diff -Nru otb-4.0.0/Applications/Classification/otbComputeConfusionMatrix.cxx otb-4.2.0/Applications/Classification/otbComputeConfusionMatrix.cxx --- otb-4.0.0/Applications/Classification/otbComputeConfusionMatrix.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Classification/otbComputeConfusionMatrix.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -216,7 +216,7 @@ void DoExecute() { - Int32ImageType* input = this->GetParameterImage ("in"); + Int32ImageType* input = this->GetParameterInt32Image("in"); std::string field; int nodata = this->GetParameterInt("nodatalabel"); @@ -228,7 +228,7 @@ if (GetParameterString("ref") == "raster") { - reference = this->GetParameterImage ("ref.raster.in"); + reference = this->GetParameterInt32Image("ref.raster.in"); } else { diff -Nru otb-4.0.0/Applications/Classification/otbSOMClassification.cxx otb-4.2.0/Applications/Classification/otbSOMClassification.cxx --- otb-4.0.0/Applications/Classification/otbSOMClassification.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Classification/otbSOMClassification.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -188,7 +188,7 @@ m_UseMask = false; if (HasValue("vm")) { - mask = GetParameterImage("vm"); + mask = GetParameterUInt16Image("vm"); if (input->GetLargestPossibleRegion() != mask->GetLargestPossibleRegion()) { diff -Nru otb-4.0.0/Applications/DisparityMap/otbBlockMatching.cxx otb-4.2.0/Applications/DisparityMap/otbBlockMatching.cxx --- otb-4.0.0/Applications/DisparityMap/otbBlockMatching.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/DisparityMap/otbBlockMatching.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -470,7 +470,7 @@ rightBandMathExpression << "if(" << rightBandMathCondition.str() << "," << state << "," << elseState << ")"; #endif - std::cout << leftBandMathCondition << std::endl; + std::cout << leftBandMathCondition.str() << std::endl; if(maskingLeft) { GetLogger()->Info("Masking criterion on left image: " + leftBandMathExpression.str() + '\n'); diff -Nru otb-4.0.0/Applications/DisparityMap/otbGeneratePlyFile.cxx otb-4.2.0/Applications/DisparityMap/otbGeneratePlyFile.cxx --- otb-4.0.0/Applications/DisparityMap/otbGeneratePlyFile.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/DisparityMap/otbGeneratePlyFile.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -98,10 +98,10 @@ { std::string outfname = GetParameterString("out"); - FloatVectorImageType::Pointer demPtr = this->GetParameterImage("indem"); + FloatVectorImageType::Pointer demPtr = this->GetParameterImage("indem"); demPtr->Update(); - FloatVectorImageType::Pointer colorPtr = this->GetParameterImage("incolor"); + FloatVectorImageType::Pointer colorPtr = this->GetParameterImage("incolor"); // First, find the footprint in the color image @@ -109,6 +109,9 @@ it.GoToBegin(); FloatImageType::IndexType lr, ul; + typedef FloatImageType::IndexType::IndexValueType IndexValueType; + lr.Fill(itk::NumericTraits::Zero); + ul.Fill(itk::NumericTraits::Zero); bool firstLoop = true; diff -Nru otb-4.0.0/Applications/DisparityMap/otbStereoFramework.cxx otb-4.2.0/Applications/DisparityMap/otbStereoFramework.cxx --- otb-4.0.0/Applications/DisparityMap/otbStereoFramework.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/DisparityMap/otbStereoFramework.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -545,8 +545,6 @@ TMetricFunctor>*subPixelFilter, TInputImage * leftImage, TInputImage * rightImage,TInputImage * leftMask,TInputImage * rightMask,TInputImage * finalMask, const bool minimize,double minDisp,double maxDisp) { typedef TMetricFunctor MetricFunctorType; - typedef otb::PixelWiseBlockMatchingImageFilter BlockMatchingFilterType; typedef otb::SubPixelDisparityImageFilter SubPixelFilterType; diff -Nru otb-4.0.0/Applications/FeatureExtraction/otbDimensionalityReduction.cxx otb-4.2.0/Applications/FeatureExtraction/otbDimensionalityReduction.cxx --- otb-4.0.0/Applications/FeatureExtraction/otbDimensionalityReduction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/FeatureExtraction/otbDimensionalityReduction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -182,7 +182,7 @@ { if (HasValue("in")) { - FloatVectorImageType::Pointer inImage = this->GetParameterImage ("in"); + FloatVectorImageType::Pointer inImage = this->GetParameterImage("in"); inImage->UpdateOutputInformation(); // Update the values of the channels to be selected @@ -211,7 +211,7 @@ } this->DisableParameter("outmatrix"); - FloatVectorImageType::Pointer inImage = this->GetParameterImage ("in"); + FloatVectorImageType::Pointer inImage = this->GetParameterImage("in"); inImage->UpdateOutputInformation(); // Update the values of the channels to be selected @@ -234,7 +234,7 @@ bool normalize = IsParameterEnabled("normalize"); bool rescale = IsParameterEnabled("rescale"); - bool invTransform = HasValue("outinv"); + bool invTransform = HasValue("outinv") && IsParameterEnabled("outinv"); switch (GetParameterInt("method")) { // PCA Algorithm diff -Nru otb-4.0.0/Applications/FeatureExtraction/otbHaralickTextureExtraction.cxx otb-4.2.0/Applications/FeatureExtraction/otbHaralickTextureExtraction.cxx --- otb-4.0.0/Applications/FeatureExtraction/otbHaralickTextureExtraction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/FeatureExtraction/otbHaralickTextureExtraction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,6 @@ #include "otbImageList.h" #include "otbImageListToVectorImageFilter.h" -#include "itkTimeProbe.h" - namespace otb { namespace Wrapper @@ -239,6 +237,7 @@ m_AdvTexFilter->SetNumberOfBinsPerAxis(GetParameterInt("parameters.nbbin")); m_AdvImageList->PushBack(m_AdvTexFilter->GetMeanOutput()); m_AdvImageList->PushBack(m_AdvTexFilter->GetVarianceOutput()); + m_AdvImageList->PushBack(m_AdvTexFilter->GetDissimilarityOutput()); m_AdvImageList->PushBack(m_AdvTexFilter->GetSumAverageOutput()); m_AdvImageList->PushBack(m_AdvTexFilter->GetSumVarianceOutput()); m_AdvImageList->PushBack(m_AdvTexFilter->GetSumEntropyOutput()); diff -Nru otb-4.0.0/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx otb-4.2.0/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx --- otb-4.0.0/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/FeatureExtraction/otbHomologousPointsExtraction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -146,17 +146,33 @@ SetParameterDescription("mode.full","Extract and match all keypoints, loading both images entirely into memory"); AddChoice("mode.geobins","Search keypoints in small spatial bins regularly spread accross first image"); - SetParameterDescription("mode.geobins","This method allows to retrieve a set of tie points regulary spread accross image 1. Corresponding bins in image 2 are retrieved using sensor and geographical information if available."); + SetParameterDescription("mode.geobins","This method allows to retrieve a set of tie points regulary spread accross image 1. Corresponding bins in image 2 are retrieved using sensor and geographical information if available. The first bin position takes into account the margin parameter. Bins are cropped to the largest image region shrinked by the margin parameter for both in1 and in2 images."); + AddParameter(ParameterType_Int,"mode.geobins.binsize","Size of bin"); SetParameterDescription("mode.geobins.binsize","Radius of the spatial bin in pixels"); SetDefaultParameterInt("mode.geobins.binsize",256); SetMinimumParameterIntValue("mode.geobins.binsize",1); + AddParameter(ParameterType_Int,"mode.geobins.binsizey","Size of bin (y direction)"); + SetParameterDescription("mode.geobins.binsizey","Radius of the spatial bin in pixels (y direction). If not set, the mode.geobins.binsize value is used."); + SetMinimumParameterIntValue("mode.geobins.binsizey",1); + MandatoryOff("mode.geobins.binsizey"); + AddParameter(ParameterType_Int,"mode.geobins.binstep","Steps between bins"); SetParameterDescription("mode.geobins.binstep","Steps between bins in pixels"); SetDefaultParameterInt("mode.geobins.binstep",256); SetMinimumParameterIntValue("mode.geobins.binstep",1); + AddParameter(ParameterType_Int,"mode.geobins.binstepy","Steps between bins (y direction)"); + SetParameterDescription("mode.geobins.binstepy","Steps between bins in pixels (y direction). If not set, the mode.geobins.binstep value is used."); + SetMinimumParameterIntValue("mode.geobins.binstepy",1); + MandatoryOff("mode.geobins.binstepy"); + + AddParameter(ParameterType_Int,"mode.geobins.margin","Margin from image border to start/end bins (in pixels)"); + SetParameterDescription("mode.geobins.margin","Margin from image border to start/end bins (in pixels)"); + SetMinimumParameterIntValue("mode.geobins.margin",0); + SetDefaultParameterInt("mode.geobins.margin",10); + AddParameter(ParameterType_Float,"precision","Estimated precision of the colocalisation function (in pixels)."); SetParameterDescription("precision","Estimated precision of the colocalisation function in pixels"); SetDefaultParameterFloat("precision",0.); @@ -360,10 +376,26 @@ { // Compute binning on first image FloatImageType::SizeType size = this->GetParameterImage("in1")->GetLargestPossibleRegion().GetSize(); - unsigned int bin_size = GetParameterInt("mode.geobins.binsize"); - unsigned int bin_step = GetParameterInt("mode.geobins.binstep"); - unsigned int nb_bins_x = size[0]/(bin_size + bin_step); - unsigned int nb_bins_y = size[1]/(bin_size + bin_step); + unsigned int bin_size_x = GetParameterInt("mode.geobins.binsize"); + unsigned int bin_size_y = bin_size_x; + + unsigned int image_border_margin = GetParameterInt("mode.geobins.margin"); + + if(IsParameterEnabled("mode.geobins.binsizey")) + { + bin_size_y = GetParameterInt("mode.geobins.binsizey"); + } + + unsigned int bin_step_x = GetParameterInt("mode.geobins.binstep"); + unsigned int bin_step_y = bin_step_x; + + if(IsParameterEnabled("mode.geobins.binstepy")) + { + bin_step_y = GetParameterInt("mode.geobins.binstepy"); + } + + unsigned int nb_bins_x = static_cast(vcl_ceil(static_cast(size[0]-2*image_border_margin)/(bin_size_x + bin_step_x))); + unsigned int nb_bins_y = static_cast(vcl_ceil(static_cast(size[1]-2*image_border_margin)/(bin_size_y + bin_step_y))); FloatImageType::SpacingType spacing1 = this->GetParameterImage("in1")->GetSpacing(); FloatImageType::PointType origin1 = this->GetParameterImage("in1")->GetOrigin(); @@ -374,8 +406,8 @@ { for(unsigned int j = 0; jGetParameterImage("in1")->GetLargestPossibleRegion()); + FloatImageType::RegionType largestRegion = this->GetParameterImage("in1")->GetLargestPossibleRegion(); + + largestRegion.ShrinkByRadius(image_border_margin); + region1.Crop(largestRegion); otbAppLogINFO("("<TransformPoint(ul1); p2 = rsTransform->TransformPoint(ur1); @@ -444,7 +479,10 @@ region2.SetSize(size2); region2.PadByRadius(static_cast(GetParameterInt("precision"))); - if(region2.Crop(this->GetParameterImage("in2")->GetLargestPossibleRegion())) + FloatImageType::RegionType largestRegion2 = this->GetParameterImage("in2")->GetLargestPossibleRegion(); + largestRegion2.ShrinkByRadius(image_border_margin); + + if(region2.Crop(largestRegion2)) { otbAppLogINFO("Corresponding region2 is "< StreamingStatisticsVectorImageFilterType; typedef otb::UnConstrainedLeastSquareImageFilter UCLSUnmixingFilterType; @@ -150,8 +147,8 @@ { m_ProcessObjects.clear(); - DoubleVectorImageType::Pointer inputImage = GetParameterImage("in"); - DoubleVectorImageType::Pointer endmembersImage = GetParameterImage("ie"); + DoubleVectorImageType::Pointer inputImage = GetParameterDoubleVectorImage("in"); + DoubleVectorImageType::Pointer endmembersImage = GetParameterDoubleVectorImage("ie"); /* * Transform Endmembers image to matrix representation diff -Nru otb-4.0.0/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx otb-4.2.0/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx --- otb-4.0.0/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Hyperspectral/otbVertexComponentAnalysis.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,13 +21,11 @@ #include "otbVcaImageFilter.h" #include "otbVectorImageToMatrixImageFilter.h" - namespace otb { namespace Wrapper { -const unsigned int Dimension = 2; typedef otb::VCAImageFilter VCAFilterType; typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; @@ -88,7 +86,7 @@ void DoExecute() { - DoubleVectorImageType::Pointer inputImage = GetParameterImage("in"); + DoubleVectorImageType::Pointer inputImage = GetParameterDoubleVectorImage("in"); DoubleVectorImageType::Pointer endmembersImage; const unsigned int nbEndmembers = GetParameterInt("ne"); diff -Nru otb-4.0.0/Applications/Projections/CMakeLists.txt otb-4.2.0/Applications/Projections/CMakeLists.txt --- otb-4.0.0/Applications/Projections/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Projections/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,11 +1,11 @@ OTB_CREATE_APPLICATION(NAME BundleToPerfectSensor SOURCES otbBundleToPerfectSensor.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBBasicFilters;OTBProjections) OTB_CREATE_APPLICATION(NAME OrthoRectification SOURCES otbOrthoRectification.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBBasicFilters;OTBProjections) OTB_CREATE_APPLICATION(NAME RigidTransformResample SOURCES otbRigidTransformResample.cxx @@ -13,23 +13,23 @@ OTB_CREATE_APPLICATION(NAME Superimpose SOURCES otbSuperimpose.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBBasicFilters;OTBProjections) OTB_CREATE_APPLICATION(NAME ConvertCartoToGeoPoint SOURCES otbConvertCartoToGeoPoint.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBBasicFilters;OTBProjections) OTB_CREATE_APPLICATION(NAME ImageEnvelope SOURCES otbImageEnvelope.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBBasicFilters;OTBProjections) OTB_CREATE_APPLICATION(NAME ObtainUTMZoneFromGeoPoint SOURCES otbObtainUTMZoneFromGeoPoint.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBBasicFilters;OTBProjections) OTB_CREATE_APPLICATION(NAME ConvertSensorToGeoPoint SOURCES otbConvertSensorToGeoPoint.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBBasicFilters;OTBProjections) OTB_CREATE_APPLICATION(NAME GridBasedImageResampling SOURCES otbGridBasedImageResampling.cxx diff -Nru otb-4.0.0/Applications/Projections/otbBundleToPerfectSensor.cxx otb-4.2.0/Applications/Projections/otbBundleToPerfectSensor.cxx --- otb-4.0.0/Applications/Projections/otbBundleToPerfectSensor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Projections/otbBundleToPerfectSensor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbWrapperApplication.h" #include "otbWrapperApplicationFactory.h" -#include "itkVectorIndexSelectionCastImageFilter.h" +#include "otbMultiToMonoChannelExtractROI.h" #include "otbGenericRSResampleImageFilter.h" #include "otbBCOInterpolateImageFunction.h" #include "otbSimpleRcsPanSharpeningFusionImageFilter.h" @@ -27,12 +27,13 @@ // Elevation handler #include "otbWrapperElevationParametersHandler.h" +#include "otbStreamingResampleImageFilter.h" +#include "otbPleiadesPToXSAffineTransformCalculator.h" + namespace otb { namespace Wrapper { - - class BundleToPerfectSensor : public Application { public: @@ -56,7 +57,7 @@ // Documentation SetDocName("Bundle to perfect sensor"); - SetDocLongDescription("This application performs P+XS pansharpening."); + SetDocLongDescription("This application performs P+XS pansharpening. The default mode use Pan and XS sensor models to estimate the transformation to superimpose XS over Pan before the fusion (\"default mode\"). The application provides also a PHR mode for Pleiades images which does not use sensor models as Pan and XS products are already coregistered but only estimate an affine transformation to superimpose XS over the Pan.Note that this option is automatically activated in case Pleiades images are detected as input."); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); @@ -72,6 +73,20 @@ // Elevation ElevationParametersHandler::AddElevationParameters(this, "elev"); + // Superposition mode + AddParameter(ParameterType_Choice,"mode", "Mode"); + SetParameterDescription("mode", "Superimposition mode"); + + AddChoice("mode.default", "Default mode"); + SetParameterDescription("mode.default", "Default superimposition mode : " + "uses any projection reference or sensor model found in the images"); + + AddChoice("mode.phr", "Pleiades mode"); + SetParameterDescription("mode.phr", "Pleiades superimposition mode, " + "designed for the case of a P+XS bundle in SENSOR geometry. It uses" + " a simple transform on the XS image : a scaling and a residual " + "translation."); + AddParameter(ParameterType_Float, "lms", "Spacing of the deformation field"); SetParameterDescription("lms"," Spacing of the deformation field. Default is 10 times the PAN image spacing."); AddParameter(ParameterType_OutputImage, "out", "Output image"); @@ -89,12 +104,18 @@ void DoUpdateParameters() { - // Nothing to do here : all parameters are independent + if(HasValue("inp") && HasValue("inxs") && otb::PleiadesPToXSAffineTransformCalculator::CanCompute(GetParameterImage("inp"),GetParameterImage("inxs"))) + { + otbAppLogWARNING("Forcing PHR mode with PHR data. You need to add \"-mode default\" to force the default mode with PHR images."); + SetParameterString("mode","phr"); + } } void DoExecute() { FloatVectorImageType* panchroV = GetParameterImage("inp"); + FloatVectorImageType* xs = GetParameterImage("inxs"); + if ( panchroV->GetNumberOfComponentsPerPixel() != 1 ) { itkExceptionMacro(<< "The panchromatic image must be a single channel image") @@ -102,29 +123,36 @@ // Transform the PAN image to otb::Image typedef otb::Image FloatImageType; - typedef itk::VectorIndexSelectionCastImageFilter VectorIndexSelectionCastImageFilterType; + typedef otb::MultiToMonoChannelExtractROI ExtractFilterType; - VectorIndexSelectionCastImageFilterType::Pointer channelSelect = VectorIndexSelectionCastImageFilterType::New(); + ExtractFilterType::Pointer channelSelect = ExtractFilterType::New(); m_Ref.push_back(channelSelect.GetPointer()); - channelSelect->SetIndex(0); + channelSelect->SetChannel(1); channelSelect->SetInput(panchroV); channelSelect->UpdateOutputInformation(); FloatImageType::Pointer panchro = channelSelect->GetOutput(); - - FloatVectorImageType* xs = GetParameterImage("inxs"); - typedef otb::BCOInterpolateImageFunction InterpolatorType; typedef otb::GenericRSResampleImageFilter ResamplerType; + typedef otb::StreamingResampleImageFilter BasicResamplerType; typedef otb::SimpleRcsPanSharpeningFusionImageFilter FusionFilterType; // Resample filter ResamplerType::Pointer resampler = ResamplerType::New(); m_Ref.push_back(resampler.GetPointer()); + + BasicResamplerType::Pointer basicResampler = BasicResamplerType::New(); + m_Ref.push_back(basicResampler.GetPointer()); InterpolatorType::Pointer interpolator = InterpolatorType::New(); resampler->SetInterpolator(interpolator); + basicResampler->SetInterpolator(interpolator); + // Fusion filter + FusionFilterType::Pointer fusionFilter = FusionFilterType::New(); + m_Ref.push_back(fusionFilter.GetPointer()); + fusionFilter->SetPanInput(panchro); + // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); @@ -134,47 +162,71 @@ FloatVectorImageType::SizeType size = panchro->GetLargestPossibleRegion().GetSize(); FloatVectorImageType::PointType origin = panchro->GetOrigin(); - if(IsParameterEnabled("lms") && HasValue("lms")) - { - double defScalarSpacing = GetParameterFloat("lms"); - otbAppLogINFO(<< "Generating coarse deformation field (spacing="<::SetLength(defaultValue, xs->GetNumberOfComponentsPerPixel()); - resampler->SetDisplacementFieldSpacing(defSpacing); + if(GetParameterString("mode") == "default") + { + otbAppLogINFO("Using the default mode"); + if(IsParameterEnabled("lms") && HasValue("lms")) + { + double defScalarSpacing = GetParameterFloat("lms"); + otbAppLogINFO(<< "Generating coarse deformation field (spacing="<SetDisplacementFieldSpacing(defSpacing); + } + else + { + FloatVectorImageType::SpacingType defSpacing; + defSpacing[0]=10*spacing[0]; + defSpacing[1]=10*spacing[1]; + resampler->SetDisplacementFieldSpacing(defSpacing); + } + + resampler->SetInput(xs); + resampler->SetOutputOrigin(origin); + resampler->SetOutputSpacing(spacing); + resampler->SetOutputSize(size); + resampler->SetOutputStartIndex(start); + resampler->SetOutputKeywordList(panchro->GetImageKeywordlist()); + resampler->SetOutputProjectionRef(panchro->GetProjectionRef()); + resampler->SetEdgePaddingValue(defaultValue); + fusionFilter->SetXsInput(resampler->GetOutput()); + } + else if(GetParameterString("mode")=="phr") + { + otbAppLogINFO("Using the PHR mode"); + + otb::PleiadesPToXSAffineTransformCalculator::TransformType::Pointer transform + = otb::PleiadesPToXSAffineTransformCalculator::Compute(panchro, xs); + + basicResampler->SetInput(xs); + basicResampler->SetTransform(transform); + basicResampler->SetOutputOrigin(origin); + basicResampler->SetOutputSpacing(spacing); + basicResampler->SetOutputSize(size); + basicResampler->SetOutputStartIndex(start); + basicResampler->SetEdgePaddingValue(defaultValue); + + fusionFilter->SetXsInput(basicResampler->GetOutput()); + + // Set the profRef & Keywordlist from Pan into the resampled XS image + basicResampler->UpdateOutputInformation(); + itk::MetaDataDictionary& dict = basicResampler->GetOutput()->GetMetaDataDictionary(); + itk::EncapsulateMetaData(dict, MetaDataKey::ProjectionRefKey, + panchro->GetProjectionRef()); + itk::EncapsulateMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, + panchro->GetImageKeywordlist()); } else { - FloatVectorImageType::SpacingType defSpacing; - defSpacing[0]=10*spacing[0]; - defSpacing[1]=10*spacing[1]; - resampler->SetDisplacementFieldSpacing(defSpacing); + otbAppLogWARNING("Unknown mode"); } - - FloatVectorImageType::PixelType defaultValue; - itk::NumericTraits::SetLength(defaultValue, xs->GetNumberOfComponentsPerPixel()); - - resampler->SetInput(xs); - resampler->SetOutputOrigin(origin); - resampler->SetOutputSpacing(spacing); - resampler->SetOutputSize(size); - resampler->SetOutputStartIndex(start); - resampler->SetOutputKeywordList(panchro->GetImageKeywordlist()); - resampler->SetOutputProjectionRef(panchro->GetProjectionRef()); - resampler->SetEdgePaddingValue(defaultValue); - - resampler->UpdateOutputInformation(); - FloatVectorImageType::Pointer xsResample = resampler->GetOutput(); - - FusionFilterType::Pointer fusionFilter = FusionFilterType::New(); - m_Ref.push_back(fusionFilter.GetPointer()); - - fusionFilter->SetPanInput(panchro); - fusionFilter->SetXsInput(resampler->GetOutput()); - fusionFilter->UpdateOutputInformation(); - + SetParameterOutputImage("out", fusionFilter->GetOutput()); } diff -Nru otb-4.0.0/Applications/Projections/otbOrthoRectification.cxx otb-4.2.0/Applications/Projections/otbOrthoRectification.cxx --- otb-4.0.0/Applications/Projections/otbOrthoRectification.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Projections/otbOrthoRectification.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -265,14 +265,6 @@ genericRSEstimator->Compute(); // Fill the Gui with the computed parameters - if (!HasUserValue("outputs.ulx")) - { - SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0]); - } - - if (!HasUserValue("outputs.uly")) - SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1]); - if (!HasUserValue("outputs.sizex")) SetParameterInt("outputs.sizex", genericRSEstimator->GetOutputSize()[0]); @@ -285,6 +277,12 @@ if (!HasUserValue("outputs.spacingy")) SetParameterFloat("outputs.spacingy", genericRSEstimator->GetOutputSpacing()[1]); + if (!HasUserValue("outputs.ulx")) + SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); + + if (!HasUserValue("outputs.uly")) + SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); + if (!HasUserValue("outputs.lrx")) SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast(GetParameterInt("outputs.sizex"))); @@ -380,8 +378,8 @@ SetParameterInt("outputs.sizey", genericRSEstimator->GetOutputSize()[1]); // Reset Origin to default - SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0]); - SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1]); + SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); + SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); // Update lower right SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast(GetParameterInt("outputs.sizex"))); @@ -434,8 +432,8 @@ SetParameterFloat("outputs.spacingy", genericRSEstimator->GetOutputSpacing()[1]); // Reset Origin to default - SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0]); - SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1]); + SetParameterFloat("outputs.ulx", genericRSEstimator->GetOutputOrigin()[0] - 0.5 * genericRSEstimator->GetOutputSpacing()[0]); + SetParameterFloat("outputs.uly", genericRSEstimator->GetOutputOrigin()[1] - 0.5 * genericRSEstimator->GetOutputSpacing()[1]); // Update lower right SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast(GetParameterInt("outputs.sizex"))); @@ -535,8 +533,8 @@ SetParameterInt("outputs.sizey",size[1]); SetParameterFloat("outputs.spacingx",spacing[0]); SetParameterFloat("outputs.spacingy",spacing[1]); - SetParameterFloat("outputs.ulx", orig[0]); - SetParameterFloat("outputs.uly", orig[1]); + SetParameterFloat("outputs.ulx", orig[0] - 0.5 * spacing[0]); + SetParameterFloat("outputs.uly", orig[1] - 0.5 * spacing[1]); // Update lower right SetParameterFloat("outputs.lrx", GetParameterFloat("outputs.ulx") + GetParameterFloat("outputs.spacingx") * static_cast(GetParameterInt("outputs.sizex"))); SetParameterFloat("outputs.lry", GetParameterFloat("outputs.uly") + GetParameterFloat("outputs.spacingy") * static_cast(GetParameterInt("outputs.sizey"))); @@ -674,11 +672,11 @@ m_ResampleFilter->SetOutputSpacing(spacing); otbAppLogINFO("Generating output with pixel spacing = " << spacing); - ResampleFilterType::OriginType ul; - ul[0] = GetParameterFloat("outputs.ulx"); - ul[1] = GetParameterFloat("outputs.uly"); - m_ResampleFilter->SetOutputOrigin(ul); - otbAppLogINFO("Generating output with origin = " << ul); + ResampleFilterType::OriginType origin; + origin[0] = GetParameterFloat("outputs.ulx") + 0.5 * GetParameterFloat("outputs.spacingx"); + origin[1] = GetParameterFloat("outputs.uly") + 0.5 * GetParameterFloat("outputs.spacingy"); + m_ResampleFilter->SetOutputOrigin(origin); + otbAppLogINFO("Generating output with origin = " << origin); // Build the default pixel FloatVectorImageType::PixelType defaultValue; diff -Nru otb-4.0.0/Applications/Projections/otbRigidTransformResample.cxx otb-4.2.0/Applications/Projections/otbRigidTransformResample.cxx --- otb-4.0.0/Applications/Projections/otbRigidTransformResample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Projections/otbRigidTransformResample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -230,12 +230,18 @@ // Evaluate spacing FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing(); FloatVectorImageType::SpacingType OutputSpacing; - OutputSpacing=spacing; - OutputSpacing[0] = spacing[0] * scale[0]; OutputSpacing[1] = spacing[1] * scale[1]; m_Resampler->SetOutputSpacing(OutputSpacing); + + FloatVectorImageType::PointType origin = inputImage->GetOrigin(); + FloatVectorImageType::PointType outputOrigin; + outputOrigin[0] = origin[0] + 0.5 * spacing[0] * (scale[0] - 1.0); + outputOrigin[1] = origin[1] + 0.5 * spacing[1] * (scale[1] - 1.0); + + m_Resampler->SetOutputOrigin(outputOrigin); + m_Resampler->SetTransform(transform); // Evaluate size @@ -267,13 +273,18 @@ // Evaluate spacing FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing(); FloatVectorImageType::SpacingType OutputSpacing; - OutputSpacing=spacing; - OutputSpacing[0] = spacing[0] * scale[0]; OutputSpacing[1] = spacing[1] * scale[1]; m_Resampler->SetOutputSpacing(OutputSpacing); + FloatVectorImageType::PointType origin = inputImage->GetOrigin(); + FloatVectorImageType::PointType outputOrigin; + outputOrigin[0] = origin[0] + 0.5 * spacing[0] * (scale[0] - 1.0); + outputOrigin[1] = origin[1] + 0.5 * spacing[1] * (scale[1] - 1.0); + + m_Resampler->SetOutputOrigin(outputOrigin); + ResampleFilterType::SizeType recomputedSize; recomputedSize[0] = inputImage->GetLargestPossibleRegion().GetSize()[0] / scale[0]; recomputedSize[1] = inputImage->GetLargestPossibleRegion().GetSize()[1] / scale[1]; @@ -290,34 +301,33 @@ { ScalableTransformType::Pointer transform = ScalableTransformType::New(); - FloatVectorImageType::IndexType origin = inputImage->GetLargestPossibleRegion().GetIndex(); + FloatVectorImageType::SizeType inSize = inputImage->GetLargestPossibleRegion().GetSize(); FloatVectorImageType::SpacingType spacing = inputImage->GetSpacing(); - FloatVectorImageType::IndexType center; - center[0] = origin[0] + inputImage->GetLargestPossibleRegion().GetSize()[0] / 2.0; - center[1] = origin[1] + inputImage->GetLargestPossibleRegion().GetSize()[1] / 2.0; - + itk::ContinuousIndex ULindex(inputImage->GetLargestPossibleRegion().GetIndex()); + ULindex[0] += -0.5; + ULindex[1] += -0.5; + itk::ContinuousIndex center, URindex, LRindex, LLindex; + center[0] = ULindex[0] + static_cast(inSize[0]) / 2.0; + center[1] = ULindex[1] + static_cast(inSize[1]) / 2.0; + + URindex = ULindex; + LRindex = ULindex; + LLindex = ULindex; + URindex[0] += inSize[0]; + LRindex[0] += inSize[0]; + LRindex[1] += inSize[1]; + LLindex[1] += inSize[1]; FloatVectorImageType::PointType centerPoint; - inputImage->TransformIndexToPhysicalPoint(center, centerPoint); + inputImage->TransformContinuousIndexToPhysicalPoint(center, centerPoint); //image boundary - FloatVectorImageType::IndexType ULindex, URindex, LRindex, LLindex; - - ULindex[0]=origin[0]; - ULindex[1]=origin[1]; - URindex[0]=origin[0]+ inputImage->GetLargestPossibleRegion().GetSize()[0]; - URindex[1]=origin[1]; - LRindex[0]=origin[0]+ inputImage->GetLargestPossibleRegion().GetSize()[0]; - LRindex[1]=origin[1]+ inputImage->GetLargestPossibleRegion().GetSize()[1]; - LLindex[0]=origin[0]; - LLindex[1]=origin[1]+ inputImage->GetLargestPossibleRegion().GetSize()[1]; - - FloatVectorImageType::PointType orig, ULpoint, URpoint, LRpoint, LLpoint; - inputImage->TransformIndexToPhysicalPoint(ULindex, ULpoint); - inputImage->TransformIndexToPhysicalPoint(URindex, URpoint); - inputImage->TransformIndexToPhysicalPoint(LRindex, LRpoint); - inputImage->TransformIndexToPhysicalPoint(LLindex, LLpoint); + FloatVectorImageType::PointType ULpoint, URpoint, LRpoint, LLpoint; + inputImage->TransformContinuousIndexToPhysicalPoint(ULindex, ULpoint); + inputImage->TransformContinuousIndexToPhysicalPoint(URindex, URpoint); + inputImage->TransformContinuousIndexToPhysicalPoint(LRindex, LRpoint); + inputImage->TransformContinuousIndexToPhysicalPoint(LLindex, LLpoint); // Scale Transform OutputVectorType scale; @@ -344,13 +354,11 @@ m_Resampler->SetTransform(transform); - FloatVectorImageType::PointType ULpointTrans, URpointTrans, LRpointTrans, LLpointTrans, CenterPointTrans; - + FloatVectorImageType::PointType ULpointTrans, URpointTrans, LRpointTrans, LLpointTrans; ULpointTrans=inverseTransform->TransformPoint(ULpoint); URpointTrans=inverseTransform->TransformPoint(URpoint); LRpointTrans=inverseTransform->TransformPoint(LRpoint); LLpointTrans=inverseTransform->TransformPoint(LLpoint); - CenterPointTrans=inverseTransform->TransformPoint(centerPoint); //compute min and max std::vector voutput; @@ -364,7 +372,7 @@ double minY = voutput[0][1]; double maxY = voutput[0][1]; - for(unsigned int i = 0; i voutput[i][0] ) @@ -387,16 +395,15 @@ } } - if( spacing[0] > 0 ) orig[0] = minX; - else orig[0] = maxX; - - if( spacing[1] > 0 ) orig[1] = minY; - else orig[1] = maxY; + FloatVectorImageType::PointType outputOrig; + if( spacing[0] > 0 ) outputOrig[0] = minX; + else outputOrig[0] = maxX; - m_Resampler->SetOutputOrigin(orig); + if( spacing[1] > 0 ) outputOrig[1] = minY; + else outputOrig[1] = maxY; //size of output image - ResampleFilterType::SizeType size; + FloatVectorImageType::PointType size; size[0]=vcl_abs(maxX-minX); size[1]=vcl_abs(maxY-minY); @@ -407,6 +414,10 @@ m_Resampler->SetOutputSpacing(OutputSpacing); + outputOrig[0] += 0.5 * OutputSpacing[0]; + outputOrig[1] += 0.5 * OutputSpacing[1]; + m_Resampler->SetOutputOrigin(outputOrig); + // Evaluate size ResampleFilterType::SizeType recomputedSize; recomputedSize[0] = static_cast(vcl_floor(vcl_abs(size[0]/OutputSpacing[0]))); diff -Nru otb-4.0.0/Applications/Projections/otbSuperimpose.cxx otb-4.2.0/Applications/Projections/otbSuperimpose.cxx --- otb-4.0.0/Applications/Projections/otbSuperimpose.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Projections/otbSuperimpose.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,6 +26,8 @@ // Elevation handler #include "otbWrapperElevationParametersHandler.h" +#include "otbStreamingResampleImageFilter.h" +#include "otbPleiadesPToXSAffineTransformCalculator.h" namespace otb { @@ -68,6 +70,12 @@ typedef otb::GenericRSResampleImageFilter ResamplerType; + typedef itk::ScalableAffineTransform TransformType; + + typedef otb::StreamingResampleImageFilter + BasicResamplerType; + private: void DoInit() { @@ -100,6 +108,20 @@ AddParameter(ParameterType_OutputImage, "out", "Output image"); SetParameterDescription("out","Output reprojected image."); + // Superposition mode + AddParameter(ParameterType_Choice,"mode", "Mode"); + SetParameterDescription("mode", "Superimposition mode"); + + AddChoice("mode.default", "Default mode"); + SetParameterDescription("mode.default", "Default superimposition mode : " + "uses any projection reference or sensor model found in the images"); + + AddChoice("mode.phr", "Pleiades mode"); + SetParameterDescription("mode.phr", "Pleiades superimposition mode, " + "designed for the case of a P+XS bundle in SENSOR geometry. It uses" + " a simple transform on the XS image : a scaling and a residual " + "translation."); + // Interpolators AddParameter(ParameterType_Choice, "interpolator", "Interpolation"); SetParameterDescription("interpolator","This group of parameters allows to define how the input image will be interpolated during resampling."); @@ -116,8 +138,7 @@ AddChoice("interpolator.linear", "Linear interpolation"); SetParameterDescription("interpolator.linear","Linear interpolation leads to average image quality but is quite fast"); - - + AddRAMParameter(); // Doc example parameter settings @@ -128,7 +149,11 @@ void DoUpdateParameters() { - // Nothing to do here : all parameters are independent + if(HasValue("inr") && HasValue("inm") && otb::PleiadesPToXSAffineTransformCalculator::CanCompute(GetParameterImage("inr"),GetParameterImage("inm"))) + { + otbAppLogWARNING("Forcing PHR mode with PHR data. You need to add \"-mode default\" to force the default mode with PHR images."); + SetParameterString("mode","phr"); + } } @@ -140,6 +165,8 @@ // Resample filter m_Resampler = ResamplerType::New(); + + m_BasicResampler = BasicResamplerType::New(); // Get Interpolator switch ( GetParameterInt("interpolator") ) @@ -148,12 +175,14 @@ { LinInterpolatorType::Pointer interpolator = LinInterpolatorType::New(); m_Resampler->SetInterpolator(interpolator); + m_BasicResampler->SetInterpolator(interpolator); } break; case Interpolator_NNeighbor: { NNInterpolatorType::Pointer interpolator = NNInterpolatorType::New(); m_Resampler->SetInterpolator(interpolator); + m_BasicResampler->SetInterpolator(interpolator); } break; case Interpolator_BCO: @@ -161,6 +190,7 @@ BCOInterpolatorType::Pointer interpolator = BCOInterpolatorType::New(); interpolator->SetRadius(GetParameterInt("interpolator.bco.radius")); m_Resampler->SetInterpolator(interpolator); + m_BasicResampler->SetInterpolator(interpolator); } break; } @@ -174,41 +204,79 @@ FloatVectorImageType::IndexType start = refImage->GetLargestPossibleRegion().GetIndex(); FloatVectorImageType::SizeType size = refImage->GetLargestPossibleRegion().GetSize(); FloatVectorImageType::PointType origin = refImage->GetOrigin(); + + FloatVectorImageType::PixelType defaultValue; + itk::NumericTraits::SetLength(defaultValue, movingImage->GetNumberOfComponentsPerPixel()); - if(IsParameterEnabled("lms")) + + if(GetParameterString("mode")=="default") { - float defScalarSpacing = vcl_abs(GetParameterFloat("lms")); - otbAppLogDEBUG("Generating coarse deformation field (spacing="<SetDisplacementFieldSpacing(defSpacing); + } + + // Setup transform through projRef and Keywordlist + m_Resampler->SetInputKeywordList(movingImage->GetImageKeywordlist()); + m_Resampler->SetInputProjectionRef(movingImage->GetProjectionRef()); + + m_Resampler->SetOutputKeywordList(refImage->GetImageKeywordlist()); + m_Resampler->SetOutputProjectionRef(refImage->GetProjectionRef()); + + m_Resampler->SetInput(movingImage); + + m_Resampler->SetOutputOrigin(origin); + m_Resampler->SetOutputSpacing(spacing); + m_Resampler->SetOutputSize(size); + m_Resampler->SetOutputStartIndex(start); + + m_Resampler->SetEdgePaddingValue(defaultValue); - m_Resampler->SetDisplacementFieldSpacing(defSpacing); + // Set the output image + SetParameterOutputImage("out", m_Resampler->GetOutput()); } + else if(GetParameterString("mode")=="phr") + { + otbAppLogINFO("Using the PHR mode"); + + otb::PleiadesPToXSAffineTransformCalculator::TransformType::Pointer transform + = otb::PleiadesPToXSAffineTransformCalculator::Compute(GetParameterImage("inr"), + GetParameterImage("inm")); + + m_BasicResampler->SetTransform(transform); + + m_BasicResampler->SetInput(movingImage); + + m_BasicResampler->SetOutputOrigin(origin); + m_BasicResampler->SetOutputSpacing(spacing); + m_BasicResampler->SetOutputSize(size); + m_BasicResampler->SetOutputStartIndex(start); + + m_BasicResampler->SetEdgePaddingValue(defaultValue); - FloatVectorImageType::PixelType defaultValue; - itk::NumericTraits::SetLength(defaultValue, movingImage->GetNumberOfComponentsPerPixel()); - - m_Resampler->SetInput(movingImage); - m_Resampler->SetInputKeywordList(movingImage->GetImageKeywordlist()); - m_Resampler->SetInputProjectionRef(movingImage->GetProjectionRef()); - m_Resampler->SetOutputOrigin(origin); - m_Resampler->SetOutputSpacing(spacing); - m_Resampler->SetOutputSize(size); - m_Resampler->SetOutputStartIndex(start); - m_Resampler->SetOutputKeywordList(refImage->GetImageKeywordlist()); - m_Resampler->SetOutputProjectionRef(refImage->GetProjectionRef()); - m_Resampler->SetEdgePaddingValue(defaultValue); - - // Set the output image - SetParameterOutputImage("out", m_Resampler->GetOutput()); + // Set the output image + SetParameterOutputImage("out", m_BasicResampler->GetOutput()); + } + else + { + otbAppLogWARNING("Unknown mode"); + } } - + ResamplerType::Pointer m_Resampler; + + BasicResamplerType::Pointer m_BasicResampler; + }; } // end namespace Wrapper diff -Nru otb-4.0.0/Applications/Radiometry/otbOpticalCalibration.cxx otb-4.2.0/Applications/Radiometry/otbOpticalCalibration.cxx --- otb-4.0.0/Applications/Radiometry/otbOpticalCalibration.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Radiometry/otbOpticalCalibration.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,19 +20,32 @@ #include "otbImageToLuminanceImageFilter.h" #include "otbLuminanceToReflectanceImageFilter.h" +#include "otbLuminanceToImageImageFilter.h" +#include "otbReflectanceToLuminanceImageFilter.h" #include "otbReflectanceToSurfaceReflectanceImageFilter.h" -#include "otbMultiplyByScalarImageFilter.h" +#include "itkMultiplyImageFilter.h" #include "otbClampVectorImageFilter.h" -#include "otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h" +#include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" #include "otbGroundSpacingImageFunction.h" #include "vnl/vnl_random.h" +#include "itkMetaDataDictionary.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" +#include "otbOpticalImageMetadataInterface.h" + +#include +#include +#include +#include + + namespace otb { enum { - Level_TOA, + Level_IM_TOA, + Level_TOA_IM, Level_TOC }; @@ -63,45 +76,109 @@ itkTypeMacro(OpticalCalibration, Application); - typedef ImageToLuminanceImageFilter ImageToLuminanceImageFilterType; typedef LuminanceToReflectanceImageFilter LuminanceToReflectanceImageFilterType; - typedef otb::MultiplyByScalarImageFilter ScaleFilterType; + typedef LuminanceToImageImageFilter LuminanceToImageImageFilterType; + + typedef ReflectanceToLuminanceImageFilter ReflectanceToLuminanceImageFilterType; + + typedef itk::MultiplyImageFilter ScaleFilterOutDoubleType; typedef otb::ClampVectorImageFilter ClampFilterType; typedef ReflectanceToSurfaceReflectanceImageFilter ReflectanceToSurfaceReflectanceImageFilterType; + DoubleVectorImageType> ReflectanceToSurfaceReflectanceImageFilterType; typedef ReflectanceToSurfaceReflectanceImageFilterType::FilterFunctionValuesType FilterFunctionValuesType; typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; - typedef AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; - typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; + //typedef AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; chris + //typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; chris + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef otb::AtmosphericCorrectionParameters::Pointer AtmoCorrectionParametersPointerType; + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef otb::ImageMetadataCorrectionParameters::Pointer AcquiCorrectionParametersPointerType; - typedef otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType; + typedef otb::SurfaceAdjacencyEffectCorrectionSchemeFilter + SurfaceAdjacencyEffectCorrectionSchemeFilterType; - typedef otb::GroundSpacingImageFunction GroundSpacingImageType; + typedef otb::GroundSpacingImageFunction GroundSpacingImageType; - typedef UInt16VectorImageType::IndexType IndexType; + typedef DoubleVectorImageType::IndexType IndexType; typedef GroundSpacingImageType::FloatType FloatType; typedef GroundSpacingImageType::ValueType ValueType; - typedef IndexType::IndexValueType IndexValueType; + typedef IndexType::IndexValueType IndexValueType; private: + + string m_inImageName; + bool m_currentEnabledStateOfFluxParam; + void DoInit() { SetName("OpticalCalibration"); - SetDescription("Perform optical calibration TOA/TOC (Top Of Atmosphere/Top Of Canopy). Supported sensors: QuickBird, Ikonos, WorldView2, Formosat, Spot5, Pleiades"); + SetDescription("Perform optical calibration TOA/TOC (Top Of Atmosphere/Top Of Canopy). Supported sensors: QuickBird, Ikonos, WorldView2, Formosat, Spot5, Pleiades, Spot6. For other sensors the application also allows to provide calibration parameters manually."); // Documentation SetDocName("Optical calibration"); - SetDocLongDescription("The application allows to convert pixel values from DN (for Digital Numbers) to physically interpretable and comparable values. Calibrated values are called surface reflectivity and its values lie in the range [0, 1].\nThe first level is called Top Of Atmosphere (TOA) reflectivity. It takes into account the sensor gain, sensor spectral response and the solar illumination.\nThe second level is called Top Of Canopy (TOC) reflectivity. In addition to sensor gain and solar illumination, it takes into account the optical thickness of the atmosphere, the atmospheric pressure, the water vapor amount, the ozone amount, as well as the composition and amount of aerosol gasses.\nIt is also possible to indicate an AERONET file which contains atmospheric parameters (version 1 and version 2 of Aeronet file are supported."); + SetDocLongDescription("The application allows to convert pixel values from DN (for Digital Numbers) to physically interpretable and comparable values. Calibrated values are called surface reflectivity and its values lie in the range [0, 1].\nThe first level is called Top Of Atmosphere (TOA) reflectivity. It takes into account the sensor gain, sensor spectral response and the solar illuminations.\nThe second level is called Top Of Canopy (TOC) reflectivity. In addition to sensor gain and solar illuminations, it takes into account the optical thickness of the atmosphere, the atmospheric pressure, the water vapor amount, the ozone amount, as well as the composition and amount of aerosol gasses.\nIt is also possible to indicate an AERONET file which contains atmospheric parameters (version 1 and version 2 of Aeronet file are supported.\n" +"\n--------------------------\n\n" +"If the sensor is not supported by the metadata interface factory of OTB, users still have the possibility to give the needed parameters to the application.\n" +"For TOA conversion, these parameters are : \n" +"- day and month of acquisition, or flux normalization coefficient;\n" +"- sun elevation angle;\n" +"- gains and biases, one pair of values for each band (passed by a file);\n" +"- solar illuminations, one value for each band (passed by a file).\n\n" +"For the conversion from DN (for Digital Numbers) to spectral radiance (or 'TOA radiance') L, the following formula is used :\n\n" + +"(1)\tL(b) = DN(b)/gain(b)+bias(b)\t(in W/m2/steradians/micrometers)\twith b being a band ID.\n\n" + +"These values are provided by the user thanks to a simple txt file with two lines, one for the gains and one for the biases.\n" +"Each value must be separated with colons (:), with eventual spaces. Blank lines are not allowed. If a line begins with the '#' symbol, then it is considered as comments.\n" +"Note that sometimes, the values provided by certain metadata files assume the formula L(b) = gain(b)*DC(b)+bias(b).\n" +"In this case, be sure to provide the inverse gain values so that the application can correctly interpret them.\n\n" + +"In order to convert TOA radiance to TOA reflectance, the following formula is used :\n\n" + +"(2)\tR(b) = (pi*L(b)*d*d) / (ESUN(b)*cos(θ))\t(no dimension)\twhere : \n\n" + +"- L(b) is the spectral radiance for band b \n" +"- pi is the famous mathematical constant (3.14159...) \n" +"- d is the earth-sun distance (in astronomical units) and depends on the acquisition's day and month \n" +"- ESUN(b) is the mean TOA solar irradiance (or solar illumination) in W/m²/micrometers\n" +"- θ is the solar zenith angle in degrees. \n" +"Note that the application asks for the solar elevation angle, and will perfom the conversion to the zenith angle itself (ze. angle = 90° - el. angle).\n" +"Note also that ESUN(b) not only depends on the band b, but also on the spectral sensitivity of the sensor in this particular band. " +"In other words, the influence of spectral sensitivities is included within the ESUN different values.\n" +"These values are provided by the user thanks to a txt file following the same convention as before.\n" +"Instead of providing the date of acquisition, the user can also provide a flux normalization coefficient 'fn'. " +"The formula used instead will be the following : \n\n" +"(3) \tR(b) = (pi*L(b)) / (ESUN(b)*fn*fn*cos(θ)) \n\n" +"Whatever the formula used (2 or 3), the user should pay attention to the interpretation of the parameters he will provide to the application, " +"by taking into account the original formula that the metadata files assumes.\n\n" + +"Below, we give two examples of txt files containing information about gains/biases and solar illuminations :\n\n" +"- gainbias.txt :\n" +"# Gain values for each band. Each value must be separated with colons (:), with eventual spaces. Blank lines not allowed.\n" +"10.4416 : 9.529 : 8.5175 : 14.0063\n" +"# Bias values for each band.\n" +"0.0 : 0.0 : 0.0 : 0.0\n\n" +"- solarillumination.txt : \n" +"# Solar illumination values in watt/m2/micron ('micron' means actually 'for each band').\n" +"# Each value must be separated with colons (:), with eventual spaces. Blank lines not allowed.\n" +"1540.494123 : 1826.087443 : 1982.671954 : 1094.747446\n\n" + +"Finally, the 'Logs' tab provides usefull messages that can help the user in knowing the process different status." ); + SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso("The OTB CookBook"); @@ -117,13 +194,14 @@ AddRAMParameter(); AddParameter(ParameterType_Choice, "level", "Calibration Level"); - AddChoice("level.toa", "TOA : Top Of Atmosphere"); + AddChoice("level.toa", "Image to TOA reflectance"); + AddChoice("level.toatoim", "TOA reflectance to Image"); AddChoice("level.toc", "TOC : Top Of Canopy (EXPERIMENTAL)"); SetParameterString("level", "toa"); AddParameter(ParameterType_Empty, "milli", "Convert to milli reflectance"); SetParameterDescription("milli", "Flag to use milli-reflectance instead of reflectance.\n" - "This allows to save the image with integer pixel type (in the range [0, 1000] instead of floating point in the range [0, 1]. In order to do that, use this option and set the output pixel type (-out filename uint16 for example)"); + "This allows to save the image with integer pixel type (in the range [0, 1000] instead of floating point in the range [0, 1]. In order to do that, use this option and set the output pixel type (-out filename double for example)"); DisableParameter("milli"); MandatoryOff("milli"); @@ -132,14 +210,84 @@ EnableParameter("clamp"); MandatoryOff("clamp"); - AddParameter(ParameterType_InputFilename, "rsr", "Relative Spectral Response File"); - std::ostringstream oss; - oss << "Sensor relative spectral response file"<GetMetaDataDictionary(); - OpticalImageMetadataInterface::Pointer lImageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); + // Check if the input image change + if (tempName != m_inImageName) + { + m_inImageName = tempName; + newInputImage = true; + } - // Test if needed data are available : an exception will be thrown - // if one the following Get* return failure. the exception is then - // caught in the Wrapper::Application class which redirect it to - // the logger - // ImageToLuminance - lImageMetadataInterface->GetPhysicalGain(); - lImageMetadataInterface->GetPhysicalBias(); - - // LuminanceToReflectance - lImageMetadataInterface->GetDay(); - lImageMetadataInterface->GetMonth(); + if (newInputImage) + { + ossOutput << std::endl << "File: " << m_inImageName << std::endl; + + //Check if valid metadata informations are available to compute ImageToLuminance and LuminanceToReflectance + FloatVectorImageType::Pointer inImage = GetParameterFloatVectorImage("in"); + itk::MetaDataDictionary dict = inImage->GetMetaDataDictionary(); + OpticalImageMetadataInterface::Pointer lImageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); - lImageMetadataInterface->GetSolarIrradiance(); - lImageMetadataInterface->GetSunElevation(); + string IMIName( lImageMetadataInterface->GetNameOfClass() ) , IMIOptDfltName("OpticalDefaultImageMetadataInterface"); + if ( (IMIName != IMIOptDfltName)) + { + ossOutput << "Sensor detected: " << lImageMetadataInterface->GetSensorID() << std::endl; + + itk::VariableLengthVector vlvector; + std::stringstream ss; + + ossOutput << "Parameters extract from input image: "<< std::endl + << "\tAcquisition Day: " << lImageMetadataInterface->GetDay() << std::endl + << "\tAcquisition Month: " << lImageMetadataInterface->GetMonth() << std::endl + << "\tAcquisition Year: " << lImageMetadataInterface->GetYear() << std::endl + << "\tAcquisition Sun Elevation Angle: " << lImageMetadataInterface->GetSunElevation() << std::endl + << "\tAcquisition Sun Azimuth Angle: " << lImageMetadataInterface->GetSunAzimuth() << std::endl + << "\tAcquisition Viewing Elevation Angle: " << lImageMetadataInterface->GetSatElevation() << std::endl + << "\tAcquisition Viewing Azimuth Angle: " << lImageMetadataInterface->GetSatAzimuth() << std::endl; + + vlvector = lImageMetadataInterface->GetPhysicalGain(); + ossOutput << "\tAcquisition gain (per band): "; + for(unsigned int k=0; kGetPhysicalBias(); + ossOutput << "\tAcquisition bias (per band): "; + for(unsigned int k=0; kGetSolarIrradiance(); + ossOutput << "\tSolar Irradiance (per band): "; + for(unsigned int k=0; kGetMinute()); + } + + if (HasUserValue("acqui.hour")) + ossOutput << "Acquisition Hour already set by user: no overload" <GetHour()); + } + + if (HasUserValue("acqui.day")) + ossOutput << "Acquisition Day already set by user: no overload" <GetDay()); + if (IsParameterEnabled("acqui.fluxnormcoeff")) + DisableParameter("acqui.day"); + } + + if (HasUserValue("acqui.month")) + ossOutput << "Acquisition Month already set by user: no overload" <GetMonth()); + if (IsParameterEnabled("acqui.fluxnormcoeff")) + DisableParameter("acqui.month"); + } + + if (HasUserValue("acqui.year")) + ossOutput << "Acquisition Year already set by user: no overload" <GetYear()); + } + + if (HasUserValue("acqui.sun.elev")) + ossOutput << "Acquisition Sun Elevation Angle already set by user: no overload" <GetSunElevation()); + + if (HasUserValue("acqui.sun.azim")) + ossOutput << "Acquisition Sun Azimuth Angle already set by user: no overload" <GetSunAzimuth()); + + if (HasUserValue("acqui.view.elev")) + ossOutput << "Acquisition Viewing Elevation Angle already set by user: no overload" <GetSatElevation()); + + if (HasUserValue("acqui.view.azim")) + ossOutput << "Acquisition Viewing Azimuth Angle already set by user: no overload" <GetSatAzimuth()); + + // Set default value so that they are stored somewhere even if + // they are overloaded by user values + SetDefaultParameterInt("acqui.minute", lImageMetadataInterface->GetMinute()); + SetDefaultParameterInt("acqui.hour", lImageMetadataInterface->GetHour()); + SetDefaultParameterInt("acqui.day", lImageMetadataInterface->GetDay()); + SetDefaultParameterInt("acqui.month", lImageMetadataInterface->GetMonth()); + SetDefaultParameterInt("acqui.year", lImageMetadataInterface->GetYear()); + SetDefaultParameterFloat("acqui.sun.elev", lImageMetadataInterface->GetSunElevation()); + SetDefaultParameterFloat("acqui.sun.azim", lImageMetadataInterface->GetSunAzimuth()); + SetDefaultParameterFloat("acqui.view.elev", lImageMetadataInterface->GetSatElevation()); + SetDefaultParameterFloat("acqui.view.azim", lImageMetadataInterface->GetSatAzimuth()); + } + else + { + // Switch gain , bias and solar illumination to mandatory since + // they are not given in the image loaded + EnableParameter("acqui.gainbias"); + EnableParameter("acqui.solarilluminations"); + MandatoryOn("acqui.gainbias"); + MandatoryOn("acqui.solarilluminations"); + + ossOutput << "Sensor unknown!"<< std::endl; + ossOutput << "Additional parameters are necessary, please provide them (cf. documentation)!"<< std::endl; + + /*GetLogger()->Info("\n-------------------------------------------------------------\n" + "Sensor ID : unknown...\n" + "The application didn't manage to find an appropriate metadata interface; " + "custom values must be provided in order to perform TOA conversion.\nPlease, set the following fields :\n" + "- day and month of acquisition, or flux normalization coefficient;\n" + "- sun elevation angle;\n" + "- gains and biases for each band (passed by a file, see documentation);\n" + "- solar illuminationss for each band (passed by a file, see documentation).\n" + "-------------------------------------------------------------\n"); */ + } + //Estimate ground spacing in kilometers + GroundSpacingImageType::Pointer groundSpacing = GroundSpacingImageType::New(); + groundSpacing->SetInputImage(inImage); + IndexType index; + vnl_random rand; + index[0] = static_cast(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[0])); + index[1] = static_cast(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[1])); + FloatType tmpSpacing = groundSpacing->EvaluateAtIndex(index); + const float spacingInKilometers = (std::max(tmpSpacing[0], tmpSpacing[1])) / 1000.; + SetDefaultParameterFloat("atmo.pixsize",spacingInKilometers); + if (!HasUserValue("atmo.pixsize")) + SetParameterFloat("atmo.pixsize",spacingInKilometers); + } + } + + // Manage the case where fluxnormcoeff is modified by user + if (m_currentEnabledStateOfFluxParam != IsParameterEnabled("acqui.fluxnormcoeff")) + { + if (IsParameterEnabled("acqui.fluxnormcoeff")) + { + ossOutput << std::endl << "Flux Normalization Coefficient will be used" << std::endl; + DisableParameter("acqui.day"); + DisableParameter("acqui.month"); + MandatoryOff("acqui.day"); + MandatoryOff("acqui.month"); + MandatoryOn("acqui.fluxnormcoeff"); + m_currentEnabledStateOfFluxParam = true; + } + else + { + ossOutput << std::endl << "Day and Month will be used" << std::endl; + EnableParameter("acqui.day"); + EnableParameter("acqui.month"); + MandatoryOn("acqui.day"); + MandatoryOn("acqui.month"); + MandatoryOff("acqui.fluxnormcoeff"); + m_currentEnabledStateOfFluxParam = false; + } + } + + if (!ossOutput.str().empty()) + otbAppLogINFO(<< ossOutput.str()); + } + + void DoExecute() + { + //Main filters instanciations m_ImageToLuminanceFilter = ImageToLuminanceImageFilterType::New(); m_LuminanceToReflectanceFilter = LuminanceToReflectanceImageFilterType::New(); m_ReflectanceToSurfaceReflectanceFilter = ReflectanceToSurfaceReflectanceImageFilterType::New(); + m_ReflectanceToLuminanceFilter = ReflectanceToLuminanceImageFilterType::New(); + m_LuminanceToImageFilter = LuminanceToImageImageFilterType::New(); - m_ImageToLuminanceFilter->SetInput(inImage); - m_LuminanceToReflectanceFilter->SetInput(m_ImageToLuminanceFilter->GetOutput()); - m_ReflectanceToSurfaceReflectanceFilter->SetInput(m_LuminanceToReflectanceFilter->GetOutput()); + //Other instanciations + m_ScaleFilter = ScaleFilterOutDoubleType::New(); + //m_ScaleFilter->InPlaceOn(); + m_ClampFilter = ClampFilterType::New(); + m_paramAcqui = AcquiCorrectionParametersType::New(); + m_paramAtmo = AtmoCorrectionParametersType::New(); - m_ScaleFilter = ScaleFilterType::New(); - m_ScaleFilter->InPlaceOn(); + FloatVectorImageType::Pointer inImage = GetParameterFloatVectorImage("in"); - m_ClampFilter = ClampFilterType::New(); + // Prepare a metadata interface on the input image. + itk::MetaDataDictionary dict = inImage->GetMetaDataDictionary(); + OpticalImageMetadataInterface::Pointer lImageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); + std::string IMIName( lImageMetadataInterface->GetNameOfClass() ); + std::string IMIOptDfltName("OpticalDefaultImageMetadataInterface"); - switch ( GetParameterInt("level") ) + // Set (Date and Day) OR FluxNormalizationCoef to corresponding filters + if ( !IsParameterEnabled("acqui.fluxnormcoeff") ) + { + m_LuminanceToReflectanceFilter->SetDay(GetParameterInt("acqui.day")); + m_LuminanceToReflectanceFilter->SetMonth(GetParameterInt("acqui.month")); + + m_ReflectanceToLuminanceFilter->SetDay(GetParameterInt("acqui.day")); + m_ReflectanceToLuminanceFilter->SetMonth(GetParameterInt("acqui.month")); + } + else + { + m_LuminanceToReflectanceFilter->SetFluxNormalizationCoefficient(GetParameterFloat("acqui.fluxnormcoeff")); + + m_ReflectanceToLuminanceFilter->SetFluxNormalizationCoefficient(GetParameterFloat("acqui.fluxnormcoeff")); + } + + // Set Sun Elevation Angle to corresponding filters + m_LuminanceToReflectanceFilter->SetElevationSolarAngle(GetParameterFloat("acqui.sun.elev")); + m_ReflectanceToLuminanceFilter->SetElevationSolarAngle(GetParameterFloat("acqui.sun.elev")); + + // Set Gain and Bias to corresponding filters + if (IsParameterEnabled("acqui.gainbias") && HasValue("acqui.gainbias")) + { + // Try to retrieve information from file provided by user + string filename(GetParameterString("acqui.gainbias")); + + std::ifstream file(filename.c_str(), std::ios::in); + if(file) { - case Level_TOA: + string line; + unsigned int numLine = 0; + while (getline(file, line)) + { + // clean line + std::string::size_type startPos = line.find_first_not_of(std::string(" \t\n\r")); + if (startPos == std::string::npos) continue; + + line = line.substr(startPos); + if (line[0]!='#') + { + numLine++; + std::vector values; + std::istringstream iss(line); + string value; double dvalue; + while ( getline( iss, value, ':' ) ) + { + std::istringstream iss2(value); + iss2 >> dvalue; + values.push_back(dvalue); + } + + itk::VariableLengthVector vlvector; + vlvector.SetData(values.data(),values.size(),false); + + switch (numLine) + { + case 1 : + m_ImageToLuminanceFilter->SetAlpha(vlvector); + m_LuminanceToImageFilter->SetAlpha(vlvector); + GetLogger()->Info("Trying to get gains/biases information... OK (1/2)\n"); + break; + + case 2 : + m_ImageToLuminanceFilter->SetBeta(vlvector); + m_LuminanceToImageFilter->SetBeta(vlvector); + GetLogger()->Info("Trying to get gains/biases information... OK (2/2)\n"); + break; + + default : itkExceptionMacro(<< "File : " << filename << " contains wrong number of lines (needs two, one for gains and one for biases)"); + } + } + } + file.close(); + } + else + itkExceptionMacro(<< "File : " << filename << " couldn't be opened"); + } + else + { + //Try to retrieve information from image metadata + if (IMIName != IMIOptDfltName) + { + m_ImageToLuminanceFilter->SetAlpha(lImageMetadataInterface->GetPhysicalGain()); + m_LuminanceToImageFilter->SetAlpha(lImageMetadataInterface->GetPhysicalGain()); + + m_ImageToLuminanceFilter->SetBeta(lImageMetadataInterface->GetPhysicalBias()); + m_LuminanceToImageFilter->SetBeta(lImageMetadataInterface->GetPhysicalBias()); + } + else + itkExceptionMacro(<< "Please, provide a type of sensor supported by OTB for automatic metadata extraction! "); + } + + // Set Solar Illumination to corresponding filters + if (IsParameterEnabled("acqui.solarilluminations") && HasValue("acqui.solarilluminations")) + { + // Try to retrieve information from file provided by user + string filename(GetParameterString("acqui.solarilluminations")); + + std::ifstream file(filename.c_str(), std::ios::in); + if(file) + { + std::string line; + while (getline(file, line)) + { + // clean line + std::string::size_type startPos = line.find_first_not_of(std::string(" \t\n\r")); + if (startPos == std::string::npos) continue; + + line = line.substr(startPos); + if (line[0]!='#') + { + std::vector values; + std::istringstream iss(line); + string value; double dvalue; + while ( getline( iss, value, ':' ) ) + { + std::istringstream iss2(value); + iss2 >> dvalue; + values.push_back(dvalue); + } + + itk::VariableLengthVector vlvector; + vlvector.SetData(values.data(),values.size(),false); + + m_LuminanceToReflectanceFilter->SetSolarIllumination(vlvector); + m_ReflectanceToLuminanceFilter->SetSolarIllumination(vlvector); + } + } + file.close(); + } + else + itkExceptionMacro(<< "File : " << filename << " couldn't be opened"); + } + else + { + //Try to retrieve information from image metadata + if (IMIName != IMIOptDfltName) { - GetLogger()->Info("Compute Top of Atmosphere reflectance\n"); - m_LuminanceToReflectanceFilter->SetUseClamp(IsParameterEnabled("clamp")); + m_LuminanceToReflectanceFilter->SetSolarIllumination(lImageMetadataInterface->GetSolarIrradiance()); + m_ReflectanceToLuminanceFilter->SetSolarIllumination(lImageMetadataInterface->GetSolarIrradiance()); + } + else + itkExceptionMacro(<< "Please, provide a type of sensor supported by OTB for automatic metadata extraction! "); + } + + // Set acquisition parameters + m_paramAcqui->SetYear(GetParameterInt("acqui.year")); + m_paramAcqui->SetMonth(GetParameterInt("acqui.month")); + m_paramAcqui->SetDay(GetParameterInt("acqui.day")); + m_paramAcqui->SetSolarZenithalAngle(90.0 - GetParameterFloat("acqui.sun.elev")); + m_paramAcqui->SetSolarAzimutalAngle(GetParameterFloat("acqui.sun.azim")); + m_paramAcqui->SetViewingZenithalAngle(90.0 - GetParameterFloat("acqui.view.elev")); + m_paramAcqui->SetViewingAzimutalAngle(GetParameterFloat("acqui.view.azim")); - m_LuminanceToReflectanceFilter->UpdateOutputInformation(); - m_ScaleFilter->SetInput(m_LuminanceToReflectanceFilter->GetOutput()); + switch ( GetParameterInt("level") ) + { + case Level_IM_TOA: + { + GetLogger()->Info("Compute Top of Atmosphere reflectance\n"); + + //Pipeline + m_ImageToLuminanceFilter->SetInput(inImage); + m_LuminanceToReflectanceFilter->SetInput(m_ImageToLuminanceFilter->GetOutput()); + + if (IsParameterEnabled("clamp")) + { + GetLogger()->Info("Clamp values between [0, 100]\n"); + } + + m_LuminanceToReflectanceFilter->SetUseClamp(IsParameterEnabled("clamp")); + m_LuminanceToReflectanceFilter->UpdateOutputInformation(); + m_ScaleFilter->SetInput(m_LuminanceToReflectanceFilter->GetOutput()); + } + break; + case Level_TOA_IM: + { + GetLogger()->Info("Convert Top of Atmosphere reflectance to image DN\n"); + + //Pipeline + m_ReflectanceToLuminanceFilter->SetInput(inImage); + m_LuminanceToImageFilter->SetInput(m_ReflectanceToLuminanceFilter->GetOutput()); + m_LuminanceToImageFilter->UpdateOutputInformation(); + m_ScaleFilter->SetInput(m_LuminanceToImageFilter->GetOutput()); } break; case Level_TOC: { - GetLogger()->Info("Compute Top of Canopy reflectance\n"); - m_ReflectanceToSurfaceReflectanceFilter->SetIsSetAtmosphericRadiativeTerms(false); - m_ReflectanceToSurfaceReflectanceFilter->SetUseGenerateParameters(true); - m_ReflectanceToSurfaceReflectanceFilter->UpdateOutputInformation(); - m_ReflectanceToSurfaceReflectanceFilter->SetUseGenerateParameters(false); + GetLogger()->Info("Compute Top of Canopy reflectance\n"); - m_AtmosphericParam = m_ReflectanceToSurfaceReflectanceFilter->GetCorrectionParameters(); - //AerosolModelType aeroMod = AtmosphericCorrectionParametersType::NO_AEROSOL; + //Pipeline + m_ImageToLuminanceFilter->SetInput(inImage); + m_LuminanceToReflectanceFilter->SetInput(m_ImageToLuminanceFilter->GetOutput()); + m_ReflectanceToSurfaceReflectanceFilter->SetInput(m_LuminanceToReflectanceFilter->GetOutput()); + m_ReflectanceToSurfaceReflectanceFilter->SetAcquiCorrectionParameters(m_paramAcqui); + m_ReflectanceToSurfaceReflectanceFilter->SetAtmoCorrectionParameters(m_paramAtmo); - switch ( GetParameterInt("atmo.aerosol") ) - { - case Aerosol_Desertic: + //AerosolModelType aeroMod = AtmosphericCorrectionParametersType::NO_AEROSOL; + + switch ( GetParameterInt("atmo.aerosol") ) { - // Aerosol_Desertic correspond to 4 in the enum but actually in - // the class atmosphericParam it is known as parameter 5 - m_AtmosphericParam->SetAerosolModel(static_cast(5)); + case Aerosol_Desertic: + { + // Aerosol_Desertic correspond to 4 in the enum but actually in + // the class atmosphericParam it is known as parameter 5 + m_paramAtmo->SetAerosolModel(static_cast(5)); + } + break; + default: + { + m_paramAtmo->SetAerosolModel(static_cast(GetParameterInt("atmo.aerosol"))); + } + break; } - break; - default: + + // Set the atmospheric param + m_paramAtmo->SetOzoneAmount(GetParameterFloat("atmo.oz")); + m_paramAtmo->SetWaterVaporAmount(GetParameterFloat("atmo.wa")); + m_paramAtmo->SetAtmosphericPressure(GetParameterFloat("atmo.pressure")); + m_paramAtmo->SetAerosolOptical(GetParameterFloat("atmo.opt")); + + // Relative Spectral Response File + if (IsParameterEnabled("atmo.rsr")) { - m_AtmosphericParam->SetAerosolModel(static_cast(GetParameterInt("atmo.aerosol"))); - } - break; + m_paramAcqui->LoadFilterFunctionValue(GetParameterString("atmo.rsr")); } - // Set the atmospheric param - m_AtmosphericParam->SetOzoneAmount(GetParameterFloat("atmo.oz")); - m_AtmosphericParam->SetWaterVaporAmount(GetParameterFloat("atmo.wa")); - m_AtmosphericParam->SetAtmosphericPressure(GetParameterFloat("atmo.pressure")); - m_AtmosphericParam->SetAerosolOptical(GetParameterFloat("atmo.opt")); - - // Relative Spectral Response File - if (IsParameterEnabled("rsr")) + else if (IMIName != IMIOptDfltName) { - m_ReflectanceToSurfaceReflectanceFilter->SetFilterFunctionValuesFileName(GetParameterString("rsr")); + if (lImageMetadataInterface->GetSpectralSensitivity()->Size() > 0) + m_paramAcqui->SetWavelengthSpectralBand(lImageMetadataInterface->GetSpectralSensitivity()); } + // Check that m_paramAcqui contains a real spectral profile. + if (m_paramAcqui->GetWavelengthSpectralBand()->Size() == 0) + { + otbAppLogWARNING("No relative spectral response found, using " + "default response (constant between 0.3 and 1.0µm)"); + AcquiCorrectionParametersType::WavelengthSpectralBandVectorType spectralDummy; + spectralDummy->Clear(); + for (unsigned int i = 0; i < inImage->GetNumberOfComponentsPerPixel(); ++i) + { + spectralDummy->PushBack(FilterFunctionValues::New()); + } + } - // Aeronet file - if (IsParameterEnabled("atmo.aeronet")) + // Aeronet file + if (IsParameterEnabled("atmo.aeronet")) { - GetLogger()->Info("Use aeronet file to retrieve atmospheric parameters"); - m_ReflectanceToSurfaceReflectanceFilter->SetAeronetFileName(GetParameterString("atmo.aeronet")); + GetLogger()->Info("Use Aeronet file to retrieve atmospheric parameters\n"); + m_paramAtmo->SetAeronetFileName(GetParameterString("atmo.aeronet")); + m_paramAtmo->UpdateAeronetData(GetParameterInt("acqui.year"), + GetParameterInt("acqui.month"), + GetParameterInt("acqui.day"), + GetParameterInt("acqui.hour"), + GetParameterInt("acqui.minute"), + 0.4); } - m_ReflectanceToSurfaceReflectanceFilter->SetIsSetAtmosphericRadiativeTerms(false); - m_ReflectanceToSurfaceReflectanceFilter->SetUseGenerateParameters(true); - m_ReflectanceToSurfaceReflectanceFilter->GenerateParameters(); - m_ReflectanceToSurfaceReflectanceFilter->UpdateOutputInformation(); - m_ReflectanceToSurfaceReflectanceFilter->SetUseGenerateParameters(false); - - // std::ostringstream oss_atmo; - // oss_atmo << "Atmospheric parameters: " << std::endl; - // oss_atmo << m_AtmosphericParam; - - // GetLogger()->Info(oss_atmo.str()); - - std::ostringstream oss; - oss.str(""); - oss << std::endl << m_AtmosphericParam; - - AtmosphericRadiativeTerms::Pointer atmoTerms = m_ReflectanceToSurfaceReflectanceFilter->GetAtmosphericRadiativeTerms(); - oss << std::endl << std::endl << atmoTerms; - - GetLogger()->Info("Atmospheric correction parameters compute by 6S : " + oss.str()); - - //Compute adjacency effect - // m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter - // = SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::New(); - - // m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); - // m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter-> - // SetAtmosphericRadiativeTerms( - // m_ReflectanceToSurfaceReflectanceFilter->GetAtmosphericRadiativeTerms()); - // m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetZenithalViewingAngle( - // m_AtmosphericParam->GetViewingZenithalAngle()); - // m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetWindowRadius(GetParameterInt("radius")); + m_ReflectanceToSurfaceReflectanceFilter->UpdateOutputInformation(); + m_ReflectanceToSurfaceReflectanceFilter->SetIsSetAtmosphericRadiativeTerms(false); + m_ReflectanceToSurfaceReflectanceFilter->SetUseGenerateParameters(true); + m_ReflectanceToSurfaceReflectanceFilter->GenerateParameters(); + m_ReflectanceToSurfaceReflectanceFilter->SetUseGenerateParameters(false); + + // std::ostringstream oss_atmo; + // oss_atmo << "Atmospheric parameters: " << std::endl; + // oss_atmo << m_AtmosphericParam; + // GetLogger()->Info(oss_atmo.str()); + + std::ostringstream oss; + oss.str(""); + oss << std::endl << m_paramAtmo; - // //estimate ground spacing in kilometers - // GroundSpacingImageType::Pointer groundSpacing = GroundSpacingImageType::New(); + AtmosphericRadiativeTerms::Pointer atmoTerms = m_ReflectanceToSurfaceReflectanceFilter->GetAtmosphericRadiativeTerms(); + oss << std::endl << std::endl << atmoTerms << std::endl; - // groundSpacing->SetInputImage(inImage); - // IndexType index; + GetLogger()->Info("Atmospheric correction parameters compute by 6S : " + oss.str()); - // vnl_random rand; - - // index[0] = static_cast(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[0])); - // index[1] = static_cast(rand.lrand32(0, inImage->GetLargestPossibleRegion().GetSize()[1])); - // FloatType tmpSpacing = groundSpacing->EvaluateAtIndex(index); - - // const float spacingInKilometers = (std::max(tmpSpacing[0], tmpSpacing[1])) / 1000.; - - // // std::ostringstream oss2; - // // oss2.str(""); - // // oss2 << spacingInKilometers; + bool adjComputation=false; + if (IsParameterEnabled("atmo.radius")) + { + GetLogger()->Info("Compute adjacency effects\n"); + adjComputation=true; + //Compute adjacency effect + m_SurfaceAdjacencyEffectCorrectionSchemeFilter + = SurfaceAdjacencyEffectCorrectionSchemeFilterType::New(); + + m_SurfaceAdjacencyEffectCorrectionSchemeFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); + m_SurfaceAdjacencyEffectCorrectionSchemeFilter-> + SetAtmosphericRadiativeTerms( + m_ReflectanceToSurfaceReflectanceFilter->GetAtmosphericRadiativeTerms()); + m_SurfaceAdjacencyEffectCorrectionSchemeFilter->SetZenithalViewingAngle( + m_paramAcqui->GetViewingZenithalAngle()); + m_SurfaceAdjacencyEffectCorrectionSchemeFilter->SetWindowRadius(GetParameterInt("atmo.radius")); + m_SurfaceAdjacencyEffectCorrectionSchemeFilter-> + SetPixelSpacingInKilometers(GetParameterFloat("atmo.pixsize")); - // // GetLogger()->Info("Spacing in kilometers " + oss2.str()); - // m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter-> - // SetPixelSpacingInKilometers(spacingInKilometers); + m_SurfaceAdjacencyEffectCorrectionSchemeFilter->UpdateOutputInformation(); + } - // //rescale the surface reflectance in milli-reflectance - // m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->UpdateOutputInformation(); - // //m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->Update(); - // m_ScaleFilter->SetInput(m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter->GetOutput()); - if (!IsParameterEnabled("clamp")) + //Rescale the surface reflectance in milli-reflectance + if (!IsParameterEnabled("clamp")) { - m_ScaleFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); + if (!adjComputation) + m_ScaleFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); + else + m_ScaleFilter->SetInput(m_SurfaceAdjacencyEffectCorrectionSchemeFilter->GetOutput()); } - else + else { - GetLogger()->Info("Clamp values between [0, 100]"); - m_ClampFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); - m_ClampFilter->ClampOutside(0.0, 1.0); - m_ScaleFilter->SetInput(m_ClampFilter->GetOutput()); + GetLogger()->Info("Clamp values between [0, 100]\n"); + + if (!adjComputation) + m_ClampFilter->SetInput(m_ReflectanceToSurfaceReflectanceFilter->GetOutput()); + else + m_ClampFilter->SetInput(m_SurfaceAdjacencyEffectCorrectionSchemeFilter->GetOutput()); + + m_ClampFilter->ClampOutside(0.0, 1.0); + m_ScaleFilter->SetInput(m_ClampFilter->GetOutput()); } } break; - } + } // Output Image - double scale = 1.0; + double scale = 1.; if (IsParameterEnabled("milli")) - { - GetLogger()->Info("Use milli-reflectance"); - scale = 1000.; - } - - m_ScaleFilter->SetCoef(scale); - + { + GetLogger()->Info("Use milli-reflectance\n"); + if ( (GetParameterInt("level") == Level_IM_TOA) || (GetParameterInt("level") == Level_TOC) ) + scale =1000.; + if (GetParameterInt("level") == Level_TOA_IM) + scale=1. / 1000.; + } + m_ScaleFilter->SetConstant(scale); + SetParameterOutputImage("out", m_ScaleFilter->GetOutput()); } + //Keep object references as a members of the class, else the pipeline will be broken after exiting DoExecute(). ImageToLuminanceImageFilterType ::Pointer m_ImageToLuminanceFilter; LuminanceToReflectanceImageFilterType::Pointer m_LuminanceToReflectanceFilter; + ReflectanceToLuminanceImageFilterType::Pointer m_ReflectanceToLuminanceFilter; + LuminanceToImageImageFilterType::Pointer m_LuminanceToImageFilter; ReflectanceToSurfaceReflectanceImageFilterType::Pointer m_ReflectanceToSurfaceReflectanceFilter; - ScaleFilterType::Pointer m_ScaleFilter; - AtmosphericCorrectionParametersType::Pointer m_AtmosphericParam; + ScaleFilterOutDoubleType::Pointer m_ScaleFilter; + AtmoCorrectionParametersPointerType m_paramAtmo; + AcquiCorrectionParametersPointerType m_paramAcqui; ClampFilterType::Pointer m_ClampFilter; - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::Pointer m_SurfaceAdjacencyEffect6SCorrectionSchemeFilter; + SurfaceAdjacencyEffectCorrectionSchemeFilterType::Pointer m_SurfaceAdjacencyEffectCorrectionSchemeFilter; }; }// namespace Wrapper diff -Nru otb-4.0.0/Applications/Segmentation/otbLSMSVectorization.cxx otb-4.2.0/Applications/Segmentation/otbLSMSVectorization.cxx --- otb-4.0.0/Applications/Segmentation/otbLSMSVectorization.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Segmentation/otbLSMSVectorization.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -111,7 +111,7 @@ { clock_t tic = clock(); - const char * shapefile = GetParameterString("out").c_str(); + std::string shapefile(GetParameterString("out")); unsigned long sizeTilesX = GetParameterInt("tilesizex"); unsigned long sizeTilesY = GetParameterInt("tilesizey"); @@ -161,8 +161,8 @@ std::vector options; ogrDS = otb::ogr::DataSource::New(shapefile, otb::ogr::DataSource::Modes::Overwrite); - std::string layername = itksys::SystemTools::GetFilenameName(shapefile); - std::string extension = itksys::SystemTools::GetFilenameLastExtension(shapefile); + std::string layername = itksys::SystemTools::GetFilenameName(shapefile.c_str()); + std::string extension = itksys::SystemTools::GetFilenameLastExtension(shapefile.c_str()); layername = layername.substr(0,layername.size()-(extension.size())); layer = ogrDS->CreateLayer(layername, &oSRS, wkbMultiPolygon, options); @@ -260,10 +260,6 @@ sqloss.str(""); sqloss<<"SELECT * FROM \""<ExecuteSQL(sqloss.str().c_str(), NULL, NULL); - - bool goesOn = true; - int nbFeatures = layerTmp.ogr().GetFeatureCount(true); - int nb = 0; otb::ogr::Feature firstFeature = layerTmp.ogr().GetNextFeature(); //Geometry fusion @@ -360,5 +356,3 @@ } OTB_APPLICATION_EXPORT(otb::Wrapper::LSMSVectorization) - - diff -Nru otb-4.0.0/Applications/Segmentation/otbMeanShiftSmoothing.cxx otb-4.2.0/Applications/Segmentation/otbMeanShiftSmoothing.cxx --- otb-4.0.0/Applications/Segmentation/otbMeanShiftSmoothing.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Segmentation/otbMeanShiftSmoothing.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ SetDescription("Perform mean shift filtering"); // Documentation - SetDocName("Mean Shift filtering (can be used as Exact Large-Scale Mean-Shift segmentation, step 1)"); + SetDocName("Exact Large-Scale Mean-Shift segmentation, step 1 (smoothing)"); SetDocLongDescription("This application performs mean shift fitlering (multi-threaded)."); SetDocLimitations("With mode search option, the result will slightly depend on thread number."); SetDocAuthors("OTB-Team"); @@ -66,6 +66,7 @@ AddParameter(ParameterType_OutputImage, "foutpos", "Spatial image"); SetParameterDescription( "foutpos", " The spatial image output. Spatial image output is a displacement map (pixel position after convergence)."); + MandatoryOff("foutpos"); AddParameter(ParameterType_Int, "spatialr", "Spatial radius"); SetParameterDescription("spatialr", "Spatial radius of the neighborhood."); @@ -99,12 +100,12 @@ AddParameter(ParameterType_Empty, "modesearch", "Mode search."); SetParameterDescription("modesearch", "If activated pixel iterative convergence is stopped if the path . Be careful, with this option, the result will slightly depend on thread number"); EnableParameter("modesearch"); - MandatoryOff("modesearch"); // Doc example parameter settings SetDocExampleParameterValue("in", "maur_rgb.png"); SetDocExampleParameterValue("fout", "MeanShift_FilterOutput.tif"); + SetDocExampleParameterValue("foutpos", "MeanShift_SpatialOutput.tif"); SetDocExampleParameterValue("spatialr", "16"); SetDocExampleParameterValue("ranger", "16"); SetDocExampleParameterValue("thres", "0.1"); @@ -114,7 +115,16 @@ void DoUpdateParameters() { - // Nothing to do here : all parameters are independent + if(IsParameterEnabled("modesearch")) + { + MandatoryOn("foutpos"); + EnableParameter("foutpos"); + } + else + { + MandatoryOff("foutpos"); + DisableParameter("foutpos"); + } } void DoExecute() @@ -131,6 +141,18 @@ m_Filter->SetMaxIterationNumber(GetParameterInt("maxiter")); m_Filter->SetRangeBandwidthRamp(GetParameterFloat("rangeramp")); + //Compute the margin used to ensure exact results (tile wise smoothing) + //This margin is valid for the default uniform kernel used by the + //MeanShiftSmoothing filter (bandwidth equal to radius in this case) + const unsigned int margin = (m_Filter->GetMaxIterationNumber() * m_Filter->GetSpatialBandwidth()) + 1; + + otbAppLogINFO(<<"Margin of " << margin << " pixels applied to each tile to stabilized mean shift filtering." << std::endl); + + if ( margin > std::min(input->GetLargestPossibleRegion().GetSize()[0],input->GetLargestPossibleRegion().GetSize()[1]) ) + { + otbAppLogWARNING(<<"Margin value exceed the input image size." << std::endl); + } + SetParameterOutputImage("fout", m_Filter->GetOutput()); SetParameterOutputImage("foutpos", m_Filter->GetSpatialOutput()); if(!IsParameterEnabled("modesearch")) diff -Nru otb-4.0.0/Applications/Segmentation/otbSegmentation.cxx otb-4.2.0/Applications/Segmentation/otbSegmentation.cxx --- otb-4.0.0/Applications/Segmentation/otbSegmentation.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Segmentation/otbSegmentation.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -380,12 +380,6 @@ GenericApplySegmentation(otb::StreamingImageToOGRLayerSegmentationFilter * streamingVectorizedFilter, TInputImage * inputImage, const otb::ogr::Layer& layer, const unsigned int outputNb) { - typedef TSegmentationFilter SegmentationFilterType; - typedef typename SegmentationFilterType::Pointer SegmentationFilterPointerType; - typedef otb::StreamingImageToOGRLayerSegmentationFilter - StreamingVectorizedSegmentationOGRType; - // Retrieve tile size parameter const unsigned int tileSize = static_cast (this->GetParameterInt("mode.vector.tilesize")); // Retrieve the 8-connected option diff -Nru otb-4.0.0/Applications/Utils/CMakeLists.txt otb-4.2.0/Applications/Utils/CMakeLists.txt --- otb-4.0.0/Applications/Utils/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -59,8 +59,8 @@ SOURCES otbVectorDataTransform.cxx LINK_LIBRARIES OTBBasicFilters) -OTB_CREATE_APPLICATION(NAME VectorDataExtractROIApplication - SOURCES otbVectorDataExtractROIApplication.cxx +OTB_CREATE_APPLICATION(NAME VectorDataExtractROI + SOURCES otbVectorDataExtractROI.cxx LINK_LIBRARIES OTBBasicFilters) #OTB_CREATE_APPLICATION(NAME DEMConvert diff -Nru otb-4.0.0/Applications/Utils/otbColorMapping.cxx otb-4.2.0/Applications/Utils/otbColorMapping.cxx --- otb-4.0.0/Applications/Utils/otbColorMapping.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbColorMapping.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -636,8 +636,6 @@ otbAppLogINFO("The map contains :"< NumericTraitsType; - for (mapIt = labelToMeanIntensityMap.begin(); mapIt != labelToMeanIntensityMap.end(); ++mapIt) @@ -827,5 +825,3 @@ } OTB_APPLICATION_EXPORT(otb::Wrapper::ColorMapping) - - diff -Nru otb-4.0.0/Applications/Utils/otbCompareImages.cxx otb-4.2.0/Applications/Utils/otbCompareImages.cxx --- otb-4.0.0/Applications/Utils/otbCompareImages.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbCompareImages.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -201,6 +201,7 @@ // Compute comparaison m_CompareFilter->SetInput1(m_ExtractRefFilter->GetOutput()); m_CompareFilter->SetInput2(m_ExtractMeasFilter->GetOutput()); + m_CompareFilter->SetPhysicalSpaceCheck(false); m_CompareFilter->Update(); // Show result diff -Nru otb-4.0.0/Applications/Utils/otbExtractROI.cxx otb-4.2.0/Applications/Utils/otbExtractROI.cxx --- otb-4.0.0/Applications/Utils/otbExtractROI.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbExtractROI.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -224,7 +224,7 @@ // Setup the DEM Handler otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"mode.fit.elev"); - FloatVectorImageType::Pointer referencePtr = this->GetParameterImage("mode.fit.ref"); + FloatVectorImageType::Pointer referencePtr = this->GetParameterImage("mode.fit.ref"); referencePtr->UpdateOutputInformation(); RSTransformType::Pointer rsTransform = RSTransformType::New(); diff -Nru otb-4.0.0/Applications/Utils/otbMultiResolutionPyramid.cxx otb-4.2.0/Applications/Utils/otbMultiResolutionPyramid.cxx --- otb-4.0.0/Applications/Utils/otbMultiResolutionPyramid.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbMultiResolutionPyramid.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -188,6 +188,7 @@ // Set the filename of the current output image paramOut->SetFileName(oss.str()); + otbAppLogINFO(<< "File: "<GetFileName() << " will be written."); paramOut->SetValue(m_ShrinkFilter->GetOutput()); paramOut->SetPixelType(this->GetParameterOutputImagePixelType("out")); // Add the current level to be written diff -Nru otb-4.0.0/Applications/Utils/otbReadImageInfo.cxx otb-4.2.0/Applications/Utils/otbReadImageInfo.cxx --- otb-4.0.0/Applications/Utils/otbReadImageInfo.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbReadImageInfo.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -281,7 +281,7 @@ SetParameterFloat("originx", inImage->GetOrigin()[0]); SetParameterFloat("originy", inImage->GetOrigin()[1]); - ossOutput << "\tOrigin : [" << GetParameterFloat("originx") << "," << GetParameterInt("originy") << "]" << std::endl; + ossOutput << "\tOrigin : [" << GetParameterFloat("originx") << "," << GetParameterFloat("originy") << "]" << std::endl; //Get image spacing SetParameterFloat("spacingx", inImage->GetSpacing()[0]); diff -Nru otb-4.0.0/Applications/Utils/otbSplitImage.cxx otb-4.2.0/Applications/Utils/otbSplitImage.cxx --- otb-4.0.0/Applications/Utils/otbSplitImage.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbSplitImage.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -120,6 +120,7 @@ // Set the filename of the current output image paramOut->SetFileName(oss.str()); + otbAppLogINFO(<< "File: "<GetFileName() << " will be written."); paramOut->SetValue(m_Filter->GetOutput()); paramOut->SetPixelType(this->GetParameterOutputImagePixelType("out")); // Add the current level to be written diff -Nru otb-4.0.0/Applications/Utils/otbVectorDataExtractROIApplication.cxx otb-4.2.0/Applications/Utils/otbVectorDataExtractROIApplication.cxx --- otb-4.0.0/Applications/Utils/otbVectorDataExtractROIApplication.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbVectorDataExtractROIApplication.cxx 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - 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. - - =========================================================================*/ -#include "otbWrapperApplication.h" -#include "otbWrapperApplicationFactory.h" - -#include "otbVectorDataExtractROI.h" -#include "otbVectorDataProjectionFilter.h" -#include "otbVectorDataProperties.h" - -//Misc -#include "otbRemoteSensingRegion.h" - -// Elevation handler -#include "otbWrapperElevationParametersHandler.h" - -#include - -namespace otb -{ -namespace Wrapper -{ - -class VectorDataExtractROIApplication : public Application -{ -public: - /** Standard class typedefs. */ - typedef VectorDataExtractROIApplication Self; - typedef Application Superclass; - typedef itk::SmartPointer Pointer; - typedef itk::SmartPointer ConstPointer; - - /** Standard macro */ - itkNewMacro(Self); - - itkTypeMacro(VectorDataExtractROIApplication, otb::Application); - - /** Filters typedef */ - // Images - - typedef FloatVectorImageType::PointType PointType; - typedef FloatVectorImageType::IndexType IndexType; - typedef FloatVectorImageType::SizeType SizeType; - typedef FloatVectorImageType::SpacingType SpacingType; - - typedef VectorDataProjectionFilter< - VectorDataType, VectorDataType> VectorDataProjectionFilterType; - typedef VectorDataExtractROI VectorDataExtractROIType; - - // Misc - typedef otb::RemoteSensingRegion RemoteSensingRegionType; - -private: - void DoInit() - { - SetName("VectorDataExtractROIApplication"); - SetDescription("Perform an extract ROI on the input vector data according to the input image extent"); - - SetDocName("VectorData Extract ROI"); - SetDocLongDescription("This application extracts the vector data features belonging to a region specified by the support image envelope"); - SetDocLimitations("None"); - SetDocAuthors("OTB-Team"); - SetDocSeeAlso(" "); - - AddDocTag(Tags::Vector); - - AddParameter(ParameterType_Group,"io","Input and output data"); - SetParameterDescription("io", "Group containing input and output parameters"); - - AddParameter(ParameterType_InputVectorData, "io.vd", "Input Vector data"); - SetParameterDescription("io.vd", "Input vector data"); - - AddParameter(ParameterType_InputImage, "io.in", "Support image"); - SetParameterDescription("io.in", "Support image that specifies the extracted region"); - - AddParameter(ParameterType_OutputVectorData,"io.out","Output Vector data"); - SetParameterDescription("io.out", "Output extracted vector data"); - - // Elevation - ElevationParametersHandler::AddElevationParameters(this, "elev"); - - // Doc example parameter settings - SetDocExampleParameterValue("io.in", "qb_RoadExtract.tif"); - SetDocExampleParameterValue("io.vd", "qb_RoadExtract_classification.shp"); - SetDocExampleParameterValue("io.out", "apTvUtVectorDataExtractROIApplicationTest.shp"); - } - - void DoUpdateParameters() - { - // Nothing to do here for the parameters : all are independent - } - - void DoExecute() - { - // Get the inputs - VectorDataType* vd = GetParameterVectorData("io.vd"); - FloatVectorImageType* inImage = GetParameterImage("io.in"); - - // Extracting the VectorData - m_VdExtract = VectorDataExtractROIType::New(); - m_VdExtract->SetInput(vd); - - // Find the geographic region of interest - // Get the index of the corner of the image - IndexType ul, ur, ll, lr; - PointType pul, pur, pll, plr; - ul = inImage->GetLargestPossibleRegion().GetIndex(); - ur = ul; - ll = ul; - lr = ul; - ur[0] += inImage->GetLargestPossibleRegion().GetSize()[0]; - lr[0] += inImage->GetLargestPossibleRegion().GetSize()[0]; - lr[1] += inImage->GetLargestPossibleRegion().GetSize()[1]; - ll[1] += inImage->GetLargestPossibleRegion().GetSize()[1]; - - // Transform to physical point - inImage->TransformIndexToPhysicalPoint(ul, pul); - inImage->TransformIndexToPhysicalPoint(ur, pur); - inImage->TransformIndexToPhysicalPoint(ll, pll); - inImage->TransformIndexToPhysicalPoint(lr, plr); - - // Build the cartographic region - RemoteSensingRegionType rsRegion; - RemoteSensingRegionType::IndexType rsOrigin; - RemoteSensingRegionType::SizeType rsSize; - rsOrigin[0] = std::min(pul[0], plr[0]); - rsOrigin[1] = std::min(pul[1], plr[1]); - rsSize[0] = vcl_abs(pul[0] - plr[0]); - rsSize[1] = vcl_abs(pul[1] - plr[1]); - - rsRegion.SetOrigin(rsOrigin); - rsRegion.SetSize(rsSize); - rsRegion.SetRegionProjection(inImage->GetProjectionRef()); - rsRegion.SetKeywordList(inImage->GetImageKeywordlist()); - - // Set the cartographic region to the extract roi filter - m_VdExtract->SetRegion(rsRegion); - - // Reprojecting the VectorData - m_VdProj = VectorDataProjectionFilterType::New(); - m_VdProj->SetInput(m_VdExtract->GetOutput()); - m_VdProj->SetInputProjectionRef(inImage->GetProjectionRef()); - m_VdProj->SetOutputKeywordList(inImage->GetImageKeywordlist()); - m_VdProj->SetOutputProjectionRef(inImage->GetProjectionRef()); - m_VdProj->SetOutputOrigin(inImage->GetOrigin()); - m_VdProj->SetOutputSpacing(inImage->GetSpacing()); - - // Setup the DEM Handler - otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); - - // Set the output vectorData - SetParameterOutputVectorData("io.out", m_VdProj->GetOutput()); - } - - VectorDataExtractROIType::Pointer m_VdExtract; - VectorDataProjectionFilterType::Pointer m_VdProj; -}; - -} -} - -OTB_APPLICATION_EXPORT(otb::Wrapper::VectorDataExtractROIApplication) diff -Nru otb-4.0.0/Applications/Utils/otbVectorDataExtractROI.cxx otb-4.2.0/Applications/Utils/otbVectorDataExtractROI.cxx --- otb-4.0.0/Applications/Utils/otbVectorDataExtractROI.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Applications/Utils/otbVectorDataExtractROI.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,169 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + + =========================================================================*/ +#include "otbWrapperApplication.h" +#include "otbWrapperApplicationFactory.h" + +#include "otbVectorDataExtractROI.h" +#include "otbVectorDataProperties.h" + +//Misc +#include "otbRemoteSensingRegion.h" + +// Elevation handler +#include "otbWrapperElevationParametersHandler.h" + +#include + +namespace otb +{ +namespace Wrapper +{ + +class VectorDataExtractROI : public Application +{ +public: + /** Standard class typedefs. */ + typedef VectorDataExtractROI Self; + typedef Application Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** Standard macro */ + itkNewMacro(Self); + + itkTypeMacro(VectorDataExtractROI, otb::Application); + + /** Filters typedef */ + // Images + + typedef FloatVectorImageType::PointType PointType; + typedef FloatVectorImageType::IndexType IndexType; + typedef FloatVectorImageType::SizeType SizeType; + typedef FloatVectorImageType::SpacingType SpacingType; + + typedef otb::VectorDataExtractROI VectorDataExtractROIType; + + // Misc + typedef otb::RemoteSensingRegion RemoteSensingRegionType; + +private: + void DoInit() + { + SetName("VectorDataExtractROI"); + SetDescription("Perform an extract ROI on the input vector data according to the input image extent"); + + SetDocName("VectorData Extract ROI"); + SetDocLongDescription("This application extracts the vector data features" + " belonging to a region specified by the support " + "image envelope. Any features intersecting the " + "support region is copied to output. The output " + "geometries are NOT cropped."); + SetDocLimitations("None"); + SetDocAuthors("OTB-Team"); + SetDocSeeAlso(" "); + + AddDocTag(Tags::Vector); + + AddParameter(ParameterType_Group,"io","Input and output data"); + SetParameterDescription("io", "Group containing input and output parameters"); + + AddParameter(ParameterType_InputVectorData, "io.vd", "Input Vector data"); + SetParameterDescription("io.vd", "Input vector data"); + + AddParameter(ParameterType_InputImage, "io.in", "Support image"); + SetParameterDescription("io.in", "Support image that specifies the extracted region"); + + AddParameter(ParameterType_OutputVectorData,"io.out","Output Vector data"); + SetParameterDescription("io.out", "Output extracted vector data"); + + // Elevation + ElevationParametersHandler::AddElevationParameters(this, "elev"); + + // Doc example parameter settings + SetDocExampleParameterValue("io.in", "qb_RoadExtract.tif"); + SetDocExampleParameterValue("io.vd", "qb_RoadExtract_classification.shp"); + SetDocExampleParameterValue("io.out", "apTvUtVectorDataExtractROIApplicationTest.shp"); + } + + void DoUpdateParameters() + { + // Nothing to do here for the parameters : all are independent + } + + void DoExecute() + { + // Get the inputs + VectorDataType* vd = GetParameterVectorData("io.vd"); + FloatVectorImageType* inImage = GetParameterImage("io.in"); + + // Extracting the VectorData + m_VdExtract = VectorDataExtractROIType::New(); + m_VdExtract->SetInput(vd); + + // Find the geographic region of interest + // Get the index of the corner of the image + itk::ContinuousIndex ul(inImage->GetLargestPossibleRegion().GetIndex()); + PointType pul, pur, pll, plr; + ul[0] += -0.5; + ul[1] += -0.5; + itk::ContinuousIndex ur, ll, lr; + ur = ul; + ll = ul; + lr = ul; + ur[0] += inImage->GetLargestPossibleRegion().GetSize()[0]; + lr[0] += inImage->GetLargestPossibleRegion().GetSize()[0]; + lr[1] += inImage->GetLargestPossibleRegion().GetSize()[1]; + ll[1] += inImage->GetLargestPossibleRegion().GetSize()[1]; + + // Transform to physical point + inImage->TransformContinuousIndexToPhysicalPoint(ul, pul); + inImage->TransformContinuousIndexToPhysicalPoint(ur, pur); + inImage->TransformContinuousIndexToPhysicalPoint(ll, pll); + inImage->TransformContinuousIndexToPhysicalPoint(lr, plr); + + // Build the cartographic region + RemoteSensingRegionType rsRegion; + RemoteSensingRegionType::IndexType rsOrigin; + RemoteSensingRegionType::SizeType rsSize; + rsOrigin[0] = std::min(pul[0], plr[0]); + rsOrigin[1] = std::min(pul[1], plr[1]); + rsSize[0] = vcl_abs(pul[0] - plr[0]); + rsSize[1] = vcl_abs(pul[1] - plr[1]); + + rsRegion.SetOrigin(rsOrigin); + rsRegion.SetSize(rsSize); + rsRegion.SetRegionProjection(inImage->GetProjectionRef()); + rsRegion.SetKeywordList(inImage->GetImageKeywordlist()); + + // Set the cartographic region to the extract roi filter + m_VdExtract->SetRegion(rsRegion); + + // Setup the DEM Handler + otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); + + // Set the output vectorData + SetParameterOutputVectorData("io.out", m_VdExtract->GetOutput()); + } + + VectorDataExtractROIType::Pointer m_VdExtract; +}; + +} +} + +OTB_APPLICATION_EXPORT(otb::Wrapper::VectorDataExtractROI) diff -Nru otb-4.0.0/CMake/CommonDefinitions.cmake otb-4.2.0/CMake/CommonDefinitions.cmake --- otb-4.0.0/CMake/CommonDefinitions.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/CommonDefinitions.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,6 +1,6 @@ # This file contains the common build definitions and flags used by default when building all targets -if(WIN32) +if(MSVC) # do not build shared lib under windows set(BUILD_SHARED_LIBS OFF) message(STATUS "Disabling build shared lib option on windows like OS.") diff -Nru otb-4.0.0/CMake/FindOssim.cmake otb-4.2.0/CMake/FindOssim.cmake --- otb-4.0.0/CMake/FindOssim.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/FindOssim.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -2,7 +2,7 @@ # Find the native Ossim includes and library # # OSSIM_FOUND - True if Ossim found. -# OSSIM_INCLUDE_DIRS - where to find tinyxml.h, etc. +# OSSIM_INCLUDE_DIRS - where to find ossim/init/ossimInit.h, etc. # OSSIM_LIBRARIES - List of libraries when using Ossim. # @@ -15,6 +15,16 @@ NAMES ossim/init/ossimInit.h PATHS $ENV{OSSIM_INCLUDE_DIR} /usr/local ) + file(READ "${OSSIM_INCLUDE_DIR}/ossim/ossimVersion.h" _ossim_version_h_CONTENTS) + string(REGEX REPLACE ".*# *define OSSIM_VERSION *\"([0-9.]+)\".*" "\\1" OSSIM_VERSION "${_ossim_version_h_CONTENTS}") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\1" OSSIM_MAJOR_VERSION_NUMBER "${OSSIM_VERSION}") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\2" OSSIM_MINOR_VERSION_NUMBER "${OSSIM_VERSION}") + string(REGEX REPLACE "([0-9]+)\\.([0-9]+)\\.([0-9]+)" "\\3" OSSIM_PATCH_VERSION_NUMBER "${OSSIM_VERSION}") + set(OSSIM_VERSION "${OSSIM_VERSION}" CACHE STRING "OSSIM version" FORCE) + math(EXPR OSSIM_VERSION_NUMBER + "((${OSSIM_MAJOR_VERSION_NUMBER})*100+${OSSIM_MINOR_VERSION_NUMBER})*100+${OSSIM_PATCH_VERSION_NUMBER}") + mark_as_advanced(OSSIM_VERSION) + find_library(OSSIM_LIBRARY NAMES ossim PATHS /usr/local/lib/ossim) @@ -25,12 +35,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS( Ossim DEFAULT_MSG OSSIM_LIBRARY OSSIM_INCLUDE_DIR ) mark_as_advanced( OSSIM_INCLUDE_DIR OSSIM_LIBRARY ) - -if(OSSIM_FOUND) - set(OSSIM_INCLUDE_DIRS ${OSSIM_INCLUDE_DIR}) - set(OSSIM_LIBRARIES ${OSSIM_LIBRARY}) -else() - set(OSSIM_INCLUDE_DIRS) - set(OSSIM_LIBRARIES) -endif() - diff -Nru otb-4.0.0/CMake/ImportBoost.cmake otb-4.2.0/CMake/ImportBoost.cmake --- otb-4.0.0/CMake/ImportBoost.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportBoost.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -6,17 +6,13 @@ if(OTB_USE_EXTERNAL_BOOST) # Import the package - find_package(Boost) + find_package(Boost 1.35.0) mark_as_advanced(Boost_DIR) if(Boost_FOUND) message(STATUS " Found Boost version ${Boost_VERSION}") - if( ${Boost_MINOR_VERSION} LESS 35) - message(WARNING "Boost >= 1.35 is required. Disabling OTB_USE_EXTERNAL_BOOST") - set(OTB_USE_EXTERNAL_BOOST OFF) - endif() else() message(FATAL_ERROR - "Cannot build OTB project without boost library. Please set Boost directories or set OTB_USE_EXTERNAL_BOOST to OFF to use the INTERNAL Boost version") + "Cannot build OTB project without boost library (>1.35.0). Please set Boost directories or set OTB_USE_EXTERNAL_BOOST to OFF to use the INTERNAL Boost version") endif() # Test package completeness diff -Nru otb-4.0.0/CMake/ImportCurl.cmake otb-4.2.0/CMake/ImportCurl.cmake --- otb-4.0.0/CMake/ImportCurl.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportCurl.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -9,7 +9,7 @@ mark_as_advanced(OTB_USE_CURL) if(OTB_USE_CURL) if(CURL_FOUND) - message(STATUS "Using CURL external version") + message(STATUS " Using CURL external version") try_compile(OTB_CURL_MULTI_AVAILABLE ${CMAKE_CURRENT_BINARY_DIR}/CMake ${CMAKE_CURRENT_SOURCE_DIR}/CMake/TestCurlMulti.cxx diff -Nru otb-4.0.0/CMake/ImportExpat.cmake otb-4.2.0/CMake/ImportExpat.cmake --- otb-4.0.0/CMake/ImportExpat.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportExpat.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -13,14 +13,14 @@ # Setup if(OTB_USE_EXTERNAL_EXPAT) if(EXPAT_FOUND) - message(STATUS "Using EXPAT external version") + message(STATUS " Using EXPAT external version") else() # Generate an error if no external EXPAT is available message(FATAL_ERROR "EXPAT required but not found. " "Turn OTB_USE_EXTERNAL_EXPAT to OFF to use the internal version.") endif() else() - message(STATUS "Using EXPAT internal version") + message(STATUS " Using EXPAT internal version") set(EXPAT_LIBRARIES otbexpat) add_definitions(-DOTB_USE_INTERNAL_EXPAT) diff -Nru otb-4.0.0/CMake/ImportGdal.cmake otb-4.2.0/CMake/ImportGdal.cmake --- otb-4.0.0/CMake/ImportGdal.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportGdal.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -33,9 +33,21 @@ if( ${GDAL_FORMATS} MATCHES "hdf" ) set(CHECK_GDAL_BUILT_WITH_HDF 1 CACHE INTERNAL "GDAL_BUILT_WITH_HDF" FORCE) else() - message(STATUS "CHECK_GDAL_BUILT_WITH_HDF test failed : GDAL is not built with hdf support. So the HDF tests will be deactivated. Formats supported by your GDAL: " [ ${GDAL_FORMATS} ] ) + message(STATUS "CHECK_GDAL_BUILT_WITH_HDF test failed : GDAL is not built with hdf support. So the HDF tests will be deactivated. Formats supported by your GDAL: [ " ${GDAL_FORMATS} " ]") set(CHECK_GDAL_BUILT_WITH_HDF 0 CACHE INTERNAL "GDAL_BUILT_WITH_HDF" FORCE) endif() + + # Detect if gdal supports JPEG2000 format + set(GDAL_HAS_J2K OFF) + if ((${GDAL_FORMATS} MATCHES "openjpeg") OR + (${GDAL_FORMATS} MATCHES "jp2kak") OR + (${GDAL_FORMATS} MATCHES "ecw")) + message(STATUS " GDAL is built with a suitable Jpeg2000 driver (OpenJpeg, Kakadu, ECW).") + set(GDAL_HAS_J2K ON) + else() + message(STATUS " GDAL has no suitable Jpeg2000 driver (compatible drivers are : OpenJpeg, Kakadu, ECW).") + endif() + else() # For WIN32 platform, we suppose that GDAL is built with HDF support (case with OSGeo4W) set(CHECK_GDAL_BUILT_WITH_HDF 1 CACHE INTERNAL "GDAL_BUILT_WITH_HDF" FORCE) diff -Nru otb-4.0.0/CMake/ImportJPEG2000.cmake otb-4.2.0/CMake/ImportJPEG2000.cmake --- otb-4.0.0/CMake/ImportJPEG2000.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportJPEG2000.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,8 +1,18 @@ message(STATUS "Importing Jpeg2000...") # Use the openjpeg library. -option(OTB_USE_JPEG2000 "Use to support jpeg2000 image file format." ON) +if(GDAL_HAS_J2K) + set(USE_JPEG2000_DEFAULT OFF) +else() + set(USE_JPEG2000_DEFAULT ON) +endif() + +option(OTB_USE_JPEG2000 "Enable internal support for jpeg2000 image file format." ${USE_JPEG2000_DEFAULT}) mark_as_advanced(OTB_USE_JPEG2000) +cmake_dependent_option(OTB_USE_JPEG2000_TESTING "Use jpeg2000 images in tests." OFF + "NOT OTB_USE_JPEG2000;NOT GDAL_HAS_J2K" ON) +mark_as_advanced(OTB_USE_JPEG2000_TESTING) + if(OTB_USE_JPEG2000) message(STATUS " Enabling Jpeg2000 support") diff -Nru otb-4.0.0/CMake/ImportLibKML.cmake otb-4.2.0/CMake/ImportLibKML.cmake --- otb-4.0.0/CMake/ImportLibKML.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportLibKML.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -5,7 +5,22 @@ option(OTB_USE_EXTERNAL_LIBKML "Use external LibKML library." ON) else() option(OTB_USE_EXTERNAL_LIBKML "Use external LibKML library." OFF) - set(LIBKML_LIBRARIES otbkml) - message(STATUS "Using LibKML internal version") endif() mark_as_advanced(OTB_USE_EXTERNAL_LIBKML) + +if(OTB_USE_EXTERNAL_LIBKML) + if(NOT LIBKML_FOUND) + message(FATAL_ERROR "Can't build OTB without LibKML. Instal it " + "on your system, or disable the option " + "OTB_USE_EXTERNAL_LIBKML to use internal one") + endif() +else() + set(LIBKML_LIBRARIES otbkml) + message(STATUS " Using LibKML internal version") + # Known issue in OTB which does not compile with external ITK and internal libkml + if (OTB_USE_EXTERNAL_ITK) + message(WARNING "There is a known issue which does not allow to use internal libKML with external ITK in OTB." + "You might consider using an external LibKML. " + "See http://bugs.orfeo-toolbox.org/view.php?id=896 for details") + endif() +endif() diff -Nru otb-4.0.0/CMake/ImportMuParser.cmake otb-4.2.0/CMake/ImportMuParser.cmake --- otb-4.0.0/CMake/ImportMuParser.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportMuParser.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -3,35 +3,49 @@ if(MUPARSER_FOUND) option(OTB_USE_EXTERNAL_MUPARSER "Use external MuParser library." ON) +else() + option(OTB_USE_EXTERNAL_MUPARSER "Use external MuParser library." OFF) +endif() +mark_as_advanced(OTB_USE_EXTERNAL_MUPARSER) - # Starting with muparser 2.0.0, - # intrinsic operators "and", "or", "xor" have been removed - # and intrinsic operators "&&" and "||" have been introduced as replacements - set(CMAKE_REQUIRED_INCLUDES ${MUPARSER_INCLUDE_DIR}) - set(CMAKE_REQUIRED_LIBRARIES ${MUPARSER_LIBRARIES}) - unset(CMAKE_REQUIRED_FLAGS) - unset(CMAKE_REQUIRED_DEFINES) - file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CMake/otbTestMuParserHasCxxLogicalOperators.cxx - OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE) - check_cxx_source_runs( - "${OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE}" - OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS - ) - unset(CMAKE_REQUIRED_INCLUDES) - unset(CMAKE_REQUIRED_LIBRARIES) - unset(CMAKE_REQUIRED_FLAGS) - unset(CMAKE_REQUIRED_DEFINES) +if(OTB_USE_EXTERNAL_MUPARSER) + if(MUPARSER_FOUND) + # Starting with muparser 2.0.0, + # intrinsic operators "and", "or", "xor" have been removed + # and intrinsic operators "&&" and "||" have been introduced as replacements + set(CMAKE_REQUIRED_INCLUDES ${MUPARSER_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${MUPARSER_LIBRARIES}) + unset(CMAKE_REQUIRED_FLAGS) + unset(CMAKE_REQUIRED_DEFINES) + file(READ ${CMAKE_CURRENT_SOURCE_DIR}/CMake/otbTestMuParserHasCxxLogicalOperators.cxx + OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE) + check_cxx_source_runs( + "${OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS_SOURCEFILE}" + OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS + ) + unset(CMAKE_REQUIRED_INCLUDES) + unset(CMAKE_REQUIRED_LIBRARIES) + unset(CMAKE_REQUIRED_FLAGS) + unset(CMAKE_REQUIRED_DEFINES) - if(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS) - message(STATUS " Testing if muParser has '&&' operator -- yes") + if(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS) + message(STATUS " MuParser version is >= 2.0.0 : " + "uses '&&' and '||' logical operators, and C++ like " + "ternary if-then-else operator") + else() + message(STATUS " MuParser version is < 2.0.0 : " + "uses 'and' and 'or' logical operators, and ternary " + "operator 'if( ; ; )'") + endif() else() - message(STATUS " Testing if muParser has '&&' operator -- no") + message(FATAL_ERROR "Can't build OTB without MuParser. Instal it " + "on your system, or disable the option " + "OTB_USE_EXTERNAL_MUPARSER to use internal one") endif() - else() - option(OTB_USE_EXTERNAL_MUPARSER "Use external MuParser library." OFF) set(MUPARSER_LIBRARIES otbmuparser) unset(OTB_MUPARSER_HAS_CXX_LOGICAL_OPERATORS) # internal version is < 2.0.0 - message(STATUS " Using MuParser internal version") + message(STATUS " Using MuParser internal version : uses 'and' and 'or' " + "logical operators, and ternary operator 'if( ; ; )' ") endif() -mark_as_advanced(OTB_USE_EXTERNAL_MUPARSER) + diff -Nru otb-4.0.0/CMake/ImportOpenThreads.cmake otb-4.2.0/CMake/ImportOpenThreads.cmake --- otb-4.0.0/CMake/ImportOpenThreads.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportOpenThreads.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -6,27 +6,33 @@ mark_as_advanced(OPENTHREADS_LIBRARY) mark_as_advanced(OPENTHREADS_LIBRARY_DEBUG) -set(OTB_USE_EXTERNAL_OPENTHREADS ON CACHE INTERNAL "") -if(OPENTHREADS_FOUND AND OTB_USE_EXTERNAL_OPENTHREADS) - - include_directories(${OPENTHREADS_INCLUDE_DIR}) - link_directories( ${OPENTHREADS_LIBRARY} ) - - message(STATUS " Using OpenThreads external version") - message(STATUS " OpenThreads includes : ${OPENTHREADS_INCLUDE_DIR}") - message(STATUS " OpenThreads library : ${OPENTHREADS_LIBRARY}") - +if(OPENTHREADS_FOUND) + option(OTB_USE_EXTERNAL_OPENTHREADS "Use external OpenThreads library." ON) else() + option(OTB_USE_EXTERNAL_OPENTHREADS "Use external OpenThreads library." OFF) +endif() +mark_as_advanced(OTB_USE_EXTERNAL_OPENTHREADS) - add_definitions(-DOTB_USE_INTERNAL_OPENTHREADS) - set(OTB_USE_EXTERNAL_OPENTHREADS OFF) - set(OPENTHREADS_INCLUDE_DIR "${OTB_SOURCE_DIR}/Utilities/otbopenthreads/OpenThreads/include") - set(OPENTHREADS_LIBRARY "OpenThreads" ) - include_directories(${OPENTHREADS_INCLUDE_DIR}) - if(NOT BUILD_SHARED_LIBS) - add_definitions(-DOT_LIBRARY_STATIC) - endif() - - message(STATUS " Using OpenThreads internal version") - +if(OTB_USE_EXTERNAL_OPENTHREADS) + if(OPENTHREADS_FOUND) + include_directories(${OPENTHREADS_INCLUDE_DIR}) + link_directories( ${OPENTHREADS_LIBRARY} ) + + message(STATUS " Using OpenThreads external version") + message(STATUS " OpenThreads includes : ${OPENTHREADS_INCLUDE_DIR}") + message(STATUS " OpenThreads library : ${OPENTHREADS_LIBRARY}") + else() + message(FATAL_ERROR "Can't build OTB without OpenThreads. Install it " + "on your system, or disable the option " + "OTB_USE_EXTERNAL_OPENTHREADS to use the internal one") + endif() +else() + add_definitions(-DOTB_USE_INTERNAL_OPENTHREADS) + set(OPENTHREADS_INCLUDE_DIR "${OTB_SOURCE_DIR}/Utilities/otbopenthreads/OpenThreads/include") + set(OPENTHREADS_LIBRARY "OpenThreads" ) + include_directories(${OPENTHREADS_INCLUDE_DIR}) + if(NOT BUILD_SHARED_LIBS) + add_definitions(-DOT_LIBRARY_STATIC) + endif() + message(STATUS " Using OpenThreads internal version") endif() diff -Nru otb-4.0.0/CMake/ImportOssim.cmake otb-4.2.0/CMake/ImportOssim.cmake --- otb-4.0.0/CMake/ImportOssim.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportOssim.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -8,15 +8,28 @@ set(DEFAULT_OTB_USE_EXTERNAL_OSSIM ON) endif() -option(OTB_USE_EXTERNAL_OSSIM "Use an outside build of Ossim." ${DEFAULT_OTB_USE_EXTERNAL_OSSIM}) +option(OTB_USE_EXTERNAL_OSSIM " Use an outside build of Ossim." ${DEFAULT_OTB_USE_EXTERNAL_OSSIM}) mark_as_advanced(OTB_USE_EXTERNAL_OSSIM) if(OTB_USE_EXTERNAL_OSSIM) find_package(Ossim REQUIRED) + if(OSSIM_FOUND) + set(OSSIM_INCLUDE_DIRS ${OSSIM_INCLUDE_DIR}) + set(OSSIM_LIBRARIES ${OSSIM_LIBRARY}) + message(STATUS " Found OSSIM library at ${OSSIM_LIBRARY}") + message(STATUS " OSSIM version is " ${OSSIM_VERSION}) + message(STATUS " Using OSSIM external version") + else() + set(OSSIM_INCLUDE_DIRS) + set(OSSIM_LIBRARIES) + #No external ossim found + message(FATAL_ERROR "OSSIM library is required but not found. " + "Turn OTB_USE_EXTERNAL_OSSIM to OFF to use the internal version.") + endif() else() set(OSSIM_LIBRARIES otbossim) if(WIN32 AND NOT BUILD_SHARED_LIBS) add_definitions(-DOSSIM_STATIC) endif() - message(STATUS "Using Ossim internal version") + message(STATUS " Using OSSIM internal version") endif() diff -Nru otb-4.0.0/CMake/ImportSiftFast.cmake otb-4.2.0/CMake/ImportSiftFast.cmake --- otb-4.0.0/CMake/ImportSiftFast.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportSiftFast.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,4 +1,4 @@ message(STATUS "Importing libSiftFast...") option(OTB_USE_SIFTFAST "Use Fast SIFT Image Features Library" ON) -message(STATUS "Using libSiftFast internal version") +message(STATUS " Using libSiftFast internal version") mark_as_advanced(OTB_USE_SIFTFAST) diff -Nru otb-4.0.0/CMake/ImportTinyXML.cmake otb-4.2.0/CMake/ImportTinyXML.cmake --- otb-4.0.0/CMake/ImportTinyXML.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/ImportTinyXML.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -3,19 +3,27 @@ if(TINYXML_FOUND) option(OTB_USE_EXTERNAL_TINYXML "Use external TinyXML library." ON) - - # Check if STL support is enabled with macro TIXML_USE_STL - try_compile(TIXML_USE_STL - ${CMAKE_CURRENT_BINARY_DIR}/CMake - ${CMAKE_CURRENT_SOURCE_DIR}/CMake/otbTestTinyXMLUseSTL.cxx - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TINYXML_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${TINYXML_LIBRARIES}" - COMPILE_DEFINITIONS "-DTIXML_USE_STL" - OUTPUT_VARIABLE OUTPUT) - else() option(OTB_USE_EXTERNAL_TINYXML "Use external TinyXML library." OFF) +endif() +mark_as_advanced(OTB_USE_EXTERNAL_TINYXML) + +if(OTB_USE_EXTERNAL_TINYXML) + if(TINYXML_FOUND) + # Check if STL support is enabled with macro TIXML_USE_STL + try_compile(TIXML_USE_STL + ${CMAKE_CURRENT_BINARY_DIR}/CMake + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/otbTestTinyXMLUseSTL.cxx + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:PATH=${TINYXML_INCLUDE_DIRS}" "-DLINK_LIBRARIES:STRING=${TINYXML_LIBRARIES}" + COMPILE_DEFINITIONS "-DTIXML_USE_STL" + OUTPUT_VARIABLE OUTPUT) + else() + message(FATAL_ERROR "Can't build OTB without TinyXML. Install it " + "on your system, or disable the option " + "OTB_USE_EXTERNAL_TINYXML to use the internal one") + endif() +else() set(TINYXML_LIBRARIES otbtinyXML) set(TIXML_USE_STL) - message(STATUS "Using TinyXML internal version") + message(STATUS " Using TinyXML internal version") endif() -mark_as_advanced(OTB_USE_EXTERNAL_TINYXML) diff -Nru otb-4.0.0/CMake/otbIncludeDirectories.cmake otb-4.2.0/CMake/otbIncludeDirectories.cmake --- otb-4.0.0/CMake/otbIncludeDirectories.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/otbIncludeDirectories.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -69,7 +69,7 @@ ${JPEG_INCLUDE_DIRS} ${OGR_INCLUDE_DIRS}) -if(WIN32) +if(MSVC) set(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Utilities/otbmsinttypes ) endif() @@ -97,7 +97,7 @@ if(OTB_USE_EXTERNAL_LIBKML) set(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} - ${LIBKML_INCLUDE_DIRS}) + ${LIBKML_INCLUDE_DIR}) else() set(OTB_INCLUDE_DIRS_BUILD_TREE ${OTB_INCLUDE_DIRS_BUILD_TREE} ${OTB_SOURCE_DIR}/Utilities/otbkml/src) @@ -296,7 +296,7 @@ #For LibKML header file if(OTB_USE_EXTERNAL_LIBKML) set(OTB_INCLUDE_ABSOLUE_DIRS ${OTB_INCLUDE_ABSOLUE_DIRS} - ${LIBKML_INCLUDE_DIRS}) + ${LIBKML_INCLUDE_DIR}) else() set(OTB_INCLUDE_RELATIVE_DIRS ${OTB_INCLUDE_RELATIVE_DIRS} Utilities/otbkml) diff -Nru otb-4.0.0/CMake/TestGDALHasOGR.cxx otb-4.2.0/CMake/TestGDALHasOGR.cxx --- otb-4.0.0/CMake/TestGDALHasOGR.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/TestGDALHasOGR.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -1,10 +1,23 @@ #ifdef WIN32 #define CPL_DISABLE_DLL #endif -#include "ogrsf_frmts.h" +#include "ogr_api.h" int main(int argc,char * argv[]) { - OGRSFDriverRegistrar::Open(argv[1], FALSE); + OGRDataSourceH hDS; + OGRSFDriverH *pahDriver; + + OGRRegisterAll(); + + hDS = OGROpen(argv[1], FALSE, pahDriver ); + + if( hDS == NULL ) + { + return -1; + } + + OGRReleaseDataSource( hDS ); + return 0; } diff -Nru otb-4.0.0/CMake/UseOTB.cmake.in otb-4.2.0/CMake/UseOTB.cmake.in --- otb-4.0.0/CMake/UseOTB.cmake.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMake/UseOTB.cmake.in 2014-09-03 08:29:34.000000000 +0000 @@ -89,7 +89,7 @@ if(OTB_USE_EXTERNAL_LIBKML) find_package(LibKML REQUIRED) - include_directories(${LIBKML_INCLUDE_DIRS}) + include_directories(${LIBKML_INCLUDE_DIR}) endif() if(OTB_USE_EXTERNAL_TINYXML) diff -Nru otb-4.0.0/CMakeLists.txt otb-4.2.0/CMakeLists.txt --- otb-4.0.0/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ #----------------------------------------------------------------------------- # OTB version number. An even minor number corresponds to releases. set(OTB_VERSION_MAJOR "4") -set(OTB_VERSION_MINOR "0") +set(OTB_VERSION_MINOR "2") set(OTB_VERSION_PATCH "0") # Version string should not include patch level. The major.minor is @@ -273,6 +273,13 @@ # generate OTBConfig.cmake list(APPEND OTB_INCLUDE_DIRS_BUILD_TREE ${ITK_INCLUDE_DIRS}) +if(OTB_COMPILE_WITH_FULL_WARNING) + if(CMAKE_COMPILER_IS_GNUCXX) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OTB_FULL_WARNING_LIST_PARAMETERS}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTB_FULL_WARNING_LIST_PARAMETERS}") + endif() +endif() + add_subdirectory(Code) if(BUILD_APPLICATIONS) diff -Nru otb-4.0.0/Code/ApplicationEngine/CMakeLists.txt otb-4.2.0/Code/ApplicationEngine/CMakeLists.txt --- otb-4.0.0/Code/ApplicationEngine/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -2,7 +2,7 @@ # Sources of non-templated classes. file(GLOB OTBApplicationEngine_SRCS "*.cxx" ) -if(WIN32) +if(MSVC) set(CMAKE_C_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}") set(CMAKE_CXX_FLAGS "/bigobj ${CMAKE_CXX_FLAGS}") endif() diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperAddProcessToWatchEvent.h otb-4.2.0/Code/ApplicationEngine/otbWrapperAddProcessToWatchEvent.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperAddProcessToWatchEvent.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperAddProcessToWatchEvent.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ * itk::ProcessObject and a string describing the process. * */ -class ITK_EXPORT AddProcessToWatchEvent: public itk::EventObject +class ITK_ABI_EXPORT AddProcessToWatchEvent: public itk::EventObject { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperApplicationFactory.h otb-4.2.0/Code/ApplicationEngine/otbWrapperApplicationFactory.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperApplicationFactory.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperApplicationFactory.h 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ { template < class TApplication > -class ApplicationFactory : public itk::ObjectFactoryBase +class ITK_ABI_EXPORT ApplicationFactory : public itk::ObjectFactoryBase { public: /** Standard class typedefs. */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperApplication.h otb-4.2.0/Code/ApplicationEngine/otbWrapperApplication.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperApplication.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperApplication.h 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ * TODO * */ -class ITK_EXPORT Application: public itk::Object +class ITK_ABI_EXPORT Application: public itk::Object { public: /** Standard class typedefs. */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGenerator.h otb-4.2.0/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGenerator.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ * class doc attributes. */ -class ITK_EXPORT ApplicationHtmlDocGenerator +class ITK_ABI_EXPORT ApplicationHtmlDocGenerator { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperApplicationRegistry.h otb-4.2.0/Code/ApplicationEngine/otbWrapperApplicationRegistry.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperApplicationRegistry.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperApplicationRegistry.h 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ * TODO * */ -class ITK_EXPORT ApplicationRegistry : public itk::Object +class ITK_ABI_EXPORT ApplicationRegistry : public itk::Object { public: /** Standard class typedefs. */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperChoiceParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperChoiceParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperChoiceParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperChoiceParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ * Represents an enumerated parameter. * The different values of the enumeration can be associated with a parameter */ -class ChoiceParameter +class ITK_ABI_EXPORT ChoiceParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.cxx otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.cxx --- otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -17,9 +17,6 @@ =========================================================================*/ #include "otbWrapperComplexInputImageParameter.h" #include "itksys/SystemTools.hxx" -#include "otbImageFileReader.h" -#include "itkCastImageFilter.h" -#include "otbImageToVectorImageCastFilter.h" #include "otbWrapperTypes.h" @@ -96,133 +93,6 @@ otbGetImageMacro(ComplexFloatVectorImage); otbGetImageMacro(ComplexDoubleVectorImage); -template -TOutputImage * -ComplexInputImageParameter::GetImage() -{ - // Used m_PreviousFileName because if not, when the user call twice GetImage, - // it without changing the filename, it returns 2 different - // image pointers - // Only one image type can be used - - // 2 cases : the user set a filename vs. the user set an image - if (m_UseFilename) - { - if( m_PreviousFileName!=m_FileName && !m_FileName.empty() ) - { - //////////////////////// Filename case: - // A new valid filename has been given : a reader is created - m_PreviousFileName = m_FileName; - typedef otb::ImageFileReader ReaderType; - typename ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(m_FileName); - try - { - reader->UpdateOutputInformation(); - } - catch(itk::ExceptionObject &) - { - this->ClearValue(); - } - - m_Image = reader->GetOutput(); - m_Reader = reader; - - // Pay attention, don't return m_Image because it is a ImageBase... - return reader->GetOutput(); - } - else - { - // In this case, the reader and the image should already be there - if (m_Image.IsNull()) - { - itkExceptionMacro("No input image or filename detected..."); - } - else - { - // Check if the image type asked here is the same as the one used for the reader - if (dynamic_cast (m_Image.GetPointer())) - { - return dynamic_cast (m_Image.GetPointer()); - } - else - { - itkExceptionMacro("Cannot ask a different image type"); - } - } - } - } - else - { - //////////////////////// Image case: - if( m_Image.IsNull() ) - { - itkExceptionMacro("No input image or filename detected..."); - } - else - { - if (dynamic_cast(m_Image.GetPointer())) - { - return CastImage(); - } - else if (dynamic_cast(m_Image.GetPointer())) - { - return CastImage(); - } - else if (dynamic_cast(m_Image.GetPointer())) - { - return CastImage(); - } - else if (dynamic_cast(m_Image.GetPointer())) - { - return CastImage(); - } - else - { - itkExceptionMacro("Unknown image type"); - } - } - } -} - - -template -TOutputImage* -ComplexInputImageParameter::SimpleCastImage() -{ - TComplexInputImage* realComplexInputImage = dynamic_cast(m_Image.GetPointer()); - - typedef itk::CastImageFilter CasterType; - typename CasterType::Pointer caster = CasterType::New(); - - caster->SetInput(realComplexInputImage); - caster->UpdateOutputInformation(); - - m_Image = caster->GetOutput(); - m_Caster = caster; - - return caster->GetOutput(); -} - - -template -TOutputImage* -ComplexInputImageParameter::CastVectorImageFromImage() -{ - TComplexInputImage* realComplexInputImage = dynamic_cast(m_Image.GetPointer()); - - typedef ImageToVectorImageCastFilter CasterType; - typename CasterType::Pointer caster = CasterType::New(); - - caster->SetInput(realComplexInputImage); - caster->UpdateOutputInformation(); - - m_Image = caster->GetOutput(); - m_Caster = caster; - - return caster->GetOutput(); -} - #define otbCastImageMacro(ComplexInputImageType, OutputImageType, theMethod) \ template<> OutputImageType * \ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ * \brief This class represents a ComplexInputImage parameter */ -class ITK_EXPORT ComplexInputImageParameter : public Parameter +class ITK_ABI_EXPORT ComplexInputImageParameter : public Parameter { public: /** Standard class typedef */ @@ -74,11 +74,7 @@ /** Generic cast method that will be specified for each image type. */ template - TOutputImage* CastImage() - { - itkExceptionMacro("Cast from "< should be declared in header +// so that the linker knows they exist when building OTB Applications + +#define otbDefineCastImageMacro(ComplexInputImageType, OutputImageType) \ + template<> OutputImageType * \ + ComplexInputImageParameter::CastImage(); \ + +#define otbGenericDefineCastImageMacro(ComplexInputImageType, prefix) \ + otbDefineCastImageMacro(ComplexInputImageType, ComplexFloat##prefix##ImageType) \ + otbDefineCastImageMacro(ComplexInputImageType, ComplexDouble##prefix##ImageType) + + +/********************************************************************* +********************** Image -> Image +**********************************************************************/ + + otbGenericDefineCastImageMacro(ComplexFloatImageType, ) + otbGenericDefineCastImageMacro(ComplexDoubleImageType, ) + + +/********************************************************************* +********************** VectorImage -> VectorImage +**********************************************************************/ + otbGenericDefineCastImageMacro(ComplexFloatVectorImageType, Vector) + otbGenericDefineCastImageMacro(ComplexDoubleVectorImageType, Vector) + } // End namespace Wrapper } // End namespace otb +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbWrapperComplexInputImageParameter.txx" +#endif + #endif diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.txx otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.txx --- otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.txx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexInputImageParameter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,173 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbWrapperComplexInputImageParameter_txx +#define __otbWrapperComplexInputImageParameter_txx + +#include "otbWrapperComplexInputImageParameter.h" + +#include "otbImageFileReader.h" +#include "itkCastImageFilter.h" +#include "otbImageToVectorImageCastFilter.h" + +namespace otb +{ +namespace Wrapper +{ + + +template +TOutputImage * +ComplexInputImageParameter::GetImage() +{ + // Used m_PreviousFileName because if not, when the user call twice GetImage, + // it without changing the filename, it returns 2 different + // image pointers + // Only one image type can be used + + // 2 cases : the user set a filename vs. the user set an image + if (m_UseFilename) + { + if( m_PreviousFileName!=m_FileName && !m_FileName.empty() ) + { + //////////////////////// Filename case: + // A new valid filename has been given : a reader is created + m_PreviousFileName = m_FileName; + typedef otb::ImageFileReader ReaderType; + typename ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(m_FileName); + try + { + reader->UpdateOutputInformation(); + } + catch(itk::ExceptionObject &) + { + this->ClearValue(); + } + + m_Image = reader->GetOutput(); + m_Reader = reader; + + // Pay attention, don't return m_Image because it is a ImageBase... + return reader->GetOutput(); + } + else + { + // In this case, the reader and the image should already be there + if (m_Image.IsNull()) + { + itkExceptionMacro("No input image or filename detected..."); + } + else + { + // Check if the image type asked here is the same as the one used for the reader + if (dynamic_cast (m_Image.GetPointer())) + { + return dynamic_cast (m_Image.GetPointer()); + } + else + { + itkExceptionMacro("Cannot ask a different image type"); + } + } + } + } + else + { + //////////////////////// Image case: + if( m_Image.IsNull() ) + { + itkExceptionMacro("No input image or filename detected..."); + } + else + { + if (dynamic_cast(m_Image.GetPointer())) + { + return CastImage(); + } + else if (dynamic_cast(m_Image.GetPointer())) + { + return CastImage(); + } + else if (dynamic_cast(m_Image.GetPointer())) + { + return CastImage(); + } + else if (dynamic_cast(m_Image.GetPointer())) + { + return CastImage(); + } + else + { + itkExceptionMacro("Unknown image type"); + } + } + } +} + + +template +TOutputImage* +ComplexInputImageParameter::CastImage() +{ + itkExceptionMacro("Cast from "< +TOutputImage* +ComplexInputImageParameter::SimpleCastImage() +{ + TComplexInputImage* realComplexInputImage = dynamic_cast(m_Image.GetPointer()); + + typedef itk::CastImageFilter CasterType; + typename CasterType::Pointer caster = CasterType::New(); + + caster->SetInput(realComplexInputImage); + caster->UpdateOutputInformation(); + + m_Image = caster->GetOutput(); + m_Caster = caster; + + return caster->GetOutput(); +} + + +template +TOutputImage* +ComplexInputImageParameter::CastVectorImageFromImage() +{ + TComplexInputImage* realComplexInputImage = dynamic_cast(m_Image.GetPointer()); + + typedef ImageToVectorImageCastFilter CasterType; + typename CasterType::Pointer caster = CasterType::New(); + + caster->SetInput(realComplexInputImage); + caster->UpdateOutputInformation(); + + m_Image = caster->GetOutput(); + m_Caster = caster; + + return caster->GetOutput(); +} + + +} // End namespace Wrapper +} // End namespace otb + +#endif diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexOutputImageParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexOutputImageParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperComplexOutputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperComplexOutputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ * \brief This class represents a ComplexOutputImage parameter */ -class ITK_EXPORT ComplexOutputImageParameter : public Parameter +class ITK_ABI_EXPORT ComplexOutputImageParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperDirectoryParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperDirectoryParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperDirectoryParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperDirectoryParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class DirectoryParameter * \brief This class represent a string parameter for the wrapper framework */ -class DirectoryParameter +class ITK_ABI_EXPORT DirectoryParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperDocExampleStructure.h otb-4.2.0/Code/ApplicationEngine/otbWrapperDocExampleStructure.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperDocExampleStructure.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperDocExampleStructure.h 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,7 @@ * User has to set the application name, the binary path and a list of * key/value couple. */ -class DocExampleStructure : +class ITK_ABI_EXPORT DocExampleStructure : public itk::Object { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx otb-4.2.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx --- otb-4.0.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,7 @@ otb::DEMHandler::Instance()->SetDefaultHeightAboveEllipsoid(GetDefaultElevation(app,key)); std::ostringstream oss; - oss<<"Elevation management: setting default height above ellipsoid to " << GetDefaultElevation(app,key) << " meters"<GetLogger()->Info(oss.str()); diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h otb-4.2.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperElevationParametersHandler.h 2014-09-03 08:29:34.000000000 +0000 @@ -45,16 +45,16 @@ * Add a Group containing several choices for map projections * */ - static void AddElevationParameters(Application::Pointer app, const std::string & key); + static ITK_ABI_EXPORT void AddElevationParameters(Application::Pointer app, const std::string & key); /** Method for getting the value of the elevation mode selected */ - static float GetDefaultElevation(const Application::Pointer app, const std::string& key); - static const std::string GetGeoidFile(const Application::Pointer app, const std::string& key); - static const std::string GetDEMDirectory(const Application::Pointer app, const std::string& key); - static bool IsGeoidUsed(const Application::Pointer app, const std::string& key); - static bool IsDEMUsed(const Application::Pointer app, const std::string & key); + static ITK_ABI_EXPORT float GetDefaultElevation(const Application::Pointer app, const std::string& key); + static ITK_ABI_EXPORT const std::string GetGeoidFile(const Application::Pointer app, const std::string& key); + static ITK_ABI_EXPORT const std::string GetDEMDirectory(const Application::Pointer app, const std::string& key); + static ITK_ABI_EXPORT bool IsGeoidUsed(const Application::Pointer app, const std::string& key); + static ITK_ABI_EXPORT bool IsDEMUsed(const Application::Pointer app, const std::string & key); - static void SetupDEMHandlerFromElevationParameters(const Application::Pointer app, const std::string& key); + static ITK_ABI_EXPORT void SetupDEMHandlerFromElevationParameters(const Application::Pointer app, const std::string& key); protected: ElevationParametersHandler(); // not implemented diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperEmptyParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperEmptyParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperEmptyParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperEmptyParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ /** \class EmptyParameter * \brief This class represent an empty parameter for the wrapper framework (boolean value) */ -class EmptyParameter +class ITK_ABI_EXPORT EmptyParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputFilenameListParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperInputFilenameListParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputFilenameListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputFilenameListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ * \brief This class represents a list of InputFilename parameter */ -class ITK_EXPORT InputFilenameListParameter : public Parameter +class ITK_ABI_EXPORT InputFilenameListParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputFilenameParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperInputFilenameParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputFilenameParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputFilenameParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ /** \class InputFilenameParameter * \brief This class represent a string parameter for the wrapper framework */ -class InputFilenameParameter +class ITK_ABI_EXPORT InputFilenameParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageListParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageListParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ * \brief This class represents a list of InputImage parameter */ -class ITK_EXPORT InputImageListParameter : public Parameter +class ITK_ABI_EXPORT InputImageListParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -17,9 +17,6 @@ =========================================================================*/ #include "otbWrapperInputImageParameter.h" #include "itksys/SystemTools.hxx" -#include "otbImageFileReader.h" -#include "itkCastImageFilter.h" -#include "otbImageToVectorImageCastFilter.h" #include "otbWrapperTypes.h" #include @@ -111,183 +108,32 @@ otbGetImageMacro(UInt8RGBAImage); -template -TOutputImage * -InputImageParameter::GetImage() +void +InputImageParameter::SetImage(FloatVectorImageType* image) { - otbMsgDevMacro(<< "GetImage()"); - - // Used m_PreviousFileName because if not, when the user call twice GetImage, - // it without changing the filename, it returns 2 different - // image pointers - // Only one image type can be used - - // 2 cases : the user set a filename vs. the user set an image - if (m_UseFilename) - { - if( m_PreviousFileName!=m_FileName && !m_FileName.empty() ) - { - //////////////////////// Filename case: - // A new valid filename has been given : a reader is created - m_PreviousFileName = m_FileName; - typedef otb::ImageFileReader ReaderType; - typename ReaderType::Pointer reader = ReaderType::New(); - reader->SetFileName(m_FileName); - - try - { - reader->UpdateOutputInformation(); - } - catch (itk::ExceptionObject &) - { - this->ClearValue(); - } - - m_Image = reader->GetOutput(); - m_Reader = reader; - - // Pay attention, don't return m_Image because it is a ImageBase... - return reader->GetOutput(); - } - else - { - // In this case, the reader and the image should already be there - if (m_Image.IsNull()) - { - itkExceptionMacro("No input image or filename detected..."); - } - else - { - // Check if the image type asked here is the same as the one used for the reader - if (dynamic_cast (m_Image.GetPointer())) - { - return dynamic_cast (m_Image.GetPointer()); - } - else - { - itkExceptionMacro("Cannot ask a different image type"); - } - } - } - } - else - { - //////////////////////// Image case: - if (m_Image.IsNull()) - { - itkExceptionMacro("No input image or filename detected..."); - } - else - { - if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else if (dynamic_cast (m_Image.GetPointer())) - { - return CastImage (); - } - else - { - itkExceptionMacro("Unknown image type"); - } - } - } - + m_UseFilename = false; + this->SetImage( image ); } -template -TOutputImage* -InputImageParameter::SimpleCastImage() +bool +InputImageParameter::HasValue() const { - TInputImage* realInputImage = dynamic_cast(m_Image.GetPointer()); - - typedef itk::CastImageFilter CasterType; - typename CasterType::Pointer caster = CasterType::New(); - - caster->SetInput(realInputImage); - caster->UpdateOutputInformation(); - - m_Image = caster->GetOutput(); - m_Caster = caster; - - return caster->GetOutput(); + if( m_FileName.empty() && m_Image.IsNull() ) + return false; + else + return true; } - -template -TOutputImage* -InputImageParameter::CastVectorImageFromImage() +void +InputImageParameter::ClearValue() { - TInputImage* realInputImage = dynamic_cast(m_Image.GetPointer()); - - typedef ImageToVectorImageCastFilter CasterType; - typename CasterType::Pointer caster = CasterType::New(); - - caster->SetInput(realInputImage); - caster->UpdateOutputInformation(); - - m_Image = caster->GetOutput(); - m_Caster = caster; - - return caster->GetOutput(); + m_Image = NULL; + m_Reader = NULL; + m_Caster = NULL; + m_FileName = ""; + m_PreviousFileName=""; + m_UseFilename = true; } @@ -344,44 +190,6 @@ otbGenericCastImageMacro(DoubleImageType, CastVectorImageFromImage, Vector) -void -InputImageParameter::SetImage(FloatVectorImageType* image) -{ - m_UseFilename = false; - this->SetImage( image ); -} - - -template -void -InputImageParameter::SetImage(TInputImage* image) -{ - m_UseFilename = false; - m_Image = image; -} - - -bool -InputImageParameter::HasValue() const -{ - if( m_FileName.empty() && m_Image.IsNull() ) - return false; - else - return true; -} - -void -InputImageParameter::ClearValue() -{ - m_Image = NULL; - m_Reader = NULL; - m_Caster = NULL; - m_FileName = ""; - m_PreviousFileName=""; - m_UseFilename = true; -} - - } } diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ * \brief This class represents a InputImage parameter */ -class ITK_EXPORT InputImageParameter : public Parameter +class ITK_ABI_EXPORT InputImageParameter : public Parameter { public: /** Standard class typedef */ @@ -80,7 +80,6 @@ template TImageType* GetImage(); - /** Set a FloatVectorImageType image.*/ void SetImage(FloatVectorImageType* image); @@ -89,13 +88,10 @@ void SetImage(TImageType* image); - /** Generic cast method that will be specified for each image type. */ + /** Generic cast method that will be specified for each image type. */ template - TOutputImage* CastImage() - { - itkExceptionMacro("Cast from "< @@ -159,7 +155,68 @@ }; // End class InputImage Parameter + +// template specializations of CastImage<> should be declared in header +// so that the linker knows they exist when building OTB Applications + +#define otbDeclareCastImageMacro(InputImageType, OutputImageType) \ + template<> OutputImageType * \ + InputImageParameter::CastImage(); \ + +#define otbGenericDeclareCastImageMacro(InputImageType, prefix) \ + otbDeclareCastImageMacro(InputImageType, UInt8##prefix##ImageType) \ + otbDeclareCastImageMacro(InputImageType, UInt16##prefix##ImageType) \ + otbDeclareCastImageMacro(InputImageType, Int16##prefix##ImageType) \ + otbDeclareCastImageMacro(InputImageType, UInt32##prefix##ImageType) \ + otbDeclareCastImageMacro(InputImageType, Int32##prefix##ImageType) \ + otbDeclareCastImageMacro(InputImageType, Float##prefix##ImageType) \ + otbDeclareCastImageMacro(InputImageType, Double##prefix##ImageType) + + +/********************************************************************* +********************** Image -> Image +**********************************************************************/ +otbGenericDeclareCastImageMacro(UInt8ImageType, ) +otbGenericDeclareCastImageMacro(Int16ImageType, ) +otbGenericDeclareCastImageMacro(UInt16ImageType, ) +otbGenericDeclareCastImageMacro(Int32ImageType, ) +otbGenericDeclareCastImageMacro(UInt32ImageType, ) +otbGenericDeclareCastImageMacro(FloatImageType, ) +otbGenericDeclareCastImageMacro(DoubleImageType, ) + + +/********************************************************************* +********************** VectorImage -> VectorImage +**********************************************************************/ +otbGenericDeclareCastImageMacro(UInt8VectorImageType, Vector) +otbGenericDeclareCastImageMacro(Int16VectorImageType, Vector) +otbGenericDeclareCastImageMacro(UInt16VectorImageType, Vector) +otbGenericDeclareCastImageMacro(Int32VectorImageType, Vector) +otbGenericDeclareCastImageMacro(UInt32VectorImageType, Vector) +otbGenericDeclareCastImageMacro(FloatVectorImageType, Vector) +otbGenericDeclareCastImageMacro(DoubleVectorImageType, Vector) + + +/********************************************************************* +********************** Image -> VectorImage +**********************************************************************/ +otbGenericDeclareCastImageMacro(UInt8ImageType, Vector) +otbGenericDeclareCastImageMacro(Int16ImageType, Vector) +otbGenericDeclareCastImageMacro(UInt16ImageType, Vector) +otbGenericDeclareCastImageMacro(Int32ImageType, Vector) +otbGenericDeclareCastImageMacro(UInt32ImageType, Vector) +otbGenericDeclareCastImageMacro(FloatImageType, Vector) +otbGenericDeclareCastImageMacro(DoubleImageType, Vector) + +#undef otbDeclareCastImageMacro +#undef otbGenericDeclareCastImageMacro + + } // End namespace Wrapper } // End namespace otb +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbWrapperInputImageParameter.txx" +#endif + #endif diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageParameter.txx otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageParameter.txx --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputImageParameter.txx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputImageParameter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,232 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbWrapperInputImageParameter_txx +#define __otbWrapperInputImageParameter_txx + +#include "otbWrapperInputImageParameter.h" + +#include "otbImageFileReader.h" +#include "itkCastImageFilter.h" +#include "otbImageToVectorImageCastFilter.h" + +namespace otb +{ +namespace Wrapper +{ + + +template +TImageType* +InputImageParameter::GetImage() +{ + otbMsgDevMacro(<< "GetImage()"); + + // Used m_PreviousFileName because if not, when the user call twice GetImage, + // it without changing the filename, it returns 2 different + // image pointers + // Only one image type can be used + + // 2 cases : the user set a filename vs. the user set an image + if (m_UseFilename) + { + if( m_PreviousFileName!=m_FileName && !m_FileName.empty() ) + { + //////////////////////// Filename case: + // A new valid filename has been given : a reader is created + m_PreviousFileName = m_FileName; + typedef otb::ImageFileReader ReaderType; + typename ReaderType::Pointer reader = ReaderType::New(); + reader->SetFileName(m_FileName); + + try + { + reader->UpdateOutputInformation(); + } + catch (itk::ExceptionObject &) + { + this->ClearValue(); + } + + m_Image = reader->GetOutput(); + m_Reader = reader; + + // Pay attention, don't return m_Image because it is a ImageBase... + return reader->GetOutput(); + } + else + { + // In this case, the reader and the image should already be there + if (m_Image.IsNull()) + { + itkExceptionMacro("No input image or filename detected..."); + } + else + { + // Check if the image type asked here is the same as the one used for the reader + if (dynamic_cast (m_Image.GetPointer())) + { + return dynamic_cast (m_Image.GetPointer()); + } + else + { + itkExceptionMacro("Cannot ask a different image type"); + } + } + } + } + else + { + //////////////////////// Image case: + if (m_Image.IsNull()) + { + itkExceptionMacro("No input image or filename detected..."); + } + else + { + if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else if (dynamic_cast (m_Image.GetPointer())) + { + return CastImage (); + } + else + { + itkExceptionMacro("Unknown image type"); + } + } + } +} + + +template +TOutputImage* +InputImageParameter::CastImage() +{ + itkExceptionMacro("Cast from "< +TOutputImage* +InputImageParameter::SimpleCastImage() +{ + TInputImage* realInputImage = dynamic_cast(m_Image.GetPointer()); + + typedef itk::CastImageFilter CasterType; + typename CasterType::Pointer caster = CasterType::New(); + + caster->SetInput(realInputImage); + caster->UpdateOutputInformation(); + + m_Image = caster->GetOutput(); + m_Caster = caster; + + return caster->GetOutput(); +} + + +template +TOutputImage* +InputImageParameter::CastVectorImageFromImage() +{ + TInputImage* realInputImage = dynamic_cast(m_Image.GetPointer()); + + typedef ImageToVectorImageCastFilter CasterType; + typename CasterType::Pointer caster = CasterType::New(); + + caster->SetInput(realInputImage); + caster->UpdateOutputInformation(); + + m_Image = caster->GetOutput(); + m_Caster = caster; + + return caster->GetOutput(); +} + + +template +void +InputImageParameter::SetImage(TInputImage* image) +{ + m_UseFilename = false; + m_Image = image; +} + + +} // End namespace Wrapper +} // End namespace otb + +#endif diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx otb-4.2.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -150,11 +150,15 @@ // Open the xml file TiXmlDocument doc; - FILE* fp = TiXmlFOpen( m_FileName.c_str (), "rb" ); + //Use itksys::SystemTools::FOpen() and close it below because + //TiXmlDocument::TiXmlFileOpen( ) is not exposed from tinyXML library. Even + //though its available in the TiXmlDocument::SaveFile(). + FILE* fp = itksys::SystemTools::Fopen(m_FileName.c_str(), "rb"); if (!doc.LoadFile(fp , TIXML_ENCODING_UTF8)) { itkExceptionMacro(<< "Can't open file " << m_FileName); + fclose(fp); } TiXmlHandle handle(&doc); @@ -221,12 +225,11 @@ /* std::string message = "Input XML was generated for a different application( " + app_Name + ") while application loaded is:" + this_->GetName(); - - std::cerr << message << "\n\n"; */ itkWarningMacro( << "Input XML was generated for a different application( " << app_Name << ") while application loaded is:" <GetName()); + fclose(fp); return -1; } @@ -390,6 +393,9 @@ //choice also comes as setint and setstring why?? } ret = 0; //resetting return to zero, we dont use it anyway for now. + + fclose(fp); + return ret; } diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputProcessXMLParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -12,7 +12,7 @@ /** \class InputProcessXMLParameter * \brief This class represent a xml filename parameter for the wrapper framework to load otb application. */ -class InputProcessXMLParameter +class ITK_ABI_EXPORT InputProcessXMLParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputVectorDataListParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperInputVectorDataListParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputVectorDataListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputVectorDataListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -16,7 +16,7 @@ =========================================================================*/ #ifndef __otbWrapperInputVectorDataListParameter_h -#define __otbWrapperInputvectorDataListParameter_h +#define __otbWrapperInputVectorDataListParameter_h #include "otbVectorDataFileReader.h" @@ -31,7 +31,7 @@ * \brief This class represents a list of VectorData parameter */ -class ITK_EXPORT InputVectorDataListParameter : public Parameter +class ITK_ABI_EXPORT InputVectorDataListParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperInputVectorDataParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ * \brief This class represents a InputVectorData parameter */ -class ITK_EXPORT InputVectorDataParameter : public Parameter +class ITK_ABI_EXPORT InputVectorDataParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperListViewParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperListViewParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperListViewParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperListViewParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ * method GetSelectedItems() allow the user to access to this method. * */ -class ListViewParameter +class ITK_ABI_EXPORT ListViewParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperMapProjectionParametersHandler.h otb-4.2.0/Code/ApplicationEngine/otbWrapperMapProjectionParametersHandler.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperMapProjectionParametersHandler.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperMapProjectionParametersHandler.h 2014-09-03 08:29:34.000000000 +0000 @@ -50,14 +50,14 @@ * Add a Group containing several choices for map projections * */ - static void AddMapProjectionParameters(Application::Pointer app, const std::string & key); + static ITK_ABI_EXPORT void AddMapProjectionParameters(Application::Pointer app, const std::string & key); /** * Helper method : Compute the ProjectionRef knowing the map * projection picked up by the user * */ - static const std::string GetProjectionRefFromChoice(const Application::Pointer app, + static ITK_ABI_EXPORT const std::string GetProjectionRefFromChoice(const Application::Pointer app, const std::string & key); @@ -67,7 +67,7 @@ * The key must be totally if the InputImageParameter belongs * to a ParamaterGroup, ie set io.in */ - static void InitializeUTMParameters(Application::Pointer app, + static ITK_ABI_EXPORT void InitializeUTMParameters(Application::Pointer app, const std::string & imageKey, const std::string & mapKey ); diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperNumericalParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperNumericalParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperNumericalParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperNumericalParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ * \brief This class represents a numerical parameter */ template -class ITK_EXPORT NumericalParameter : public Parameter +class ITK_ABI_EXPORT NumericalParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputFilenameParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputFilenameParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputFilenameParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputFilenameParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ /** \class OutputFilenameParameter * \brief This class represent a string parameter for the wrapper framework */ -class OutputFilenameParameter +class ITK_ABI_EXPORT OutputFilenameParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputImageParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputImageParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ * \brief This class represents a OutputImage parameter */ -class ITK_EXPORT OutputImageParameter : public Parameter +class ITK_ABI_EXPORT OutputImageParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputProcessXMLParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -11,7 +11,7 @@ /** \class OutputProcessXMLParameter * \brief This class represent a xml filename parameter for the wrapper framework to save otb application. */ -class OutputProcessXMLParameter +class ITK_ABI_EXPORT OutputProcessXMLParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputVectorDataParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputVectorDataParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperOutputVectorDataParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperOutputVectorDataParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ * \brief This class represents a OutputVectorData parameter */ -class ITK_EXPORT OutputVectorDataParameter : public Parameter +class ITK_ABI_EXPORT OutputVectorDataParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperParameterGroup.h otb-4.2.0/Code/ApplicationEngine/otbWrapperParameterGroup.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperParameterGroup.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperParameterGroup.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ /** * \class Group */ -class ITK_EXPORT ParameterGroup +class ITK_ABI_EXPORT ParameterGroup : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -55,7 +55,7 @@ * wrapper framework. It should be subclassed to represent different * kinds of parameters */ -class Parameter +class ITK_ABI_EXPORT Parameter : public itk::Object { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperParameterKey.h otb-4.2.0/Code/ApplicationEngine/otbWrapperParameterKey.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperParameterKey.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperParameterKey.h 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ * The constructor accepts a string key constructed as follow : parent.me.child. * It implements some key manipulation as described in the code. */ -class ITK_EXPORT ParameterKey +class ITK_ABI_EXPORT ParameterKey { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperRadiusParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperRadiusParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperRadiusParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperRadiusParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ /** \class StringParameter * \brief This class represent a radius parameter for the wrapper framework */ -class RadiusParameter +class ITK_ABI_EXPORT RadiusParameter : public IntParameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperRAMParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperRAMParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperRAMParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperRAMParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ /** \class RAMParameter * \brief This class represent a RAM parameter for the wrapper framework */ -class RAMParameter : public Parameter +class ITK_ABI_EXPORT RAMParameter : public Parameter { public: /** Standard class typedef */ diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperStringListParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperStringListParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperStringListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperStringListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ /** \class StringListParameter * \brief This class represent a list of string parameter for the wrapper framework */ -class StringListParameter +class ITK_ABI_EXPORT StringListParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/ApplicationEngine/otbWrapperStringParameter.h otb-4.2.0/Code/ApplicationEngine/otbWrapperStringParameter.h --- otb-4.0.0/Code/ApplicationEngine/otbWrapperStringParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ApplicationEngine/otbWrapperStringParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ /** \class StringParameter * \brief This class represent a string parameter for the wrapper framework */ -class StringParameter +class ITK_ABI_EXPORT StringParameter : public Parameter { public: diff -Nru otb-4.0.0/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx otb-4.2.0/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx --- otb-4.0.0/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbLabelImageRegionMergingFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -150,7 +150,7 @@ template void LabelImageRegionMergingFilter -::EnlargeOutputRequestedRegion( itk::DataObject *output ) +::EnlargeOutputRequestedRegion( itk::DataObject *itkNotUsed(output) ) { // This filter requires all of the output images in the buffer. for ( unsigned int j = 0; j < this->GetNumberOfOutputs(); j++ ) diff -Nru otb-4.0.0/Code/BasicFilters/otbLabelImageRegionPruningFilter.txx otb-4.2.0/Code/BasicFilters/otbLabelImageRegionPruningFilter.txx --- otb-4.0.0/Code/BasicFilters/otbLabelImageRegionPruningFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbLabelImageRegionPruningFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -151,7 +151,7 @@ template void LabelImageRegionPruningFilter -::EnlargeOutputRequestedRegion( itk::DataObject *output ) +::EnlargeOutputRequestedRegion( itk::DataObject *itkNotUsed(output) ) { // This filter requires all of the output images in the buffer. for ( unsigned int j = 0; j < this->GetNumberOfOutputs(); j++ ) @@ -402,13 +402,13 @@ LabelType l = outputIt.Get(); LabelType canLabel; - assert(m_CanonicalLabels[l] <= oldRegionCount); + itkAssertOrThrowMacro(m_CanonicalLabels[l] <= oldRegionCount,"Found a label greater than region count") canLabel = newLabels[m_CanonicalLabels[l]]; outputIt.Set( canLabel ); - ++outputIt; } + finishedPruning = !minRegionCount || regionCount == 1 || pruneIterations>=10; // only one iteration for now diff -Nru otb-4.0.0/Code/BasicFilters/otbLabelizeImageFilterBase.h otb-4.2.0/Code/BasicFilters/otbLabelizeImageFilterBase.h --- otb-4.0.0/Code/BasicFilters/otbLabelizeImageFilterBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbLabelizeImageFilterBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -98,7 +98,7 @@ virtual void GenerateData(); /** Region growing */ - virtual void RegionGrowing(const IndexType indexSeed) {} + virtual void RegionGrowing(const IndexType itkNotUsed(indexSeed)) {} /** Instance region growing filter*/ RegionGrowingFilterPointerType m_RegionGrowingFilter; diff -Nru otb-4.0.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.h otb-4.2.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.h --- otb-4.0.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -146,7 +146,7 @@ ListSampleToHistogramListGenerator(); virtual ~ListSampleToHistogramListGenerator() {} void GenerateData(); - DataObjectPointer MakeOutput(unsigned int idx); + DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); void PrintSelf(std::ostream& os, itk::Indent indent) const; private: diff -Nru otb-4.0.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx otb-4.2.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx --- otb-4.0.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbListSampleToHistogramListGenerator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -90,7 +90,7 @@ typename ListSampleToHistogramListGenerator ::DataObjectPointer ListSampleToHistogramListGenerator -::MakeOutput(unsigned int idx) +::MakeOutput(DataObjectPointerArraySizeType itkNotUsed(idx)) { DataObjectPointer output; output = static_cast(HistogramListType::New().GetPointer()); diff -Nru otb-4.0.0/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx otb-4.2.0/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx --- otb-4.0.0/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ typename ListSampleToVariableDimensionHistogramGenerator ::DataObjectPointer ListSampleToVariableDimensionHistogramGenerator -::MakeOutput(unsigned int idx) +::MakeOutput(unsigned int itkNotUsed(idx)) { DataObjectPointer output; output = static_cast(HistogramType::New().GetPointer()); diff -Nru otb-4.0.0/Code/BasicFilters/otbMeanShiftImageFilter.txx otb-4.2.0/Code/BasicFilters/otbMeanShiftImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbMeanShiftImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbMeanShiftImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -143,7 +143,7 @@ template void -MeanShiftImageFilter::EnlargeOutputRequestedRegion( itk::DataObject *output ) +MeanShiftImageFilter::EnlargeOutputRequestedRegion( itk::DataObject *itkNotUsed(output) ) { // This filter requires all of the output images in the buffer. diff -Nru otb-4.0.0/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.txx otb-4.2.0/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -181,7 +181,7 @@ for(unsigned int comp = 0; comp < ImageDimension; ++comp) { - margin[comp] = (m_MaxIterationNumber+1) * m_SpatialRadius[comp]; + margin[comp] = (m_MaxIterationNumber * m_SpatialRadius[comp]) + 1; } inputRequestedRegion.PadByRadius(margin); diff -Nru otb-4.0.0/Code/BasicFilters/otbPointSetExtractROI.txx otb-4.2.0/Code/BasicFilters/otbPointSetExtractROI.txx --- otb-4.0.0/Code/BasicFilters/otbPointSetExtractROI.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbPointSetExtractROI.txx 2014-09-03 08:29:34.000000000 +0000 @@ -54,11 +54,6 @@ ::GenerateData(void) { typedef typename TInputPointSet::PointsContainer InputPointsContainer; - typedef typename TOutputPointSet::PointsContainer OutputPointsContainer; - - typedef typename TInputPointSet::PointDataContainer InputPointDataContainer; - typedef typename TOutputPointSet::PointDataContainer OutputPointDataContainer; - typedef typename TInputPointSet::PointsContainerPointer InputPointsContainerPointer; typedef typename TOutputPointSet::PointsContainerPointer OutputPointsContainerPointer; diff -Nru otb-4.0.0/Code/BasicFilters/otbProlateInterpolateImageFunction.h otb-4.2.0/Code/BasicFilters/otbProlateInterpolateImageFunction.h --- otb-4.0.0/Code/BasicFilters/otbProlateInterpolateImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbProlateInterpolateImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -201,15 +201,15 @@ TOutput val = itk::NumericTraits::Zero; if (A != itk::NumericTraits::Zero && vcl_abs(A) != static_cast(m_Radius) && m_Radius != 0) { - double ival = static_cast(originalProfileSize) * static_cast(vcl_abs(A)) / + double ival = static_cast(originalProfileSize - 1) * static_cast(vcl_abs(A)) / static_cast(m_Radius); double ivalFloor = vcl_floor(ival); double left = ival - ivalFloor; - if (ivalFloor < originalProfileSize - 1) + if (static_cast(ivalFloor) + 1 < originalProfileSize) { - val = left * m_OriginalProfile[static_cast(ivalFloor)] + - (1 - left) * m_OriginalProfile[static_cast(ivalFloor) + 1]; + val = (1.0 - left) * m_OriginalProfile[static_cast(ivalFloor)] + + left * m_OriginalProfile[static_cast(ivalFloor) + 1]; } else { diff -Nru otb-4.0.0/Code/BasicFilters/otbRasterizeVectorDataFilter.txx otb-4.2.0/Code/BasicFilters/otbRasterizeVectorDataFilter.txx --- otb-4.0.0/Code/BasicFilters/otbRasterizeVectorDataFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbRasterizeVectorDataFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -174,8 +174,8 @@ InputIndexType bufferIndexOrigin = bufferedRegion.GetIndex(); InputPointType bufferOrigin; this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSpacing()[1]; geoTransform[1] = this->GetOutput()->GetSpacing()[0]; geoTransform[5] = this->GetOutput()->GetSpacing()[1]; diff -Nru otb-4.0.0/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.txx otb-4.2.0/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.txx --- otb-4.0.0/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -370,6 +370,8 @@ if (originspecified) { + origine[0] += 0.5 * m_Spacing[0]; + origine[1] += 0.5 * m_Spacing[1]; OutputImage->SetOrigin(origine); // and origin m_Origin[0] = OutputImage->GetOrigin()[0]; m_Origin[1] = OutputImage->GetOrigin()[1]; diff -Nru otb-4.0.0/Code/BasicFilters/otbStreamingCompareImageFilter.h otb-4.2.0/Code/BasicFilters/otbStreamingCompareImageFilter.h --- otb-4.0.0/Code/BasicFilters/otbStreamingCompareImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbStreamingCompareImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -121,6 +121,9 @@ RealObjectType* GetMAEOutput(); const RealObjectType* GetMAEOutput() const; + itkGetMacro(PhysicalSpaceCheck,bool); + itkSetMacro(PhysicalSpaceCheck,bool); + /** Make a DataObject of the correct type to be used as the specified * output. */ virtual DataObjectPointer MakeOutput(unsigned int idx); @@ -143,6 +146,11 @@ outputRegionForThread, itk::ThreadIdType threadId); + /** Allows to skip the verification of physical space between + * the two input images (see flag m_PhysicalSpaceCheck) + */ + virtual void VerifyInputInformation(); + private: PersistentCompareImageFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented @@ -152,6 +160,7 @@ itk::Array m_ThreadMinRef; itk::Array m_ThreadMaxRef; itk::Array m_Count; + bool m_PhysicalSpaceCheck; }; // end of class PersistentCompareImageFilter /*===========================================================================*/ @@ -264,6 +273,18 @@ return this->GetFilter()->GetMAEOutput(); } + /** Set the PhysicalSpaceCheck flag */ + void SetPhysicalSpaceCheck(bool flag) + { + this->GetFilter()->SetPhysicalSpaceCheck(flag); + } + + /** Get the PhysicalSpaceCheck flag */ + bool GetPhysicalSpaceCheck() + { + return this->GetFilter()->GetPhysicalSpaceCheck(); + } + protected: /** Constructor */ StreamingCompareImageFilter() {}; diff -Nru otb-4.0.0/Code/BasicFilters/otbStreamingCompareImageFilter.txx otb-4.2.0/Code/BasicFilters/otbStreamingCompareImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbStreamingCompareImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbStreamingCompareImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ template PersistentCompareImageFilter ::PersistentCompareImageFilter() : m_SquareOfDifferences(1), m_AbsoluteValueOfDifferences(1), - m_ThreadMinRef(1), m_ThreadMaxRef(1), m_Count(1) + m_ThreadMinRef(1), m_ThreadMaxRef(1), m_Count(1), m_PhysicalSpaceCheck(true) { this->SetNumberOfRequiredInputs( 2 ); // first output is a copy of the image, DataObject created by @@ -276,6 +276,15 @@ } template +void +PersistentCompareImageFilter +::VerifyInputInformation() +{ + if (m_PhysicalSpaceCheck) + Superclass::VerifyInputInformation(); +} + +template void PersistentCompareImageFilter ::ThreadedGenerateData(const RegionType& outputRegionForThread, diff -Nru otb-4.0.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.h otb-4.2.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.h --- otb-4.0.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbObjectList.h" #include "itkStatisticsAlgorithm.h" -#include "itkDenseFrequencyContainer.h" +#include "itkDenseFrequencyContainer2.h" #include "itkNumericTraits.h" #include "itkHistogram.h" @@ -37,11 +37,11 @@ * \brief Compute the histogram of a large image using streaming * * This filter persists its temporary data. It means that if you Update it n times on n different - * requested regions, the output statistics will be the statitics of the whole set of n regions. + * requested regions, the output histogram will be the histogram of the whole set of n regions. * * To reset the temporary data, one should call the Reset() function. * - * To get the statistics once the regions have been processed via the pipeline, use the Synthetize() method. + * To get the histogram once the regions have been processed via the pipeline, use the Synthetize() method. * * \sa PersistentImageFilter * \ingroup Streamed @@ -88,12 +88,18 @@ typedef typename itk::DataObject::Pointer DataObjectPointer; /** Types for histogram */ - typedef itk::Statistics::DenseFrequencyContainer DFContainerType; - typedef typename itk::NumericTraits - ::RealType HistogramMeasurementRealType; - typedef itk::Statistics::Histogram HistogramType; - typedef typename HistogramType::SizeType HistogramSizeType; + typedef itk::Statistics::DenseFrequencyContainer2 DFContainerType; + + typedef + typename itk::NumericTraits::RealType + HistogramMeasurementRealType; + + typedef + itk::Statistics::Histogram + HistogramType; + + typedef itk::VariableLengthVector< unsigned int > CountVectorType; + typedef PixelType MeasurementVectorType; typedef ObjectList HistogramListType; typedef typename HistogramListType::Pointer HistogramListPointerType; @@ -125,9 +131,14 @@ */ itkBooleanMacro(NoDataFlag); - void SetNumberOfBins(unsigned int size) + inline void SetNumberOfBins( unsigned int i, CountVectorType::ValueType size ) + { + m_Size[ i ] = size; + } + + inline void SetNumberOfBins( const CountVectorType& size ) { - m_Size[0] = size; + m_Size = size; } /** Return the computed histogram list */ @@ -177,7 +188,7 @@ void operator =(const Self&); //purposely not implemented ArrayHistogramListType m_ThreadHistogramList; - HistogramSizeType m_Size; + CountVectorType m_Size; MeasurementVectorType m_HistogramMin; MeasurementVectorType m_HistogramMax; bool m_NoDataFlag; diff -Nru otb-4.0.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.txx otb-4.2.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -33,11 +33,14 @@ template PersistentHistogramVectorImageFilter -::PersistentHistogramVectorImageFilter() : m_HistogramMin(), - m_HistogramMax(), - m_NoDataFlag(false), - m_NoDataValue(itk::NumericTraits::Zero), - m_SubSamplingRate(1) +::PersistentHistogramVectorImageFilter() : + m_ThreadHistogramList(), + m_Size(), + m_HistogramMin(), + m_HistogramMax(), + m_NoDataFlag(false), + m_NoDataValue(itk::NumericTraits::Zero), + m_SubSamplingRate(1) { // first output is a copy of the image, DataObject created by // superclass @@ -126,7 +129,8 @@ unsigned int numberOfThreads = this->GetNumberOfThreads(); unsigned int numberOfComponent = inputPtr->GetNumberOfComponentsPerPixel(); - bool clipBins = true; +// TODO which is the good value ? (false in MVD2) + bool clipBins = false; // if histogram Min and Max have the wrong size : set to default [0, 255] if (m_HistogramMin.Size() != numberOfComponent || @@ -145,16 +149,24 @@ for (unsigned int k=0; kSetClipBinsAtEnds(clipBins); - histogram->Initialize(m_Size, bandMin, bandMax); - outputHisto->PushBack(histogram); - } + typename HistogramType::SizeType size; + size.SetSize(1); + size.Fill( m_Size[ k ] ); + histogram->SetMeasurementVectorSize(1); + histogram->Initialize( size, bandMin, bandMax ); + outputHisto->PushBack(histogram); + } + + // Setup HistogramLists for each thread m_ThreadHistogramList.clear(); for (unsigned int i=0; iSetClipBinsAtEnds(clipBins); - histogram->Initialize(m_Size, bandMin, bandMax); + + typename HistogramType::SizeType size; + size.SetSize(1); + size.Fill( m_Size[ k ] ); + histogram->SetMeasurementVectorSize(1); + histogram->Initialize(size, bandMin, bandMax ); + histoList->PushBack(histogram); } m_ThreadHistogramList.push_back(histoList); @@ -251,11 +271,34 @@ } PixelType vectorValue = it.Get(); - for (unsigned int j = 0; j < vectorValue.GetSize(); ++j) + + bool skipSampleNoData=false; + if(m_NoDataFlag) { - InternalPixelType value = vectorValue[j]; - if( (!m_NoDataFlag) || value!=m_NoDataValue ) + unsigned int itComp=0; + while( itComp < vectorValue.GetSize() ) + { + if (vectorValue[itComp]==m_NoDataValue) + { + skipSampleNoData=true; + itComp++; + } + else + { + skipSampleNoData=false; + break; + } + } + } + + if( !skipSampleNoData ) + { + for (unsigned int j = 0; j < vectorValue.GetSize(); ++j) { + typename HistogramType::MeasurementVectorType value; + value.SetSize(1); + value.Fill(vectorValue[j]); + m_ThreadHistogramList[threadId]->GetNthElement(j)->GetIndex(value, index); if (!m_ThreadHistogramList[threadId]->GetNthElement(j)->IsIndexOutOfBounds(index)) { @@ -265,10 +308,11 @@ // bin value. // If the index isn't valid, we don't increase the frequency. // See the comments in Histogram->GetIndex() for more info. - m_ThreadHistogramList[threadId]->GetNthElement(j)->IncreaseFrequency(index, 1); + m_ThreadHistogramList[threadId]->GetNthElement(j)->IncreaseFrequencyOfIndex(index, 1); } } } + ++it; progress.CompletedPixel(); } diff -Nru otb-4.0.0/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx otb-4.2.0/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx --- otb-4.0.0/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,7 @@ StreamingShrinkImageRegionSplitter::RegionType StreamingShrinkImageRegionSplitter -::GetSplit(unsigned int i, unsigned int numberOfPieces, const RegionType& region) +::GetSplit(unsigned int i, unsigned int itkNotUsed(numberOfPieces), const RegionType& region) { RegionType splitRegion; IndexType splitIndex; diff -Nru otb-4.0.0/Code/BasicFilters/otbStreamingShrinkImageFilter.txx otb-4.2.0/Code/BasicFilters/otbStreamingShrinkImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbStreamingShrinkImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbStreamingShrinkImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -129,18 +129,24 @@ typename OutputImageType::RegionType shrinkedOutputLargestPossibleRegion; typename OutputImageType::SizeType shrinkedOutputSize; typename OutputImageType::IndexType shrinkedOutputStartIndex; + typename OutputImageType::PointType shrinkedOutputOrigin; for (unsigned int i = 0; i < OutputImageType::ImageDimension; ++i) { shrinkedOutputSpacing[i] = inputSpacing[i] * static_cast(m_ShrinkFactor); shrinkedOutputSize[i] = inputSize[i] > m_ShrinkFactor ? inputSize[i] / m_ShrinkFactor : 1; + + shrinkedOutputOrigin[i] = inputPtr->GetOrigin()[i] + inputSpacing[i] * + (static_cast(inputPtr->GetLargestPossibleRegion().GetIndex(i)) - 0.5) + + shrinkedOutputSpacing[i] * 0.5; - // TODO : don't know what to do here. - // dividing the input index by the shrink factor does not make a lot of sense... + // we choose to output a region with a start index [0,0] + // the origin is set accordingly shrinkedOutputStartIndex[i] = 0; } m_ShrinkedOutput->SetSpacing(shrinkedOutputSpacing); + m_ShrinkedOutput->SetOrigin(shrinkedOutputOrigin); shrinkedOutputLargestPossibleRegion.SetSize(shrinkedOutputSize); shrinkedOutputLargestPossibleRegion.SetIndex(shrinkedOutputStartIndex); @@ -176,6 +182,7 @@ for(inIt.GoToBegin(); !inIt.IsAtEnd(); ++inIt, progress.CompletedPixel()) { const IndexType& inIndex = inIt.GetIndex(); + // TODO the pixel value should be taken near the centre of the cell, not at the corners if (inIndex[0] % m_ShrinkFactor == 0 && inIndex[1] % m_ShrinkFactor == 0 ) { diff -Nru otb-4.0.0/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.txx otb-4.2.0/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbStreamingStatisticsVectorImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -452,13 +452,21 @@ const RealPixelType& mean = this->GetMeanOutput()->Get(); double regul = 1.0; + double regulComponent = 1.0; - if( m_UseUnbiasedEstimator && nbPixels>1 ) + if( m_UseUnbiasedEstimator && nbRelevantPixels>1 ) { regul = static_cast< double >( nbRelevantPixels ) / ( static_cast< double >( nbRelevantPixels ) - 1.0 ); } + + if( m_UseUnbiasedEstimator && (nbRelevantPixels * numberOfComponent) > 1 ) + { + regulComponent = + static_cast< double >(nbRelevantPixels * numberOfComponent) / + ( static_cast< double >(nbRelevantPixels * numberOfComponent) - 1.0 ); + } MatrixType cov = cor; for (unsigned int r = 0; r < numberOfComponent; ++r) @@ -473,8 +481,7 @@ this->GetComponentMeanOutput()->Set(streamFirstOrderComponentAccumulator / (nbRelevantPixels * numberOfComponent)); this->GetComponentCorrelationOutput()->Set(streamSecondOrderComponentAccumulator / (nbRelevantPixels * numberOfComponent)); this->GetComponentCovarianceOutput()->Set( - (nbRelevantPixels * numberOfComponent) / (nbRelevantPixels * numberOfComponent - 1) - * (this->GetComponentCorrelation() + regulComponent * (this->GetComponentCorrelation() - (this->GetComponentMean() * this->GetComponentMean()))); } } diff -Nru otb-4.0.0/Code/BasicFilters/otbTileImageFilter.txx otb-4.2.0/Code/BasicFilters/otbTileImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbTileImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbTileImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -164,7 +164,7 @@ template void TileImageFilter -::ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const RegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) { // Retrieve output image pointer ImageType * outputPtr = this->GetOutput(); diff -Nru otb-4.0.0/Code/BasicFilters/otbVectorDataToLabelImageFilter.txx otb-4.2.0/Code/BasicFilters/otbVectorDataToLabelImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbVectorDataToLabelImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbVectorDataToLabelImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -288,8 +288,8 @@ OutputIndexType bufferIndexOrigin = bufferedRegion.GetIndex(); OutputOriginType bufferOrigin; this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSpacing()[1]; geoTransform[1] = this->GetOutput()->GetSpacing()[0]; geoTransform[5] = this->GetOutput()->GetSpacing()[1]; diff -Nru otb-4.0.0/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.txx otb-4.2.0/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.txx --- otb-4.0.0/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -84,7 +84,7 @@ void VectorImageTo3DScalarImageFilter ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) + itk::ThreadIdType itkNotUsed(threadId)) { const InputImageType* inputPtr = this->GetInput(); OutputImageType* outputPtr = this->GetOutput(); diff -Nru otb-4.0.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h otb-4.2.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h --- otb-4.0.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,6 +72,24 @@ typedef itk::ProcessObject ProcessObjectType; + typedef itk::ConstNeighborhoodIterator + NeighborhoodIteratorType1; + typedef itk::ConstNeighborhoodIterator + NeighborhoodIteratorType2; + + typedef typename NeighborhoodIteratorType1::RadiusType RadiusType1; + typedef typename NeighborhoodIteratorType2::RadiusType RadiusType2; + + typedef unsigned char RadiusSizeType; + + /** Typedefs for histogram. This should have been defined as + Histogram but a bug in VC++7 produced an internal compiler + error with such declaration. */ + typedef typename itk::Statistics::Histogram HistogramType; + typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; + typedef typename HistogramType::SizeType HistogramSizeType; + /** Connect one of the operands for pixel-wise addition */ void SetInput1(const TInputImage1 * image1); @@ -103,33 +121,9 @@ this->Modified(); } - typedef itk::ConstNeighborhoodIterator - NeighborhoodIteratorType1; - typedef itk::ConstNeighborhoodIterator - NeighborhoodIteratorType2; - - typedef typename NeighborhoodIteratorType1::RadiusType RadiusType1; - typedef typename NeighborhoodIteratorType2::RadiusType RadiusType2; - - typedef unsigned char RadiusSizeType; - + /** Neighborhood radius */ itkSetMacro(Radius, RadiusSizeType); - /** Typedefs for histogram. This should have been defined as - Histogram but a bug in VC++7 produced an internal compiler - error with such declaration. */ - typedef typename itk::Statistics::Histogram HistogramType; - typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; - typedef typename HistogramType::SizeType HistogramSizeType; - - /** Sets the histogram size. Note this function must be called before - \c Initialize(). */ - itkSetMacro(HistogramSize, HistogramSizeType); - - /** Gets the histogram size. */ - itkGetConstReferenceMacro(HistogramSize, HistogramSizeType); - /** Factor to increase the upper bound for the samples in the histogram. Default value is 0.001 */ itkSetMacro(UpperBoundIncreaseFactor, double); @@ -151,6 +145,8 @@ BinaryFunctorNeighborhoodJoinHistogramImageFilter(); virtual ~BinaryFunctorNeighborhoodJoinHistogramImageFilter() {} + virtual void BeforeThreadedGenerateData(); + /** BinaryFunctorNeighborhoodJoinHistogramImageFilter can be implemented as a multithreaded filter. * Therefore, this implementation provides a ThreadedGenerateData() routine * which is called for each processing thread. The output image data is @@ -173,19 +169,12 @@ HistogramType::Pointer m_Histogram; - /** The histogram size. */ - HistogramSizeType m_HistogramSize; - /** The lower bound for samples in the histogram. */ - mutable MeasurementVectorType m_LowerBound; - /** The upper bound for samples in the histogram. */ - mutable MeasurementVectorType m_UpperBound; - /** The increase in the upper bound. */ - double m_UpperBoundIncreaseFactor; - private: BinaryFunctorNeighborhoodJoinHistogramImageFilter(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented + void ComputeHistogram(); + FunctorType m_Functor; /** The padding value. */ @@ -195,8 +184,9 @@ padding value should be ignored when calculating the similarity measure. */ bool m_UsePaddingValue; - - HistogramType::Pointer ComputeHistogram(); + + /** The increase in the upper bound. */ + double m_UpperBoundIncreaseFactor; }; } // end namespace otb diff -Nru otb-4.0.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx otb-4.2.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx --- otb-4.0.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ChangeDetection/otbBinaryFunctorNeighborhoodJoinHistogramImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -33,11 +33,10 @@ template BinaryFunctorNeighborhoodJoinHistogramImageFilter -::BinaryFunctorNeighborhoodJoinHistogramImageFilter(): m_HistogramSize(2) +::BinaryFunctorNeighborhoodJoinHistogramImageFilter() { this->SetNumberOfRequiredInputs(2); m_Radius = 3; - m_HistogramSize.Fill(256); m_UsePaddingValue = false; m_UpperBoundIncreaseFactor = 0.001; } @@ -171,13 +170,21 @@ return; } +template +void +BinaryFunctorNeighborhoodJoinHistogramImageFilter +::BeforeThreadedGenerateData() +{ + this->ComputeHistogram(); +} + /** * Initialize the histogram */ template -BinaryFunctorNeighborhoodJoinHistogramImageFilter -::HistogramType::Pointer +void BinaryFunctorNeighborhoodJoinHistogramImageFilter ::ComputeHistogram() { @@ -235,15 +242,16 @@ // Set the size of the upper and lower bounds of the histogram: - m_LowerBound.SetSize(2); - m_UpperBound.SetSize(2); + MeasurementVectorType lowerBound, upperBound; + lowerBound.SetSize(2); + upperBound.SetSize(2); // Initialize the upper and lower bounds of the histogram. - m_LowerBound[0] = minInput1; - m_LowerBound[1] = minInput2; - m_UpperBound[0] = + lowerBound[0] = minInput1; + lowerBound[1] = minInput2; + upperBound[0] = maxInput1 + (maxInput1 - minInput1) * m_UpperBoundIncreaseFactor; - m_UpperBound[1] = + upperBound[1] = maxInput2 + (maxInput2 - minInput2) * m_UpperBoundIncreaseFactor; typedef itk::ImageRegionConstIteratorWithIndex Input1IteratorType; @@ -259,8 +267,10 @@ Input2IteratorType ti2(pInput2Image, input2Region); typename HistogramType::Pointer histogram = HistogramType::New(); + HistogramSizeType histogramSize(2); + histogramSize.Fill(256); histogram->SetMeasurementVectorSize(2); - histogram->Initialize(m_HistogramSize, m_LowerBound, m_UpperBound); + histogram->Initialize(histogramSize, lowerBound, upperBound); ti1.GoToBegin(); ti2.GoToBegin(); @@ -277,8 +287,7 @@ ++ti2; } - return histogram; - + m_Histogram = histogram; } /** @@ -290,19 +299,12 @@ ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) { - - //this->Initialize(); - - typename HistogramType::Pointer histogram = ComputeHistogram(); - - //m_Functor->SetHistogram(m_Histogram); -// unsigned int i; itk::ZeroFluxNeumannBoundaryCondition nbc1; itk::ZeroFluxNeumannBoundaryCondition nbc2; -// We use dynamic_cast since inputs are stored as DataObjects. The -// ImageToJoinHistogramImageFilter::GetInput(int) always returns a pointer to a -// TInputImage1 so it cannot be used for the second input. + // We use dynamic_cast since inputs are stored as DataObjects. The + // ImageToJoinHistogramImageFilter::GetInput(int) always returns a pointer to a + // TInputImage1 so it cannot be used for the second input. Input1ImageConstPointer inputPtr1 = dynamic_cast(ProcessObjectType::GetInput(0)); Input2ImageConstPointer inputPtr2 @@ -353,7 +355,7 @@ while (!outputIt.IsAtEnd()) { - outputIt.Set(m_Functor(neighInputIt1, neighInputIt2, histogram)); + outputIt.Set(m_Functor(neighInputIt1, neighInputIt2, m_Histogram)); ++neighInputIt1; ++neighInputIt2; @@ -361,7 +363,6 @@ progress.CompletedPixel(); } } - } } // end namespace otb diff -Nru otb-4.0.0/Code/ChangeDetection/otbJoinHistogramMI.h otb-4.2.0/Code/ChangeDetection/otbJoinHistogramMI.h --- otb-4.0.0/Code/ChangeDetection/otbJoinHistogramMI.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ChangeDetection/otbJoinHistogramMI.h 2014-09-03 08:29:34.000000000 +0000 @@ -41,48 +41,6 @@ TOutput jointEntropy = itk::NumericTraits::Zero; HistogramFrequencyType totalFreq = histogram->GetTotalFrequency(); - /* for(unsigned long pos = 0; pos< itA.Size(); ++pos) - { - double value = static_cast(itA.GetPixel(pos)); - - unsigned int bin = - HistogramFrequencyType freq = histogram.GetFrequency(, 0); - if (freq > 0) - { - entropyX += freq*vcl_log(freq); - } - } - - entropyX = -entropyX/static_cast(totalFreq) + vcl_log(totalFreq); - - for (unsigned int i = 0; i < this->GetHistogramSize()[1]; ++i) - { - HistogramFrequencyType freq = histogram.GetFrequency(i, 1); - if (freq > 0) - { - entropyY += freq*vcl_log(freq); - } - } - - entropyY = -entropyY/static_cast(totalFreq) + vcl_log(totalFreq); - - HistogramIteratorType it = histogram.Begin(); - HistogramIteratorType end = histogram.End(); - while (it != end) - { - HistogramFrequencyType freq = it.GetFrequency(); - if (freq > 0) - { - jointEntropy += freq*vcl_log(freq); - } - ++it; - } - - jointEntropy = -jointEntropy/static_cast(totalFreq) + - vcl_log(totalFreq); - - return entropyX + entropyY - jointEntropy; */ - typename HistogramType::MeasurementVectorType sample(2); for (unsigned long pos = 0; pos < itA.Size(); ++pos) { @@ -106,28 +64,8 @@ vcl_log(totalFreq); return jointEntropy; - - /* TOutput meanA = 0.0; - TOutput meanB = 0.0; - - for(unsigned long pos = 0; pos< itA.Size(); ++pos) - { - - meanA += static_cast(itA.GetPixel(pos)); - meanB += static_cast(itB.GetPixel(pos)); - - - }*/ - return static_cast(0); } - /* void SetHistogram(HistogramType* histo) - { - m_Histogram = histo; - } - - protected: - HistogramType::Pointer m_Histogram; */ }; } } // end namespace otb diff -Nru otb-4.0.0/Code/CMakeLists.txt otb-4.2.0/Code/CMakeLists.txt --- otb-4.0.0/Code/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -27,9 +27,3 @@ add_subdirectory(Wrappers) endif() -if(OTB_COMPILE_WITH_FULL_WARNING) - if(CMAKE_COMPILER_IS_GNUCXX) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OTB_FULL_WARNING_LIST_PARAMETERS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OTB_FULL_WARNING_LIST_PARAMETERS}") - endif() -endif() diff -Nru otb-4.0.0/Code/Common/otbCommandLineArgumentParser.cxx otb-4.2.0/Code/Common/otbCommandLineArgumentParser.cxx --- otb-4.0.0/Code/Common/otbCommandLineArgumentParser.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbCommandLineArgumentParser.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ CommandLineArgumentParseResult::~CommandLineArgumentParseResult() {} void CommandLineArgumentParseResult -::PrintSelf(std::ostream& itkNotUsed(os), itk::Indent indent) const +::PrintSelf(std::ostream& itkNotUsed(os), itk::Indent itkNotUsed(indent)) const { } diff -Nru otb-4.0.0/Code/Common/otbDrawLineSpatialObjectListFilter.txx otb-4.2.0/Code/Common/otbDrawLineSpatialObjectListFilter.txx --- otb-4.0.0/Code/Common/otbDrawLineSpatialObjectListFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbDrawLineSpatialObjectListFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -64,7 +64,7 @@ template void DrawLineSpatialObjectListFilter -::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) { typename InputImageType::ConstPointer input = this->GetInput(); @@ -280,7 +280,7 @@ DrawLineSpatialObjectListFilter ::CropSegment(OutputIndexType *indexToCrop, OutputIndexType *otherIndex, - const OutputImageRegionType *outputRegionForThread) const + const OutputImageRegionType *itkNotUsed(outputRegionForThread)) const { OutputIndexType tempIndex; diff -Nru otb-4.0.0/Code/Common/otbLabelImageToOGRDataSourceFilter.txx otb-4.2.0/Code/Common/otbLabelImageToOGRDataSourceFilter.txx --- otb-4.0.0/Code/Common/otbLabelImageToOGRDataSourceFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbLabelImageToOGRDataSourceFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -21,18 +21,16 @@ #include "otbLabelImageToOGRDataSourceFilter.h" #include "otbGdalDataTypeBridge.h" - //gdal libraries #include "gdal.h" #include "gdal_priv.h" #include "cpl_conv.h" #include "gdal_alg.h" +#include "stdint.h" //needed for uintptr_t namespace otb { - - template LabelImageToOGRDataSourceFilter ::LabelImageToOGRDataSourceFilter() : m_FieldName("DN"), m_Use8Connected(false) @@ -163,7 +161,7 @@ // integer make us pointing to an non allowed memory block => Crash. std::ostringstream stream; stream << "MEM:::" - << "DATAPOINTER=" << (unsigned long)(this->GetInput()->GetBufferPointer()) << "," + << "DATAPOINTER=" << (uintptr_t)(this->GetInput()->GetBufferPointer()) << "," << "PIXELS=" << size[0] << "," << "LINES=" << size[1] << "," << "BANDS=" << nbBands << "," @@ -186,8 +184,8 @@ IndexType bufferIndexOrigin = this->GetInput()->GetBufferedRegion().GetIndex(); OriginType bufferOrigin; this->GetInput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSpacing()[1]; geoTransform[1] = this->GetInput()->GetSpacing()[0]; geoTransform[5] = this->GetInput()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters @@ -235,7 +233,7 @@ // integer make us pointing to an non allowed memory block => Crash. std::ostringstream maskstream; maskstream << "MEM:::" - << "DATAPOINTER=" << (unsigned long)(this->GetInputMask()->GetBufferPointer()) << "," + << "DATAPOINTER=" << (uintptr_t)(this->GetInputMask()->GetBufferPointer()) << "," << "PIXELS=" << size[0] << "," << "LINES=" << size[1] << "," << "BANDS=" << nbBands << "," @@ -256,8 +254,8 @@ // the spacing is unchanged, the origin is relative to the buffered region bufferIndexOrigin = this->GetInputMask()->GetBufferedRegion().GetIndex(); this->GetInputMask()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSpacing()[1]; geoTransform[1] = this->GetInputMask()->GetSpacing()[0]; geoTransform[5] = this->GetInputMask()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters diff -Nru otb-4.0.0/Code/Common/otbLabelImageToVectorDataFilter.txx otb-4.2.0/Code/Common/otbLabelImageToVectorDataFilter.txx --- otb-4.0.0/Code/Common/otbLabelImageToVectorDataFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbLabelImageToVectorDataFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -164,8 +164,8 @@ IndexType bufferIndexOrigin = this->GetInput()->GetBufferedRegion().GetIndex(); OriginType bufferOrigin; this->GetInput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInput()->GetSpacing()[1]; geoTransform[1] = this->GetInput()->GetSpacing()[0]; geoTransform[5] = this->GetInput()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters @@ -234,8 +234,8 @@ // the spacing is unchanged, the origin is relative to the buffered region bufferIndexOrigin = this->GetInputMask()->GetBufferedRegion().GetIndex(); this->GetInputMask()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetInputMask()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetInputMask()->GetSpacing()[1]; geoTransform[1] = this->GetInputMask()->GetSpacing()[0]; geoTransform[5] = this->GetInputMask()->GetSpacing()[1]; // FIXME: Here component 1 and 4 should be replaced by the orientation parameters diff -Nru otb-4.0.0/Code/Common/otbMacro.h otb-4.2.0/Code/Common/otbMacro.h --- otb-4.0.0/Code/Common/otbMacro.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbMacro.h 2014-09-03 08:29:34.000000000 +0000 @@ -222,4 +222,6 @@ } \ } +# define otbUnusedMacro(x) do { (void)sizeof(x); } while(0) + #endif //end of otbMacro.h diff -Nru otb-4.0.0/Code/Common/otbOGRDataSourceToLabelImageFilter.txx otb-4.2.0/Code/Common/otbOGRDataSourceToLabelImageFilter.txx --- otb-4.0.0/Code/Common/otbOGRDataSourceToLabelImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbOGRDataSourceToLabelImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -22,6 +22,7 @@ #include "otbMacro.h" #include "gdal_alg.h" +#include "stdint.h" //needed for uintptr_t namespace otb { @@ -184,7 +185,7 @@ std::ostringstream stream; stream << "MEM:::" - << "DATAPOINTER=" << (unsigned long)(this->GetOutput()->GetBufferPointer()) << "," + << "DATAPOINTER=" << (uintptr_t)(this->GetOutput()->GetBufferPointer()) << "," << "PIXELS=" << bufferedRegion.GetSize()[0] << "," << "LINES=" << bufferedRegion.GetSize()[1]<< "," << "BANDS=" << nbBands << "," @@ -213,8 +214,8 @@ OutputIndexType bufferIndexOrigin = bufferedRegion.GetIndex(); OutputOriginType bufferOrigin; this->GetOutput()->TransformIndexToPhysicalPoint(bufferIndexOrigin, bufferOrigin); - geoTransform[0] = bufferOrigin[0]; - geoTransform[3] = bufferOrigin[1]; + geoTransform[0] = bufferOrigin[0] - 0.5 * this->GetOutput()->GetSpacing()[0]; + geoTransform[3] = bufferOrigin[1] - 0.5 * this->GetOutput()->GetSpacing()[1]; geoTransform[1] = this->GetOutput()->GetSpacing()[0]; geoTransform[5] = this->GetOutput()->GetSpacing()[1]; @@ -256,4 +257,3 @@ } } // end namespace otb - diff -Nru otb-4.0.0/Code/Common/otbParser.cxx otb-4.2.0/Code/Common/otbParser.cxx --- otb-4.0.0/Code/Common/otbParser.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbParser.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -135,7 +135,7 @@ } catch(ExceptionType &e) { - ExceptionHandlerDebug(e); + ExceptionHandler(e); return false; } @@ -172,16 +172,9 @@ /** Convert parser specific exception into itk debug macro */ virtual void ExceptionHandlerDebug(ExceptionType &e) { - otbGenericMsgDebugMacro( << std::endl - << "Message: " << e.GetMsg() << std::endl - << "Formula: " << e.GetExpr() << std::endl - << "Token: " << e.GetToken() << std::endl - << "Position: " << e.GetPos() << std::endl - << std::endl); - // << "Errc: " << e.GetCode() << std::endl); + ExceptionHandler(e); } - protected: ParserImpl() { diff -Nru otb-4.0.0/Code/Common/otbPolyLineImageConstIterator.txx otb-4.2.0/Code/Common/otbPolyLineImageConstIterator.txx --- otb-4.0.0/Code/Common/otbPolyLineImageConstIterator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbPolyLineImageConstIterator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,7 @@ IndexType source, target; for (unsigned int i = 0; i < ImageType::ImageDimension; ++i) { - source[i] = static_cast (m_InternalVertexIterator.Value()[i]); + source[i] = static_cast (vcl_floor(m_InternalVertexIterator.Value()[i] + 0.5)); } ++m_InternalVertexIterator; if (m_InternalVertexIterator != m_Path->GetVertexList()->End()) @@ -47,7 +47,7 @@ for (unsigned int i = 0; i < ImageType::ImageDimension; ++i) { - target[i] = static_cast (m_InternalVertexIterator.Value()[i]); + target[i] = static_cast (vcl_floor(m_InternalVertexIterator.Value()[i] + 0.5)); } } else @@ -78,7 +78,7 @@ IndexType source, target; for (unsigned int i = 0; i < ImageType::ImageDimension; ++i) { - source[i] = static_cast (m_InternalVertexIterator.Value()[i]); + source[i] = static_cast (vcl_floor(m_InternalVertexIterator.Value()[i] + 0.5)); } ++m_InternalVertexIterator; if (m_InternalVertexIterator != m_Path->GetVertexList()->End()) @@ -86,7 +86,7 @@ for (unsigned int i = 0; i < ImageType::ImageDimension; ++i) { - target[i] = static_cast (m_InternalVertexIterator.Value()[i]); + target[i] = static_cast (vcl_floor(m_InternalVertexIterator.Value()[i] + 0.5)); } } else @@ -110,7 +110,7 @@ IndexType source; for (unsigned int i = 0; i < ImageType::ImageDimension; ++i) { - source[i] = static_cast (m_InternalVertexIterator.Value()[i]); + source[i] = static_cast (vcl_floor(m_InternalVertexIterator.Value()[i] + 0.5)); } // otbMsgDebugMacro(<<"Source: "< (m_InternalVertexIterator.Value()[i]); + target[i] = static_cast (vcl_floor(m_InternalVertexIterator.Value()[i] + 0.5)); } // otbMsgDebugMacro(<<"Target: "< (m_Image.GetPointer()), source, diff -Nru otb-4.0.0/Code/Common/otbSubsampledImageRegionConstIterator.h otb-4.2.0/Code/Common/otbSubsampledImageRegionConstIterator.h --- otb-4.0.0/Code/Common/otbSubsampledImageRegionConstIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbSubsampledImageRegionConstIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -222,7 +222,7 @@ * No Bound checking is performed when setting the position. */ void SetOffset(const OffsetType& offset); - const OffsetType GetOffset() const + OffsetType GetOffset() const { return this->m_Offset; } diff -Nru otb-4.0.0/Code/Common/otbTransform.h otb-4.2.0/Code/Common/otbTransform.h --- otb-4.0.0/Code/Common/otbTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -119,6 +119,11 @@ virtual void SetParameters( const ParametersType & ) { itkExceptionMacro( << "Subclasses should override this method (SetParameters)" ) } + virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const + { + itkExceptionMacro(<< "Subclasses should override this method (ComputeJacobianWithRespectToParamters)" ); + } + /** Set the transformation parameters and update internal transformation. * This method forces the transform to copy the parameters. The * default implementation is to call SetParameters. This call must diff -Nru otb-4.0.0/Code/Common/otbVectorDataToImageFilter.txx otb-4.2.0/Code/Common/otbVectorDataToImageFilter.txx --- otb-4.0.0/Code/Common/otbVectorDataToImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbVectorDataToImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -402,8 +402,8 @@ sizePhy[1] = size[1] * m_Spacing[1]; rsRegion.SetSize(sizePhy); OriginType origin; - origin[0] = m_Origin[0] + index[0] * m_Spacing[0]; - origin[1] = m_Origin[1] + index[1] * m_Spacing[1]; + origin[0] = m_Origin[0] + (static_cast(index[0]) - 0.5) * m_Spacing[0]; + origin[1] = m_Origin[1] + (static_cast(index[1]) - 0.5) * m_Spacing[1]; rsRegion.SetOrigin(origin); rsRegion.SetRegionProjection(m_VectorDataProjectionWKT); @@ -470,6 +470,8 @@ m_Maps[tileIdx].removeLayer(i); } m_Maps[tileIdx].resize(m_TilingRegions[tileIdx].GetSize()[0], m_TilingRegions[tileIdx].GetSize()[1]); + + RemoteSensingRegionType rsRegion; for (unsigned int vdIdx = 0; vdIdx < this->GetNumberOfInputs(); ++vdIdx) { @@ -477,6 +479,8 @@ { datasource_ptr mDatasource = datasource_ptr(new mapnik::memory_datasource); + rsRegion = m_VectorDataExtractors[tileIdx][vdIdx]->GetRegion(); + m_VectorDataExtractors[tileIdx][vdIdx]->Update(); VectorDataConstPointer input = m_VectorDataExtractors[tileIdx][vdIdx]->GetOutput(); InternalTreeNodeType * inputRoot = const_cast(input->GetDataTree()->GetRoot()); @@ -501,12 +505,10 @@ assert((m_SensorModelFlip == 1) || (m_SensorModelFlip == -1)); mapnik_otb::box2d envelope( - m_Origin[0] + m_TilingRegions[tileIdx].GetIndex()[0]*m_Spacing[0], - m_SensorModelFlip*(m_Origin[1] + m_TilingRegions[tileIdx].GetIndex()[1] * m_Spacing[1] - + m_TilingRegions[tileIdx].GetSize()[1] * m_Spacing[1]), - m_Origin[0] + m_TilingRegions[tileIdx].GetIndex()[0] * m_Spacing[0] - + m_TilingRegions[tileIdx].GetSize()[0] * m_Spacing[0], - m_SensorModelFlip*(m_Origin[1] + m_TilingRegions[tileIdx].GetIndex()[1] * m_Spacing[1]) + rsRegion.GetOrigin(0), + m_SensorModelFlip*(rsRegion.GetOrigin(1) + rsRegion.GetSize(1)), + rsRegion.GetOrigin(0) + rsRegion.GetSize(0), + m_SensorModelFlip*(rsRegion.GetOrigin(1)) ); mapnik_otb::zoom_to_box(&m_Maps[tileIdx], envelope); diff -Nru otb-4.0.0/Code/Common/otbVectorDataToMapFilter.txx otb-4.2.0/Code/Common/otbVectorDataToMapFilter.txx --- otb-4.0.0/Code/Common/otbVectorDataToMapFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Common/otbVectorDataToMapFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -402,8 +402,8 @@ sizePhy[1] = size[1] * m_Spacing[1]; rsRegion.SetSize(sizePhy); OriginType origin; - origin[0] = m_Origin[0] + index[0] * m_Spacing[0]; - origin[1] = m_Origin[1] + index[1] * m_Spacing[1]; + origin[0] = m_Origin[0] + (static_cast(index[0]) - 0.5) * m_Spacing[0]; + origin[1] = m_Origin[1] + (static_cast(index[1]) - 0.5) * m_Spacing[1]; rsRegion.SetOrigin(origin); rsRegion.SetRegionProjection(m_VectorDataProjectionWKT); @@ -471,12 +471,16 @@ } m_Maps[tileIdx].resize(m_TilingRegions[tileIdx].GetSize()[0], m_TilingRegions[tileIdx].GetSize()[1]); + RemoteSensingRegionType rsRegion; + for (unsigned int vdIdx = 0; vdIdx < this->GetNumberOfInputs(); ++vdIdx) { if (this->GetInput(vdIdx)) { datasource_ptr mDatasource = datasource_ptr(new mapnik::memory_datasource); + rsRegion = m_VectorDataExtractors[tileIdx][vdIdx]->GetRegion(); + m_VectorDataExtractors[tileIdx][vdIdx]->Update(); VectorDataConstPointer input = m_VectorDataExtractors[tileIdx][vdIdx]->GetOutput(); InternalTreeNodeType * inputRoot = const_cast(input->GetDataTree()->GetRoot()); @@ -501,12 +505,10 @@ assert((m_SensorModelFlip == 1) || (m_SensorModelFlip == -1)); mapnik_otb::box2d envelope( - m_Origin[0] + m_TilingRegions[tileIdx].GetIndex()[0]*m_Spacing[0], - m_SensorModelFlip*(m_Origin[1] + m_TilingRegions[tileIdx].GetIndex()[1] * m_Spacing[1] - + m_TilingRegions[tileIdx].GetSize()[1] * m_Spacing[1]), - m_Origin[0] + m_TilingRegions[tileIdx].GetIndex()[0] * m_Spacing[0] - + m_TilingRegions[tileIdx].GetSize()[0] * m_Spacing[0], - m_SensorModelFlip*(m_Origin[1] + m_TilingRegions[tileIdx].GetIndex()[1] * m_Spacing[1]) + rsRegion.GetOrigin(0), + m_SensorModelFlip*(rsRegion.GetOrigin(1) + rsRegion.GetSize(1)), + rsRegion.GetOrigin(0) + rsRegion.GetSize(0), + m_SensorModelFlip*(rsRegion.GetOrigin(1)) ); mapnik_otb::zoom_to_box(&m_Maps[tileIdx], envelope); diff -Nru otb-4.0.0/Code/DisparityMap/otbAdhesionCorrectionFilter.txx otb-4.2.0/Code/DisparityMap/otbAdhesionCorrectionFilter.txx --- otb-4.0.0/Code/DisparityMap/otbAdhesionCorrectionFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbAdhesionCorrectionFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -571,7 +571,7 @@ } index_pos = new_disparityIt.GetIndex(); old_disparityIt.SetIndex(index_pos); - double disp = old_disparityIt.Get(); +// double disp = old_disparityIt.Get(); while (new_disparityIt.GetIndex()[0](outputPtr->GetRequestedRegion().GetSize()[0]) + outputPtr->GetRequestedRegion().GetIndex()[0] - 1) { index_pos = new_disparityIt.GetIndex(); @@ -930,7 +930,7 @@ int Count; int big_win = win + 1; - int half_big_win = (2*big_win +1)*(2*big_win +1) /2; +// int half_big_win = (2*big_win +1)*(2*big_win +1) /2; double Tol2 = m_Tolerance/2; new_disparityIt.GoToBegin(); diff -Nru otb-4.0.0/Code/DisparityMap/otbBijectionCoherencyFilter.txx otb-4.2.0/Code/DisparityMap/otbBijectionCoherencyFilter.txx --- otb-4.0.0/Code/DisparityMap/otbBijectionCoherencyFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbBijectionCoherencyFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -215,7 +215,7 @@ template void BijectionCoherencyFilter -::ThreadedGenerateData(const OutputRegionType & outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const OutputRegionType & outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) { const TDisparityImage * directHmap = this->GetDirectHorizontalDisparityMapInput(); const TDisparityImage * directVmap = this->GetDirectVerticalDisparityMapInput(); @@ -251,13 +251,18 @@ if (directVmap) tmpIndex[1] += directVertiIter.Get(); // Interpolate in reverse disparity map + typedef typename IndexType::IndexValueType IndexValueType; IndexType ul,ur,ll,lr; ul[0] = static_cast(vcl_floor(tmpIndex[0])); ul[1] = static_cast(vcl_floor(tmpIndex[1])); - if (ul[0](unsigned int)(buffered.GetIndex()[0]+buffered.GetSize()[0]-1)) ul[0]=(buffered.GetIndex()[0]+buffered.GetSize()[0]-1); - if (ul[1]>(unsigned int)(buffered.GetIndex()[1]+buffered.GetSize()[1]-1)) ul[1]=(buffered.GetIndex()[1]+buffered.GetSize()[1]-1); + if (ul[0] < buffered.GetIndex()[0]) + ul[0] = buffered.GetIndex()[0]; + if (ul[1] < buffered.GetIndex()[1]) + ul[1] = buffered.GetIndex()[1]; + if (ul[0] > static_cast(buffered.GetIndex()[0] + buffered.GetSize()[0]-1)) + ul[0]=(buffered.GetIndex()[0]+buffered.GetSize()[0]-1); + if (ul[1] > static_cast(buffered.GetIndex()[1] + buffered.GetSize()[1]-1)) + ul[1] = (buffered.GetIndex()[1]+buffered.GetSize()[1]-1); ur = ul; ur[0] += 1; diff -Nru otb-4.0.0/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.txx otb-4.2.0/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.txx --- otb-4.0.0/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,6 @@ typedef itk::Vector VectorType; typedef otb::Image ImageType; typedef itk::LandmarkDisplacementFieldSource DisplacementFieldSourceType; - typedef typename DisplacementFieldSourceType::LandmarkContainerPointer LandmarkContainerPointer; typedef typename DisplacementFieldSourceType::LandmarkContainer LandmarkContainerType; typedef typename DisplacementFieldSourceType::LandmarkPointType LandmarkPointType; typedef typename PointSetType::PointsContainer PointsContainer; diff -Nru otb-4.0.0/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx otb-4.2.0/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx --- otb-4.0.0/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -62,7 +62,6 @@ typedef otb::ObjectList SPlineInterpolatorListType; typedef typename PointSetType::PointsContainer::ConstIterator PointSetIteratorType; - typedef typename PointSetType::PointsContainer PointsContainerType; // Initialization of the splines interpolator typename SPlineInterpolatorListType::Pointer splineIntList = SPlineInterpolatorListType::New(); diff -Nru otb-4.0.0/Code/DisparityMap/otbDisparityMapTo3DFilter.txx otb-4.2.0/Code/DisparityMap/otbDisparityMapTo3DFilter.txx --- otb-4.0.0/Code/DisparityMap/otbDisparityMapTo3DFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbDisparityMapTo3DFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -251,7 +251,7 @@ class TEpipolarGridImage, class TMaskImage> void DisparityMapTo3DFilter -::ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const RegionType & itkNotUsed(outputRegionForThread), itk::ThreadIdType itkNotUsed(threadId)) { const TDisparityImage * horizDisp = this->GetHorizontalDisparityMapInput(); const TDisparityImage * vertiDisp = this->GetVerticalDisparityMapInput(); diff -Nru otb-4.0.0/Code/DisparityMap/otbDisparityMapToDEMFilter.h otb-4.2.0/Code/DisparityMap/otbDisparityMapToDEMFilter.h --- otb-4.0.0/Code/DisparityMap/otbDisparityMapToDEMFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbDisparityMapToDEMFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -190,6 +190,13 @@ /** Temporary DEMs for mutlithreading */ std::vector m_TempDEMRegions; + + /** Left sensor image transform */ + RSTransformType::Pointer m_LeftToGroundTransform; + + /** Right sensor image transform */ + RSTransformType::Pointer m_RightToGroundTransform; + }; } // end namespace otb diff -Nru otb-4.0.0/Code/DisparityMap/otbDisparityMapToDEMFilter.txx otb-4.2.0/Code/DisparityMap/otbDisparityMapToDEMFilter.txx --- otb-4.0.0/Code/DisparityMap/otbDisparityMapToDEMFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbDisparityMapToDEMFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -263,38 +263,53 @@ // left image typename SensorImageType::SizeType inputSize = leftImgPtr->GetLargestPossibleRegion().GetSize(); - typename SensorImageType::PointType tmpPoint; - tmpPoint = leftImgPtr->GetOrigin(); - RSTransform2DType::OutputPointType left_ul = leftToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (leftImgPtr->GetOrigin())[0] + (leftImgPtr->GetSpacing())[0] * static_cast(inputSize[0]); - tmpPoint[1] = (leftImgPtr->GetOrigin())[1]; - RSTransform2DType::OutputPointType left_ur = leftToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (leftImgPtr->GetOrigin())[0] + (leftImgPtr->GetSpacing())[0] * static_cast(inputSize[0]); - tmpPoint[1] = (leftImgPtr->GetOrigin())[1] + (leftImgPtr->GetSpacing())[1] * static_cast(inputSize[1]); - RSTransform2DType::OutputPointType left_lr = leftToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (leftImgPtr->GetOrigin())[0]; - tmpPoint[1] = (leftImgPtr->GetOrigin())[1] + (leftImgPtr->GetSpacing())[1] * static_cast(inputSize[1]); - RSTransform2DType::OutputPointType left_ll = leftToGroundTransform->TransformPoint(tmpPoint); + typename SensorImageType::PointType ulp, urp, llp, lrp; + itk::ContinuousIndex ul(leftImgPtr->GetLargestPossibleRegion().GetIndex()); + ul[0] += -0.5; + ul[1] += -0.5; + + itk::ContinuousIndex ur(ul); + itk::ContinuousIndex lr(ul); + itk::ContinuousIndex ll(ul); + ur[0] += static_cast(inputSize[0]); + lr[0] += static_cast(inputSize[0]); + lr[1] += static_cast(inputSize[1]); + ll[1] += static_cast(inputSize[1]); + + leftImgPtr->TransformContinuousIndexToPhysicalPoint(ul,ulp); + leftImgPtr->TransformContinuousIndexToPhysicalPoint(ur,urp); + leftImgPtr->TransformContinuousIndexToPhysicalPoint(ll,llp); + leftImgPtr->TransformContinuousIndexToPhysicalPoint(lr,lrp); + + RSTransform2DType::OutputPointType left_ul, left_ur, left_ll, left_lr; + left_ul = leftToGroundTransform->TransformPoint(ulp); + left_ur = leftToGroundTransform->TransformPoint(urp); + left_ll = leftToGroundTransform->TransformPoint(llp); + left_lr = leftToGroundTransform->TransformPoint(lrp); // right image inputSize = rightImgPtr->GetLargestPossibleRegion().GetSize(); - tmpPoint = rightImgPtr->GetOrigin(); - RSTransform2DType::OutputPointType right_ul = rightToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (rightImgPtr->GetOrigin())[0] + (rightImgPtr->GetSpacing())[0] * static_cast(inputSize[0]); - tmpPoint[1] = (rightImgPtr->GetOrigin())[1]; - RSTransform2DType::OutputPointType right_ur = rightToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (rightImgPtr->GetOrigin())[0] + (rightImgPtr->GetSpacing())[0] * static_cast(inputSize[0]); - tmpPoint[1] = (rightImgPtr->GetOrigin())[1] + (rightImgPtr->GetSpacing())[1] * static_cast(inputSize[1]); - RSTransform2DType::OutputPointType right_lr = rightToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (rightImgPtr->GetOrigin())[0]; - tmpPoint[1] = (rightImgPtr->GetOrigin())[1] + (rightImgPtr->GetSpacing())[1] * static_cast(inputSize[1]); - RSTransform2DType::OutputPointType right_ll = rightToGroundTransform->TransformPoint(tmpPoint); + ul = rightImgPtr->GetLargestPossibleRegion().GetIndex(); + ul[0] += -0.5; + ul[1] += -0.5; + ur = ul; + lr = ul; + ll = ul; + ur[0] += static_cast(inputSize[0]); + lr[0] += static_cast(inputSize[0]); + lr[1] += static_cast(inputSize[1]); + ll[1] += static_cast(inputSize[1]); + + rightImgPtr->TransformContinuousIndexToPhysicalPoint(ul,ulp); + rightImgPtr->TransformContinuousIndexToPhysicalPoint(ur,urp); + rightImgPtr->TransformContinuousIndexToPhysicalPoint(ll,llp); + rightImgPtr->TransformContinuousIndexToPhysicalPoint(lr,lrp); + + RSTransform2DType::OutputPointType right_ul, right_ur, right_lr, right_ll; + right_ul = rightToGroundTransform->TransformPoint(ulp); + right_ur = rightToGroundTransform->TransformPoint(urp); + right_ll = rightToGroundTransform->TransformPoint(llp); + right_lr = rightToGroundTransform->TransformPoint(lrp); double left_xmin = std::min(std::min(std::min(left_ul[0],left_ur[0]),left_lr[0]),left_ll[0]); double left_xmax = std::max(std::max(std::max(left_ul[0],left_ur[0]),left_lr[0]),left_ll[0]); @@ -316,12 +331,6 @@ itkExceptionMacro(<<"Wrong reconstruction area, images don't overlap, check image corners"); } - // Choose origin - typename TOutputDEMImage::PointType outOrigin; - outOrigin[0] = box_xmin; - outOrigin[1] = box_ymax; - outputPtr->SetOrigin(outOrigin); - // Compute step : // TODO : use a clean RS transform instead typename TOutputDEMImage::SpacingType outSpacing; @@ -329,6 +338,12 @@ outSpacing[1] = -57.295779513 * m_DEMGridStep / 6378137.0; outputPtr->SetSpacing(outSpacing); + // Choose origin + typename TOutputDEMImage::PointType outOrigin; + outOrigin[0] = box_xmin + 0.5 * outSpacing[0]; + outOrigin[1] = box_ymax + 0.5 * outSpacing[1]; + outputPtr->SetOrigin(outOrigin); + // Compute output size typename DEMImageType::RegionType outRegion; outRegion.SetIndex(0,0); @@ -391,32 +406,32 @@ // up left at elevation min TDPointType corners[8]; - corners[0][0]= outOrigin[0] + outSpacing[0] * outRegion.GetIndex(0); - corners[0][1]= outOrigin[1] + outSpacing[1] * outRegion.GetIndex(1); + corners[0][0]= outOrigin[0] + outSpacing[0] * (-0.5 + static_cast(outRegion.GetIndex(0))); + corners[0][1]= outOrigin[1] + outSpacing[1] * (-0.5 + static_cast(outRegion.GetIndex(1))); corners[0][2]= m_ElevationMin; // up left at elevation max corners[1][0]= corners[0][0]; corners[1][1]= corners[0][1]; corners[1][2]= m_ElevationMax; // up right at elevation min - corners[2][0]= outOrigin[0] + outSpacing[0] * (outRegion.GetIndex(0) + outRegion.GetSize(0)); - corners[2][1]= outOrigin[1] + outSpacing[1] * outRegion.GetIndex(1); + corners[2][0]= corners[0][0] + outSpacing[0] * static_cast(outRegion.GetSize(0)); + corners[2][1]= corners[0][1]; corners[2][2]= m_ElevationMin; // up right at elevation max corners[3][0]= corners[2][0]; corners[3][1]= corners[2][1]; corners[3][2]= m_ElevationMax; // low right at elevation min - corners[4][0]= outOrigin[0] + outSpacing[0] * (outRegion.GetIndex(0) + outRegion.GetSize(0)); - corners[4][1]= outOrigin[1] + outSpacing[1] * (outRegion.GetIndex(1) + outRegion.GetSize(1)); + corners[4][0]= corners[0][0] + outSpacing[0] * static_cast(outRegion.GetSize(0)); + corners[4][1]= corners[0][1] + outSpacing[1] * static_cast(outRegion.GetSize(1)); corners[4][2]= m_ElevationMin; // low right at elevation max corners[5][0]= corners[4][0]; corners[5][1]= corners[4][1]; corners[5][2]= m_ElevationMax; // low left at elevation min - corners[6][0]= outOrigin[0] + outSpacing[0] * outRegion.GetIndex(0); - corners[6][1]= outOrigin[1] + outSpacing[1] * (outRegion.GetIndex(1) + outRegion.GetSize(1)); + corners[6][0]= corners[0][0]; + corners[6][1]= corners[0][1] + outSpacing[1] * static_cast(outRegion.GetSize(1)); corners[6][2]= m_ElevationMin; // low left at elevation max corners[7][0]= corners[6][0]; @@ -446,6 +461,13 @@ double epiIndexMax[2]; int maxGridIndex[2]; int minGridIndex[2]; + + epiIndexMin[0] = itk::NumericTraits::Zero; + epiIndexMin[1] = itk::NumericTraits::Zero; + + epiIndexMax[0] = itk::NumericTraits::Zero; + epiIndexMax[1] = itk::NumericTraits::Zero; + maxGridIndex[0] = static_cast(gridRegion.GetIndex(0) + gridRegion.GetSize(0)) - 2; maxGridIndex[1] = static_cast(gridRegion.GetIndex(1) + gridRegion.GetSize(1)) - 2; minGridIndex[0] = static_cast(gridRegion.GetIndex(0)); @@ -540,8 +562,8 @@ } typename DisparityMapType::RegionType inputDisparityRegion; - inputDisparityRegion.SetIndex(0, static_cast(vcl_floor(epiIndexMin[0]))); - inputDisparityRegion.SetIndex(1, static_cast(vcl_floor(epiIndexMin[1]))); + inputDisparityRegion.SetIndex(0, static_cast(vcl_floor(epiIndexMin[0] + 0.5))); + inputDisparityRegion.SetIndex(1, static_cast(vcl_floor(epiIndexMin[1] + 0.5))); inputDisparityRegion.SetSize(0, 1 + static_cast(vcl_floor(epiIndexMax[0] - epiIndexMin[0] + 0.5))); inputDisparityRegion.SetSize(1, 1 + static_cast(vcl_floor(epiIndexMax[1] - epiIndexMin[1] + 0.5))); @@ -601,6 +623,8 @@ ::BeforeThreadedGenerateData() { const TDisparityImage * horizDisp = this->GetHorizontalDisparityMapInput(); + const TInputImage * leftSensor = this->GetLeftInput(); + const TInputImage * rightSensor = this->GetRightInput(); const TOutputDEMImage * outputDEM = this->GetDEMOutput(); @@ -608,6 +632,15 @@ m_UsedInputSplits = m_InputSplitter->GetNumberOfSplits(requestedRegion, this->GetNumberOfThreads()); + m_LeftToGroundTransform = RSTransformType::New(); + m_RightToGroundTransform = RSTransformType::New(); + + m_LeftToGroundTransform->SetInputKeywordList(leftSensor->GetImageKeywordlist()); + m_RightToGroundTransform->SetInputKeywordList(rightSensor->GetImageKeywordlist()); + + m_LeftToGroundTransform->InstanciateTransform(); + m_RightToGroundTransform->InstanciateTransform(); + // ensure empty regions are not processed if (requestedRegion.GetSize(0) == 0 && requestedRegion.GetSize(1) == 0) { @@ -641,27 +674,15 @@ class TEpipolarGridImage, class TMaskImage> void DisparityMapToDEMFilter -::ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const RegionType & itkNotUsed(outputRegionForThread), itk::ThreadIdType threadId) { const TDisparityImage * horizDisp = this->GetHorizontalDisparityMapInput(); const TDisparityImage * vertiDisp = this->GetVerticalDisparityMapInput(); - const TInputImage * leftSensor = this->GetLeftInput(); - const TInputImage * rightSensor = this->GetRightInput(); - const TMaskImage * disparityMask = this->GetDisparityMaskInput(); const TOutputDEMImage * outputDEM = this->GetDEMOutput(); - RSTransformType::Pointer leftToGroundTransform = RSTransformType::New(); - RSTransformType::Pointer rightToGroundTransform = RSTransformType::New(); - - leftToGroundTransform->SetInputKeywordList(leftSensor->GetImageKeywordlist()); - rightToGroundTransform->SetInputKeywordList(rightSensor->GetImageKeywordlist()); - - leftToGroundTransform->InstanciateTransform(); - rightToGroundTransform->InstanciateTransform(); - const TEpipolarGridImage * leftGrid = this->GetLeftEpipolarGridInput(); const TEpipolarGridImage * rightGrid = this->GetRightEpipolarGridInput(); @@ -775,10 +796,10 @@ sensorPoint[0] = cPixel[0]; sensorPoint[1] = cPixel[1]; sensorPoint[2] = m_ElevationMin; - leftGroundHmin = leftToGroundTransform->TransformPoint(sensorPoint); + leftGroundHmin = m_LeftToGroundTransform->TransformPoint(sensorPoint); sensorPoint[2] = m_ElevationMax; - leftGroundHmax = leftToGroundTransform->TransformPoint(sensorPoint); + leftGroundHmax = m_LeftToGroundTransform->TransformPoint(sensorPoint); // compute right ray itk::ContinuousIndex rightIndexEstimate; @@ -828,10 +849,10 @@ sensorPoint[0] = cPixel[0]; sensorPoint[1] = cPixel[1]; sensorPoint[2] = m_ElevationMin; - rightGroundHmin = rightToGroundTransform->TransformPoint(sensorPoint); + rightGroundHmin = m_RightToGroundTransform->TransformPoint(sensorPoint); sensorPoint[2] = m_ElevationMax; - rightGroundHmax = rightToGroundTransform->TransformPoint(sensorPoint); + rightGroundHmax = m_RightToGroundTransform->TransformPoint(sensorPoint); // Compute ray intersection (mid-point method), TODO : implement non-iterative method from Hartley & Sturm double a = (leftGroundHmax[0] - leftGroundHmin[0]) * (leftGroundHmax[0] - leftGroundHmin[0]) + diff -Nru otb-4.0.0/Code/DisparityMap/otbDisparityTranslateFilter.h otb-4.2.0/Code/DisparityMap/otbDisparityTranslateFilter.h --- otb-4.0.0/Code/DisparityMap/otbDisparityTranslateFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbDisparityTranslateFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -69,6 +69,7 @@ typedef typename DispMapType::IndexType IndexType; typedef typename DispMapType::SpacingType SpacingType; typedef typename DispMapType::PointType PointType; + typedef typename DispMapType::IndexValueType IndexValueType; typedef typename GridType::RegionType GridRegionType; diff -Nru otb-4.0.0/Code/DisparityMap/otbDisparityTranslateFilter.txx otb-4.2.0/Code/DisparityMap/otbDisparityTranslateFilter.txx --- otb-4.0.0/Code/DisparityMap/otbDisparityTranslateFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbDisparityTranslateFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -242,15 +242,23 @@ GridRegionType gridLargest = leftGrid->GetLargestPossibleRegion(); IndexType minIndex,maxIndex; + // -Wmaybe-uninitialized + typedef typename IndexType::IndexValueType IndexValueType; + minIndex.Fill(itk::NumericTraits::Zero); + maxIndex.Fill(itk::NumericTraits::Zero); + IndexType corners[4]; + for(int i = 0; i < 4; i++) + corners[i].Fill(itk::NumericTraits::Zero); + corners[0] = requested.GetIndex(); corners[1] = requested.GetIndex(); - corners[1][0] += requested.GetSize()[0]; + corners[1][0] += static_cast(requested.GetSize()[0]) - 1; corners[2] = requested.GetIndex(); - corners[2][1] += requested.GetSize()[1]; + corners[2][1] += static_cast(requested.GetSize()[1]) - 1; corners[3] = requested.GetIndex(); - corners[3][0] += requested.GetSize()[0]; - corners[3][1] += requested.GetSize()[1]; + corners[3][0] += static_cast(requested.GetSize()[0]) - 1; + corners[3][1] += static_cast(requested.GetSize()[1]) - 1; for (unsigned int k=0; k<4; ++k) { PointType pointSensor; @@ -260,10 +268,12 @@ IndexType ul; ul[0] = static_cast(vcl_floor(indexGrid[0])); ul[1] = static_cast(vcl_floor(indexGrid[1])); - if (ul[0](unsigned int)(gridLargest.GetIndex()[0]+gridLargest.GetSize()[0]-2)) ul[0]=(gridLargest.GetIndex()[0]+gridLargest.GetSize()[0]-2); - if (ul[1]>(unsigned int)(gridLargest.GetIndex()[1]+gridLargest.GetSize()[1]-2)) ul[1]=(gridLargest.GetIndex()[1]+gridLargest.GetSize()[1]-2); + if (ul[0] < gridLargest.GetIndex()[0]) ul[0] = gridLargest.GetIndex()[0]; + if (ul[1] < gridLargest.GetIndex()[1]) ul[1] = gridLargest.GetIndex()[1]; + if (ul[0] > static_cast(gridLargest.GetIndex()[0] + gridLargest.GetSize()[0]-2)) + ul[0] = (gridLargest.GetIndex()[0] + gridLargest.GetSize()[0]-2); + if (ul[1] > static_cast(gridLargest.GetIndex()[1] + gridLargest.GetSize()[1]-2)) + ul[1] = (gridLargest.GetIndex()[1] + gridLargest.GetSize()[1]-2); IndexType ur = ul; ur[0] += 1; @@ -319,7 +329,7 @@ template void DisparityTranslateFilter -::ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) { const TGridImage * leftGrid = this->GetInverseEpipolarLeftGrid(); const TGridImage * rightGrid = this->GetDirectEpipolarRightGrid(); @@ -357,15 +367,16 @@ leftGrid->TransformPhysicalPointToContinuousIndex(pointSensor, indexGrid); // Interpolate in left grid + typedef typename IndexType::IndexValueType IndexValueType; IndexType ul; ul[0] = static_cast (vcl_floor(indexGrid[0])); ul[1] = static_cast (vcl_floor(indexGrid[1])); if (ul[0] < leftLargest.GetIndex()[0]) ul[0] = leftLargest.GetIndex()[0]; if (ul[1] < leftLargest.GetIndex()[1]) ul[1] = leftLargest.GetIndex()[1]; - if (ul[0] > (unsigned int) (leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2)) ul[0] = ( - leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2); - if (ul[1] > (unsigned int) (leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2)) ul[1] = ( - leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2); + if (ul[0] > static_cast(leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2)) + ul[0] = (leftLargest.GetIndex()[0] + leftLargest.GetSize()[0] - 2); + if (ul[1] > static_cast(leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2)) + ul[1] = (leftLargest.GetIndex()[1] + leftLargest.GetSize()[1] - 2); IndexType ur = ul; ur[0] += 1; @@ -392,10 +403,10 @@ ul[1] = static_cast (vcl_floor(indexEpi[1])); if (ul[0] < buffered.GetIndex()[0]) ul[0] = buffered.GetIndex()[0]; if (ul[1] < buffered.GetIndex()[1]) ul[1] = buffered.GetIndex()[1]; - if (ul[0] > (unsigned int) (buffered.GetIndex()[0] + buffered.GetSize()[0] - 2)) ul[0] = (buffered.GetIndex()[0] - + buffered.GetSize()[0] - 2); - if (ul[1] > (unsigned int) (buffered.GetIndex()[1] + buffered.GetSize()[1] - 2)) ul[1] = (buffered.GetIndex()[1] - + buffered.GetSize()[1] - 2); + if (ul[0] > static_cast(buffered.GetIndex()[0] + buffered.GetSize()[0] - 2)) + ul[0] = (buffered.GetIndex()[0] + buffered.GetSize()[0] - 2); + if (ul[1] > static_cast(buffered.GetIndex()[1] + buffered.GetSize()[1] - 2)) + ul[1] = (buffered.GetIndex()[1] + buffered.GetSize()[1] - 2); ur = ul; ur[0] += 1; @@ -433,10 +444,10 @@ ul[1] = static_cast (vcl_floor(indexGridRight[1])); if (ul[0] < rightLargest.GetIndex()[0]) ul[0] = rightLargest.GetIndex()[0]; if (ul[1] < rightLargest.GetIndex()[1]) ul[1] = rightLargest.GetIndex()[1]; - if (ul[0] > (unsigned int) (rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2)) ul[0] = ( - rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2); - if (ul[1] > (unsigned int) (rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2)) ul[1] = ( - rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2); + if (ul[0] > static_cast(rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2)) + ul[0] = (rightLargest.GetIndex()[0] + rightLargest.GetSize()[0] - 2); + if (ul[1] > static_cast(rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2)) + ul[1] = (rightLargest.GetIndex()[1] + rightLargest.GetSize()[1] - 2); ur = ul; ur[0] += 1; diff -Nru otb-4.0.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.h otb-4.2.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.h --- otb-4.0.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -120,6 +120,9 @@ // 3D points typedef typename RSTransformType::InputPointType TDPointType; + // 2D Transform + typedef otb::GenericRSTransform<> RSTransform2DType; + typedef otb::ImageKeywordlist ImageKeywordListType; typedef std::map @@ -303,7 +306,9 @@ int m_OutputParametersFrom3DMap; bool m_IsGeographic; - + + /** internal transform between WGS84 and user's ProjRef */ + RSTransform2DType::Pointer m_GroundTransform; }; } // end namespace otb diff -Nru otb-4.0.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx otb-4.2.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx --- otb-4.0.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbMulti3DMapToDEMFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -169,7 +169,6 @@ TOutputDEMImage * outputPtr = this->GetDEMOutput(); // Set-up a transform to use the DEMHandler - typedef otb::GenericRSTransform<> RSTransform2DType; // DEM BBox itk::NumericTraits::max(); @@ -194,21 +193,29 @@ typename InputMapType::SizeType inputSize = imgPtr->GetLargestPossibleRegion().GetSize(); - typename InputMapType::PointType tmpPoint; - tmpPoint = imgPtr->GetOrigin(); - RSTransform2DType::OutputPointType ul = mapToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (imgPtr->GetOrigin())[0] + (imgPtr->GetSpacing())[0] * static_cast (inputSize[0]); - tmpPoint[1] = (imgPtr->GetOrigin())[1]; - RSTransform2DType::OutputPointType ur = mapToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (imgPtr->GetOrigin())[0] + (imgPtr->GetSpacing())[0] * static_cast (inputSize[0]); - tmpPoint[1] = (imgPtr->GetOrigin())[1] + (imgPtr->GetSpacing())[1] * static_cast (inputSize[1]); - RSTransform2DType::OutputPointType lr = mapToGroundTransform->TransformPoint(tmpPoint); - - tmpPoint[0] = (imgPtr->GetOrigin())[0]; - tmpPoint[1] = (imgPtr->GetOrigin())[1] + (imgPtr->GetSpacing())[1] * static_cast (inputSize[1]); - RSTransform2DType::OutputPointType ll = mapToGroundTransform->TransformPoint(tmpPoint); + typename InputMapType::PointType ulPt, urPt, llPt, lrPt; + itk::ContinuousIndex ulIdx(imgPtr->GetLargestPossibleRegion().GetIndex()); + ulIdx[0] += -0.5; + ulIdx[1] += -0.5; + + itk::ContinuousIndex urIdx(ulIdx); + itk::ContinuousIndex lrIdx(ulIdx); + itk::ContinuousIndex llIdx(ulIdx); + urIdx[0] += static_cast(inputSize[0]); + lrIdx[0] += static_cast(inputSize[0]); + lrIdx[1] += static_cast(inputSize[1]); + llIdx[1] += static_cast(inputSize[1]); + + imgPtr->TransformContinuousIndexToPhysicalPoint(ulIdx,ulPt); + imgPtr->TransformContinuousIndexToPhysicalPoint(urIdx,urPt); + imgPtr->TransformContinuousIndexToPhysicalPoint(llIdx,llPt); + imgPtr->TransformContinuousIndexToPhysicalPoint(lrIdx,lrPt); + + RSTransform2DType::OutputPointType ul, ur, lr, ll; + ul = mapToGroundTransform->TransformPoint(ulPt); + ur = mapToGroundTransform->TransformPoint(urPt); + ll = mapToGroundTransform->TransformPoint(llPt); + lr = mapToGroundTransform->TransformPoint(lrPt); double xmin = std::min(std::min(std::min(ul[0], ur[0]), lr[0]), ll[0]); double xmax = std::max(std::max(std::max(ul[0], ur[0]), lr[0]), ll[0]); @@ -228,12 +235,6 @@ } - // Choose origin - typename TOutputDEMImage::PointType outOrigin; - outOrigin[0] = box_xmin; - outOrigin[1] = box_ymax; - outputPtr->SetOrigin(outOrigin); - // Compute step : // TODO : use a clean RS transform instead typename TOutputDEMImage::SpacingType outSpacing; @@ -241,14 +242,19 @@ outSpacing[0] = 57.295779513 * m_DEMGridStep / (6378137.0 * vcl_cos((box_ymin + box_ymax) * 0.5 * 0.01745329251)); outSpacing[1] = -57.295779513 * m_DEMGridStep / 6378137.0; outputPtr->SetSpacing(outSpacing); + + // Choose origin + typename TOutputDEMImage::PointType outOrigin; + outOrigin[0] = box_xmin + 0.5 * outSpacing[0]; + outOrigin[1] = box_ymax + 0.5 * outSpacing[1]; + outputPtr->SetOrigin(outOrigin); + // Compute output size typename TOutputDEMImage::RegionType outRegion; outRegion.SetIndex(0, 0); outRegion.SetIndex(1, 0); - outRegion.SetSize(0, static_cast ((box_xmax - box_xmin) / vcl_abs(outSpacing[0]) + 1)); - //TODO JGT check the size - //outRegion.SetSize(1, static_cast ((box_ymax - box_ymin) / vcl_abs(outSpacing[1])+1)); - outRegion.SetSize(1, static_cast ((box_ymax - box_ymin) / vcl_abs(outSpacing[1]))); + outRegion.SetSize(0, static_cast(vcl_floor((box_xmax - box_xmin) / vcl_abs(outSpacing[0]) + 0.5))); + outRegion.SetSize(1, static_cast(vcl_floor((box_ymax - box_ymin) / vcl_abs(outSpacing[1]) + 0.5))); outputPtr->SetLargestPossibleRegion(outRegion); outputPtr->SetNumberOfComponentsPerPixel(1); @@ -347,32 +353,32 @@ // up left at elevation min TDPointType corners[8]; - corners[0][0] = outOrigin[0] + outSpacing[0] * outRegion.GetIndex(0); - corners[0][1] = outOrigin[1] + outSpacing[1] * outRegion.GetIndex(1); + corners[0][0] = outOrigin[0] + outSpacing[0] * (-0.5 + static_cast(outRegion.GetIndex(0))); + corners[0][1] = outOrigin[1] + outSpacing[1] * (-0.5 + static_cast(outRegion.GetIndex(1))); corners[0][2] = m_ElevationMin; // up left at elevation max corners[1][0] = corners[0][0]; corners[1][1] = corners[0][1]; corners[1][2] = m_ElevationMax; // up right at elevation min - corners[2][0] = outOrigin[0] + outSpacing[0] * (outRegion.GetIndex(0) + outRegion.GetSize(0)); - corners[2][1] = outOrigin[1] + outSpacing[1] * outRegion.GetIndex(1); + corners[2][0] = corners[0][0] + outSpacing[0] * static_cast(outRegion.GetSize(0)); + corners[2][1] = corners[0][1]; corners[2][2] = m_ElevationMin; // up right at elevation max corners[3][0] = corners[2][0]; corners[3][1] = corners[2][1]; corners[3][2] = m_ElevationMax; // low right at elevation min - corners[4][0] = outOrigin[0] + outSpacing[0] * (outRegion.GetIndex(0) + outRegion.GetSize(0)); - corners[4][1] = outOrigin[1] + outSpacing[1] * (outRegion.GetIndex(1) + outRegion.GetSize(1)); + corners[4][0] = corners[0][0] + outSpacing[0] * static_cast(outRegion.GetSize(0)); + corners[4][1] = corners[0][1] + outSpacing[1] * static_cast(outRegion.GetSize(1)); corners[4][2] = m_ElevationMin; // low right at elevation max corners[5][0] = corners[4][0]; corners[5][1] = corners[4][1]; corners[5][2] = m_ElevationMax; // low left at elevation min - corners[6][0] = outOrigin[0] + outSpacing[0] * outRegion.GetIndex(0); - corners[6][1] = outOrigin[1] + outSpacing[1] * (outRegion.GetIndex(1) + outRegion.GetSize(1)); + corners[6][0] = corners[0][0]; + corners[6][1] = corners[0][1] + outSpacing[1] * static_cast(outRegion.GetSize(1)); corners[6][2] = m_ElevationMin; // low left at elevation max corners[7][0] = corners[6][0]; @@ -516,13 +522,20 @@ m_TempDEMAccumulatorRegions.push_back(tmpImg2); } + if (!this->m_IsGeographic) + { + m_GroundTransform = RSTransform2DType::New(); + m_GroundTransform->SetInputProjectionRef(static_cast (otb::GeoInformationConversion::ToWKT(4326))); + m_GroundTransform->SetOutputProjectionRef(m_ProjectionRef); + m_GroundTransform->InstanciateTransform(); + } } template void Multi3DMapToDEMFilter::ThreadedGenerateData( - const RegionType & outputRegionForThread, - itk::ThreadIdType threadId) + const RegionType & itkNotUsed(outputRegionForThread), + itk::ThreadIdType threadId) { TOutputDEMImage * outputPtr = this->GetOutput(); @@ -543,11 +556,9 @@ InputInternalPixelType regionLong2 = pointRef[0] + size[0] * step[0]; InputInternalPixelType regionLat2 = pointRef[1] + size[1] * step[1]; InputInternalPixelType minLong = std::min(regionLong1, regionLong2); - InputInternalPixelType minLat = std::min(regionLat1, regionLat2); - InputInternalPixelType maxLong = std::max(regionLong1, regionLong2); - InputInternalPixelType maxLat = std::max(regionLat1, regionLat2); - - typedef otb::GenericRSTransform<> RSTransform2DType; + // InputInternalPixelType minLat = std::min(regionLat1, regionLat2); + // InputInternalPixelType maxLong = std::max(regionLong1, regionLong2); + // InputInternalPixelType maxLat = std::max(regionLat1, regionLat2); TOutputDEMImage * tmpDEM = NULL; AccumulatorImageType *tmpAcc = NULL; @@ -570,18 +581,6 @@ origin = imgPtr->GetOrigin(); typename InputMapType::SpacingType spacing; spacing = imgPtr->GetSpacing(); - RSTransform2DType::Pointer groundTransform; - if (!this->m_IsGeographic) - { - groundTransform = RSTransform2DType::New(); - ImageKeywordListType imageKWL = imgPtr->GetImageKeywordlist(); - //groundTransform->SetInputKeywordList(imageKWL); - groundTransform->SetInputProjectionRef(static_cast (otb::GeoInformationConversion::ToWKT(4326))); - groundTransform->SetOutputProjectionRef(m_ProjectionRef); - //groundTransform->SetInputOrigin(origin); - //groundTransform->SetInputSpacing(spacing); - groundTransform->InstanciateTransform(); - } if (static_cast (threadId) < m_NumberOfSplit[k]) { @@ -624,7 +623,7 @@ typename RSTransform2DType::InputPointType tmpPoint; tmpPoint[0] = position[0]; tmpPoint[1] = position[1]; - RSTransform2DType::OutputPointType groundPosition = groundTransform->TransformPoint(tmpPoint); + RSTransform2DType::OutputPointType groundPosition = m_GroundTransform->TransformPoint(tmpPoint); position[0] = groundPosition[0]; position[1] = groundPosition[1]; } @@ -641,10 +640,11 @@ itk::ContinuousIndex continuousIndex; //std::cout<<"point2D "<TransformPhysicalPointToContinuousIndex(point2D, continuousIndex); typename OutputImageType::IndexType cellIndex; - cellIndex[0] = static_cast (vcl_floor(continuousIndex[0])); - cellIndex[1] = static_cast (vcl_floor(continuousIndex[1])); + cellIndex[0] = static_cast (vcl_floor(continuousIndex[0] + 0.5)); + cellIndex[1] = static_cast (vcl_floor(continuousIndex[1] + 0.5)); //std::cout<<"cellindex "< void MultiDisparityMapTo3DFilter -::ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const RegionType & outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) { TOutputImage * outputPtr = this->GetOutput(); TResidueImage * residuePtr = this->GetResidueOutput(); diff -Nru otb-4.0.0/Code/DisparityMap/otbPointSetToDisplacementFieldGenerator.txx otb-4.2.0/Code/DisparityMap/otbPointSetToDisplacementFieldGenerator.txx --- otb-4.0.0/Code/DisparityMap/otbPointSetToDisplacementFieldGenerator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbPointSetToDisplacementFieldGenerator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -98,7 +98,7 @@ unsigned int j = 0; typedef typename PointSetType::PointsContainer::ConstIterator PointSetIteratorType; - typedef typename PointSetType::PointsContainer PointsContainerType; + PointSetIteratorType it = this->GetPointSet()->GetPoints()->Begin(); for (; it != this->GetPointSet()->GetPoints()->End(); ++it) { diff -Nru otb-4.0.0/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.txx otb-4.2.0/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.txx --- otb-4.0.0/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.txx 2014-09-03 08:29:34.000000000 +0000 @@ -213,7 +213,6 @@ { double a = (leftEpiLineEnd[1] - leftEpiLineStart[1]) / (leftEpiLineEnd[0] - leftEpiLineStart[0]); - double b = leftEpiLineStart[1] - a * leftEpiLineStart[0]; if (leftEpiLineEnd[0] > leftEpiLineStart[0]) { alpha = vcl_atan(a); diff -Nru otb-4.0.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.h otb-4.2.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.h --- otb-4.0.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -242,6 +242,10 @@ * difference between the estimated elevation and the initial * one. If set to false, elevation is absolute. Default is false. */ bool m_SubtractInitialElevation; + + /** Master to slave transform */ + GenericRSTransform3DType::Pointer m_MasterToSlave; + }; } // End namespace otb diff -Nru otb-4.0.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.txx otb-4.2.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.txx --- otb-4.0.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -298,6 +298,15 @@ outputIt.Set(otb::DEMHandler::Instance()->GetHeightAboveEllipsoid(geoPoint)); } + const InputImageType* masterPtr = this->GetMasterInput(); + const InputImageType* slavePtr = this->GetSlaveInput(); + + // Set-up the forward-inverse sensor model transform + m_MasterToSlave = GenericRSTransform3DType::New(); + m_MasterToSlave->SetInputKeywordList(masterPtr->GetImageKeywordlist()); + m_MasterToSlave->SetOutputKeywordList(slavePtr->GetImageKeywordlist()); + m_MasterToSlave->InstanciateTransform(); + } template @@ -307,16 +316,9 @@ { // Retrieve pointers const InputImageType* masterPtr = this->GetMasterInput(); - const InputImageType* slavePtr = this->GetSlaveInput(); OutputImageType* outputPtr = this->GetOutput(); OutputImageType* correlPtr = this->GetCorrelationOutput(); - // Set-up the forward-inverse sensor model transform - typename GenericRSTransform3DType::Pointer transform = GenericRSTransform3DType::New(); - transform->SetInputKeywordList(masterPtr->GetImageKeywordlist()); - transform->SetOutputKeywordList(slavePtr->GetImageKeywordlist()); - - // TODO: Uncomment when model optimization pushed // // GCP refinement // unsigned int gcpCount1 = this->GetMasterInput()->GetGCPCount(); @@ -375,9 +377,6 @@ itk::ImageRegionIterator outputIt(outputPtr, outputRegionForThread); itk::ImageRegionIteratorWithIndex correlIt(correlPtr, outputRegionForThread); - // Transform elevation set-up - transform->InstanciateTransform(); - // Start visiting buffer again outputIt.GoToBegin(); correlIt.GoToBegin(); @@ -458,7 +457,7 @@ in3DPoint[2] = height; // Transform to slave - out3DPoint = transform->TransformPoint(in3DPoint); + out3DPoint = m_MasterToSlave->TransformPoint(in3DPoint); outPoint[0] = out3DPoint[0]; outPoint[1] = out3DPoint[1]; diff -Nru otb-4.0.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.h otb-4.2.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.h --- otb-4.0.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -207,6 +207,13 @@ /** Destructor */ virtual ~SubPixelDisparityImageFilter(); + /** \brief Verify that the input images are compatible + * + * This method needs to be re-implemented from ImageToImageFilter since + * the initial images and disparity maps may not have the same size + */ + virtual void VerifyInputInformation(); + /** Generate output information */ virtual void GenerateOutputInformation(); diff -Nru otb-4.0.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.txx otb-4.2.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.txx --- otb-4.0.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/DisparityMap/otbSubPixelDisparityImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -357,6 +357,59 @@ void SubPixelDisparityImageFilter +::VerifyInputInformation() +{ + // Retrieve input pointers + const TInputImage * inLeftPtr = this->GetLeftInput(); + const TInputImage * inRightPtr = this->GetRightInput(); + const TMaskImage * inLeftMaskPtr = this->GetLeftMaskInput(); + const TMaskImage * inRightMaskPtr = this->GetRightMaskInput(); + const TDisparityImage * inHDispPtr = this->GetHorizontalDisparityInput(); + const TDisparityImage * inVDispPtr = this->GetVerticalDisparityInput(); + + // Check pointers before using them + if(!inLeftPtr || !inRightPtr) + { + itkExceptionMacro(<<"Missing input, need left and right input images."); + } + + if (!inHDispPtr) + { + itkExceptionMacro(<<"Input horizontal disparity map is missing"); + } + + // Now, we impose that both inputs have the same size + if(inLeftPtr->GetLargestPossibleRegion() + != inRightPtr->GetLargestPossibleRegion()) + { + itkExceptionMacro(<<"Left and right images do not have the same size ! Left largest region: "<GetLargestPossibleRegion()<<", right largest region: "<GetLargestPossibleRegion()); + } + + // We also check that left mask image has same size if present + if(inLeftMaskPtr && inLeftPtr->GetLargestPossibleRegion() != inLeftMaskPtr->GetLargestPossibleRegion()) + { + itkExceptionMacro(<<"Left and mask images do not have the same size ! Left largest region: "<GetLargestPossibleRegion()<<", mask largest region: "<GetLargestPossibleRegion()); + } + + // We also check that right mask image has same size if present + if(inRightMaskPtr && inRightPtr->GetLargestPossibleRegion() != inRightMaskPtr->GetLargestPossibleRegion()) + { + itkExceptionMacro(<<"Right and mask images do not have the same size ! Right largest region: "<GetLargestPossibleRegion()<<", mask largest region: "<GetLargestPossibleRegion()); + } + + // We check that the input initial disparity maps have the same size if present + if (inHDispPtr && inVDispPtr && inHDispPtr->GetLargestPossibleRegion() != inVDispPtr->GetLargestPossibleRegion()) + { + itkExceptionMacro(<<"Initial horizontal and vertical disparity maps don't have the same size ! Horizontal disparity largest region: "<GetLargestPossibleRegion()<<", vertical disparity largest region: "<GetLargestPossibleRegion()); + } + +} + +template +void +SubPixelDisparityImageFilter ::GenerateOutputInformation() { // Retrieve input pointers @@ -367,11 +420,6 @@ TDisparityImage * outHDispPtr = this->GetHorizontalDisparityOutput(); TDisparityImage * outVDispPtr = this->GetVerticalDisparityOutput(); - if (!inHDispPtr) - { - itkExceptionMacro(<<"Input horizontal disparity map is missing"); - } - outMetricPtr->CopyInformation(inHDispPtr); outHDispPtr->CopyInformation(inHDispPtr); outVDispPtr->CopyInformation(inHDispPtr); @@ -416,40 +464,7 @@ TDisparityImage * inHDispPtr = const_cast(this->GetHorizontalDisparityInput()); TDisparityImage * inVDispPtr = const_cast(this->GetVerticalDisparityInput()); - TOutputMetricImage * outMetricPtr = this->GetMetricOutput(); TDisparityImage * outHDispPtr = this->GetHorizontalDisparityOutput(); - TDisparityImage * outVDispPtr = this->GetVerticalDisparityOutput(); - - // Check pointers before using them - if(!inLeftPtr || !inRightPtr || !outMetricPtr || !outHDispPtr || !outVDispPtr) - { - return; - } - - // Now, we impose that both inputs have the same size - if(inLeftPtr->GetLargestPossibleRegion() - != inRightPtr->GetLargestPossibleRegion()) - { - itkExceptionMacro(<<"Left and right images do not have the same size ! Left largest region: "<GetLargestPossibleRegion()<<", right largest region: "<GetLargestPossibleRegion()); - } - - // We also check that left mask image has same size if present - if(inLeftMaskPtr && inLeftPtr->GetLargestPossibleRegion() != inLeftMaskPtr->GetLargestPossibleRegion()) - { - itkExceptionMacro(<<"Left and mask images do not have the same size ! Left largest region: "<GetLargestPossibleRegion()<<", mask largest region: "<GetLargestPossibleRegion()); - } - - // We also check that right mask image has same size if present - if(inRightMaskPtr && inRightPtr->GetLargestPossibleRegion() != inRightMaskPtr->GetLargestPossibleRegion()) - { - itkExceptionMacro(<<"Right and mask images do not have the same size ! Right largest region: "<GetLargestPossibleRegion()<<", mask largest region: "<GetLargestPossibleRegion()); - } - - // We check that the input initial disparity maps have the same size if present - if (inHDispPtr && inVDispPtr && inHDispPtr->GetLargestPossibleRegion() != inVDispPtr->GetLargestPossibleRegion()) - { - itkExceptionMacro(<<"Initial horizontal and vertical disparity maps don't have the same size ! Horizontal disparity largest region: "<GetLargestPossibleRegion()<<", vertical disparity largest region: "<GetLargestPossibleRegion()); - } // Retrieve requested region (TODO: check if we need to handle // region for outHDispPtr) diff -Nru otb-4.0.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.h otb-4.2.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -80,45 +80,45 @@ /** Set/Get the radius of the region of the pixel suppression by direction image filter. */ void SetPixelSuppressionRadius(SizeType Radius); - const SizeType GetPixelSuppressionRadius(void); + const SizeType GetPixelSuppressionRadius(); /** Set/Get Angular Accuracy on the direction of the central pixel for the pixel suppression by direction image filter. */ void SetPixelSuppressionAngularBeam(float AngularBeam); - const float GetPixelSuppressionAngularBeam(void); + float GetPixelSuppressionAngularBeam(); /** Set/Get the radius used to define the region of local hough filter. */ void SetLocalHoughRadius(SizeType Radius); - const SizeType GetLocalHoughRadius(void); + const SizeType GetLocalHoughRadius(); /** Set/Get the number of lines we are looking for in the local hough filter. */ void SetLocalHoughNumberOfLines(unsigned int Radius); - const unsigned int GetLocalHoughNumberOfLines(void); + unsigned int GetLocalHoughNumberOfLines(); /** Set/Get the radius of the disc to remove from the accumulator * for each line found */ void SetLocalHoughDiscRadius(float DiscRadius); - const float GetLocalHoughDiscRadius(void); + float GetLocalHoughDiscRadius(); /** Set/Get the variance of the gaussian bluring for the accumulator */ void SetLocalHoughVariance(float Variance); - const float GetLocalHoughVariance(void); + float GetLocalHoughVariance(); /** Set/Get the radius between two segments in the fill gaps filter. */ void SetFillGapsRadius(float Radius); - const float GetFillGapsRadius(void); + float GetFillGapsRadius(); /** Set/Get Angular Beam between two segments in the fill gaps filter. */ void SetFillGapsAngularBeam(float AngularBeam); - const float GetFillGapsAngularBeam(void); + float GetFillGapsAngularBeam(); /** Set/Get the image input of this filter. */ void SetInputImage(const InputImageType *image); - const InputImageType * GetInputImage(void); + const InputImageType * GetInputImage(); /** Set/Get the image direction of this filter. */ void SetInputImageDirection(const InputImageType *image); - const InputImageType * GetInputImageDirection(void); + const InputImageType * GetInputImageDirection(); /** Set/Get the value of the drawed line*/ itkGetMacro(LineValue, typename OutputImageType::PixelType); diff -Nru otb-4.0.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.txx otb-4.2.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbExtractSegmentsImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -55,7 +55,7 @@ template const typename ExtractSegmentsImageFilter::InputImageType * ExtractSegmentsImageFilter -::GetInputImage(void) +::GetInputImage() { return static_cast (this->GetInput(0)); @@ -74,7 +74,7 @@ template const typename ExtractSegmentsImageFilter::InputImageType * ExtractSegmentsImageFilter -::GetInputImageDirection(void) +::GetInputImageDirection() { return static_cast (this->GetInput(1)); @@ -93,7 +93,7 @@ template const typename ExtractSegmentsImageFilter::SizeType ExtractSegmentsImageFilter -::GetPixelSuppressionRadius(void) +::GetPixelSuppressionRadius() { return (m_PixelSuppression->GetRadius()); } @@ -106,9 +106,9 @@ } template -const float +float ExtractSegmentsImageFilter -::GetPixelSuppressionAngularBeam(void) +::GetPixelSuppressionAngularBeam() { return (m_PixelSuppression->GetAngularBeam()); } @@ -126,7 +126,7 @@ template const typename ExtractSegmentsImageFilter::SizeType ExtractSegmentsImageFilter -::GetLocalHoughRadius(void) +::GetLocalHoughRadius() { return (m_LocalHough->GetRadius()); } @@ -139,9 +139,9 @@ } template -const unsigned int +unsigned int ExtractSegmentsImageFilter -::GetLocalHoughNumberOfLines(void) +::GetLocalHoughNumberOfLines() { return (m_LocalHough->GetNumberOfLines()); } @@ -154,9 +154,9 @@ } template -const float +float ExtractSegmentsImageFilter -::GetLocalHoughDiscRadius(void) +::GetLocalHoughDiscRadius() { return (m_LocalHough->GetDiscRadius()); } @@ -169,9 +169,9 @@ } template -const float +float ExtractSegmentsImageFilter -::GetLocalHoughVariance(void) +::GetLocalHoughVariance() { return (m_LocalHough->GetVariance()); } @@ -187,9 +187,9 @@ } template -const float +float ExtractSegmentsImageFilter -::GetFillGapsRadius(void) +::GetFillGapsRadius() { return (m_FillGaps->GetRadius()); } @@ -202,9 +202,9 @@ } template -const float +float ExtractSegmentsImageFilter -::GetFillGapsAngularBeam(void) +::GetFillGapsAngularBeam() { return (m_FillGaps->GetAngularBeam()); } diff -Nru otb-4.0.0/Code/FeatureExtraction/otbFlusserPathFunction.txx otb-4.2.0/Code/FeatureExtraction/otbFlusserPathFunction.txx --- otb-4.0.0/Code/FeatureExtraction/otbFlusserPathFunction.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbFlusserPathFunction.txx 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ template typename FlusserPathFunction::RealType FlusserPathFunction -::Evaluate(const PathType& path) const +::Evaluate(const PathType& itkNotUsed(path)) const { typedef ComplexMomentPathFunction FunctionType; typedef typename FunctionType::ComplexType ComplexType; diff -Nru otb-4.0.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h otb-4.2.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -79,6 +79,8 @@ typedef typename InputImageType::IndexType IndexType; typedef typename InputImageType::Pointer ImagePointer; typedef typename InputImageType::ConstPointer ImageConstPointer; + typedef typename InputImageType::SizeType SizeType; + typedef typename InputImageType::SpacingType SpacingType; /** InputImageType typedef support. */ typedef typename OutputImageType::PixelType OutputPixelType; @@ -118,8 +120,6 @@ itkSetMacro(DefaultPixelValue, PixelType); itkGetMacro(DefaultPixelValue, PixelType); - virtual void GenerateOutputInformation(void); - /** Set/Get the Interpolator pointer for the Log-polar resampler */ itkSetObjectMacro(Interpolator, InterpolatorType); itkGetObjectMacro(Interpolator, InterpolatorType); @@ -128,6 +128,11 @@ ForwardFourierMellinTransformImageFilter(); virtual ~ForwardFourierMellinTransformImageFilter() {} void PrintSelf(std::ostream& os, itk::Indent indent) const; + + virtual void GenerateOutputInformation(void); + + virtual void GenerateInputRequestedRegion(void); + /** Main Computation Method */ void GenerateData(); @@ -156,9 +161,6 @@ /** FFT Filter */ FourierImageFilterPointer m_FFTFilter; - /** Iterator */ - IteratorType m_Iterator; - }; } // namespace otb diff -Nru otb-4.0.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx otb-4.2.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbForwardFourierMellinTransformImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -63,27 +63,60 @@ template void ForwardFourierMellinTransformImageFilter +::GenerateInputRequestedRegion(void) +{ + ImagePointer input = const_cast(this->GetInput()); + input->SetRequestedRegion(input->GetLargestPossibleRegion()); +} + +template +void +ForwardFourierMellinTransformImageFilter ::GenerateData() { typename LogPolarTransformType::ParametersType params(4); - // Center the transform - params[0] = 0.5 * static_cast(this->GetInput()->GetLargestPossibleRegion().GetSize()[0]); - params[1] = 0.5 * static_cast(this->GetInput()->GetLargestPossibleRegion().GetSize()[1]); + + // Compute centre of the transform + SizeType inputSize = this->GetInput()->GetLargestPossibleRegion().GetSize(); + SpacingType inputSpacing = this->GetInput()->GetSpacing(); + itk::ContinuousIndex centre; + centre[0] = -0.5 + 0.5 * static_cast(inputSize[0]); + centre[1] = -0.5 + 0.5 * static_cast(inputSize[1]); + PointType centrePt; + this->GetInput()->TransformContinuousIndexToPhysicalPoint(centre,centrePt); + + // Compute physical radius in the input image + double radius = vcl_log(vcl_sqrt( + vcl_pow(static_cast(inputSize[0])*inputSpacing[0],2.0) + + vcl_pow(static_cast(inputSize[1])*inputSpacing[1],2.0)) / 2.0); + + params[0] = centrePt[0]; + params[1] = centrePt[1]; params[2] = 360. / m_OutputSize[0]; - params[3] = - vcl_log(vcl_sqrt(vcl_pow(static_cast(this->GetInput()->GetLargestPossibleRegion().GetSize()[0]), 2) - + vcl_pow(static_cast(this->GetInput()->GetLargestPossibleRegion().GetSize()[1]), - 2.)) / 2) / m_OutputSize[1]; + params[3] = radius / m_OutputSize[1]; m_Transform->SetParameters(params); + // Compute rho scaling parameter in index space + double rhoScaleIndex = vcl_log(vcl_sqrt( + vcl_pow(static_cast(inputSize[0]),2.0) + + vcl_pow(static_cast(inputSize[1]),2.0)) / 2.0) / m_OutputSize[1]; + // log polar resampling m_ResampleFilter->SetInput(this->GetInput()); m_ResampleFilter->SetDefaultPixelValue(m_DefaultPixelValue); m_ResampleFilter->SetSize(m_OutputSize); + + PointType outOrigin; + outOrigin.Fill(0.5); + m_ResampleFilter->SetOutputOrigin(outOrigin); + SpacingType outSpacing; + outSpacing.Fill(1.0); + m_ResampleFilter->SetOutputSpacing(outSpacing); + m_ResampleFilter->Update(); typename InputImageType::Pointer tempImage = m_ResampleFilter->GetOutput(); - m_Iterator = IteratorType(tempImage, tempImage->GetRequestedRegion()); + IteratorType iter(tempImage, tempImage->GetRequestedRegion()); // Min/max values of the output pixel type AND these values // represented as the output type of the interpolator @@ -92,13 +125,14 @@ // Normalization is specific to FourierMellin convergence conditions, and // thus should be implemented here instead of in the resample filter. - for (m_Iterator.GoToBegin(); !m_Iterator.IsAtEnd(); ++m_Iterator) + for (iter.GoToBegin(); !iter.IsAtEnd(); ++iter) { - double Rho = m_Iterator.GetIndex()[1] * params[3]; + // 0.5 shift in order to follow output image physical space + double Rho = (0.5 + static_cast(iter.GetIndex()[1])) * rhoScaleIndex; PixelType pixval; - double valueTemp = static_cast(m_Iterator.Get()); + double valueTemp = static_cast(iter.Get()); valueTemp *= vcl_exp(m_Sigma * Rho); - valueTemp *= params[3]; + valueTemp *= rhoScaleIndex; PixelType value = static_cast(valueTemp); if (value < minOutputValue) @@ -113,7 +147,7 @@ { pixval = static_cast(value); } - m_Iterator.Set(pixval); + iter.Set(pixval); } m_FFTFilter->SetInput(tempImage); diff -Nru otb-4.0.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h otb-4.2.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -187,7 +187,9 @@ /** Destructor */ ~GenericRoadExtractionFilter() {} - /** Prepare main computation method */ + /** Prepare main computation method + * Note : this function isn't called + */ void BeforeGenerateData(void); /** Main computation method */ diff -Nru otb-4.0.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx otb-4.2.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbGenericRoadExtractionFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -113,6 +113,7 @@ m_GradientFilter->SetInput(m_SquareRootImageFilter->GetOutput()); /** Sigma calculated with the alpha and image resolution parameters */ m_GradientFilter->SetSigma(static_cast(m_Alpha * (1.2 / m_Resolution + 1.))); + m_GradientFilter->SetUseImageDirection(false); m_NeighborhoodScalarProductFilter->SetInput(m_GradientFilter->GetOutput()); diff -Nru otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.h otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.h --- otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,192 @@ +/*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ + + +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. + + +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. + +=========================================================================*/ + +#ifndef __otbGreyLevelCooccurrenceIndexedList_h +#define __otbGreyLevelCooccurrenceIndexedList_h + +#include "itkNumericTraits.h" +#include "itkObjectFactory.h" +#include "itkLightObject.h" +#include "itkArray.h" +#include "itkIndex.h" +#include "itkSize.h" +#include +#include + +namespace otb +{ +/** \class GreyLevelCooccurrenceIndexedList +* \brief This class holds a VectorType of CooccurrencePairType with each pair is +* a combination of pixel index and frequency. +* +* GreyLevelCooccurrenceIndexedList instance is created for every neighborhood +* iteration over the given input image. This class keep an internal itk::Array +* as a lookup array with size as [nbbins x nbbins]. The lookup array stores +* position CooccurrencePairType in the VectorType. It ensures us that all elements +* in Vector are unqiue in terms of the index value in the pair. For any given +* pixel index, -1 value indicates zero existance of the index in the +* VectorType. This avoid searching all elements in VectorType for each pixel +* index added during neighborhood iterator. It is also used to decide wheather +* to update the frequency of pair or to insert a new element in the vector. +* +* Print references: +* David A. Clausi and Yongping Zhao. 2002. Rapid extraction of image texture by +* co-occurrence using a hybrid data structure. Comput. Geosci. 28, 6 (July +* 2002), 763-774. DOI=10.1016/S0098-3004(01)00108-X +* http://dx.doi.org/10.1016/S0098-3004(01)00108-X +* +* de O.Bastos, L.; Liatsis, P.; Conci, A., Automatic texture segmentation based +* on k-means clustering and efficient calculation of co-occurrence +* features. Systems, Signals and Image Processing, 2008. IWSSIP 2008. 15th +* International Conference on , vol., no., pp.141,144, 25-28 June 2008 +* doi: 10.1109/IWSSIP.2008.4604387 +*/ + +template +class ITK_EXPORT GreyLevelCooccurrenceIndexedList : public itk::LightObject +{ +public: + + /** Standard typedefs */ + typedef GreyLevelCooccurrenceIndexedList Self; + typedef itk::LightObject Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** Creation through the object factory */ + itkNewMacro(Self); + + /** RTTI */ + itkTypeMacro(GreyLevelCooccurrenceIndexedList, itk::LightObject); + + typedef TPixel PixelType; + + itkStaticConstMacro(PixelPairSize, unsigned int, 2); + + typedef itk::Index IndexType; + typedef itk::Size SizeType; + typedef typename itk::IndexValueType IndexValueType; + + typedef typename itk::IdentifierType InstanceIdentifier; + typedef InstanceIdentifier FrequencyType; + typedef typename itk::NumericTraits< FrequencyType >::RealType RelativeFrequencyType; + typedef typename itk::NumericTraits< FrequencyType >::AccumulateType TotalFrequencyType; + + typedef typename itk::NumericTraits< PixelType >::RealType PixelValueType; + typedef itk::FixedArray PixelPairType; + // lower bound of each bin + std::vector< std::vector< PixelValueType > > m_Min; + // upper bound of each bin + std::vector< std::vector< PixelValueType > > m_Max; + + /* std::pair to hold pixel pair and its frequency count */ + typedef std::pair CooccurrencePairType; + + /** Lookup array used to store the index of the given pixel pair. Size of + * LookupAray is equal to the nbins * nbins. Values in the array represents 1D + * index of the IndexType*/ + typedef itk::Array LookupArrayType; + + /** std::vector to hold CooccurrencePairType. Index of the array where the + * cooccurrence is stored is saved in the LookupArrayType.*/ + typedef std::vector VectorType; + + /** Get the total frequency of Co-occurrence pairs. */ + itkGetMacro(TotalFrequency, TotalFrequencyType); + + /** Get the total frequency of Co-occurrence pairs. */ + itkGetMacro(Symmetry, bool); + + /** Get std::vector containing non-zero co-occurrence pairs */ + VectorType GetVector(); + + /** Initialize the lowerbound and upper bound vecotor, Fill m_LookupArray with + * -1 and set m_TotalFreqency to zero */ + void Initialize(const unsigned int nbins, const PixelValueType min, + const PixelValueType max, const bool symmetry = true); + + //check if both pixel values fall between m_InputImageMinimum and + //m_InputImageMaximum. If so add to m_Vector via AddPairToVector method */ + void AddPixelPair(const PixelValueType& pixelvalue1, const PixelValueType& pixelvalue2); + + /* Get the frequency value from Vector with index =[j,i] */ + RelativeFrequencyType GetFrequency(IndexValueType i, IndexValueType j); + + /* Get the frequency value from Vector with index =[j,i] from given + * vector. This is used if we have a copy of m_Vector normalized. */ + RelativeFrequencyType GetFrequency(IndexValueType i, IndexValueType j, const VectorType& vect) const; + +protected: + GreyLevelCooccurrenceIndexedList(); + ~GreyLevelCooccurrenceIndexedList() { } + + /** create a cooccurrence pair with given index and frequency = 1 + * value. Next occurrence of same index is checked via m_LookupArray and the + * correspoding frequency value is incremented. If m_Symmetry is true the + * co-occurrence pair is added again with index values swapped */ + void AddPairToVector(IndexType index); + + void SetBinMin(const unsigned int dimension, const InstanceIdentifier nbin, + PixelValueType min); + + void SetBinMax(const unsigned int dimension, const InstanceIdentifier nbin, + PixelValueType max); + + /** Get index of the pixelPair combination and save the result in index **/ + bool GetIndex(const PixelPairType & pixelPair, IndexType & index) const; + + void PrintSelf(std::ostream & os, itk::Indent indent) const; + +private: + + GreyLevelCooccurrenceIndexedList(const Self&); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + /** LookupArray instance */ + LookupArrayType m_LookupArray; + + /* std::vector holding actual co-occurrence pairs */ + VectorType m_Vector; + + /* Size instance */ + SizeType m_Size; + + /** booleab to check if co-occurrene list is a symmtrical. true by default */ + bool m_Symmetry; + + /* Store the total frequency of co-occurrence pairs in GreyLevelCooccureneIndexedList class */ + TotalFrequencyType m_TotalFrequency; + + /** boolean to check pixel values fall under m_InputImageMinimum and + * m_InputImageMaximum. Used in GetIndex method. false by default */ + bool m_ClipBinsAtEnds; + + /** Input image minimum */ + PixelValueType m_InputImageMinimum; + + /** Input image maximum */ + PixelValueType m_InputImageMaximum; +}; + +} // End namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbGreyLevelCooccurrenceIndexedList.txx" +#endif + +#endif diff -Nru otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.txx otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.txx --- otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.txx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.txx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,329 @@ +/*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ + + +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. + + +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. + +=========================================================================*/ + +#ifndef __otbGreyLevelCooccurrenceIndexedList_txx +#define __otbGreyLevelCooccurrenceIndexedList_txx + +#include "otbGreyLevelCooccurrenceIndexedList.h" + +namespace otb +{ +template +GreyLevelCooccurrenceIndexedList:: +GreyLevelCooccurrenceIndexedList(): +m_Size(), +m_Symmetry(true), +m_TotalFrequency(0), +m_ClipBinsAtEnds(true), +m_InputImageMinimum(0), +m_InputImageMaximum(255) +{ + +} + +template +void +GreyLevelCooccurrenceIndexedList:: +Initialize(const unsigned int nbins, const PixelValueType min, + const PixelValueType max, const bool symmetry) +{ + PixelPairType lowerBound; + PixelPairType upperBound; + + m_Size.Fill(nbins); + m_InputImageMinimum = min; + m_InputImageMaximum = max; + lowerBound.Fill(min); + upperBound.Fill(max+1); + + m_Symmetry = symmetry; + m_LookupArray = LookupArrayType(m_Size[0] * m_Size[1]); + m_LookupArray.Fill(-1); + m_TotalFrequency = 0; + + // adjust the sizes of min max value containers + unsigned int dim; + m_Min.resize( PixelPairSize ); + for ( dim = 0; dim < PixelPairSize; dim++ ) + { + m_Min[dim].resize(m_Size[dim]); + } + + m_Max.resize( PixelPairSize ); + for ( dim = 0; dim < PixelPairSize; dim++ ) + { + m_Max[dim].resize(m_Size[dim]); + } + + float interval; + for ( unsigned int i = 0; i < PixelPairSize; i++ ) + { + if ( m_Size[i] > 0 ) + { + interval = static_cast( upperBound[i] - lowerBound[i] ) + / static_cast< PixelValueType >( m_Size[i] ); + + // Set the min vector and max vector + for ( unsigned int j = 0; j < static_cast< unsigned int >( m_Size[i] - 1 ); j++ ) + { + this->SetBinMin( i, j, (PixelValueType)( lowerBound[i] + + ( (float)j * interval ) ) ); + this->SetBinMax( i, j, (PixelValueType)( lowerBound[i] + + ( ( (float)j + 1 ) * interval ) ) ); + } + this->SetBinMin( i, m_Size[i] - 1, + (PixelValueType)( lowerBound[i] + + ( ( (float)m_Size[i] - 1 ) * interval ) ) ); + this->SetBinMax( i, m_Size[i] - 1, + (PixelValueType)( upperBound[i] ) ); + } + } +} + +template +void +GreyLevelCooccurrenceIndexedList:: +SetBinMin(const unsigned int dimension, const InstanceIdentifier nbin, + PixelValueType min) +{ + m_Min[dimension][nbin] = min; +} + +template +void +GreyLevelCooccurrenceIndexedList:: +SetBinMax(const unsigned int dimension, const InstanceIdentifier nbin, + PixelValueType max) +{ + m_Max[dimension][nbin] = max; +} + +template +bool +GreyLevelCooccurrenceIndexedList:: +GetIndex(const PixelPairType & pixelPair, IndexType & index) const +{ + // now using something similar to binary search to find + // index. + unsigned int dim; + + int begin; + int mid; + int end; + + PixelValueType median; + PixelValueType tempPixelValue; + + for ( dim = 0; dim < PixelPairSize; dim++ ) + { + tempPixelValue = pixelPair[dim]; + begin = 0; + + if ( tempPixelValue < m_Min[dim][begin] ) + { + // one of measurement is below the minimum + // its ok if we extend the bins to infinity.. not ok if we don't + if ( !m_ClipBinsAtEnds ) + { + index[dim] = (IndexValueType)0; + continue; + } + else + { // set an illegal value and return 0 + index[dim] = (IndexValueType)m_Size[dim]; + return false; + } + } + + end = m_Min[dim].size() - 1; + if ( tempPixelValue >= m_Max[dim][end] ) + { + // one of measurement is above the maximum + // its ok if we extend the bins to infinity.. not ok if we don't + // Need to include the last endpoint in the last bin. + if ( !m_ClipBinsAtEnds || tempPixelValue == m_Max[dim][end]) + { + index[dim] = (IndexValueType)m_Size[dim] - 1; + continue; + } + else + { // set an illegal value and return 0 + index[dim] = (IndexValueType)m_Size[dim]; + return false; + } + } + + // Binary search for the bin where this measurement could be + mid = ( end + 1 ) / 2; + median = m_Min[dim][mid]; + + while ( true ) + { + if ( tempPixelValue < median ) + { + end = mid - 1; + } + else if ( tempPixelValue > median ) + { + // test whether it is inside the current bin by comparing to the max of + // this bin. + if ( tempPixelValue < m_Max[dim][mid] + && tempPixelValue >= m_Min[dim][mid] ) + { + index[dim] = mid; + break; + } + // otherwise, continue binary search + begin = mid + 1; + } + else + { + index[dim] = mid; + break; + } + mid = begin + ( end - begin ) / 2; + median = m_Min[dim][mid]; + } // end of while + } // end of for() + return true; +} + +template +void +GreyLevelCooccurrenceIndexedList:: +AddPixelPair(const PixelValueType& pixelvalue1, const PixelValueType& pixelvalue2) +{ + + if ( pixelvalue1 < m_InputImageMinimum + || pixelvalue1 > m_InputImageMaximum ) + { + return; // don't put a pixel in the co-occurrence list if pixelvalue1 + // is out-of-bounds. + } + + if ( pixelvalue2 < m_InputImageMinimum + || pixelvalue2 > m_InputImageMaximum ) + { + return; // don't put a pixel in the co-occurrence list if the pixelvalue2 + // is out-of-bounds. + } + + IndexType index; + PixelPairType ppair( PixelPairSize); + ppair[0] = pixelvalue1; + ppair[1] = pixelvalue2; + + //Get Index of the given pixel pair; + this->GetIndex(ppair, index); + //Add the index and set/update the frequency of the pixel pair. if m_Symmetry + //is true the index is swapped and added to vector again. + this->AddPairToVector(index); + if(m_Symmetry) + { + IndexValueType temp; + temp = index[0]; + index[0] = index[1]; + index[1] = temp; + this->AddPairToVector(index); + } +} + +template +typename GreyLevelCooccurrenceIndexedList::RelativeFrequencyType +GreyLevelCooccurrenceIndexedList:: +GetFrequency(IndexValueType i, IndexValueType j) +{ + double frequency = 0; + InstanceIdentifier instanceId = i * m_Size[0] + j; + if (instanceId < m_LookupArray.size()) + { + int findex = m_LookupArray[instanceId]; + if(findex > -1 ) + frequency = m_Vector[findex].second / m_TotalFrequency; + } + return frequency; +} + +template +typename GreyLevelCooccurrenceIndexedList::RelativeFrequencyType +GreyLevelCooccurrenceIndexedList:: +GetFrequency(IndexValueType i, IndexValueType j, const VectorType& vect) const +{ + double frequency = 0; + InstanceIdentifier instanceId = i * m_Size[0] + j; + if (instanceId < m_LookupArray.size()) + { + int findex = m_LookupArray[instanceId]; + if(findex > -1 ) + frequency = vect[findex].second; + } + return frequency; +} + +template +typename GreyLevelCooccurrenceIndexedList::VectorType +GreyLevelCooccurrenceIndexedList +::GetVector() +{ + return m_Vector; +} + +template +void +GreyLevelCooccurrenceIndexedList +::AddPairToVector(IndexType index) +{ + InstanceIdentifier instanceId = 0; + instanceId = index[1] * m_Size[0] + index[0]; + int vindex = m_LookupArray[instanceId]; + if( vindex < 0) + { + m_LookupArray[instanceId] = m_Vector.size(); + + CooccurrencePairType cooccur; + cooccur = std::make_pair(index,1); + m_Vector.push_back(cooccur); + } + else + { + m_Vector[vindex].second++; + } + m_TotalFrequency = m_TotalFrequency + 1; +} + +template +void +GreyLevelCooccurrenceIndexedList +::PrintSelf(std::ostream & os, itk::Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "Symmetry: " << this->m_Symmetry << std::endl; + os << indent << "TotalFrequency: " << this->m_TotalFrequency << std::endl; + os << indent << "Size: " << m_Size; + os << indent << "CooccurrenceIndexedList: " << std::endl; + typename VectorType::const_iterator it; + for (it = m_Vector.begin(); it != m_Vector.end(); ++it) + { + std::cerr << "index=" << (*it).first << ", frequency=" << (*it).second << std::endl; + } + std::cerr << std::endl; +} + +} //end namespace otb + +#endif diff -Nru otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h --- otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -18,6 +18,8 @@ #ifndef __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_h #define __otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator_h +#include "vcl_deprecated_header.h" + #include "itkHistogram.h" #include "itkMacro.h" diff -Nru otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx --- otb-4.0.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -20,6 +20,7 @@ #include "itkNumericTraits.h" #include "vnl/vnl_math.h" +#include namespace otb { diff -Nru otb-4.0.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.h otb-4.2.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.h --- otb-4.0.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -18,10 +18,10 @@ #ifndef __otbHaralickTexturesImageFunction_h #define __otbHaralickTexturesImageFunction_h +#include "otbGreyLevelCooccurrenceIndexedList.h" +#include "itkImageToImageFilter.h" #include "itkImageFunction.h" #include "itkFixedArray.h" -#include "itkScalarImageToCooccurrenceMatrixFilter.h" -#include "itkHistogramToTextureFeaturesFilter.h" namespace otb { @@ -29,9 +29,14 @@ * \class HaralickTexturesImageFunction * \brief Compute the 8 Haralick texture indices on the neighborhood of the point * - * This class computes the 8 Haralick texture indices on the neighborhood of the point - * (where \f$ g(i, j) \f$ is the element in - * cell i, j of a normalized GLCM): + * To improve the speed of computation, a variant of Grey Level Co-occurrence + * Matrix(GLCM) called Grey Level Co-occurrence Indexed List (GLCIL) is + * used. Given below is the mathematical explanation on the computation of each + * textures. Here $ g(i, j) $ is the frequency of element in the GLCIL whose + * index is i, j. GLCIL stores a pair of frequency of two pixels from the given + * offset and the cell index (i, j) of the pixel in the neighborhood + * window. :(where each element in GLCIL is a pair of pixel index and it's + * frequency, $ g(i, j) $ is the frequency value of the pair having index is i, j). * * "Energy" \f$ = f_1 = \sum_{i, j}g(i, j)^2 \f$ * @@ -56,15 +61,30 @@ * * \f$ \sigma = \f$ (weighted pixel variance) \f$ = \sum_{i, j}(i - \mu)^2 \cdot g(i, j) = * \sum_{i, j}(j - \mu)^2 \cdot g(i, j) \f$ (due to matrix summetry) - * This class is templated over the input image type and the - * coordinate representation type (e.g. float or double). * - * \sa otb::MaskedScalarImageToGreyLevelCooccurrenceMatrixGenerator - * \sa itk::HistogramToTextureFeaturesFilter + * Print references: + * + * Haralick, R.M., K. Shanmugam and I. Dinstein. 1973. Textural Features for + * Image Classification. IEEE Transactions on Systems, Man and Cybernetics. + * SMC-3(6):610-620. + * + * David A. Clausi and Yongping Zhao. 2002. Rapid extraction of image texture by + * co-occurrence using a hybrid data structure. Comput. Geosci. 28, 6 (July + * 2002), 763-774. DOI=10.1016/S0098-3004(01)00108-X + * http://dx.doi.org/10.1016/S0098-3004(01)00108-X + * + * de O.Bastos, L.; Liatsis, P.; Conci, A., Automatic texture segmentation based + * on k-means clustering and efficient calculation of co-occurrence + * features. Systems, Signals and Image Processing, 2008. IWSSIP 2008. 15th + * International Conference on , vol., no., pp.141,144, 25-28 June 2008 + * doi: 10.1109/IWSSIP.2008.4604387 + * + * \sa otb::GreyLevelCo-occurrenceIndexedList * * \ingroup ImageFunctions */ + template class ITK_EXPORT HaralickTexturesImageFunction : public itk::ImageFunction< TInputImage, @@ -99,27 +119,23 @@ typedef typename InputImageType::Pointer InputImagePointerType; typedef typename InputImageType::PixelType InputPixelType; typedef typename InputImageType::RegionType InputRegionType; + typedef typename InputImageType::OffsetType OffsetType; typedef typename InputRegionType::SizeType SizeType; - // Textures tools - /** Co-occurence matrix and textures calculator */ - typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter - CoocurrenceMatrixGeneratorType; - typedef typename CoocurrenceMatrixGeneratorType - ::Pointer CoocurrenceMatrixGeneratorPointerType; - typedef typename CoocurrenceMatrixGeneratorType - ::OffsetType OffsetType; - typedef typename CoocurrenceMatrixGeneratorType - ::HistogramType HistogramType; - typedef itk::Statistics::HistogramToTextureFeaturesFilter - TextureCoefficientsCalculatorType; - typedef typename TextureCoefficientsCalculatorType - ::Pointer TextureCoefficientsCalculatorPointerType; - // Output typedef support typedef typename Superclass::OutputType OutputType; typedef typename OutputType::ValueType ScalarRealType; + // Textures tools + typedef GreyLevelCooccurrenceIndexedList< InputPixelType > CooccurrenceIndexedListType; + typedef typename CooccurrenceIndexedListType::Pointer CooccurrenceIndexedListPointerType; + typedef typename CooccurrenceIndexedListType::ConstPointer CooccurrenceIndexedListConstPointerType; + typedef typename CooccurrenceIndexedListType::IndexType CooccurrenceIndexType; + typedef typename CooccurrenceIndexedListType::PixelValueType PixelValueType; + typedef typename CooccurrenceIndexedListType::RelativeFrequencyType RelativeFrequencyType; + typedef typename CooccurrenceIndexedListType::VectorType VectorType; + typedef typename VectorType::iterator VectorIteratorType; + typedef typename VectorType::const_iterator VectorConstIteratorType; // Coord rep typedef TCoordRep CoordRepType; @@ -154,7 +170,7 @@ * Get the radius of the neighborhood over which the * statistics are evaluated */ - itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int ); + itkGetConstReferenceMacro( NeighborhoodRadius, unsigned int ); /** Set the offset for co-occurence computation */ itkSetMacro(Offset, OffsetType); @@ -162,10 +178,10 @@ /** Get the offset for co-occurence computation */ itkGetMacro(Offset, OffsetType); - /** Set the number of bin per axis for histogram generation */ + /** Set the number of bin per axis */ itkSetMacro(NumberOfBinsPerAxis, unsigned int); - /** Get the number of bin per axis for histogram generation */ + /** Get the number of bin per axis */ itkGetMacro(NumberOfBinsPerAxis, unsigned int); /** Set the input image minimum */ @@ -195,7 +211,7 @@ /** Offset for co-occurences generation */ OffsetType m_Offset; - /** Number of bins per axis for histogram generation */ + /** Number of bins per axis */ unsigned int m_NumberOfBinsPerAxis; /** Input image minimum */ @@ -203,6 +219,10 @@ /** Input image maximum */ InputPixelType m_InputImageMaximum; + + //TODO: should we use constexpr? only c++11 and problem for msvc + inline double GetPixelValueTolerance() const {return 0.0001; } + }; } // namespace otb @@ -212,4 +232,3 @@ #endif #endif - diff -Nru otb-4.0.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx otb-4.2.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx --- otb-4.0.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbHaralickTexturesImageFunction.txx 2014-09-03 08:29:34.000000000 +0000 @@ -24,6 +24,7 @@ #include "itkNumericTraits.h" #include "itkMacro.h" #include +#include namespace otb { @@ -38,7 +39,7 @@ m_Offset(), m_NumberOfBinsPerAxis(8), m_InputImageMinimum(0), - m_InputImageMaximum(256) + m_InputImageMaximum(255) {} template @@ -77,24 +78,18 @@ return textures; } - + const double log2 = vcl_log(2.0); // Retrieve the input pointer InputImagePointerType inputPtr = const_cast (this->GetInputImage()); // Compute the region on which co-occurence will be estimated - typename InputRegionType::IndexType inputIndex, inputIndexWithTwiceOffset; - typename InputRegionType::SizeType inputSize, inputSizeWithTwiceOffset; + typename InputRegionType::IndexType inputIndex; + typename InputRegionType::SizeType inputSize; - for(unsigned int dim = 0; dimGetRequestedRegion()); - InputRegionType inputRegionWithTwiceOffset; - inputRegionWithTwiceOffset.SetIndex(inputIndexWithTwiceOffset); - inputRegionWithTwiceOffset.SetSize(inputSizeWithTwiceOffset); - inputRegionWithTwiceOffset.Crop(inputPtr->GetRequestedRegion()); - - - /*********************************************************************************/ - //Local copy of the input image around the processed pixel index - InputImagePointerType localInputImage = InputImageType::New(); - localInputImage->SetRegions(inputRegionWithTwiceOffset); - localInputImage->Allocate(); - typedef itk::ImageRegionIteratorWithIndex ImageRegionIteratorType; - ImageRegionIteratorType itInputPtr(inputPtr, inputRegionWithTwiceOffset); - ImageRegionIteratorType itLocalInputImage(localInputImage, inputRegionWithTwiceOffset); - for (itInputPtr.GoToBegin(), itLocalInputImage.GoToBegin(); !itInputPtr.IsAtEnd(); ++itInputPtr, ++itLocalInputImage) - { - itLocalInputImage.Set(itInputPtr.Get()); - } - /*********************************************************************************/ - - // Build the maskImage corresponding to inputRegion included in inputRegionWithTwiceOffset - InputImagePointerType maskImage = InputImageType::New(); - maskImage->SetRegions(inputRegionWithTwiceOffset); - maskImage->Allocate(); - maskImage->FillBuffer(0); - - ImageRegionIteratorType itMask(maskImage, inputRegion); - for (itMask.GoToBegin(); !itMask.IsAtEnd(); ++itMask) - { - itMask.Set(1); - } - - // Build the co-occurence matrix generator - CoocurrenceMatrixGeneratorPointerType coOccurenceMatrixGenerator = CoocurrenceMatrixGeneratorType::New(); - coOccurenceMatrixGenerator->SetInput(localInputImage); - coOccurenceMatrixGenerator->SetOffset(m_Offset); - coOccurenceMatrixGenerator->SetNumberOfBinsPerAxis(m_NumberOfBinsPerAxis); - coOccurenceMatrixGenerator->SetPixelValueMinMax(m_InputImageMinimum, m_InputImageMaximum); - coOccurenceMatrixGenerator->SetMaskImage(maskImage); - coOccurenceMatrixGenerator->SetInsidePixelValue(1); - coOccurenceMatrixGenerator->Update(); - - // Build the texture calculator - TextureCoefficientsCalculatorPointerType texturesCalculator = TextureCoefficientsCalculatorType::New(); - - // Compute textures indices - texturesCalculator->SetInput(coOccurenceMatrixGenerator->GetOutput()); - texturesCalculator->Update(); - - // Fill the output vector - textures[0]=texturesCalculator->GetEnergy(); - textures[1]=texturesCalculator->GetEntropy(); - textures[2]=texturesCalculator->GetCorrelation(); - textures[3]=texturesCalculator->GetInverseDifferenceMoment(); - textures[4]=texturesCalculator->GetInertia(); - textures[5]=texturesCalculator->GetClusterShade(); - textures[6]=texturesCalculator->GetClusterProminence(); - textures[7]=texturesCalculator->GetHaralickCorrelation(); + CooccurrenceIndexedListPointerType GLCIList = CooccurrenceIndexedListType::New(); + GLCIList->Initialize(m_NumberOfBinsPerAxis, m_InputImageMinimum, m_InputImageMaximum); + + // Next, find the minimum radius that encloses all the offsets. + unsigned int minRadius = 0; + for ( unsigned int i = 0; i < m_Offset.GetOffsetDimension(); i++ ) + { + unsigned int distance = vcl_abs(m_Offset[i]); + if ( distance > minRadius ) + { + minRadius = distance; + } + } + SizeType radius; + radius.Fill(minRadius); + + + typedef itk::ConstNeighborhoodIterator< InputImageType > NeighborhoodIteratorType; + NeighborhoodIteratorType neighborIt; + neighborIt = NeighborhoodIteratorType(radius, inputPtr, inputRegion); + for ( neighborIt.GoToBegin(); !neighborIt.IsAtEnd(); ++neighborIt ) + { + const InputPixelType centerPixelIntensity = neighborIt.GetCenterPixel(); + bool pixelInBounds; + const InputPixelType pixelIntensity = neighborIt.GetPixel(m_Offset, pixelInBounds); + if ( !pixelInBounds ) + { + continue; // don't put a pixel in the value if it's out-of-bounds. + } + GLCIList->AddPixelPair(centerPixelIntensity, pixelIntensity); + } + + + double pixelMean = 0.; + double marginalMean; + double marginalDevSquared = 0.; + double pixelVariance = 0.; + + //Create and Intialize marginalSums + std::vector marginalSums(m_NumberOfBinsPerAxis, 0); + + //get co-occurrence vector and totalfrequency + VectorType glcVector = GLCIList->GetVector(); + double totalFrequency = static_cast (GLCIList->GetTotalFrequency()); + + //Normalize the co-occurrence indexed list and compute mean, marginalSum + typename VectorType::iterator it = glcVector.begin(); + while( it != glcVector.end()) + { + double frequency = (*it).second / totalFrequency; + CooccurrenceIndexType index = (*it).first; + pixelMean += index[0] * frequency; + marginalSums[index[0]] += frequency; + ++it; + } + + /* Now get the mean and deviaton of the marginal sums. + Compute incremental mean and SD, a la Knuth, "The Art of Computer + Programming, Volume 2: Seminumerical Algorithms", section 4.2.2. + Compute mean and standard deviation using the recurrence relation: + M(1) = x(1), M(k) = M(k-1) + (x(k) - M(k-1) ) / k + S(1) = 0, S(k) = S(k-1) + (x(k) - M(k-1)) * (x(k) - M(k)) + for 2 <= k <= n, then + sigma = vcl_sqrt(S(n) / n) (or divide by n-1 for sample SD instead of + population SD). + */ + std::vector::const_iterator msIt = marginalSums.begin(); + marginalMean = *msIt; + //Increment iterator to start with index 1 + ++msIt; + for(int k= 2; msIt != marginalSums.end(); ++k, ++msIt) + { + double M_k_minus_1 = marginalMean; + double S_k_minus_1 = marginalDevSquared; + double x_k = *msIt; + double M_k = M_k_minus_1 + ( x_k - M_k_minus_1 ) / k; + double S_k = S_k_minus_1 + ( x_k - M_k_minus_1 ) * ( x_k - M_k ); + marginalMean = M_k; + marginalDevSquared = S_k; + } + marginalDevSquared = marginalDevSquared / m_NumberOfBinsPerAxis; + + VectorConstIteratorType constVectorIt; + constVectorIt = glcVector.begin(); + while( constVectorIt != glcVector.end()) + { + RelativeFrequencyType frequency = (*constVectorIt).second / totalFrequency; + CooccurrenceIndexType index = (*constVectorIt).first; + pixelVariance += ( index[0] - pixelMean ) * ( index[0] - pixelMean ) * frequency; + ++constVectorIt; + } + + double pixelVarianceSquared = pixelVariance * pixelVariance; + // Variance is only used in correlation. If variance is 0, then (index[0] - pixelMean) * (index[1] - pixelMean) + // should be zero as well. In this case, set the variance to 1. in order to + // avoid NaN correlation. + if(pixelVarianceSquared < GetPixelValueTolerance()) + { + pixelVarianceSquared = 1.; + } + + //Compute textures + constVectorIt = glcVector.begin(); + while( constVectorIt != glcVector.end()) + { + CooccurrenceIndexType index = (*constVectorIt).first; + RelativeFrequencyType frequency = (*constVectorIt).second / totalFrequency; + textures[0] += frequency * frequency; + textures[1] -= ( frequency > GetPixelValueTolerance() ) ? frequency *vcl_log(frequency) / log2:0; + textures[2] += ( ( index[0] - pixelMean ) * ( index[1] - pixelMean ) * frequency ) / pixelVarianceSquared; + textures[3] += frequency / ( 1.0 + ( index[0] - index[1] ) * ( index[0] - index[1] ) ); + textures[4] += ( index[0] - index[1] ) * ( index[0] - index[1] ) * frequency; + textures[5] += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 3 ) * frequency; + textures[6] += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 4 ) * frequency; + textures[7] += index[0] * index[1] * frequency; + ++constVectorIt; + } + textures[7] = (fabs(marginalDevSquared) > 1E-8) ? ( textures[7] - marginalMean * marginalMean ) / marginalDevSquared : 0; // Return result return textures; diff -Nru otb-4.0.0/Code/FeatureExtraction/otbHuPathFunction.txx otb-4.2.0/Code/FeatureExtraction/otbHuPathFunction.txx --- otb-4.0.0/Code/FeatureExtraction/otbHuPathFunction.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbHuPathFunction.txx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ template typename HuPathFunction::RealType HuPathFunction -::Evaluate(const PathType& path) const +::Evaluate(const PathType& itkNotUsed(path)) const { typedef ComplexMomentPathFunction FunctionType; typedef typename FunctionType::ComplexType ComplexType; diff -Nru otb-4.0.0/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx otb-4.2.0/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -278,6 +278,7 @@ while ((lIterDoG + 1) != m_DoGList->End()) { otbGenericMsgDebugMacro(<< "ImageToSIFTKeyPointSetFilter:: octave: " << octave << " scale: " << lScale); + otbUnusedMacro(octave); // Compute max of DoG MinimumMaximumCalculatorPointerType lMaximumCalculator = MinimumMaximumCalculatorType::New(); lMaximumCalculator->SetImage(lIterDoG.Get()); @@ -561,7 +562,7 @@ ImageToSIFTKeyPointSetFilter ::ComputeKeyPointOrientations(const NeighborhoodIteratorType& currentScale, const unsigned int scale, - const PixelType translation) + const PixelType itkNotUsed(translation)) { // radius of the neighborhood unsigned int radius = 4; @@ -892,8 +893,7 @@ ImageToSIFTKeyPointSetFilter ::PrintSelf(std::ostream& os, itk::Indent indent) const { - typedef typename TOutputPointSet::PointsContainerConstIterator PointsIteratorType; - typedef typename TOutputPointSet::PointDataContainerIterator PointsDataIteratorType; + typedef itk::ProcessObject ProcessObjectType; const OutputPointSetType* output = dynamic_cast(this->ProcessObjectType::GetOutput(0)); diff -Nru otb-4.0.0/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx otb-4.2.0/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx --- otb-4.0.0/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbLineDetectorImageFilterBase.txx 2014-09-03 08:29:34.000000000 +0000 @@ -155,8 +155,6 @@ typename itk::ConstNeighborhoodIterator::OffsetType off; itk::ImageRegionIterator it; itk::ImageRegionIterator itdir; - typedef itk::ImageRegionIterator InputIteratorType; - typedef itk::ImageRegionConstIterator ConstInputIteratorType; // Allocate output typename OutputImageType::Pointer output = this->GetOutput(); @@ -394,7 +392,7 @@ template double LineDetectorImageFilterBase -::ComputeMeasure(std::vector* m1, std::vector* m2, std::vector* m3) +::ComputeMeasure(std::vector* itkNotUsed(m1), std::vector* itkNotUsed(m2), std::vector* itkNotUsed(m3)) { return 0; } diff -Nru otb-4.0.0/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.txx otb-4.2.0/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,6 @@ typedef itk::ConstNeighborhoodIterator NeighborhoodIteratorType; typedef typename NeighborhoodIteratorType::RadiusType RadiusType; typedef typename NeighborhoodIteratorType::OffsetType OffsetType; - typedef itk::ZeroFluxNeumannBoundaryCondition BoundaryConditionType; typedef itk::ImageRegionIterator OutputIteratorType; typedef itk::ImageRegionIterator OutputDirectionIteratorType; typedef itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator BoundaryFacesCalculatorType; diff -Nru otb-4.0.0/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.h otb-4.2.0/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -44,6 +44,8 @@ if (itA.GetCenterPixel() != 0) { typename TInput1::OffsetType offset1, offset2; + offset1.Fill(0); + offset2.Fill(0); int neighborhoodNumber; if (itB.GetCenterPixel() > 0) { diff -Nru otb-4.0.0/Code/FeatureExtraction/otbParallelLinePathListFilter.txx otb-4.2.0/Code/FeatureExtraction/otbParallelLinePathListFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbParallelLinePathListFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbParallelLinePathListFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -212,7 +212,7 @@ template bool ParallelLinePathListFilter -::VerifyMaxDistanceCondition(VertexType v1, VertexType v2, VertexType v3, VertexType v4) +::VerifyMaxDistanceCondition(VertexType v1, VertexType v2, VertexType v3, VertexType itkNotUsed(v4)) { // Compute the direction vector of the first line VertexType vectorDir12; diff -Nru otb-4.0.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.h otb-4.2.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -18,15 +18,81 @@ #ifndef __otbScalarImageToAdvancedTexturesFilter_h #define __otbScalarImageToAdvancedTexturesFilter_h +#include "otbGreyLevelCooccurrenceIndexedList.h" #include "itkImageToImageFilter.h" -#include "itkScalarImageToCooccurrenceMatrixFilter.h" -#include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h" namespace otb { /** * \class ScalarImageToAdvancedTexturesFilter - * \brief TODO + * \brief In this case, 10 advanced texture features will be processed. The 10 + * output image channels are: Mean, Variance, Dissimilarity, Sum Average, Sum + * Variance, Sum Entropy, Difference of Entropies, Difference of Variances, IC1 + * and IC2. They are provided in this exact order in the output image. The + * textures are computed over a sliding window with user defined radius. + * + * To improve the speed of computation, a variant of Grey Level Co-occurrence + * Matrix(GLCM) called Grey Level Co-occurrence Indexed List (GLCIL) is + * used. Given below is the mathematical explanation on the computation of each + * textures. Here $ g(i, j) $ is the frequency of element in the GLCIL whose + * index is i, j. GLCIL stores a pair of frequency of two pixels from the given + * offset and the cell index (i, j) of the pixel in the neighborhood + * window. :(where each element in GLCIL is a pair of pixel index and it's + * frequency, $ g(i, j) $ is the frequency value of the pair having index is i, j). + * + * "Mean" \f$ = \sum_{i, j}i g(i, j) \f$ + * + * "Sum of squares: Variance" \f$ = f_4 = \sum_{i, j}(i - \mu)^2 g(i, j) \f$ + * + * "Dissimilarity" \f$ = f_5 = \sum_{i, j}(i - j) g(i, j)^2 \f$ + * + * "Sum average" \f$ = f_6 = -\sum_{i}i g_{x+y}(i) \f$ + * + * "Sum Variance" \f$ = f_7 = \sum_{i}(i - f_8)^2 g_{x+y}(i) \f$ + * + * "Sum Entropy" \f$= f_8 = -\sum_{i}g_{x+y}(i) log (g_{x+y}(i)) \f$ + * + * "Difference variance" \f$ = f_10 = variance of g_{x-y}(i) \f$ + * + * "Difference entropy" \f$ = f_11 = -\sum_{i}g_{x-y}(i) log (g_{x-y}(i)) \f$ + * + * "Information Measures of Correlation IC1" \f$ = f_12 = \frac{f_9 - HXY1}{H} \f$ + * + * "Information Measures of Correlation IC2" \f$ = f_13 = \sqrt{1 - \exp{-2}|HXY2 - f_9|} \f$ + * + * Above, \f$ \mu = \f$ (weighted pixel average) \f$ = \sum_{i, j}i \cdot g(i, j) = + * \sum_{i, j}j \cdot g(i, j) \f$ (due to matrix summetry), and + * + * \f$ \g_{x+y}(k) = \sum_{i}\sum_{j}g(i)\f$ where \f$ i+j=k \f$ and \f$ k = 2, 3, .., 2N_[g} \f$ and + * + * \f$ \g_{x-y}(k) = \sum_{i}\sum_{j}g(i)\f$ where \f$ i-j=k \f$ and \f$ k = 0, 1, .., N_[g}-1 \f$ + * + * Print references: + * + * Haralick, R.M., K. Shanmugam and I. Dinstein. 1973. Textural Features for + * Image Classification. IEEE Transactions on Systems, Man and Cybernetics. + * SMC-3(6):610-620. + * + * David A. Clausi and Yongping Zhao. 2002. Rapid extraction of image texture by + * co-occurrence using a hybrid data structure. Comput. Geosci. 28, 6 (July + * 2002), 763-774. DOI=10.1016/S0098-3004(01)00108-X + * http://dx.doi.org/10.1016/S0098-3004(01)00108-X + * + * de O.Bastos, L.; Liatsis, P.; Conci, A., Automatic texture segmentation based + * on k-means clustering and efficient calculation of co-occurrence + * features. Systems, Signals and Image Processing, 2008. IWSSIP 2008. 15th + * International Conference on , vol., no., pp.141,144, 25-28 June 2008 + * doi: 10.1109/IWSSIP.2008.4604387 + * + * Neighborhood size can be set using the SetRadius() method. Offset for co-occurence estimation + * is set using the SetOffset() method. + * + * \sa otb::ScalarImageToCooccurrenceIndexedList + * \sa otb::ScalarImageToTexturesFiler + * \sa otb::ScalarImageToHigherOrderTexturesFilter + * \ingroup Streamed + * \ingroup Threaded + * */ template class ScalarImageToAdvancedTexturesFilter : public itk::ImageToImageFilter @@ -50,19 +116,22 @@ typedef typename InputImageType::Pointer InputImagePointerType; typedef typename InputImageType::PixelType InputPixelType; typedef typename InputImageType::RegionType InputRegionType; + typedef typename InputImageType::OffsetType OffsetType; typedef typename InputRegionType::SizeType SizeType; typedef TOutputImage OutputImageType; typedef typename OutputImageType::Pointer OutputImagePointerType; typedef typename OutputImageType::RegionType OutputRegionType; - /** Co-occurence matrix and textures calculator */ - typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter CoocurrenceMatrixGeneratorType; - typedef typename CoocurrenceMatrixGeneratorType::Pointer CoocurrenceMatrixGeneratorPointerType; - typedef typename CoocurrenceMatrixGeneratorType::OffsetType OffsetType; - typedef typename CoocurrenceMatrixGeneratorType::HistogramType HistogramType; - typedef GreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator - TextureCoefficientsCalculatorType; - typedef typename TextureCoefficientsCalculatorType::Pointer TextureCoefficientsCalculatorPointerType; + typedef GreyLevelCooccurrenceIndexedList< InputPixelType > CooccurrenceIndexedListType; + typedef typename CooccurrenceIndexedListType::Pointer CooccurrenceIndexedListPointerType; + typedef typename CooccurrenceIndexedListType::ConstPointer CooccurrenceIndexedListConstPointerType; + typedef typename CooccurrenceIndexedListType::IndexType CooccurrenceIndexType; + typedef typename CooccurrenceIndexedListType::PixelValueType PixelValueType; + typedef typename CooccurrenceIndexedListType::RelativeFrequencyType RelativeFrequencyType; + typedef typename CooccurrenceIndexedListType::VectorType VectorType; + + typedef typename VectorType::iterator VectorIteratorType; + typedef typename VectorType::const_iterator VectorConstIteratorType; /** Set the radius of the window on which textures will be computed */ itkSetMacro(Radius, SizeType); @@ -75,10 +144,10 @@ /** Get the offset for co-occurence computation */ itkGetMacro(Offset, OffsetType); - /** Set the number of bin per axis for histogram generation */ + /** Set the number of bin per axis */ itkSetMacro(NumberOfBinsPerAxis, unsigned int); - /** Get the number of bin per axis for histogram generation */ + /** Get the number of bin per axis*/ itkGetMacro(NumberOfBinsPerAxis, unsigned int); /** Set the input image minimum */ @@ -99,6 +168,9 @@ /** Get the variance output image */ OutputImageType * GetVarianceOutput(); + /** Get the dissimilarity output image */ + OutputImageType * GetDissimilarityOutput(); + /** Get the sum average output image */ OutputImageType * GetSumAverageOutput(); @@ -127,6 +199,8 @@ ~ScalarImageToAdvancedTexturesFilter(); /** Generate the input requested region */ virtual void GenerateInputRequestedRegion(); + /** Before Parallel textures extraction */ + virtual void BeforeThreadedGenerateData(); /** Parallel textures extraction */ virtual void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId); @@ -143,7 +217,10 @@ /** Offset for co-occurence */ OffsetType m_Offset; - /** Number of bins per axis for histogram generation */ + /** Radius of the neighborhood iterator which is minumum of m_Radius */ + SizeType m_NeighborhoodRadius; + + /** Number of bins per axis */ unsigned int m_NumberOfBinsPerAxis; /** Input image minimum */ @@ -151,6 +228,7 @@ /** Input image maximum */ InputPixelType m_InputImageMaximum; + }; } // End namespace otb diff -Nru otb-4.0.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx otb-4.2.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -20,23 +20,28 @@ #include "otbScalarImageToAdvancedTexturesFilter.h" #include "itkImageRegionIteratorWithIndex.h" +#include "itkConstNeighborhoodIterator.h" #include "itkImageRegionIterator.h" #include "itkProgressReporter.h" +#include "itkNumericTraits.h" +#include namespace otb { template ScalarImageToAdvancedTexturesFilter -::ScalarImageToAdvancedTexturesFilter() : m_Radius(), - m_Offset(), - m_NumberOfBinsPerAxis(8), - m_InputImageMinimum(0), - m_InputImageMaximum(256) +::ScalarImageToAdvancedTexturesFilter() +: m_Radius() +, m_Offset() +, m_NeighborhoodRadius() +, m_NumberOfBinsPerAxis(8) +, m_InputImageMinimum(0) +, m_InputImageMaximum(255) { - // There are 9 outputs corresponding to the 8 textures indices - this->SetNumberOfRequiredOutputs(9); + // There are 10 outputs corresponding to the 9 textures indices + this->SetNumberOfRequiredOutputs(10); - // Create the 9 outputs + // Create the 10 outputs this->SetNthOutput(0, OutputImageType::New()); this->SetNthOutput(1, OutputImageType::New()); this->SetNthOutput(2, OutputImageType::New()); @@ -46,18 +51,18 @@ this->SetNthOutput(6, OutputImageType::New()); this->SetNthOutput(7, OutputImageType::New()); this->SetNthOutput(8, OutputImageType::New()); + this->SetNthOutput(9, OutputImageType::New()); } template ScalarImageToAdvancedTexturesFilter ::~ScalarImageToAdvancedTexturesFilter() {} - template typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetVarianceOutput() +::GetMeanOutput() { if (this->GetNumberOfOutputs() < 1) { @@ -70,7 +75,7 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetSumAverageOutput() +::GetVarianceOutput() { if (this->GetNumberOfOutputs() < 2) { @@ -83,7 +88,7 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetSumVarianceOutput() +::GetDissimilarityOutput() { if (this->GetNumberOfOutputs() < 3) { @@ -96,7 +101,7 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetSumEntropyOutput() +::GetSumAverageOutput() { if (this->GetNumberOfOutputs() < 4) { @@ -109,7 +114,7 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetDifferenceEntropyOutput() +::GetSumVarianceOutput() { if (this->GetNumberOfOutputs() < 5) { @@ -122,7 +127,7 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetDifferenceVarianceOutput() +::GetSumEntropyOutput() { if (this->GetNumberOfOutputs() < 6) { @@ -135,7 +140,7 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetIC1Output() +::GetDifferenceEntropyOutput() { if (this->GetNumberOfOutputs() < 7) { @@ -148,7 +153,7 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetIC2Output() +::GetDifferenceVarianceOutput() { if (this->GetNumberOfOutputs() < 8) { @@ -161,9 +166,9 @@ typename ScalarImageToAdvancedTexturesFilter ::OutputImageType * ScalarImageToAdvancedTexturesFilter -::GetMeanOutput() +::GetIC1Output() { - if (this->GetNumberOfOutputs() < 1) + if (this->GetNumberOfOutputs() < 9) { return 0; } @@ -171,6 +176,19 @@ } template +typename ScalarImageToAdvancedTexturesFilter +::OutputImageType * +ScalarImageToAdvancedTexturesFilter +::GetIC2Output() +{ + if (this->GetNumberOfOutputs() < 10) + { + return 0; + } + return static_cast(this->GetOutput(9)); +} + +template void ScalarImageToAdvancedTexturesFilter ::GenerateInputRequestedRegion() @@ -233,23 +251,42 @@ template void ScalarImageToAdvancedTexturesFilter +::BeforeThreadedGenerateData() +{ + unsigned int minRadius = 0; + for ( unsigned int i = 0; i < m_Offset.GetOffsetDimension(); i++ ) + { + unsigned int distance = vcl_abs(m_Offset[i]); + if ( distance > minRadius ) + { + minRadius = distance; + } + } + m_NeighborhoodRadius.Fill(minRadius); +} + +template +void +ScalarImageToAdvancedTexturesFilter ::ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId) { // Retrieve the input and output pointers - InputImagePointerType inputPtr = const_cast(this->GetInput()); - OutputImagePointerType meanPtr = this->GetMeanOutput(); - OutputImagePointerType variancePtr = this->GetVarianceOutput(); - OutputImagePointerType sumAveragePtr = this->GetSumAverageOutput(); - OutputImagePointerType sumVariancePtr = this->GetSumVarianceOutput(); - OutputImagePointerType sumEntropytPtr = this->GetSumEntropyOutput(); - OutputImagePointerType differenceEntropyPtr = this->GetDifferenceEntropyOutput(); + InputImagePointerType inputPtr = const_cast(this->GetInput()); + OutputImagePointerType meanPtr = this->GetMeanOutput(); + OutputImagePointerType variancePtr = this->GetVarianceOutput(); + OutputImagePointerType dissimilarityPtr = this->GetDissimilarityOutput(); + OutputImagePointerType sumAveragePtr = this->GetSumAverageOutput(); + OutputImagePointerType sumVariancePtr = this->GetSumVarianceOutput(); + OutputImagePointerType sumEntropytPtr = this->GetSumEntropyOutput(); + OutputImagePointerType differenceEntropyPtr = this->GetDifferenceEntropyOutput(); OutputImagePointerType differenceVariancePtr = this->GetDifferenceVarianceOutput(); - OutputImagePointerType ic1Ptr = this->GetIC1Output(); - OutputImagePointerType ic2Ptr = this->GetIC2Output(); + OutputImagePointerType ic1Ptr = this->GetIC1Output(); + OutputImagePointerType ic2Ptr = this->GetIC2Output(); // Build output iterators itk::ImageRegionIteratorWithIndex varianceIt(variancePtr, outputRegionForThread); itk::ImageRegionIterator meanIt(meanPtr, outputRegionForThread); + itk::ImageRegionIterator dissimilarityIt(dissimilarityPtr, outputRegionForThread); itk::ImageRegionIterator sumAverageIt(sumAveragePtr, outputRegionForThread); itk::ImageRegionIterator sumVarianceIt(sumVariancePtr, outputRegionForThread); itk::ImageRegionIterator sumEntropytIt(sumEntropytPtr, outputRegionForThread); @@ -261,6 +298,7 @@ // Go to begin varianceIt.GoToBegin(); meanIt.GoToBegin(); + dissimilarityIt.GoToBegin(); sumAverageIt.GoToBegin(); sumVarianceIt.GoToBegin(); sumEntropytIt.GoToBegin(); @@ -269,15 +307,9 @@ ic1It.GoToBegin(); ic2It.GoToBegin(); - - // Build the co-occurence matrix generator - CoocurrenceMatrixGeneratorPointerType coOccurenceMatrixGenerator = CoocurrenceMatrixGeneratorType::New(); - coOccurenceMatrixGenerator->SetOffset(m_Offset); - coOccurenceMatrixGenerator->SetNumberOfBinsPerAxis(m_NumberOfBinsPerAxis); - coOccurenceMatrixGenerator->SetPixelValueMinMax(m_InputImageMinimum, m_InputImageMaximum); - - // Build the texture calculator - TextureCoefficientsCalculatorPointerType texturesCalculator = TextureCoefficientsCalculatorType::New(); + const double log2 = vcl_log(2.0); + const unsigned int histSize = m_NumberOfBinsPerAxis; + const long unsigned int twiceHistSize = 2 * m_NumberOfBinsPerAxis; // Set-up progress reporting itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); @@ -285,6 +317,7 @@ // Iterate on outputs to compute textures while (!varianceIt.IsAtEnd() && !meanIt.IsAtEnd() + && !dissimilarityIt.IsAtEnd() && !sumAverageIt.IsAtEnd() && !sumVarianceIt.IsAtEnd() && !sumEntropytIt.IsAtEnd() @@ -294,20 +327,15 @@ && !ic2It.IsAtEnd()) { // Compute the region on which co-occurence will be estimated - typename InputRegionType::IndexType inputIndex, inputIndexWithTwiceOffset; - typename InputRegionType::SizeType inputSize, inputSizeWithTwiceOffset; + typename InputRegionType::IndexType inputIndex; + typename InputRegionType::SizeType inputSize; - // First, apply offset + // First, create an window for neighborhood iterator based on m_Radius + // For example, if xradius and yradius is 2. window size is 5x5 (2 * radius + 1). for (unsigned int dim = 0; dim < InputImageType::ImageDimension; ++dim) { - inputIndex[dim] = std::min( - static_cast(varianceIt.GetIndex()[dim] - m_Radius[dim]), - static_cast(varianceIt.GetIndex()[dim] - m_Radius[dim] + m_Offset[dim]) - ); - inputSize[dim] = 2 * m_Radius[dim] + 1 + std::abs(m_Offset[dim]); - - inputIndexWithTwiceOffset[dim] = static_cast(varianceIt.GetIndex()[dim] - m_Radius[dim] - std::abs(m_Offset[dim])); - inputSizeWithTwiceOffset[dim] = inputSize[dim] + std::abs(m_Offset[dim]); + inputIndex[dim] = varianceIt.GetIndex()[dim] - m_Radius[dim]; + inputSize[dim] = 2 * m_Radius[dim] + 1; } // Build the input region @@ -316,56 +344,164 @@ inputRegion.SetSize(inputSize); inputRegion.Crop(inputPtr->GetRequestedRegion()); - InputRegionType inputRegionWithTwiceOffset; - inputRegionWithTwiceOffset.SetIndex(inputIndexWithTwiceOffset); - inputRegionWithTwiceOffset.SetSize(inputSizeWithTwiceOffset); - inputRegionWithTwiceOffset.Crop(inputPtr->GetRequestedRegion()); - - /*********************************************************************************/ - //Local copy of the input image around the processed pixel *outputIt - InputImagePointerType localInputImage = InputImageType::New(); - localInputImage->SetRegions(inputRegionWithTwiceOffset); - localInputImage->Allocate(); - typedef itk::ImageRegionIteratorWithIndex ImageRegionIteratorType; - ImageRegionIteratorType itInputPtr(inputPtr, inputRegionWithTwiceOffset); - ImageRegionIteratorType itLocalInputImage(localInputImage, inputRegionWithTwiceOffset); - for (itInputPtr.GoToBegin(), itLocalInputImage.GoToBegin(); !itInputPtr.IsAtEnd(); ++itInputPtr, ++itLocalInputImage) + CooccurrenceIndexedListPointerType GLCIList = CooccurrenceIndexedListType::New(); + GLCIList->Initialize(m_NumberOfBinsPerAxis, m_InputImageMinimum, m_InputImageMaximum); + + typedef itk::ConstNeighborhoodIterator< InputImageType > NeighborhoodIteratorType; + NeighborhoodIteratorType neighborIt; + neighborIt = NeighborhoodIteratorType(m_NeighborhoodRadius, inputPtr, inputRegion); + for ( neighborIt.GoToBegin(); !neighborIt.IsAtEnd(); ++neighborIt ) + { + const InputPixelType centerPixelIntensity = neighborIt.GetCenterPixel(); + bool pixelInBounds; + const InputPixelType pixelIntensity = neighborIt.GetPixel(m_Offset, pixelInBounds); + if ( !pixelInBounds ) + { + continue; // don't put a pixel in the co-occurrence list if the value is + // out of bounds + } + GLCIList->AddPixelPair(centerPixelIntensity, pixelIntensity); + } + + PixelValueType m_Mean = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_Variance = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_Dissimilarity = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_SumAverage = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_SumEntropy = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_SumVariance = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_DifferenceEntropy = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_DifferenceVariance = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_IC1 = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType m_IC2 = itk::NumericTraits< PixelValueType >::Zero; + + double Entropy = 0; + + typedef itk::Array DoubleArrayType; + DoubleArrayType hx(histSize); + DoubleArrayType hy(histSize); + DoubleArrayType pdxy(twiceHistSize); + + for(long unsigned int i = 0; i < histSize; i++) { - itLocalInputImage.Set(itInputPtr.Get()); + hx[i] = 0.0; + hy[i] = 0.0; + pdxy[i] = 0.0; } - /*********************************************************************************/ + for(long unsigned int i = histSize; i < twiceHistSize; i++) + { + pdxy[i] = 0.0; + } + + /* hx.Fill(0.0); hy.Fill(0.0); pdxy.Fill(0.0); */ + double hxy1 = 0; + + //get co-occurrence vector and totalfrequency + VectorType glcVector = GLCIList->GetVector(); + double totalFrequency = static_cast (GLCIList->GetTotalFrequency()); + + VectorConstIteratorType constVectorIt; + //Normalize the GreyLevelCooccurrenceListType + //Compute Mean, Entropy (f12), hx, hy, pdxy + constVectorIt = glcVector.begin(); + while( constVectorIt != glcVector.end()) + { + CooccurrenceIndexType index = (*constVectorIt).first; + double frequency = (*constVectorIt).second / totalFrequency; + m_Mean += static_cast(index[0]) * frequency; + Entropy -= (frequency > 0.0001) ? frequency * vcl_log(frequency) / log2 : 0.; + unsigned int i = index[1]; + unsigned int j = index[0]; + hx[j] += frequency; + hy[i] += frequency; + + if( i+j > histSize-1) + { + pdxy[i+j] += frequency; + } + if( i <= j ) + { + pdxy[j-i] += frequency; + } + ++constVectorIt; + } + + //second pass over normalized co-occurrence list to find variance and pipj. + //pipj is needed to calculate f11 + constVectorIt = glcVector.begin(); + while( constVectorIt != glcVector.end()) + { + double frequency = (*constVectorIt).second / totalFrequency; + CooccurrenceIndexType index = (*constVectorIt).first; + unsigned int i = index[1]; + unsigned int j = index[0]; + double index0 = static_cast(index[0]); + m_Variance += ((index0 - m_Mean) * (index0 - m_Mean)) * frequency; + double pipj = hx[j] * hy[i]; + hxy1 -= (pipj > 0.0001) ? frequency * vcl_log(pipj) : 0.; + ++constVectorIt; + } + + //iterate histSize to compute sumEntropy + double PSSquareCumul = 0; + for(long unsigned int k = histSize; k < twiceHistSize; k++) + { + m_SumAverage += k * pdxy[k]; + m_SumEntropy -= (pdxy[k] > 0.0001) ? pdxy[k] * vcl_log(pdxy[k]) / log2 : 0; + PSSquareCumul += k * k * pdxy[k]; + } + m_SumVariance = PSSquareCumul - m_SumAverage * m_SumAverage; - InputImagePointerType maskImage = InputImageType::New(); - maskImage->SetRegions(inputRegionWithTwiceOffset); - maskImage->Allocate(); - maskImage->FillBuffer(0); + double PDSquareCumul = 0; + double PDCumul = 0; + double hxCumul = 0; + double hyCumul = 0; + + for (long unsigned int i = 0; i < histSize; ++i) + { + double pdTmp = pdxy[i]; + PDCumul += i * pdTmp; + m_DifferenceEntropy -= (pdTmp > 0.0001) ? pdTmp * vcl_log(pdTmp) / log2 : 0; + PDSquareCumul += i * i * pdTmp; + + //comput hxCumul and hyCumul + double marginalfreq = hx[i]; + hxCumul += (marginalfreq > 0.0001) ? vcl_log (marginalfreq) * marginalfreq : 0; + + marginalfreq = hy[i]; + hyCumul += (marginalfreq > 0.0001) ? vcl_log (marginalfreq) * marginalfreq : 0; + } + m_DifferenceVariance = PDSquareCumul - PDCumul * PDCumul; - ImageRegionIteratorType itMask(maskImage, inputRegion); - for (itMask.GoToBegin(); !itMask.IsAtEnd(); ++itMask) + /* pipj computed below is totally different from earlier one which was used + * to compute hxy1. */ + double hxy2 = 0; + for(unsigned int i = 0; i < histSize; ++i) { - itMask.Set(1); + for(unsigned int j = 0; j < histSize; ++j) + { + double pipj = hx[j] * hy[i]; + hxy2 -= (pipj > 0.0001) ? pipj * vcl_log(pipj) : 0.; + double frequency = GLCIList->GetFrequency(i,j, glcVector) / totalFrequency; + m_Dissimilarity+= ( static_cast(j) - static_cast(i) ) * (frequency * frequency); + } } - // Compute the co-occurence matrix - coOccurenceMatrixGenerator->SetInput(localInputImage); - coOccurenceMatrixGenerator->SetMaskImage(maskImage); - coOccurenceMatrixGenerator->SetInsidePixelValue(1); - coOccurenceMatrixGenerator->Update(); - - // Compute textures indices - texturesCalculator->SetHistogram(const_cast(coOccurenceMatrixGenerator->GetOutput())); //FIXME const correctness - texturesCalculator->Compute(); + //Information measures of correlation 1 & 2 + m_IC1 = (vcl_abs(std::max (hxCumul, hyCumul)) > 0.0001) ? (Entropy - hxy1) / (std::max (hxCumul, hyCumul)) : 0; + m_IC2 = 1 - vcl_exp (-2. * vcl_abs (hxy2 - Entropy)); + m_IC2 = (m_IC2 >= 0) ? vcl_sqrt (m_IC2) : 0; // Fill outputs - varianceIt.Set(texturesCalculator->GetVariance()); - meanIt.Set(texturesCalculator->GetMean()); - sumAverageIt.Set(texturesCalculator->GetSumAverage()); - sumVarianceIt.Set(texturesCalculator->GetSumVariance()); - sumEntropytIt.Set(texturesCalculator->GetSumEntropy()); - differenceEntropyIt.Set(texturesCalculator->GetDifferenceEntropy()); - differenceVarianceIt.Set(texturesCalculator->GetDifferenceVariance()); - ic1It.Set(texturesCalculator->GetIC1()); - ic2It.Set(texturesCalculator->GetIC2()); + meanIt.Set(m_Mean); + varianceIt.Set(m_Variance); + dissimilarityIt.Set(m_Dissimilarity); + sumAverageIt.Set(m_SumAverage); + sumVarianceIt.Set(m_SumVariance); + sumEntropytIt.Set(m_SumEntropy); + differenceEntropyIt.Set(m_DifferenceEntropy); + differenceVarianceIt.Set(m_DifferenceVariance); + ic1It.Set(m_IC1); + ic2It.Set(m_IC2); // Update progress progress.CompletedPixel(); @@ -373,6 +509,7 @@ // Increment iterators ++varianceIt; ++meanIt; + ++dissimilarityIt; ++sumAverageIt; ++sumVarianceIt; ++sumEntropytIt; diff -Nru otb-4.0.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.h otb-4.2.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -18,8 +18,8 @@ #ifndef __otbScalarImageToPanTexTextureFilter_h #define __otbScalarImageToPanTexTextureFilter_h +#include "otbGreyLevelCooccurrenceIndexedList.h" #include "itkImageToImageFilter.h" -#include "itkScalarImageToCooccurrenceMatrixFilter.h" namespace otb { @@ -37,9 +37,7 @@ * Vol1, NO3. * * - * \sa ScalarImageToGreyLevelCooccurrenceMatrixGenerator - * \sa GreyLevelCooccurrenceMatrixTextureCoefficientsCalculator - * \sa ScalarImageTextureCalculator + * \sa otb::GreyLevelCooccurrenceIndexedList * */ @@ -66,19 +64,23 @@ typedef typename InputImageType::PixelType InputPixelType; typedef typename InputImageType::RegionType InputRegionType; typedef typename InputRegionType::SizeType SizeType; + typedef typename InputImageType::OffsetType OffsetType; + typedef typename std::vector< OffsetType> OffsetListType; typedef TOutputImage OutputImageType; typedef typename OutputImageType::Pointer OutputImagePointerType; typedef typename OutputImageType::RegionType OutputRegionType; - /** Co-occurence matrix and textures calculator */ - typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter CoocurrenceMatrixGeneratorType; - typedef typename CoocurrenceMatrixGeneratorType::Pointer CoocurrenceMatrixGeneratorPointerType; - typedef typename CoocurrenceMatrixGeneratorType::OffsetType OffsetType; - typedef typename std::vector OffsetListType; - typedef typename CoocurrenceMatrixGeneratorType::HistogramType HistogramType; - typedef typename HistogramType::AbsoluteFrequencyType FrequencyType; //FIXME stat framework - typedef typename HistogramType::MeasurementType MeasurementType; - typedef typename HistogramType::Iterator HistogramIterator; + typedef GreyLevelCooccurrenceIndexedList< InputPixelType > CooccurrenceIndexedListType; + typedef typename CooccurrenceIndexedListType::Pointer CooccurrenceIndexedListPointerType; + typedef typename CooccurrenceIndexedListType::ConstPointer CooccurrenceIndexedListConstPointerType; + typedef typename CooccurrenceIndexedListType::IndexType CooccurrenceIndexType; + typedef typename CooccurrenceIndexedListType::PixelValueType PixelValueType; + typedef typename CooccurrenceIndexedListType::RelativeFrequencyType RelativeFrequencyType; + typedef typename CooccurrenceIndexedListType::VectorType VectorType; + + typedef typename VectorType::iterator VectorIteratorType; + typedef typename VectorType::const_iterator VectorConstIteratorType; + /** Set the radius of the window on which textures will be computed */ itkSetMacro(Radius, SizeType); @@ -134,6 +136,7 @@ /** Input image maximum */ InputPixelType m_InputImageMaximum; + }; } // End namespace otb diff -Nru otb-4.0.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx otb-4.2.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -20,17 +20,19 @@ #include "otbScalarImageToPanTexTextureFilter.h" #include "itkImageRegionIteratorWithIndex.h" +#include "itkConstNeighborhoodIterator.h" #include "itkImageRegionIterator.h" #include "itkProgressReporter.h" +#include "itkNumericTraits.h" namespace otb { template ScalarImageToPanTexTextureFilter ::ScalarImageToPanTexTextureFilter() : m_Radius(), - m_NumberOfBinsPerAxis(8), - m_InputImageMinimum(0), - m_InputImageMaximum(256) + m_NumberOfBinsPerAxis(8), + m_InputImageMinimum(0), + m_InputImageMaximum(255) { // There are 1 output corresponding to the Pan Tex texture indice this->SetNumberOfRequiredOutputs(1); @@ -144,86 +146,68 @@ OffsetType currentOffset = *offIt; // Compute the region on which co-occurence will be estimated - typename InputRegionType::IndexType inputIndex, inputIndexWithTwiceOffset; - typename InputRegionType::SizeType inputSize, inputSizeWithTwiceOffset; + typename InputRegionType::IndexType inputIndex; + typename InputRegionType::SizeType inputSize; - // First, apply offset + // First, create an window for neighborhood iterator based on m_Radius + // For example, if xradius and yradius is 2. window size is 5x5 (2 * + // radius + 1). for (unsigned int dim = 0; dim < InputImageType::ImageDimension; ++dim) { - inputIndex[dim] = std::min( - static_cast(outputIt.GetIndex()[dim] - m_Radius[dim]), - static_cast(outputIt.GetIndex()[dim] - m_Radius[dim] + currentOffset[dim]) - ); - inputSize[dim] = 2 * m_Radius[dim] + 1 + std::abs(currentOffset[dim]); - - inputIndexWithTwiceOffset[dim] = static_cast(outputIt.GetIndex()[dim] - m_Radius[dim] - std::abs(currentOffset[dim])); - inputSizeWithTwiceOffset[dim] = inputSize[dim] + std::abs(currentOffset[dim]); + inputIndex[dim] = outputIt.GetIndex()[dim] - m_Radius[dim]; + inputSize[dim] = 2 * m_Radius[dim] + 1; } - // Build the input region InputRegionType inputRegion; inputRegion.SetIndex(inputIndex); inputRegion.SetSize(inputSize); inputRegion.Crop(inputPtr->GetRequestedRegion()); - InputRegionType inputRegionWithTwiceOffset; - inputRegionWithTwiceOffset.SetIndex(inputIndexWithTwiceOffset); - inputRegionWithTwiceOffset.SetSize(inputSizeWithTwiceOffset); - inputRegionWithTwiceOffset.Crop(inputPtr->GetRequestedRegion()); - - /*********************************************************************************/ - //Local copy of the input image around the processed pixel *outputIt - InputImagePointerType localInputImage = InputImageType::New(); - localInputImage->SetRegions(inputRegionWithTwiceOffset); - localInputImage->Allocate(); - typedef itk::ImageRegionIteratorWithIndex ImageRegionIteratorType; - ImageRegionIteratorType itInputPtr(inputPtr, inputRegionWithTwiceOffset); - ImageRegionIteratorType itLocalInputImage(localInputImage, inputRegionWithTwiceOffset); - for (itInputPtr.GoToBegin(), itLocalInputImage.GoToBegin(); !itInputPtr.IsAtEnd(); ++itInputPtr, ++itLocalInputImage) + + SizeType neighborhoodRadius; + /** calulate minimum offset and set it as neigborhood radius **/ + unsigned int minRadius = 0; + for ( unsigned int i = 0; i < currentOffset.GetOffsetDimension(); i++ ) { - itLocalInputImage.Set(itInputPtr.Get()); + unsigned int distance = vcl_abs(currentOffset[i]); + if ( distance > minRadius ) + { + minRadius = distance; + } } - /*********************************************************************************/ + neighborhoodRadius.Fill(minRadius); - InputImagePointerType maskImage = InputImageType::New(); - maskImage->SetRegions(inputRegionWithTwiceOffset); - maskImage->Allocate(); - maskImage->FillBuffer(0); + CooccurrenceIndexedListPointerType GLCIList = CooccurrenceIndexedListType::New(); + GLCIList->Initialize(m_NumberOfBinsPerAxis, m_InputImageMinimum, m_InputImageMaximum); - ImageRegionIteratorType itMask(maskImage, inputRegion); - for (itMask.GoToBegin(); !itMask.IsAtEnd(); ++itMask) + typedef itk::ConstNeighborhoodIterator< InputImageType > NeighborhoodIteratorType; + NeighborhoodIteratorType neighborIt; + neighborIt = NeighborhoodIteratorType(neighborhoodRadius, inputPtr, inputRegion); + for ( neighborIt.GoToBegin(); !neighborIt.IsAtEnd(); ++neighborIt ) { - itMask.Set(1); + const InputPixelType centerPixelIntensity = neighborIt.GetCenterPixel(); + bool pixelInBounds; + const InputPixelType pixelIntensity = neighborIt.GetPixel(currentOffset, pixelInBounds); + if ( !pixelInBounds ) + { + continue; // don't put a pixel in the histogram if it's out-of-bounds. + } + GLCIList->AddPixelPair(centerPixelIntensity, pixelIntensity); } + VectorConstIteratorType constVectorIt; + VectorType glcVector = GLCIList->GetVector(); + double totalFrequency = static_cast (GLCIList->GetTotalFrequency()); - // Build the co-occurence matrix generator - CoocurrenceMatrixGeneratorPointerType coOccurenceMatrixGenerator = CoocurrenceMatrixGeneratorType::New(); - coOccurenceMatrixGenerator->SetInput(localInputImage); - coOccurenceMatrixGenerator->SetOffset(currentOffset); - coOccurenceMatrixGenerator->SetNumberOfBinsPerAxis(m_NumberOfBinsPerAxis); - coOccurenceMatrixGenerator->SetPixelValueMinMax(m_InputImageMinimum, m_InputImageMaximum); - - // Compute the co-occurence matrix - coOccurenceMatrixGenerator->SetMaskImage(maskImage); - coOccurenceMatrixGenerator->SetInsidePixelValue(1); - coOccurenceMatrixGenerator->Update(); - - typename HistogramType::ConstPointer histo = coOccurenceMatrixGenerator->GetOutput(); - + //Compute inertia aka contrast double inertia = 0; - typename HistogramType::TotalAbsoluteFrequencyType totalFrequency = histo->GetTotalFrequency(); - typename HistogramType::ConstIterator itr = histo->Begin(); - typename HistogramType::ConstIterator end = histo->End(); - for(; itr != end; ++itr ) + constVectorIt = glcVector.begin(); + while( constVectorIt != glcVector.end()) { - MeasurementType frequency = itr.GetFrequency(); - if (frequency == 0) - { - continue; // no use doing these calculations if we're just multiplying by zero. - } - typename HistogramType::IndexType index = histo->GetIndex(itr.GetInstanceIdentifier()); - inertia += (index[0] - index[1]) * (index[0] - index[1]) * frequency / totalFrequency; + CooccurrenceIndexType index = (*constVectorIt).first; + RelativeFrequencyType frequency = (*constVectorIt).second / totalFrequency; + inertia += ( index[0] - index[1] ) * ( index[0] - index[1] ) * frequency; + ++constVectorIt; } if (inertia < out) diff -Nru otb-4.0.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.h otb-4.2.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -1,37 +1,46 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - 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. +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. + +=========================================================================*/ - =========================================================================*/ #ifndef __otbScalarImageToTexturesFilter_h #define __otbScalarImageToTexturesFilter_h +#include "otbGreyLevelCooccurrenceIndexedList.h" #include "itkImageToImageFilter.h" -#include "itkScalarImageToCooccurrenceMatrixFilter.h" -#include "itkHistogramToTextureFeaturesFilter.h" - namespace otb { -/** \class ScalarImageToTexturesFilter - * \brief This class compute 8 local Haralick textures features. - * - * This filter computes the following Haralick textures over a sliding windows with - * user defined radius: - * (where \f$ g(i, j) \f$ is the element in - * cell i, j of a normalized GLCM): +/** + * \class ScalarImageToTexturesFilter + * \brief This class compute 8 local Haralick textures features. The 8 output + * image channels are: Energy, Entropy, Correlation, Inverse Difference Moment, + * Inertia, Cluster Shade, Cluster Prominence and Haralick Correlation. They + * are provided in this exact order in the output image. Thus, this application + * computes the following Haralick textures over a neighborhood with user + * defined radius. + * + * To improve the speed of computation, a variant of Grey Level Co-occurrence + * Matrix(GLCM) called Grey Level Co-occurrence Indexed List (GLCIL) is + * used. Given below is the mathematical explanation on the computation of each + * textures. Here $ g(i, j) $ is the frequency of element in the GLCIL whose + * index is i, j. GLCIL stores a pair of frequency of two pixels from the given + * offset and the cell index (i, j) of the pixel in the neighborhood + * window. :(where each element in GLCIL is a pair of pixel index and it's + * frequency, $ g(i, j) $ is the frequency value of the pair having index is i, j). * * "Energy" \f$ = f_1 = \sum_{i, j}g(i, j)^2 \f$ * @@ -57,11 +66,30 @@ * \f$ \sigma = \f$ (weighted pixel variance) \f$ = \sum_{i, j}(i - \mu)^2 \cdot g(i, j) = * \sum_{i, j}(j - \mu)^2 \cdot g(i, j) \f$ (due to matrix summetry) * + + * Print references: + * + * Haralick, R.M., K. Shanmugam and I. Dinstein. 1973. Textural Features for + * Image Classification. IEEE Transactions on Systems, Man and Cybernetics. + * SMC-3(6):610-620. + * + * David A. Clausi and Yongping Zhao. 2002. Rapid extraction of image texture by + * co-occurrence using a hybrid data structure. Comput. Geosci. 28, 6 (July + * 2002), 763-774. DOI=10.1016/S0098-3004(01)00108-X + * http://dx.doi.org/10.1016/S0098-3004(01)00108-X + * + * de O.Bastos, L.; Liatsis, P.; Conci, A., Automatic texture segmentation based + * on k-means clustering and efficient calculation of co-occurrence + * features. Systems, Signals and Image Processing, 2008. IWSSIP 2008. 15th + * International Conference on , vol., no., pp.141,144, 25-28 June 2008 + * doi: 10.1109/IWSSIP.2008.4604387 + * * Neighborhood size can be set using the SetRadius() method. Offset for co-occurence estimation * is set using the SetOffset() method. * - * \sa otb::MaskedScalarImageToGreyLevelCooccurrenceMatrixGenerator - * \sa itk::GreyLevelCooccurrenceMatrixTextureCoefficientsCalculator + * \sa otb::GreyLevelCooccurrenceIndexedList + * \sa otb::ScalarImageToAdvancedTexturesFiler + * \sa otb::ScalarImageToHigherOrderTexturesFilter * * \ingroup Streamed * \ingroup Threaded @@ -90,18 +118,22 @@ typedef typename InputImageType::PixelType InputPixelType; typedef typename InputImageType::RegionType InputRegionType; typedef typename InputRegionType::SizeType SizeType; + typedef typename InputImageType::OffsetType OffsetType; + typedef TOutputImage OutputImageType; typedef typename OutputImageType::Pointer OutputImagePointerType; typedef typename OutputImageType::RegionType OutputRegionType; - /** Co-occurence matrix and textures calculator */ - typedef itk::Statistics::ScalarImageToCooccurrenceMatrixFilter CoocurrenceMatrixGeneratorType; - typedef typename CoocurrenceMatrixGeneratorType::Pointer CoocurrenceMatrixGeneratorPointerType; - typedef typename CoocurrenceMatrixGeneratorType::OffsetType OffsetType; - typedef typename CoocurrenceMatrixGeneratorType::HistogramType HistogramType; - typedef itk::Statistics::HistogramToTextureFeaturesFilter - TextureCoefficientsCalculatorType; - typedef typename TextureCoefficientsCalculatorType::Pointer TextureCoefficientsCalculatorPointerType; + typedef GreyLevelCooccurrenceIndexedList< InputPixelType > CooccurrenceIndexedListType; + typedef typename CooccurrenceIndexedListType::Pointer CooccurrenceIndexedListPointerType; + typedef typename CooccurrenceIndexedListType::ConstPointer CooccurrenceIndexedListConstPointerType; + typedef typename CooccurrenceIndexedListType::IndexType CooccurrenceIndexType; + typedef typename CooccurrenceIndexedListType::PixelValueType PixelValueType; + typedef typename CooccurrenceIndexedListType::RelativeFrequencyType RelativeFrequencyType; + typedef typename CooccurrenceIndexedListType::VectorType VectorType; + + typedef typename VectorType::iterator VectorIteratorType; + typedef typename VectorType::const_iterator VectorConstIteratorType; /** Set the radius of the window on which textures will be computed */ itkSetMacro(Radius, SizeType); @@ -114,10 +146,10 @@ /** Get the offset for co-occurence computation */ itkGetMacro(Offset, OffsetType); - /** Set the number of bin per axis for histogram generation */ + /** Set the number of bin per axis */ itkSetMacro(NumberOfBinsPerAxis, unsigned int); - /** Get the number of bin per axis for histogram generation */ + /** Get the number of bin per axis */ itkGetMacro(NumberOfBinsPerAxis, unsigned int); /** Set the input image minimum */ @@ -163,6 +195,8 @@ ~ScalarImageToTexturesFilter(); /** Generate the input requested region */ virtual void GenerateInputRequestedRegion(); + /** Before Parallel textures extraction */ + virtual void BeforeThreadedGenerateData(); /** Parallel textures extraction */ virtual void ThreadedGenerateData(const OutputRegionType& outputRegion, itk::ThreadIdType threadId); @@ -179,7 +213,10 @@ /** Offset for co-occurence */ OffsetType m_Offset; - /** Number of bins per axis for histogram generation */ + /** Radius of the neighborhood iterator which is minumum of m_Radius */ + SizeType m_NeighborhoodRadius; + + /** Number of bins per axis */ unsigned int m_NumberOfBinsPerAxis; /** Input image minimum */ @@ -187,6 +224,10 @@ /** Input image maximum */ InputPixelType m_InputImageMaximum; + + //TODO: should we use constexpr? only c++11 and problem for msvc + inline double GetPixelValueTolerance() const {return 0.0001; } + }; } // End namespace otb diff -Nru otb-4.0.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx otb-4.2.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx --- otb-4.0.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbScalarImageToTexturesFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -1,37 +1,44 @@ /*========================================================================= - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. - 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. +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. =========================================================================*/ + #ifndef __otbScalarImageToTexturesFilter_txx #define __otbScalarImageToTexturesFilter_txx #include "otbScalarImageToTexturesFilter.h" #include "itkImageRegionIteratorWithIndex.h" +#include "itkConstNeighborhoodIterator.h" #include "itkImageRegionIterator.h" #include "itkProgressReporter.h" +#include "itkNumericTraits.h" +#include +#include namespace otb { template ScalarImageToTexturesFilter -::ScalarImageToTexturesFilter() : m_Radius(), - m_Offset(), - m_NumberOfBinsPerAxis(8), - m_InputImageMinimum(0), - m_InputImageMaximum(256) +::ScalarImageToTexturesFilter() +: m_Radius() +, m_Offset() +, m_NeighborhoodRadius() +, m_NumberOfBinsPerAxis(8) +, m_InputImageMinimum(0) +, m_InputImageMaximum(255) { // There are 8 outputs corresponding to the 8 textures indices this->SetNumberOfRequiredOutputs(8); @@ -219,6 +226,23 @@ template void ScalarImageToTexturesFilter +::BeforeThreadedGenerateData() +{ + unsigned int minRadius = 0; + for ( unsigned int i = 0; i < m_Offset.GetOffsetDimension(); i++ ) + { + unsigned int distance = vcl_abs(m_Offset[i]); + if ( distance > minRadius ) + { + minRadius = distance; + } + } + m_NeighborhoodRadius.Fill(minRadius); +} + +template +void +ScalarImageToTexturesFilter ::ThreadedGenerateData(const OutputRegionType& outputRegionForThread, itk::ThreadIdType threadId) { // Retrieve the input and output pointers @@ -252,15 +276,7 @@ clusterProminenceIt.GoToBegin(); haralickCorIt.GoToBegin(); - - // Build the co-occurence matrix generator - CoocurrenceMatrixGeneratorPointerType coOccurenceMatrixGenerator = CoocurrenceMatrixGeneratorType::New(); - coOccurenceMatrixGenerator->SetOffset(m_Offset); - coOccurenceMatrixGenerator->SetNumberOfBinsPerAxis(m_NumberOfBinsPerAxis); - coOccurenceMatrixGenerator->SetPixelValueMinMax(m_InputImageMinimum, m_InputImageMaximum); - - // Build the texture calculator - TextureCoefficientsCalculatorPointerType texturesCalculator = TextureCoefficientsCalculatorType::New(); + const double log2 = vcl_log(2.0); // Set-up progress reporting itk::ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels()); @@ -276,20 +292,15 @@ && !haralickCorIt.IsAtEnd()) { // Compute the region on which co-occurence will be estimated - typename InputRegionType::IndexType inputIndex, inputIndexWithTwiceOffset; - typename InputRegionType::SizeType inputSize, inputSizeWithTwiceOffset; + typename InputRegionType::IndexType inputIndex; + typename InputRegionType::SizeType inputSize; - // First, apply offset + // First, create an window for neighborhood iterator based on m_Radius + // For example, if xradius and yradius is 2. window size is 5x5 (2 * radius + 1). for (unsigned int dim = 0; dim < InputImageType::ImageDimension; ++dim) { - inputIndex[dim] = std::min( - static_cast(energyIt.GetIndex()[dim] - m_Radius[dim]), - static_cast(energyIt.GetIndex()[dim] - m_Radius[dim] + m_Offset[dim]) - ); - inputSize[dim] = 2 * m_Radius[dim] + 1 + std::abs(m_Offset[dim]); - - inputIndexWithTwiceOffset[dim] = static_cast(energyIt.GetIndex()[dim] - m_Radius[dim] - std::abs(m_Offset[dim])); - inputSizeWithTwiceOffset[dim] = inputSize[dim] + std::abs(m_Offset[dim]); + inputIndex[dim] = energyIt.GetIndex()[dim] - m_Radius[dim]; + inputSize[dim] = 2 * m_Radius[dim] + 1; } // Build the input region @@ -298,55 +309,132 @@ inputRegion.SetSize(inputSize); inputRegion.Crop(inputPtr->GetRequestedRegion()); - InputRegionType inputRegionWithTwiceOffset; - inputRegionWithTwiceOffset.SetIndex(inputIndexWithTwiceOffset); - inputRegionWithTwiceOffset.SetSize(inputSizeWithTwiceOffset); - inputRegionWithTwiceOffset.Crop(inputPtr->GetRequestedRegion()); - - /*********************************************************************************/ - //Local copy of the input image around the processed pixel *outputIt - InputImagePointerType localInputImage = InputImageType::New(); - localInputImage->SetRegions(inputRegionWithTwiceOffset); - localInputImage->Allocate(); - typedef itk::ImageRegionIteratorWithIndex ImageRegionIteratorType; - ImageRegionIteratorType itInputPtr(inputPtr, inputRegionWithTwiceOffset); - ImageRegionIteratorType itLocalInputImage(localInputImage, inputRegionWithTwiceOffset); - for (itInputPtr.GoToBegin(), itLocalInputImage.GoToBegin(); !itInputPtr.IsAtEnd(); ++itInputPtr, ++itLocalInputImage) + CooccurrenceIndexedListPointerType GLCIList = CooccurrenceIndexedListType::New(); + GLCIList->Initialize(m_NumberOfBinsPerAxis, m_InputImageMinimum, m_InputImageMaximum); + + typedef itk::ConstNeighborhoodIterator< InputImageType > NeighborhoodIteratorType; + NeighborhoodIteratorType neighborIt; + neighborIt = NeighborhoodIteratorType(m_NeighborhoodRadius, inputPtr, inputRegion); + for ( neighborIt.GoToBegin(); !neighborIt.IsAtEnd(); ++neighborIt ) + { + const InputPixelType centerPixelIntensity = neighborIt.GetCenterPixel(); + bool pixelInBounds; + const InputPixelType pixelIntensity = neighborIt.GetPixel(m_Offset, pixelInBounds); + if ( !pixelInBounds ) + { + continue; // don't put a pixel in the co-occurrence list if the value is + // out of bounds + } + GLCIList->AddPixelPair(centerPixelIntensity, pixelIntensity); + } + + double pixelMean = 0.; + double marginalMean; + double marginalDevSquared = 0.; + double pixelVariance = 0.; + + //Create and Intialize marginalSums + std::vector marginalSums(m_NumberOfBinsPerAxis, 0); + + //get co-occurrence vector and totalfrequency + VectorType glcVector = GLCIList->GetVector(); + double totalFrequency = static_cast (GLCIList->GetTotalFrequency()); + + //Normalize the co-occurrence indexed list and compute mean, marginalSum + typename VectorType::iterator it = glcVector.begin(); + while( it != glcVector.end()) { - itLocalInputImage.Set(itInputPtr.Get()); + double frequency = (*it).second / totalFrequency; + CooccurrenceIndexType index = (*it).first; + pixelMean += index[0] * frequency; + marginalSums[index[0]] += frequency; + ++it; } - /*********************************************************************************/ - InputImagePointerType maskImage = InputImageType::New(); - maskImage->SetRegions(inputRegionWithTwiceOffset); - maskImage->Allocate(); - maskImage->FillBuffer(0); + /* Now get the mean and deviaton of the marginal sums. + Compute incremental mean and SD, a la Knuth, "The Art of Computer + Programming, Volume 2: Seminumerical Algorithms", section 4.2.2. + Compute mean and standard deviation using the recurrence relation: + M(1) = x(1), M(k) = M(k-1) + (x(k) - M(k-1) ) / k + S(1) = 0, S(k) = S(k-1) + (x(k) - M(k-1)) * (x(k) - M(k)) + for 2 <= k <= n, then + sigma = vcl_sqrt(S(n) / n) (or divide by n-1 for sample SD instead of + population SD). + */ + std::vector::const_iterator msIt = marginalSums.begin(); + marginalMean = *msIt; + //Increment iterator to start with index 1 + ++msIt; + for(int k= 2; msIt != marginalSums.end(); ++k, ++msIt) + { + double M_k_minus_1 = marginalMean; + double S_k_minus_1 = marginalDevSquared; + double x_k = *msIt; + double M_k = M_k_minus_1 + ( x_k - M_k_minus_1 ) / k; + double S_k = S_k_minus_1 + ( x_k - M_k_minus_1 ) * ( x_k - M_k ); + marginalMean = M_k; + marginalDevSquared = S_k; + } + marginalDevSquared = marginalDevSquared / m_NumberOfBinsPerAxis; + + VectorConstIteratorType constVectorIt; + constVectorIt = glcVector.begin(); + while( constVectorIt != glcVector.end()) + { + RelativeFrequencyType frequency = (*constVectorIt).second / totalFrequency; + CooccurrenceIndexType index = (*constVectorIt).first; + pixelVariance += ( index[0] - pixelMean ) * ( index[0] - pixelMean ) * frequency; + ++constVectorIt; + } + + double pixelVarianceSquared = pixelVariance * pixelVariance; + // Variance is only used in correlation. If variance is 0, then (index[0] - pixelMean) * (index[1] - pixelMean) + // should be zero as well. In this case, set the variance to 1. in order to + // avoid NaN correlation. + if(pixelVarianceSquared < GetPixelValueTolerance()) + { + pixelVarianceSquared = 1.; + } - ImageRegionIteratorType itMask(maskImage, inputRegion); - for (itMask.GoToBegin(); !itMask.IsAtEnd(); ++itMask) + //Initalize texture variables; + PixelValueType energy = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType entropy = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType correlation = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType inverseDifferenceMoment = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType inertia = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType clusterShade = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType clusterProminence = itk::NumericTraits< PixelValueType >::Zero; + PixelValueType haralickCorrelation = itk::NumericTraits< PixelValueType >::Zero; + + //Compute textures + constVectorIt = glcVector.begin(); + while( constVectorIt != glcVector.end()) { - itMask.Set(1); + CooccurrenceIndexType index = (*constVectorIt).first; + RelativeFrequencyType frequency = (*constVectorIt).second / totalFrequency; + energy += frequency * frequency; + entropy -= ( frequency > GetPixelValueTolerance() ) ? frequency *vcl_log(frequency) / log2 : 0; + correlation += ( ( index[0] - pixelMean ) * ( index[1] - pixelMean ) * frequency ) / pixelVarianceSquared; + inverseDifferenceMoment += frequency / ( 1.0 + ( index[0] - index[1] ) * ( index[0] - index[1] ) ); + inertia += ( index[0] - index[1] ) * ( index[0] - index[1] ) * frequency; + clusterShade += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 3 ) * frequency; + clusterProminence += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 4 ) * frequency; + haralickCorrelation += index[0] * index[1] * frequency; + ++constVectorIt; } - // Compute the co-occurence matrix - coOccurenceMatrixGenerator->SetInput(localInputImage); - coOccurenceMatrixGenerator->SetMaskImage(maskImage); - coOccurenceMatrixGenerator->SetInsidePixelValue(1); - coOccurenceMatrixGenerator->Update(); - - // Compute textures indices - texturesCalculator->SetInput(coOccurenceMatrixGenerator->GetOutput()); - texturesCalculator->Update(); + haralickCorrelation = (fabs(marginalDevSquared) > 1E-8) ? + ( haralickCorrelation - marginalMean * marginalMean ) / marginalDevSquared : 0; // Fill outputs - energyIt.Set(texturesCalculator->GetEnergy()); - entropyIt.Set(texturesCalculator->GetEntropy()); - correlationIt.Set(texturesCalculator->GetCorrelation()); - invDiffMomentIt.Set(texturesCalculator->GetInverseDifferenceMoment()); - inertiaIt.Set(texturesCalculator->GetInertia()); - clusterShadeIt.Set(texturesCalculator->GetClusterShade()); - clusterProminenceIt.Set(texturesCalculator->GetClusterProminence()); - haralickCorIt.Set(texturesCalculator->GetHaralickCorrelation()); + energyIt.Set(energy); + entropyIt.Set(entropy); + correlationIt.Set(correlation); + invDiffMomentIt.Set(inverseDifferenceMoment); + inertiaIt.Set(inertia); + clusterShadeIt.Set(clusterShade); + clusterProminenceIt.Set(clusterProminence); + haralickCorIt.Set(haralickCorrelation); // Update progress progress.CompletedPixel(); @@ -361,7 +449,6 @@ ++clusterProminenceIt; ++haralickCorIt; } - } } // End namespace otb diff -Nru otb-4.0.0/Code/FeatureExtraction/otbSFSTexturesFunctor.h otb-4.2.0/Code/FeatureExtraction/otbSFSTexturesFunctor.h --- otb-4.0.0/Code/FeatureExtraction/otbSFSTexturesFunctor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbSFSTexturesFunctor.h 2014-09-03 08:29:34.000000000 +0000 @@ -80,7 +80,7 @@ void SetNumberOfDirections(unsigned int D) { m_NumberOfDirections = D; - m_DirectionStep = CONST_2PI / static_cast(D); + m_DirectionStep = CONST_PI / static_cast(D); } void SetDirectionStep(double step){ m_DirectionStep = step; } void SetSelectedTextures(std::vector vect) @@ -123,15 +123,21 @@ for (unsigned int d = 0; d < m_NumberOfDirections; d++) { // Current angle direction - angle = m_Alpha * static_cast(d); + angle = m_DirectionStep * static_cast(d); - // last offset in the diraction respecting spatial threshold + // last offset in the direction respecting spatial threshold off[0] = static_cast(vcl_floor(SpatialThresholdDouble * vcl_cos(angle) + 0.5)); off[1] = static_cast(vcl_floor(SpatialThresholdDouble * vcl_sin(angle) + 0.5)); - // last indices in the diration respecting spectral threshold + // last indices in the direction respecting spectral threshold OffsetType offEnd = this->FindLastOffset(it, off); - // computes distance = dist between the 2 segment point. One of them is the center pixel -> (0, 0) - dist = vcl_sqrt(vcl_pow(static_cast(offEnd[0]), 2) + vcl_pow(static_cast(offEnd[1]), 2)); + + // Check the opposite side + off[0] *= -1.0; + off[1] *= -1.0; + OffsetType offStart = this->FindLastOffset(it, off); + + // computes distance = dist between the 2 segment point. + dist = vcl_sqrt(vcl_pow(static_cast(offEnd[0]-offStart[0]), 2) + vcl_pow(static_cast(offEnd[1]-offStart[1]), 2)); // for length computation if (m_SelectedTextures[0] == true) if (dist > length) length = dist; diff -Nru otb-4.0.0/Code/FeatureExtraction/otbSFSTexturesImageFilter.h otb-4.2.0/Code/FeatureExtraction/otbSFSTexturesImageFilter.h --- otb-4.0.0/Code/FeatureExtraction/otbSFSTexturesImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/FeatureExtraction/otbSFSTexturesImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -145,7 +145,7 @@ void SetNumberOfDirections(unsigned int D) { this->GetFunctor().SetNumberOfDirections(D); - double step = CONST_2PI / static_cast(D); + double step = CONST_PI / static_cast(D); this->GetFunctor().SetDirectionStep(step); } unsigned int GetNumberOfDirections() diff -Nru otb-4.0.0/Code/Fusion/otbBayesianFusionFilter.h otb-4.2.0/Code/Fusion/otbBayesianFusionFilter.h --- otb-4.0.0/Code/Fusion/otbBayesianFusionFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Fusion/otbBayesianFusionFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -102,7 +102,7 @@ return m_Vcondopt; } - inline TOutput operator ()(const TInputMultiSpectral& ms, + inline TOutput operator ()(const TInputMultiSpectral& itkNotUsed(ms), const TInputMultiSpectralInterp& msi, const TInputPanchro& p) { diff -Nru otb-4.0.0/Code/Fuzzy/otbMassOfBelief.txx otb-4.2.0/Code/Fuzzy/otbMassOfBelief.txx --- otb-4.0.0/Code/Fuzzy/otbMassOfBelief.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Fuzzy/otbMassOfBelief.txx 2014-09-03 08:29:34.000000000 +0000 @@ -373,24 +373,24 @@ Superclass::PrintSelf(os, indent); // Display mass of belief universe - os << indent << "Mass of belief universe: " - << PrintLabelSet(os, this->GetUniverse()) - << std::endl; + os << indent << "Mass of belief universe: "; + PrintLabelSet(os, this->GetUniverse()); + os << std::endl; // Display mass of belief support - os<GetSupport()) - <GetSupport()); + os << std::endl; // Display individual masses for(typename MassMapType::const_iterator it = m_MassesMap.begin(); it!=m_MassesMap.end(); ++it) { - os<< indent - << PrintLabelSet(os, it->first) - << " has mass "<<(it->second)<first); + os << " has mass " << (it->second) << std::endl; } - os< @@ -428,7 +428,6 @@ const LabelSetOfSetType & labelSet) { // Define an iterator on the label set - typedef std::set LabelSetType; typename LabelSetOfSetType::const_iterator it = labelSet.begin(); // Open the set diff -Nru otb-4.0.0/Code/Fuzzy/otbStandardDSCostFunction.txx otb-4.2.0/Code/Fuzzy/otbStandardDSCostFunction.txx --- otb-4.0.0/Code/Fuzzy/otbStandardDSCostFunction.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Fuzzy/otbStandardDSCostFunction.txx 2014-09-03 08:29:34.000000000 +0000 @@ -148,7 +148,7 @@ template void StandardDSCostFunction -::GetDerivative(const ParametersType & parameters, DerivativeType & derivative) const +::GetDerivative(const ParametersType & itkNotUsed(parameters), DerivativeType & itkNotUsed(derivative)) const { //Not necessary for Amoeba Optimizer itkExceptionMacro(<< "Not Supposed to be used when using Amoeba Optimizer!") diff -Nru otb-4.0.0/Code/Hyperspectral/otbMDMDNMFImageFilter.txx otb-4.2.0/Code/Hyperspectral/otbMDMDNMFImageFilter.txx --- otb-4.0.0/Code/Hyperspectral/otbMDMDNMFImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Hyperspectral/otbMDMDNMFImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -87,7 +87,7 @@ ::Criterion(const MatrixType & X, const MatrixType & A, const MatrixType & S, - const double &m_Delt, + const double &itkNotUsed(m_Delt), const double &m_LambdS, const double &m_LambdD) { @@ -164,7 +164,7 @@ ::EvalGradS(const MatrixType &X, const MatrixType &A, const MatrixType &S, - const double &m_Delt, + const double &itkNotUsed(m_Delt), const double &m_LambdS, MatrixType & gradS) { @@ -185,7 +185,7 @@ ::EvalGradA(const MatrixType &X, const MatrixType &A, const MatrixType &S, - const double &m_Delt, + const double &itkNotUsed(m_Delt), const double &m_LambdD, MatrixType &gradA) { diff -Nru otb-4.0.0/Code/IO/CMakeLists.txt otb-4.2.0/Code/IO/CMakeLists.txt --- otb-4.0.0/Code/IO/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -15,7 +15,7 @@ if(OTB_USE_JPEG2000) if(WIN32) - if(OTB_BUILD_SHARED_LIBS) + if(BUILD_SHARED_LIBS) add_definitions(-DOPJ_EXPORTS) else() add_definitions(-DOPJ_STATIC) diff -Nru otb-4.0.0/Code/IO/otbBSQImageIO.cxx otb-4.2.0/Code/IO/otbBSQImageIO.cxx --- otb-4.0.0/Code/IO/otbBSQImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbBSQImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,9 +50,10 @@ // Set default spacing to one m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to [0.5 , 0.5] + // (consistency between ImageIO, see Mantis #942) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_ChannelsFile = NULL; m_FlagWriteImageInformation = true; diff -Nru otb-4.0.0/Code/IO/otbDefaultConvertPixelTraits.h otb-4.2.0/Code/IO/otbDefaultConvertPixelTraits.h --- otb-4.0.0/Code/IO/otbDefaultConvertPixelTraits.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbDefaultConvertPixelTraits.h 2014-09-03 08:29:34.000000000 +0000 @@ -55,7 +55,7 @@ /** Set the nth component of the pixel. */ static void SetNthComponent(int c, PixelType& pixel, const ComponentType& v) { pixel.SetNthComponent(c, v); } - static void SetNthComponent(int c, PixelType & pixel, const PixelType& v) + static void SetNthComponent(int itkNotUsed(c), PixelType & pixel, const PixelType& v) { pixel = v; } /** Return a single scalar value from this pixel. */ diff -Nru otb-4.0.0/Code/IO/otbExtendedFilenameToReaderOptions.cxx otb-4.2.0/Code/IO/otbExtendedFilenameToReaderOptions.cxx --- otb-4.0.0/Code/IO/otbExtendedFilenameToReaderOptions.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbExtendedFilenameToReaderOptions.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,12 +43,16 @@ m_Options.skipGeom.first = false; m_Options.skipGeom.second = false; + + m_Options.skipRpcTag.first = false; + m_Options.skipRpcTag.second = false; m_Options.optionList.push_back("geom"); m_Options.optionList.push_back("sdataidx"); m_Options.optionList.push_back("resol"); m_Options.optionList.push_back("skipcarto"); m_Options.optionList.push_back("skipgeom"); + m_Options.optionList.push_back("skiprpctag"); } void @@ -105,6 +109,20 @@ } } + if (!map["skiprpctag"].empty()) + { + m_Options.skipRpcTag.first = true; + if ( map["skiprpctag"] == "On" + || map["skiprpctag"] == "on" + || map["skiprpctag"] == "ON" + || map["skiprpctag"] == "true" + || map["skiprpctag"] == "True" + || map["skiprpctag"] == "1" ) + { + m_Options.skipRpcTag.second = true; + } + } + //Option Checking MapIteratorType it; for ( it=map.begin(); it != map.end(); it++ ) @@ -198,4 +216,17 @@ return m_Options.skipGeom.second; } +bool +ExtendedFilenameToReaderOptions +::SkipRpcTagIsSet () const +{ + return m_Options.skipRpcTag.first; +} +bool +ExtendedFilenameToReaderOptions +::GetSkipRpcTag () const +{ + return m_Options.skipRpcTag.second; +} + } // end namespace otb diff -Nru otb-4.0.0/Code/IO/otbExtendedFilenameToReaderOptions.h otb-4.2.0/Code/IO/otbExtendedFilenameToReaderOptions.h --- otb-4.0.0/Code/IO/otbExtendedFilenameToReaderOptions.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbExtendedFilenameToReaderOptions.h 2014-09-03 08:29:34.000000000 +0000 @@ -62,6 +62,7 @@ std::pair< bool, unsigned int > resolutionFactor; std::pair< bool, bool > skipCarto; std::pair< bool, bool > skipGeom; + std::pair< bool, bool > skipRpcTag; std::vector optionList; }; @@ -80,6 +81,8 @@ bool GetSkipCarto () const; bool SkipGeomIsSet () const; bool GetSkipGeom () const; + bool SkipRpcTagIsSet () const; + bool GetSkipRpcTag () const; protected: ExtendedFilenameToReaderOptions(); diff -Nru otb-4.0.0/Code/IO/otbGDALDriverManagerWrapper.cxx otb-4.2.0/Code/IO/otbGDALDriverManagerWrapper.cxx --- otb-4.0.0/Code/IO/otbGDALDriverManagerWrapper.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbGDALDriverManagerWrapper.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,15 +43,43 @@ return m_Dataset; } +// IsJPEG2000 +bool +GDALDatasetWrapper::IsJPEG2000() const +{ + if (m_Dataset == NULL) + { + return false; + } + std::string driverName(m_Dataset->GetDriver()->GetDescription()); + if (driverName.compare("JP2OpenJPEG") == 0 || + driverName.compare("JP2KAK") == 0 || + driverName.compare("JP2ECW") == 0) + { + return true; + } + return false; +} + // GDALDriverManagerWrapper method implementation GDALDriverManagerWrapper::GDALDriverManagerWrapper() { GDALAllRegister(); + // Ignore incompatible Jpeg2000 drivers (Jasper) + /* + driver = GetGDALDriverManager()->GetDriverByName( "JPEG2000" ); + if (driver) + GetGDALDriverManager()->DeregisterDriver( driver ); + */ + #ifndef CHECK_HDF4OPEN_SYMBOL + + GDALDriver* driver = 0; + // Get rid of the HDF4 driver when it is buggy - GDALDriver* driver = GetGDALDriverManager()->GetDriverByName( "hdf4" ); + driver = GetGDALDriverManager()->GetDriverByName( "hdf4" ); if (driver) GetGDALDriverManager()->DeregisterDriver( driver ); #endif @@ -67,6 +95,26 @@ GDALDriverManagerWrapper::Open( std::string filename ) const { GDALDatasetWrapper::Pointer datasetWrapper; + + // first : test if a driver can identify the dataset + GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), NULL); + if(identifyDriverH == NULL) + { + // don't try to open it and exit + return datasetWrapper; + } + + GDALDriver *identifyDriver = static_cast(identifyDriverH); + + // check if Jasper will be used + if (strcmp(identifyDriver->GetDescription(),"JPEG2000") == 0) + { + itkGenericExceptionMacro(<< "Error : tried to open the file " + << filename.c_str() << " with GDAL driver Jasper " + "(which fails on OTB). Try setting the environment variable GDAL_SKIP" + " in order to avoid this driver."); + } + GDALDatasetH dataset = GDALOpen(filename.c_str(), GA_ReadOnly); if (dataset != NULL) @@ -164,7 +212,7 @@ extern "C" { static int CPL_STDCALL otb_UpdateGDALProgress(double dfComplete, - const char *pszMessage, + const char *itkNotUsed(pszMessage), void * pProgressArg) { otb::GDALOverviewsBuilder* _this = (otb::GDALOverviewsBuilder*)pProgressArg; @@ -225,4 +273,3 @@ } } // end namespace otb - diff -Nru otb-4.0.0/Code/IO/otbGDALDriverManagerWrapper.h otb-4.2.0/Code/IO/otbGDALDriverManagerWrapper.h --- otb-4.0.0/Code/IO/otbGDALDriverManagerWrapper.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbGDALDriverManagerWrapper.h 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,9 @@ /* GDAL Libraries */ #include "gdal.h" +#include "gdaljp2metadata.h" #include "gdal_priv.h" +#include "gdal_alg.h" namespace otb { @@ -50,6 +52,11 @@ /** Easy access to the internal GDALDataset object. * Don't close it, it will be automatic */ GDALDataset* GetDataSet() const; + + /** Test if the dataset corresponds to a Jpeg2000 file format + * Return true if the dataset exists and has a JPEG2000 driver + * Return false in all other cases */ + bool IsJPEG2000() const; protected : GDALDatasetWrapper(); diff -Nru otb-4.0.0/Code/IO/otbGDALImageIO.cxx otb-4.2.0/Code/IO/otbGDALImageIO.cxx --- otb-4.0.0/Code/IO/otbGDALImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbGDALImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,6 +25,8 @@ #include "itksys/SystemTools.hxx" #include "otbImage.h" #include "itkVariableLengthVector.h" +#include "otbTinyXML.h" +#include "otbImageKeywordlist.h" #include "itkMetaDataObject.h" #include "otbMetaDataKey.h" @@ -42,6 +44,8 @@ #include #include "otbOGRHelpers.h" +#include "stdint.h" //needed for uintptr_t + inline unsigned int uint_ceildivpow2(unsigned int a, unsigned int b) { return (a + (1 << b) - 1) >> b; } @@ -134,9 +138,9 @@ // Set default spacing to one m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to half a pixel (centered pixel convention) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_IsIndexed = false; m_DatasetNumber = 0; @@ -331,8 +335,8 @@ // TODO: This is a very special case and seems to be working only // for unsigned char pixels. There might be a gdal method to do // the work in a cleaner way - std::streamoff lNbPixels = (static_cast(lNbColumns)) - * (static_cast(lNbLines)); + std::streamoff lNbPixels = (static_cast(lNbColumnsRegion)) + * (static_cast(lNbLinesRegion)); std::streamoff lBufferSize = static_cast(m_BytePerPixel) * lNbPixels; itk::VariableLengthVector value(lBufferSize); @@ -352,7 +356,8 @@ 0); if (lCrGdal == CE_Failure) { - itkExceptionMacro(<< "Error while reading image (GDAL format) " << m_FileName.c_str() << "."); + itkExceptionMacro(<< "Error while reading image (GDAL format) '" + << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); } // Interpret index as color std::streamoff cpt(0); @@ -422,7 +427,8 @@ // Check if gdal call succeed if (lCrGdal == CE_Failure) { - itkExceptionMacro(<< "Error while reading image (GDAL format) " << m_FileName.c_str() << "."); + itkExceptionMacro(<< "Error while reading image (GDAL format) '" + << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); return; } //printDataBuffer(p, m_PxType->pixType, m_NbBands, lNbColumnsRegion*lNbLinesRegion); @@ -485,6 +491,22 @@ { GDALDataset* dataset = m_Dataset->GetDataSet(); + if (m_Dataset->IsJPEG2000()) + { + // JPEG2000 case : use the number of overviews actually in the dataset + // Original resolution + res.push_back(0); + + // available overviews + for (unsigned int k=0; kGetDataSet(); + if (m_Dataset->IsJPEG2000()) + { + computeBlockSize = true; + dataset->GetRasterBand(1)->GetBlockSize(&blockSizeX, &blockSizeY); + if (blockSizeX==0 || blockSizeY==0) + { + computeBlockSize = false; + } + } + + for (std::vector::iterator itRes = res.begin(); itRes < res.end(); itRes++) { // For each resolution we will compute the tile dim and image dim @@ -523,7 +563,17 @@ unsigned int w = uint_ceildivpow2( originalWidth, *itRes); unsigned int h = uint_ceildivpow2( originalHeight, *itRes); - oss << "Resolution: " << *itRes << " (Image [w x h]: " << w << "x" << h << ", Tile [w x h]: " << "not defined x not defined" << ")"; + oss << "Resolution: " << *itRes << " (Image [w x h]: " << w << "x" << h << ", Tile [w x h]: "; + if (computeBlockSize) + { + unsigned int tw = uint_ceildivpow2( static_cast(blockSizeX), *itRes); + unsigned int th = uint_ceildivpow2( static_cast(blockSizeY), *itRes); + oss << tw << "x" << th << ")"; + } + else + { + oss << "not defined x not defined" << ")"; + } desc.push_back(oss.str()); } @@ -805,9 +855,17 @@ { otbMsgDevMacro(<< "Original blockSize: "<< blockSizeX << " x " << blockSizeY ); - // Try to keep the GDAL block memory constant blockSizeX = uint_ceildivpow2(blockSizeX,m_ResolutionFactor); - blockSizeY = blockSizeY * (1 << m_ResolutionFactor); + if (m_Dataset->IsJPEG2000()) + { + // Jpeg2000 case : use the real block size Y + blockSizeY = uint_ceildivpow2(blockSizeY,m_ResolutionFactor); + } + else + { + // Try to keep the GDAL block memory constant + blockSizeY = blockSizeY * (1 << m_ResolutionFactor); + } otbMsgDevMacro(<< "Decimated blockSize: "<< blockSizeX << " x " << blockSizeY ); @@ -825,6 +883,13 @@ m_Spacing[0] = 1; m_Spacing[1] = 1; + // Reset origin to GDAL convention default + m_Origin[0] = 0.0; + m_Origin[1] = 0.0; + + // flag to detect images in sensor geometry + bool isSensor = false; + if (m_NumberOfDimensions == 3) m_Spacing[2] = 1; char** papszMetadata; @@ -843,6 +908,12 @@ itk::EncapsulateMetaData(dict, MetaDataKey::DriverShortNameKey, driverShortName); itk::EncapsulateMetaData(dict, MetaDataKey::DriverLongNameKey, driverLongName); + if (m_Dataset->IsJPEG2000()) + { + // store the cache size used for Jpeg2000 files + itk::EncapsulateMetaData(dict, MetaDataKey::CacheSizeInBytes , GDALGetCacheMax64()); + } + /* -------------------------------------------------------------------- */ /* Get the projection coordinate system of the image : ProjectionRef */ /* -------------------------------------------------------------------- */ @@ -875,6 +946,15 @@ pSR = NULL; } } + else + { + otbMsgDevMacro( << "No projection => sensor model" ); + // Special case for Jpeg2000 files : try to read the origin in the GML box + if (m_Dataset->IsJPEG2000()) + { + isSensor = GetOriginFromGMLBox(m_Origin); + } + } /* -------------------------------------------------------------------- */ /* Get the GCP projection coordinates of the image : GCPProjection */ @@ -937,14 +1017,43 @@ itk::EncapsulateMetaData(dict, MetaDataKey::GeoTransformKey, VadfGeoTransform); - /// retrieve origin and spacing from the geo transform - m_Origin[0] = VadfGeoTransform[0]; - m_Origin[1] = VadfGeoTransform[3]; - m_Spacing[0] = VadfGeoTransform[1]; - m_Spacing[1] = VadfGeoTransform[5]; + if (!isSensor) + { + /// retrieve origin and spacing from the geo transform + m_Spacing[0] = VadfGeoTransform[1]; + m_Spacing[1] = VadfGeoTransform[5]; + if ( m_Spacing[0]== 0 || m_Spacing[1] == 0) + { + // Manage case where axis are not standard + if (VadfGeoTransform[2] != 0 && VadfGeoTransform[4] != 0 ) + { + m_Spacing[0] = VadfGeoTransform[2]; + m_Spacing[1] = VadfGeoTransform[4]; + } + else + { + otbWarningMacro(<< "Incorrect geotransform (spacing = 0)!"); + m_Spacing[0] = 1; + m_Spacing[1] = 1; + } + } + // Geotransforms with a non-null rotation are not supported + // Beware : GDAL origin is at the corner of the top-left pixel + // whereas OTB/ITK origin is at the centre of the top-left pixel + // The origin computed here is in GDAL convention for now + m_Origin[0] = VadfGeoTransform[0]; + m_Origin[1] = VadfGeoTransform[3]; + } } + // Compute final spacing with the resolution factor + m_Spacing[0] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); + m_Spacing[1] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); + // Now that the spacing is known, apply the half-pixel shift + m_Origin[0] += 0.5*m_Spacing[0]; + m_Origin[1] += 0.5*m_Spacing[1]; + // Dataset info otbMsgDevMacro(<< "**** ReadImageInformation() DATASET INFO: ****" ); otbMsgDevMacro(<< "Projection Ref: "<< dataset->GetProjectionRef() ); @@ -982,6 +1091,34 @@ } } + /* Special case for JPEG2000, also look in the GML boxes */ + if (m_Dataset->IsJPEG2000()) + { + char **gmlMetadata = NULL; + GDALJP2Metadata jp2Metadata; + if (jp2Metadata.ReadAndParse(m_FileName.c_str())) + { + gmlMetadata = jp2Metadata.papszGMLMetadata; + } + + if (CSLCount(gmlMetadata) > 0) + { + std::string key; + int cptOffset = CSLCount(papszMetadata); + + for (int cpt = 0; gmlMetadata[cpt] != NULL; ++cpt) + { + std::ostringstream lStream; + lStream << MetaDataKey::MetadataKey << (cpt+cptOffset); + key = lStream.str(); + + itk::EncapsulateMetaData(dict, key, + static_cast(gmlMetadata[cpt])); + } + } + } + + /* -------------------------------------------------------------------- */ /* Report subdatasets. */ /* -------------------------------------------------------------------- */ @@ -1087,9 +1224,6 @@ this->SetPixelType(VECTOR); } - // Adapt the spacing to the resolution read - m_Spacing[0] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); - m_Spacing[1] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); } bool GDALImageIO::CanWriteFile(const char* name) @@ -1140,7 +1274,6 @@ { m_CanStreamWrite = false; } - return m_CanStreamWrite; } @@ -1223,13 +1356,14 @@ // Check if writing succeed if (lCrGdal == CE_Failure) { - itkExceptionMacro(<< "Error while writing image (GDAL format) " << m_FileName.c_str() << "."); + itkExceptionMacro(<< "Error while writing image (GDAL format) '" + << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); } // Flush dataset cache m_Dataset->GetDataSet()->FlushCache(); } else - { + { // We only wrote data to the memory dataset // Now write it to the real file with CreateCopy() std::string gdalDriverShortName = FilenameToGdalDriverShortName(m_FileName); @@ -1245,8 +1379,16 @@ GDALDataset* hOutputDS = driver->CreateCopy( realFileName.c_str(), m_Dataset->GetDataSet(), FALSE, otb::ogr::StringListConverter(creationOptions).to_ogr(), NULL, NULL ); - GDALClose(hOutputDS); + if(!hOutputDS) + { + itkExceptionMacro(<< "Error while writing image (GDAL format) '" + << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); } + else + { + GDALClose(hOutputDS); + } + } if (lFirstLine + lNbLines == m_Dimensions[1] @@ -1445,9 +1587,11 @@ // doesn't begin with 0x, the address in not interpreted as // hexadecimal but alpha numeric value, then the conversion to // integer make us pointing to an non allowed memory block => Crash. + //use intptr_t to cast void* to unsigned long. included stdint.h for + // uintptr_t typedef. std::ostringstream stream; stream << "MEM:::" - << "DATAPOINTER=" << (unsigned long)(buffer) << "," + << "DATAPOINTER=" << (uintptr_t)(buffer) << "," << "PIXELS=" << m_Dimensions[0] << "," << "LINES=" << m_Dimensions[1] << "," << "BANDS=" << m_NbBands << "," @@ -1462,7 +1606,8 @@ if (m_Dataset.IsNull()) { itkExceptionMacro( - << "GDAL Writing failed : Impossible to create the image file name '" << m_FileName << "'."); + << "GDAL Writing failed : Impossible to create the image file name '" + << m_FileName << "' : " << CPLGetLastErrorMsg() ); } /*----------------------------------------------------------------------*/ @@ -1482,10 +1627,10 @@ /* -------------------------------------------------------------------- */ const double Epsilon = 1E-10; if (projectionRef.empty() - && (vcl_abs(m_Origin[0]) > Epsilon - || vcl_abs(m_Origin[1]) > Epsilon - || vcl_abs(m_Spacing[0] - 1) > Epsilon - || vcl_abs(m_Spacing[1] - 1) > Epsilon) ) + && (vcl_abs(m_Origin[0] - 0.5) > Epsilon + || vcl_abs(m_Origin[1] - 0.5) > Epsilon + || vcl_abs(m_Spacing[0] - 1.0) > Epsilon + || vcl_abs(m_Spacing[1] - 1.0) > Epsilon) ) { // See issue #303 : // If there is no ProjectionRef, and the GeoTransform is not the identity, @@ -1544,8 +1689,10 @@ /* -------------------------------------------------------------------- */ itk::VariableLengthVector geoTransform(6); /// Reporting origin and spacing - geoTransform[0] = m_Origin[0]; - geoTransform[3] = m_Origin[1]; + // Beware : GDAL origin is at the corner of the top-left pixel + // whereas OTB/ITK origin is at the centre of the top-left pixel + geoTransform[0] = m_Origin[0] - 0.5*m_Spacing[0]; + geoTransform[3] = m_Origin[1] - 0.5*m_Spacing[1]; geoTransform[1] = m_Spacing[0]; geoTransform[5] = m_Spacing[1]; @@ -1575,6 +1722,25 @@ dataset->SetMetadataItem(tag.c_str(), value.c_str(), NULL); } } + +#if GDAL_VERSION_NUM >= 1100000 + // Report any RPC coefficients (feature available since GDAL 1.10.0) + ImageKeywordlist otb_kwl; + itk::ExposeMetaData(dict, + MetaDataKey::OSSIMKeywordlistKey, + otb_kwl); + if( otb_kwl.GetSize() != 0 ) + { + GDALRPCInfo gdalRpcStruct; + if ( otb_kwl.convertToGDALRPC(gdalRpcStruct) ) + { + char **rpcMetadata = RPCInfoToMD(&gdalRpcStruct); + dataset->SetMetadata(rpcMetadata, "RPC"); + CSLDestroy( rpcMetadata ); + } + } +#endif + // END // Dataset info @@ -1621,12 +1787,103 @@ gdalDriverShortName="PCIDSK"; else if ( extension == ".lbl" || extension == ".pds" ) gdalDriverShortName="ISIS2"; + else if ( extension == ".j2k" || extension == ".jp2" || extension == ".jpx") + { + // Try different JPEG2000 drivers + GDALDriver *driver = NULL; + driver = GDALDriverManagerWrapper::GetInstance().GetDriverByName("JP2OpenJPEG"); + if (driver) + { + gdalDriverShortName = "JP2OpenJPEG"; + } + + if (!driver) + { + driver = GDALDriverManagerWrapper::GetInstance().GetDriverByName("JP2KAK"); + if (driver) + { + gdalDriverShortName = "JP2KAK"; + } + } + + if (!driver) + { + driver = GDALDriverManagerWrapper::GetInstance().GetDriverByName("JP2ECW"); + if (driver) + { + gdalDriverShortName = "JP2ECW"; + } + } + + if (!driver) + { + gdalDriverShortName = "NOT-FOUND"; + } + } + else gdalDriverShortName = "NOT-FOUND"; return gdalDriverShortName; } +bool GDALImageIO::GetOriginFromGMLBox(std::vector &origin) +{ + GDALJP2Metadata jp2Metadata; + if (!jp2Metadata.ReadAndParse(m_FileName.c_str())) + { + return false; + } + + if (!jp2Metadata.papszGMLMetadata) + { + return false; + } + + std::string gmlString = static_cast(jp2Metadata.papszGMLMetadata[0]); + gmlString.erase(0,18); // We need to remove first part to create a true xml stream + otbMsgDevMacro( << "XML extract from GML box: " << gmlString ); + + TiXmlDocument doc; + doc.Parse(gmlString.c_str()); // Create xml doc from a string + + TiXmlHandle docHandle( &doc ); + TiXmlElement* originTag = docHandle.FirstChild( "gml:FeatureCollection" ) + .FirstChild( "gml:featureMember" ) + .FirstChild( "gml:FeatureCollection" ) + .FirstChild( "gml:featureMember" ) + .FirstChild( "gml:GridCoverage" ) + .FirstChild( "gml:gridDomain") + .FirstChild( "gml:Grid" ) + .FirstChild( "gml:limits" ) + .FirstChild( "gml:GridEnvelope" ) + .FirstChild( "gml:low").ToElement(); + if(originTag) + { + otbMsgDevMacro( << "\t Origin (" << originTag->Value() <<" tag)= "<< originTag->GetText()); + } + else + { + otbMsgDevMacro( << "Didn't find the GML element which indicate the origin!" ); + return false; + } + + std::vector originValues; + originValues = itksys::SystemTools::SplitString(originTag->GetText(),' ', false); + + // Compute origin in GDAL convention (the half-pixel shift is applied later) + std::istringstream ss0 (originValues[0]); + std::istringstream ss1 (originValues[1]); + ss0 >> origin[1]; + ss1 >> origin[0]; + origin[0] += -1.0; + origin[1] += -1.0; + + otbMsgDevMacro( << "\t Origin from GML box: " << origin[0] << ", " << origin[1] ); + + return true; +} + std::string GDALImageIO::GetGdalWriteImageFileName(const std::string& gdalDriverShortName, const std::string& filename) const { std::string gdalFileName; diff -Nru otb-4.0.0/Code/IO/otbGDALImageIO.h otb-4.2.0/Code/IO/otbGDALImageIO.h --- otb-4.0.0/Code/IO/otbGDALImageIO.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbGDALImageIO.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,29 @@ /** \class GDALImageIO * - * \brief ImageIO object for reading (not writing) GDAL images + * \brief ImageIO object for reading and writing images with GDAL + * + * This ImageIO uses GDAL interface to read/write images. The + * origin and spacing are translated from/to GDAL geotransform + * matrix (even in the case of a sensor image). It means that + * extracts from sensor images are well supported. Typical + * sensor images in OTB have a spacing of [1,1] and an origin + * at [0.5,0.5] (when there is no GDAL geotransform, GDAL + * physical space is identical to GDAL index space). + * + * Note that the geotransform matrix supports any rotated physical + * space whereas OTB doesn't. + * + * \em Warning : the index coordinate system used in GDAL is attached + * to the corner of the top left pixel, whereas in OTB, the index + * coordinate system is attached to the centre of the top-left + * pixel. It means that the origin coefficents read from the + * GDAL geotransform are the location of the top-left pixel + * corner. This is why this location has to be shifted by + * half a pixel to be used as an OTB origin. In a nutshell, + * OTB images read/written by this ImageIO have the \em same + * physical space as GDAL physical space : a given point of + * image has the same physical location in OTB and in GDAL. * * The streaming read is implemented. * @@ -142,7 +164,11 @@ protected: - /** Constructor.*/ + /** + * Constructor. + * Spacing is set to [1,1] and origin to [0.5,0.5] as it would correspond + * to an image without geotransform + */ GDALImageIO(); /** Destructor.*/ virtual ~GDALImageIO(); @@ -175,6 +201,9 @@ std::string FilenameToGdalDriverShortName(const std::string& name) const; + /** Parse a GML box from a Jpeg2000 file and get the origin */ + bool GetOriginFromGMLBox(std::vector &origin); + /** Test whether m_CreationOptions has an option * \param partialOption The beginning of a creation option (for example "QUALITY=") */ diff -Nru otb-4.0.0/Code/IO/otbImageFileReader.txx otb-4.2.0/Code/IO/otbImageFileReader.txx --- otb-4.0.0/Code/IO/otbImageFileReader.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbImageFileReader.txx 2014-09-03 08:29:34.000000000 +0000 @@ -403,7 +403,7 @@ // spacing, origin and direction for the final (degenerate) dimensions. dimSize[i] = 1; spacing[i] = 1.0; - origin[i] = 0.0; + origin[i] = 0.5; for (unsigned j = 0; j < TOutputImage::ImageDimension; ++j) { if (i == j) @@ -422,7 +422,6 @@ { for (unsigned int i = 0; i < TOutputImage::ImageDimension; ++i) { - origin[i] = 0.0; if ( m_FilenameHelper->GetResolutionFactor() != 0 ) { spacing[i] = 1.0*vcl_pow((double)2, (double)m_FilenameHelper->GetResolutionFactor()); @@ -431,6 +430,7 @@ { spacing[i] = 1.0; } + origin[i] = 0.5*spacing[i]; } } @@ -442,7 +442,7 @@ ImageKeywordlist otb_kwl; if (!m_FilenameHelper->ExtGEOMFileNameIsSet()) { - otb_kwl = ReadGeometryFromImage(lFileNameOssimKeywordlist); + otb_kwl = ReadGeometryFromImage(lFileNameOssimKeywordlist,!m_FilenameHelper->GetSkipRpcTag()); otbMsgDevMacro(<< "Loading internal kwl"); } else @@ -478,12 +478,21 @@ std::string projRef; itk::ExposeMetaData(dict, MetaDataKey::ProjectionRefKey, projRef); + // Compute spacing for an identity geotransform at current resolution + unsigned int resolution; + itk::ExposeMetaData(dict, + MetaDataKey::ResolutionFactor, + resolution); + double idSpacing = 1.0; + if (resolution != 0) + idSpacing = 1.0 * vcl_pow((double)2.0, (double)resolution); + const double Epsilon = 1.0E-12; if ( projRef.empty() - && vcl_abs(origin[0]) > Epsilon - && vcl_abs(origin[1]) > Epsilon - && vcl_abs(spacing[0] - 1) > Epsilon - && vcl_abs(spacing[1] - 1) > Epsilon) + && vcl_abs(origin[0] - 0.5 * spacing[0]) > Epsilon + && vcl_abs(origin[1] - 0.5 * spacing[1]) > Epsilon + && vcl_abs(spacing[0] - idSpacing) > Epsilon + && vcl_abs(spacing[1] - idSpacing) > Epsilon) { std::string wgs84ProjRef = "GEOGCS[\"GCS_WGS_1984\", DATUM[\"D_WGS_1984\", SPHEROID[\"WGS_1984\", 6378137, 298.257223563]]," @@ -671,9 +680,12 @@ ImageFileReader ::SetFileName(const char* extendedFileName) { - this->m_FilenameHelper->SetExtendedFileName(extendedFileName); - this->m_FileName = this->m_FilenameHelper->GetSimpleFileName(); - this->Modified(); + if (extendedFileName) + { + this->m_FilenameHelper->SetExtendedFileName(extendedFileName); + this->m_FileName = this->m_FilenameHelper->GetSimpleFileName(); + this->Modified(); + } } template diff -Nru otb-4.0.0/Code/IO/otbImageIOBase.cxx otb-4.2.0/Code/IO/otbImageIOBase.cxx --- otb-4.0.0/Code/IO/otbImageIOBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbImageIOBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -430,7 +430,7 @@ bool itkSetPixelType(ImageIOBase *This, const std::type_info &ptype, - ImageIOBase::IOComponentType ntype, + ImageIOBase::IOComponentType itkNotUsed(ntype), std::complex itkNotUsed( dummy ) ) { if (ptype == typeid(std::complex)) diff -Nru otb-4.0.0/Code/IO/otbImageMetadataInterfaceFactory.cxx otb-4.2.0/Code/IO/otbImageMetadataInterfaceFactory.cxx --- otb-4.0.0/Code/IO/otbImageMetadataInterfaceFactory.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbImageMetadataInterfaceFactory.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,6 +25,7 @@ #include "otbIkonosImageMetadataInterfaceFactory.h" #include "otbSpotImageMetadataInterfaceFactory.h" #include "otbPleiadesImageMetadataInterfaceFactory.h" +#include "otbSpot6ImageMetadataInterfaceFactory.h" #include "otbFormosatImageMetadataInterfaceFactory.h" #include "otbQuickBirdImageMetadataInterfaceFactory.h" #include "otbWorldView2ImageMetadataInterfaceFactory.h" @@ -105,6 +106,7 @@ itk::ObjectFactoryBase::RegisterFactory(IkonosImageMetadataInterfaceFactory::New()); itk::ObjectFactoryBase::RegisterFactory(SpotImageMetadataInterfaceFactory::New()); itk::ObjectFactoryBase::RegisterFactory(PleiadesImageMetadataInterfaceFactory::New()); + itk::ObjectFactoryBase::RegisterFactory(Spot6ImageMetadataInterfaceFactory::New()); itk::ObjectFactoryBase::RegisterFactory(FormosatImageMetadataInterfaceFactory::New()); itk::ObjectFactoryBase::RegisterFactory(QuickBirdImageMetadataInterfaceFactory::New()); itk::ObjectFactoryBase::RegisterFactory(WorldView2ImageMetadataInterfaceFactory::New()); diff -Nru otb-4.0.0/Code/IO/otbImageSeriesFileReaderBase.h otb-4.2.0/Code/IO/otbImageSeriesFileReaderBase.h --- otb-4.0.0/Code/IO/otbImageSeriesFileReaderBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbImageSeriesFileReaderBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -153,7 +153,7 @@ * order to add the appropriated path */ virtual void TestFileExistanceAndReadability(std::string& file, FileType fileType); - virtual void TestBandSelection(std::vector& bands) {} + virtual void TestBandSelection(std::vector& itkNotUsed(bands)) {} virtual void GenerateData(void); diff -Nru otb-4.0.0/Code/IO/otbImageSeriesFileReaderBase.txx otb-4.2.0/Code/IO/otbImageSeriesFileReaderBase.txx --- otb-4.0.0/Code/IO/otbImageSeriesFileReaderBase.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbImageSeriesFileReaderBase.txx 2014-09-03 08:29:34.000000000 +0000 @@ -332,7 +332,7 @@ template void ImageSeriesFileReaderBase -::GenerateData(unsigned int idx) +::GenerateData(unsigned int itkNotUsed(idx)) { std::ostringstream msg; msg << "Something wrong... Check the template definition of this class in the program...\n"; diff -Nru otb-4.0.0/Code/IO/otbImageSeriesFileReader.h otb-4.2.0/Code/IO/otbImageSeriesFileReader.h --- otb-4.0.0/Code/IO/otbImageSeriesFileReader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbImageSeriesFileReader.h 2014-09-03 08:29:34.000000000 +0000 @@ -414,7 +414,7 @@ /** * Tests the coherency of the Meta File (especifically band selection) with the image types */ - virtual void TestBandSelection(std::vector& bands){} + virtual void TestBandSelection(std::vector& itkNotUsed(bands)){} /** GenerateData * This method will be specialised if template definitions follow: diff -Nru otb-4.0.0/Code/IO/otbJPEG2000ImageIO.cxx otb-4.2.0/Code/IO/otbJPEG2000ImageIO.cxx --- otb-4.0.0/Code/IO/otbJPEG2000ImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbJPEG2000ImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -238,12 +238,13 @@ std::vector originValues; originValues = itksys::SystemTools::SplitString(originTag->GetText(),' ', false); + // Compute origin in GDAL convention (half pixel shift is applied later) std::istringstream ss0 (originValues[0]); std::istringstream ss1 (originValues[1]); ss0 >> origin[1]; ss1 >> origin[0]; - origin[0]--; - origin[1]--; + origin[0] += -1.0; + origin[1] += -1.0; otbMsgDevMacro( << "\t Origin from GML box: " << origin[0] << ", " << origin[1] ); @@ -666,7 +667,7 @@ void JPEG2000TileCache::EstimateTileCacheSize(unsigned int originalWidthTile, unsigned int originalHeightTile, unsigned int nbComponent, - unsigned int precision, + unsigned int itkNotUsed(precision), unsigned int resolution) { this->m_TileCacheSizeInByte = originalWidthTile * originalHeightTile @@ -761,8 +762,8 @@ m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_BytePerPixel = 1; m_ResolutionFactor = 0; // Full resolution by default @@ -1239,6 +1240,10 @@ { otbMsgDevMacro(<<"JPEG2000 file has metadata available!"); + // reset the origin to [0,0] as in GDAL convention + m_Origin[0] = 0.0; + m_Origin[1] = 0.0; + /* GEOTRANSFORM */ if (lJP2MetadataReader.HaveGeoTransform()) { @@ -1255,8 +1260,6 @@ std::cout << std::endl; */ // Retrieve origin and spacing from the geo transform - m_Origin[0] = geoTransform[0]; - m_Origin[1] = geoTransform[3]; m_Spacing[0] = geoTransform[1]; m_Spacing[1] = geoTransform[5]; @@ -1275,6 +1278,13 @@ m_Spacing[1] = 1; } } + // Geotransforms with a non-null rotation are not supported + // Beware : GDAL origin is at the corner of the top-left pixel + // whereas OTB/ITK origin is at the centre of the top-left pixel + // The origin is first stored in GDAL convention. The halft pixel + // shift is applied later (when the final spacing is known) + m_Origin[0] = geoTransform[0]; + m_Origin[1] = geoTransform[3]; } /* GCPs */ @@ -1365,7 +1375,7 @@ else { otbMsgDevMacro( << "NO PROJECTION IN GML BOX => SENSOR MODEL " ); - m_Origin[0] = 0; m_Origin[1] = 0; + m_Origin[0] = 0.0; m_Origin[1] = 0.0; m_Spacing[0] = 1; m_Spacing[1] = 1; lJP2MetadataReader.GetOriginFromGMLBox(m_Origin); @@ -1378,12 +1388,18 @@ else { otbMsgDevMacro( << "JPEG2000 file has NO metadata available!"); - m_Origin[0] = 0; - m_Origin[1] = 0; - m_Spacing[0] = 1; - m_Spacing[1] = 1; + m_Origin[0] = 0.0; + m_Origin[1] = 0.0; + m_Spacing[0] = 1.0; + m_Spacing[1] = 1.0; } + // Compute final spacing using the resolution factor + m_Spacing[0] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); + m_Spacing[1] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); + // Now that the spacing is known, apply the half-pixel shift + m_Origin[0] += 0.5*m_Spacing[0]; + m_Origin[1] += 0.5*m_Spacing[1]; // If the internal image was not open we open it. // This is usually done when the user sets the ImageIO manually @@ -1450,9 +1466,6 @@ itk::EncapsulateMetaData(dict, MetaDataKey::TileHintX, tileHintX); itk::EncapsulateMetaData(dict, MetaDataKey::TileHintY, tileHintY); - m_Spacing[0] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); - m_Spacing[1] *= vcl_pow(2.0, static_cast(m_ResolutionFactor)); - // If we have some spacing information we use it // could be needed for other j2k image but not for pleiades // if ( (m_InternalReaders.front()->m_XResolution.front() > 0) && (m_InternalReaders.front()->m_YResolution.front() > 0) ) diff -Nru otb-4.0.0/Code/IO/otbKmzProductWriter.txx otb-4.2.0/Code/IO/otbKmzProductWriter.txx --- otb-4.0.0/Code/IO/otbKmzProductWriter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbKmzProductWriter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -447,78 +447,77 @@ InputPointType inputPoint; OutputPointType outputPoint; - IndexType indexTile; - SizeType sizeTile, demiSizeTile; + double sizeTile[2]; + double halfSizeTile[2]; - sizeTile = extractSize; - demiSizeTile[0] = (sizeTile[0] / 2) - 1; - demiSizeTile[1] = (sizeTile[1] / 2) - 1; + sizeTile[0] = static_cast(extractSize[0]); + sizeTile[1] = static_cast(extractSize[1]); + halfSizeTile[0] = sizeTile[0] / 2.0; + halfSizeTile[1] = sizeTile[1] / 2.0; + + itk::ContinuousIndex indexRef(extractIndex); + indexRef[0] += -0.5; + indexRef[1] += -0.5; + itk::ContinuousIndex indexTile(indexRef); // Compute North value - indexTile[0] = extractIndex[0] + demiSizeTile[0]; - indexTile[1] = extractIndex[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[0] += halfSizeTile[0]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); outputPoint = m_Transform->TransformPoint(inputPoint); double north = outputPoint[1]; // Compute South value - indexTile[0] = extractIndex[0] + demiSizeTile[0]; - indexTile[1] = extractIndex[1] + sizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[1] += sizeTile[1]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); outputPoint = m_Transform->TransformPoint(inputPoint); double south = outputPoint[1]; - // Compute East value - indexTile[0] = extractIndex[0] + sizeTile[0]; - indexTile[1] = extractIndex[1] + demiSizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); - outputPoint = m_Transform->TransformPoint(inputPoint); - double east = outputPoint[0]; - // Compute West value - indexTile[0] = extractIndex[0]; - indexTile[1] = extractIndex[1] + demiSizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile = indexRef; + indexTile[1] += halfSizeTile[1]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); outputPoint = m_Transform->TransformPoint(inputPoint); double west = outputPoint[0]; + // Compute East value + indexTile[0] += sizeTile[0]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); + outputPoint = m_Transform->TransformPoint(inputPoint); + double east = outputPoint[0]; + // Compute center value (lat / long) - indexTile[0] = extractIndex[0] + demiSizeTile[0]; - indexTile[1] = extractIndex[1] + demiSizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile = indexRef; + indexTile[0] += halfSizeTile[0]; + indexTile[1] += halfSizeTile[1]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); outputPoint = m_Transform->TransformPoint(inputPoint); double centerLat = outputPoint[1]; double centerLong = outputPoint[0]; /** GX LAT LON **/ + // Compute upper left corner + indexTile = indexRef; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); + outputPoint = m_Transform->TransformPoint(inputPoint); + OutputPointType upperLeftCorner = outputPoint; + // Compute lower left corner - indexTile[0] = extractIndex[0]; - indexTile[1] = extractIndex[1] + sizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[1] += sizeTile[1]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); outputPoint = m_Transform->TransformPoint(inputPoint); OutputPointType lowerLeftCorner = outputPoint; // Compute lower right corner - indexTile[0] = extractIndex[0] + sizeTile[0]; - indexTile[1] = extractIndex[1] + sizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[0] += sizeTile[0]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); outputPoint = m_Transform->TransformPoint(inputPoint); OutputPointType lowerRightCorner = outputPoint; // Compute upper right corner - indexTile[0] = extractIndex[0] + sizeTile[0]; - indexTile[1] = extractIndex[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[1] -= sizeTile[1]; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); outputPoint = m_Transform->TransformPoint(inputPoint); OutputPointType upperRightCorner = outputPoint; - - // Compute upper left corner - indexTile[0] = extractIndex[0]; - indexTile[1] = extractIndex[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); - outputPoint = m_Transform->TransformPoint(inputPoint); - OutputPointType upperLeftCorner = outputPoint; - /** END GX LAT LON */ // Create KML - Filename - PathName - tile number - North - South - East - West @@ -635,7 +634,7 @@ double south, double east, double west, - bool extended) + bool itkNotUsed(extended)) { // Give a name to the root file std::ostringstream kmlname; @@ -884,7 +883,7 @@ template void KmzProductWriter -::GenerateKMLExtended(const std::string& pathname, int depth, int x, int y, +::GenerateKMLExtended(const std::string& pathname, int depth, int itkNotUsed(x), int y, OutputPointType lowerLeft, OutputPointType lowerRight, OutputPointType upperRight, OutputPointType upperLeft) { @@ -940,7 +939,7 @@ void KmzProductWriter ::GenerateKML(const std::string& pathname, int depth, - int x, int y, double north, double south, + int itkNotUsed(x), int y, double north, double south, double east, double west) { std::ostringstream kmlname; @@ -991,10 +990,10 @@ void KmzProductWriter ::GenerateKMLExtendedWithLink(const std::string& pathname, - int depth, int x, int y, int tileStartX, int tileStartY, - OutputPointType lowerLeft, OutputPointType lowerRight, - OutputPointType upperRight, OutputPointType upperLeft, - double centerLong, double centerLat) + int depth, int itkNotUsed(x), int y, int tileStartX, int tileStartY, + OutputPointType lowerLeft, OutputPointType lowerRight, + OutputPointType upperRight, OutputPointType upperLeft, + double centerLong, double centerLat) { std::ostringstream kmlname; kmlname << pathname; @@ -1176,8 +1175,8 @@ void KmzProductWriter ::GenerateKMLWithLink(const std::string& pathname, - int depth, int x, int y, int tileStartX, int tileStartY, - double north, double south, double east, double west, double centerLong, double centerLat) + int depth, int itkNotUsed(x), int y, int tileStartX, int tileStartY, + double north, double south, double east, double west, double centerLong, double centerLat) { std::ostringstream kmlname; kmlname << pathname; @@ -1403,7 +1402,7 @@ template std::string KmzProductWriter -::GetCuttenFileName(const std::string& description, unsigned int idx) +::GetCuttenFileName(const std::string& itkNotUsed(description), unsigned int idx) { std::string currentImageName; std::string tempName; diff -Nru otb-4.0.0/Code/IO/otbLUMImageIO.cxx otb-4.2.0/Code/IO/otbLUMImageIO.cxx --- otb-4.0.0/Code/IO/otbLUMImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbLUMImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,9 +46,10 @@ // Set default spacing to one m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to [0.5 , 0.5] + // (consistency between ImageIO, see Mantis #942) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_FlagWriteImageInformation = true; diff -Nru otb-4.0.0/Code/IO/otbMapFileProductWriter.txx otb-4.2.0/Code/IO/otbMapFileProductWriter.txx --- otb-4.0.0/Code/IO/otbMapFileProductWriter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbMapFileProductWriter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -365,39 +365,36 @@ m_Transform->InstanciateTransform(); InputPointType inputPoint; - IndexType indexTile; SizeType sizeTile; sizeTile = extractSize; /** GX LAT LON **/ + // Compute upper left corner + itk::ContinuousIndex indexTile(extractIndex); + indexTile[0] += -0.5; + indexTile[1] += -0.5; + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); + OutputPointType upperLeftCorner = m_Transform->TransformPoint(inputPoint); + //std::cout <<"indexTile "<< indexTile <<" --> input Point "<< inputPoint << " upperLeftCorner "<< upperLeftCorner << std::endl; + // Compute lower left corner - indexTile[0] = extractIndex[0]; - indexTile[1] = extractIndex[1] + sizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[1] += static_cast(sizeTile[1]); + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); OutputPointType lowerLeftCorner = m_Transform->TransformPoint(inputPoint); //std::cout <<"indexTile "<< indexTile <<" --> input Point "<< inputPoint << " lowerLeftCorner "<< lowerLeftCorner << std::endl; // Compute lower right corner - indexTile[0] = extractIndex[0] + sizeTile[0]; - indexTile[1] = extractIndex[1] + sizeTile[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[0] += static_cast(sizeTile[0]); + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); OutputPointType lowerRightCorner = m_Transform->TransformPoint(inputPoint); //std::cout <<"indexTile "<< indexTile <<" --> input Point "<< inputPoint << " lowerRightCorner "<< lowerRightCorner << std::endl; // Compute upper right corner - indexTile[0] = extractIndex[0]+ sizeTile[0]; - indexTile[1] = extractIndex[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); + indexTile[1] -= static_cast(sizeTile[1]); + m_ResampleVectorImage->TransformContinuousIndexToPhysicalPoint(indexTile, inputPoint); OutputPointType upperRightCorner = m_Transform->TransformPoint(inputPoint); //std::cout <<"indexTile "<< indexTile <<" --> input Point "<< inputPoint << " upperRightCorner "<< upperRightCorner << std::endl; - // Compute upper left corner - indexTile[0] = extractIndex[0]; - indexTile[1] = extractIndex[1]; - m_ResampleVectorImage->TransformIndexToPhysicalPoint(indexTile, inputPoint); - OutputPointType upperLeftCorner = m_Transform->TransformPoint(inputPoint); - //std::cout <<"indexTile "<< indexTile <<" --> input Point "<< inputPoint << " upperLeftCorner "<< upperLeftCorner << std::endl; - // Build The indexTile this->AddBBoxToIndexTile(lowerLeftCorner, lowerRightCorner, diff -Nru otb-4.0.0/Code/IO/otbMSTARImageIO.cxx otb-4.2.0/Code/IO/otbMSTARImageIO.cxx --- otb-4.0.0/Code/IO/otbMSTARImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbMSTARImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,8 +53,10 @@ m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to [0.5 , 0.5] + // (consistency between ImageIO, see Mantis #942) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_BytePerPixel = 0; diff -Nru otb-4.0.0/Code/IO/otbMWImageIO.cxx otb-4.2.0/Code/IO/otbMWImageIO.cxx --- otb-4.0.0/Code/IO/otbMWImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbMWImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,9 +46,10 @@ // Set default spacing to one m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to [0.5 , 0.5] + // (consistency between ImageIO, see Mantis #942) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_FlagWriteImageInformation = true; m_Ncom = 0; diff -Nru otb-4.0.0/Code/IO/otbONERAImageIO.cxx otb-4.2.0/Code/IO/otbONERAImageIO.cxx --- otb-4.0.0/Code/IO/otbONERAImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbONERAImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,9 +41,10 @@ // Set default spacing to one m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to [0.5 , 0.5] + // (consistency between ImageIO, see Mantis #942) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_FlagWriteImageInformation = true; diff -Nru otb-4.0.0/Code/IO/otbOpticalImageMetadataInterfaceFactory.cxx otb-4.2.0/Code/IO/otbOpticalImageMetadataInterfaceFactory.cxx --- otb-4.0.0/Code/IO/otbOpticalImageMetadataInterfaceFactory.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbOpticalImageMetadataInterfaceFactory.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbQuickBirdImageMetadataInterfaceFactory.h" #include "otbWorldView2ImageMetadataInterfaceFactory.h" #include "otbPleiadesImageMetadataInterfaceFactory.h" - +#include "otbSpot6ImageMetadataInterfaceFactory.h" #include "itkObjectFactoryBase.h" #include "itkMutexLock.h" @@ -91,6 +91,7 @@ itk::ObjectFactoryBase::RegisterFactory(QuickBirdImageMetadataInterfaceFactory::New()); itk::ObjectFactoryBase::RegisterFactory(WorldView2ImageMetadataInterfaceFactory::New()); itk::ObjectFactoryBase::RegisterFactory(PleiadesImageMetadataInterfaceFactory::New()); + itk::ObjectFactoryBase::RegisterFactory(Spot6ImageMetadataInterfaceFactory::New()); firstTime = false; } } diff -Nru otb-4.0.0/Code/IO/otbPleiadesImageMetadataInterface.cxx otb-4.2.0/Code/IO/otbPleiadesImageMetadataInterface.cxx --- otb-4.0.0/Code/IO/otbPleiadesImageMetadataInterface.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbPleiadesImageMetadataInterface.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,6 +24,8 @@ #include "otbImageKeywordlist.h" #include +//uyseful constants +#include namespace otb { @@ -78,7 +80,6 @@ { itkExceptionMacro(<< "Invalid Metadata, no Pleiades Image"); } - ImageKeywordlistType imageKeywordlist; if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) @@ -681,6 +682,13 @@ // MSD: for the moment take only topCenter value std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.incident_angle"); double value = atof(valueString.c_str()); + + //Convention use in input of atmospheric correction parameters computation is + //"90 - satOrientation". Pleiades does not seem to follow this convention so + //inverse the formula here to be able to take the angle read in the metadata + //as input for 6S + value = 90. - value; + return value; } @@ -704,12 +712,39 @@ { return 0; } + else if (!imageKeywordlist.HasKey("support_data.along_track_incidence_angle") || !imageKeywordlist.HasKey("support_data.across_track_incidence_angle")) + { + // MSD: for the moment take only topCenter value + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation"); + double cap = atof(valueString.c_str()); - // MSD: for the moment take only topCenter value - std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation"); - double satAz = atof(valueString.c_str()); + //return only orientation if across/along track incidence are not available + return cap; + } + else + { + //Got orientation and incidences angle which allow to compute satellite + // azimuthal angle + + // MSD: for the moment take only topCenter value + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation"); + double cap = atof(valueString.c_str()); + + valueString = imageKeywordlist.GetMetadataByKey("support_data.along_track_incidence_angle"); + double along = atof(valueString.c_str()); + + valueString = imageKeywordlist.GetMetadataByKey("support_data.across_track_incidence_angle"); + double ortho = atof(valueString.c_str()); + + //Compute Satellite azimuthal angle using the azimuthal angle and the along + //and across track incidence angle + + double satAz = (cap - vcl_atan2(vcl_tan(ortho * CONST_PI_180),vcl_tan(along * CONST_PI_180)) * CONST_180_PI); - return satAz; + satAz = fmod(satAz,360); + + return satAz; + } } PleiadesImageMetadataInterface::VariableLengthVectorType @@ -810,7 +845,7 @@ } else { - otbMsgDevMacro(<< "Pleiades detected: band 0 and 2 inverted"); + otbMsgDevMacro(<< "Pleiades detected: first file component is red band and third component is blue one"); if (i == 0) return 2; if (i == 2) return 0; } @@ -886,45 +921,12 @@ itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); } - int nbBands = this->GetNumberOfBands(); - std::string key = "support_data.band_name_list"; std::vector rgb(3); - // TODO MSD remove this limitation when we get a real pleiades image - // Band order in PHR products seems to be always the same : RGB => keep the flag off - bool realProduct = false; - if (realProduct) - { - if (imageKeywordlist.HasKey(key) && (nbBands > 1)) - { - std::string keywordStringBandNameList = imageKeywordlist.GetMetadataByKey(key); - std::vector bandNameList; - boost::trim(keywordStringBandNameList); - boost::split(bandNameList, keywordStringBandNameList, boost::is_any_of(" ")); - - for (int i = 0; i < nbBands && i < 3; i++) - { - size_t found; - found = bandNameList[i].find_first_not_of("B"); - rgb[i] = lexical_cast (bandNameList[i].at(found)); - } - } - else - { - // Default values - rgb[0] = 2; - rgb[1] = 1; - rgb[2] = 0; - } - } - else - { - // Default values for simulation product - rgb[0] = 0; - rgb[1] = 1; - rgb[2] = 2; - } + rgb[0] = 0; + rgb[1] = 1; + rgb[2] = 2; return rgb; } diff -Nru otb-4.0.0/Code/IO/otbRADImageIO.cxx otb-4.2.0/Code/IO/otbRADImageIO.cxx --- otb-4.0.0/Code/IO/otbRADImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbRADImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -57,9 +57,10 @@ // Set default spacing to one m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to [0.5 , 0.5] + // (consistency between ImageIO, see Mantis #942) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_ChannelsFile = NULL; m_FlagWriteImageInformation = true; diff -Nru otb-4.0.0/Code/IO/otbSpectralSensitivityReader.cxx otb-4.2.0/Code/IO/otbSpectralSensitivityReader.cxx --- otb-4.0.0/Code/IO/otbSpectralSensitivityReader.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbSpectralSensitivityReader.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -136,6 +136,14 @@ while (std::getline(file, line)) { + // Replace any tabulation by a space + std::string::size_type tabpos = line.find('\t'); + while (tabpos != std::string::npos) + { + line.at(tabpos) = ' '; + tabpos = line.find('\t'); + } + // Replace multiple spaces by a unique space std::unique(line.begin(), line.end(), SpectralSensitivityReader::BothAre(' ')); diff -Nru otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterface.cxx otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterface.cxx --- otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterface.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterface.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,3868 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + +#include "otbSpot6ImageMetadataInterface.h" + +#include +#include "otbMacro.h" +#include "itkMetaDataObject.h" +#include "otbImageKeywordlist.h" +#include + + +namespace otb +{ +using boost::lexical_cast; +using boost::bad_lexical_cast; + +Spot6ImageMetadataInterface +::Spot6ImageMetadataInterface() +{ +} + +bool +Spot6ImageMetadataInterface::CanRead() const +{ + std::string sensorID = GetSensorID(); + if (sensorID.find("SPOT 6") != std::string::npos) + return true; + else + return false; +} + +std::string +Spot6ImageMetadataInterface::GetInstrument() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (imageKeywordlist.HasKey("support_data.instrument")) + { + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.instrument"); + return valueString; + } + + return ""; +} + +std::string +Spot6ImageMetadataInterface::GetInstrumentIndex() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + if (imageKeywordlist.HasKey("support_data.instrument_index")) + { + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.instrument_index"); + return valueString; + } + + return ""; // Invalid value +} + +Spot6ImageMetadataInterface::VariableLengthVectorType +Spot6ImageMetadataInterface::GetSolarIrradiance() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + std::vector outputValues; + if (imageKeywordlist.HasKey("support_data.solar_irradiance")) + { + std::vector outputValuesString; + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.solar_irradiance"); + boost::trim(valueString); + boost::split(outputValuesString, valueString, boost::is_any_of(" ")); + for (unsigned int i = 0; i < outputValuesString.size(); ++i) + { + outputValues.push_back(atof(outputValuesString[i].c_str())); + } + } + + VariableLengthVectorType outputValuesVariableLengthVector; + outputValuesVariableLengthVector.SetSize(outputValues.size()); + outputValuesVariableLengthVector.Fill(0); + + if (outputValues.size() > 0) + { + for (unsigned int i = 0; i < outputValues.size(); ++i) + outputValuesVariableLengthVector[i] = outputValues[this->BandIndexToWavelengthPosition(i)]; + } + else + { + itkExceptionMacro("Invalid Physical Irradiance"); + } + + return outputValuesVariableLengthVector; +} + + +int +Spot6ImageMetadataInterface::GetDay() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.image_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date"); + std::vector outputValues; + + boost::split(outputValues, valueString, boost::is_any_of(" T:-.")); + + int value; + try + { + value = lexical_cast (outputValues[2]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Day"); + } + + return value; +} + +int +Spot6ImageMetadataInterface::GetMonth() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.image_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date"); + std::vector outputValues; + boost::split(outputValues, valueString, boost::is_any_of(" T:-.")); + + int value; + try + { + value = lexical_cast (outputValues[1]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Month"); + } + return value; +} + +int +Spot6ImageMetadataInterface::GetYear() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.image_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date"); + std::vector outputValues; + boost::split(outputValues, valueString, boost::is_any_of(" T:-.")); + + int value; + try + { + value = lexical_cast (outputValues[0]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Year"); + } + return value; +} + +int +Spot6ImageMetadataInterface::GetHour() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.image_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date"); + std::vector outputValues; + boost::split(outputValues, valueString, boost::is_any_of(" T:-.")); + + int value; + try + { + value = lexical_cast (outputValues[3]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Hour"); + } + return value; +} + +int +Spot6ImageMetadataInterface::GetMinute() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.image_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.image_date"); + std::vector outputValues; + boost::split(outputValues, valueString, boost::is_any_of(" T:-.")); + + int value; + try + { + value = lexical_cast (outputValues[4]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Minute"); + } + return value; +} + +int +Spot6ImageMetadataInterface::GetProductionDay() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.production_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.production_date"); + std::vector outputValues; + boost::split(outputValues, valueString, boost::is_any_of(" T:-")); + + int value; + try + { + value = lexical_cast (outputValues[2]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Day"); + } + return value; +} + +int +Spot6ImageMetadataInterface::GetProductionMonth() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.production_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.production_date"); + std::vector outputValues; + boost::split(outputValues, valueString, boost::is_any_of(" T:-")); + + int value; + try + { + value = lexical_cast (outputValues[1]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Month"); + } + return value; +} + +int +Spot6ImageMetadataInterface::GetProductionYear() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.production_date")) + { + return -1; + } + + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.production_date"); + std::vector outputValues; + boost::split(outputValues, valueString, boost::is_any_of(" T:-")); + + if (outputValues.size() <= 2) itkExceptionMacro(<< "Invalid Year"); + + int value; + try + { + value = lexical_cast (outputValues[0]); + } + catch (bad_lexical_cast &) + { + itkExceptionMacro(<< "Invalid Year"); + } + return value; +} + + +Spot6ImageMetadataInterface::VariableLengthVectorType +Spot6ImageMetadataInterface +::GetPhysicalBias() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + std::vector outputValues; + if (imageKeywordlist.HasKey("support_data.physical_bias")) + { + std::vector outputValuesString; + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.physical_bias"); + boost::trim(valueString); + boost::split(outputValuesString, valueString, boost::is_any_of(" ")); + for (unsigned int i = 0; i < outputValuesString.size(); ++i) + { + outputValues.push_back(atof(outputValuesString[i].c_str())); + } + } + + VariableLengthVectorType outputValuesVariableLengthVector; + outputValuesVariableLengthVector.SetSize(outputValues.size()); + outputValuesVariableLengthVector.Fill(0); + + if (outputValues.size() > 0) + { + for (unsigned int i = 0; i < outputValues.size(); ++i) + outputValuesVariableLengthVector[i] = outputValues[this->BandIndexToWavelengthPosition(i)]; + } + else + { + itkExceptionMacro("Invalid Physical Bias"); + } + + return outputValuesVariableLengthVector; +} + +Spot6ImageMetadataInterface::VariableLengthVectorType +Spot6ImageMetadataInterface +::GetPhysicalGain() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + std::vector outputValues; + if (imageKeywordlist.HasKey("support_data.physical_gain")) + { + std::vector outputValuesString; + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.physical_gain"); + boost::trim(valueString); + boost::split(outputValuesString, valueString, boost::is_any_of(" ")); + for (unsigned int i = 0; i < outputValuesString.size(); ++i) + { + outputValues.push_back(atof(outputValuesString[i].c_str())); + } + } + + VariableLengthVectorType outputValuesVariableLengthVector; + outputValuesVariableLengthVector.SetSize(outputValues.size()); + outputValuesVariableLengthVector.Fill(0); + + if (outputValues.size() > 0) + { + for (unsigned int i = 0; i < outputValues.size(); ++i) + outputValuesVariableLengthVector[i] = outputValues[this->BandIndexToWavelengthPosition(i)]; + } + else + { + itkExceptionMacro("Invalid Physical Bias"); + } + + return outputValuesVariableLengthVector; +} + + +double +Spot6ImageMetadataInterface::GetSatElevation() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.incident_angle")) + { + return 0; + } + + // MSD: for the moment take only topCenter value + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.incident_angle"); + double value = atof(valueString.c_str()); + return value; +} + +double +Spot6ImageMetadataInterface::GetSatAzimuth() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + if (!imageKeywordlist.HasKey("support_data.scene_orientation")) + { + return 0; + } + + // MSD: for the moment take only topCenter value + std::string valueString = imageKeywordlist.GetMetadataByKey("support_data.scene_orientation"); + double satAz = atof(valueString.c_str()); + + return satAz; +} + +Spot6ImageMetadataInterface::VariableLengthVectorType +Spot6ImageMetadataInterface +::GetFirstWavelengths() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + int nbBands = this->GetNumberOfBands(); + std::string sensorId = this->GetSensorID(); + + // Panchromatic case + if (nbBands == 1) + { + wavel.SetSize(1); + wavel.Fill(0.455); // todo + } + else if (nbBands > 1 && nbBands < 5) // todo + { + wavel.SetSize(4); + wavel[0] = 0.454; + wavel[1] = 0.527; + wavel[2] = 0.624; + wavel[3] = 0.756; + } + else itkExceptionMacro(<< "Invalid number of bands..."); + + return wavel; +} + +Spot6ImageMetadataInterface::VariableLengthVectorType +Spot6ImageMetadataInterface +::GetLastWavelengths() const +{ + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + VariableLengthVectorType wavel(1); + wavel.Fill(0.); + + int nbBands = this->GetNumberOfBands(); + + // Panchromatic case + if (nbBands == 1) // todo + { + wavel.SetSize(1); + wavel.Fill(0.744); + } + else if (nbBands > 1 && nbBands < 5) // todo + { + wavel.SetSize(4); + wavel[0] = 0.519; + wavel[1] = 0.587; + wavel[2] = 0.694; + wavel[3] = 0.880; + } + else itkExceptionMacro(<< "Invalid number of bands..."); + + return wavel; +} + +// TODO MSD need to update this function +// Comment this part as relative response +// FIXME check if this is coherent with other sensor +unsigned int +Spot6ImageMetadataInterface +::BandIndexToWavelengthPosition(unsigned int i) const // todo +{ + int nbBands = this->GetNumberOfBands(); + //Panchromatic case + if (nbBands == 1) + { + return 0; + } + else + { + otbMsgDevMacro(<< "Spot6 detected: first file component is red band and third component is blue one"); + if (i == 0) return 2; + if (i == 2) return 0; + } + + return i; +} + +std::vector +Spot6ImageMetadataInterface +::GetEnhancedBandNames() const // todo +{ + std::vector enhBandNames; + std::vector rawBandNames = this->Superclass::GetBandName(); + + if(rawBandNames.size()) + { + for (std::vector::iterator it = rawBandNames.begin(); it != rawBandNames.end(); ++it) + { + // Manage Panchro case + if ( (rawBandNames.size() == 1) && !(*it).compare("P") ) + { + enhBandNames.push_back("PAN"); + break; + } + else if ((rawBandNames.size() != 1) && !(*it).compare("P")) + { + /* Launch exception situation not valid*/ + itkExceptionMacro(<< "Invalid Metadata, we cannot provide an consistent name to the band"); + } + + // Manage MS case + if ( !(*it).compare("B0") ) + { + enhBandNames.push_back("Blue"); + } + else if ( !(*it).compare("B1") ) + { + enhBandNames.push_back("Green"); + } + else if ( !(*it).compare("B2") ) + { + enhBandNames.push_back("Red"); + } + else if ( !(*it).compare("B3") ) + { + enhBandNames.push_back("NIR"); + } + else + { + enhBandNames.push_back("Unknown"); + } + } + } + + return enhBandNames; + +} + +std::vector +Spot6ImageMetadataInterface +::GetDefaultDisplay() const // todo +{ + + std::vector rgb(3); + rgb[0] = 0; + rgb[1] = 1; + rgb[2] = 2; + return rgb; + +} + +Spot6ImageMetadataInterface::WavelengthSpectralBandVectorType +Spot6ImageMetadataInterface +::GetSpectralSensitivity() const // todo +{ + //TODO tabulate spectral responses + WavelengthSpectralBandVectorType wavelengthSpectralBand = InternalWavelengthSpectralBandVectorType::New(); + + std::list > tmpSpectralBandList; + + const MetaDataDictionaryType& dict = this->GetMetaDataDictionary(); + if (!this->CanRead()) + { + itkExceptionMacro(<< "Invalid Metadata, no Spot6 Image"); + } + + ImageKeywordlistType imageKeywordlist; + + if (dict.HasKey(MetaDataKey::OSSIMKeywordlistKey)) + { + itk::ExposeMetaData(dict, MetaDataKey::OSSIMKeywordlistKey, imageKeywordlist); + } + + const int nbBands = this->GetNumberOfBands(); + const std::string sensorId = this->GetSensorID(); + + // Panchromatic case + if (nbBands == 1) + { + //if (sensorId.find("PHR") != std::string::npos) + if (sensorId == "SPOT 6") // todo + { + const float pan[601] = + { +0.00007493, +0.00008750, +0.00009848, +0.00010843, +0.00011646, +0.00012259, +0.00012552, +0.00012814, +0.00013531, +0.00015014, +0.00017236, +0.00019564, +0.00021235, +0.00022348, +0.00022676, +0.00022299, +0.00021213, +0.00020083, +0.00019926, +0.00021359, +0.00025083, +0.00030983, +0.00038670, +0.00047229, +0.00056950, +0.00067560, +0.00078669, +0.00090069, +0.00103421, +0.00131540, +0.00169029, +0.00228198, +0.00312648, +0.00417071, +0.00533582, +0.00661006, +0.00802817, +0.00960467, +0.01132980, +0.01334611, +0.01609231, +0.02038299, +0.02732543, +0.03802347, +0.05294767, +0.07167096, +0.09348728, +0.11872659, +0.14830802, +0.18269957, +0.22269040, +0.26906796, +0.32263521, +0.38325366, +0.44824011, +0.51559417, +0.58258589, +0.64645021, +0.70236661, +0.74583583, +0.77585237, +0.79433792, +0.80499388, +0.81090952, +0.81371638, +0.81431418, +0.81316313, +0.81141755, +0.81097193, +0.81322836, +0.81878063, +0.82800769, +0.83916423, +0.85084085, +0.86161004, +0.87040692, +0.87637562, +0.87967534, +0.88047879, +0.88112137, +0.88175192, +0.88365397, +0.88759508, +0.89291809, +0.89912245, +0.90543957, +0.91146456, +0.91547923, +0.91843965, +0.91963891, +0.91975983, +0.91963913, +0.91947516, +0.92025788, +0.92260193, +0.92575482, +0.93070662, +0.93550391, +0.94001389, +0.94383039, +0.94609629, +0.94688618, +0.94624211, +0.94455744, +0.94265988, +0.94120799, +0.94079078, +0.94176327, +0.94473408, +0.94915584, +0.95419339, +0.95954236, +0.96459688, +0.96902841, +0.97179112, +0.97317857, +0.97320070, +0.97218736, +0.97091309, +0.97035732, +0.96996616, +0.97140258, +0.97376942, +0.97636229, +0.97957895, +0.98311659, +0.98550114, +0.98688700, +0.98705275, +0.98569258, +0.98301588, +0.97915984, +0.97493690, +0.97129138, +0.96813872, +0.96649466, +0.96685400, +0.96849224, +0.97201807, +0.97702694, +0.98197923, +0.98753229, +0.99230951, +0.99540351, +0.99740084, +0.99730413, +0.99558763, +0.99262103, +0.98803927, +0.98368879, +0.97966358, +0.97601679, +0.97409076, +0.97356455, +0.97460306, +0.97733165, +0.98142794, +0.98607299, +0.99104944, +0.99556304, +0.99892911, +1.00128281, +1.00206838, +1.00124192, +0.99879621, +0.99466280, +0.99032401, +0.98568114, +0.98102690, +0.97756954, +0.97495949, +0.97366152, +0.97436348, +0.97596613, +0.97930722, +0.98307748, +0.98726114, +0.99154671, +0.99533904, +0.99803299, +0.99950550, +1.00000000, +0.99848218, +0.99593416, +0.99288307, +0.98834389, +0.98366197, +0.97971238, +0.97601117, +0.97307044, +0.97155305, +0.97102663, +0.97152475, +0.97341779, +0.97585074, +0.97896590, +0.98255796, +0.98543794, +0.98789503, +0.98994151, +0.99059899, +0.99029895, +0.98922305, +0.98676544, +0.98389430, +0.98067297, +0.97675508, +0.97324400, +0.97055473, +0.96803100, +0.96629732, +0.96561899, +0.96564173, +0.96639591, +0.96771777, +0.96934976, +0.97124886, +0.97291816, +0.97432735, +0.97530655, +0.97542227, +0.97463623, +0.97308990, +0.97065297, +0.96750332, +0.96379792, +0.95963369, +0.95522586, +0.95099476, +0.94711647, +0.94373897, +0.94086191, +0.93909609, +0.93751312, +0.93716161, +0.93749275, +0.93844552, +0.93992284, +0.94157292, +0.94327292, +0.94494878, +0.94621266, +0.94689150, +0.94695971, +0.94601526, +0.94485162, +0.94216490, +0.93936780, +0.93516770, +0.93117984, +0.92600825, +0.92184558, +0.91679022, +0.91281220, +0.90873714, +0.90559995, +0.90280144, +0.90151379, +0.90018969, +0.90026306, +0.90055224, +0.90169504, +0.90303974, +0.90479165, +0.90660298, +0.90788333, +0.90928294, +0.90961910, +0.91044105, +0.90941307, +0.90884628, +0.90648792, +0.90426184, +0.90090015, +0.89728707, +0.89360311, +0.88921759, +0.88536863, +0.88109823, +0.87784434, +0.87367129, +0.87100044, +0.86849439, +0.86645265, +0.86555715, +0.86486409, +0.86444275, +0.86462554, +0.86421244, +0.86509991, +0.86504142, +0.86574075, +0.86547448, +0.86537728, +0.86481040, +0.86329140, +0.86242059, +0.85986818, +0.85807444, +0.85502168, +0.85224705, +0.84852762, +0.84517422, +0.84157685, +0.83807810, +0.83443274, +0.83120263, +0.82819085, +0.82520041, +0.82259510, +0.82050631, +0.81863236, +0.81673157, +0.81518962, +0.81376687, +0.81276571, +0.81111987, +0.81039972, +0.80884166, +0.80742716, +0.80605476, +0.80328088, +0.80094601, +0.79797843, +0.79448406, +0.79079478, +0.78664955, +0.78403080, +0.77837404, +0.77671056, +0.77071265, +0.76860809, +0.76568459, +0.76096821, +0.75943556, +0.75440145, +0.74853854, +0.73756232, +0.72050194, +0.69619742, +0.66466129, +0.62570237, +0.58042003, +0.52946690, +0.47429123, +0.41572304, +0.35577781, +0.29694274, +0.24182875, +0.19245049, +0.15026362, +0.11482153, +0.08854978, +0.06698482, +0.05109390, +0.03916000, +0.03018623, +0.02342899, +0.01832614, +0.01444326, +0.01147024, +0.00918513, +0.00740254, +0.00609562, +0.00491959, +0.00435297, +0.00335678, +0.00291823, +0.00234224, +0.00205113, +0.00167084, +0.00145104, +0.00124552, +0.00104170, +0.00108470, +0.00077931, +0.00084497, +0.00059188, +0.00063835, +0.00045747, +0.00040248, +0.00043271, +0.00031792, +0.00033871, +0.00025452, +0.00026931, +0.00020572, +0.00018559, +0.00019577, +0.00015320, +0.00016086, +0.00012704, +0.00011590, +0.00012165, +0.00009829, +0.00010178, +0.00008372, +0.00007722, +0.00008098, +0.00007448, +0.00006262, +0.00006513, +0.00005514, +0.00005663, +0.00004857, +0.00004996, +0.00004369, +0.00004402, +0.00003879, +0.00003626, +0.00003796, +0.00003303, +0.00003435, +0.00003053, +0.00003118, +0.00002826, +0.00002628, +0.00002754, +0.00002484, +0.00002559, +0.00002406, +0.00002348, +0.00002237, +0.00002233, +0.00002269, +0.00002170, +0.00001996, +0.00002062, +0.00001880, +0.00002003, +0.00001893, +0.00001935, +0.00001823, +0.00001794, +0.00001879, +0.00001726, +0.00001797, +0.00001774, +0.00001520, +0.00001784, +0.00001500, +0.00001790, +0.00001464, +0.00001317, +0.00001633, +0.00001127, +0.00001471, +0.00001314, +0.00001114, +0.00000968, +0.00001262, +0.00001126, +0.00002112, +0.00001135, +0.00001674, +0.00001146, +0.00001572, +0.00002157, +0.00001166, +0.00002111, +0.00001206, +0.00002362, +0.00002815, +0.00001740, +0.00001816, +0.00002519, +0.00001627, +0.00002405, +0.00002027, +0.00002469, +0.00002124, +0.00001758, +0.00002971, +0.00002051, +0.00002437, +0.00002119, +0.00001926, +0.00001850, +0.00001774, +0.00002056, +0.00002202, +0.00001602, +0.00001436, +0.00001710, +0.00001369, +0.00001827, +0.00001218, +0.00001567, +0.00001596, +0.00001348, +0.00001857, +0.00001662, +0.00001805, +0.00002361, +0.00001927, +0.00003019, +0.00003036, +0.00003602, +0.00003469, +0.00004530, +0.00004918, +0.00005892, +0.00005708, +0.00006488, +0.00006319, +0.00007284, +0.00006971, +0.00007822, +0.00007143, +0.00007223, +0.00007024, +0.00007097, +0.00007120, +0.00006619, +0.00006294, +0.00005778, +0.00005333, +0.00005405, +0.00004915, +0.00004779, +0.00004379, +0.00004087, +0.00003311, +0.00003608, +0.00003592, +0.00002213, +0.00002159, +0.00002350, +0.00001705, +0.00002055, +0.00001764, +0.00001453, +0.00001636, +0.00001197, +0.00001123, +0.00001127, +0.00001042, +0.00001021, +0.00001099, +0.00001171, +0.00001030, +0.00001236, +0.00001192, +0.00000823, +0.00000820, +0.00000893, +0.00001115, +0.00001001, +0.00000802, +0.00000976, +0.00000966, +0.00000957, +0.00000726, +0.00000967, +0.00001001, +0.00000803, +0.00000726, +0.00000739, +0.00000845, +0.00000698, +0.00000568, +0.00000472, +0.00000650, +0.00000706, +0.00000546, +0.00000433, +0.00000607, +0.00000408, +0.00000788, +0.00000464, +0.00000958, +0.00000689, +0.00000976, +0.00000672, +0.00000574, +0.00000980, +0.00000503, +0.00000796, +0.00000325, +0.00000636, +0.00000334, +0.00000562, +0.00000413, +0.00000400, +0.00000610, +0.00000240, +0.00000486, +0.00000262, +0.00000333, +0.00000152, +0.00000236, +0.00000152, +0.00000228, +0.00000070, +0.00000185, +0.00000162, +0.00000093, +0.00000188, +0.00000116, +0.00000041, +0.00000126 + }; + //add panchromatic band to the temporary list + const std::vector vpan (pan, pan + sizeof(pan) / sizeof(float) ); + tmpSpectralBandList.push_back(vpan); + } + else + { + itkExceptionMacro(<< "Invalid Spot6 Sensor ID"); + } + } + else if (nbBands > 1 && nbBands < 5) + { + if (sensorId == "SPOT 6") // todo + { + //band B0 (blue band) + const float b0[601] = + { +0.00006627, +0.00006114, +0.00005964, +0.00006755, +0.00007354, +0.00007335, +0.00007303, +0.00006988, +0.00006669, +0.00006467, +0.00008891, +0.00010731, +0.00006420, +0.00008781, +0.00008978, +0.00008292, +0.00008193, +0.00005499, +0.00008203, +0.00011262, +0.00009092, +0.00010575, +0.00013926, +0.00016613, +0.00019666, +0.00019375, +0.00021841, +0.00033008, +0.00059283, +0.00096710, +0.00120426, +0.00143132, +0.00190776, +0.00246548, +0.00314995, +0.00393858, +0.00502501, +0.00693758, +0.00995331, +0.01395395, +0.01816332, +0.02248784, +0.02806060, +0.03582005, +0.04774668, +0.06795621, +0.09842750, +0.13108997, +0.16221496, +0.20486488, +0.26488470, +0.33784410, +0.41558626, +0.48567541, +0.54882896, +0.61466150, +0.68475833, +0.75228611, +0.80736646, +0.84246227, +0.85754473, +0.85841741, +0.85407547, +0.85129313, +0.85144931, +0.85321674, +0.85405128, +0.85387063, +0.85555834, +0.86252514, +0.87558536, +0.89251130, +0.90900546, +0.92154349, +0.92918777, +0.93306769, +0.93515923, +0.93666027, +0.93739349, +0.93661481, +0.93379608, +0.92929650, +0.92442581, +0.92058032, +0.91895381, +0.92090421, +0.92631122, +0.93455782, +0.94463030, +0.95473194, +0.96364502, +0.97043568, +0.97436437, +0.97495098, +0.97200508, +0.96636029, +0.95962307, +0.95371958, +0.95061152, +0.95192705, +0.95818895, +0.96856416, +0.98070274, +0.99142860, +0.99788650, +1.00000000, +0.99910819, +0.99808156, +0.99650360, +0.99314712, +0.98404465, +0.96550845, +0.93867401, +0.90804427, +0.87480177, +0.83387151, +0.77606904, +0.69859059, +0.60871934, +0.51759429, +0.43125686, +0.34977809, +0.27392459, +0.20473488, +0.14738691, +0.10459452, +0.07555179, +0.05654570, +0.04380857, +0.03477386, +0.02793581, +0.02225302, +0.01751704, +0.01359022, +0.01046026, +0.00814691, +0.00649078, +0.00530930, +0.00446096, +0.00383097, +0.00333164, +0.00292664, +0.00257637, +0.00225949, +0.00198202, +0.00172287, +0.00150439, +0.00130359, +0.00113903, +0.00099076, +0.00086925, +0.00076142, +0.00067853, +0.00060841, +0.00055953, +0.00051880, +0.00049699, +0.00047445, +0.00045863, +0.00044229, +0.00042470, +0.00040647, +0.00038780, +0.00035963, +0.00033330, +0.00029660, +0.00027179, +0.00024451, +0.00022875, +0.00021524, +0.00021255, +0.00021004, +0.00021079, +0.00021138, +0.00021521, +0.00021336, +0.00021459, +0.00020993, +0.00020747, +0.00019888, +0.00019065, +0.00018249, +0.00017164, +0.00016473, +0.00015826, +0.00015437, +0.00015378, +0.00015002, +0.00015089, +0.00015050, +0.00015245, +0.00015136, +0.00015264, +0.00015147, +0.00015009, +0.00014792, +0.00014493, +0.00014083, +0.00013665, +0.00013056, +0.00012700, +0.00012212, +0.00011620, +0.00011384, +0.00010918, +0.00010782, +0.00010377, +0.00010231, +0.00010126, +0.00010021, +0.00009925, +0.00009923, +0.00009906, +0.00009850, +0.00009892, +0.00009742, +0.00009802, +0.00009809, +0.00009662, +0.00009692, +0.00009575, +0.00009546, +0.00009575, +0.00009469, +0.00009485, +0.00009453, +0.00009384, +0.00009463, +0.00009451, +0.00009458, +0.00009520, +0.00009478, +0.00009588, +0.00009579, +0.00009545, +0.00009560, +0.00009549, +0.00009549, +0.00009551, +0.00009535, +0.00009579, +0.00009570, +0.00009544, +0.00009552, +0.00009622, +0.00009645, +0.00009648, +0.00009799, +0.00009797, +0.00009864, +0.00009916, +0.00010183, +0.00010153, +0.00010358, +0.00010461, +0.00010712, +0.00010718, +0.00011085, +0.00011321, +0.00011173, +0.00011398, +0.00011982, +0.00011831, +0.00012135, +0.00012902, +0.00012720, +0.00013658, +0.00013538, +0.00014397, +0.00014356, +0.00015119, +0.00015202, +0.00015693, +0.00015686, +0.00015130, +0.00015184, +0.00013690, +0.00013092, +0.00013335, +0.00011361, +0.00010715, +0.00010823, +0.00009932, +0.00009856, +0.00009765, +0.00009914, +0.00010008, +0.00010777, +0.00010686, +0.00011218, +0.00012769, +0.00012456, +0.00014074, +0.00014680, +0.00014400, +0.00015360, +0.00015552, +0.00015166, +0.00015221, +0.00014625, +0.00014561, +0.00013613, +0.00013172, +0.00013242, +0.00012141, +0.00012300, +0.00011836, +0.00010821, +0.00010974, +0.00010309, +0.00010302, +0.00010127, +0.00009629, +0.00009854, +0.00009280, +0.00009475, +0.00009054, +0.00009196, +0.00008822, +0.00008866, +0.00008744, +0.00008550, +0.00008673, +0.00008483, +0.00008628, +0.00008449, +0.00009254, +0.00008532, +0.00009594, +0.00008917, +0.00009084, +0.00010183, +0.00009128, +0.00010000, +0.00008800, +0.00009430, +0.00008055, +0.00008475, +0.00007796, +0.00007850, +0.00007713, +0.00007770, +0.00007623, +0.00007664, +0.00007474, +0.00007405, +0.00007519, +0.00007318, +0.00007349, +0.00007204, +0.00007375, +0.00007369, +0.00007149, +0.00007148, +0.00007312, +0.00007167, +0.00007255, +0.00007120, +0.00007186, +0.00007087, +0.00007145, +0.00007024, +0.00007096, +0.00007041, +0.00007088, +0.00006995, +0.00007149, +0.00006924, +0.00007103, +0.00006949, +0.00007093, +0.00006951, +0.00007194, +0.00007193, +0.00006859, +0.00006781, +0.00007056, +0.00006741, +0.00006870, +0.00006628, +0.00006687, +0.00006601, +0.00006595, +0.00006670, +0.00006450, +0.00006595, +0.00006433, +0.00006569, +0.00006431, +0.00006573, +0.00006406, +0.00006507, +0.00006298, +0.00006428, +0.00006201, +0.00006357, +0.00006101, +0.00006096, +0.00006309, +0.00006103, +0.00006314, +0.00006382, +0.00006164, +0.00006245, +0.00006061, +0.00005973, +0.00006261, +0.00005982, +0.00006197, +0.00005956, +0.00006099, +0.00005881, +0.00005972, +0.00006005, +0.00005691, +0.00005647, +0.00005823, +0.00005603, +0.00005759, +0.00005605, +0.00005558, +0.00005646, +0.00005480, +0.00005543, +0.00005551, +0.00005357, +0.00005295, +0.00005549, +0.00005286, +0.00005495, +0.00005278, +0.00005414, +0.00005475, +0.00005169, +0.00005307, +0.00005117, +0.00005068, +0.00005036, +0.00005270, +0.00004991, +0.00005177, +0.00005900, +0.00004889, +0.00006116, +0.00005285, +0.00006427, +0.00005589, +0.00006943, +0.00006195, +0.00007219, +0.00007275, +0.00006694, +0.00007232, +0.00006712, +0.00007044, +0.00006607, +0.00007040, +0.00007120, +0.00006047, +0.00006863, +0.00006547, +0.00005919, +0.00006852, +0.00005996, +0.00006589, +0.00006938, +0.00006013, +0.00007365, +0.00006702, +0.00007595, +0.00008089, +0.00006987, +0.00008784, +0.00007751, +0.00009504, +0.00010978, +0.00008984, +0.00012777, +0.00010534, +0.00014784, +0.00012341, +0.00017455, +0.00018601, +0.00015342, +0.00020484, +0.00017984, +0.00018931, +0.00022557, +0.00022780, +0.00021393, +0.00022939, +0.00023016, +0.00021920, +0.00021508, +0.00022046, +0.00020159, +0.00021016, +0.00018988, +0.00019842, +0.00017117, +0.00018205, +0.00015240, +0.00014443, +0.00015946, +0.00014629, +0.00012207, +0.00013127, +0.00010545, +0.00011422, +0.00009446, +0.00009843, +0.00008316, +0.00008914, +0.00008435, +0.00006511, +0.00007269, +0.00006160, +0.00006279, +0.00005814, +0.00005882, +0.00005406, +0.00005351, +0.00005183, +0.00005084, +0.00004786, +0.00004877, +0.00004859, +0.00004583, +0.00004279, +0.00004263, +0.00004130, +0.00004093, +0.00004059, +0.00004012, +0.00004037, +0.00004396, +0.00004304, +0.00004054, +0.00004200, +0.00004073, +0.00004199, +0.00004077, +0.00004125, +0.00003820, +0.00003723, +0.00003610, +0.00003503, +0.00003232, +0.00003214, +0.00003263, +0.00003065, +0.00003127, +0.00002955, +0.00002956, +0.00002840, +0.00002896, +0.00002780, +0.00002805, +0.00002680, +0.00002585, +0.00002704, +0.00002540, +0.00002576, +0.00002438, +0.00002409, +0.00002110, +0.00002288, +0.00001930, +0.00002147, +0.00001830, +0.00001907, +0.00001917, +0.00001634, +0.00001778, +0.00001705, +0.00001506, +0.00001555, +0.00001544, +0.00001376, +0.00001432, +0.00001256, +0.00001321, +0.00001143, +0.00001207, +0.00001040, +0.00001079, +0.00001077, +0.00000938, +0.00000992, +0.00000926, +0.00000875, +0.00000915, +0.00000791, +0.00000858, +0.00000757, +0.00000885, +0.00000740, +0.00000859, +0.00000871, +0.00000732, +0.00000711 + }; + //B1 green band + const float b1[601] = + { +0.00001010, +0.00001389, +0.00001902, +0.00001356, +0.00001327, +0.00002873, +0.00003122, +0.00002184, +0.00002860, +0.00002274, +0.00006723, +0.00008343, +0.00001226, +0.00006171, +0.00005563, +0.00004426, +0.00004539, +0.00000677, +0.00002035, +0.00001522, +0.00000528, +0.00001865, +0.00001834, +0.00002028, +0.00001608, +0.00000017, +0.00000057, +0.00001313, +0.00001658, +0.00000224, +0.00001983, +0.00001885, +0.00001859, +0.00001975, +0.00000023, +0.00000139, +0.00001634, +0.00001789, +0.00000616, +0.00002267, +0.00001903, +0.00001956, +0.00001844, +0.00000342, +0.00001448, +0.00001340, +0.00000774, +0.00001880, +0.00001632, +0.00001912, +0.00001915, +0.00000950, +0.00000865, +0.00000927, +0.00001089, +0.00001236, +0.00001349, +0.00001273, +0.00001062, +0.00000958, +0.00000938, +0.00000973, +0.00000998, +0.00001014, +0.00001042, +0.00001060, +0.00001115, +0.00001174, +0.00001254, +0.00001338, +0.00001400, +0.00001431, +0.00001481, +0.00001528, +0.00001646, +0.00001812, +0.00001991, +0.00002232, +0.00002548, +0.00002855, +0.00003235, +0.00003705, +0.00004200, +0.00004766, +0.00005414, +0.00006070, +0.00006821, +0.00007648, +0.00008464, +0.00009410, +0.00010524, +0.00011803, +0.00013402, +0.00015319, +0.00017614, +0.00020243, +0.00023094, +0.00026260, +0.00029673, +0.00033499, +0.00038048, +0.00043594, +0.00050952, +0.00061362, +0.00076395, +0.00097908, +0.00126923, +0.00163382, +0.00207590, +0.00261314, +0.00327921, +0.00413303, +0.00526369, +0.00684627, +0.00915649, +0.01267648, +0.01800685, +0.02585007, +0.03667779, +0.05118064, +0.07035894, +0.09617429, +0.13094754, +0.17727190, +0.23641290, +0.30751157, +0.38790047, +0.47436827, +0.56468213, +0.65643377, +0.74674718, +0.82841738, +0.89713046, +0.94858047, +0.98476388, +1.00572477, +1.01799762, +1.02241761, +1.02351216, +1.02270186, +1.02115905, +1.01965328, +1.01731773, +1.01540955, +1.01129946, +1.00955329, +1.00573235, +1.00407549, +1.00164097, +1.00130077, +0.99962912, +1.00130006, +1.00140898, +1.00384853, +1.00599723, +1.00910590, +1.01051975, +1.01099594, +1.00890543, +1.00483865, +0.99901144, +0.99220799, +0.98468953, +0.97823873, +0.97314859, +0.97022501, +0.96868569, +0.97004107, +0.97166154, +0.97626613, +0.98067188, +0.98683373, +0.99219054, +0.99666299, +1.00000000, +0.99912543, +0.99696320, +0.99036225, +0.98384547, +0.97519907, +0.96391617, +0.94573906, +0.91096960, +0.85904551, +0.79290657, +0.72361833, +0.65257621, +0.57623116, +0.48870213, +0.39405229, +0.29840580, +0.21347365, +0.14739732, +0.10143634, +0.07106678, +0.05101665, +0.03753145, +0.02803887, +0.02107987, +0.01582745, +0.01178705, +0.00868732, +0.00634606, +0.00461992, +0.00337907, +0.00250694, +0.00189987, +0.00147499, +0.00117574, +0.00096470, +0.00080813, +0.00069267, +0.00060187, +0.00053101, +0.00046977, +0.00041864, +0.00037515, +0.00033197, +0.00029595, +0.00026098, +0.00022974, +0.00020299, +0.00017878, +0.00015870, +0.00014470, +0.00012912, +0.00012281, +0.00011148, +0.00010580, +0.00010508, +0.00009942, +0.00009982, +0.00009664, +0.00009667, +0.00009589, +0.00009628, +0.00009600, +0.00009459, +0.00009484, +0.00009162, +0.00009246, +0.00008883, +0.00008616, +0.00008688, +0.00008318, +0.00008295, +0.00008153, +0.00008262, +0.00008265, +0.00008855, +0.00009224, +0.00008974, +0.00010120, +0.00010537, +0.00010299, +0.00011271, +0.00011213, +0.00011810, +0.00011639, +0.00011824, +0.00011152, +0.00011302, +0.00010361, +0.00010441, +0.00009482, +0.00009519, +0.00008675, +0.00008735, +0.00008078, +0.00008067, +0.00007509, +0.00007486, +0.00006895, +0.00006944, +0.00006375, +0.00006358, +0.00005878, +0.00005896, +0.00005523, +0.00005501, +0.00005343, +0.00005281, +0.00005140, +0.00005170, +0.00005134, +0.00005138, +0.00005107, +0.00005085, +0.00005096, +0.00005018, +0.00005046, +0.00004904, +0.00004833, +0.00004769, +0.00004781, +0.00004694, +0.00004600, +0.00004584, +0.00004562, +0.00004584, +0.00004525, +0.00004562, +0.00004612, +0.00004747, +0.00004854, +0.00004734, +0.00004932, +0.00004894, +0.00005047, +0.00004972, +0.00005030, +0.00005129, +0.00004999, +0.00005048, +0.00004864, +0.00004901, +0.00004923, +0.00004719, +0.00004950, +0.00004776, +0.00005348, +0.00005702, +0.00005214, +0.00006320, +0.00005556, +0.00007144, +0.00005903, +0.00005649, +0.00007807, +0.00004800, +0.00004042, +0.00005618, +0.00002571, +0.00003251, +0.00002175, +0.00000592, +0.00001077, +0.00000286, +0.00000380, +0.00000323, +0.00000149, +0.00000247, +0.00000112, +0.00000145, +0.00000111, +0.00000139, +0.00000105, +0.00000141, +0.00000097, +0.00000085, +0.00000123, +0.00000158, +0.00000089, +0.00000137, +0.00000086, +0.00000158, +0.00000202, +0.00000091, +0.00000174, +0.00000102, +0.00000200, +0.00000128, +0.00000479, +0.00000149, +0.00000719, +0.00000417, +0.00000502, +0.00000963, +0.00000561, +0.00000984, +0.00000949, +0.00000318, +0.00000643, +0.00000153, +0.00000184, +0.00000116, +0.00000173, +0.00000086, +0.00000185, +0.00000089, +0.00000193, +0.00000096, +0.00000196, +0.00000116, +0.00000200, +0.00000115, +0.00000195, +0.00000131, +0.00000197, +0.00000125, +0.00000187, +0.00000099, +0.00000070, +0.00000049, +0.00000119, +0.00000051, +0.00000135, +0.00000086, +0.00000153, +0.00000104, +0.00000186, +0.00000156, +0.00000205, +0.00000293, +0.00000170, +0.00000296, +0.00000182, +0.00000266, +0.00000171, +0.00000236, +0.00000240, +0.00000093, +0.00000174, +0.00000183, +0.00000096, +0.00000144, +0.00000177, +0.00000076, +0.00000198, +0.00000079, +0.00000160, +0.00000058, +0.00000154, +0.00000070, +0.00000161, +0.00000076, +0.00000068, +0.00000245, +0.00000079, +0.00000299, +0.00000128, +0.00000285, +0.00000154, +0.00000296, +0.00000178, +0.00000333, +0.00000130, +0.00000347, +0.00000220, +0.00000159, +0.00000449, +0.00000188, +0.00000635, +0.00000903, +0.00000344, +0.00001051, +0.00000601, +0.00000991, +0.00001299, +0.00000632, +0.00001514, +0.00000941, +0.00001426, +0.00000749, +0.00001524, +0.00000887, +0.00000743, +0.00001404, +0.00000558, +0.00001092, +0.00001135, +0.00000460, +0.00001024, +0.00000547, +0.00001036, +0.00000503, +0.00001140, +0.00000557, +0.00001124, +0.00000612, +0.00001120, +0.00000642, +0.00001093, +0.00000638, +0.00001191, +0.00000531, +0.00000907, +0.00000487, +0.00000794, +0.00000998, +0.00000316, +0.00000322, +0.00001260, +0.00000365, +0.00000446, +0.00001209, +0.00000567, +0.00001173, +0.00000705, +0.00001006, +0.00000466, +0.00000325, +0.00000921, +0.00000755, +0.00000493, +0.00000922, +0.00000673, +0.00001643, +0.00001135, +0.00001160, +0.00002335, +0.00001573, +0.00002364, +0.00001931, +0.00002613, +0.00002318, +0.00001698, +0.00001954, +0.00001127, +0.00001395, +0.00001618, +0.00000862, +0.00001383, +0.00000962, +0.00000696, +0.00000696, +0.00000561, +0.00000807, +0.00000905, +0.00000632, +0.00000850, +0.00000820, +0.00001222, +0.00000921, +0.00001027, +0.00001204, +0.00001323, +0.00001373, +0.00001579, +0.00001521, +0.00002156, +0.00001894, +0.00002375, +0.00002243, +0.00002409, +0.00002019, +0.00002182, +0.00001452, +0.00001755, +0.00001475, +0.00000805, +0.00001071, +0.00000537, +0.00000682, +0.00000663, +0.00000526, +0.00000418, +0.00000477, +0.00000426, +0.00000405, +0.00000367, +0.00000399, +0.00000340, +0.00000339, +0.00000169, +0.00000178, +0.00000242, +0.00000171, +0.00000172, +0.00000233, +0.00000182, +0.00000230, +0.00000204, +0.00000245, +0.00000243, +0.00000136, +0.00000259, +0.00000105, +0.00000239, +0.00000090, +0.00000213, +0.00000104, +0.00000226, +0.00000088, +0.00000229, +0.00000065, +0.00000246, +0.00000063, +0.00000238, +0.00000072, +0.00000210, +0.00000091, +0.00000122, +0.00000184, +0.00000177, +0.00000066, +0.00000153, +0.00000065, +0.00000147, +0.00000054, +0.00000145, +0.00000023, +0.00000134, +0.00000029, +0.00000141, +0.00000045, +0.00000127, +0.00000146, +0.00000040, +0.00000142, +0.00000038 + }; + //B2 red band + const float b2[601] = + { +0.00001168, +0.00001419, +0.00001348, +0.00000996, +0.00001009, +0.00001366, +0.00003289, +0.00001748, +0.00002207, +0.00002377, +0.00002383, +0.00002470, +0.00001811, +0.00001353, +0.00001155, +0.00001303, +0.00001374, +0.00001126, +0.00000712, +0.00000464, +0.00000438, +0.00000381, +0.00000312, +0.00000581, +0.00000319, +0.00000473, +0.00000585, +0.00000644, +0.00000967, +0.00000918, +0.00000742, +0.00001090, +0.00001649, +0.00002016, +0.00001631, +0.00001673, +0.00001578, +0.00001766, +0.00002209, +0.00003114, +0.00003091, +0.00001848, +0.00003451, +0.00003492, +0.00004332, +0.00004770, +0.00004658, +0.00004547, +0.00004239, +0.00005155, +0.00005834, +0.00006365, +0.00005824, +0.00004581, +0.00003799, +0.00003584, +0.00003689, +0.00003817, +0.00003951, +0.00004017, +0.00003987, +0.00003754, +0.00003651, +0.00003781, +0.00003645, +0.00003408, +0.00003160, +0.00003251, +0.00003509, +0.00003935, +0.00004494, +0.00005115, +0.00005707, +0.00006145, +0.00006038, +0.00005716, +0.00005354, +0.00004978, +0.00004759, +0.00004735, +0.00005985, +0.00006501, +0.00005803, +0.00006474, +0.00006650, +0.00006908, +0.00006585, +0.00005102, +0.00003616, +0.00002648, +0.00002034, +0.00001645, +0.00001363, +0.00001142, +0.00000950, +0.00000755, +0.00000648, +0.00000560, +0.00000476, +0.00000466, +0.00000444, +0.00000389, +0.00000408, +0.00000399, +0.00000392, +0.00000436, +0.00000413, +0.00000397, +0.00000424, +0.00000400, +0.00000389, +0.00000385, +0.00000390, +0.00000379, +0.00000357, +0.00000383, +0.00000386, +0.00000378, +0.00000439, +0.00000377, +0.00000416, +0.00000494, +0.00000455, +0.00000553, +0.00000605, +0.00000613, +0.00000672, +0.00000696, +0.00000744, +0.00000760, +0.00000766, +0.00000770, +0.00000725, +0.00000682, +0.00000716, +0.00000758, +0.00000759, +0.00000722, +0.00000805, +0.00000826, +0.00000816, +0.00000835, +0.00000798, +0.00000798, +0.00000796, +0.00000817, +0.00000856, +0.00000897, +0.00000920, +0.00000935, +0.00000980, +0.00001003, +0.00000998, +0.00001038, +0.00001044, +0.00001035, +0.00001090, +0.00001143, +0.00001155, +0.00001240, +0.00001322, +0.00001374, +0.00001466, +0.00001507, +0.00001561, +0.00001799, +0.00001806, +0.00001990, +0.00002207, +0.00002400, +0.00002768, +0.00003153, +0.00003519, +0.00003855, +0.00004048, +0.00004339, +0.00004685, +0.00004712, +0.00004885, +0.00005031, +0.00005058, +0.00005380, +0.00006109, +0.00006875, +0.00008360, +0.00010367, +0.00013385, +0.00017220, +0.00021349, +0.00025613, +0.00029745, +0.00033957, +0.00038077, +0.00042014, +0.00045664, +0.00049082, +0.00052462, +0.00057202, +0.00064046, +0.00073788, +0.00088389, +0.00109195, +0.00138377, +0.00179072, +0.00234897, +0.00310035, +0.00409611, +0.00539886, +0.00764596, +0.00982485, +0.01250677, +0.01576553, +0.01971871, +0.02460136, +0.03076162, +0.03870973, +0.04932564, +0.06405112, +0.08527458, +0.11683854, +0.16336997, +0.22811553, +0.30778033, +0.39105868, +0.46939880, +0.54633346, +0.62987089, +0.71765372, +0.80227884, +0.87400338, +0.92669327, +0.95728386, +0.97246242, +0.98093913, +0.98815314, +0.99512479, +1.00000000, +1.00071278, +0.99509151, +0.98322813, +0.96618038, +0.94726377, +0.92911907, +0.91427200, +0.90407257, +0.89868685, +0.89729260, +0.90048309, +0.90619876, +0.91486402, +0.92548194, +0.93716217, +0.95109280, +0.96341044, +0.97756310, +0.98873468, +1.00002059, +1.00784176, +1.01361246, +1.01518655, +1.01365106, +1.00889905, +1.00094470, +0.99098939, +0.97907661, +0.96736515, +0.95491923, +0.94403019, +0.93408742, +0.92588661, +0.91979557, +0.91551236, +0.91345541, +0.91406966, +0.91586446, +0.92112352, +0.92637606, +0.93343259, +0.93977000, +0.94511856, +0.94655018, +0.94482431, +0.93695460, +0.92470622, +0.90515848, +0.87651239, +0.84722733, +0.81626058, +0.77926628, +0.74095072, +0.69853161, +0.65530863, +0.60957078, +0.56408506, +0.51760530, +0.47150814, +0.42482252, +0.37706746, +0.32909071, +0.28093192, +0.23513938, +0.19289082, +0.15584587, +0.12438828, +0.09857760, +0.07759031, +0.06074302, +0.04708451, +0.03618668, +0.02749464, +0.02064713, +0.01533676, +0.01131374, +0.00832392, +0.00613477, +0.00454626, +0.00340798, +0.00258536, +0.00199356, +0.00156305, +0.00125005, +0.00101327, +0.00085049, +0.00071368, +0.00062520, +0.00054959, +0.00049985, +0.00047162, +0.00043891, +0.00042848, +0.00040347, +0.00038227, +0.00035692, +0.00033769, +0.00030789, +0.00029814, +0.00024879, +0.00021170, +0.00018471, +0.00013393, +0.00012509, +0.00007240, +0.00006419, +0.00003891, +0.00003294, +0.00002353, +0.00002711, +0.00001690, +0.00001474, +0.00001598, +0.00001292, +0.00001366, +0.00001329, +0.00001411, +0.00002354, +0.00009563, +0.00012882, +0.00011528, +0.00001687, +0.00015343, +0.00012777, +0.00015354, +0.00024298, +0.00015520, +0.00024274, +0.00012696, +0.00014910, +0.00000979, +0.00000629, +0.00000738, +0.00000483, +0.00000489, +0.00000536, +0.00000458, +0.00000528, +0.00000438, +0.00000475, +0.00000446, +0.00000488, +0.00000456, +0.00000547, +0.00000448, +0.00000478, +0.00000435, +0.00000470, +0.00000425, +0.00000458, +0.00000435, +0.00000380, +0.00000373, +0.00000298, +0.00000390, +0.00000278, +0.00000290, +0.00000277, +0.00000307, +0.00000247, +0.00000231, +0.00000301, +0.00000293, +0.00000319, +0.00000351, +0.00000323, +0.00000339, +0.00000318, +0.00000318, +0.00000396, +0.00000313, +0.00000364, +0.00000310, +0.00000419, +0.00000349, +0.00000396, +0.00000341, +0.00000365, +0.00000362, +0.00000290, +0.00000345, +0.00000289, +0.00000288, +0.00000429, +0.00000323, +0.00000329, +0.00000329, +0.00000455, +0.00000497, +0.00000353, +0.00000556, +0.00000383, +0.00000507, +0.00000482, +0.00000484, +0.00000546, +0.00000374, +0.00000601, +0.00000422, +0.00000512, +0.00000509, +0.00000286, +0.00000637, +0.00000539, +0.00000579, +0.00000462, +0.00000647, +0.00000604, +0.00000432, +0.00000662, +0.00000521, +0.00000680, +0.00001180, +0.00000638, +0.00000805, +0.00000389, +0.00001200, +0.00001134, +0.00000562, +0.00001181, +0.00000868, +0.00001541, +0.00001086, +0.00001222, +0.00000823, +0.00000960, +0.00000871, +0.00001051, +0.00001235, +0.00000864, +0.00001357, +0.00001158, +0.00001522, +0.00001091, +0.00001237, +0.00000928, +0.00000973, +0.00000865, +0.00001333, +0.00000847, +0.00001329, +0.00000740, +0.00000974, +0.00001229, +0.00001128, +0.00000704, +0.00001244, +0.00000915, +0.00001448, +0.00001164, +0.00000861, +0.00001441, +0.00000700, +0.00001461, +0.00001401, +0.00001007, +0.00001695, +0.00002042, +0.00002108, +0.00003064, +0.00003171, +0.00004339, +0.00004171, +0.00005692, +0.00007019, +0.00007121, +0.00007122, +0.00008504, +0.00007450, +0.00008010, +0.00008936, +0.00008826, +0.00008831, +0.00009721, +0.00009019, +0.00008741, +0.00008467, +0.00007373, +0.00006748, +0.00006984, +0.00005307, +0.00004844, +0.00005417, +0.00004482, +0.00004483, +0.00003814, +0.00003524, +0.00002726, +0.00002455, +0.00002566, +0.00002043, +0.00001759, +0.00001473, +0.00001512, +0.00001132, +0.00000862, +0.00001262, +0.00000857, +0.00000918, +0.00000689, +0.00000671, +0.00000434, +0.00000648, +0.00000513, +0.00000748, +0.00000691, +0.00000789, +0.00000754, +0.00000715, +0.00000806, +0.00000701, +0.00000449, +0.00000640, +0.00000595, +0.00000877, +0.00000724, +0.00000837, +0.00000733, +0.00000815, +0.00000621, +0.00000755, +0.00000444, +0.00000580, +0.00000524, +0.00000343, +0.00000356, +0.00000340, +0.00000361, +0.00000245, +0.00000146, +0.00000232, +0.00000165, +0.00000168, +0.00000491, +0.00000168, +0.00000411, +0.00000122, +0.00000367, +0.00000244, +0.00000179, +0.00000395, +0.00000177, +0.00000108, +0.00000330, +0.00000166, +0.00000258, +0.00000204, +0.00000054, +0.00000259, +0.00000133, +0.00000205, +0.00000101, +0.00000210, +0.00000084, +0.00000090, +0.00000176, +0.00000079, +0.00000165, +0.00000071, +0.00000173, +0.00000070, +0.00000043, +0.00000056, +0.00000159 + }; + //B3 nir band + const float b3[601] = + { +0.00000184, +0.00000202, +0.00000371, +0.00000470, +0.00000487, +0.00000512, +0.00000521, +0.00000490, +0.00000308, +0.00000160, +0.00000126, +0.00000131, +0.00000119, +0.00000105, +0.00000082, +0.00000078, +0.00000076, +0.00000059, +0.00000058, +0.00000052, +0.00000064, +0.00000070, +0.00000068, +0.00000068, +0.00000079, +0.00000093, +0.00000124, +0.00000092, +0.00000124, +0.00000117, +0.00000125, +0.00000129, +0.00000121, +0.00000153, +0.00000149, +0.00000148, +0.00000139, +0.00000166, +0.00000211, +0.00000193, +0.00000241, +0.00000211, +0.00000228, +0.00000294, +0.00000406, +0.00000507, +0.00001753, +0.00062612, +0.00099041, +0.00038281, +0.00084800, +0.00090343, +0.00098820, +0.00100027, +0.00030612, +0.00003473, +0.00002650, +0.00002396, +0.00002429, +0.00002735, +0.00003712, +0.00005612, +0.00007768, +0.00008914, +0.00009611, +0.00010759, +0.00011246, +0.00011011, +0.00009290, +0.00006854, +0.00005014, +0.00003890, +0.00003142, +0.00002673, +0.00002266, +0.00002061, +0.00002008, +0.00002029, +0.00002207, +0.00002564, +0.00003063, +0.00003885, +0.00004812, +0.00005996, +0.00007077, +0.00007965, +0.00008609, +0.00008841, +0.00008691, +0.00008090, +0.00007026, +0.00005867, +0.00004706, +0.00003684, +0.00002888, +0.00002252, +0.00001864, +0.00001631, +0.00001512, +0.00001579, +0.00001740, +0.00002076, +0.00002500, +0.00002970, +0.00003324, +0.00003568, +0.00003719, +0.00003637, +0.00003522, +0.00003204, +0.00002806, +0.00002554, +0.00002401, +0.00002509, +0.00002676, +0.00003097, +0.00003703, +0.00004613, +0.00006025, +0.00007876, +0.00010325, +0.00012473, +0.00014349, +0.00015902, +0.00017128, +0.00017677, +0.00017814, +0.00017111, +0.00016498, +0.00016271, +0.00016590, +0.00017244, +0.00018189, +0.00018854, +0.00019224, +0.00019405, +0.00019354, +0.00018898, +0.00018087, +0.00017218, +0.00016359, +0.00015899, +0.00015586, +0.00015606, +0.00015819, +0.00016068, +0.00016530, +0.00016816, +0.00017049, +0.00017164, +0.00017169, +0.00017074, +0.00017054, +0.00016913, +0.00016744, +0.00016766, +0.00016951, +0.00017426, +0.00018167, +0.00019232, +0.00020428, +0.00021790, +0.00023244, +0.00024402, +0.00025416, +0.00026158, +0.00026375, +0.00026297, +0.00026655, +0.00026988, +0.00027504, +0.00028070, +0.00028807, +0.00030046, +0.00031707, +0.00033920, +0.00036610, +0.00039570, +0.00043575, +0.00048703, +0.00053825, +0.00057909, +0.00060314, +0.00061674, +0.00061491, +0.00059039, +0.00054258, +0.00047833, +0.00039787, +0.00031987, +0.00025214, +0.00019590, +0.00015376, +0.00012305, +0.00010304, +0.00008730, +0.00007548, +0.00006686, +0.00006139, +0.00005448, +0.00005006, +0.00004759, +0.00004287, +0.00003904, +0.00003667, +0.00003331, +0.00003138, +0.00002877, +0.00002657, +0.00002417, +0.00002328, +0.00002129, +0.00002036, +0.00001896, +0.00001779, +0.00001738, +0.00001579, +0.00001598, +0.00001498, +0.00001430, +0.00001381, +0.00001310, +0.00001315, +0.00001249, +0.00001236, +0.00001250, +0.00001178, +0.00001194, +0.00001165, +0.00001136, +0.00001177, +0.00001162, +0.00001149, +0.00001162, +0.00001162, +0.00001183, +0.00001163, +0.00001211, +0.00001182, +0.00001142, +0.00001146, +0.00001129, +0.00001064, +0.00001038, +0.00001123, +0.00001061, +0.00001039, +0.00001007, +0.00001068, +0.00001053, +0.00001131, +0.00001150, +0.00001210, +0.00001199, +0.00001228, +0.00001244, +0.00001267, +0.00001226, +0.00001236, +0.00001242, +0.00001236, +0.00001227, +0.00001222, +0.00001218, +0.00001214, +0.00001206, +0.00001202, +0.00001242, +0.00001231, +0.00001283, +0.00001325, +0.00001395, +0.00001410, +0.00001399, +0.00001534, +0.00001580, +0.00001690, +0.00001748, +0.00001885, +0.00001898, +0.00001988, +0.00002137, +0.00002320, +0.00002504, +0.00002641, +0.00002837, +0.00003079, +0.00003251, +0.00003533, +0.00003740, +0.00004081, +0.00004361, +0.00004639, +0.00004986, +0.00005346, +0.00005805, +0.00006226, +0.00006694, +0.00007188, +0.00007800, +0.00008485, +0.00009055, +0.00010008, +0.00010713, +0.00011933, +0.00012975, +0.00014324, +0.00015785, +0.00017539, +0.00019507, +0.00021689, +0.00024318, +0.00027135, +0.00030518, +0.00034281, +0.00039712, +0.00044651, +0.00050188, +0.00056707, +0.00063984, +0.00072378, +0.00081879, +0.00092782, +0.00105511, +0.00120160, +0.00137088, +0.00156792, +0.00180276, +0.00207920, +0.00240799, +0.00280298, +0.00327494, +0.00384821, +0.00454832, +0.00540493, +0.00645469, +0.00774941, +0.00936399, +0.01137832, +0.01388118, +0.01700597, +0.02092752, +0.02586928, +0.03206911, +0.03985523, +0.04956652, +0.06173849, +0.07680296, +0.09550239, +0.11837088, +0.14615821, +0.19110224, +0.23178705, +0.27801636, +0.33031673, +0.38771033, +0.44914649, +0.51370254, +0.57939644, +0.64484781, +0.70835304, +0.76788190, +0.82252523, +0.87063314, +0.91086251, +0.94360264, +0.96734308, +0.98447500, +0.99402844, +0.99904759, +1.00000000, +0.99829749, +0.99534944, +0.99113813, +0.98712837, +0.98344438, +0.97955733, +0.97683333, +0.97381307, +0.97171326, +0.96937935, +0.96682308, +0.96494693, +0.96155704, +0.95914861, +0.95524656, +0.95141098, +0.94725240, +0.94238136, +0.93805030, +0.93299243, +0.92787669, +0.92261726, +0.91765026, +0.91344782, +0.90866986, +0.90481152, +0.90031693, +0.89720732, +0.89342505, +0.89040645, +0.88745245, +0.88446834, +0.88140255, +0.87825555, +0.87487903, +0.87077850, +0.86665463, +0.86193864, +0.85704385, +0.85203260, +0.84608531, +0.84067874, +0.83464870, +0.82847182, +0.82237664, +0.81646034, +0.81067178, +0.80547624, +0.79996761, +0.79538371, +0.79048464, +0.78593335, +0.78246221, +0.77854086, +0.77505353, +0.77183963, +0.76834628, +0.76559075, +0.76238953, +0.75915219, +0.75631414, +0.75288758, +0.74984835, +0.74648701, +0.74311251, +0.73936992, +0.73559705, +0.73163277, +0.72765295, +0.72334537, +0.71892768, +0.71424776, +0.70932732, +0.70417024, +0.69865547, +0.69314542, +0.68706957, +0.68120878, +0.67553032, +0.66989091, +0.66440763, +0.65922988, +0.65415969, +0.64965635, +0.64537477, +0.64153052, +0.63820324, +0.63506916, +0.63264959, +0.62992135, +0.62726732, +0.62445640, +0.62156999, +0.61847181, +0.61501909, +0.61133939, +0.60744762, +0.60314205, +0.59883705, +0.59425662, +0.58928886, +0.58381508, +0.57719033, +0.56857851, +0.55699311, +0.54163099, +0.52202898, +0.49847084, +0.47191641, +0.44270534, +0.41155122, +0.37843868, +0.34304355, +0.30590964, +0.26730226, +0.22805403, +0.18974714, +0.15369596, +0.12145605, +0.09413162, +0.07189929, +0.05457376, +0.04144546, +0.03158417, +0.02425525, +0.01879617, +0.01470317, +0.01163795, +0.00930858, +0.00744330, +0.00607348, +0.00501379, +0.00413379, +0.00347084, +0.00293573, +0.00250919, +0.00215786, +0.00186591, +0.00163284, +0.00142997, +0.00127599, +0.00112918, +0.00102171, +0.00091069, +0.00083541, +0.00075489, +0.00069931, +0.00063879, +0.00059080, +0.00055023, +0.00050660, +0.00047777, +0.00044789, +0.00041317, +0.00039493, +0.00035947, +0.00033744, +0.00031989, +0.00028719, +0.00027707, +0.00025430, +0.00023132, +0.00022543, +0.00019537, +0.00018380, +0.00016713, +0.00014542, +0.00013876, +0.00011616, +0.00011019, +0.00009086, +0.00009183, +0.00006774, +0.00006181, +0.00006360, +0.00004633, +0.00005224, +0.00003735, +0.00003902, +0.00002393, +0.00003180, +0.00001716, +0.00001762, +0.00002033, +0.00001262, +0.00001259, +0.00001118, +0.00001421, +0.00000830, +0.00001294, +0.00000699, +0.00000782, +0.00000718, +0.00000642, +0.00000548, +0.00000427, +0.00000417, +0.00000440, +0.00000377, +0.00000253, +0.00000456, +0.00000202, +0.00000373, +0.00000325, +0.00000341, +0.00000232, +0.00000301, +0.00000117, +0.00000319, +0.00000169, +0.00000286, +0.00000184, +0.00000260, +0.00000212, +0.00000293, +0.00000175, +0.00000229, +0.00000126, +0.00000232, +0.00000099, +0.00000250, +0.00000135, +0.00000090, +0.00000289, +0.00000070, +0.00000210, +0.00000118, +0.00000072, +0.00000182, +0.00000111 + }; + //Add multispectral bands to the temporary list + const std::vector vb0 (b0, b0 + sizeof(b0) / sizeof(float) ); + const std::vector vb1 (b1, b1 + sizeof(b1) / sizeof(float) ); + const std::vector vb2 (b2, b2 + sizeof(b2) / sizeof(float) ); + const std::vector vb3 (b3, b3 + sizeof(b3) / sizeof(float) ); + //For Spot6 MS image the order of band is: B2 B1 B0 B3 + //(BandIndexToWavelength method could be used here) + tmpSpectralBandList.push_back(vb2); + tmpSpectralBandList.push_back(vb1); + tmpSpectralBandList.push_back(vb0); + tmpSpectralBandList.push_back(vb3); + } + else + { + itkExceptionMacro(<< "Invalid Spot6 Sensor ID"); + } + } + else + { + itkExceptionMacro(<< "Invalid number of bands..."); + } + + unsigned int j = 0; + for (std::list >::const_iterator it = tmpSpectralBandList.begin(); it != tmpSpectralBandList.end(); ++it) + { + wavelengthSpectralBand->PushBack(FilterFunctionValues::New()); + wavelengthSpectralBand->GetNthElement(j)->SetFilterFunctionValues(*it); + wavelengthSpectralBand->GetNthElement(j)->SetMinSpectralValue(0.4); + wavelengthSpectralBand->GetNthElement(j)->SetMaxSpectralValue(1.0); + wavelengthSpectralBand->GetNthElement(j)->SetUserStep(0.001); + ++j; + } + return wavelengthSpectralBand; +} + +} // end namespace otb diff -Nru otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.cxx otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.cxx --- otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,60 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + + +#include +#include + +#include "otbMacro.h" + +#include "otbSpot6ImageMetadataInterfaceFactory.h" +#include "otbSpot6ImageMetadataInterface.h" + +#include "itkCreateObjectFunction.h" +#include "itkVersion.h" + +namespace otb +{ +Spot6ImageMetadataInterfaceFactory +::Spot6ImageMetadataInterfaceFactory() +{ + this->RegisterOverride("OpticalImageMetadataInterface", + "otbSpot6ImageMetadataInterface", + "Spot6 Metadata Interface", + 1, + itk::CreateObjectFunction::New()); +} + +Spot6ImageMetadataInterfaceFactory +::~Spot6ImageMetadataInterfaceFactory() +{ +} + +const char* +Spot6ImageMetadataInterfaceFactory::GetITKSourceVersion(void) const +{ + return ITK_SOURCE_VERSION; +} + +const char* +Spot6ImageMetadataInterfaceFactory::GetDescription() const +{ + return "Spot6 Metadata Interface Factory, handle Spot6 metadata in OTB"; +} + +} // end namespace otb diff -Nru otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.h otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.h --- otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterfaceFactory.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,67 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbSpot6ImageMetadataInterfaceFactory_h +#define __otbSpot6ImageMetadataInterfaceFactory_h + + +#include "itkObjectFactoryBase.h" + +namespace otb +{ +/** \class Spot6ImageMetadataInterfaceFactory + * \brief Creating an instance of a ImageMetadataInterface object using object factory. + */ +class ITK_EXPORT Spot6ImageMetadataInterfaceFactory : public itk::ObjectFactoryBase +{ +public: + /** Standard class typedefs. */ + typedef Spot6ImageMetadataInterfaceFactory Self; + typedef itk::ObjectFactoryBase Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** Class methods used to interface with the registered factories. */ + virtual const char* GetITKSourceVersion(void) const; + virtual const char* GetDescription(void) const; + + /** Method for class instantiation. */ + itkFactorylessNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(Spot6ImageMetadataInterfaceFactory, itk::ObjectFactoryBase); + + /** Register one factory of this type */ + static void RegisterOneFactory(void) + { + Spot6ImageMetadataInterfaceFactory::Pointer Spot6IMIFactory = Spot6ImageMetadataInterfaceFactory::New(); + itk::ObjectFactoryBase::RegisterFactory(Spot6IMIFactory); + } + +protected: + Spot6ImageMetadataInterfaceFactory(); + virtual ~Spot6ImageMetadataInterfaceFactory(); + +private: + Spot6ImageMetadataInterfaceFactory(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + +}; + +} // end namespace otb + +#endif diff -Nru otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterface.h otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterface.h --- otb-4.0.0/Code/IO/otbSpot6ImageMetadataInterface.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/IO/otbSpot6ImageMetadataInterface.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,135 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbSpot6ImageMetadataInterface_h +#define __otbSpot6ImageMetadataInterface_h + +#include "otbOpticalImageMetadataInterface.h" + +namespace otb +{ +/** \class Spot6ImageMetadataInterface + * + * \brief Creation of an "otb" Spot6ImageMetadataInterface that gets metadata. + * + */ +class ITK_EXPORT Spot6ImageMetadataInterface : public OpticalImageMetadataInterface +{ +public: + + typedef Spot6ImageMetadataInterface Self; + typedef OpticalImageMetadataInterface Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(Spot6ImageMetadataInterface, OpticalImageMetadataInterface); + + typedef Superclass::ImageType ImageType; + typedef Superclass::MetaDataDictionaryType MetaDataDictionaryType; + typedef Superclass::VectorType VectorType; + typedef Superclass::VariableLengthVectorType VariableLengthVectorType; + typedef Superclass::ImageKeywordlistType ImageKeywordlistType; + + /** Get the radiometric bias from the ossim metadata */ + VariableLengthVectorType GetPhysicalBias() const; + + /** Get the radiometric gain from the ossim metadata */ + VariableLengthVectorType GetPhysicalGain() const; + + /** Get the solar irradiance from the ossim metadata */ + VariableLengthVectorType GetSolarIrradiance() const; + + /** Get the imaging acquisition day from the ossim metadata : IMAGING_DATE metadata variable */ + int GetDay() const; + + /** Get the imaging acquisition month from the ossim metadata : IMAGING_DATE metadata variable */ + int GetMonth() const; + + /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ + int GetYear() const; + + /** Get the imaging acquisition hour from the ossim metadata : IMAGING_DATE metadata variable */ + int GetHour() const; + + /** Get the imaging acquisition year from the ossim metadata : IMAGING_DATE metadata variable */ + int GetMinute() const; + + /** Get the imaging production day from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ + int GetProductionDay() const; + + /** Get the imaging production month from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ + int GetProductionMonth() const; + + /** Get the imaging production year from the ossim metadata : DATASET_PRODUCTION_DATE metadata variable */ + int GetProductionYear() const; + + /** Get the sat elevation from the ossim metadata */ + double GetSatElevation() const; + + /** Get the sat azimuth from the ossim metadata */ + double GetSatAzimuth() const; + + /** Get the first wavelength for the spectral band definition */ + VariableLengthVectorType GetFirstWavelengths() const; + + /** Get the last wavelength for the spectral band definition */ + VariableLengthVectorType GetLastWavelengths() const; + + /** Get Instrument */ + std::string GetInstrument() const; + + /** Get Instrument Index */ + std::string GetInstrumentIndex() const; + + /** This method is to handle the permutation of the spectral band by some image provider + * in most cases, this method won't change the value, but for SPOT data, the bands are set up as + * 2 1 0 3 in the tiff file, this method which is overloaded for SPOT enables to retrieve the + * proper band. */ + unsigned int BandIndexToWavelengthPosition(unsigned int i) const; + + /** Get the 3 spectral band numbers corresponding to the default display for visualization, + * in the order R, G, B */ + std::vector GetDefaultDisplay() const; + + bool CanRead() const; + + /** Get the enhanced band names of the Spot6 data */ + std::vector GetEnhancedBandNames() const; + + + /** Vector that contains the filter function value in 6S format (step of 0.0025 micro m). + * There values a computed by 6S. */ + WavelengthSpectralBandVectorType GetSpectralSensitivity() const; + +protected: + Spot6ImageMetadataInterface(); + virtual ~Spot6ImageMetadataInterface() {} + +private: + + Spot6ImageMetadataInterface(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + +}; + +} // end namespace otb + +#endif diff -Nru otb-4.0.0/Code/IO/otbTileMapImageIO.cxx otb-4.2.0/Code/IO/otbTileMapImageIO.cxx --- otb-4.0.0/Code/IO/otbTileMapImageIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/IO/otbTileMapImageIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -54,9 +54,10 @@ // Set default spacing to one m_Spacing[0] = 1.0; m_Spacing[1] = 1.0; - // Set default origin to zero - m_Origin[0] = 0.0; - m_Origin[1] = 0.0; + // Set default origin to [0.5 , 0.5] + // (consistency between ImageIO, see Mantis #942) + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; m_NbBands = 3; m_FlagWriteImageInformation = true; @@ -412,8 +413,8 @@ // Default Spacing m_Spacing[0] = 1; m_Spacing[1] = 1; - m_Origin[0] = 0; - m_Origin[1] = 0; + m_Origin[0] = 0.5; + m_Origin[1] = 0.5; if (m_FileName.empty() == true) @@ -657,8 +658,8 @@ imageIO->SetDimensions(1, m_TileSize); imageIO->SetSpacing(0, 1); imageIO->SetSpacing(1, 1); - imageIO->SetOrigin(0, 0); - imageIO->SetOrigin(1, 0); + imageIO->SetOrigin(0, 0.5); + imageIO->SetOrigin(1, 0.5); imageIO->SetNumberOfComponents(3); vnl_vector axisDirection(2); diff -Nru otb-4.0.0/Code/Learning/otbKMeansImageClassificationFilter.txx otb-4.2.0/Code/Learning/otbKMeansImageClassificationFilter.txx --- otb-4.0.0/Code/Learning/otbKMeansImageClassificationFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Learning/otbKMeansImageClassificationFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -82,7 +82,7 @@ template void KMeansImageClassificationFilter -::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) { InputImageConstPointerType inputPtr = this->GetInput(); MaskImageConstPointerType inputMaskPtr = this->GetInputMask(); diff -Nru otb-4.0.0/Code/Learning/otbLibSVMMachineLearningModel.txx otb-4.2.0/Code/Learning/otbLibSVMMachineLearningModel.txx --- otb-4.0.0/Code/Learning/otbLibSVMMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Learning/otbLibSVMMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -94,7 +94,7 @@ template void LibSVMMachineLearningModel -::Save(const std::string & filename, const std::string & name) +::Save(const std::string & filename, const std::string & itkNotUsed(name)) { m_SVMestimator->GetModel()->SaveModel(filename.c_str()); } @@ -102,7 +102,7 @@ template void LibSVMMachineLearningModel -::Load(const std::string & filename, const std::string & name) +::Load(const std::string & filename, const std::string & itkNotUsed(name)) { m_SVMestimator->GetModel()->LoadModel(filename.c_str()); } @@ -139,7 +139,7 @@ template bool LibSVMMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/Learning/otbListSampleGenerator.h otb-4.2.0/Code/Learning/otbListSampleGenerator.h --- otb-4.0.0/Code/Learning/otbListSampleGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Learning/otbListSampleGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -145,7 +145,9 @@ void PrintSelf(std::ostream& os, itk::Indent indent) const; /** Triggers the Computation of the sample list */ - void GenerateData(void); + virtual void GenerateData(void); + + virtual void GenerateInputRequestedRegion(void); /** Compute the calss statistics*/ void GenerateClassStatistics(); diff -Nru otb-4.0.0/Code/Learning/otbListSampleGenerator.txx otb-4.2.0/Code/Learning/otbListSampleGenerator.txx --- otb-4.0.0/Code/Learning/otbListSampleGenerator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Learning/otbListSampleGenerator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -188,6 +188,27 @@ return dynamic_cast(this->itk::ProcessObject::GetOutput(3)); } +template +void +ListSampleGenerator +::GenerateInputRequestedRegion() +{ + ImagePointerType img = static_cast(this->ProcessObject::GetInput(0)); + + if(img.IsNotNull()) + { + + // Requested regions will be generated during GenerateData + // call. For now request an empty region so as to avoid requesting + // the largest possible region (fixes bug #943 ) + typename ImageType::RegionType dummyRegion; + typename ImageType::SizeType dummySize; + dummySize.Fill(0); + dummyRegion.SetSize(dummySize); + img->SetRequestedRegion(dummyRegion); + } +} + template void diff -Nru otb-4.0.0/Code/Learning/otbSOMImageClassificationFilter.txx otb-4.2.0/Code/Learning/otbSOMImageClassificationFilter.txx --- otb-4.0.0/Code/Learning/otbSOMImageClassificationFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Learning/otbSOMImageClassificationFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -71,7 +71,7 @@ template void SOMImageClassificationFilter -::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType threadId) +::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, itk::ThreadIdType itkNotUsed(threadId)) { InputImageConstPointerType inputPtr = this->GetInput(); MaskImageConstPointerType inputMaskPtr = this->GetInputMask(); diff -Nru otb-4.0.0/Code/Markov/otbMRFEnergy.h otb-4.2.0/Code/Markov/otbMRFEnergy.h --- otb-4.0.0/Code/Markov/otbMRFEnergy.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Markov/otbMRFEnergy.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ this->Modified(); } - virtual double GetSingleValue(const InputImagePixelType& value1, const LabelledImagePixelType& value2) + virtual double GetSingleValue(const InputImagePixelType& itkNotUsed(value1), const LabelledImagePixelType& itkNotUsed(value2)) { itkExceptionMacro(<< "GetSingleValue() has to be declared in child classes."); } @@ -181,7 +181,7 @@ this->Modified(); } - virtual double GetSingleValue(const LabelledImagePixelType& value1, const LabelledImagePixelType& value2) + virtual double GetSingleValue(const LabelledImagePixelType& itkNotUsed(value1), const LabelledImagePixelType& itkNotUsed(value2)) { itkExceptionMacro(<< "GetSingleValue() has to be declared in child classes."); } diff -Nru otb-4.0.0/Code/MultiScale/otbMorphologicalPyramidResampler.txx otb-4.2.0/Code/MultiScale/otbMorphologicalPyramidResampler.txx --- otb-4.0.0/Code/MultiScale/otbMorphologicalPyramidResampler.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/MultiScale/otbMorphologicalPyramidResampler.txx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #define __otbMorphologicalPyramidResampler_txx #include "otbMorphologicalPyramidResampler.h" #include "itkResampleImageFilter.h" -#include "itkScaleTransform.h" +#include "itkScalableAffineTransform.h" #include "itkNearestNeighborInterpolateImageFunction.h" #include "itkLinearInterpolateImageFunction.h" #include "itkProgressAccumulator.h" @@ -123,10 +123,8 @@ // Filters typedefs typedef itk::ResampleImageFilter ResampleFilterType; - typedef itk::ScaleTransform TransformType; + typedef itk::ScalableAffineTransform TransformType; typedef itk::LinearInterpolateImageFunction InterpolatorType; - typedef itk::ImageRegionConstIterator ConstIteratorType; - typedef itk::ImageRegionIterator IteratorType; // Resampling filter creation typename ResampleFilterType::Pointer resampler = ResampleFilterType::New(); @@ -134,13 +132,18 @@ typename TransformType::Pointer transform = TransformType::New(); // Scale parameters computation - typename TransformType::ParametersType scales(2); + typename TransformType::InputVectorType scales; typename InputImageType::SizeType inputSize = this->GetInput()->GetLargestPossibleRegion().GetSize(); typename InputImageType::SpacingType inputSpacing = this->GetInput()->GetSpacing(); - scales[0] = static_cast(inputSize[0] - 1) / static_cast(m_Size[0] - 1); - scales[1] = static_cast(inputSize[1] - 1) / static_cast(m_Size[1] - 1); - transform->SetParameters(scales); + scales[0] = static_cast(inputSize[0]) / static_cast(m_Size[0]); + scales[1] = static_cast(inputSize[1]) / static_cast(m_Size[1]); + transform->SetScale(scales); transform->SetCenter(this->GetInput()->GetOrigin()); + typename TransformType::OutputVectorType translation; + translation[0] = 0.5 * inputSpacing[0] * (scales[0] - 1.0); + translation[1] = 0.5 * inputSpacing[1] * (scales[1] - 1.0); + transform->SetTranslation(translation); + // Resampling filter set up resampler->SetTransform(transform); diff -Nru otb-4.0.0/Code/MultiScale/otbMorphologicalPyramidSegmenter.txx otb-4.2.0/Code/MultiScale/otbMorphologicalPyramidSegmenter.txx --- otb-4.0.0/Code/MultiScale/otbMorphologicalPyramidSegmenter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/MultiScale/otbMorphologicalPyramidSegmenter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -159,7 +159,6 @@ typedef itk::PointSet PointSetType; typedef otb::ThresholdImageToPointSetFilter PointSetFilterType; typedef typename PointSetType::PointsContainer::Iterator PointSetIteratorType; - typedef typename PointSetType::PointType PointType; // Typedefs for segmentation typedef itk::ConnectedThresholdImageFilter ConnectedFilterType; @@ -169,7 +168,6 @@ // Typedefs for statistics computation typedef itk::Statistics::ScalarImageToHistogramGenerator HistGeneratorType; - typedef typename HistGeneratorType::HistogramType HistogramType; ///////////////////////////////////// //// Details image enhancement ////// diff -Nru otb-4.0.0/Code/MultiScale/otbSubsampleImageFilter.txx otb-4.2.0/Code/MultiScale/otbSubsampleImageFilter.txx --- otb-4.0.0/Code/MultiScale/otbSubsampleImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/MultiScale/otbSubsampleImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -148,7 +148,7 @@ void SubsampleImageFilter ::ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, - itk::ThreadIdType threadId) + itk::ThreadIdType itkNotUsed(threadId)) { OutputImagePointerType output = this->GetOutput(); diff -Nru otb-4.0.0/Code/MultiScale/otbWaveletFilterBank.txx otb-4.2.0/Code/MultiScale/otbWaveletFilterBank.txx --- otb-4.0.0/Code/MultiScale/otbWaveletFilterBank.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/MultiScale/otbWaveletFilterBank.txx 2014-09-03 08:29:34.000000000 +0000 @@ -960,7 +960,6 @@ // typedef for the iterations over the input image typedef itk::ConstNeighborhoodIterator NeighborhoodIteratorType; typedef itk::NeighborhoodInnerProduct InnerProductType; - typedef itk::ImageRegionIterator IteratorType; // Faces iterations typename NeighborhoodIteratorType::RadiusType radiusMax; @@ -1137,8 +1136,6 @@ // typedef for the iterations over the input image typedef itk::ConstNeighborhoodIterator NeighborhoodIteratorType; typedef itk::NeighborhoodInnerProduct InnerProductType; - typedef itk::ImageRegionIterator IteratorType; - // Faces iterations typename NeighborhoodIteratorType::RadiusType radiusMax; for (unsigned int i = 0; i < InputImageDimension; ++i) diff -Nru otb-4.0.0/Code/MultiScale/otbWaveletPacketDecompositionCosts.h otb-4.2.0/Code/MultiScale/otbWaveletPacketDecompositionCosts.h --- otb-4.0.0/Code/MultiScale/otbWaveletPacketDecompositionCosts.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/MultiScale/otbWaveletPacketDecompositionCosts.h 2014-09-03 08:29:34.000000000 +0000 @@ -57,7 +57,7 @@ static unsigned int NumberOfAllowedDecompositions; /** Evaluate the cost */ - bool Evaluate(unsigned int decomposition, const ImageType * image) + bool Evaluate(unsigned int decomposition, const ImageType * itkNotUsed(image)) { return (decomposition < NumberOfAllowedDecompositions); } diff -Nru otb-4.0.0/Code/OBIA/otbLabelMapToSampleListFilter.txx otb-4.2.0/Code/OBIA/otbLabelMapToSampleListFilter.txx --- otb-4.0.0/Code/OBIA/otbLabelMapToSampleListFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/OBIA/otbLabelMapToSampleListFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ typename LabelMapToSampleListFilter ::DataObjectPointerType LabelMapToSampleListFilter -::MakeOutput(unsigned int idx) +::MakeOutput(unsigned int itkNotUsed(idx)) { DataObjectPointerType output; output = static_cast(OutputSampleListType::New().GetPointer()); diff -Nru otb-4.0.0/Code/OBIA/otbLabelMapToVectorDataFilter.h otb-4.2.0/Code/OBIA/otbLabelMapToVectorDataFilter.h --- otb-4.0.0/Code/OBIA/otbLabelMapToVectorDataFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/OBIA/otbLabelMapToVectorDataFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,11 @@ * "An algorithm for the rapid computation of boundaries of run-length * encoded regions", Francis K. H. Queck, in Pattern Recognition 33 * (2000), p 1637-1649. - * + * + * Note : the output vector data contains index coordinates (not physical coordinates). + * For instance, a polygon around the pixel at index (0,0) would have the following + * points : [-0.5,-0.5] , [0.5,-0.5] , [0.5,0.5] , [-0.5,0.5] + * * \sa VectorDataSource * \ingroup GeoSpatialAnalysis */ diff -Nru otb-4.0.0/Code/OBIA/otbLabelObjectToPolygonFunctor.txx otb-4.2.0/Code/OBIA/otbLabelObjectToPolygonFunctor.txx --- otb-4.0.0/Code/OBIA/otbLabelObjectToPolygonFunctor.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/OBIA/otbLabelObjectToPolygonFunctor.txx 2014-09-03 08:29:34.000000000 +0000 @@ -486,30 +486,32 @@ } typename PolygonType::VertexType::VectorType offset; + typedef typename PolygonType::VertexType::VectorType::ValueType VectorValueType; + offset.Fill(itk::NumericTraits::Zero); switch (state) { case UP_RIGHT: - offset[1] = 1; + offset[1] = 0.5; break; case UP_LEFT: - offset[1] = 1; + offset[1] = 0.5; break; case DOWN_RIGHT: - offset[1] = 0; + offset[1] = -0.5; break; case DOWN_LEFT: - offset[1] = 0; + offset[1] = -0.5; break; } switch (m_PositionFlag) { case LEFT_END: - offset[0] = 0; + offset[0] = -0.5; break; case RIGHT_END: - offset[0] = 1; + offset[0] = 0.5; break; } typename PolygonType::VertexType newPoint; @@ -560,24 +562,26 @@ } typename PolygonType::VertexType::VectorType offset; + typedef typename PolygonType::VertexType::VectorType::ValueType VectorValueType; + offset.Fill(itk::NumericTraits::Zero); switch (state) { case UP_RIGHT: - offset[0] = 1; - offset[1] = 1; + offset[0] = 0.5; + offset[1] = 0.5; break; case UP_LEFT: - offset[0] = 0; - offset[1] = 1; + offset[0] = -0.5; + offset[1] = 0.5; break; case DOWN_RIGHT: - offset[0] = 1; - offset[1] = 0; + offset[0] = 0.5; + offset[1] = -0.5; break; case DOWN_LEFT: - offset[0] = 0; - offset[1] = 0; + offset[0] = -0.5; + offset[1] = -0.5; break; } @@ -622,8 +626,10 @@ VertexType resp; // Apply origin and spacing - resp[0] = (index[0] - m_StartIndex[0]) * m_Spacing[0] + m_Origin[0]; - resp[1] = (index[1] - m_StartIndex[1]) * m_Spacing[1] + m_Origin[1]; + //resp[0] = (index[0] - m_StartIndex[0]) * m_Spacing[0] + m_Origin[0]; + //resp[1] = (index[1] - m_StartIndex[1]) * m_Spacing[1] + m_Origin[1]; + resp[0] = index[0] * m_Spacing[0] + m_Origin[0]; + resp[1] = index[1] * m_Spacing[1] + m_Origin[1]; return resp; } diff -Nru otb-4.0.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.h otb-4.2.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.h --- otb-4.0.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,6 +48,12 @@ * The first Label is set using SetInitialLabel (by default it is 0), and increases 1 by 1. * The vector data attributes are also assigned to the object in the label map. * + * When AutomaticSizeComputation=True, the spacing from the vector data object + * is used. Then the size and origin are computed so that the image extent + * covers exactly the vector data bounding region. + * + * Note : the coordinates in the vector data are assumed to be physical coordinates. + * * \sa LabelMapSource */ diff -Nru otb-4.0.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.txx otb-4.2.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.txx --- otb-4.0.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/OBIA/otbVectorDataToLabelMapWithAttributesFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -135,25 +135,36 @@ outputPtr->SetDirection(m_Direction); } else - { - typename PolygonType::RegionType region; - OriginType origin; - m_VectorDataProperties->SetVectorDataObject(this->GetInput()); - m_VectorDataProperties->SetBoundingRegion(region); - //Compute the global bounding box of the vectordata - m_VectorDataProperties->ComputeBoundingRegion(); - origin[0] = m_VectorDataProperties->GetBoundingRegion().GetImageRegion().GetIndex(0); - origin[1] = m_VectorDataProperties->GetBoundingRegion().GetImageRegion().GetIndex(1); - - // Set spacing and origin - outputLargestPossibleRegion.SetSize(m_VectorDataProperties->GetBoundingRegion().GetImageRegion().GetSize()); - outputLargestPossibleRegion.SetIndex(m_StartIndex); - - outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); - outputPtr->SetSpacing(this->GetInput()->GetSpacing()); - outputPtr->SetOrigin(origin); - outputPtr->SetDirection(m_Direction); - } + { + //typename PolygonType::RegionType region; + m_VectorDataProperties->SetVectorDataObject(this->GetInput()); + //m_VectorDataProperties->SetBoundingRegion(region); + //Compute the global bounding box of the vectordata + m_VectorDataProperties->ComputeBoundingRegion(); + + // Compute origin and size + SizeType size; + SpacingType spacing = this->GetInput()->GetSpacing(); + OriginType origin = m_VectorDataProperties->GetBoundingRegion().GetOrigin(); + for (unsigned int i=0; i<2; ++i) + { + if (spacing[i] < 0.0) + { + origin[i] += m_VectorDataProperties->GetBoundingRegion().GetSize(i); + } + origin[i] += (0.5 - m_StartIndex[i]) * spacing[i]; + size[i] = static_cast(vcl_ceil(vcl_abs( + m_VectorDataProperties->GetBoundingRegion().GetSize(i)/spacing[i]))); + } + + outputLargestPossibleRegion.SetSize(size); + outputLargestPossibleRegion.SetIndex(m_StartIndex); + + outputPtr->SetLargestPossibleRegion(outputLargestPossibleRegion); + outputPtr->SetSpacing(spacing); + outputPtr->SetOrigin(origin); + outputPtr->SetDirection(m_Direction); + } return; } /* @@ -298,9 +309,11 @@ otbGenericMsgDebugMacro(<< "Insert Point from vectorData"); IndexType index; this->GetOutput()->TransformPhysicalPointToIndex(dataNode->GetPoint(), index); - - this->GetOutput()->SetPixel(index, m_lab); - m_lab += 1; + if (this->GetOutput()->GetLargestPossibleRegion().IsInside(index)) + { + this->GetOutput()->SetPixel(index, m_lab); + m_lab += 1; + } break; } case otb::FEATURE_LINE: @@ -317,55 +330,90 @@ CorrectFunctorType correct; PolygonPointerType correctPolygonExtRing = correct(dataNode->GetPolygonExteriorRing()); - typedef typename DataNodeType::PolygonType PolygonType; - typedef typename PolygonType::RegionType RegionType; + //typedef typename DataNodeType::PolygonType PolygonType; + typedef typename PolygonType::RegionType RSRegionType; typedef typename PolygonType::VertexType VertexType; typedef typename IndexType::IndexValueType IndexValueType; - typedef typename VertexType::ValueType VertexValueType; - RegionType polygonExtRingBoundReg = correctPolygonExtRing->GetBoundingRegion(); + RSRegionType polygonExtRingBoundReg = correctPolygonExtRing->GetBoundingRegion(); - VertexType vertex; + IndexType startIdx,endIdx,tmpIdx; + OriginType physCorners[4]; + physCorners[0][0] = polygonExtRingBoundReg.GetOrigin(0); + physCorners[0][1] = polygonExtRingBoundReg.GetOrigin(1); + physCorners[1] = physCorners[0]; + physCorners[2] = physCorners[0]; + physCorners[3] = physCorners[0]; + + physCorners[1][1] += polygonExtRingBoundReg.GetSize(1); + physCorners[2][1] += polygonExtRingBoundReg.GetSize(1); + physCorners[2][0] += polygonExtRingBoundReg.GetSize(0); + physCorners[3][0] += polygonExtRingBoundReg.GetSize(0); - // For each position in the bounding region of the polygon - for (double i = polygonExtRingBoundReg.GetOrigin(0); - i < polygonExtRingBoundReg.GetOrigin(0) + polygonExtRingBoundReg.GetSize(0); - i += this->GetOutput()->GetSpacing()[0]) + for (unsigned int k=0; k<4; ++k) { - vertex[0] = static_cast(i); - for (double j = polygonExtRingBoundReg.GetOrigin(1); - j < polygonExtRingBoundReg.GetOrigin(1) + polygonExtRingBoundReg.GetSize(1); - j += this->GetOutput()->GetSpacing()[1]) + this->GetOutput()->TransformPhysicalPointToIndex(physCorners[k],tmpIdx); + if (k == 0) + { + startIdx = tmpIdx; + endIdx = tmpIdx; + } + else { - vertex[1] = static_cast(j); + startIdx[0] = std::min(startIdx[0],tmpIdx[0]); + startIdx[1] = std::min(startIdx[1],tmpIdx[1]); + endIdx[0] = std::max(endIdx[0],tmpIdx[0]); + endIdx[1] = std::max(endIdx[1],tmpIdx[1]); + } + } + // Check that the polygon intersects the largest possible region + RegionType polyRegion; + polyRegion.SetIndex(startIdx); + polyRegion.SetSize(0,endIdx[0] - startIdx[0] + 1); + polyRegion.SetSize(1,endIdx[1] - startIdx[1] + 1); + if (polyRegion.Crop(this->GetOutput()->GetLargestPossibleRegion())) + { + startIdx = polyRegion.GetIndex(); + endIdx[0] = startIdx[0] - 1 + polyRegion.GetSize(0); + endIdx[1] = startIdx[1] - 1 + polyRegion.GetSize(1); + } + else + { + // No intersection + break; + } + OriginType tmpPoint; + VertexType vertex; + for (IndexValueType j=startIdx[1]; j<=endIdx[1]; ++j) + { + for (IndexValueType i=startIdx[0]; i<=endIdx[0]; ++i) + { + tmpIdx[0] = i; + tmpIdx[1] = j; + this->GetOutput()->TransformIndexToPhysicalPoint(tmpIdx,tmpPoint); + vertex[0] = tmpPoint[0]; + vertex[1] = tmpPoint[1]; if (correctPolygonExtRing->IsInside(vertex) || correctPolygonExtRing->IsOnEdge (vertex)) { - IndexType index; -// index[0] = static_cast(vertex[0] - polygonExtRingBoundReg.GetOrigin(0)); -// index[1] = static_cast(vertex[1] - polygonExtRingBoundReg.GetOrigin(1)); - index[0] = static_cast(vertex[0]-this->GetOutput()->GetOrigin()[0]); - index[1] = static_cast(vertex[1]-this->GetOutput()->GetOrigin()[1]); -// index[0] += this->GetOutput()->GetOrigin()[0]; -// index[1] += this->GetOutput()->GetOrigin()[1]; -// std::cout << "index " << index << std::endl; + // TODO : should also test interior rings if (this->GetOutput()->HasLabel(m_lab)) { - if (!this->GetOutput()->GetLabelObject(m_lab)->HasIndex(index)) + if (!this->GetOutput()->GetLabelObject(m_lab)->HasIndex(tmpIdx)) { //Add a pixel to the current labelObject - this->GetOutput()->SetPixel(index, m_lab); + this->GetOutput()->SetPixel(tmpIdx, m_lab); } } else { //Add a pixel to the current labelObject - this->GetOutput()->SetPixel(index, m_lab); - } + this->GetOutput()->SetPixel(tmpIdx, m_lab); //add attributes AttributesValueType fieldValue; for(unsigned int ii=0; iiGetFieldList().size(); ii++) - { + { fieldValue = static_cast( dataNode->GetFieldAsString(dataNode->GetFieldList()[ii]) ); this->GetOutput()->GetLabelObject(m_lab)->SetAttribute( dataNode->GetFieldList()[ii].c_str(), fieldValue ); + } } } } diff -Nru otb-4.0.0/Code/ObjectDetection/otbDescriptorsListSampleGenerator.txx otb-4.2.0/Code/ObjectDetection/otbDescriptorsListSampleGenerator.txx --- otb-4.0.0/Code/ObjectDetection/otbDescriptorsListSampleGenerator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ObjectDetection/otbDescriptorsListSampleGenerator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -314,10 +314,6 @@ ContinuousIndexType cidx; this->GetInput()->TransformPhysicalPointToContinuousIndex(point, cidx); - // OGR convention : vector data are recorded with a 0.5 shift - cidx[0] -= 0.5; - cidx[1] -= 0.5; - RegionType paddedRegion = outputRegionForThread; paddedRegion.PadByRadius(m_NeighborhoodRadius); if (this->IsInsideWithNeighborhoodRadius(paddedRegion, cidx)) diff -Nru otb-4.0.0/Code/ObjectDetection/otbHaralickTexturesIFFactory.txx otb-4.2.0/Code/ObjectDetection/otbHaralickTexturesIFFactory.txx --- otb-4.0.0/Code/ObjectDetection/otbHaralickTexturesIFFactory.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ObjectDetection/otbHaralickTexturesIFFactory.txx 2014-09-03 08:29:34.000000000 +0000 @@ -43,9 +43,9 @@ function->SetInputImage(image); function->GetInternalImageFunction()->SetNeighborhoodRadius(param[0]); - function->GetInternalImageFunction()->SetInputImageMinimum(param[1]); - function->GetInternalImageFunction()->SetInputImageMaximum(param[2]); - function->GetInternalImageFunction()->SetNumberOfBinsPerAxis(param[3]); + function->SetInputImageMinimum(param[1]); + function->SetInputImageMaximum(param[2]); + function->SetNumberOfBinsPerAxis(param[3]); OffsetType offset; offset.Fill(param[4]); diff -Nru otb-4.0.0/Code/ObjectDetection/otbObjectDetectionClassifier.txx otb-4.2.0/Code/ObjectDetection/otbObjectDetectionClassifier.txx --- otb-4.0.0/Code/ObjectDetection/otbObjectDetectionClassifier.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ObjectDetection/otbObjectDetectionClassifier.txx 2014-09-03 08:29:34.000000000 +0000 @@ -245,8 +245,6 @@ SVMModelType* model = static_cast(this->itk::ProcessObject::GetInput(1)); typedef typename RegionType::IndexType IndexType; - typedef typename RegionType::IndexValueType IndexValueType; - IndexType begin = outputRegionForThread.GetIndex(); IndexType end = begin; end[0] += outputRegionForThread.GetSize(0); @@ -264,12 +262,6 @@ DescriptorsFunctionPointType point; input->TransformIndexToPhysicalPoint(current, point); - ContinuousIndexType currentContinuous(current); - currentContinuous[0] += 0.5; - currentContinuous[1] += 0.5; - DescriptorsFunctionPointType pointOGR; - input->TransformContinuousIndexToPhysicalPoint(currentContinuous, pointOGR); - DescriptorType descriptor = m_DescriptorsFunction->Evaluate(point); SVMModelMeasurementType modelMeasurement(descriptor.GetSize()); for (unsigned int i = 0; i < descriptor.GetSize(); ++i) @@ -280,7 +272,7 @@ if (label != m_NoClassLabel) { - m_ThreadPointArray[threadId].push_back(std::make_pair(pointOGR, label)); + m_ThreadPointArray[threadId].push_back(std::make_pair(point, label)); } } } diff -Nru otb-4.0.0/Code/ObjectDetection/otbStatisticsXMLFileReader.txx otb-4.2.0/Code/ObjectDetection/otbStatisticsXMLFileReader.txx --- otb-4.0.0/Code/ObjectDetection/otbStatisticsXMLFileReader.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ObjectDetection/otbStatisticsXMLFileReader.txx 2014-09-03 08:29:34.000000000 +0000 @@ -134,7 +134,7 @@ template < class TMeasurementVector > void StatisticsXMLFileReader -::PrintSelf(std::ostream& os, itk::Indent indent) const +::PrintSelf(std::ostream& itkNotUsed(os), itk::Indent itkNotUsed(indent)) const { // Call superclass implementation //Superclass::PrintSelf(os, indent); diff -Nru otb-4.0.0/Code/ObjectDetection/otbStatisticsXMLFileWriter.txx otb-4.2.0/Code/ObjectDetection/otbStatisticsXMLFileWriter.txx --- otb-4.0.0/Code/ObjectDetection/otbStatisticsXMLFileWriter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/ObjectDetection/otbStatisticsXMLFileWriter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -105,14 +105,20 @@ } // Finally, write the file - doc.SaveFile( m_FileName.c_str() ); + if (! doc.SaveFile( m_FileName.c_str() ) ) + { + itkExceptionMacro(<<"Unable to write the XML file in " + << itksys::SystemTools::GetFilenamePath(m_FileName) + << " (permission issue? Directory does not exist?)." ); + } + } template < class TMeasurementVector > void StatisticsXMLFileWriter -::PrintSelf(std::ostream& os, itk::Indent indent) const +::PrintSelf(std::ostream& itkNotUsed(os), itk::Indent itkNotUsed(indent)) const { // Call superclass implementation //Superclass::PrintSelf(os, indent); diff -Nru otb-4.0.0/Code/Projections/otbGenericRSTransform.h otb-4.2.0/Code/Projections/otbGenericRSTransform.h --- otb-4.0.0/Code/Projections/otbGenericRSTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Projections/otbGenericRSTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -60,6 +60,7 @@ //@} typedef typename Superclass::ScalarType ScalarType; + typedef typename Superclass::JacobianType JacobianType; typedef itk::Point InputPointType; typedef itk::Point OutputPointType; @@ -173,8 +174,10 @@ virtual InverseTransformBasePointer GetInverseTransform() const; // Dummy set parameter method - virtual void SetParameters(const typename Superclass::ParametersType &) - {} + virtual void SetParameters(const typename Superclass::ParametersType &) {} + + // Dummy ComputeJacobianWithRespectToParameters method + virtual void ComputeJacobianWithRespectToParameters(const InputPointType &, JacobianType& ) const {} protected: GenericRSTransform(); diff -Nru otb-4.0.0/Code/Projections/otbGeometriesProjectionFilter.cxx otb-4.2.0/Code/Projections/otbGeometriesProjectionFilter.cxx --- otb-4.0.0/Code/Projections/otbGeometriesProjectionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Projections/otbGeometriesProjectionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -214,7 +214,7 @@ /*virtual*/ OGRSpatialReference* otb::GeometriesProjectionFilter::DoDefineNewLayerSpatialReference( - ogr::Layer const& source) const + ogr::Layer const& itkNotUsed(source)) const { if (!m_OutputProjectionRef.empty()) { diff -Nru otb-4.0.0/Code/Projections/otbImageToEnvelopeVectorDataFilter.txx otb-4.2.0/Code/Projections/otbImageToEnvelopeVectorDataFilter.txx --- otb-4.0.0/Code/Projections/otbImageToEnvelopeVectorDataFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Projections/otbImageToEnvelopeVectorDataFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -125,11 +125,16 @@ OutputVectorDataPointer outputPtr = this->GetOutput(); // Compute corners as index - typename InputImageType::IndexType ul, ur, lr, ll; - ul = inputPtr->GetLargestPossibleRegion().GetIndex(); - ur = ul; - ll=ul; - lr=ul; + itk::ContinuousIndex ul( + inputPtr->GetLargestPossibleRegion().GetIndex()); + // move 'ul' to the corner of the first pixel + ul[0] += -0.5; + ul[1] += -0.5; + + itk::ContinuousIndex ur(ul); + itk::ContinuousIndex lr(ul); + itk::ContinuousIndex ll(ul); + typename InputImageType::SizeType size = inputPtr->GetLargestPossibleRegion().GetSize(); ur[0]+=size[0]; ll[1]+=size[1]; @@ -138,14 +143,14 @@ // Get corners as physical points typename InputImageType::PointType ulp, urp, lrp, llp, current; - inputPtr->TransformIndexToPhysicalPoint(ul, ulp); - inputPtr->TransformIndexToPhysicalPoint(ur, urp); - inputPtr->TransformIndexToPhysicalPoint(lr, lrp); - inputPtr->TransformIndexToPhysicalPoint(ll, llp); + inputPtr->TransformContinuousIndexToPhysicalPoint(ul, ulp); + inputPtr->TransformContinuousIndexToPhysicalPoint(ur, urp); + inputPtr->TransformContinuousIndexToPhysicalPoint(lr, lrp); + inputPtr->TransformContinuousIndexToPhysicalPoint(ll, llp); this->InstantiateTransform(); - typename InputImageType::IndexType edgeIndex; + itk::ContinuousIndex edgeIndex; typename InputImageType::PointType edgePoint; // Build envelope polygon @@ -162,7 +167,7 @@ edgeIndex[0]+=m_SamplingRate; while (edgeIndex[0]TransformIndexToPhysicalPoint(edgeIndex, edgePoint); + inputPtr->TransformContinuousIndexToPhysicalPoint(edgeIndex, edgePoint); current = m_Transform->TransformPoint(edgePoint); vertex[0] = current[0]; vertex[1] = current[1]; @@ -182,7 +187,7 @@ edgeIndex[1]+=m_SamplingRate; while (edgeIndex[1]TransformIndexToPhysicalPoint(edgeIndex, edgePoint); + inputPtr->TransformContinuousIndexToPhysicalPoint(edgeIndex, edgePoint); current = m_Transform->TransformPoint(edgePoint); vertex[0] = current[0]; vertex[1] = current[1]; @@ -202,7 +207,7 @@ edgeIndex[0]-=m_SamplingRate; while (edgeIndex[0]>ll[0]) { - inputPtr->TransformIndexToPhysicalPoint(edgeIndex, edgePoint); + inputPtr->TransformContinuousIndexToPhysicalPoint(edgeIndex, edgePoint); current = m_Transform->TransformPoint(edgePoint); vertex[0] = current[0]; vertex[1] = current[1]; @@ -222,7 +227,7 @@ edgeIndex[1]-=m_SamplingRate; while (edgeIndex[1]>ul[1]) { - inputPtr->TransformIndexToPhysicalPoint(edgeIndex, edgePoint); + inputPtr->TransformContinuousIndexToPhysicalPoint(edgeIndex, edgePoint); current = m_Transform->TransformPoint(edgePoint); vertex[0] = current[0]; vertex[1] = current[1]; diff -Nru otb-4.0.0/Code/Projections/otbImageToGenericRSOutputParameters.txx otb-4.2.0/Code/Projections/otbImageToGenericRSOutputParameters.txx --- otb-4.0.0/Code/Projections/otbImageToGenericRSOutputParameters.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Projections/otbImageToGenericRSOutputParameters.txx 2014-09-03 08:29:34.000000000 +0000 @@ -21,6 +21,7 @@ #include "otbImageToGenericRSOutputParameters.h" #include "itkMacro.h" +#include "itkContinuousIndex.h" namespace otb { @@ -56,15 +57,15 @@ // Estimate the Output image Extent this->EstimateOutputImageExtent(); - // Estimate the Output Origin - this->EstimateOutputOrigin(); - // Estimate the Output Spacing if(!m_ForceSpacing) this->EstimateOutputSpacing(); // Finally Estimate the Output Size this->EstimateOutputSize(); + + // Estimate the Output Origin + this->EstimateOutputOrigin(); } @@ -94,25 +95,24 @@ m_Transform->GetInverse(invTransform); // Compute the 4 corners in the cartographic coordinate system - std::vector vindex; + std::vector< itk::ContinuousIndex > vindex; std::vector voutput; - IndexType index1, index2, index3, index4; - SizeType size; + itk::ContinuousIndex index1(m_Input->GetLargestPossibleRegion().GetIndex()); + index1[0] += -0.5; + index1[1] += -0.5; + itk::ContinuousIndex index2(index1); + itk::ContinuousIndex index3(index1); + itk::ContinuousIndex index4(index1); // Image size - size = m_Input->GetLargestPossibleRegion().GetSize(); + SizeType size = m_Input->GetLargestPossibleRegion().GetSize(); // project the 4 corners - index1 = m_Input->GetLargestPossibleRegion().GetIndex(); - index2 = m_Input->GetLargestPossibleRegion().GetIndex(); - index3 = m_Input->GetLargestPossibleRegion().GetIndex(); - index4 = m_Input->GetLargestPossibleRegion().GetIndex(); - - index2[0] += size[0] - 1; - index3[0] += size[0] - 1; - index3[1] += size[1] - 1; - index4[1] += size[1] - 1; + index2[0] += size[0]; + index3[0] += size[0]; + index3[1] += size[1]; + index4[1] += size[1]; vindex.push_back(index1); vindex.push_back(index2); @@ -122,7 +122,7 @@ for (unsigned int i = 0; i < vindex.size(); ++i) { PointType physicalPoint; - m_Input->TransformIndexToPhysicalPoint(vindex[i], physicalPoint); + m_Input->TransformContinuousIndexToPhysicalPoint(vindex[i], physicalPoint); voutput.push_back(invTransform->TransformPoint(physicalPoint)); } @@ -168,8 +168,8 @@ // Set the output orgin in carto // projection PointType origin; - origin[0] = m_OutputExtent.minX; - origin[1] = m_OutputExtent.maxY; + origin[0] = m_OutputExtent.minX + 0.5 * this->GetOutputSpacing()[0]; + origin[1] = m_OutputExtent.maxY + 0.5 * this->GetOutputSpacing()[1]; this->SetOutputOrigin(origin); } @@ -187,8 +187,8 @@ double sizeCartoY = vcl_abs(m_OutputExtent.minY - m_OutputExtent.maxY); PointType o, oX, oY; - o[0] = this->GetOutputOrigin()[0]; - o[1] = this->GetOutputOrigin()[1]; + o[0] = m_OutputExtent.minX; + o[1] = m_OutputExtent.maxY; oX = o; oY = o; diff -Nru otb-4.0.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.cxx otb-4.2.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.cxx --- otb-4.0.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,155 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbPleiadesPToXSAffineTransformCalculator__cxx +#define __otbPleiadesPToXSAffineTransformCalculator__cxx + +#include "otbPleiadesPToXSAffineTransformCalculator.h" +#include "otbPleiadesImageMetadataInterface.h" +#include "otbDateTimeAdapter.h" +#include "otbImageKeywordlist.h" +#include "itkMetaDataObject.h" + +namespace otb { + +bool +PleiadesPToXSAffineTransformCalculator +::CanCompute(const itk::ImageBase<2> * panchromaticImage, const itk::ImageBase<2> * xsImage) +{ + bool isPanPHR = false; + bool isXSPHR = false; + + otb::PleiadesImageMetadataInterface::Pointer phrIMI = + otb::PleiadesImageMetadataInterface::New(); + phrIMI->SetMetaDataDictionary(panchromaticImage->GetMetaDataDictionary()); + isPanPHR = phrIMI->CanRead(); + + phrIMI->SetMetaDataDictionary(xsImage->GetMetaDataDictionary()); + isXSPHR = phrIMI->CanRead(); + + if (isPanPHR && isXSPHR) + { + ImageKeywordlist kwlPan; + ImageKeywordlist kwlXS; + + itk::ExposeMetaData( + panchromaticImage->GetMetaDataDictionary(), + MetaDataKey::OSSIMKeywordlistKey, + kwlPan); + + itk::ExposeMetaData( + xsImage->GetMetaDataDictionary(), + MetaDataKey::OSSIMKeywordlistKey, + kwlXS); + + // Get geometric processing + std::string panProcessing = kwlPan.GetMetadataByKey("support_data.processing_level"); + std::string xsProcessing = kwlXS.GetMetadataByKey("support_data.processing_level"); + + if (panProcessing.compare("SENSOR") == 0 && + xsProcessing.compare("SENSOR") == 0) + { + + std::string pid = kwlPan.GetMetadataByKey("image_id"); + std::string xsid = kwlXS.GetMetadataByKey("image_id"); + + pid = pid.substr(0,pid.size()-4); + xsid = xsid.substr(0,xsid.size()-4); + + if(pid == xsid) + { + return true; + } + } + } + return false; +} + +PleiadesPToXSAffineTransformCalculator +::TransformType::Pointer +PleiadesPToXSAffineTransformCalculator +::Compute(const itk::ImageBase<2> * panchromaticImage, const itk::ImageBase<2> * xsImage) +{ + if(!CanCompute(panchromaticImage,xsImage)) + { + itkGenericExceptionMacro("Can not compute affine transform between images, they do not correspond to Pleiades sensor bundle."); + } + + ImageKeywordlist kwlPan; + ImageKeywordlist kwlXS; + + itk::ExposeMetaData( + panchromaticImage->GetMetaDataDictionary(), + MetaDataKey::OSSIMKeywordlistKey, + kwlPan); + + itk::ExposeMetaData( + xsImage->GetMetaDataDictionary(), + MetaDataKey::OSSIMKeywordlistKey, + kwlXS); + + // Compute time delta + std::string strStartTimePan = kwlPan.GetMetadataByKey("support_data.time_range_start"); + std::string strStartTimeXS = kwlXS.GetMetadataByKey("support_data.time_range_start"); + + DateTimeAdapter::Pointer startTimePan = DateTimeAdapter::New(); + DateTimeAdapter::Pointer startTimeXS = DateTimeAdapter::New(); + + startTimePan->SetFromIso8601(strStartTimePan); + startTimeXS->SetFromIso8601(strStartTimeXS); + + double timeDelta = startTimeXS->GetDeltaInSeconds(startTimePan); + + // Retrieve line period in Pan + std::string tmpStr = kwlPan.GetMetadataByKey("support_data.line_period"); + double linePeriodPan = atof(tmpStr.c_str()); + + // Retrieve column start + tmpStr = kwlPan.GetMetadataByKey("support_data.swath_first_col"); + int colStartPan = atoi(tmpStr.c_str()); + tmpStr = kwlXS.GetMetadataByKey("support_data.swath_first_col"); + int colStartXS = atoi(tmpStr.c_str()); + + // Compute shift between MS and P (in Pan pixels) + // in order to keep the top left corners unchanged, apply an + // additional offset of (3/2) panchro pixels, or 0.375 xs pixels + int lineShift_MS_P =int(vcl_floor((timeDelta/(linePeriodPan/1000)) + 0.5)) + 0.375; + int colShift_MS_P = colStartXS*4 - colStartPan-4 + 0.375; + + // Apply the scaling + typedef itk::ScalableAffineTransform TransformType; + TransformType::Pointer transform = TransformType::New(); + transform->Scale(4.0); + + // Apply the offset + TransformType::OutputVectorType offset; + offset[0] = static_cast(colShift_MS_P); + offset[1] = static_cast(lineShift_MS_P); + transform->Translate(offset); + + // Invert the transform to get the P to XS transform + TransformType::Pointer realTransform = TransformType::New(); + transform->GetInverse(realTransform); + + return realTransform; + } + +} // End namespace otb + +#endif + + diff -Nru otb-4.0.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.h otb-4.2.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.h --- otb-4.0.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Projections/otbPleiadesPToXSAffineTransformCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,94 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbPleiadesPToXSAffineTransformCalculator__h +#define __otbPleiadesPToXSAffineTransformCalculator__h + +#include "itkLightObject.h" +#include "itkObjectFactory.h" +#include "itkScalableAffineTransform.h" +#include "itkImageBase.h" + +namespace otb { +/** + * \class PleiadesPToXSAffineTransformCalculator + * \brief Compute the affine transform linking P and XS pixel position for Pleiades sensor bundles + * + * Pleiades sensor bundle are exactly homotetic, it is therefore + * possible to corregister the pancrhomatic and multispectral images + * with a simple affine transform without using any sensor + * modelling. This yelds a very accurate corregistration and avoid the + * use of a DSM which may cause registration errors due to height errors. + * + * This calculator is a helper class to build the affine transform. It + * consists in only two static methods: one to check if the transform + * calculation applies to the given pair of images, the other to + * actually estimate the transfrom. + * + * The estimated transform returned by the latter transforms + * pancrhomatic image positions to multispectral image positions. If + * the inverse transform is needed, one can call the GetInverse() + * method of the transform to retrieve it. + * + */ +class ITK_EXPORT PleiadesPToXSAffineTransformCalculator + : public itk::LightObject +{ +public: + typedef PleiadesPToXSAffineTransformCalculator Self; + typedef itk::LightObject Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + itkTypeMacro(PleiadesPToXSAffineTransformCalculator,itk::LightObject); + + typedef itk::ScalableAffineTransform TransformType; + + /** + * This function checks if the transform calculation applies to the + * given pair of images. Checked items are: + * - Both images are sucessfully undertood by OTB as Pleiades images, + * - Both images processing level is SENSOR", + * - XS and Pan ids (except last 4 letters) are equal. + * \return True if the calculation applies + */ + static bool CanCompute(const itk::ImageBase<2> * panchromaticImage, const itk::ImageBase<2> * xsImage); + + + /** + * This function computes the transform for a pair of image. Note + * that the CanCompute() method is first called, and that an + * exception will be raised if computation can not be done. + * + * This function reads both images support data and builds a + * transform that will exactly coregister the images. + * + * \return The computed transform + */ + static TransformType::Pointer Compute(const itk::ImageBase<2> * panchromaticImage, const itk::ImageBase<2> * xsImage); + +private: + PleiadesPToXSAffineTransformCalculator(); // purposely not implemented + PleiadesPToXSAffineTransformCalculator(const Self &); // purposely not implemented + void operator =(const Self&); // purposely not implemented +}; + + +} // End namespace otb + + +#endif diff -Nru otb-4.0.0/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx otb-4.2.0/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx --- otb-4.0.0/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Projections/otbVectorDataIntoImageProjectionFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -117,8 +117,8 @@ { m_VdExtractFilter->SetInput(this->GetInput()); - typedef typename ImageType::IndexType IndexType; typedef typename ImageType::PointType PointType; + typedef typename ImageType::SizeType SizeType; if (m_InputImage.IsNull()) { @@ -132,24 +132,28 @@ std::cout << "ProjRef of the input vector data: "<< this->GetInput()->GetProjectionRef() << std::endl; */ // Get the index of the corner of the image - IndexType ul, ur, ll, lr; PointType pul, pur, pll, plr; - ul = m_InputImage->GetLargestPossibleRegion().GetIndex(); - ur = ul; - ll = ul; - lr = ul; - ur[0] += m_InputImage->GetLargestPossibleRegion().GetSize()[0]; - lr[0] += m_InputImage->GetLargestPossibleRegion().GetSize()[0]; - lr[1] += m_InputImage->GetLargestPossibleRegion().GetSize()[1]; - ll[1] += m_InputImage->GetLargestPossibleRegion().GetSize()[1]; + itk::ContinuousIndex ul(m_InputImage->GetLargestPossibleRegion().GetIndex()); + ul[0] += -0.5; + ul[1] += -0.5; + + itk::ContinuousIndex ur(ul); + itk::ContinuousIndex ll(ul); + itk::ContinuousIndex lr(ul); + + SizeType size = m_InputImage->GetLargestPossibleRegion().GetSize(); + ur[0] += size[0]; + lr[0] += size[0]; + lr[1] += size[1]; + ll[1] += size[1]; //std::cout << "bounding box of the input image (pixel): "<< ur << ", " << ul << ", " << lr << ", " << ll << std::endl; // Transform to physical point - m_InputImage->TransformIndexToPhysicalPoint(ul, pul); - m_InputImage->TransformIndexToPhysicalPoint(ur, pur); - m_InputImage->TransformIndexToPhysicalPoint(ll, pll); - m_InputImage->TransformIndexToPhysicalPoint(lr, plr); + m_InputImage->TransformContinuousIndexToPhysicalPoint(ul, pul); + m_InputImage->TransformContinuousIndexToPhysicalPoint(ur, pur); + m_InputImage->TransformContinuousIndexToPhysicalPoint(ll, pll); + m_InputImage->TransformContinuousIndexToPhysicalPoint(lr, plr); //std::cout << "bounding box of the input image (physical): "<< pur << ", " << pul << ", " << plr << ", " << pll << std::endl; // Build the cartographic region diff -Nru otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx --- otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParameters.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,83 +26,21 @@ namespace otb { -///*********************** FilterFunctionValues **************************/ -//FilterFunctionValues -//::FilterFunctionValues() -//{ -// m_MinSpectralValue = 0; -// m_MaxSpectralValue = 1; -// // Fill with 1. Size 3 for 6S interpolation -// m_FilterFunctionValues = ValuesVectorType(3, 1.); -// m_UserStep = 0.0025; -//} -// -//FilterFunctionValues::WavelengthSpectralBandType -//FilterFunctionValues -//::GetCenterSpectralValue() const -//{ -// // The computation is done by taking the weighted average of the -// // filter. The computation is done each time the value is requested. -// // It is anticipated that this method won't be called much and that -// // the cost will be negligible compared to the rest of the processing -// double total = 0; -// for (unsigned int i = 0; i < m_FilterFunctionValues6S.size(); ++i) -// { -// total += m_FilterFunctionValues6S[i]; -// } -// unsigned int centerIndex = 0; -// double total2 = 0; -// for (centerIndex = 0; centerIndex < m_FilterFunctionValues6S.size(); ++centerIndex) -// { -// total2 += m_FilterFunctionValues6S[centerIndex]; -// if (total2 > total / 2) break; -// } -// return m_MinSpectralValue + m_UserStep * centerIndex; -//} -// -///**PrintSelf method */ -//void -//FilterFunctionValues -//::PrintSelf(std::ostream& os, itk::Indent indent) const -//{ -// os << indent << "Minimum spectral value : " << m_MinSpectralValue << std::endl; -// os << indent << "Maximum spectral value : " << m_MaxSpectralValue << std::endl; -// os << indent << "Wavelength spectral band step: " << m_UserStep << std::endl; -// os << indent << "Filter function values: " << std::endl; -// for (unsigned int i = 0; i < m_FilterFunctionValues.size(); ++i) -// { -// os << indent << m_FilterFunctionValues[i] << std::endl; -// } -// os << indent << "6S Filter function values: " << std::endl; -// for (unsigned int i = 0; i < m_FilterFunctionValues6S.size(); ++i) -// { -// os << indent << m_FilterFunctionValues6S[i] << std::endl; -// } -//} - -/*********************** AtmosphericCorrectionParameters **************************/ -/** - * Constructor - */ + AtmosphericCorrectionParameters ::AtmosphericCorrectionParameters() { - m_SolarZenithalAngle = 361.; - m_SolarAzimutalAngle = 361.; - m_ViewingZenithalAngle = 361.; - m_ViewingAzimutalAngle = 361.; - m_Month = 0; - m_Day = 0; + m_AtmosphericPressure = 1030.; m_WaterVaporAmount = 2.5; m_OzoneAmount = 0.28; m_AerosolModel = CONTINENTAL; m_AerosolOptical = 0.2; - - m_WavelengthSpectralBand = InternalWavelengthSpectralBandVectorType::New(); - m_WavelengthSpectralBand->Clear(); - + m_AeronetFileName = ""; + m_Day = 1; + m_Month = 1; + } /** Get data from aeronet file*/ @@ -127,41 +65,18 @@ m_WaterVaporAmount = reader->GetOutput()->GetWater(); } -/** Get data from filter function file*/ -void -AtmosphericCorrectionParameters -::LoadFilterFunctionValue(const std::string& filename) -{ - m_WavelengthSpectralBand->Clear(); - SpectralSensitivityReader::Pointer spectralSensitivityReader = SpectralSensitivityReader::New(); - spectralSensitivityReader->SetFileName(filename); - spectralSensitivityReader->Update(); - m_WavelengthSpectralBand = spectralSensitivityReader->GetOutput(); -} /**PrintSelf method */ void AtmosphericCorrectionParameters ::PrintSelf(std::ostream& os, itk::Indent indent) const { - os << "Solar zenithal angle : " << m_SolarZenithalAngle << std::endl; - os << "Solar azimutal angle : " << m_SolarAzimutalAngle << std::endl; - os << "Viewing zenithal angle: " << m_ViewingZenithalAngle << std::endl; - os << "Viewing azimutal angle: " << m_ViewingAzimutalAngle << std::endl; - os << "Month : " << m_Month << std::endl; - os << "Day : " << m_Day << std::endl; + os << "Atmospheric pressure : " << m_AtmosphericPressure << std::endl; os << "Water vapor amount : " << m_WaterVaporAmount << std::endl; os << "Ozone amount : " << m_OzoneAmount << std::endl; os << "Aerosol model : " << m_AerosolModel << std::endl; os << "Aerosol optical : " << m_AerosolOptical << std::endl; - // Function values print : - os << "Filter function values: " << std::endl; - for (unsigned int i = 0; i < m_WavelengthSpectralBand->Size(); ++i) - { - os << indent << "Channel " << i + 1 << " : " << std::endl; - os << indent << m_WavelengthSpectralBand->GetNthElement(i) << std::endl; - } } } // end namespace otb diff -Nru otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParameters.h otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParameters.h --- otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParameters.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParameters.h 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #ifndef __otbAtmosphericCorrectionParameters_h #define __otbAtmosphericCorrectionParameters_h -#include "itkDataObject.h" +#include "itkObject.h" #include "itkObjectFactory.h" #include "itkMacro.h" #include "itkVariableSizeMatrix.h" @@ -44,56 +44,22 @@ public: /** Standard typedefs */ typedef AtmosphericCorrectionParameters Self; - typedef itk::DataObject Superclass; + typedef itk::Object Superclass; typedef itk::SmartPointer Pointer; typedef itk::SmartPointer ConstPointer; /** Type macro */ - itkTypeMacro(AtmosphericCorrectionParameters, DataObject); + itkTypeMacro(AtmosphericCorrectionParameters, Object); /** Creation through object factory macro */ itkNewMacro(Self); - typedef enum {NO_AEROSOL = 0, CONTINENTAL = 1, MARITIME = 2, URBAN = 3, DESERTIC = 5} AerosolModelType; + typedef enum {NO_AEROSOL = 0, CONTINENTAL = 1, MARITIME = 2, URBAN = 3, DESERTIC = 4} AerosolModelType; typedef ObjectList InternalWavelengthSpectralBandVectorType; typedef InternalWavelengthSpectralBandVectorType::Pointer WavelengthSpectralBandVectorType; /** - * Set/Get the solar zenithal angle. - */ - itkSetMacro(SolarZenithalAngle, double); - itkGetMacro(SolarZenithalAngle, double); - /** - * Set/Get the solar azimutal angle. - */ - itkSetMacro(SolarAzimutalAngle, double); - itkGetMacro(SolarAzimutalAngle, double); - - /** - * Set/Get the viewing zenithal angle. - */ - itkSetMacro(ViewingZenithalAngle, double); - itkGetMacro(ViewingZenithalAngle, double); - /** - * Set/Get the viewing azimutal angle. - */ - itkSetMacro(ViewingAzimutalAngle, double); - itkGetMacro(ViewingAzimutalAngle, double); - - /** - * Set/Get the month. - */ - itkSetClampMacro(Month, unsigned int, 1, 12); - itkGetMacro(Month, unsigned int); - - /** - * Set/Get the day. - */ - itkSetClampMacro(Day, unsigned int, 1, 31); - itkGetMacro(Day, unsigned int); - - /** * Set/Get the atmospheric pressure. */ itkSetMacro(AtmosphericPressure, double); @@ -123,53 +89,46 @@ itkSetMacro(AerosolOptical, double); itkGetMacro(AerosolOptical, double); - /** - * Set/Get the wavelength spectral band. - */ - void SetWavelengthSpectralBand(const WavelengthSpectralBandVectorType& waveband) + + /** Get/Set Aeronet file name. */ + itkSetMacro(AeronetFileName, std::string); + itkGetMacro(AeronetFileName, std::string); + + + /** Read the aeronet data and extract aerosol optical and water vapor amount. */ + void ReadAeronetData(const std::string& file, int year, int month, int day, int hour, int minute, double epsi); + + + void UpdateAeronetData(const std::string& file, int year, int month, int day, int hour, int minute, double epsi); + void UpdateAeronetData(const std::string& file, int year, int month, int day, int hour, int minute) { - m_WavelengthSpectralBand = waveband; + this->UpdateAeronetData(file, year, month, day, hour, minute, 0.4); } - void SetWavelengthSpectralBandWithIndex(unsigned int id, const FilterFunctionValues::Pointer& function) + void UpdateAeronetData(int year, int month, int day, int hour, int minute, double epsi) { - if (m_WavelengthSpectralBand->Size() < id + 1) - { - for (unsigned int j = 0; j < (id + 1 - m_WavelengthSpectralBand->Size()); ++j) - { - FilterFunctionValues::Pointer temp; - m_WavelengthSpectralBand->PushBack(temp); - } - } - m_WavelengthSpectralBand->SetNthElement(id, function); + this->UpdateAeronetData(m_AeronetFileName, year, month, day, hour, minute, epsi); } - WavelengthSpectralBandVectorType GetWavelengthSpectralBand() const + void UpdateAeronetData(int year, int month, int day, int hour, int minute) { - return m_WavelengthSpectralBand; + this->UpdateAeronetData(m_AeronetFileName, year, month, day, hour, minute, 0.4); } - const WavelengthSpectralBandVectorType * GetWavelengthSpectralBandRef() const + void UpdateAeronetData(const std::string& file, int year, int hour, int minute) { - return &m_WavelengthSpectralBand; + this->UpdateAeronetData(file, year, m_Month, m_Day, hour, minute, 0.4); } - - /** Read the aeronet data and extract aerosol optical and water vapor amount. */ - void UpdateAeronetData(const std::string& file, int year, int month, int day, int hour, int minute, double epsi); - void UpdateAeronetData(const std::string& file, int year, int month, int day, int hour, int minute) + void UpdateAeronetData(int year, int hour, int minute) { - this->UpdateAeronetData(file, year, month, day, hour, minute, 0.4); + this->UpdateAeronetData(m_AeronetFileName, year, m_Month, m_Day, hour, minute, 0.4); } - void UpdateAeronetData(const std::string& file, int year, int hour, int minute, double epsi) + + /*void UpdateAeronetData(const std::string& file, int year, int hour, int minute, double epsi) CHRIS { this->UpdateAeronetData(file, year, m_Month, m_Day, hour, minute, epsi); } void UpdateAeronetData(const std::string& file, int year, int hour, int minute) { this->UpdateAeronetData(file, year, m_Month, m_Day, hour, minute, 0.4); - } - - /** - * Read a file that contains filter function values on the 6S format. - */ - void LoadFilterFunctionValue(const std::string& filename); + }*/ /** Constructor */ AtmosphericCorrectionParameters(); @@ -184,19 +143,12 @@ private: AtmosphericCorrectionParameters(const Self &); //purposely not implemented void operator =(const Self&); //purposely not implemented - - /** The Solar zenithal angle */ - double m_SolarZenithalAngle; - /** The Solar azimutal angle */ - double m_SolarAzimutalAngle; - /** The Viewing zenithal angle */ - double m_ViewingZenithalAngle; - /** The Viewing azimutal angle */ - double m_ViewingAzimutalAngle; - /** The Month */ - unsigned int m_Month; - /** The Day (in the month) */ - unsigned int m_Day; + /** Path to an Aeronet data file, allows to compute aerosol optical and water vapor amounts. */ + std::string m_AeronetFileName; + /** Day */ + int m_Day; + /** Month */ + int m_Month; /** The Atmospheric pressure */ double m_AtmosphericPressure; /** The Water vapor amount (Total water vapor content over vertical atmospheric column) */ @@ -207,8 +159,6 @@ AerosolModelType m_AerosolModel; /** The Aerosol optical (radiative impact of aerosol for the reference wavelength 550-nm) */ double m_AerosolOptical; - /** Wavelength for the each spectral band definition */ - WavelengthSpectralBandVectorType m_WavelengthSpectralBand; }; } // end namespace otb diff -Nru otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx --- otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -135,7 +135,11 @@ AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms ::GenerateData() { - + itkExceptionMacro("This class is not compatible with the new radiometry" + " framework. It is kept in the sources for documentation purpose. Check" + " Example/Radiometry/AtmosphericCorrectionSequencement.cxx for details" + " on the new framework"); +#if 0 AtmosphericCorrectionParametersPointer input = this->GetInput(); AtmosphericRadiativeTermsPointer output = this->GetOutput(); @@ -201,6 +205,7 @@ output->SetUpwardDiffuseTransmittanceForAerosol(i, upwardDiffuseTransmittanceForAerosol); output->SetWavelengthSpectralBand(i, input->GetWavelengthSpectralBand()->GetNthElement(i)->GetCenterSpectralValue()); } +#endif } /** diff -Nru otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h --- otb-4.0.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h 2014-09-03 08:29:34.000000000 +0000 @@ -37,6 +37,9 @@ * \sa ReflectanceToSurfaceReflectanceImageFilter * \ingroup DataSources * \ingroup Radiometry + * \deprecated This class has been replaced by + * otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms, + * which only contains a static function that computes the radiative terms. */ class ITK_EXPORT AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms : public itk::ProcessObject diff -Nru otb-4.0.0/Code/Radiometry/otbImageMetadataCorrectionParameters.cxx otb-4.2.0/Code/Radiometry/otbImageMetadataCorrectionParameters.cxx --- otb-4.0.0/Code/Radiometry/otbImageMetadataCorrectionParameters.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbImageMetadataCorrectionParameters.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,81 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + +#include "otbImageMetadataCorrectionParameters.h" +#include "otbSpectralSensitivityReader.h" + +namespace otb +{ + + +/*********************** ImageMetadataCorrectionParameters **************************/ +/** + * Constructor + */ + +ImageMetadataCorrectionParameters +::ImageMetadataCorrectionParameters() +{ + m_SolarZenithalAngle = 361.; + m_SolarAzimutalAngle = 361.; + m_ViewingZenithalAngle = 361.; + m_ViewingAzimutalAngle = 361.; + m_Month = 0; + m_Day = 0; + m_Year = 0; + m_FilterFunctionValuesFileName = ""; + + m_WavelengthSpectralBand = InternalWavelengthSpectralBandVectorType::New(); + m_WavelengthSpectralBand->Clear(); +} + + +/** Get data from filter function file*/ +void +ImageMetadataCorrectionParameters +::LoadFilterFunctionValue(const std::string& filename) +{ + m_WavelengthSpectralBand->Clear(); + SpectralSensitivityReader::Pointer spectralSensitivityReader = SpectralSensitivityReader::New(); + spectralSensitivityReader->SetFileName(filename); + spectralSensitivityReader->Update(); + m_WavelengthSpectralBand = spectralSensitivityReader->GetOutput(); +} + +/**PrintSelf method */ +void +ImageMetadataCorrectionParameters +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + os << "Solar zenithal angle : " << m_SolarZenithalAngle << std::endl; + os << "Solar azimutal angle : " << m_SolarAzimutalAngle << std::endl; + os << "Viewing zenithal angle: " << m_ViewingZenithalAngle << std::endl; + os << "Viewing azimutal angle: " << m_ViewingAzimutalAngle << std::endl; + os << "Month : " << m_Month << std::endl; + os << "Day : " << m_Day << std::endl; + os << "Year : " << m_Year << std::endl; + + // Function values print : + os << "Filter function values: " << std::endl; + for (unsigned int i = 0; i < m_WavelengthSpectralBand->Size(); ++i) + { + os << indent << "Channel " << i + 1 << " : " << std::endl; + os << indent << m_WavelengthSpectralBand->GetNthElement(i) << std::endl; + } +} +} // end namespace otb diff -Nru otb-4.0.0/Code/Radiometry/otbImageMetadataCorrectionParameters.h otb-4.2.0/Code/Radiometry/otbImageMetadataCorrectionParameters.h --- otb-4.0.0/Code/Radiometry/otbImageMetadataCorrectionParameters.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbImageMetadataCorrectionParameters.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,176 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbImageMetadataCorrectionParameters_h +#define __otbImageMetadataCorrectionParameters_h + +#include "itkObject.h" +#include "itkMacro.h" +#include "itkVariableSizeMatrix.h" +#include "itkVariableLengthVector.h" +#include "otbObjectList.h" +#include "otbFilterFunctionValues.h" +#include +#include + +namespace otb +{ +/** \class ImageMetadataCorrectionParameters + * \brief This class contains all atmospheric correction parameters. + * + * Each value can be read in the metadata of an image (ex: SPOT5, ...) or directly set by the user. + * + * \ingroup Radiometry + * + */ + +class ITK_EXPORT ImageMetadataCorrectionParameters : public itk::DataObject +{ +public: + /** Standard typedefs */ + typedef ImageMetadataCorrectionParameters Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** Type macro */ + itkTypeMacro(ImageMetadataCorrectionParameters, Object); + + /** Creation through object factory macro */ + itkNewMacro(Self); + + typedef ObjectList InternalWavelengthSpectralBandVectorType; + typedef InternalWavelengthSpectralBandVectorType::Pointer WavelengthSpectralBandVectorType; + + /** + * Set/Get the solar zenithal angle. + */ + itkSetMacro(SolarZenithalAngle, double); + itkGetMacro(SolarZenithalAngle, double); + /** + * Set/Get the solar azimutal angle. + */ + itkSetMacro(SolarAzimutalAngle, double); + itkGetMacro(SolarAzimutalAngle, double); + + /** + * Set/Get the viewing zenithal angle. + */ + itkSetMacro(ViewingZenithalAngle, double); + itkGetMacro(ViewingZenithalAngle, double); + /** + * Set/Get the viewing azimutal angle. + */ + itkSetMacro(ViewingAzimutalAngle, double); + itkGetMacro(ViewingAzimutalAngle, double); + + /** + * Set/Get the month. + */ + itkSetClampMacro(Month, unsigned int, 1, 12); + itkGetMacro(Month, unsigned int); + + /** + * Set/Get the day. + */ + itkSetClampMacro(Day, unsigned int, 1, 31); + itkGetMacro(Day, unsigned int); + + /** + * Set/Get the year. + */ + itkSetMacro(Year, unsigned int); + itkGetMacro(Year, unsigned int); + + /** Get/Set FilterFunction file name. */ + itkSetMacro(FilterFunctionValuesFileName, std::string); + itkGetMacro(FilterFunctionValuesFileName, std::string); + + /** + * Set/Get the wavelength spectral band. + */ + void SetWavelengthSpectralBand(const WavelengthSpectralBandVectorType& waveband) + { + m_WavelengthSpectralBand = waveband; + } + void SetWavelengthSpectralBandWithIndex(unsigned int id, const FilterFunctionValues::Pointer& function) + { + if (m_WavelengthSpectralBand->Size() < id + 1) + { + for (unsigned int j = 0; j < (id + 1 - m_WavelengthSpectralBand->Size()); ++j) + { + FilterFunctionValues::Pointer temp; + m_WavelengthSpectralBand->PushBack(temp); + } + } + m_WavelengthSpectralBand->SetNthElement(id, function); + } + WavelengthSpectralBandVectorType GetWavelengthSpectralBand() const + { + return m_WavelengthSpectralBand; + } + const WavelengthSpectralBandVectorType * GetWavelengthSpectralBandRef() const + { + return &m_WavelengthSpectralBand; + } + + /** + * Read a file that contains filter function values on the 6S format. + */ + void LoadFilterFunctionValue(const std::string& filename); + void LoadFilterFunctionValue() + { + this->LoadFilterFunctionValue(m_FilterFunctionValuesFileName); + } + + /** Constructor */ + ImageMetadataCorrectionParameters(); + /** Destructor */ + ~ImageMetadataCorrectionParameters() {} + +protected: + + /**PrintSelf method */ + void PrintSelf(std::ostream& os, itk::Indent indent) const; + +private: + ImageMetadataCorrectionParameters(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + /** The Solar zenithal angle */ + double m_SolarZenithalAngle; + /** The Solar azimutal angle */ + double m_SolarAzimutalAngle; + /** The Viewing zenithal angle */ + double m_ViewingZenithalAngle; + /** The Viewing azimutal angle */ + double m_ViewingAzimutalAngle; + /** The Month */ + unsigned int m_Month; + /** The Day (in the month) */ + unsigned int m_Day; + /** The Year */ + unsigned int m_Year; + std::string m_FilterFunctionValuesFileName; + + /** Wavelength for the each spectral band definition */ + WavelengthSpectralBandVectorType m_WavelengthSpectralBand; +}; + +} // end namespace otb + +#endif diff -Nru otb-4.0.0/Code/Radiometry/otbImageToReflectanceImageFilter.h otb-4.2.0/Code/Radiometry/otbImageToReflectanceImageFilter.h --- otb-4.0.0/Code/Radiometry/otbImageToReflectanceImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbImageToReflectanceImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -22,6 +22,7 @@ #ifndef __otbImageToReflectanceImageFilter_h #define __otbImageToReflectanceImageFilter_h +#include "otbVarSol.h" #include "otbUnaryImageFunctorWithVectorImageFilter.h" #include "otbImageToLuminanceImageFilter.h" #include "otbLuminanceToReflectanceImageFilter.h" @@ -315,12 +316,8 @@ { if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) { - otb_6s_doublereal dsol = 0.; - otb_6s_integer day = static_cast(m_Day); - otb_6s_integer month = static_cast(m_Month); - //int cr(0); - otb_6s_varsol_(&day, &month, &dsol); - coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * static_cast(dsol); + double dsol = VarSol::GetVarSol(m_Day, m_Month); + coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * dsol; } else { diff -Nru otb-4.0.0/Code/Radiometry/otbLuminanceToImageImageFilter.h otb-4.2.0/Code/Radiometry/otbLuminanceToImageImageFilter.h --- otb-4.0.0/Code/Radiometry/otbLuminanceToImageImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbLuminanceToImageImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,225 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + Some parts of this code are derived from ITK. See ITKCopyright.txt + for details. + + + 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. + +=========================================================================*/ +#ifndef __otbLuminanceToImageImageFilter_h +#define __otbLuminanceToImageImageFilter_h + +#include "otb_6S.h" +#include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "otbVectorImage.h" +#include "itkNumericTraits.h" +#include "itkVariableLengthVector.h" +#include "otbMacro.h" +#include "otbOpticalImageMetadataInterface.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" + +#include + +namespace otb +{ +namespace Functor +{ +/** + * \class LuminanceToImageImageFunctor + * \brief Substract beta to the Input and multiply by alpha. + * + * \sa LuminanceToImageImageFilter + * \ingroup Functor + * \ingroup Radiometry + */ + +template +class LuminanceToImageImageFunctor +{ +public: + LuminanceToImageImageFunctor() : + m_Alpha(1.), + m_Beta(0.) + {} + + virtual ~LuminanceToImageImageFunctor() {} + + void SetAlpha(double alpha) + { + m_Alpha = alpha; + } + void SetBeta(double beta) + { + m_Beta = beta; + } + double GetAlpha() + { + return m_Alpha; + } + double GetBeta() + { + return m_Beta; + } + + inline TOutput operator ()(const TInput& inPixel) const + { + TOutput outPixel; + double temp; + temp = (static_cast(inPixel) - m_Beta) * m_Alpha; + outPixel = static_cast(temp); + return outPixel; + } + +private: + double m_Alpha; + double m_Beta; +}; +} + +/** \class LuminanceToImageImageFilter + * \brief Convert a raw value into a luminance value + * + * Transform a luminance image into a classical image. For this it + * uses the functor LuminanceToImageImageFunctor calling for each component of each pixel. + * + * + * For Spot image in the dimap format, the correction parameters are + * retrieved automatically from the metadata + * + * \ingroup LuminanceToImageImageFunctor + * \ingroup Radiometry + * + * \example Radiometry/AtmosphericCorrectionSequencement.cxx + */ +template +class ITK_EXPORT LuminanceToImageImageFilter : + public UnaryImageFunctorWithVectorImageFilter > +{ +public: + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** "typedef" to simplify the variables definition and the declaration. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename Functor::LuminanceToImageImageFunctor FunctorType; + + /** "typedef" for standard classes. */ + typedef LuminanceToImageImageFilter Self; + typedef UnaryImageFunctorWithVectorImageFilter Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(LuminanceToImageImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef typename itk::VariableLengthVector VectorType; + + /** Image size "typedef" definition. */ + typedef typename InputImageType::SizeType SizeType; + + /** Set the absolute calibration gains. */ + itkSetMacro(Alpha, VectorType); + + /** Give the absolute calibration gains. */ + itkGetConstReferenceMacro(Alpha, VectorType); + + /** Set the absolute calibration bias. */ + itkSetMacro(Beta, VectorType); + /** Give the absolute calibration bias. */ + itkGetConstReferenceMacro(Beta, VectorType); + +protected: + /** Constructor */ + LuminanceToImageImageFilter() + { + m_Alpha.SetSize(0); + m_Beta.SetSize(0); + }; + + /** Destructor */ + virtual ~LuminanceToImageImageFilter() {} + + /** Update the functor list and input parameters */ + virtual void BeforeThreadedGenerateData(void) + { + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( + this->GetInput()->GetMetaDataDictionary()); + if (m_Alpha.GetSize() == 0) + { + m_Alpha = imageMetadataInterface->GetPhysicalGain(); + } + + if (m_Beta.GetSize() == 0) + { + m_Beta = imageMetadataInterface->GetPhysicalBias(); + } + + otbMsgDevMacro(<< "Dimension: "); + otbMsgDevMacro(<< "m_Alpha.GetSize(): " << m_Alpha.GetSize()); + otbMsgDevMacro(<< "m_Beta.GetSize() : " << m_Beta.GetSize()); + otbMsgDevMacro( + << "this->GetInput()->GetNumberOfComponentsPerPixel() : " << this->GetInput()->GetNumberOfComponentsPerPixel()); + + if ((m_Alpha.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) + || (m_Beta.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) + { + itkExceptionMacro(<< "Alpha and Beta parameters should have the same size as the number of bands"); + } + + otbMsgDevMacro(<< "Using correction parameters: "); + otbMsgDevMacro(<< "Alpha (gain): " << m_Alpha); + otbMsgDevMacro(<< "Beta (bias): " << m_Beta); + + this->GetFunctorVector().clear(); + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + FunctorType functor; + functor.SetAlpha(m_Alpha[i]); + functor.SetBeta(m_Beta[i]); + this->GetFunctorVector().push_back(functor); + } + } + +private: + /** Ponderation declaration*/ + VectorType m_Alpha; + VectorType m_Beta; +}; + +} // end namespace otb + +#endif diff -Nru otb-4.0.0/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h otb-4.2.0/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h --- otb-4.0.0/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbLuminanceToReflectanceImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #ifndef __otbLuminanceToReflectanceImageFilter_h #define __otbLuminanceToReflectanceImageFilter_h -#include "otb_6S.h" +#include "otbVarSol.h" #include "otbUnaryImageFunctorWithVectorImageFilter.h" #include "otbVectorImage.h" #include "otbMath.h" @@ -297,12 +297,8 @@ { if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) { - otb_6s_doublereal dsol = 0.; - otb_6s_integer day = static_cast(m_Day); - otb_6s_integer month = static_cast(m_Month); - //int cr(0); - otb_6s_varsol_(&day, &month, &dsol); - coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * static_cast(dsol); + double dsol = VarSol::GetVarSol(m_Day, m_Month); + coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * dsol; } else { diff -Nru otb-4.0.0/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h otb-4.2.0/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h --- otb-4.0.0/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,113 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms_h +#define __otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms_h + +#include "otbAtmosphericRadiativeTerms.h" +#include "otbAtmosphericCorrectionParameters.h" +#include "otbImageMetadataCorrectionParameters.h" +#include "otbSIXSTraits.h" + +namespace otb +{ + +/** \class RadiometryCorrectionParametersToAtmosphericRadiativeTerms + * \brief TODO. + * + * TODO + * \ingroup Radiometry + * + */ + class ITK_EXPORT RadiometryCorrectionParametersToAtmosphericRadiativeTerms + { + public: + + /** Call the varSol function*/ + static AtmosphericRadiativeTerms::Pointer Compute(AtmosphericCorrectionParameters* paramAtmo, ImageMetadataCorrectionParameters* paramAcqui) + { + AtmosphericRadiativeTerms::Pointer radTermsOut = AtmosphericRadiativeTerms::New(); + + typedef AtmosphericCorrectionParameters::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType; + WavelengthSpectralBandVectorType WavelengthSpectralBandVector = paramAcqui->GetWavelengthSpectralBand(); + unsigned int NbBand = WavelengthSpectralBandVector->Size(); + + radTermsOut->ValuesInitialization(NbBand); + + 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.); + + for (unsigned int i = 0; i < NbBand; ++i) + { + atmosphericReflectance = 0.; + atmosphericSphericalAlbedo = 0.; + totalGaseousTransmission = 0.; + downwardTransmittance = 0.; + upwardTransmittance = 0.; + upwardDiffuseTransmittance = 0.; + upwardDirectTransmittance = 0.; + upwardDiffuseTransmittanceForRayleigh = 0.; + upwardDiffuseTransmittanceForAerosol = 0.; + SIXSTraits::ComputeAtmosphericParameters( + paramAcqui->GetSolarZenithalAngle(), /** The Solar zenithal angle */ + paramAcqui->GetSolarAzimutalAngle(), /** The Solar azimutal angle */ + paramAcqui->GetViewingZenithalAngle(), /** The Viewing zenithal angle */ + paramAcqui->GetViewingAzimutalAngle(), /** The Viewing azimutal angle */ + paramAcqui->GetMonth(), /** The Month */ + paramAcqui->GetDay(), /** The Day (in the month) */ + paramAtmo->GetAtmosphericPressure(), /** The Atmospheric pressure */ + paramAtmo->GetWaterVaporAmount(), /** The Water vapor amount (Total water vapor content over vertical atmospheric column) */ + paramAtmo->GetOzoneAmount(), /** The Ozone amount (Stratospheric ozone layer content) */ + paramAtmo->GetAerosolModel(), /** The Aerosol model */ + paramAtmo->GetAerosolOptical(), /** The Aerosol optical (radiative impact of aerosol for the reference wavelength 550-nm) */ + paramAcqui->GetWavelengthSpectralBand()->GetNthElement(i), /** Wavelength for the spectral band definition */ + /** Note : The Max wavelength spectral band value must be updated ! */ + atmosphericReflectance, /** Atmospheric reflectance */ + atmosphericSphericalAlbedo, /** atmospheric spherical albedo */ + totalGaseousTransmission, /** Total gaseous transmission */ + downwardTransmittance, /** downward transmittance */ + upwardTransmittance, /** upward transmittance */ + upwardDiffuseTransmittance, /** Upward diffuse transmittance */ + upwardDirectTransmittance, /** Upward direct transmittance */ + upwardDiffuseTransmittanceForRayleigh, /** Upward diffuse transmittance for rayleigh */ + upwardDiffuseTransmittanceForAerosol /** Upward diffuse transmittance for aerosols */ + ); + + radTermsOut->SetIntrinsicAtmosphericReflectance(i, atmosphericReflectance); + radTermsOut->SetSphericalAlbedo(i, atmosphericSphericalAlbedo); + radTermsOut->SetTotalGaseousTransmission(i, totalGaseousTransmission); + radTermsOut->SetDownwardTransmittance(i, downwardTransmittance); + radTermsOut->SetUpwardTransmittance(i, upwardTransmittance); + radTermsOut->SetUpwardDiffuseTransmittance(i, upwardDiffuseTransmittance); + radTermsOut->SetUpwardDirectTransmittance(i, upwardDirectTransmittance); + radTermsOut->SetUpwardDiffuseTransmittanceForRayleigh(i, upwardDiffuseTransmittanceForRayleigh); + radTermsOut->SetUpwardDiffuseTransmittanceForAerosol(i, upwardDiffuseTransmittanceForAerosol); + radTermsOut->SetWavelengthSpectralBand(i, paramAcqui->GetWavelengthSpectralBand()->GetNthElement(i)->GetCenterSpectralValue()); + } + + return radTermsOut; + } + }; +} //end namespace otb +#endif diff -Nru otb-4.0.0/Code/Radiometry/otbReflectanceToImageImageFilter.h otb-4.2.0/Code/Radiometry/otbReflectanceToImageImageFilter.h --- otb-4.0.0/Code/Radiometry/otbReflectanceToImageImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbReflectanceToImageImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,351 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + Some parts of this code are derived from ITK. See ITKCopyright.txt + for details. + + + 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. + +=========================================================================*/ +#ifndef __otbReflectanceToImageImageFilter_h +#define __otbReflectanceToImageImageFilter_h + +#include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "otbLuminanceToImageImageFilter.h" +#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbVectorImage.h" +#include "itkNumericTraits.h" +#include "itkVariableLengthVector.h" + +namespace otb +{ +namespace Functor +{ +/** \class ReflectanceToImageImageFunctor + * \brief Call the ReflectanceToLuminanceFunctor over the input and the LuminanceToImageFunctor to this result. + * + * + * \sa ReflectanceToImageImageFilter + * + * \ingroup Functor + * \ingroup LuminanceToImageFunctor + * \ingroup ReflectanceToLuminanceFunctor + * \ingroup Radiometry + */ +template +class ReflectanceToImageImageFunctor +{ +public: + ReflectanceToImageImageFunctor() {} + virtual ~ReflectanceToImageImageFunctor() {} + + typedef Functor::LuminanceToImageImageFunctor LumToImFunctorType; + typedef Functor::ReflectanceToLuminanceImageFunctor ReflecToLumFunctorType; + + void SetAlpha(double alpha) + { + m_LumToImFunctor.SetAlpha(alpha); + } + void SetBeta(double beta) + { + m_LumToImFunctor.SetBeta(beta); + } + void SetSolarIllumination(double solarIllumination) + { + m_ReflecToLumFunctor.SetSolarIllumination(solarIllumination); + } + void SetIlluminationCorrectionCoefficient(double coef) + { + m_ReflecToLumFunctor.SetIlluminationCorrectionCoefficient(coef); + } + + double GetAlpha() + { + return m_LumToImFunctor.GetAlpha(); + } + double GetBeta() + { + return m_LumToImFunctor.GetBeta(); + } + double GetSolarIllumination() + { + return m_ReflecToLumFunctor.GetSolarIllumination(); + } + double GetIlluminationCorrectionCoefficient() + { + return m_ReflecToLumFunctor.GetIlluminationCorrectionCoefficient(); + } + + inline TOutput operator ()(const TInput& inPixel) const + { + TOutput outPixel; + TOutput tempPix; + tempPix = m_ReflecToLumFunctor(inPixel); + outPixel = m_LumToImFunctor(tempPix); + + return outPixel; + } + +private: + LumToImFunctorType m_LumToImFunctor; + ReflecToLumFunctorType m_ReflecToLumFunctor; + +}; +} + +/** \class ReflectanceToImageImageFilter + * \brief Convert a reflectance into a raw value value + * + * Transform a reflectance image into a classical image image. For this it uses the functor ReflectanceToImageFunctor calling for each component of each pixel. + * The flux normalization coefficient (that is the ratio solar distance over mean solar distance) can be directly set or the user can + * give the day and the mounth of the observation and the class will used a coefficient given by a 6S routine that will give the corresponding coefficient. + * To note that in the case, 6S gives the square of the distances ratio. + * + * + * For Spot image in the dimap format, the correction parameters are + * retrieved automatically from the metadata + * + * \ingroup ReflectanceToImageImageFunctor + * \ingroup LuminanceToImageImageFilter + * \ingroup ReflectanceToLuminanceImageFilter + * \ingroup Radiometry + */ +template +class ITK_EXPORT ReflectanceToImageImageFilter : + public UnaryImageFunctorWithVectorImageFilter > +{ +public: + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** "typedef" to simplify the variables definition and the declaration. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename Functor::ReflectanceToImageImageFunctor FunctorType; + + /** "typedef" for standard classes. */ + typedef ReflectanceToImageImageFilter Self; + typedef UnaryImageFunctorWithVectorImageFilter Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(ReflectanceToImageImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef typename itk::VariableLengthVector VectorType; + + /** Image size "typedef" definition. */ + typedef typename InputImageType::SizeType SizeType; + + /** Set the absolute calibration gains. */ + itkSetMacro(Alpha, VectorType); + /** Give the absolute calibration gains. */ + itkGetConstReferenceMacro(Alpha, VectorType); + + /** Set the absolute calibration bias. */ + itkSetMacro(Beta, VectorType); + /** Give the absolute calibration bias. */ + itkGetConstReferenceMacro(Beta, VectorType); + /** Set the solar illumination value. */ + itkSetMacro(SolarIllumination, VectorType); + + /** Give the solar illumination value. */ + itkGetConstReferenceMacro(SolarIllumination, VectorType); + + /** Set the zenithal solar angle. */ + itkSetMacro(ZenithalSolarAngle, double); + /** Give the zenithal solar angle. */ + itkGetConstReferenceMacro(ZenithalSolarAngle, double); + + /** Set/Get the sun elevation angle (internally handled by the zenithal angle)*/ + virtual void SetElevationSolarAngle(double elevationAngle) + { + double zenithalAngle = 90.0 - elevationAngle; + if (this->m_ZenithalSolarAngle != zenithalAngle) + { + this->m_ZenithalSolarAngle = zenithalAngle; + this->Modified(); + } + } + + virtual double GetElevationSolarAngle() const + { + return 90.0 - this->m_ZenithalSolarAngle; + } + + /** Set the flux normalization coefficient. */ + void SetFluxNormalizationCoefficient(double coef) + { + m_FluxNormalizationCoefficient = coef; + m_IsSetFluxNormalizationCoefficient = true; + this->Modified(); + } + + /** Set the acquisition day. */ + itkSetClampMacro(Day, int, 1, 31); + /** Get the acquisition day. */ + itkGetConstReferenceMacro(Day, int); + /** Set the acquisition mounth. */ + itkSetClampMacro(Month, int, 1, 12); + /** Set the acquisition mounth. */ + itkGetConstReferenceMacro(Month, int); + +protected: + /** Constructor */ + ReflectanceToImageImageFilter() : + m_ZenithalSolarAngle(120.), //invalid value which will lead to negative radiometry + m_FluxNormalizationCoefficient(1.), + m_IsSetFluxNormalizationCoefficient(false), + m_Day(0), + m_Month(0) + { + m_Alpha.SetSize(0); + m_Beta.SetSize(0); + m_SolarIllumination.SetSize(0); + }; + + /** Destructor */ + virtual ~ReflectanceToImageImageFilter() {} + + /** Update the functor list and input parameters */ + virtual void BeforeThreadedGenerateData(void) + { + + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( + this->GetInput()->GetMetaDataDictionary()); + if (m_Alpha.GetSize() == 0) + { + m_Alpha = imageMetadataInterface->GetPhysicalGain(); + } + + if (m_Beta.GetSize() == 0) + { + m_Beta = imageMetadataInterface->GetPhysicalBias(); + } + + if ((m_Day == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Day = imageMetadataInterface->GetDay(); + } + + if ((m_Month == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Month = imageMetadataInterface->GetMonth(); + } + + if (m_SolarIllumination.GetSize() == 0) + { + m_SolarIllumination = imageMetadataInterface->GetSolarIrradiance(); + } + + if (m_ZenithalSolarAngle == 120.0) + { + //the zenithal angle is the complementary of the elevation angle + m_ZenithalSolarAngle = 90.0 - imageMetadataInterface->GetSunElevation(); + } + + otbMsgDevMacro(<< "Using correction parameters: "); + otbMsgDevMacro(<< "Alpha (gain): " << m_Alpha); + otbMsgDevMacro(<< "Beta (bias): " << m_Beta); + otbMsgDevMacro(<< "Day: " << m_Day); + otbMsgDevMacro(<< "Month: " << m_Month); + otbMsgDevMacro(<< "Solar irradiance: " << m_SolarIllumination); + otbMsgDevMacro(<< "Zenithal angle: " << m_ZenithalSolarAngle); + + if ((m_Alpha.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) + || (m_Beta.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel()) + || (m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) + { + itkExceptionMacro( + << "Alpha, Beta and SolarIllumination parameters should have the same size as the number of bands"); + } + + this->GetFunctorVector().clear(); + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + FunctorType functor; + double coefTemp = 0.; + if (!m_IsSetFluxNormalizationCoefficient) + { + if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) + { + otb_6s_doublereal dsol = 0.; + otb_6s_integer day = static_cast(m_Day); + otb_6s_integer month = static_cast(m_Month); + //int cr(0); + otb_6s_varsol_(&day, &month, &dsol); + coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * static_cast(dsol); + } + else + { + itkExceptionMacro(<< "Day has to be included between 1 and 31, Month beetween 1 and 12."); + } + } + else + { + coefTemp = + vcl_cos(m_ZenithalSolarAngle * + CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient; + } + functor.SetIlluminationCorrectionCoefficient(coefTemp); + functor.SetAlpha(m_Alpha[i]); + functor.SetBeta(m_Beta[i]); + functor.SetSolarIllumination(m_SolarIllumination[i]); + this->GetFunctorVector().push_back(functor); + } + } + +private: + /** Ponderation declaration*/ + VectorType m_Alpha; + VectorType m_Beta; + /** Set the zenithal soalr angle. */ + double m_ZenithalSolarAngle; + /** Flux normalization coefficient. */ + double m_FluxNormalizationCoefficient; + /** Solar illumination value. */ + VectorType m_SolarIllumination; + /** Used to know if the user has set a value for the FluxNormalizationCoefficient parameter + * or if the class has to compute it */ + bool m_IsSetFluxNormalizationCoefficient; + /** Acquisition Day*/ + int m_Day; + /** Acquisition Month*/ + int m_Month; +}; + +} // end namespace otb + +#endif diff -Nru otb-4.0.0/Code/Radiometry/otbReflectanceToLuminanceImageFilter.h otb-4.2.0/Code/Radiometry/otbReflectanceToLuminanceImageFilter.h --- otb-4.0.0/Code/Radiometry/otbReflectanceToLuminanceImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbReflectanceToLuminanceImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,329 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + Some parts of this code are derived from ITK. See ITKCopyright.txt + for details. + + + 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. + +=========================================================================*/ +#ifndef __otbReflectanceToLuminanceImageFilter_h +#define __otbReflectanceToLuminanceImageFilter_h + +#include "otb_6S.h" +#include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "otbVectorImage.h" +#include "otbMath.h" +#include "itkNumericTraits.h" +#include "itkVariableLengthVector.h" +#include "otbMacro.h" +#include "otbOpticalImageMetadataInterface.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" +#include + +namespace otb +{ +namespace Functor +{ +/** + * \class ReflectanceToLuminanceImageFunctor + * \brief Compupute luminance from the reflectance value + * + * Divide by Pi and multiply by an illumination correction coefficient + * and the given solar illumination. + * + * + * \sa ReflectanceToLuminanceImageFilter + * + * \ingroup Functor + * \ingroup Radiometry + * + */ +template +class ReflectanceToLuminanceImageFunctor +{ +public: + ReflectanceToLuminanceImageFunctor() : + m_SolarIllumination(1.0), + m_IlluminationCorrectionCoefficient(1.0) + {} + + virtual ~ReflectanceToLuminanceImageFunctor() {} + + void SetSolarIllumination(double solarIllumination) + { + m_SolarIllumination = solarIllumination; + } + void SetIlluminationCorrectionCoefficient(double coef) + { + m_IlluminationCorrectionCoefficient = coef; + } + + double GetSolarIllumination() + { + return m_SolarIllumination; + } + double GetIlluminationCorrectionCoefficient() + { + return m_IlluminationCorrectionCoefficient; + } + + inline TOutput operator ()(const TInput& inPixel) const + { + TOutput outPixel; + double temp; + temp = static_cast(inPixel) + / static_cast(CONST_PI) + * m_IlluminationCorrectionCoefficient + * m_SolarIllumination; + + outPixel = static_cast(temp); + return outPixel; + } + +private: + double m_SolarIllumination; + double m_IlluminationCorrectionCoefficient; +}; +} + +/** \class ReflectanceToLuminanceImageFilter + * \brief Convert reflectance value into luminance value + * + * Transform a reflectance image into the luminance. For this it uses the + * functor ReflectanceToLuminanceImageFunctor calling for each component of each pixel. + * + * + * For Spot image in the dimap format, the correction parameters are + * retrieved automatically from the metadata + * + * \ingroup ImageToLuminanceImageFunctor + * \ingroup Radiometry + * + * \example Radiometry/AtmosphericCorrectionSequencement.cxx + */ +template +class ITK_EXPORT ReflectanceToLuminanceImageFilter : + public UnaryImageFunctorWithVectorImageFilter > +{ +public: + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** "typedef" to simplify the variables definition and the declaration. */ + typedef TInputImage InputImageType; + typedef TOutputImage OutputImageType; + typedef typename Functor::ReflectanceToLuminanceImageFunctor + FunctorType; + + /** "typedef" for standard classes. */ + typedef ReflectanceToLuminanceImageFilter Self; + typedef UnaryImageFunctorWithVectorImageFilter Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(ReflectanceToLuminanceImageFilter, UnaryImageFunctorWithVectorImageFiltermageFilter); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + typedef typename itk::VariableLengthVector VectorType; + + /** Image size "typedef" definition. */ + typedef typename InputImageType::SizeType SizeType; + + /** Set the solar illumination value. */ + itkSetMacro(SolarIllumination, VectorType); + /** Give the solar illumination value. */ + itkGetConstReferenceMacro(SolarIllumination, VectorType); + + /** Set the zenithal solar angle. */ + itkSetMacro(ZenithalSolarAngle, double); + /** Give the zenithal solar angle. */ + itkGetConstReferenceMacro(ZenithalSolarAngle, double); + + /** Set/Get the sun elevation angle (internally handled by the zenithal angle)*/ + virtual void SetElevationSolarAngle(double elevationAngle) + { + double zenithalAngle = 90.0 - elevationAngle; + if (this->m_ZenithalSolarAngle != zenithalAngle) + { + this->m_ZenithalSolarAngle = zenithalAngle; + this->Modified(); + } + } + + virtual double GetElevationSolarAngle() const + { + return 90.0 - this->m_ZenithalSolarAngle; + } + + /** Set the day. */ + itkSetClampMacro(Day, int, 1, 31); + /** Give the day. */ + itkGetConstReferenceMacro(Day, int); + + /** Set the mounth. */ + itkSetClampMacro(Month, int, 1, 12); + /** Give the mounth. */ + itkGetConstReferenceMacro(Month, int); + + /** Set the flux normalization coefficient. */ + void SetFluxNormalizationCoefficient(double coef) + { + m_FluxNormalizationCoefficient = coef; + m_IsSetFluxNormalizationCoefficient = true; + this->Modified(); + } + /** Give the flux normalization coefficient. */ + itkGetConstReferenceMacro(FluxNormalizationCoefficient, double); + + /** Set the IsSetFluxNormalizationCoefficient boolean. */ + itkSetMacro(IsSetFluxNormalizationCoefficient, bool); + /** Give the IsSetFluxNormalizationCoefficient boolean. */ + itkGetConstReferenceMacro(IsSetFluxNormalizationCoefficient, bool); + + /** Set the UseClamp boolean. */ + itkSetMacro(UseClamp, bool); + /** Give the UseClamp boolean. */ + itkGetConstReferenceMacro(UseClamp, bool); + +protected: + /** Constructor */ + ReflectanceToLuminanceImageFilter() : + m_ZenithalSolarAngle(120.0), //invalid value which will lead to negative radiometry + m_FluxNormalizationCoefficient(1.), + m_Day(0), + m_Month(0), + m_IsSetFluxNormalizationCoefficient(false) + { + m_SolarIllumination.SetSize(0); + }; + + /** Destructor */ + virtual ~ReflectanceToLuminanceImageFilter() {} + + /** Update the functor list and input parameters */ + virtual void BeforeThreadedGenerateData(void) + { + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI( + this->GetInput()->GetMetaDataDictionary()); + if ((m_Day == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Day = imageMetadataInterface->GetDay(); + } + + if ((m_Month == 0) && (!m_IsSetFluxNormalizationCoefficient)) + { + m_Month = imageMetadataInterface->GetMonth(); + } + + if (m_SolarIllumination.GetSize() == 0) + { + m_SolarIllumination = imageMetadataInterface->GetSolarIrradiance(); + } + + if (m_ZenithalSolarAngle == 120.0) + { + //the zenithal angle is the complementary of the elevation angle + m_ZenithalSolarAngle = 90.0 - imageMetadataInterface->GetSunElevation(); + } + + std::cout << "Using correction parameters: " << std::endl; + std::cout<< "Day: " << m_Day << std::endl; + std::cout<< "Month: " << m_Month << std::endl; + std::cout<< "Solar irradiance: " << m_SolarIllumination << std::endl; + std::cout<< "Zenithal angle: " << m_ZenithalSolarAngle << std::endl; + + if ((m_SolarIllumination.GetSize() != this->GetInput()->GetNumberOfComponentsPerPixel())) + { + itkExceptionMacro(<< "SolarIllumination parameter should have the same size as the number of bands"); + } + + this->GetFunctorVector().clear(); + + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + FunctorType functor; + double coefTemp = 0.; + if (!m_IsSetFluxNormalizationCoefficient) + { + if (m_Day * m_Month != 0 && m_Day < 32 && m_Month < 13) + { + otb_6s_doublereal dsol = 0.; + otb_6s_integer day = static_cast(m_Day); + otb_6s_integer month = static_cast(m_Month); + //int cr(0); + otb_6s_varsol_(&day, &month, &dsol); + coefTemp = vcl_cos(m_ZenithalSolarAngle * CONST_PI_180) * static_cast(dsol); + } + else + { + itkExceptionMacro(<< "Day has to be included between 1 and 31, Month beetween 1 and 12."); + } + } + else + { + coefTemp = + vcl_cos(m_ZenithalSolarAngle * + CONST_PI_180) * m_FluxNormalizationCoefficient * m_FluxNormalizationCoefficient; + } + functor.SetIlluminationCorrectionCoefficient(coefTemp); + functor.SetSolarIllumination(static_cast(m_SolarIllumination[i])); + + this->GetFunctorVector().push_back(functor); + } + } + +private: + + /** Set the zenithal soalr angle. */ + double m_ZenithalSolarAngle; + /** Flux normalization coefficient. */ + double m_FluxNormalizationCoefficient; + /** Acquisition day. */ + int m_Day; + /** Acquisition mounth. */ + int m_Month; + /** Solar illumination value. */ + VectorType m_SolarIllumination; + /** Used to know if the user has set a value for the FluxNormalizationCoefficient parameter + * or if the class has to compute it */ + bool m_IsSetFluxNormalizationCoefficient; + /** Clamp values to [0,1] */ + bool m_UseClamp; + +}; + +} // end namespace otb +#endif diff -Nru otb-4.0.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h otb-4.2.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h --- otb-4.0.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -24,8 +24,11 @@ #include "otbUnaryImageFunctorWithVectorImageFilter.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" +#include "otbAtmosphericCorrectionParameters.h" +#include "otbImageMetadataCorrectionParameters.h" #include "otbAtmosphericRadiativeTerms.h" -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" + #include "itkMetaDataDictionary.h" #include @@ -117,6 +120,8 @@ * \ingroup AtmosphericCorrectionParameters * \ingroup LuminanceToReflectanceImageFilter * \ingroup ImageToReflectanceImageFilter + * \ingroup ImageMetadataCorrectionParameters + * \ingroup otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms * \ingroup Radiometry * * \example Radiometry/AtmosphericCorrectionSequencement.cxx @@ -162,56 +167,58 @@ typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; typedef typename OutputImageType::RegionType OutputImageRegionType; - typedef AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms Parameters2RadiativeTermsType; - typedef Parameters2RadiativeTermsType::Pointer Parameters2RadiativeTermsPointerType; - typedef AtmosphericCorrectionParameters::Pointer CorrectionParametersPointerType; - typedef AtmosphericRadiativeTerms::Pointer AtmosphericRadiativeTermsPointerType; - - typedef FilterFunctionValues FilterFunctionValuesType; - typedef FilterFunctionValuesType::ValuesVectorType CoefVectorType; - typedef std::vector FilterFunctionCoefVectorType; - typedef ObjectList InternalWavelengthSpectralBandVectorType; - typedef InternalWavelengthSpectralBandVectorType::Pointer WavelengthSpectralBandVectorType; + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef typename AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef typename AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef typename AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + + + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; //float + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; //std::vector + + typedef typename AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType; typedef itk::MetaDataDictionary MetaDataDictionaryType; /** Get/Set Atmospheric Radiative Terms. */ - void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmo) + void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmoRadTerms) { - m_AtmosphericRadiativeTerms = atmo; + m_AtmosphericRadiativeTerms = atmoRadTerms; this->SetNthInput(1, m_AtmosphericRadiativeTerms); m_IsSetAtmosphericRadiativeTerms = true; this->Modified(); } - itkGetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTerms); + itkGetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTermsType); /** Get/Set Atmospheric Correction Parameters. */ - itkSetObjectMacro(CorrectionParameters, AtmosphericCorrectionParameters); - itkGetObjectMacro(CorrectionParameters, AtmosphericCorrectionParameters); - - /** Get/Set Aeronet file name. */ - itkSetMacro(AeronetFileName, std::string); - itkGetMacro(AeronetFileName, std::string); - - /** Get/Set Aeronet file name. */ - itkSetMacro(FilterFunctionValuesFileName, std::string); - itkGetMacro(FilterFunctionValuesFileName, std::string); - - /** Get/Set Filter function coef. */ - void SetFilterFunctionCoef(WavelengthSpectralBandVectorType vect) + void SetAtmoCorrectionParameters(AtmoCorrectionParametersPointerType atmoCorrTerms) { - m_FilterFunctionCoef = vect; + m_AtmoCorrectionParameters = atmoCorrTerms; + this->SetNthInput(2, m_AtmoCorrectionParameters); + m_IsSetAtmoCorrectionParameters = true; this->Modified(); } - WavelengthSpectralBandVectorType GetFilterFunctionCoef() const + itkGetObjectMacro(AtmoCorrectionParameters, AtmoCorrectionParametersType); + + /** Get/Set Acquisition Correction Parameters. */ + void SetAcquiCorrectionParameters(AcquiCorrectionParametersPointerType acquiCorrTerms) { - return m_FilterFunctionCoef; + m_AcquiCorrectionParameters = acquiCorrTerms; + this->SetNthInput(3, m_AcquiCorrectionParameters); + m_IsSetAcquiCorrectionParameters = true; + this->Modified(); } + itkGetObjectMacro(AcquiCorrectionParameters, AcquiCorrectionParametersType); - /** Generate radiative terms from the atmospheric parameters */ - void GenerateAtmosphericRadiativeTerms(); /** Compute radiative terms if necessary and then update functors attributs. */ void GenerateParameters(); @@ -233,32 +240,35 @@ virtual ~ReflectanceToSurfaceReflectanceImageFilter() {} void PrintSelf(std::ostream& os, itk::Indent indent) const; - /** Read the aeronet data and extract aerosol optical and water vapor amount. */ - //void UpdateAeronetData( const MetaDataDictionaryType dict ); - - /** Initialize the functor vector */ - void GenerateOutputInformation(); + /** Initialize the parameters of the functor before the threads run. */ + virtual void BeforeThreadedGenerateData(); /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); /** Update Functors parameters */ void UpdateFunctors(); + /** If modified, we need to compute the functor parameters again */ + virtual void Modified(); + private: bool m_IsSetAtmosphericRadiativeTerms; - /** Path to an Aeronet data file, allows to compute aerosol optical and water vapor amounts. */ - std::string m_AeronetFileName; - /** Path to an filter function values file. */ - std::string m_FilterFunctionValuesFileName; - /** Contains the filter function values (each element is a vector and represents the values for each channel) */ - WavelengthSpectralBandVectorType m_FilterFunctionCoef; + bool m_IsSetAtmoCorrectionParameters; + bool m_IsSetAcquiCorrectionParameters; + /** Enable/Disable GenerateParameters in GenerateOutputInformation. * Useful for image view that call GenerateOutputInformation each time you move the full area. */ bool m_UseGenerateParameters; - AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; - CorrectionParametersPointerType m_CorrectionParameters; + /** True if the functor parameters have been generated */ + bool m_FunctorParametersHaveBeenComputed; + + AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; + AtmoCorrectionParametersPointerType m_AtmoCorrectionParameters; + AcquiCorrectionParametersPointerType m_AcquiCorrectionParameters; + + }; } // end namespace otb diff -Nru otb-4.0.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx otb-4.2.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx --- otb-4.0.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -32,114 +32,128 @@ ReflectanceToSurfaceReflectanceImageFilter ::ReflectanceToSurfaceReflectanceImageFilter() : m_IsSetAtmosphericRadiativeTerms(false), - m_AeronetFileName(""), - m_FilterFunctionValuesFileName(""), + m_IsSetAtmoCorrectionParameters(false), + m_IsSetAcquiCorrectionParameters(false), m_UseGenerateParameters(true) { - m_AtmosphericRadiativeTerms = AtmosphericRadiativeTerms::New(); - m_CorrectionParameters = AtmosphericCorrectionParameters::New(); - m_FilterFunctionCoef = InternalWavelengthSpectralBandVectorType::New(); - m_FilterFunctionCoef->Clear(); + m_AtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); + m_AtmoCorrectionParameters = AtmoCorrectionParametersType::New(); + m_AcquiCorrectionParameters = AcquiCorrectionParametersType::New(); } template void ReflectanceToSurfaceReflectanceImageFilter -::UpdateAtmosphericRadiativeTerms() +::BeforeThreadedGenerateData() { - if (this->GetInput() == NULL) - { - itkExceptionMacro(<< "Input must be set before updating the atmospheric radiative terms"); - } - MetaDataDictionaryType dict = this->GetInput()->GetMetaDataDictionary(); + Superclass::BeforeThreadedGenerateData(); + if (m_UseGenerateParameters) this->GenerateParameters(); + } - OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); - if ((m_CorrectionParameters->GetDay() == 0)) - { - m_CorrectionParameters->SetDay(imageMetadataInterface->GetDay()); - } +template +void +ReflectanceToSurfaceReflectanceImageFilter +::Modified() +{ + Superclass::Modified(); + m_FunctorParametersHaveBeenComputed = false; +} - if ((m_CorrectionParameters->GetMonth() == 0)) - { - m_CorrectionParameters->SetMonth(imageMetadataInterface->GetMonth()); - } - if ((m_CorrectionParameters->GetSolarZenithalAngle() == 361.)) +template +void +ReflectanceToSurfaceReflectanceImageFilter +::GenerateParameters() + { + if (!m_IsSetAtmosphericRadiativeTerms) { - m_CorrectionParameters->SetSolarZenithalAngle(90. - imageMetadataInterface->GetSunElevation()); + this->UpdateAtmosphericRadiativeTerms(); + m_IsSetAtmosphericRadiativeTerms = true; } - if ((m_CorrectionParameters->GetSolarAzimutalAngle() == 361.)) + if (!m_FunctorParametersHaveBeenComputed) { - m_CorrectionParameters->SetSolarAzimutalAngle(imageMetadataInterface->GetSunAzimuth()); + this->UpdateFunctors(); + m_FunctorParametersHaveBeenComputed = true; } + } - if ((m_CorrectionParameters->GetViewingZenithalAngle() == 361.)) + +template +void +ReflectanceToSurfaceReflectanceImageFilter +::UpdateAtmosphericRadiativeTerms() + { + if (this->GetInput() == NULL) { - m_CorrectionParameters->SetViewingZenithalAngle(90. - imageMetadataInterface->GetSatElevation()); + itkExceptionMacro(<< "Input must be set before updating the atmospheric radiative terms"); } - if ((m_CorrectionParameters->GetViewingAzimutalAngle() == 361.)) + // Atmospheric parameters + if (!m_IsSetAtmoCorrectionParameters) + { + itkExceptionMacro(<< "Atmospheric correction parameters must be provided before updating the atmospheric radiative terms"); + } + + + // load filter function values + bool SetFilterFunctionValuesFileName=false; + if (m_AcquiCorrectionParameters->GetFilterFunctionValuesFileName() != "") { - m_CorrectionParameters->SetViewingAzimutalAngle(imageMetadataInterface->GetSatAzimuth()); + m_AcquiCorrectionParameters->LoadFilterFunctionValue(); + SetFilterFunctionValuesFileName=true; } - if (m_AeronetFileName != "") - m_CorrectionParameters->UpdateAeronetData(m_AeronetFileName, - imageMetadataInterface->GetYear(), + + MetaDataDictionaryType dict = this->GetInput()->GetMetaDataDictionary(); + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); + + + if (m_AtmoCorrectionParameters->GetAeronetFileName() != "") + m_AtmoCorrectionParameters->UpdateAeronetData(imageMetadataInterface->GetYear(), imageMetadataInterface->GetHour(), imageMetadataInterface->GetMinute()); - // load filter function values - if (m_FilterFunctionValuesFileName != "") - { - m_CorrectionParameters->LoadFilterFunctionValue(m_FilterFunctionValuesFileName); - } - //case where filter function values are not read from an ascii file - else - { - if (imageMetadataInterface->GetSpectralSensitivity()->Capacity() > 0) - { - m_CorrectionParameters->SetWavelengthSpectralBand(imageMetadataInterface->GetSpectralSensitivity()); - otbMsgDevMacro(<< "use filter available in MetadataInterface " << imageMetadataInterface->GetSpectralSensitivity()); - } - else + + // Acquisition parameters + if (!m_IsSetAcquiCorrectionParameters) // Get info from image metadata interface { - otbMsgDevMacro(<< "use dummy filter"); - m_FilterFunctionCoef->Clear(); - for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) - { - m_FilterFunctionCoef->PushBack(FilterFunctionValues::New()); - } - m_CorrectionParameters->SetWavelengthSpectralBand(m_FilterFunctionCoef); + m_AcquiCorrectionParameters = AcquiCorrectionParametersType::New(); + + m_AcquiCorrectionParameters->SetSolarZenithalAngle(90. - imageMetadataInterface->GetSunElevation()); + m_AcquiCorrectionParameters->SetSolarAzimutalAngle(imageMetadataInterface->GetSunAzimuth()); + m_AcquiCorrectionParameters->SetViewingZenithalAngle(90. - imageMetadataInterface->GetSatElevation()); + m_AcquiCorrectionParameters->SetViewingAzimutalAngle(imageMetadataInterface->GetSatAzimuth()); + + m_AcquiCorrectionParameters->SetDay(imageMetadataInterface->GetDay()); + m_AcquiCorrectionParameters->SetMonth(imageMetadataInterface->GetMonth()); + + + if (!SetFilterFunctionValuesFileName) + { + if (imageMetadataInterface->GetSpectralSensitivity()->Capacity() > 0) + { + m_AcquiCorrectionParameters->SetWavelengthSpectralBand(imageMetadataInterface->GetSpectralSensitivity()); + } + else + { + otbMsgDevMacro(<< "use dummy filter"); + WavelengthSpectralBandVectorType spectralDummy; + spectralDummy->Clear(); + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + spectralDummy->PushBack(FilterFunctionValuesType::New()); + } + m_AcquiCorrectionParameters->SetWavelengthSpectralBand(spectralDummy); + } + } + } - } - Parameters2RadiativeTermsPointerType param2Terms = Parameters2RadiativeTermsType::New(); - param2Terms->SetInput(m_CorrectionParameters); - param2Terms->Update(); - m_AtmosphericRadiativeTerms = param2Terms->GetOutput(); - } -template -void -ReflectanceToSurfaceReflectanceImageFilter -::GenerateOutputInformation() - { - Superclass::GenerateOutputInformation(); - if (m_UseGenerateParameters) this->GenerateParameters(); - } + m_AtmosphericRadiativeTerms = CorrectionParametersToRadiativeTermsType::Compute(m_AtmoCorrectionParameters,m_AcquiCorrectionParameters); -template -void -ReflectanceToSurfaceReflectanceImageFilter -::GenerateAtmosphericRadiativeTerms() - { - Parameters2RadiativeTermsPointerType param2Terms = Parameters2RadiativeTermsType::New(); - param2Terms->SetInput(m_CorrectionParameters); - param2Terms->Update(); - m_AtmosphericRadiativeTerms = param2Terms->GetOutput(); } template @@ -147,12 +161,13 @@ ReflectanceToSurfaceReflectanceImageFilter ::UpdateFunctors() { + if (this->GetInput() == NULL) { itkExceptionMacro(<< "Input must be set before updating the functors"); } + MetaDataDictionaryType dict = this->GetInput()->GetMetaDataDictionary(); - OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); this->GetFunctorVector().clear(); @@ -184,22 +199,7 @@ otbMsgDevMacro(<< "Coef (A): " << functor.GetCoefficient()); otbMsgDevMacro(<< "Residu: " << functor.GetResidu()); otbMsgDevMacro(<< "Spherical albedo: " << functor.GetSphericalAlbedo()); - - } - } - -template -void -ReflectanceToSurfaceReflectanceImageFilter -::GenerateParameters() - { - if (!m_IsSetAtmosphericRadiativeTerms) - { - this->UpdateAtmosphericRadiativeTerms(); - m_IsSetAtmosphericRadiativeTerms = true; } - - this->UpdateFunctors(); } @@ -209,7 +209,9 @@ ReflectanceToSurfaceReflectanceImageFilter ::PrintSelf(std::ostream& os, itk::Indent indent) const { - os << indent << "Correction parameters : " << m_CorrectionParameters << std::endl; + os << indent << "Atmospheric radiative terms : " << m_AtmosphericRadiativeTerms << std::endl; + os << indent << "Atmospheric correction terms : " << m_AtmoCorrectionParameters << std::endl; + os << indent << "Acquisition correction terms : " << m_AcquiCorrectionParameters << std::endl; } } //end namespace otb diff -Nru otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h --- otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -85,32 +85,23 @@ double contribution = 0.; TOutput outPixel; outPixel.SetSize(it.GetCenterPixel().Size()); - std::ostringstream oss; - oss << std::fixed << std::setprecision(3); // Loop over each component const unsigned int size = outPixel.GetSize(); for (unsigned int j = 0; j < size; ++j) - { - oss.str(""); + { contribution = 0; // Load the current channel ponderation value matrix WeightingMatrixType TempChannelWeighting = m_WeightingValues[j]; // Loop over the neighborhood for (unsigned int i = 0; i < neighborhoodSize; ++i) - { + { // Current neighborhood pixel index calculation unsigned int RowIdx = 0; unsigned int ColIdx = 0; RowIdx = i / TempChannelWeighting.Cols(); - if (RowIdx != 0) - { - ColIdx = (i + 1) - RowIdx*TempChannelWeighting.Cols() - 1; - } - else - { - ColIdx = i; - } + ColIdx = i - RowIdx*TempChannelWeighting.Cols(); + // Extract the current neighborhood pixel ponderation double idVal = TempChannelWeighting(RowIdx, ColIdx); // Extract the current neighborhood pixel value @@ -119,12 +110,9 @@ contribution += static_cast(tempPix[j]) * idVal; } - double temp = static_cast(it.GetCenterPixel()[j]) * m_UpwardTransmittanceRatio[j] + contribution * - m_DiffuseRatio[j]; - oss << temp; - outPixel[j] = static_cast(atof(oss.str().c_str())); - - //outPixel[j] = static_cast(it.GetCenterPixel()[j])*m_UpwardTransmittanceRatio[j] + contribution*m_DiffuseRatio[j]; + + outPixel[j] = static_cast(it.GetCenterPixel()[j]) *m_UpwardTransmittanceRatio[j] + + contribution * m_DiffuseRatio[j]; } return outPixel; } @@ -145,18 +133,16 @@ * the target pixel and a weighting of the siganls coming from the neighbor pixels. * * \ingroup Radiometry - * + * \deprecated This class has been replaced by otb::SurfaceAdjacencyEffectCorrectionSchemeFilter. */ template class ITK_EXPORT SurfaceAdjacencyEffect6SCorrectionSchemeFilter : - public UnaryFunctorNeighborhoodImageFilter, - typename - TOutputImage - ::PixelType> > + ConstNeighborhoodIterator , + typename TOutputImage::PixelType> > { public: /** "typedef" to simplify the variables definition and the declaration. */ @@ -262,7 +248,7 @@ /** Compute the functor parameters */ void ComputeParameters(); - /** Compute radiative terms if necessary and then updtae functors attibuts. */ + /** Compute radiative terms if necessary and then update functors attibuts. */ void GenerateParameters(); /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); @@ -272,11 +258,8 @@ virtual ~SurfaceAdjacencyEffect6SCorrectionSchemeFilter() {} void PrintSelf(std::ostream& os, itk::Indent indent) const; - /** GenerateOutputInformation method */ - virtual void GenerateOutputInformation(); - - /** Initialize some accumulators before the threads run. */ - //virtual void BeforeThreadedGenerateData(); + /** Initialize the parameters of the functor before the threads run. */ + virtual void BeforeThreadedGenerateData(); /** If modified, we need to compute the parameters again */ virtual void Modified(); @@ -301,12 +284,8 @@ std::string m_AeronetFileName; /** Path to an filter function values file. */ std::string m_FilterFunctionValuesFileName; - /** Contains the filter function values (each element is a vector and represnts the values for each channel) */ + /** Contains the filter function values (each element is a vector and reprsents the values for each channel) */ FilterFunctionCoefVectorType m_FilterFunctionCoef; - /** Enable/Disable GenerateParameters in GenerateOutputInformation. - * Usefull for image view that call GenerateOutputInformation each time you move the full area. - */ - bool m_UseGenerateParameters; }; } // end namespace otb diff -Nru otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.txx otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.txx --- otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -46,6 +46,7 @@ ::SurfaceAdjacencyEffect6SCorrectionSchemeFilter() { m_WindowRadius = 1; + m_ParametersHaveBeenComputed=false; m_PixelSpacingInKilometers = 1.; m_ZenithalViewingAngle = 361.; m_AtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); @@ -54,22 +55,16 @@ m_AeronetFileName = ""; m_FilterFunctionValuesFileName = ""; m_FilterFunctionCoef.clear(); - m_UseGenerateParameters = true; } template void SurfaceAdjacencyEffect6SCorrectionSchemeFilter -::GenerateOutputInformation() +::BeforeThreadedGenerateData() { - Superclass::GenerateOutputInformation(); - typename InputImageType::Pointer inputPtr = const_cast(this->GetInput()); - typename OutputImageType::Pointer outputPtr = const_cast(this->GetOutput()); - - if (!inputPtr || !outputPtr) return; + Superclass::BeforeThreadedGenerateData(); - outputPtr->SetNumberOfComponentsPerPixel(inputPtr->GetNumberOfComponentsPerPixel()); - if (m_UseGenerateParameters) this->GenerateParameters(); + this->GenerateParameters(); if (!m_ParametersHaveBeenComputed) { @@ -211,10 +206,10 @@ for (unsigned int band = 0; band < inputPtr->GetNumberOfComponentsPerPixel(); ++band) { - WeightingMatrixType currentWeightingMatrix(2*m_WindowRadius + 1, 2*m_WindowRadius + 1); double rayleigh = m_AtmosphericRadiativeTerms->GetUpwardDiffuseTransmittanceForRayleigh(band); double aerosol = m_AtmosphericRadiativeTerms->GetUpwardDiffuseTransmittanceForAerosol(band); - + + WeightingMatrixType currentWeightingMatrix(2*m_WindowRadius + 1, 2*m_WindowRadius + 1); currentWeightingMatrix.Fill(0.); for (unsigned int i = 0; i < 2 * m_WindowRadius + 1; ++i) @@ -224,11 +219,13 @@ double notUsed1, notUsed2; double factor = 1; double palt = 1000.; - SIXSTraits::ComputeEnvironmentalContribution(rayleigh, aerosol, - radiusMatrix(i, - j), palt, - vcl_cos( - m_ZenithalViewingAngle * CONST_PI_180), notUsed1, notUsed2, + SIXSTraits::ComputeEnvironmentalContribution(rayleigh, + aerosol, + radiusMatrix(i,j), + palt, + vcl_cos(m_ZenithalViewingAngle * CONST_PI_180), + notUsed1, + notUsed2, factor); //Call to 6S currentWeightingMatrix(i, j) = factor; } diff -Nru otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h --- otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,312 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + Some parts of this code are derived from ITK. See ITKCopyright.txt + for details. + + + 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. + +=========================================================================*/ +#ifndef __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_h +#define __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_h + +#include "itkNumericTraits.h" +#include +#include "itkConstNeighborhoodIterator.h" +#include "otbUnaryFunctorNeighborhoodImageFilter.h" +#include "itkVariableSizeMatrix.h" +#include "otbAtmosphericRadiativeTerms.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" +#include + +namespace otb +{ +namespace Functor +{ +/** \class ComputeNeighborhoodContributionFunctor +* \brief Unary neighborhood functor to compute the value of a pixel which is a sum +* of the surrounding pixels value ponderated by a coefficient. +* +* \ingroup Functor +* \ingroup Radiometry +*/ +template +class ComputeNeighborhoodContributionFunctor +{ +public: + ComputeNeighborhoodContributionFunctor() {} + virtual ~ComputeNeighborhoodContributionFunctor() {} + + typedef itk::VariableSizeMatrix WeightingMatrixType; + typedef typename std::vector WeightingValuesContainerType; + typedef typename TOutput::RealValueType RealValueType; + typedef std::vector DoubleContainerType; + + void SetWeightingValues(const WeightingValuesContainerType& cont) + { + m_WeightingValues = cont; + } + void SetUpwardTransmittanceRatio(DoubleContainerType upwardTransmittanceRatio) + { + m_UpwardTransmittanceRatio = upwardTransmittanceRatio; + } + void SetDiffuseRatio(DoubleContainerType diffuseRatio) + { + m_DiffuseRatio = diffuseRatio; + } + WeightingValuesContainerType GetWeightingValues() + { + return m_WeightingValues; + } + DoubleContainerType GetUpwardTransmittanceRatio() + { + return m_UpwardTransmittanceRatio; + } + DoubleContainerType GetDiffuseRatio() + { + return m_DiffuseRatio; + } + + inline TOutput operator ()(const TNeighIter& it) + { + unsigned int neighborhoodSize = it.Size(); + double contribution = 0.; + TOutput outPixel; + outPixel.SetSize(it.GetCenterPixel().Size()); + + // Loop over each component + const unsigned int size = outPixel.GetSize(); + for (unsigned int j = 0; j < size; ++j) + { + contribution = 0; + // Load the current channel ponderation value matrix + WeightingMatrixType TempChannelWeighting = m_WeightingValues[j]; + // Loop over the neighborhood + for (unsigned int i = 0; i < neighborhoodSize; ++i) + { + // Current neighborhood pixel index calculation + unsigned int RowIdx = 0; + unsigned int ColIdx = 0; + RowIdx = i / TempChannelWeighting.Cols(); + ColIdx = i - RowIdx*TempChannelWeighting.Cols(); + + // Extract the current neighborhood pixel ponderation + double idVal = TempChannelWeighting(RowIdx, ColIdx); + // Extract the current neighborhood pixel value + TOutput tempPix = it.GetPixel(i); + + contribution += static_cast(tempPix[j]) * idVal; + + } + + outPixel[j] = static_cast(it.GetCenterPixel()[j]) *m_UpwardTransmittanceRatio[j] + + contribution * m_DiffuseRatio[j]; + } + return outPixel; + } + +private: + WeightingValuesContainerType m_WeightingValues; + DoubleContainerType m_UpwardTransmittanceRatio; + DoubleContainerType m_DiffuseRatio; +}; + +} + +/** \class SurfaceAdjacencyEffectCorrectionSchemeFilter + * \brief Correct the scheme taking care of the surrounding pixels. + * + * The SurfaceAdjacencyEffectCorrectionSchemeFilter class allows to introduce a neighbor correction to the + * reflectance estimation. The satelite signal is considered as to be a combinaison of the signal coming from + * the target pixel and a weighting of the siganls coming from the neighbor pixels. + * + * \ingroup Radiometry + * + */ +template +class ITK_EXPORT SurfaceAdjacencyEffectCorrectionSchemeFilter : + public UnaryFunctorNeighborhoodImageFilter< + TInputImage, + TOutputImage, + typename Functor::ComputeNeighborhoodContributionFunctor, + typename TOutputImage::PixelType> > +{ +public: + /** "typedef" to simplify the variables definition and the declaration. */ + typedef Functor::ComputeNeighborhoodContributionFunctor, + typename TOutputImage::PixelType> FunctorType; + + /** "typedef" for standard classes. */ + typedef SurfaceAdjacencyEffectCorrectionSchemeFilter Self; + typedef UnaryFunctorNeighborhoodImageFilter Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + typedef typename Superclass::InputImageType InputImageType; + typedef typename Superclass::OutputImageType OutputImageType; + + typedef std::vector DoubleContainerType; + /** object factory method. */ + itkNewMacro(Self); + + /** return class name. */ + itkTypeMacro(SurfaceAdjacencyEffectCorrectionSchemeFilter, UnaryFunctorNeighborhoodImageFilter); + + /** Extract input and output images dimensions.*/ + itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension); + itkStaticConstMacro(OutputImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** Supported images definition. */ + typedef typename InputImageType::PixelType InputPixelType; + typedef typename InputImageType::InternalPixelType InputInternalPixelType; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename InputImageType::SizeType SizeType; + typedef typename OutputImageType::PixelType OutputPixelType; + typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef typename AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef typename AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef typename AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + + + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; //float + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; //std::vector + + typedef typename AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType; + + typedef itk::MetaDataDictionary MetaDataDictionaryType; + + /** Storage ponderation values types*/ + typedef itk::VariableSizeMatrix WeightingMatrixType; + typedef typename std::vector WeightingValuesContainerType; + + /** typedef for calculation*/ + typedef typename itk::ConstNeighborhoodIterator NeighborIterType; + + /** Set/Get the Size of the neighbor window. */ + void SetWindowRadius(unsigned int rad) + { + this->SetRadius(rad); + m_WindowRadius = rad; + this->Modified(); + } + itkGetConstReferenceMacro(WindowRadius, unsigned int); + + /** Set/Get the pixel spacing in kilometers */ + itkSetMacro(PixelSpacingInKilometers, double); + itkGetMacro(PixelSpacingInKilometers, double); + /** Set/Get the viewing angle */ + itkSetMacro(ZenithalViewingAngle, double); + itkGetMacro(ZenithalViewingAngle, double); + + + /** Get/Set Atmospheric Radiative Terms. */ + void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmoRadTerms) + { + m_AtmosphericRadiativeTerms = atmoRadTerms; + this->SetNthInput(1, m_AtmosphericRadiativeTerms); + m_IsSetAtmosphericRadiativeTerms = true; + this->Modified(); + } + itkGetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTermsType); + + /** Get/Set Atmospheric Correction Parameters. */ + void SetAtmoCorrectionParameters(AtmoCorrectionParametersPointerType atmoCorrTerms) + { + m_AtmoCorrectionParameters = atmoCorrTerms; + this->SetNthInput(2, m_AtmoCorrectionParameters); + m_IsSetAtmoCorrectionParameters = true; + this->Modified(); + } + itkGetObjectMacro(AtmoCorrectionParameters, AtmoCorrectionParametersType); + + /** Get/Set Acquisition Correction Parameters. */ + void SetAcquiCorrectionParameters(AcquiCorrectionParametersPointerType acquiCorrTerms) + { + m_AcquiCorrectionParameters = acquiCorrTerms; + this->SetNthInput(3, m_AcquiCorrectionParameters); + m_IsSetAcquiCorrectionParameters = true; + this->Modified(); + } + itkGetObjectMacro(AcquiCorrectionParameters, AcquiCorrectionParametersType); + + + /** Compute radiative terms if necessary and then update functors attibuts. */ + void GenerateParameters(); + + + /** Set/Get IsSetAtmosphericRadiativeTerms */ + itkSetMacro(IsSetAtmosphericRadiativeTerms, bool); + itkGetMacro(IsSetAtmosphericRadiativeTerms, bool); + itkBooleanMacro(IsSetAtmosphericRadiativeTerms); + +protected: + SurfaceAdjacencyEffectCorrectionSchemeFilter(); + virtual ~SurfaceAdjacencyEffectCorrectionSchemeFilter() {} + void PrintSelf(std::ostream& os, itk::Indent indent) const; + + /** Initialize the parameters of the functor before the threads run. */ + virtual void BeforeThreadedGenerateData(); + + /** Fill AtmosphericRadiativeTerms using image metadata*/ + void UpdateAtmosphericRadiativeTerms(); + + /** Compute the functor parameters */ + void UpdateFunctors(); + + /** If modified, we need to compute the functor parameters again */ + virtual void Modified(); + +private: + + bool m_IsSetAtmosphericRadiativeTerms; + bool m_IsSetAtmoCorrectionParameters; + bool m_IsSetAcquiCorrectionParameters; + + /** Radiative terms object */ + AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; + AtmoCorrectionParametersPointerType m_AtmoCorrectionParameters; + AcquiCorrectionParametersPointerType m_AcquiCorrectionParameters; + + /** Size of the window. */ + unsigned int m_WindowRadius; + /** Weighting values for the neighbor pixels.*/ + WeightingValuesContainerType m_WeightingValues; + /** True if the functor parameters have been generated */ + bool m_FunctorParametersHaveBeenComputed; + /** Pixel spacing in kilometers */ + double m_PixelSpacingInKilometers; + /** Viewing angle in degree */ + double m_ZenithalViewingAngle; +}; + +} // end namespace otb + +#ifndef OTB_MANUAL_INSTANTIATION +#include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx" +#endif + +#endif diff -Nru otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx --- otb-4.0.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,237 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + Some parts of this code are derived from ITK. See ITKCopyright.txt + for details. + + + 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. + +=========================================================================*/ + +#ifndef __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_txx +#define __otbSurfaceAdjacencyEffectCorrectionSchemeFilter_txx + +#include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" + +#include "itkConstNeighborhoodIterator.h" +#include "itkNeighborhoodInnerProduct.h" +#include "itkImageRegionIterator.h" +#include "itkNeighborhoodAlgorithm.h" +#include "itkZeroFluxNeumannBoundaryCondition.h" +#include "itkOffset.h" +#include "itkProgressReporter.h" +#include "otbImage.h" +#include "otbSIXSTraits.h" +#include "otbMath.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" +#include "otbOpticalImageMetadataInterface.h" + +namespace otb +{ + +template +SurfaceAdjacencyEffectCorrectionSchemeFilter +::SurfaceAdjacencyEffectCorrectionSchemeFilter() : + m_IsSetAtmosphericRadiativeTerms(false), + m_IsSetAtmoCorrectionParameters(false), + m_IsSetAcquiCorrectionParameters(false), + m_WindowRadius(1), + m_FunctorParametersHaveBeenComputed(false), + m_PixelSpacingInKilometers(1.), + m_ZenithalViewingAngle(361.) +{ + m_AtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); + m_AtmoCorrectionParameters = AtmoCorrectionParametersType::New(); + m_AcquiCorrectionParameters = AcquiCorrectionParametersType::New(); +} + +template +void +SurfaceAdjacencyEffectCorrectionSchemeFilter +::BeforeThreadedGenerateData() +{ + Superclass::BeforeThreadedGenerateData(); + this->GenerateParameters(); + +} + +template +void +SurfaceAdjacencyEffectCorrectionSchemeFilter +::Modified() +{ + Superclass::Modified(); + m_FunctorParametersHaveBeenComputed = false; +} + +template +void +SurfaceAdjacencyEffectCorrectionSchemeFilter +::UpdateAtmosphericRadiativeTerms() +{ + if (this->GetInput() == NULL) + { + itkExceptionMacro(<< "Input must be set before updating the atmospheric radiative terms"); + } + + // Atmospheric parameters + if (!m_IsSetAtmoCorrectionParameters) + { + itkExceptionMacro(<< "Atmospheric correction parameters must be provided before updating the atmospheric radiative terms"); + } + + + // Acquisition parameters + if (!m_IsSetAcquiCorrectionParameters) // Get info from image metadata interface + { + MetaDataDictionaryType dict = this->GetInput()->GetMetaDataDictionary(); + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); + + m_AcquiCorrectionParameters = AcquiCorrectionParametersType::New(); + + m_AcquiCorrectionParameters->SetSolarZenithalAngle(90. - imageMetadataInterface->GetSunElevation()); + m_AcquiCorrectionParameters->SetSolarAzimutalAngle(imageMetadataInterface->GetSunAzimuth()); + m_AcquiCorrectionParameters->SetViewingZenithalAngle(90. - imageMetadataInterface->GetSatElevation()); + m_AcquiCorrectionParameters->SetViewingAzimutalAngle(imageMetadataInterface->GetSatAzimuth()); + + m_AcquiCorrectionParameters->SetDay(imageMetadataInterface->GetDay()); + m_AcquiCorrectionParameters->SetMonth(imageMetadataInterface->GetMonth()); + + if (imageMetadataInterface->GetSpectralSensitivity()->Capacity() > 0) + { + m_AcquiCorrectionParameters->SetWavelengthSpectralBand(imageMetadataInterface->GetSpectralSensitivity()); + + } + else + { + otbMsgDevMacro(<< "use dummy filter"); + WavelengthSpectralBandVectorType spectralDummy; + spectralDummy->Clear(); + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + spectralDummy->PushBack(FilterFunctionValuesType::New()); + } + m_AcquiCorrectionParameters->SetWavelengthSpectralBand(spectralDummy); + } + + } + + m_AtmosphericRadiativeTerms = CorrectionParametersToRadiativeTermsType::Compute(m_AtmoCorrectionParameters,m_AcquiCorrectionParameters); +} + +template +void +SurfaceAdjacencyEffectCorrectionSchemeFilter +::GenerateParameters() +{ + if (!m_IsSetAtmosphericRadiativeTerms) + { + this->UpdateAtmosphericRadiativeTerms(); + m_IsSetAtmosphericRadiativeTerms = true; + } + + if (!m_FunctorParametersHaveBeenComputed) + { + this->UpdateFunctors(); + m_FunctorParametersHaveBeenComputed = true; + } +} + +template +void +SurfaceAdjacencyEffectCorrectionSchemeFilter +::UpdateFunctors() +{ + // get pointers to the input and output + typename InputImageType::Pointer inputPtr = const_cast(this->GetInput()); + typename OutputImageType::Pointer outputPtr = const_cast(this->GetOutput()); + + WeightingMatrixType radiusMatrix(2*m_WindowRadius + 1, 2*m_WindowRadius + 1); + radiusMatrix.Fill(0.); + + double center = static_cast(m_WindowRadius); + + for (unsigned int i = 0; i < m_WindowRadius + 1; ++i) + { + for (unsigned int j = 0; j < m_WindowRadius + 1; ++j) + { + double id = static_cast(i); + double jd = static_cast(j); + double currentRadius = m_PixelSpacingInKilometers * vcl_sqrt(vcl_pow(id - center, 2) + vcl_pow(jd - center, 2)); + radiusMatrix(i, j) = currentRadius; + radiusMatrix(2 * m_WindowRadius - i, j) = currentRadius; + radiusMatrix(2 * m_WindowRadius - i, 2 * m_WindowRadius - j) = currentRadius; + radiusMatrix(i, 2 * m_WindowRadius - j) = currentRadius; + } + } + + for (unsigned int band = 0; band < inputPtr->GetNumberOfComponentsPerPixel(); ++band) + { + double rayleigh = m_AtmosphericRadiativeTerms->GetUpwardDiffuseTransmittanceForRayleigh(band); + double aerosol = m_AtmosphericRadiativeTerms->GetUpwardDiffuseTransmittanceForAerosol(band); + + WeightingMatrixType currentWeightingMatrix(2*m_WindowRadius + 1, 2*m_WindowRadius + 1); + currentWeightingMatrix.Fill(0.); + + for (unsigned int i = 0; i < 2 * m_WindowRadius + 1; ++i) + { + for (unsigned int j = 0; j < 2 * m_WindowRadius + 1; ++j) + { + double notUsed1, notUsed2; + double factor = 1; + double palt = 1000.; + SIXSTraits::ComputeEnvironmentalContribution(rayleigh, + aerosol, + radiusMatrix(i,j), + palt, + vcl_cos(m_ZenithalViewingAngle * CONST_PI_180), + notUsed1, + notUsed2, + factor); //Call to 6S + currentWeightingMatrix(i, j) = factor; + } + } + m_WeightingValues.push_back(currentWeightingMatrix); + } + + DoubleContainerType upwardTransmittanceRatio, diffuseRatio; + + for (unsigned int band = 0; band < inputPtr->GetNumberOfComponentsPerPixel(); ++band) + { + upwardTransmittanceRatio.push_back(m_AtmosphericRadiativeTerms->GetUpwardTransmittance( + band) / m_AtmosphericRadiativeTerms->GetUpwardDirectTransmittance(band)); + diffuseRatio.push_back(m_AtmosphericRadiativeTerms->GetUpwardDiffuseTransmittance( + band) / m_AtmosphericRadiativeTerms->GetUpwardDirectTransmittance(band)); + } + this->GetFunctor().SetUpwardTransmittanceRatio(upwardTransmittanceRatio); + this->GetFunctor().SetDiffuseRatio(diffuseRatio); + this->GetFunctor().SetWeightingValues(m_WeightingValues); +} +/** + * Standard "PrintSelf" method + */ +template +void +SurfaceAdjacencyEffectCorrectionSchemeFilter +::PrintSelf(std::ostream& os, itk::Indent indent) const +{ + os << indent << "Radius : " << m_WindowRadius << std::endl; + os << indent << "Pixel spacing in kilometers: " << m_PixelSpacingInKilometers << std::endl; + os << indent << "Zenithal viewing angle in degree: " << m_AcquiCorrectionParameters->GetViewingZenithalAngle() << std::endl; +} + +} // end namespace otb + +#endif diff -Nru otb-4.0.0/Code/Radiometry/otbVarSol.h otb-4.2.0/Code/Radiometry/otbVarSol.h --- otb-4.0.0/Code/Radiometry/otbVarSol.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/Radiometry/otbVarSol.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,67 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#ifndef __otbVarSol_h +#define __otbVarSol_h + +#include "otbMath.h" + +namespace otb +{ + +/** \class VarSol + * \brief VarSol operations. + * + * Call VarSol main function + * + * [1] Vermote, E., Tanre, D., Deuze, J., Herman, M., Morcette, J., 1997. + * Second simulation of the satellite signal in the solar spectrum, 6S: An overview. + * IEEE Transactions on Geoscience and Remote Sensing 35 + * \ingroup Radiometry + * + */ + class ITK_EXPORT VarSol + { + public: + + /** Call the varSol function*/ + static double GetVarSol(const int day, const int month) + { + /* System generated locals */ + double d__1; + + /* Local variables */ + int j; + double om; + + /* calculation of the variability of the solar constant during the year. */ + /* day is the number of the day in the month */ + if (month <= 2) + j = (month - 1) * 31 + day; + else if (month > 8) + j = (month - 1) * 31 - (month - 2) / 2 - 2 + day; + else + j = (month - 1) * 31 - (month - 1) / 2 - 2 + day; + + om = (double) (j - 4) * .9856 * CONST_PI_180; + /* Computing 2nd power */ + d__1 = 1. - vcl_cos(om) * .01673; + return 1. / (d__1 * d__1); + } + }; +} //end namespace otb +#endif diff -Nru otb-4.0.0/Code/Segmentation/otbOGRLayerStreamStitchingFilter.txx otb-4.2.0/Code/Segmentation/otbOGRLayerStreamStitchingFilter.txx --- otb-4.0.0/Code/Segmentation/otbOGRLayerStreamStitchingFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Segmentation/otbOGRLayerStreamStitchingFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -19,6 +19,7 @@ #define __otbOGRLayerStreamStitchingFilter_txx #include "otbOGRLayerStreamStitchingFilter.h" +#include "itkContinuousIndex.h" #include #include "ogrsf_frmts.h" @@ -133,29 +134,27 @@ //Compute Stream line OGRLineString streamLine; - IndexType startIndex; - IndexType endIndex; + itk::ContinuousIndex startIndex; + itk::ContinuousIndex endIndex; if(!line) { - // Treat Row stream - //Compute the spatial filter of the upper stream - startIndex[0] = x*m_StreamSize[0]; - startIndex[1] = m_StreamSize[1]*(y-1); - endIndex[0] = m_StreamSize[0]*x; - endIndex[1] = m_StreamSize[1]*y; + // Treat vertical stream line + startIndex[0] = static_cast(m_StreamSize[0] * x) - 0.5; + startIndex[1] = static_cast(m_StreamSize[1] * (y-1)) - 0.5; + endIndex = startIndex; + endIndex[1] += static_cast(m_StreamSize[1]); } else - { // Treat Column stream - //Compute the spatial filter of the left stream - startIndex[0] = (x-1)*m_StreamSize[0]; - startIndex[1] = m_StreamSize[1]*y; - endIndex[0] = m_StreamSize[0]*x; - endIndex[1] = m_StreamSize[1]*y; //-1 to stop just before stream line + { // Treat horizontal stream line + startIndex[0] = static_cast(m_StreamSize[0] * (x-1)) - 0.5; + startIndex[1] = static_cast(m_StreamSize[1] * y) - 0.5; + endIndex = startIndex; + endIndex[0] += static_cast(m_StreamSize[0]); } OriginType startPoint; - inputImage->TransformIndexToPhysicalPoint(startIndex, startPoint); + inputImage->TransformContinuousIndexToPhysicalPoint(startIndex, startPoint); OriginType endPoint; - inputImage->TransformIndexToPhysicalPoint(endIndex, endPoint); + inputImage->TransformContinuousIndexToPhysicalPoint(endIndex, endPoint); streamLine.addPoint(startPoint[0], startPoint[1]); streamLine.addPoint(endPoint[0], endPoint[1]); @@ -171,19 +170,19 @@ // Treat Row stream //Compute the spatial filter of the upper stream UpperLeftCorner[0] = x*m_StreamSize[0] - 1 - m_Radius; - UpperLeftCorner[1] = m_StreamSize[1]*(y-1) + 1; + UpperLeftCorner[1] = m_StreamSize[1]*(y-1); - LowerRightCorner[0] = m_StreamSize[0]*x - 1 - 1; - LowerRightCorner[1] = m_StreamSize[1]*y - 1 - 1; + LowerRightCorner[0] = m_StreamSize[0]*x - 1; + LowerRightCorner[1] = m_StreamSize[1]*y - 1; } else { // Treat Column stream //Compute the spatial filter of the left stream - UpperLeftCorner[0] = (x-1)*m_StreamSize[0] + 1; - UpperLeftCorner[1] = m_StreamSize[1]*y - 1 - 1 - m_Radius; + UpperLeftCorner[0] = (x-1)*m_StreamSize[0]; + UpperLeftCorner[1] = m_StreamSize[1]*y - 1 - m_Radius; - LowerRightCorner[0] = m_StreamSize[0]*x - 1 - 1; - LowerRightCorner[1] = m_StreamSize[1]*y - 1 - 1; //-1 to stop just before stream line + LowerRightCorner[0] = m_StreamSize[0]*x - 1; + LowerRightCorner[1] = m_StreamSize[1]*y - 1; //-1 to stop just before stream line } OriginType ulCorner; @@ -211,20 +210,20 @@ if(!line) { //Compute the spatial filter of the lower stream - UpperLeftCorner[0] = x*m_StreamSize[0] + 1; - UpperLeftCorner[1] = m_StreamSize[1]*(y-1) + 1; + UpperLeftCorner[0] = x*m_StreamSize[0]; + UpperLeftCorner[1] = m_StreamSize[1]*(y-1); - LowerRightCorner[0] = m_StreamSize[0]*x + 1 + m_Radius; - LowerRightCorner[1] = m_StreamSize[1]*y - 1 - 1; + LowerRightCorner[0] = m_StreamSize[0]*x + m_Radius; + LowerRightCorner[1] = m_StreamSize[1]*y - 1; } else { //Compute the spatial filter of the right stream - UpperLeftCorner[0] = (x-1)*m_StreamSize[0] + 1; - UpperLeftCorner[1] = m_StreamSize[1]*y + 1; + UpperLeftCorner[0] = (x-1)*m_StreamSize[0]; + UpperLeftCorner[1] = m_StreamSize[1]*y; - LowerRightCorner[0] = m_StreamSize[0]*x - 1 - 1; - LowerRightCorner[1] = m_StreamSize[1]*y + 1 + m_Radius; + LowerRightCorner[0] = m_StreamSize[0]*x - 1; + LowerRightCorner[1] = m_StreamSize[1]*y + m_Radius; } inputImage->TransformIndexToPhysicalPoint(UpperLeftCorner, ulCorner); diff -Nru otb-4.0.0/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.h otb-4.2.0/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.h --- otb-4.0.0/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -331,7 +331,7 @@ this->GetFilter()->SetUse8Connected(flag); } - const bool GetUse8Connected() + bool GetUse8Connected() { return this->GetFilter()->GetUse8Connected(); } @@ -341,7 +341,7 @@ this->GetFilter()->SetFilterSmallObject(flag); } - const bool GetFilterSmallObject() + bool GetFilterSmallObject() { return this->GetFilter()->GetFilterSmallObject(); } @@ -351,7 +351,7 @@ this->GetFilter()->SetMinimumObjectSize(size); } - const unsigned int GetMinimumObjectSize() + unsigned int GetMinimumObjectSize() { return this->GetFilter()->GetMinimumObjectSize(); } @@ -361,7 +361,7 @@ this->GetFilter()->SetSimplify(flag); } - const bool GetSimplify() + bool GetSimplify() { return this->GetFilter()->GetSimplify(); } @@ -373,7 +373,7 @@ this->GetFilter()->SetSimplificationTolerance(tol); } - const double GetSimplificationTolerance() + double GetSimplificationTolerance() { return this->GetFilter()->GetSimplificationTolerance(); } diff -Nru otb-4.0.0/Code/Simulation/otbAtmosphericEffects.h otb-4.2.0/Code/Simulation/otbAtmosphericEffects.h --- otb-4.0.0/Code/Simulation/otbAtmosphericEffects.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbAtmosphericEffects.h 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,8 @@ #ifndef __otbAtmosphericEffects_h #define __otbAtmosphericEffects_h -#include "otbAtmosphericCorrectionParameters.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" +#include "otbAtmosphericRadiativeTerms.h" namespace otb { @@ -56,9 +57,9 @@ typedef typename InputRSRType::ValuePrecisionType ValuePrecisionType; typedef typename InputSpectralResponseType::PairType PairType; - /** 6S typedefs*/ - typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; - typedef itk::SmartPointer AtmosphericCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef typename AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; /** Standard macros */ itkNewMacro(Self); @@ -70,14 +71,20 @@ itkGetConstObjectMacro(InputSpectralResponse, InputSpectralResponseType); itkSetObjectMacro(InputSpectralResponse, InputSpectralResponseType); - itkGetConstObjectMacro(DataAtmosphericCorrectionParameters, AtmosphericCorrectionParametersType); - itkSetObjectMacro(DataAtmosphericCorrectionParameters, AtmosphericCorrectionParametersType); + /** Get/Set Atmospheric Radiative Terms. */ + void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmoRadTerms) + { + m_AtmosphericRadiativeTerms = atmoRadTerms; + this->Modified(); + } + itkGetConstObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTermsType); + //itkSetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTermsType); itkGetObjectMacro(CorrectedSpectralResponse, InputSpectralResponseType); -// void LoadFilterFunctionAtmosphericCorrectionParameters( double step = 0.0025); - void Process6S(/*const unsigned int numBand*/); +// void LoadFilterFunctionAtmosphericCorrectionParameters( double step = 0.0025); + void Process(/*const unsigned int numBand*/); protected: /** Constructor */ @@ -94,11 +101,13 @@ AtmosphericEffects(const Self&); //purposely not implemented void operator=(const Self&); //purposely not implemented - AtmosphericCorrectionParametersPointerType m_DataAtmosphericCorrectionParameters; + AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; InputSpectralResponsePointerType m_InputSpectralResponse; InputSpectralResponsePointerType m_CorrectedSpectralResponse; InputRSRPointerType m_InputSatRSR; + bool m_IsSetAtmosphericRadiativeTerms; + }; }// end namespace otb diff -Nru otb-4.0.0/Code/Simulation/otbAtmosphericEffects.txx otb-4.2.0/Code/Simulation/otbAtmosphericEffects.txx --- otb-4.0.0/Code/Simulation/otbAtmosphericEffects.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbAtmosphericEffects.txx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,6 @@ #define __otbAtmosphericEffects_txx #include "otbAtmosphericEffects.h" -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" #include "otbSurfaceReflectanceToReflectanceFilter.h" namespace otb @@ -27,7 +26,8 @@ template AtmosphericEffects -::AtmosphericEffects() +::AtmosphericEffects() : +m_IsSetAtmosphericRadiativeTerms(false) { m_InputSpectralResponse = InputSpectralResponseType::New(); m_CorrectedSpectralResponse = InputSpectralResponseType::New(); @@ -49,9 +49,9 @@ template void AtmosphericEffects -::Process6S(/*const unsigned int numBand*/) +::Process(/*const unsigned int numBand*/) { - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms + /*typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms AtmosphericCorrectionParametersTo6SRadiativeTermsType; AtmosphericCorrectionParametersTo6SRadiativeTermsType::Pointer filterAtmosphericCorrectionParametersTo6SRadiativeTerms = AtmosphericCorrectionParametersTo6SRadiativeTermsType::New(); @@ -108,7 +108,27 @@ filterSRToR->Update(); - this->m_CorrectedSpectralResponse->SetFromImage( filterSRToR->GetOutput() ); + this->m_CorrectedSpectralResponse->SetFromImage( filterSRToR->GetOutput() ); */ + + /*if (m_IsSetAtmosphericRadiativeTerms) + {*/ + typedef typename InputSpectralResponseType::ImageType ImageType; + + typedef SurfaceReflectanceToReflectanceFilter SurfaceReflectanceToReflectanceFilterType; + typename SurfaceReflectanceToReflectanceFilterType::Pointer filterSRToR = SurfaceReflectanceToReflectanceFilterType::New(); + + filterSRToR->SetAtmosphericRadiativeTerms( m_AtmosphericRadiativeTerms ); + + typename ImageType::Pointer image = ImageType::New(); + this->m_InputSpectralResponse->GetImage(image); + filterSRToR->SetInput( image ); + filterSRToR->Update(); + + this->m_CorrectedSpectralResponse->SetFromImage( filterSRToR->GetOutput() ); + /*} + else + itkExceptionMacro(<< "Atmospheric radiative terms must be provided before updating the CSR (Corrected Spectral Response)"); */ + } } // end namespace otb diff -Nru otb-4.0.0/Code/Simulation/otbImageSimulationMethod.txx otb-4.2.0/Code/Simulation/otbImageSimulationMethod.txx --- otb-4.0.0/Code/Simulation/otbImageSimulationMethod.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbImageSimulationMethod.txx 2014-09-03 08:29:34.000000000 +0000 @@ -158,6 +158,8 @@ m_LabelMapToLabelImageFilter->SetInput(m_Spatialisation->GetOutput()); + m_LabelMapToSimulatedImageFilter->UpdateOutputInformation(); + for (unsigned int i = 0; i < m_NumberOfComponentsPerPixel; ++i) { diff -Nru otb-4.0.0/Code/Simulation/otbReduceSpectralResponse.h otb-4.2.0/Code/Simulation/otbReduceSpectralResponse.h --- otb-4.0.0/Code/Simulation/otbReduceSpectralResponse.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbReduceSpectralResponse.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,13 +31,24 @@ /** \class ReduceSpectralResponse * \brief This class computes the reduced spectral response of each band of a sensor * - * It takes the spectral response of an object and the relative spectral - * response of a satellite (one response per band) to compute the satellite spectral bands. + * It takes the spectral response of an object and the relative + * spectral response of a satellite (one response per band) to + * compute the satellite spectral bands. + * + * There are 2 operating modes: + * - luminance mode (default): integrates the spectral response over each band + * - reflectance mode (needs to call SetReflectanceMode(true)): takes into account + * the solar irradiance in the integration * * The two templates indicate: - * - the SpectralResponse input (from the JPL ASTER spectral library for example) + * - the SpectralResponse input * - the relative spectral response (RSR) of a sensor * + * The computation assumes that the RSR of the sensor has a + * wavelength resolution similar or better than the spectral + * response to be reduced. If this is not the case, it is wise to + * oversample it (by linear interpolation, for instance). + * * The method CalculateResponse must be called. * * \sa itk::DataObject @@ -90,6 +101,9 @@ itkGetObjectMacro(ReduceResponse, InputSpectralResponseType) ; + itkSetMacro(ReflectanceMode, bool); + itkGetConstMacro(ReflectanceMode, bool); + /** Clear the vector data */ virtual bool Clear(); @@ -98,7 +112,7 @@ /** * \param PrecisionType - * \return The integrate value of the RSR for the input spectral response. + * \return The integrated value of the RSR for the input spectral response. */ inline ValuePrecisionType operator()(const unsigned int numBand); @@ -134,6 +148,9 @@ /** the computed response */ InputSpectralResponsePointerType m_ReduceResponse; + + /** Choose between reflectance or luminance mode */ + bool m_ReflectanceMode; }; }// end namespace otb diff -Nru otb-4.0.0/Code/Simulation/otbReduceSpectralResponse.txx otb-4.2.0/Code/Simulation/otbReduceSpectralResponse.txx --- otb-4.0.0/Code/Simulation/otbReduceSpectralResponse.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbReduceSpectralResponse.txx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ template ReduceSpectralResponse -::ReduceSpectralResponse() +::ReduceSpectralResponse() : m_ReflectanceMode(false) { m_ReduceResponse = InputSpectralResponseType::New(); } @@ -40,6 +40,28 @@ return ( m_InputSatRSR->Clear() & m_InputSpectralResponse->Clear() ); } +template +inline +T trapezoid_area(T x1, T x2, T y1, T y2) +{ + /* We compute the area of the trapezoid + by computing the lower square and the + upper triangle. + /- |y2 + /- | + /- | + /- | + y1 +----------+ + | | + | | + | | + +----------+ + x1 x2 + + (x2-x1)*min(y1,y2) + (x2-x1)*abs(y2-y1)/2 + */ + return (x2-x1)*std::min(y1,y2) + (x2-x1)*fabs(y2-y1)*0.5; +} template inline typename ReduceSpectralResponse::ValuePrecisionType @@ -48,166 +70,65 @@ { if (numBand >= m_InputSatRSR->GetNbBands()) { - itkExceptionMacro(<< "There is no band num " << numBand << " in the RSR vector!(Size of the current RSR vector is " << m_InputSatRSR->GetNbBands() << ")" ); + itkExceptionMacro(<< "There is no band num " << numBand + << " in the RSR vector!(Size of the current RSR vector is " + << m_InputSatRSR->GetNbBands() << ")" ); } else { ValuePrecisionType res = itk::NumericTraits::ZeroValue(); - ValuePrecisionType response1; - ValuePrecisionType response2; - ValuePrecisionType inputSatRSR1; - ValuePrecisionType inputSatRSR2; - - ValuePrecisionType inputRSR1; - ValuePrecisionType inputRSR2; - PrecisionType lambda1; - PrecisionType lambda2; - + typename InputRSRType::SpectralResponseType* solarIrradiance; + if(m_ReflectanceMode) + { + solarIrradiance = this->m_InputSatRSR->GetSolarIrradiance(); + if (solarIrradiance == 0) + { + itkExceptionMacro(<<"Error occurs getting solar irradiance. Solar irradiance is mandatory using the reflectance mode."); + } + } typename VectorPairType::const_iterator it; VectorPairType pairs = (m_InputSatRSR->GetRSR())[numBand]->GetResponse(); it = pairs.begin(); - - PrecisionType lambdaMin=(this->m_InputSatRSR->GetRSR())[numBand]->GetInterval().first; - PrecisionType lambdaMax=(this->m_InputSatRSR->GetRSR())[numBand]->GetInterval().second; - - ValuePrecisionType totalArea = static_cast (0); - totalArea =lambdaMax - lambdaMin; - if (totalArea == 0) return static_cast (0.0); - - - while (it != pairs.end() - 1) + ValuePrecisionType totalArea(0); + //start with the second value for the numerical integration + ++it; + while (it != pairs.end()) { - - lambda1 = (*it).first; - lambda2 = (*(it + 1)).first; - if((lambda1lambdaMin)) + PrecisionType lambda1 = (*(it-1)).first; + PrecisionType lambda2 = (*it).first; +// PrecisionType deltaLambda = lambda2-lambda1; + ValuePrecisionType rsr1 = (*(it-1)).second; + ValuePrecisionType rsr2 = (*it).second; + ValuePrecisionType spectrum1 = (*m_InputSpectralResponse)(lambda1); + ValuePrecisionType spectrum2 = (*m_InputSpectralResponse)(lambda2); + /* + In order to simplify the computation for the reflectance mode, + we introduce the solar irradiance in the general formula with + a value of 1.0 for the luminance case. + + In this way the formula is the same if we weight the RSR by + the solar irradiance before the integration. + */ + ValuePrecisionType solarIrradiance1(1.0); + ValuePrecisionType solarIrradiance2(1.0); + if(m_ReflectanceMode) { - inputSatRSR1 = (*it).second; - inputSatRSR2 = (*(it + 1)).second; - - inputRSR1 = (*m_InputSpectralResponse)(lambda1); - inputRSR2 = (*m_InputSpectralResponse)(lambda2); - - - // lambda1 need to be resampled - /* - - /------+ inputRSR2 - /--- | - / | - | | - | | - | | - | | - inputRSR1=0+------------------+ - lambda1 lambda2 - ^ - | - first non zero val in inputRSR - - - after resampling - - /------+ inputRSR2 - /--- | - / | - inputRSR1 + | - | | - | | - | | - +------------+ - lambda1 lambda2 - */ - if ((inputRSR1 == 0) && (inputRSR2 != 0)) - { - PrecisionType lambdaRSRmin = m_InputSpectralResponse->GetInterval().first; - if ((lambdaRSRmin > lambda2) || (lambdaRSRmin < lambda1)) - { - itkExceptionMacro(<<"Spectral response problem"); - } - - PrecisionType lambdaDist = lambdaRSRmin - lambda1; - PrecisionType ratio = lambdaDist / (lambda2 - lambda1); - lambda1 = lambdaRSRmin; - inputSatRSR1 = ratio * inputSatRSR1 + (1 - ratio) * inputSatRSR2; - - inputRSR1=(*m_InputSpectralResponse)(lambda1); - - } - - // lambda2 need to be resampled - /* - - inputRSR1 +---\ - | \ - | ------\ - | | - | | - | | - +----------------------------+ inputRSR2=0 - lambda1 lambda2 - ^ - | - first non zero val in inputRSR - - - after resampling - - - inputRSR1 +---\ - | \ - | ------\ - | +inputRSR2 - | | - | | - +------------+ - lambda1 lambda2 - - */ - if ((inputRSR1 != 0) && (inputRSR2 == 0)) - { - PrecisionType lambdaRSRmax = m_InputSpectralResponse->GetInterval().second; - if ((lambdaRSRmax > lambda2) || (lambdaRSRmax < lambda1)) - { - itkExceptionMacro(<<"Spectral response problem"); - } - PrecisionType lambdaDist = lambdaRSRmax - lambda1; - PrecisionType ratio = lambdaDist / (lambda2 - lambda1); - lambda2 = lambdaRSRmax; - inputSatRSR2 = ratio * inputSatRSR1 + (1 - ratio) * inputSatRSR2; - - inputRSR2=(*m_InputSpectralResponse)(lambda2); - - } - - response1 = inputRSR1 * inputSatRSR1; - response2 = inputRSR2 * inputSatRSR2; - - ValuePrecisionType rmin = std::min(response1, response2); - ValuePrecisionType rmax = std::max(response1, response2); - - /* - rmax +\ - | ---\ - | --| rmin - | | - | | - | | - | | - |-------+ - lambda1 lambda2 - */ - - //Compute the surface of the trapezoid - - ValuePrecisionType area = (lambda2 - lambda1) * (rmax + rmin) / 2.0; - res += area; + solarIrradiance1 = (*solarIrradiance)(lambda1); + solarIrradiance2 = (*solarIrradiance)(lambda2); } + rsr1 *= solarIrradiance1; + rsr2 *= solarIrradiance2; + res += trapezoid_area(lambda1, lambda2, + rsr1*spectrum1, + rsr2*spectrum2); + totalArea += trapezoid_area(lambda1, lambda2, + rsr1, + rsr2); ++it; } - return res / totalArea; } - } template @@ -261,15 +182,26 @@ os<m_InputSatRSR->GetSolarIrradiance()->PrintSelf(os, indent); + os<GetResponse().begin(); it != m_ReduceResponse->GetResponse().end(); ++it) { os <GetResponse().begin() << ": [" << (*it).first << ","<< (*it).second << "]" << std::endl; } } + } // end namespace otb #endif diff -Nru otb-4.0.0/Code/Simulation/otbSatelliteRSR.h otb-4.2.0/Code/Simulation/otbSatelliteRSR.h --- otb-4.0.0/Code/Simulation/otbSatelliteRSR.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbSatelliteRSR.h 2014-09-03 08:29:34.000000000 +0000 @@ -119,7 +119,7 @@ /** * \param PrecisionType * \param Band - * \return The interpolate value of the SR for the numBand (band num 0 to band num (m_NbBands-1)). + * \return The interpolated value of the SR for the numBand (band num 0 to band num (m_NbBands-1)). */ inline ValuePrecisionType operator()(const PrecisionType & lambda, const unsigned int numBand); @@ -132,6 +132,12 @@ return m_RSR; } + /** get the solar irradiance */ + SpectralResponseType* GetSolarIrradiance() + { + return m_SolarIrradiance; + } + protected: /** Constructor */ SatelliteRSR(); @@ -151,6 +157,9 @@ /** Vector of SpectralResponse */ RSRVectorType m_RSR; + + /** Solar irradiance vector */ + SpectralResponsePointerType m_SolarIrradiance; /** Number of bands*/ unsigned int m_NbBands; }; diff -Nru otb-4.0.0/Code/Simulation/otbSatelliteRSR.txx otb-4.2.0/Code/Simulation/otbSatelliteRSR.txx --- otb-4.0.0/Code/Simulation/otbSatelliteRSR.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbSatelliteRSR.txx 2014-09-03 08:29:34.000000000 +0000 @@ -28,6 +28,7 @@ { //m_RSR = VectorType::New(); m_SortBands = true; + m_SolarIrradiance = SpectralResponseType::New(); } template @@ -50,13 +51,15 @@ m_RSR.push_back(RSRBand); } PrecisionType currentLambda; - PrecisionType zenithalAngle; + PrecisionType solarIrradiance; while (!fin.eof()) { //Parse the 6S.txt file fin >> currentLambda; - fin >> zenithalAngle; + fin >> solarIrradiance; + m_SolarIrradiance->GetResponse().push_back(std::make_pair(currentLambda, + solarIrradiance)); //for each band add a pair of values (wavelength and % response) for (unsigned int i = 0; i < m_NbBands; ++i) { diff -Nru otb-4.0.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.h otb-4.2.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.h --- otb-4.0.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,8 @@ #include "otbUnaryImageFunctorWithVectorImageFilter.h" #include "otbAtmosphericRadiativeTerms.h" -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" +#include "otbImageMetadataCorrectionParameters.h" #include "itkMetaDataDictionary.h" // #include "itkFactory.h" namespace otb @@ -193,51 +194,57 @@ typedef typename OutputImageType::InternalPixelType OutputInternalPixelType; typedef typename OutputImageType::RegionType OutputImageRegionType; - typedef AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms Parameters2RadiativeTermsType; - typedef Parameters2RadiativeTermsType::Pointer Parameters2RadiativeTermsPointerType; - typedef AtmosphericCorrectionParameters::Pointer CorrectionParametersPointerType; - typedef AtmosphericRadiativeTerms::Pointer AtmosphericRadiativeTermsPointerType; + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef typename AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; - typedef FilterFunctionValues FilterFunctionValuesType; - typedef FilterFunctionValuesType::ValuesVectorType CoefVectorType; - typedef std::vector FilterFunctionCoefVectorType; + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef typename AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef typename AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + + + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; //float + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; //std::vector + + typedef typename AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType; + + typedef itk::MetaDataDictionary MetaDataDictionaryType; - typedef itk::MetaDataDictionary MetaDataDictionaryType; /** Get/Set Atmospheric Radiative Terms. */ - void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmo) + void SetAtmosphericRadiativeTerms(AtmosphericRadiativeTermsPointerType atmoRadTerms) { - m_AtmosphericRadiativeTerms = atmo; + m_AtmosphericRadiativeTerms = atmoRadTerms; this->SetNthInput(1, m_AtmosphericRadiativeTerms); m_IsSetAtmosphericRadiativeTerms = true; this->Modified(); } - itkGetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTerms); + itkGetObjectMacro(AtmosphericRadiativeTerms, AtmosphericRadiativeTermsType); /** Get/Set Atmospheric Correction Parameters. */ - itkSetObjectMacro(CorrectionParameters, AtmosphericCorrectionParameters); - itkGetObjectMacro(CorrectionParameters, AtmosphericCorrectionParameters); - - /** Get/Set Aeronet file name. */ - itkSetMacro(AeronetFileName, std::string); - itkGetMacro(AeronetFileName, std::string); - - /** Get/Set Aeronet file name. */ - itkSetMacro(FilterFunctionValuesFileName, std::string); - itkGetMacro(FilterFunctionValuesFileName, std::string); - - /** Get/Set Filter function coef. */ - void SetFilterFunctionCoef( FilterFunctionCoefVectorType vect ) + void SetAtmoCorrectionParameters(AtmoCorrectionParametersPointerType atmoCorrTerms) { - m_FilterFunctionCoef = vect; - this->Modified(); + m_AtmoCorrectionParameters = atmoCorrTerms; + this->SetNthInput(2, m_AtmoCorrectionParameters); + m_IsSetAtmoCorrectionParameters = true; + this->Modified(); } - FilterFunctionCoefVectorType GetFilterFunctionCoef() + itkGetObjectMacro(AtmoCorrectionParameters, AtmoCorrectionParametersType); + + /** Get/Set Acquisition Correction Parameters. */ + void SetAcquiCorrectionParameters(AcquiCorrectionParametersPointerType acquiCorrTerms) { - return m_FilterFunctionCoef; + m_AcquiCorrectionParameters = acquiCorrTerms; + this->SetNthInput(3, m_AcquiCorrectionParameters); + m_IsSetAcquiCorrectionParameters = true; + this->Modified(); } + /** Compute radiative terms if necessary and then updtae functors attibuts. */ void GenerateParameters(); @@ -256,30 +263,32 @@ /** Destructor */ virtual ~SurfaceReflectanceToReflectanceFilter() {}; - /** Read the aeronet data and extract aerosol optical and water vapor amount. */ - //void UpdateAeronetData( const MetaDataDictionaryType dict ); /** Initialize the functor vector */ - void GenerateOutputInformation(); + void BeforeThreadedGenerateData(); /** Fill AtmosphericRadiativeTerms using image metadata*/ void UpdateAtmosphericRadiativeTerms(); /** Update Functors parameters */ void UpdateFunctors(); + /** If modified, we need to compute the functor parameters again */ + virtual void Modified(); + private: - AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; - CorrectionParametersPointerType m_CorrectionParameters; + bool m_IsSetAtmosphericRadiativeTerms; - /** Path to an Aeronet data file, allows to compute aerosol optical and water vapor amounts. */ - std::string m_AeronetFileName; - /** Path to a filter function values file. */ - std::string m_FilterFunctionValuesFileName; - /** Contains the filter function values (each element is a vector and represnts the values for each channel) */ - FilterFunctionCoefVectorType m_FilterFunctionCoef; - /** Enable/Disable GenerateParameters in GenerateOutputInformation. - * Usefull for image view that call GenerateOutputInformation each time you move the full area. - */ + bool m_IsSetAtmoCorrectionParameters; + bool m_IsSetAcquiCorrectionParameters; + + /** Radiative terms object */ + AtmosphericRadiativeTermsPointerType m_AtmosphericRadiativeTerms; + AtmoCorrectionParametersPointerType m_AtmoCorrectionParameters; + AcquiCorrectionParametersPointerType m_AcquiCorrectionParameters; + bool m_UseGenerateParameters; + + /** True if the functor parameters have been generated */ + bool m_FunctorParametersHaveBeenComputed; }; } // end namespace otb diff -Nru otb-4.0.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.txx otb-4.2.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.txx --- otb-4.0.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Simulation/otbSurfaceReflectanceToReflectanceFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -30,15 +30,15 @@ */ template SurfaceReflectanceToReflectanceFilter -::SurfaceReflectanceToReflectanceFilter() +::SurfaceReflectanceToReflectanceFilter() : + m_IsSetAtmosphericRadiativeTerms(false), + m_IsSetAtmoCorrectionParameters(false), + m_IsSetAcquiCorrectionParameters(false), + m_UseGenerateParameters(true) { - m_AtmosphericRadiativeTerms = AtmosphericRadiativeTerms::New(); - m_CorrectionParameters = AtmosphericCorrectionParameters::New(); - m_IsSetAtmosphericRadiativeTerms = false; - m_AeronetFileName = ""; - m_FilterFunctionValuesFileName = ""; - m_FilterFunctionCoef.clear(); - m_UseGenerateParameters = true; + m_AtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); + m_AtmoCorrectionParameters = AtmoCorrectionParametersType::New(); + m_AcquiCorrectionParameters = AcquiCorrectionParametersType::New(); } @@ -47,83 +47,63 @@ SurfaceReflectanceToReflectanceFilter ::UpdateAtmosphericRadiativeTerms() { - MetaDataDictionaryType dict = this->GetInput()->GetMetaDataDictionary(); - - OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); - - if ((m_CorrectionParameters->GetDay() == 0)) - { - m_CorrectionParameters->SetDay(imageMetadataInterface->GetDay()); - } - - if ((m_CorrectionParameters->GetMonth() == 0)) - { - m_CorrectionParameters->SetMonth(imageMetadataInterface->GetMonth()); - } - - if ((m_CorrectionParameters->GetSolarZenithalAngle() == 361.)) - { - m_CorrectionParameters->SetSolarZenithalAngle(90. - imageMetadataInterface->GetSunElevation()); - } - - if ((m_CorrectionParameters->GetSolarAzimutalAngle() == 361.)) - { - m_CorrectionParameters->SetSolarAzimutalAngle(imageMetadataInterface->GetSunAzimuth()); - } - - if ((m_CorrectionParameters->GetViewingZenithalAngle() == 361.)) - { - m_CorrectionParameters->SetViewingZenithalAngle(90. - imageMetadataInterface->GetSatElevation()); - } - - if ((m_CorrectionParameters->GetViewingAzimutalAngle() == 361.)) + if (this->GetInput() == NULL) { - m_CorrectionParameters->SetViewingAzimutalAngle(imageMetadataInterface->GetSatAzimuth()); + itkExceptionMacro(<< "Input must be set before updating the atmospheric radiative terms"); } - if(m_AeronetFileName != "") - m_CorrectionParameters->UpdateAeronetData( m_AeronetFileName, - imageMetadataInterface->GetYear(), - imageMetadataInterface->GetHour(), - imageMetadataInterface->GetMinute() ); - - // load fiter function values - if(m_FilterFunctionValuesFileName != "") - { - m_CorrectionParameters->LoadFilterFunctionValue( m_FilterFunctionValuesFileName ); - } - // the user has set the filter function values - else - { - if( m_FilterFunctionCoef.size() != this->GetInput()->GetNumberOfComponentsPerPixel() ) - { - itkExceptionMacro(<<"Filter Function and image channels mismatch."); - } - for(unsigned int i=0; iGetInput()->GetNumberOfComponentsPerPixel(); ++i) - { - FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); - functionValues->SetFilterFunctionValues(m_FilterFunctionCoef[i]); - functionValues->SetMinSpectralValue(imageMetadataInterface->GetFirstWavelengths()[i]); - functionValues->SetMaxSpectralValue(imageMetadataInterface->GetLastWavelengths()[i]); - - m_CorrectionParameters->SetWavelengthSpectralBandWithIndex(i, functionValues); - } - } + // Atmospheric parameters + if (!m_IsSetAtmoCorrectionParameters) + { + itkExceptionMacro(<< "Atmospheric correction parameters must be provided before updating the atmospheric radiative terms"); + } + + + // Acquisition parameters + if (!m_IsSetAcquiCorrectionParameters) // Get info from image metadata interface + { + MetaDataDictionaryType dict = this->GetInput()->GetMetaDataDictionary(); + OpticalImageMetadataInterface::Pointer imageMetadataInterface = OpticalImageMetadataInterfaceFactory::CreateIMI(dict); + + m_AcquiCorrectionParameters = AcquiCorrectionParametersType::New(); + + m_AcquiCorrectionParameters->SetSolarZenithalAngle(90. - imageMetadataInterface->GetSunElevation()); + m_AcquiCorrectionParameters->SetSolarAzimutalAngle(imageMetadataInterface->GetSunAzimuth()); + m_AcquiCorrectionParameters->SetViewingZenithalAngle(90. - imageMetadataInterface->GetSatElevation()); + m_AcquiCorrectionParameters->SetViewingAzimutalAngle(imageMetadataInterface->GetSatAzimuth()); + + m_AcquiCorrectionParameters->SetDay(imageMetadataInterface->GetDay()); + m_AcquiCorrectionParameters->SetMonth(imageMetadataInterface->GetMonth()); + + if (imageMetadataInterface->GetSpectralSensitivity()->Capacity() > 0) + { + m_AcquiCorrectionParameters->SetWavelengthSpectralBand(imageMetadataInterface->GetSpectralSensitivity()); + + } + else + { + otbMsgDevMacro(<< "use dummy filter"); + WavelengthSpectralBandVectorType spectralDummy; + spectralDummy->Clear(); + for (unsigned int i = 0; i < this->GetInput()->GetNumberOfComponentsPerPixel(); ++i) + { + spectralDummy->PushBack(FilterFunctionValuesType::New()); + } + m_AcquiCorrectionParameters->SetWavelengthSpectralBand(spectralDummy); + } - Parameters2RadiativeTermsPointerType param2Terms = Parameters2RadiativeTermsType::New(); + } - param2Terms->SetInput(m_CorrectionParameters); - param2Terms->Update(); - m_AtmosphericRadiativeTerms = param2Terms->GetOutput(); + m_AtmosphericRadiativeTerms = CorrectionParametersToRadiativeTermsType::Compute(m_AtmoCorrectionParameters,m_AcquiCorrectionParameters); } template void SurfaceReflectanceToReflectanceFilter -::GenerateOutputInformation() +::BeforeThreadedGenerateData() { - Superclass::GenerateOutputInformation(); + Superclass::BeforeThreadedGenerateData(); if(m_UseGenerateParameters) this->GenerateParameters(); } @@ -131,6 +111,15 @@ template void SurfaceReflectanceToReflectanceFilter +::Modified() +{ + Superclass::Modified(); + m_FunctorParametersHaveBeenComputed = false; +} + +template +void +SurfaceReflectanceToReflectanceFilter ::UpdateFunctors() { //this->GetFunctor().clear(); @@ -162,12 +151,18 @@ SurfaceReflectanceToReflectanceFilter ::GenerateParameters() { - if(m_IsSetAtmosphericRadiativeTerms==false) + + if (!m_IsSetAtmosphericRadiativeTerms) { - this->UpdateAtmosphericRadiativeTerms(); + this->UpdateAtmosphericRadiativeTerms(); + m_IsSetAtmosphericRadiativeTerms=true; } - this->UpdateFunctors(); + if (!m_FunctorParametersHaveBeenComputed) + { + this->UpdateFunctors(); + m_FunctorParametersHaveBeenComputed = true; + } } } diff -Nru otb-4.0.0/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx otb-4.2.0/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx --- otb-4.0.0/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -149,7 +149,7 @@ typedef PolygonToPolygonRCC8Calculator RCC8CalculatorType; typedef RCC8VertexIterator VertexIteratorType; typedef RCC8InEdgeIterator InEdgeIteratorType; - typedef RCC8OutEdgeIterator OutEdgeIteratorType; + // Vector of label std::vector maxLabelVector; diff -Nru otb-4.0.0/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx otb-4.2.0/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx --- otb-4.0.0/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/SpatialReasoning/otbImageToImageRCC8Calculator.txx 2014-09-03 08:29:34.000000000 +0000 @@ -337,7 +337,7 @@ { /// Definition of the filters used typedef itk::AndImageFilter AndFilterType; - typedef itk::MinimumMaximumImageCalculator MinMaxCalculatorType; + /// Declaration and instantiation typename AndFilterType::Pointer andFilter = AndFilterType::New(); /// The exterior is the inverted input image diff -Nru otb-4.0.0/Code/Testing/otbCurlHelperStub.cxx otb-4.2.0/Code/Testing/otbCurlHelperStub.cxx --- otb-4.0.0/Code/Testing/otbCurlHelperStub.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Testing/otbCurlHelperStub.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ namespace otb { -bool CurlHelperStub::TestUrlAvailability(const std::string& url) const +bool CurlHelperStub::TestUrlAvailability(const std::string& itkNotUsed(url)) const { itkExceptionMacro(<< "otbCurlHelperStub: method undefined"); return -1; @@ -84,14 +84,14 @@ return -1; } -int CurlHelperStub::RetrieveFile(const std::string& urlString, std::string filename) const +int CurlHelperStub::RetrieveFile(const std::string& itkNotUsed(urlString), std::string itkNotUsed(filename)) const { itkExceptionMacro(<< "otbCurlHelperStub: method undefined"); return -1; } -int CurlHelperStub::RetrieveFileMulti(const std::vector& listURLs, - const std::vector& listFiles, int maxConnect) const +int CurlHelperStub::RetrieveFileMulti(const std::vector& itkNotUsed(listURLs), + const std::vector& itkNotUsed(listFiles), int itkNotUsed(maxConnect)) const { itkExceptionMacro(<< "otbCurlHelperStub: method undefined"); return -1; diff -Nru otb-4.0.0/Code/Testing/otbCurlHelperStub.h otb-4.2.0/Code/Testing/otbCurlHelperStub.h --- otb-4.0.0/Code/Testing/otbCurlHelperStub.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Testing/otbCurlHelperStub.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ * This class is available only for testing purposes * */ -class ITK_EXPORT CurlHelperStub : public CurlHelperInterface +class ITK_ABI_EXPORT CurlHelperStub : public CurlHelperInterface { public: /** Standard class typedefs. */ diff -Nru otb-4.0.0/Code/Testing/otbTestHelper.cxx otb-4.2.0/Code/Testing/otbTestHelper.cxx --- otb-4.0.0/Code/Testing/otbTestHelper.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Testing/otbTestHelper.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -594,8 +594,6 @@ // Use the factory mechanism to read the test and baseline files and convert them to double typedef otb::VectorImage ImageType; - typedef otb::VectorImage OutputType; - typedef otb::VectorImage DiffOutputType; typedef otb::ImageFileReader ReaderType; // Read the baseline file @@ -662,7 +660,6 @@ if (status.GetSquaredNorm() > 0 && m_ReportErrors) { typedef otb::PrintableImageFilter RescaleType; - typedef RescaleType::OutputImageType OutputType; typedef otb::ImageFileWriter WriterType; RescaleType::Pointer rescale = RescaleType::New(); @@ -1536,6 +1533,8 @@ keys.push_back("="); keys.push_back(":"); keys.push_back(";"); + keys.push_back(""); std::vector keysOut; keysOut.push_back("[ "); @@ -1546,6 +1545,9 @@ keysOut.push_back(" = "); keysOut.push_back(" : "); keysOut.push_back(" , "); + keysOut.push_back(" "); + for (unsigned int it = 0; it < keys.size(); ++it) { @@ -1604,7 +1606,6 @@ buffstreamTest >> strTest; //otbMsgDevMacro(<< "sub comparison of the line, strRef: " << strRef << " || strTest: " << strTest); - bool chgt = false; std::string charTmpRef = ""; std::string charTmpTest = ""; @@ -1683,7 +1684,6 @@ strCharTest = ""; strNumRef = charTmpRef; strNumTest = charTmpTest; - chgt = true; } // Case where there's a character after numbers. else if ((etatCour == ETAT_CHAR) && (etatPrec == ETAT_NUM)) @@ -1706,7 +1706,6 @@ strNumTest = ""; strCharRef = charTmpRef; strCharTest = charTmpTest; - chgt = true; } else if (etatCour == etatPrec) { @@ -1726,36 +1725,32 @@ ++i; } - // Simpliest case : string characters or numeric value between 2 separators - if (!chgt) + // test last part + if (etatCour == ETAT_CHAR) { - if (isNumeric(strRef)) + if (strCharRef != strCharTest) { - - if ((strRef != strTest) && (vcl_abs(atof(strRef.c_str())) > m_EpsilonBoundaryChecking) - && (vcl_abs(atof(strRef.c_str()) - atof(strTest.c_str())) - > epsilon * vcl_abs(atof(strRef.c_str())))) //epsilon as relative error + if (m_ReportErrors) { - if (m_ReportErrors) - { - fluxfilediff << "Diff at line " << numLine << " : vcl_abs( (" << strRef << ") - (" << strTest - << ") ) > " << epsilon << std::endl; - differenceFoundInCurrentLine = true; - } - nbdiff++; + fluxfilediff << "Diff at line " << numLine << " : " << strCharRef << " != " << strCharTest << std::endl; + differenceFoundInCurrentLine = true; } + nbdiff++; } - else + } + else + { + if ((strNumRef != strNumTest) && (vcl_abs(atof(strNumRef.c_str())) > m_EpsilonBoundaryChecking) + && (vcl_abs(atof(strNumRef.c_str()) - atof(strNumTest.c_str())) + > epsilon * vcl_abs(atof(strNumRef.c_str())))) //epsilon as relative error { - if (strRef != strTest) + if (m_ReportErrors) { - if (m_ReportErrors) - { - fluxfilediff << "Diff at line " << numLine << " : " << strRef << " != " << strTest << std::endl; - differenceFoundInCurrentLine = true; - } - nbdiff++; + fluxfilediff << "Diff at line " << numLine << " : vcl_abs( (" << strNumRef << ") - (" << strNumTest + << ") ) > " << epsilon << std::endl; + differenceFoundInCurrentLine = true; } + nbdiff++; } } } // else diff -Nru otb-4.0.0/Code/Testing/otbTestHelper.h otb-4.2.0/Code/Testing/otbTestHelper.h --- otb-4.0.0/Code/Testing/otbTestHelper.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Testing/otbTestHelper.h 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,7 @@ * \class TestHelper * \brief Helper class to perform the baseline comparisons during the tests */ -class /*ITK_EXPORT*/ TestHelper : public itk::Object +class ITK_ABI_EXPORT TestHelper : public itk::Object { public: diff -Nru otb-4.0.0/Code/Testing/otbTestMain.h otb-4.2.0/Code/Testing/otbTestMain.h --- otb-4.0.0/Code/Testing/otbTestMain.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Testing/otbTestMain.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,8 +72,6 @@ double epsilonBoundary(0.0); typedef otb::TestHelper::StringList StringList; - typedef otb::TestHelper::StringListIt StringListIt; - StringList baselineFilenamesBinary; StringList testFilenamesBinary; StringList baselineFilenamesMetaData; diff -Nru otb-4.0.0/Code/UtilitiesAdapters/CurlAdapters/otbCurlHelper.cxx otb-4.2.0/Code/UtilitiesAdapters/CurlAdapters/otbCurlHelper.cxx --- otb-4.0.0/Code/UtilitiesAdapters/CurlAdapters/otbCurlHelper.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/CurlAdapters/otbCurlHelper.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -350,8 +350,9 @@ int CurlHelper::RetrieveFileMulti(const std::vector& listURLs, const std::vector& listFilename, - int maxConnect) const + int itkNotUsed(maxConnect)) const { + #ifdef OTB_USE_CURL #if 0 //#ifdef OTB_CURL_MULTI_AVAILABLE @@ -531,7 +532,7 @@ return size * nmemb; } -size_t CurlHelper::CallbackWriteDataDummy(void *ptr, size_t size, size_t nmemb, void *data) +size_t CurlHelper::CallbackWriteDataDummy(void *itkNotUsed(ptr), size_t size, size_t nmemb, void *itkNotUsed(data)) { return size * nmemb; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.h otb-4.2.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.h --- otb-4.0.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,232 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __itkHistogramToTextureFeaturesFilter_h -#define __itkHistogramToTextureFeaturesFilter_h - -#include "itkHistogram.h" -#include "itkMacro.h" -#include "itkProcessObject.h" -#include "itkSimpleDataObjectDecorator.h" - -namespace itk -{ -namespace Statistics -{ -/** \class HistogramToTextureFeaturesFilter -* \brief This class computes texture feature coefficients from a grey level -* co-occurrence matrix. -* -* This class computes features that summarize image texture, given a grey level -* co-occurrence matrix (generated by a ScalarImageToGreyLevelCooccurrenceMatrixGenerator -* or related class). -* -* The features calculated are as follows (where \f$ g(i, j) \f$ is the element in -* cell i, j of a a normalized GLCM): -* -* "Energy" \f$ = f_1 = \sum_{i,j}g(i, j)^2 \f$ -* -* "Entropy" \f$ = f_2 = -\sum_{i,j}g(i, j) \log_2 g(i, j)\f$, or 0 if \f$g(i, j) = 0\f$ -* -* "Correlation" \f$ = f_3 = \sum_{i,j}\frac{(i - \mu)(j - \mu)g(i, j)}{\sigma^2} \f$ -* -* "Difference Moment" \f$= f_4 = \sum_{i,j}\frac{1}{1 + (i - j)^2}g(i, j) \f$ -* -* "Inertia" \f$ = f_5 = \sum_{i,j}(i - j)^2g(i, j) \f$ (sometimes called "contrast.") -* -* "Cluster Shade" \f$ = f_6 = \sum_{i,j}((i - \mu) + (j - \mu))^3 g(i, j) \f$ -* -* "Cluster Prominence" \f$ = f_7 = \sum_{i,j}((i - \mu) + (j - \mu))^4 g(i, j) \f$ -* -* "Haralick's Correlation" \f$ = f_8 = \frac{\sum_{i,j}(i, j) g(i, j) -\mu_t^2}{\sigma_t^2} \f$ -* where \f$\mu_t\f$ and \f$\sigma_t\f$ are the mean and standard deviation of the row -* (or column, due to symmetry) sums. -* -* Above, \f$ \mu = \f$ (weighted pixel average) \f$ = \sum_{i,j}i \cdot g(i, j) = -* \sum_{i,j}j \cdot g(i, j) \f$ (due to matrix summetry), and -* -* \f$ \sigma = \f$ (weighted pixel variance) \f$ = \sum_{i,j}(i - \mu)^2 \cdot g(i, j) = -* \sum_{i,j}(j - \mu)^2 \cdot g(i, j) \f$ (due to matrix summetry) -* -* A good texture feature set to use is the Conners, Trivedi and Harlow set: -* features 1, 2, 4, 5, 6, and 7. There is some correlation between the various -* features, so using all of them at the same time is not necessarialy a good idea. -* -* NOTA BENE: The input histogram will be forcably normalized! -* This algorithm takes three passes through the input -* histogram if the histogram was already normalized, and four if not. -* -* Web references: -* -* http://www.cssip.uq.edu.au/meastex/www/algs/algs/algs.html -* http://www.ucalgary.ca/~mhallbey/texture/texture_tutorial.html -* -* Print references: -* -* Haralick, R.M., K. Shanmugam and I. Dinstein. 1973. Textural Features for -* Image Classification. IEEE Transactions on Systems, Man and Cybernetics. -* SMC-3(6):610-620. -* -* Haralick, R.M. 1979. Statistical and Structural Approaches to Texture. -* Proceedings of the IEEE, 67:786-804. -* -* R.W. Conners and C.A. Harlow. A Theoretical Comaprison of Texture Algorithms. -* IEEE Transactions on Pattern Analysis and Machine Intelligence, 2:204-222, 1980. -* -* R.W. Conners, M.M. Trivedi, and C.A. Harlow. Segmentation of a High-Resolution -* Urban Scene using Texture Operators. Computer Vision, Graphics and Image -* Processing, 25:273-310, 1984. -* -* \sa ScalarImageToGreyLevelCooccurrenceMatrixGenerator -* \sa MaskedScalarImageToGreyLevelCooccurrenceMatrixGenerator -* \sa ScalarImageTextureCalculator -* -* Author: Zachary Pincus -* \ingroup ITKStatistics -*/ - -template< class THistogram > -class ITK_EXPORT HistogramToTextureFeaturesFilter:public ProcessObject -{ -public: - /** Standard typedefs */ - typedef HistogramToTextureFeaturesFilter Self; - typedef ProcessObject Superclass; - typedef SmartPointer< Self > Pointer; - typedef SmartPointer< const Self > ConstPointer; - - /** Run-time type information (and related methods). */ - itkTypeMacro(HistogramToTextureFeaturesFilter, ProcessObject); - - /** standard New() method support */ - itkNewMacro(Self); - - typedef THistogram HistogramType; - typedef typename HistogramType::Pointer HistogramPointer; - typedef typename HistogramType::ConstPointer HistogramConstPointer; - typedef typename HistogramType::MeasurementType MeasurementType; - typedef typename HistogramType::MeasurementVectorType MeasurementVectorType; - typedef typename HistogramType::IndexType IndexType; - typedef typename HistogramType::AbsoluteFrequencyType AbsoluteFrequencyType; - typedef typename HistogramType::RelativeFrequencyType RelativeFrequencyType; - - typedef typename HistogramType::TotalAbsoluteFrequencyType - TotalAbsoluteFrequencyType; - - typedef typename HistogramType::TotalRelativeFrequencyType - TotalRelativeFrequencyType; - - /** Container to hold relative frequencies of the histogram */ - typedef std::vector< RelativeFrequencyType > RelativeFrequencyContainerType; - - /** Method to Set/Get the input Histogram */ - using Superclass::SetInput; - void SetInput(const HistogramType *histogram); - - const HistogramType * GetInput() const; - - /** Smart Pointer type to a DataObject. */ - typedef DataObject::Pointer DataObjectPointer; - - /** Type of DataObjects used for scalar outputs */ - typedef SimpleDataObjectDecorator< MeasurementType > MeasurementObjectType; - - /** Return energy texture value. */ - MeasurementType GetEnergy() const; - - const MeasurementObjectType * GetEnergyOutput() const; - - /** Return entropy texture value. */ - MeasurementType GetEntropy() const; - - const MeasurementObjectType * GetEntropyOutput() const; - - /** return correlation texture value. */ - MeasurementType GetCorrelation() const; - - const MeasurementObjectType * GetCorrelationOutput() const; - - /** Return inverse difference moment texture value. */ - MeasurementType GetInverseDifferenceMoment() const; - - const MeasurementObjectType * GetInverseDifferenceMomentOutput() const; - - /** Return inertia texture value. */ - MeasurementType GetInertia() const; - - const MeasurementObjectType * GetInertiaOutput() const; - - /** Return cluster shade texture value. */ - MeasurementType GetClusterShade() const; - - const MeasurementObjectType * GetClusterShadeOutput() const; - - /** Return cluster prominence texture value. */ - MeasurementType GetClusterProminence() const; - - const MeasurementObjectType * GetClusterProminenceOutput() const; - - /** Return Haralick correlation texture value. */ - MeasurementType GetHaralickCorrelation() const; - - const MeasurementObjectType * GetHaralickCorrelationOutput() const; - - /** Texture feature types */ - typedef enum { - Energy, - Entropy, - Correlation, - InverseDifferenceMoment, - Inertia, - ClusterShade, - ClusterProminence, - HaralickCorrelation, - InvalidFeatureName - } TextureFeatureName; - - /** convenience method to access the texture values */ - MeasurementType GetFeature(TextureFeatureName name); - -protected: - HistogramToTextureFeaturesFilter(); - ~HistogramToTextureFeaturesFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; - - /** Make a DataObject to be used for output output. */ - typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; - using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); - - void GenerateData(); - -private: - HistogramToTextureFeaturesFilter(const Self &); //purposely not implemented - void operator=(const Self &); //purposely not implemented - - void ComputeMeansAndVariances(double & pixelMean, double & marginalMean, - double & marginalDevSquared, double & pixelVariance); - - RelativeFrequencyContainerType m_RelativeFrequencyContainer; -}; -} // end of namespace Statistics -} // end of namespace itk - -#ifndef ITK_MANUAL_INSTANTIATION -#include "itkHistogramToTextureFeaturesFilter.hxx" -#endif - -#endif diff -Nru otb-4.0.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.hxx otb-4.2.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.hxx --- otb-4.0.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/ITKPendingPatches/itkHistogramToTextureFeaturesFilter.hxx 1970-01-01 00:00:00.000000000 +0000 @@ -1,448 +0,0 @@ -/*========================================================================= - * - * Copyright Insight Software Consortium - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0.txt - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - *=========================================================================*/ -#ifndef __itkHistogramToTextureFeaturesFilter_hxx -#define __itkHistogramToTextureFeaturesFilter_hxx - -#include "itkHistogramToTextureFeaturesFilter.h" - -#include "itkNumericTraits.h" -#include "vnl/vnl_math.h" - -namespace itk -{ -namespace Statistics -{ -//constructor -template< class THistogram > -HistogramToTextureFeaturesFilter< THistogram >::HistogramToTextureFeaturesFilter(void) -{ - this->ProcessObject::SetNumberOfRequiredInputs(1); - - // allocate the data objects for the outputs which are - // just decorators real types - for ( int i = 0; i < 8; ++i ) - { - this->ProcessObject::SetNthOutput( i, this->MakeOutput(i) ); - } -} - -template< class THistogram > -void -HistogramToTextureFeaturesFilter< THistogram > -::SetInput(const HistogramType *histogram) -{ - this->ProcessObject::SetNthInput( 0, const_cast< HistogramType * >( histogram ) ); -} - -template< class THistogram > -const typename -HistogramToTextureFeaturesFilter< THistogram >::HistogramType * -HistogramToTextureFeaturesFilter< THistogram > -::GetInput() const -{ - return itkDynamicCastInDebugMode< const HistogramType * >( this->GetPrimaryInput() ); -} - -template< class THistogram > -typename -HistogramToTextureFeaturesFilter< THistogram >::DataObjectPointer -HistogramToTextureFeaturesFilter< THistogram > -::MakeOutput( DataObjectPointerArraySizeType itkNotUsed(idx) ) -{ - return MeasurementObjectType::New().GetPointer(); -} - -template< class THistogram > -void -HistogramToTextureFeaturesFilter< THistogram >::GenerateData(void) -{ - typedef typename HistogramType::ConstIterator HistogramIterator; - - const HistogramType *inputHistogram = this->GetInput(); - - //Normalize the absolute frequencies and populate the relative frequency - //container - TotalRelativeFrequencyType totalFrequency = - static_cast< TotalRelativeFrequencyType >( inputHistogram->GetTotalFrequency() ); - - m_RelativeFrequencyContainer.clear(); - - for ( HistogramIterator hit = inputHistogram->Begin(); - hit != inputHistogram->End(); ++hit ) - { - AbsoluteFrequencyType frequency = hit.GetFrequency(); - RelativeFrequencyType relativeFrequency = frequency / totalFrequency; - m_RelativeFrequencyContainer.push_back(relativeFrequency); - } - - // Now get the various means and variances. This is takes two passes - // through the histogram. - double pixelMean; - double marginalMean; - double marginalDevSquared; - double pixelVariance; - - this->ComputeMeansAndVariances(pixelMean, marginalMean, marginalDevSquared, - pixelVariance); - - // Finally compute the texture features. Another one pass. - MeasurementType energy = NumericTraits< MeasurementType >::Zero; - MeasurementType entropy = NumericTraits< MeasurementType >::Zero; - MeasurementType correlation = NumericTraits< MeasurementType >::Zero; - - MeasurementType inverseDifferenceMoment = - NumericTraits< MeasurementType >::Zero; - - MeasurementType inertia = NumericTraits< MeasurementType >::Zero; - MeasurementType clusterShade = NumericTraits< MeasurementType >::Zero; - MeasurementType clusterProminence = NumericTraits< MeasurementType >::Zero; - MeasurementType haralickCorrelation = NumericTraits< MeasurementType >::Zero; - - double pixelVarianceSquared = pixelVariance * pixelVariance; - - // Variance is only used in correlation. If variance is 0, then (index[0] - pixelMean) * (index[1] - pixelMean) - // should be zero as well. In this case, set the variance to 1. in order to avoid NaN correlation. - if(pixelVarianceSquared < 0.0001) - { - pixelVarianceSquared = 1.; - } - - double log2 = vcl_log(2.0); - - typename RelativeFrequencyContainerType::const_iterator rFreqIterator = - m_RelativeFrequencyContainer.begin(); - - for ( HistogramIterator hit = inputHistogram->Begin(); - hit != inputHistogram->End(); ++hit ) - { - RelativeFrequencyType frequency = *rFreqIterator; - ++rFreqIterator; - if ( frequency == 0 ) - { - continue; // no use doing these calculations if we're just multiplying by - // zero. - } - - IndexType index = inputHistogram->GetIndex( hit.GetInstanceIdentifier() ); - energy += frequency * frequency; - entropy -= ( frequency > 0.0001 ) ? frequency *vcl_log(frequency) / log2:0; - correlation += ( ( index[0] - pixelMean ) * ( index[1] - pixelMean ) * frequency ) - / pixelVarianceSquared; - inverseDifferenceMoment += frequency - / ( 1.0 + ( index[0] - index[1] ) * ( index[0] - index[1] ) ); - inertia += ( index[0] - index[1] ) * ( index[0] - index[1] ) * frequency; - clusterShade += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 3 ) - * frequency; - clusterProminence += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 4 ) - * frequency; - haralickCorrelation += index[0] * index[1] * frequency; - } - - haralickCorrelation = ( haralickCorrelation - marginalMean * marginalMean ) - / marginalDevSquared; - - MeasurementObjectType *energyOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(0) ); - energyOutputObject->Set(energy); - - MeasurementObjectType *entropyOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(1) ); - entropyOutputObject->Set(entropy); - - MeasurementObjectType *correlationOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(2) ); - correlationOutputObject->Set(correlation); - - MeasurementObjectType *inverseDifferenceMomentOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(3) ); - inverseDifferenceMomentOutputObject->Set(inverseDifferenceMoment); - - MeasurementObjectType *inertiaOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(4) ); - inertiaOutputObject->Set(inertia); - - MeasurementObjectType *clusterShadeOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(5) ); - clusterShadeOutputObject->Set(clusterShade); - - MeasurementObjectType *clusterProminenceOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(6) ); - clusterProminenceOutputObject->Set(clusterProminence); - - MeasurementObjectType *haralickCorrelationOutputObject = - static_cast< MeasurementObjectType * >( this->ProcessObject::GetOutput(7) ); - haralickCorrelationOutputObject->Set(haralickCorrelation); -} - -template< class THistogram > -void -HistogramToTextureFeaturesFilter< THistogram >::ComputeMeansAndVariances(double & pixelMean, - double & marginalMean, - double & marginalDevSquared, - double & pixelVariance) -{ - // This function takes two passes through the histogram and two passes through - // an array of the same length as a histogram axis. This could probably be - // cleverly compressed to one pass, but it's not clear that that's necessary. - - typedef typename HistogramType::ConstIterator HistogramIterator; - - const HistogramType *inputHistogram = this->GetInput(); - - // Initialize everything - typename HistogramType::SizeValueType binsPerAxis = inputHistogram->GetSize(0); - double *marginalSums = new double[binsPerAxis]; - for ( double *ms_It = marginalSums; - ms_It < marginalSums + binsPerAxis; ms_It++ ) - { - *ms_It = 0; - } - pixelMean = 0; - - typename RelativeFrequencyContainerType::const_iterator rFreqIterator = - m_RelativeFrequencyContainer.begin(); - - // Ok, now do the first pass through the histogram to get the marginal sums - // and compute the pixel mean - HistogramIterator hit = inputHistogram->Begin(); - while ( hit != inputHistogram->End() ) - { - RelativeFrequencyType frequency = *rFreqIterator; - IndexType index = inputHistogram->GetIndex( hit.GetInstanceIdentifier() ); - pixelMean += index[0] * frequency; - marginalSums[index[0]] += frequency; - ++hit; - ++rFreqIterator; - } - - /* Now get the mean and deviaton of the marginal sums. - Compute incremental mean and SD, a la Knuth, "The Art of Computer - Programming, Volume 2: Seminumerical Algorithms", section 4.2.2. - Compute mean and standard deviation using the recurrence relation: - M(1) = x(1), M(k) = M(k-1) + (x(k) - M(k-1) ) / k - S(1) = 0, S(k) = S(k-1) + (x(k) - M(k-1)) * (x(k) - M(k)) - for 2 <= k <= n, then - sigma = vcl_sqrt(S(n) / n) (or divide by n-1 for sample SD instead of - population SD). - */ - marginalMean = marginalSums[0]; - marginalDevSquared = 0; - for ( unsigned int arrayIndex = 1; arrayIndex < binsPerAxis; arrayIndex++ ) - { - int k = arrayIndex + 1; - double M_k_minus_1 = marginalMean; - double S_k_minus_1 = marginalDevSquared; - double x_k = marginalSums[arrayIndex]; - - double M_k = M_k_minus_1 + ( x_k - M_k_minus_1 ) / k; - double S_k = S_k_minus_1 + ( x_k - M_k_minus_1 ) * ( x_k - M_k ); - - marginalMean = M_k; - marginalDevSquared = S_k; - } - marginalDevSquared = marginalDevSquared / binsPerAxis; - - rFreqIterator = m_RelativeFrequencyContainer.begin(); - // OK, now compute the pixel variances. - pixelVariance = 0; - for ( hit = inputHistogram->Begin(); hit != inputHistogram->End(); ++hit ) - { - RelativeFrequencyType frequency = *rFreqIterator; - IndexType index = inputHistogram->GetIndex( hit.GetInstanceIdentifier() ); - pixelVariance += ( index[0] - pixelMean ) * ( index[0] - pixelMean ) * frequency; - ++rFreqIterator; - } - - delete[] marginalSums; -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetEnergyOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(0) ); -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetEntropyOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(1) ); -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetCorrelationOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(2) ); -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetInverseDifferenceMomentOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(3) ); -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetInertiaOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(4) ); -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetClusterShadeOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(5) ); -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetClusterProminenceOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(6) ); -} - -template< class THistogram > -const -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementObjectType * -HistogramToTextureFeaturesFilter< THistogram > -::GetHaralickCorrelationOutput() const -{ - return static_cast< const MeasurementObjectType * >( this->ProcessObject::GetOutput(7) ); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetEnergy() const -{ - return this->GetEnergyOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetEntropy() const -{ - return this->GetEntropyOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetCorrelation() const -{ - return this->GetCorrelationOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetInverseDifferenceMoment() const -{ - return this->GetInverseDifferenceMomentOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetInertia() const -{ - return this->GetInertiaOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetClusterShade() const -{ - return this->GetClusterShadeOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetClusterProminence() const -{ - return this->GetClusterProminenceOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetHaralickCorrelation() const -{ - return this->GetHaralickCorrelationOutput()->Get(); -} - -template< class THistogram > -typename HistogramToTextureFeaturesFilter< THistogram >::MeasurementType -HistogramToTextureFeaturesFilter< THistogram > -::GetFeature(TextureFeatureName feature) -{ - switch ( feature ) - { - case Energy : - return this->GetEnergy(); - case Entropy: - return this->GetEntropy(); - case Correlation: - return this->GetCorrelation(); - case InverseDifferenceMoment: - return this->GetInverseDifferenceMoment(); - case Inertia: - return this->GetInertia(); - case ClusterShade: - return this->GetClusterShade(); - case ClusterProminence: - return this->GetClusterProminence(); - case HaralickCorrelation: - return this->GetHaralickCorrelation(); - default: - return 0; - } -} - -template< class THistogram > -void -HistogramToTextureFeaturesFilter< THistogram > -::PrintSelf(std::ostream & os, Indent indent) const -{ - Superclass::PrintSelf(os, indent); -} -} // end of namespace Statistics -} // end of namespace itk - -#endif diff -Nru otb-4.0.0/Code/UtilitiesAdapters/ITKPendingPatches/otbWarpImageFilter.txx otb-4.2.0/Code/UtilitiesAdapters/ITKPendingPatches/otbWarpImageFilter.txx --- otb-4.0.0/Code/UtilitiesAdapters/ITKPendingPatches/otbWarpImageFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/ITKPendingPatches/otbWarpImageFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ { return pix.Size(); } -template unsigned int PixelSizeFinder(PixelType pix) +template unsigned int PixelSizeFinder(PixelType itkNotUsed(pix)) { return PixelType::Dimension; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx --- otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -215,7 +215,7 @@ /*virtual*/ OGRSpatialReference* otb::GeometriesToGeometriesFilter::DoDefineNewLayerSpatialReference( - ogr::Layer const& source) const + ogr::Layer const& itkNotUsed(source)) const { return 0; } @@ -229,7 +229,7 @@ /*virtual*/ std::vector otb::GeometriesToGeometriesFilter::DoDefineNewLayerOptions( - ogr::Layer const& source) const + ogr::Layer const& itkNotUsed(source)) const { return std::vector(); } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h --- otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -181,7 +181,7 @@ * \param[in] inoutFeature \c Feature to change. * \throw Nothing */ - void fieldsTransform(ogr::Feature const& inoutFeature) const + void fieldsTransform(ogr::Feature const& itkNotUsed(inoutFeature)) const { // default => do nothing for in-place transformation } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx --- otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbGeometriesToGeometriesFilter.txx 2014-09-03 08:29:34.000000000 +0000 @@ -98,7 +98,7 @@ void otb::TransformationFunctorDispatcher::operator()( otb::ogr::Layer & inout) const { - OGRFeatureDefn & defn = inout.GetLayerDefn(); +// OGRFeatureDefn & defn = inout.GetLayerDefn(); // NB: We can't iterate with begin()/end() as SetFeature may invalidate the // iterators depending of the underlying drivers // => we use start_at(), i.e. SetNextByIndex() diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx --- otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapper.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -686,7 +686,7 @@ } } -/*virtual*/ void otb::ogr::DataSource::Graft(const itk::DataObject * data) +/*virtual*/ void otb::ogr::DataSource::Graft(const itk::DataObject * itkNotUsed(data)) { assert(! "Disabled to check if it makes sense..."); } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx --- otb-4.0.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OGRAdapters/otbOGRFeatureWrapper.txx 2014-09-03 08:29:34.000000000 +0000 @@ -145,10 +145,8 @@ CheckInvariants(); OGRGeometry * g = geometry.get(); UncheckedSetGeometryDirectly(otb::move(geometry)); - assert(m_Feature->GetGeometryRef() == g && "The new geometry hasn't been set as expected"); - assert(! geometry && "UniqueGeometryPtr hasn't released its pointer"); - // avoid unused variable warning - g=NULL; + itkAssertOrThrowMacro((m_Feature->GetGeometryRef() == g), "The new geometry hasn't been set as expected"); + itkAssertOrThrowMacro(!geometry, "UniqueGeometryPtr hasn't released its pointer"); } inline @@ -156,7 +154,7 @@ { CheckInvariants(); UniqueGeometryPtr res = UncheckedStealGeometry(); - assert(! m_Feature->GetGeometryRef() && "Geometry hasn't been properly stolen"); + itkAssertOrThrowMacro(!m_Feature->GetGeometryRef(), "Geometry hasn't been properly stolen"); return otb::move(res); } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbBoostMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbBoostMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbBoostMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbBoostMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -148,7 +148,7 @@ template bool BoostMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbDecisionTreeMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbDecisionTreeMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbDecisionTreeMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbDecisionTreeMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -153,7 +153,7 @@ template bool DecisionTreeMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbGradientBoostedTreeMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbGradientBoostedTreeMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbGradientBoostedTreeMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbGradientBoostedTreeMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -150,7 +150,7 @@ template bool GradientBoostedTreeMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbKNearestNeighborsMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbKNearestNeighborsMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbKNearestNeighborsMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbKNearestNeighborsMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -84,7 +84,7 @@ template void KNearestNeighborsMachineLearningModel -::Save(const std::string & filename, const std::string & name) +::Save(const std::string & filename, const std::string & itkNotUsed(name)) { //there is no m_KNearestModel->save(filename.c_str(), name.c_str()). //We need to save the K parameter and IsRegression flag used and the samples. @@ -117,7 +117,7 @@ template void KNearestNeighborsMachineLearningModel -::Load(const std::string & filename, const std::string & name) +::Load(const std::string & filename, const std::string & itkNotUsed(name)) { //there is no m_KNearestModel->load(filename.c_str(), name.c_str()); std::ifstream ifs(filename.c_str()); @@ -203,7 +203,7 @@ template bool KNearestNeighborsMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNeuralNetworkMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNeuralNetworkMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNeuralNetworkMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNeuralNetworkMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -278,7 +278,7 @@ } template -bool NeuralNetworkMachineLearningModel::CanWriteFile(const std::string & file) +bool NeuralNetworkMachineLearningModel::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNormalBayesMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNormalBayesMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNormalBayesMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbNormalBayesMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,7 @@ template bool NormalBayesMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbRandomForestsMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbRandomForestsMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbRandomForestsMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbRandomForestsMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -178,7 +178,7 @@ template bool RandomForestsMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbSVMMachineLearningModel.txx otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbSVMMachineLearningModel.txx --- otb-4.0.0/Code/UtilitiesAdapters/OpenCVAdapters/otbSVMMachineLearningModel.txx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OpenCVAdapters/otbSVMMachineLearningModel.txx 2014-09-03 08:29:34.000000000 +0000 @@ -179,7 +179,7 @@ template bool SVMMachineLearningModel -::CanWriteFile(const std::string & file) +::CanWriteFile(const std::string & itkNotUsed(file)) { return false; } diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.cxx otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.cxx --- otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,88 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + + =========================================================================*/ +#include "otbDateTimeAdapter.h" + +#include "ossim/base/ossimDate.h" + +namespace otb +{ + +DateTimeAdapter::DateTimeAdapter() +{ + m_LocalTm = new ossimLocalTm(0); +} + +DateTimeAdapter::~DateTimeAdapter() +{ + if (m_LocalTm != NULL) + { + delete m_LocalTm; + } +} + +int +DateTimeAdapter::GetYear() +{ + return m_LocalTm->getYear(); +} + +int +DateTimeAdapter::GetMonth() +{ + return m_LocalTm->getMonth(); +} + +int +DateTimeAdapter::GetDay() +{ + return m_LocalTm->getDay(); +} + +int +DateTimeAdapter::GetHour() +{ + return m_LocalTm->getHour(); +} + +int +DateTimeAdapter::GetMinute() +{ + return m_LocalTm->getMin(); +} + +double +DateTimeAdapter::GetSeconds() +{ + return static_cast(m_LocalTm->getSec()) + + m_LocalTm->getFractionalSecond(); +} + +bool +DateTimeAdapter::SetFromIso8601(const std::string &date) +{ + return m_LocalTm->setIso8601(date); +} + +double +DateTimeAdapter::GetDeltaInSeconds(const DateTimeAdapter *pastDate) +{ + return m_LocalTm->deltaInSeconds(*(pastDate->m_LocalTm)); +} + + +} // namespace otb diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.h otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.h --- otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbDateTimeAdapter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,96 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + + =========================================================================*/ +#ifndef __otbDateTimeAdapter_h +#define __otbDateTimeAdapter_h + +#include "itkObject.h" +#include "itkObjectFactory.h" + +class ossimLocalTm; +//class ossimDate; +//class ossimTime; + +namespace otb +{ + +/** \class DateTimeAdapter + * \brief This is a dummy class to the ossimLocalTm class + * + * This class provide functions to define, compare and measure times and dates. + * + **/ +class DateTimeAdapter : public itk::Object +{ +public: + /** Standard class typedefs. */ + typedef DateTimeAdapter Self; + typedef itk::Object Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(DateTimeAdapter, itk::Object); + + /** Year Accessor*/ + int GetYear(); + + /** Month Accessor*/ + int GetMonth(); + + /** Day Accessor*/ + int GetDay(); + + /** Hour Accessor*/ + int GetHour(); + + /** Minute Accessor*/ + int GetMinute(); + + /** Seconds Accessor*/ + double GetSeconds(); + + /** Set the date and time from an Iso8601 string + * Return true if the date is valid + */ + bool SetFromIso8601(const std::string &date); + + /** Return the delta with an other date, expressed in seconds */ + double GetDeltaInSeconds(const DateTimeAdapter *pastDate); + + // TODO : add print self function + +protected: + DateTimeAdapter(); + virtual ~DateTimeAdapter(); + +private: + DateTimeAdapter(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + ossimLocalTm *m_LocalTm; + +}; + +// TODO add extern '<<' function + +} // namespace otb + +#endif diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.cxx otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.cxx --- otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,12 +21,15 @@ #include "otbMacro.h" +#include "gdal_priv.h" + #include "ossim/base/ossimKeywordlist.h" #include "ossim/base/ossimString.h" #include "ossim/ossimPluginProjectionFactory.h" #include "ossim/imaging/ossimImageHandlerRegistry.h" #include "ossim/ossimTileMapModel.h" #include "ossim/projection/ossimProjectionFactoryRegistry.h" +#include "ossim/projection/ossimRpcModel.h" #include "otbSensorModelAdapter.h" @@ -123,6 +126,44 @@ kwl.getMap() = ossimMap; } +bool +ImageKeywordlist:: +convertToGDALRPC(GDALRPCInfo &rpc) const +{ + ossimKeywordlist geom_kwl; + this->convertToOSSIMKeywordlist(geom_kwl); + + ossimRefPtr rpcModel = new ossimRpcModel; + if (rpcModel->loadState(geom_kwl)) + { + ossimRpcModel::rpcModelStruct ossimRpcStruct; + rpcModel->getRpcParameters(ossimRpcStruct); + + if (ossimRpcStruct.type == 'B') + { + rpc.dfSAMP_OFF = ossimRpcStruct.sampOffset; + rpc.dfLINE_OFF = ossimRpcStruct.lineOffset; + rpc.dfSAMP_SCALE = ossimRpcStruct.sampScale; + rpc.dfLINE_SCALE = ossimRpcStruct.lineScale; + rpc.dfLAT_OFF = ossimRpcStruct.latOffset; + rpc.dfLONG_OFF = ossimRpcStruct.lonOffset; + rpc.dfHEIGHT_OFF = ossimRpcStruct.hgtOffset; + rpc.dfLAT_SCALE = ossimRpcStruct.latScale; + rpc.dfLONG_SCALE = ossimRpcStruct.lonScale; + rpc.dfHEIGHT_SCALE = ossimRpcStruct.hgtScale; + + memcpy(rpc.adfLINE_NUM_COEFF, ossimRpcStruct.lineNumCoef, sizeof(double) * 20); + memcpy(rpc.adfLINE_DEN_COEFF, ossimRpcStruct.lineDenCoef, sizeof(double) * 20); + memcpy(rpc.adfSAMP_NUM_COEFF, ossimRpcStruct.sampNumCoef, sizeof(double) * 20); + memcpy(rpc.adfSAMP_DEN_COEFF, ossimRpcStruct.sampDenCoef, sizeof(double) * 20); + + return true; + } + } + + return false; +} + void ImageKeywordlist:: Print(std::ostream& os, itk::Indent indent) const @@ -154,98 +195,149 @@ } ImageKeywordlist -ReadGeometryFromImage(const std::string& filename) +ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) { // Trying to read ossim MetaData bool hasMetaData = false; ossimKeywordlist geom_kwl; // = new ossimKeywordlist(); ImageKeywordlist otb_kwl; - // Test the plugins factory + /****************************************************/ + /* First try : test the OSSIM plugins factory */ + /****************************************************/ /** Before, the pluginfactory was tested if the ossim one returned false. But in the case TSX, the images tif were considered as ossimQuickbirdTiffTileSource thus a TSX tif image wasn't read with TSX Model. We don't use the ossimRegisteryFactory because the default include factory contains ossimQuickbirdTiffTileSource. */ ossimProjection * projection = ossimplugins::ossimPluginProjectionFactory::instance() ->createProjection(ossimFilename(filename.c_str()), 0); - - if (!projection) - { - otbMsgDevMacro(<< "OSSIM Instantiate projection FAILED ! "); - } - else + if (projection) { - otbMsgDevMacro(<< "OSSIM Instantiate projection SUCCESS ! "); + otbMsgDevMacro(<< "OSSIM plugin projection instantiated ! "); hasMetaData = projection->saveState(geom_kwl); otb_kwl.SetKeywordlist(geom_kwl); // Free memory delete projection; + projection = 0; } + /***********************************************/ + /* Second try : the OSSIM projection factory */ + /***********************************************/ if (!hasMetaData) { ossimImageHandler* handler = ossimImageHandlerRegistry::instance() ->open(ossimFilename(filename.c_str())); - if (!handler) - { - otbMsgDevMacro(<< "OSSIM Open Image FAILED ! "); - - // In some corner cases, ossim is unable to create a ossimImageHandler - // instance for the provided file. - // This can happen for TIFF+geom files where the ossimTiffTileSource - // fails when trying to open the TIFF file (for example - // because ossim is compiled with a libtiff without BigTIFF support - // and when the actual TIFF file exceeds the Large File limit). - // In such cases, we don't actually need ossim to interpret the TIFF file, - // and just want a valid ossimKeywordlist corresponding to a sensor model. - - // Here is implemented a shortcut used as a fallback scenario, - // where we bypass the ossimImageHandlerRegistry - // and directly create a ossimKeywordlist from the ".geom" file. - - // We then verify it is a valid sensor model by using otb::SensorModelAdapter - // which uses ossimSensorModelFactory and ossimPluginProjectionFactory internally, - // thus by-passing the need for a valid ossimImageHandler. - - // Try to find a ".geom" file next to 'filename' - ossimFilename ossimGeomFile = ossimFilename(filename).setExtension(".geom"); - - otb_kwl = ReadGeometryFromGEOMFile(ossimGeomFile); - } - else + if (handler) { otbMsgDevMacro(<< "OSSIM Open Image SUCCESS ! "); // Add ossimPlugins model ossimProjectionFactoryRegistry::instance()->registerFactory(ossimplugins::ossimPluginProjectionFactory::instance()); - // hasMetaData = handler->getImageGeometry(geom_kwl); ossimRefPtr geom = handler->getImageGeometry(); - if (geom.valid()) { - ossimProjection* projection = geom->getProjection(); + projection = geom->getProjection(); if (projection) { hasMetaData = projection->saveState(geom_kwl); - otb_kwl.SetKeywordlist(geom_kwl); } } - - // If still no metadata, try the ".geom" file - if (!hasMetaData && otb_kwl.GetSize() == 0) + + // if the handler has found a sensor model, copy the tags found + if (hasMetaData && dynamic_cast(projection)) { - ossimFilename ossimGeomFile = ossimFilename(filename).setExtension(".geom"); - otb_kwl = ReadGeometryFromGEOMFile(ossimGeomFile); + otbMsgDevMacro(<<"OSSIM sensor projection instantiated ! "); + otb_kwl.SetKeywordlist(geom_kwl); } - + else + { + hasMetaData = false; + } + // Free memory + delete handler; + } + } + + /**********************************************************/ + /* Third try : look for external geom file and RPC tags */ + /**********************************************************/ + if (!hasMetaData) + { + // If still no metadata, try the ".geom" file + ossimFilename ossimGeomFile = ossimFilename(filename).setExtension(".geom"); + otb_kwl = ReadGeometryFromGEOMFile(ossimGeomFile); + + // also check any RPC tags + ImageKeywordlist rpc_kwl; + if (checkRpcTag) + { + rpc_kwl = ReadGeometryFromRPCTag(filename); + } + + if (otb_kwl.HasKey("type")) + { + // external geom has a "type" keyword + std::string geomType(otb_kwl.GetMetadataByKey("type")); + ossimProjection *testProj = ossimProjectionFactoryRegistry::instance() + ->createProjection(ossimString(geomType)); + if (dynamic_cast(testProj)) + { + // "type" keyword corresponds to a sensor model : don't erase it + if (rpc_kwl.GetSize() > 0) + { + rpc_kwl.ClearMetadataByKey("type"); + } + + ossimKeywordlist ossim_test_kwl; + otb_kwl.convertToOSSIMKeywordlist(ossim_test_kwl); + testProj = ossimProjectionFactoryRegistry::instance() + ->createProjection(ossim_test_kwl); + if (testProj) + { + // external geom contains a valid sensor geometry + hasMetaData = true; + } + } + } + + // copy keywords found in RPC tags if the external geom is not valid + if (!hasMetaData && rpc_kwl.GetSize() > 0) + { + const ImageKeywordlist::KeywordlistMap &kwlMap = rpc_kwl.GetKeywordlist(); + for (ImageKeywordlist::KeywordlistMap::const_iterator it = kwlMap.begin(); + it != kwlMap.end(); + ++it) + { + if (it->second != "") + { + otb_kwl.AddKey(it->first , it->second); + } + } + hasMetaData = true; } - // Free memory - delete handler; } + // In some corner cases, ossim is unable to create a ossimImageHandler + // instance for the provided file. + // This can happen for TIFF+geom files where the ossimTiffTileSource + // fails when trying to open the TIFF file (for example + // because ossim is compiled with a libtiff without BigTIFF support + // and when the actual TIFF file exceeds the Large File limit). + // In such cases, we don't actually need ossim to interpret the TIFF file, + // and just want a valid ossimKeywordlist corresponding to a sensor model. + + // Here is implemented a shortcut used as a fallback scenario, + // where we bypass the ossimImageHandlerRegistry + // and directly create a ossimKeywordlist from the ".geom" file. + + // We then verify it is a valid sensor model by using otb::SensorModelAdapter + // which uses ossimSensorModelFactory and ossimPluginProjectionFactory internally, + // thus by-passing the need for a valid ossimImageHandler. + if (!hasMetaData) { otbMsgDevMacro(<< "OSSIM MetaData not present ! "); @@ -253,7 +345,7 @@ else { otbMsgDevMacro(<< "OSSIM MetaData present ! "); - otbMsgDevMacro(<< geom_kwl); + //otbMsgDevMacro(<< geom_kwl); } return otb_kwl; @@ -294,6 +386,111 @@ return otb_kwl; } +ImageKeywordlist +ReadGeometryFromRPCTag(const std::string& filename) +{ + ossimKeywordlist geom_kwl; + ImageKeywordlist otb_kwl; + + // try to use GeoTiff RPC tag if present. + // Warning : RPC in subdatasets are not supported + GDALDriverH identifyDriverH = GDALIdentifyDriver(filename.c_str(), NULL); + if(identifyDriverH == NULL) + { + // If no driver has identified the dataset, don't try to open it and exit + return otb_kwl; + } + + GDALDatasetH datasetH = GDALOpen(filename.c_str(), GA_ReadOnly); + if (datasetH != NULL) + { + GDALDataset* dataset = static_cast(datasetH); + GDALRPCInfo rpcStruct; + if (GDALExtractRPCInfo(dataset->GetMetadata("RPC"),&rpcStruct)) + { + otbMsgDevMacro(<<"RPC Coeff found"); + std::vector lineNumCoefs; + std::vector lineDenCoefs; + std::vector sampNumCoefs; + std::vector sampDenCoefs; + + for (unsigned int k=0; k<20; ++k) + { + lineNumCoefs.push_back(rpcStruct.adfLINE_NUM_COEFF[k]); + lineDenCoefs.push_back(rpcStruct.adfLINE_DEN_COEFF[k]); + sampNumCoefs.push_back(rpcStruct.adfSAMP_NUM_COEFF[k]); + sampDenCoefs.push_back(rpcStruct.adfSAMP_DEN_COEFF[k]); + } + + ossimRefPtr rpcModel = new ossimRpcModel; + rpcModel->setAttributes( rpcStruct.dfSAMP_OFF, + rpcStruct.dfLINE_OFF, + rpcStruct.dfSAMP_SCALE, + rpcStruct.dfLINE_SCALE, + rpcStruct.dfLAT_OFF, + rpcStruct.dfLONG_OFF, + rpcStruct.dfHEIGHT_OFF, + rpcStruct.dfLAT_SCALE, + rpcStruct.dfLONG_SCALE, + rpcStruct.dfHEIGHT_SCALE, + sampNumCoefs, + sampDenCoefs, + lineNumCoefs, + lineDenCoefs); + + double errorBias = 0.0; + double errorRand = 0.0; + + // setup other metadata + rpcModel->setPositionError(errorBias,errorRand,true); + ossimDrect rectangle(0.0, + 0.0, + static_cast(dataset->GetRasterXSize()-1), + static_cast(dataset->GetRasterYSize()-1)); + rpcModel->setImageRect(rectangle); + + ossimDpt size; + size.line = rectangle.height(); + size.samp = rectangle.width(); + rpcModel->setImageSize(size); + + // Compute 4 corners and reference point + rpcModel->updateModel(); + double heightOffset = rpcStruct.dfHEIGHT_OFF; + ossimGpt ulGpt, urGpt, lrGpt, llGpt; + ossimGpt refGndPt; + + rpcModel->lineSampleHeightToWorld(rectangle.ul(), heightOffset, ulGpt); + rpcModel->lineSampleHeightToWorld(rectangle.ur(), heightOffset, urGpt); + rpcModel->lineSampleHeightToWorld(rectangle.lr(), heightOffset, lrGpt); + rpcModel->lineSampleHeightToWorld(rectangle.ll(), heightOffset, llGpt); + rpcModel->setGroundRect(ulGpt,urGpt,lrGpt,llGpt); + + rpcModel->lineSampleHeightToWorld(rectangle.midPoint(), heightOffset, refGndPt); + rpcModel->setRefGndPt(refGndPt); + + // compute ground sampling distance + try + { + // Method can throw ossimException. + rpcModel->computeGsd(); + } + catch (const ossimException& e) + { + otbMsgDevMacro(<< "OSSIM Compute ground sampling distance FAILED ! "); + } + + if (rpcModel->saveState(geom_kwl)) + { + otb_kwl.SetKeywordlist(geom_kwl); + } + } + GDALClose(datasetH); + } + + return otb_kwl; +} + void WriteGeometry(const ImageKeywordlist& otb_kwl, const std::string& filename) { diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.h otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.h --- otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbImageKeywordlist.h 2014-09-03 08:29:34.000000000 +0000 @@ -21,6 +21,8 @@ #include #include +#include "gdal.h" + #include "itkObject.h" #include "itkObjectFactory.h" @@ -30,6 +32,34 @@ namespace otb { +namespace internal +{ + /** + * Converts index coordinates from OTB into OSSIM. It is intended for sensor + * images where the centre of the top-left pixel is expected to be : + * [0.5,0.5] in OTB physical space + * [ 0 , 0 ] in OSSIM + * \param[in] val coordinate value to modify (along X or Y) + */ + inline double ConvertToOSSIMFrame(double val) + { + return (val - 0.5); + } + + /** + * Converts index coordinates from OSSIM into OTB. It is intended for sensor + * images where the centre of the top-left pixel is expected to be : + * [0.5,0.5] in OTB physical space + * [ 0 , 0 ] in OSSIM + * \param[in] val coordinate value to modify (along X or Y) + */ + inline double ConvertFromOSSIMFrame(double val) + { + return (val + 0.5); + } + +} // namespace internal + /** \class ImageKeywordlist * \brief Storage and conversion for OSSIM metadata * @@ -83,6 +113,10 @@ virtual void AddKey(const std::string& key, const std::string& value); virtual void convertToOSSIMKeywordlist(ossimKeywordlist& kwl) const; + + /** try to convert the image keywordlist into a GDALRpcInfo structure + * return true if successful, false otherwise */ + virtual bool convertToGDALRPC(GDALRPCInfo &rpc) const; virtual void Print(std::ostream& os, itk::Indent indent = 0) const; @@ -112,8 +146,9 @@ std::ostream & operator <<(std::ostream& os, const ImageKeywordlist& kwl); // Free function to handle the keywordlist <-> files -ImageKeywordlist ReadGeometryFromImage(const std::string& filename); +ImageKeywordlist ReadGeometryFromImage(const std::string& filename, bool checkRpcTag=true); ImageKeywordlist ReadGeometryFromGEOMFile(const std::string& filename); +ImageKeywordlist ReadGeometryFromRPCTag(const std::string& filename); void WriteGeometry(const ImageKeywordlist& otb_kwl, const std::string& filename); } //namespace otb diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCProjectionAdapter.cxx otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCProjectionAdapter.cxx --- otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCProjectionAdapter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCProjectionAdapter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,8 @@ h = 0.0; return; } - ossimDpt spoint(x, y); + ossimDpt spoint( internal::ConvertToOSSIMFrame(x), + internal::ConvertToOSSIMFrame(y)); ossimGpt gpoint; gpoint.hgt = z; @@ -82,7 +83,8 @@ for (gcpIt = gcpContainer.begin(); gcpIt != gcpContainer.end(); ++gcpIt) { // Fill sensor point - sensorPoint = ossimDpt(gcpIt->first[0], gcpIt->first[1]); + sensorPoint = ossimDpt( internal::ConvertToOSSIMFrame(gcpIt->first[0]), + internal::ConvertToOSSIMFrame(gcpIt->first[1])); // Fill geo point (lat, lon, elev) geoPoint = ossimGpt(gcpIt->second[1], gcpIt->second[0], gcpIt->second[2]); @@ -131,17 +133,18 @@ { ossimGpt ul, ll, ur, lr; // Upper left - ossimDpt imagePoint(orig[0], orig[1]); + ossimDpt imagePoint( internal::ConvertToOSSIMFrame(orig[0]), + internal::ConvertToOSSIMFrame(orig[1])); m_RpcProjection->lineSampleToWorld(imagePoint, ul); // Upper right - imagePoint = ossimDpt(orig[0], orig[1]+size[0]-1); + imagePoint.x += static_cast(size[0]) - 1.0; m_RpcProjection->lineSampleToWorld(imagePoint, ur); - // Lower left - imagePoint = ossimDpt(orig[0]+size[1]-1, orig[1]); - m_RpcProjection->lineSampleToWorld(imagePoint, ll); // Lower right - imagePoint = ossimDpt(orig[0]+size[1]-1, orig[1]+size[0]-1); + imagePoint.y += static_cast(size[0]) - 1.0; m_RpcProjection->lineSampleToWorld(imagePoint, lr); + // Lower left + imagePoint.x += - static_cast(size[0]) + 1.0; + m_RpcProjection->lineSampleToWorld(imagePoint, ll); ossimKeywordlist geom_kwl; diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx --- otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbRPCSolverAdapter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,7 +56,8 @@ { // Check if point is inside bounds // Fill sensor point - sensorPoint = ossimDpt(gcpIt->first[0], gcpIt->first[1]); + sensorPoint = ossimDpt( internal::ConvertToOSSIMFrame(gcpIt->first[0]), + internal::ConvertToOSSIMFrame(gcpIt->first[1])); // Fill geo point (lat, lon, elev) geoPoint = ossimGpt(gcpIt->second[1], gcpIt->second[0], gcpIt->second[2]); diff -Nru otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbSensorModelAdapter.cxx otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbSensorModelAdapter.cxx --- otb-4.0.0/Code/UtilitiesAdapters/OssimAdapters/otbSensorModelAdapter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/UtilitiesAdapters/OssimAdapters/otbSensorModelAdapter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,8 @@ itkExceptionMacro(<< "ForwardTransformPoint(): Invalid sensor model (m_SensorModel pointer is null)"); } - ossimDpt ossimPoint(x, y); + ossimDpt ossimPoint( internal::ConvertToOSSIMFrame(x), + internal::ConvertToOSSIMFrame(y)); ossimGpt ossimGPoint; this->m_SensorModel->lineSampleHeightToWorld(ossimPoint,z, ossimGPoint); @@ -106,7 +107,8 @@ itkExceptionMacro(<< "ForwardTransformPoint(): Invalid sensor model (m_SensorModel pointer is null)"); } - ossimDpt ossimPoint(x, y); + ossimDpt ossimPoint( internal::ConvertToOSSIMFrame(x), + internal::ConvertToOSSIMFrame(y)); ossimGpt ossimGPoint; this->m_SensorModel->lineSampleToWorld(ossimPoint, ossimGPoint); @@ -130,8 +132,8 @@ this->m_SensorModel->worldToLineSample(ossimGPoint, ossimDPoint); - x = ossimDPoint.x; - y = ossimDPoint.y; + x = internal::ConvertFromOSSIMFrame(ossimDPoint.x); + y = internal::ConvertFromOSSIMFrame(ossimDPoint.y); z = ossimGPoint.height(); } @@ -153,15 +155,16 @@ this->m_SensorModel->worldToLineSample(ossimGPoint, ossimDPoint); - x = ossimDPoint.x; - y = ossimDPoint.y; + x = internal::ConvertFromOSSIMFrame(ossimDPoint.x); + y = internal::ConvertFromOSSIMFrame(ossimDPoint.y); z = ossimGPoint.height(); } void SensorModelAdapter::AddTiePoint(double x, double y, double z, double lon, double lat) { // Create the tie point - ossimDpt imagePoint(x,y); + ossimDpt imagePoint( internal::ConvertToOSSIMFrame(x), + internal::ConvertToOSSIMFrame(y)); ossimGpt ossimGPoint(lat, lon, z); // Add the tie point to the container @@ -171,7 +174,8 @@ void SensorModelAdapter::AddTiePoint(double x, double y, double lon, double lat) { // Create the tie point - ossimDpt imagePoint(x,y); + ossimDpt imagePoint( internal::ConvertToOSSIMFrame(x), + internal::ConvertToOSSIMFrame(y)); // Get elevation from DEMHandler double z = m_DEMHandler->GetHeightAboveEllipsoid(lon,lat); diff -Nru otb-4.0.0/Code/Wrappers/CommandLine/otbApplicationLauncherCommandLine.cxx otb-4.2.0/Code/Wrappers/CommandLine/otbApplicationLauncherCommandLine.cxx --- otb-4.0.0/Code/Wrappers/CommandLine/otbApplicationLauncherCommandLine.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/CommandLine/otbApplicationLauncherCommandLine.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,9 +18,12 @@ #include "otbWrapperCommandLineLauncher.h" #include "otbTinyXML.h" +#include const std::string GetChildNodeTextOf(TiXmlElement *parentElement, std::string key); std::string PrepareExpressionFromXML(std::string filename); +std::vector PrepareVectorExpressionFromXML(std::string filename); +std::string CleanWord(const std::string & word); std::string PrepareExpressionFromXML(std::string filename) @@ -39,13 +42,17 @@ // Open the xml file TiXmlDocument doc; - FILE* fp = fopen( filename.c_str (), "rb" ); //must be changed TiXmlFileOpen - //from tinyxml.cpp + //Use itksys::SystemTools::FOpen() and close it below because + //TiXmlDocument::TiXmlFileOpen( ) is not exposed from tinyXML library. Even + //though its available in the TiXmlDocument::SaveFile(). + FILE* fp = itksys::SystemTools::Fopen(filename.c_str(), "rb"); if (!doc.LoadFile(fp , TIXML_ENCODING_UTF8)) { std::cerr << "Can't open file " << filename << std::endl; + fclose(fp); exit(1); + } TiXmlHandle handle(&doc); @@ -57,6 +64,7 @@ { std::string info = "Input XML file " + filename + " is invalid."; std::cerr << info << std::endl; + fclose(fp); exit(1); } @@ -134,9 +142,112 @@ } } } + + fclose(fp); + return expression; } +std::vector PrepareVectorExpressionFromXML(std::string filename) +{ + std::vector expression; + + if(filename.empty()) + { + std::cerr <<"Input XML Filename is empty" << std::endl; + return expression; + } + std::string ext = filename.substr(filename.size()-4,filename.size()); + if(ext != ".xml" ) + std::cerr << ext << " is a wrong extension: Expected .xml " << __FILE__ << std::endl; + + // Open the xml file + TiXmlDocument doc; + + //Use itksys::SystemTools::FOpen() and close it below because + //TiXmlDocument::TiXmlFileOpen( ) is not exposed from tinyXML library. Even + //though its available in the TiXmlDocument::SaveFile(). + FILE* fp = itksys::SystemTools::Fopen(filename.c_str(), "rb"); + + if (!doc.LoadFile(fp , TIXML_ENCODING_UTF8)) + { + std::cerr << "Can't open file " << filename << std::endl; + fclose(fp); + exit(1); + + } + + TiXmlHandle handle(&doc); + + TiXmlElement *n_OTB; + n_OTB = handle.FirstChild("OTB").Element(); + + if(!n_OTB) + { + std::string info = "Input XML file " + filename + " is invalid."; + std::cerr << info << std::endl; + fclose(fp); + exit(1); + } + + TiXmlElement *n_AppNode = n_OTB->FirstChildElement("application"); + + std::string moduleName; + moduleName = GetChildNodeTextOf(n_AppNode, "name"); + + expression.push_back(CleanWord(moduleName)); + + for( TiXmlElement* n_Parameter = n_AppNode->FirstChildElement("parameter"); n_Parameter != NULL; + n_Parameter = n_Parameter->NextSiblingElement() ) + { + std::string key="-"; + key.append(GetChildNodeTextOf(n_Parameter, "key")); + expression.push_back(CleanWord(key)); + + TiXmlElement* n_Values = NULL; + n_Values = n_Parameter->FirstChildElement("values"); + if(n_Values) + { + std::string values; + for(TiXmlElement* n_Value = n_Values->FirstChildElement("value"); n_Value != NULL; + n_Value = n_Value->NextSiblingElement()) + { + expression.push_back(CleanWord(n_Value->GetText())); + } + } + else + { + std::string value; + value = GetChildNodeTextOf(n_Parameter, "value"); + expression.push_back(CleanWord(value)); + + std::string type = GetChildNodeTextOf(n_Parameter, "type"); + if (type == "OutputImage") + { + std::string type = GetChildNodeTextOf(n_Parameter, "pixtype"); + expression.push_back(CleanWord(type)); + } + } + } + + fclose(fp); + + return expression; +} + +std::string CleanWord(const std::string & word) +{ + std::string res(""); + // Suppress whitespace characters at the beginning and ending of the string + std::string::size_type cleanStart = word.find_first_not_of(" \t"); + std::string::size_type cleanEnd = word.find_last_not_of(" \t\f\v\n\r"); + if (cleanEnd != std::string::npos) + { + res = word.substr(cleanStart,cleanEnd+1); + } + return res; +} + int main(int argc, char* argv[]) { if (argc < 2) @@ -145,17 +256,20 @@ return EXIT_FAILURE; } + std::vector vexp; + std::string exp; if (strcmp(argv[1], "-inxml") == 0) { - exp = PrepareExpressionFromXML(argv[2]); + //exp = PrepareExpressionFromXML(argv[2]); + vexp = PrepareVectorExpressionFromXML(argv[2]); } else { // Construct the string expression for (int i = 1; i < argc; i++) { - if (i != argc - 1) + /*if (i != argc - 1) { exp.append(argv[i]); exp.append(" "); @@ -163,16 +277,24 @@ else { exp.append(argv[i]); + }*/ + std::string strarg(argv[i]); + std::string cleanArg = CleanWord(strarg); + if (cleanArg.empty()) + { + // Empty argument ! + continue; } + vexp.push_back(cleanArg); } - } // std::cerr << exp << ":\n"; typedef otb::Wrapper::CommandLineLauncher LauncherType; LauncherType::Pointer launcher = LauncherType::New(); - if (launcher->Load(exp) == true) + //if (launcher->Load(exp) == true) + if (launcher->Load(vexp) == true) { if (launcher->ExecuteAndWriteOutput() == false) { diff -Nru otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx --- otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -58,7 +58,7 @@ { CommandLineLauncher::CommandLineLauncher() : - m_Expression(""), m_WatcherList(), m_ReportProgress(true), m_MaxKeySize(0) + /*m_Expression(""),*/m_VExpression(), m_WatcherList(), m_ReportProgress(true), m_MaxKeySize(0) { m_Application = NULL; m_Parser = CommandLineParser::New(); @@ -70,8 +70,8 @@ m_AddProcessCommand->SetCallbackFunction(this, &CommandLineLauncher::LinkWatchers); } -CommandLineLauncher::CommandLineLauncher(const char * exp) : - m_Expression(exp) +CommandLineLauncher::CommandLineLauncher(const char * exp) /*: + m_Expression(exp)*/ { m_Application = NULL; m_Parser = CommandLineParser::New(); @@ -94,15 +94,23 @@ bool CommandLineLauncher::Load(const std::string & exp) { - m_Expression = exp; + /*m_Expression = exp; + return this->Load(); */ + return false; +} + +bool CommandLineLauncher::Load(const std::vector &vexp) +{ + m_VExpression = vexp; return this->Load(); } + bool CommandLineLauncher::Load() { // Add a space to clarify output logs std::cerr << std::endl; - if (m_Expression == "") + if (m_VExpression.empty()) { itkExceptionMacro("No expression specified..."); } @@ -121,9 +129,9 @@ if (this->LoadPath() == false) { - if (m_Parser->GetPathsAsString(m_Expression).size() != 0) + if (m_Parser->GetPathsAsString(m_VExpression).size() != 0) { - std::cerr << "ERROR: At least one specified path within \"" << m_Parser->GetPathsAsString(m_Expression) + std::cerr << "ERROR: At least one specified path within \"" << m_Parser->GetPathsAsString(m_VExpression) << "\" is invalid or doesn't exist..." << std::endl; return false; } @@ -193,7 +201,7 @@ // Check if there's keys in the expression if the application takes // at least 1 mandatory parameter const std::vector appKeyList = m_Application->GetParametersKeys(true); - std::vector keyList = m_Parser->GetKeyList( m_Expression ); + std::vector keyList = m_Parser->GetKeyList( m_VExpression ); if( appKeyList.size()!=0 && keyList.size()==0 ) { @@ -203,21 +211,21 @@ } // if help is asked... - if (m_Parser->IsAttributExists("-help", m_Expression) == true) + if (m_Parser->IsAttributExists("-help", m_VExpression) == true) { this->DisplayHelp(); return false; } //display OTB version - if (m_Parser->IsAttributExists("-version", m_Expression) == true) + if (m_Parser->IsAttributExists("-version", m_VExpression) == true) { std::cerr << "This is the "<GetName() << " application, version " << OTB_VERSION_STRING <IsAttributExists("-testenv", m_Expression) == true) + if (m_Parser->IsAttributExists("-testenv", m_VExpression) == true) { this->LoadTestEnv(); } @@ -256,10 +264,10 @@ } // Check for the progress report - if (m_Parser->IsAttributExists("-progress", m_Expression) == true) + if (m_Parser->IsAttributExists("-progress", m_VExpression) == true) { std::vector val; - val = m_Parser->GetAttribut("-progress", m_Expression); + val = m_Parser->GetAttribut("-progress", m_VExpression); if (val.size() != 1) { std::cerr << "ERROR: Invalid progress argument, must be unique value..." << std::endl; @@ -292,7 +300,8 @@ { std::vector pathList; // If users has set path... - if (m_Parser->GetPaths(pathList, m_Expression) == CommandLineParser::OK) + //if (m_Parser->GetPaths(pathList, m_Expression) == CommandLineParser::OK) + if (m_Parser->GetPaths(pathList, m_VExpression) == CommandLineParser::OK) { for (unsigned i = 0; i < pathList.size(); i++) { @@ -311,7 +320,8 @@ { // Look for the module name std::string moduleName; - if (m_Parser->GetModuleName(moduleName, m_Expression) != CommandLineParser::OK) + //if (m_Parser->GetModuleName(moduleName, m_Expression) != CommandLineParser::OK) + if (m_Parser->GetModuleName(moduleName, m_VExpression) != CommandLineParser::OK) { std::cerr << "ERROR: LoadApplication, no module found..." << std::endl; return; @@ -365,17 +375,18 @@ */ const char *inXMLKey = "inxml"; const char *attrib = "-inxml"; - const bool paramInXMLExists(m_Parser->IsAttributExists(attrib, m_Expression)); + const bool paramInXMLExists(m_Parser->IsAttributExists(attrib, m_VExpression)); if(paramInXMLExists) { std::vector inXMLValues; - inXMLValues = m_Parser->GetAttribut(attrib, m_Expression); + inXMLValues = m_Parser->GetAttribut(attrib, m_VExpression); m_Application->SetParameterString(inXMLKey, inXMLValues[0]); m_Application->UpdateParameters(); } const std::vector appKeyList = m_Application->GetParametersKeys(true); // Loop over each parameter key declared in the application + // FIRST PASS : set parameter values for (unsigned int i = 0; i < appKeyList.size(); i++) { const std::string paramKey(appKeyList[i]); @@ -384,13 +395,13 @@ Parameter::Pointer param = m_Application->GetParameterByKey(paramKey); ParameterType type = m_Application->GetParameterType(paramKey); - const bool paramExists(m_Parser->IsAttributExists(std::string("-").append(paramKey), m_Expression)); + const bool paramExists(m_Parser->IsAttributExists(std::string("-").append(paramKey), m_VExpression)); // if param is a Group, dont do anything, ParamGroup dont have values if (type != ParameterType_Group) { // Get the attribute relative to this key as vector - values = m_Parser->GetAttribut(std::string("-").append(paramKey), m_Expression); + values = m_Parser->GetAttribut(std::string("-").append(paramKey), m_VExpression); // If the param does not exists in the cli, dont try to set a // value on it, an exception will be thrown later in this function @@ -430,7 +441,7 @@ if (type == ParameterType_String) { dynamic_cast (param.GetPointer())->SetValue( - m_Parser->GetAttributAsString(std::string("-").append(paramKey), m_Expression) ); + m_Parser->GetAttributAsString(std::string("-").append(paramKey), m_VExpression) ); } else if (type == ParameterType_OutputImage) @@ -530,6 +541,16 @@ m_Application->UpdateParameters(); } } + } + + // SECOND PASS : check mandatory parameters + for (unsigned int i = 0; i < appKeyList.size(); i++) + { + const std::string paramKey(appKeyList[i]); + Parameter::Pointer param = m_Application->GetParameterByKey(paramKey); + ParameterType type = m_Application->GetParameterType(paramKey); + const bool paramExists(m_Parser->IsAttributExists(std::string("-").append(paramKey), m_VExpression)); + std::vector values; // When a parameter is mandatory : // it must be set if : @@ -586,7 +607,7 @@ } else { - values = m_Parser->GetAttribut(std::string("-").append(paramKey), m_Expression); + values = m_Parser->GetAttribut(std::string("-").append(paramKey), m_VExpression); if (values.size() == 0 && !m_Application->HasValue(paramKey)) { std::cerr << "ERROR: Missing mandatory parameter: " << paramKey << std::endl; @@ -599,7 +620,7 @@ { if( paramExists ) { - values = m_Parser->GetAttribut(std::string("-").append(paramKey), m_Expression); + values = m_Parser->GetAttribut(std::string("-").append(paramKey), m_VExpression); if (values.size() == 0) { std::cerr << "ERROR: Missing non-mandatory parameter: " << paramKey << std::endl; @@ -612,7 +633,7 @@ return OKPARAM; } -void CommandLineLauncher::LinkWatchers(itk::Object * caller, const itk::EventObject & event) +void CommandLineLauncher::LinkWatchers(itk::Object * itkNotUsed(caller), const itk::EventObject & event) { // Report the progress only if asked if (m_ReportProgress) @@ -708,7 +729,7 @@ // - The param is not root and belonging to a Mandatory Group // wich is activated bool isMissing = false; - if (!m_Parser->IsAttributExists(std::string("-").append(paramKey), m_Expression)) + if (!m_Parser->IsAttributExists(std::string("-").append(paramKey), m_VExpression)) { if (!m_Application->HasValue(paramKey)) { @@ -847,7 +868,8 @@ { bool res = true; // Extract expression keys - std::vector keyList = m_Parser->GetKeyList(m_Expression); + //std::vector keyList = m_Parser->GetKeyList(m_Expression); + std::vector keyList = m_Parser->GetKeyList(m_VExpression); // Check Unicity for (unsigned int i = 0; i < keyList.size(); i++) @@ -872,21 +894,22 @@ bool CommandLineLauncher::CheckParametersPrefix() { - bool res = true; - // Check if the chain " --" appears in the expression, could be a common mistake - if (m_Expression.find(" --") != std::string::npos ) + // Check if the chain " --" appears in the args, could be a common mistake + for (std::vector::iterator it = m_VExpression.begin(); it != m_VExpression.end(); ++it) { - res = false; + if (it->find("--") != std::string::npos ) + { + return false; + } } - - return res; + return true; } bool CommandLineLauncher::CheckKeyValidity(std::string& refKey) { bool res = true; // Extract expression keys - std::vector expKeyList = m_Parser->GetKeyList(m_Expression); + std::vector expKeyList = m_Parser->GetKeyList(m_VExpression); // Extract application keys std::vector appKeyList = m_Application->GetParametersKeys(true); @@ -935,9 +958,9 @@ } - if ( m_Parser->IsAttributExists("-testenv", m_Expression) ) + if ( m_Parser->IsAttributExists("-testenv", m_VExpression) ) { - std::vector val = m_Parser->GetAttribut("-testenv", m_Expression); + std::vector val = m_Parser->GetAttribut("-testenv", m_VExpression); if( val.size() == 1 ) { std::ofstream ofs(val[0].c_str()); diff -Nru otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h --- otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncher.h 2014-09-03 08:29:34.000000000 +0000 @@ -33,6 +33,8 @@ #include "itkCommand.h" +#include + namespace otb { namespace Wrapper @@ -49,7 +51,7 @@ * interpreted as a list. */ -class ITK_EXPORT CommandLineLauncher : public itk::Object +class ITK_ABI_EXPORT CommandLineLauncher : public itk::Object { public: /** Standard class typedefs. */ @@ -84,6 +86,9 @@ /** same as Load method but set the expression before. */ bool Load( const std::string & exp ); + + /** same as Load method but set the expression before. */ + bool Load(const std::vector &vexp); /** Launch the process, using the Execute application method * The method will check if the user asked for help (looking at @@ -168,7 +173,8 @@ std::string m_Path; Application::Pointer m_Application; - std::string m_Expression; + //std::string m_Expression; + std::vector m_VExpression; CommandLineParser::Pointer m_Parser; WatcherListType m_WatcherList; diff -Nru otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx --- otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,6 +40,27 @@ } std::string +CommandLineParser::GetPathsAsString(const std::vector & vexp ) +{ + std::string res; + std::vector pathList; + + if (this->GetPaths(pathList,vexp) == OK) + { + std::vector::iterator it; + for (it=pathList.begin(); it!=pathList.end(); ++it) + { + if (!res.empty()) + { + res.append(" "); + } + res.append(*it); + } + } + return res; +} + +std::string CommandLineParser::GetPathsAsString( const std::string & exp ) { std::string res; @@ -69,6 +90,49 @@ } CommandLineParser::ParseResultType +CommandLineParser::GetPaths( std::vector & paths, const std::vector & exp ) +{ + if (exp.empty()) + { + return NOMODULEPATH; + } + + // The first element must be the module name, non " -" allowed. + // The module path list elements are the strings between the first + // element and the first key (ie. string which begins with "-"). + std::vector::const_iterator it = exp.begin(); + ++it; // first element is module name + + std::string tmpPath; + + while (it != exp.end()) + { + tmpPath = *it; + // If this is the first key : exit loop + if (tmpPath[0]=='-') + { + break; + } + // Add path to result + std::string fullPath = itksys::SystemTools::CollapseFullPath(tmpPath.c_str()); + if( !itksys::SystemTools::FileIsDirectory(fullPath.c_str()) ) + { + std::cerr<<"Invalid module path: "< & paths, const std::string & exp ) { std::string pathsList = this->GetPathsAsString( exp ); @@ -118,6 +182,34 @@ return OK; } +CommandLineParser::ParseResultType +CommandLineParser::GetModuleName( std::string & modName, const std::vector & exp ) +{ + if (exp.empty()) + { + return NOMODULENAME; + } + + itksys::RegularExpression reg; + reg.compile("([^0-9a-zA-Z])"); + // The first element must be the module path, non " -" allowed. + if( exp[0][0] == '-') + { + return NOMODULENAME; + } + + // It must contain only alphanumerical character + if(reg.find(exp[0])) + { + return INVALIDMODULENAME; + } + else + { + modName = exp[0]; + } + + return OK; +} CommandLineParser::ParseResultType CommandLineParser::GetModuleName( std::string & modName, const std::string & exp ) @@ -162,6 +254,45 @@ return OK; } +std::vector +CommandLineParser::GetAttribut( const std::string & key, const std::vector & exp ) +{ + std::vector res; + if (!this->IsAttributExists(key,exp)) + return res; + + bool foundKey=false; + std::vector::const_iterator it = exp.begin(); + while(it!=exp.end() ) + { + if (foundKey) + { + if (it->find("-") == 0) + { + std::string tmpKey = it->substr(1,std::string::npos); + if (this->IsAValidKey(tmpKey)) + { + break; + } + else + { + res.push_back(*it); + } + } + else + res.push_back(*it); + } + else + { + if (it->compare(key) == 0) + { + foundKey=true; + } + } + ++it; + } + return res; +} std::vector CommandLineParser::GetAttribut( const std::string & key, const std::string & exp ) @@ -254,6 +385,36 @@ } std::string +CommandLineParser::GetAttributAsString( const std::string & key, const std::vector & exp ) +{ + std::string res(""); + std::vector values = this->GetAttribut( key, exp ); + + if( values.size() == 0 ) + { + return ""; + } + else if( values.size() == 1 && values[0] == " " ) + { + return ""; + } + + for( unsigned int i=0; i & exp ) +{ + for (std::vector::const_iterator it = exp.begin(); it != exp.end(); ++it) + { + if (it->compare(key) == 0) + return true; + } + return false; +} + +std::vector +CommandLineParser::GetKeyList( const std::vector & exp ) +{ + std::vector keyList; + for (std::vector::const_iterator it = exp.begin(); it != exp.end(); ++it) + { + if (it->find("-") == 0) + { + // Remove first character ('-') + std::string key = it->substr(1,std::string::npos); + if (this->IsAValidKey(key)) + { + keyList.push_back(key); + } + } + } + + return keyList; +} std::vector CommandLineParser::GetKeyList( const std::string & exp ) @@ -335,18 +526,32 @@ { bool res = false; std::string tmp = foundKey; - if( tmp.find(".") != std::string::npos ) - tmp.erase(tmp.find("."), tmp.find(".")); - - // To be a key, the string can't contain a number + // make sure the tested key ends with a dot. + // the starting dash should be already removed + tmp.append("."); + + // To be a key, the string must be a serie of groups separated by dots so that : + // - each group has at least one character + // - each group contains only alphanumeric characters (and lowercase) + // - there is at least one group + // The following regular expression says just that itksys::RegularExpression reg; - reg.compile("([^0-9])"); - + reg.compile("^([a-z0-9]+\\.)+$"); if( reg.find(tmp) ) { res = true; } + // a second test is performed to detect negative numbers (even in + // scientific notation). Any key that matches the search pattern for a + // number is considered not valid. + itksys::RegularExpression regNum; + regNum.compile("^([0-9]+(\\.[0-9]*)?([eE][+-]?[0-9]+)?)$"); + if( regNum.find(foundKey) ) + { + res = false; + } + return res; } diff -Nru otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.h otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.h --- otb-4.0.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/CommandLine/otbWrapperCommandLineParser.h 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ * After the attribut key, if the user give several values (expression without \"--\" separated by space), it will automacally be interpreted as a list. */ -class ITK_EXPORT CommandLineParser : public itk::Object +class ITK_ABI_EXPORT CommandLineParser : public itk::Object { public: /** Standard class typedefs. */ @@ -57,22 +57,30 @@ /** Get the attribut associatd to a key (list of element after the key and before the next "--") as a vector of string. */ std::vector GetAttribut( const std::string & key, const std::string & exp ); + std::vector GetAttribut( const std::string & key, const std::vector & exp ); /** Get the attribut associatd to a key (list of element after the key and before the next "--") as a string separated by spaces. */ std::string GetAttributAsString( const std::string & key, const std::string & exp ); - +std::string GetAttributAsString( const std::string & key, const std::vector & exp ); /** Look if a given key is in an expression. */ bool IsAttributExists(const std::string key, const std::string & exp ); - +bool IsAttributExists(const std::string key, const std::vector & exp); + /** Get the paths executables in an expression. Store the list in a vector of string. */ CommandLineParser::ParseResultType GetPaths( std::vector & paths, const std::string & exp ); + CommandLineParser::ParseResultType GetPaths( std::vector & paths, const std::vector & exp ); + /** Get the paths executables in an expression. Store the list in a vector of string. */ std::string GetPathsAsString( const std::string & exp ); + std::string GetPathsAsString( const std::vector & vexp ); + /** Get the module name in an expression. It can be the first element of the expression (if the expression doesn't start with a "--" or the attribut associated to the key m_ModuleNameKey). */ CommandLineParser::ParseResultType GetModuleName( std::string & modName, const std::string & exp ); - +CommandLineParser::ParseResultType GetModuleName( std::string & modName, const std::vector & exp ); + /** Get the list of keys in an expression. That is to say each word starting by "--". */ std::vector GetKeyList( const std::string & exp ); + std::vector GetKeyList( const std::vector & exp); protected: /** Constructor */ diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/itkQtProgressBar.h otb-4.2.0/Code/Wrappers/QtWidget/itkQtProgressBar.h --- otb-4.0.0/Code/Wrappers/QtWidget/itkQtProgressBar.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/itkQtProgressBar.h 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ namespace itk { -class QtProgressBar : public ::QProgressBar +class ITK_ABI_EXPORT QtProgressBar : public ::QProgressBar { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbQtApplication.h otb-4.2.0/Code/Wrappers/QtWidget/otbQtApplication.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbQtApplication.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbQtApplication.h 2014-09-03 08:29:34.000000000 +0000 @@ -21,11 +21,12 @@ #include #include +#include "itkMacro.h" namespace otb { namespace Wrapper { -class QtApplication : public QApplication +class ITK_ABI_EXPORT QtApplication : public QApplication { Q_OBJECT diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbQtFileSelectionWidget.h otb-4.2.0/Code/Wrappers/QtWidget/otbQtFileSelectionWidget.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbQtFileSelectionWidget.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbQtFileSelectionWidget.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ /** \class * \brief */ -class QtFileSelectionWidget : public QWidget +class ITK_ABI_EXPORT QtFileSelectionWidget : public QWidget { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbQtLogOutput.h otb-4.2.0/Code/Wrappers/QtWidget/otbQtLogOutput.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbQtLogOutput.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbQtLogOutput.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ * */ -class ITK_EXPORT QtLogOutput : public QObject, public itk::LogOutput +class ITK_ABI_EXPORT QtLogOutput : public QObject, public itk::LogOutput { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbQtStringSelectionWidget.h otb-4.2.0/Code/Wrappers/QtWidget/otbQtStringSelectionWidget.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbQtStringSelectionWidget.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbQtStringSelectionWidget.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtStringSelectionWidget : public QWidget +class ITK_ABI_EXPORT QtStringSelectionWidget : public QWidget { Q_OBJECT diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetChoiceParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetChoiceParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetChoiceParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetChoiceParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetChoiceParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetChoiceParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexInputImageParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexInputImageParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexInputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexInputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetComplexInputImageParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetComplexInputImageParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexOutputImageParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexOutputImageParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexOutputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetComplexOutputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetComplexOutputImageParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetComplexOutputImageParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetDirectoryParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetDirectoryParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetDirectoryParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetEmptyParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetEmptyParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetEmptyParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetEmptyParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ /** \class * \brief */ -class QtWidgetEmptyParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetEmptyParameter : public QtWidgetParameterBase { Q_OBJECT diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetFloatParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ /** \class * \brief */ -class QtWidgetFloatParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetFloatParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.cxx otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.cxx --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -304,6 +304,8 @@ m_Scroll->setWidget(mainGroup); this->update(); + + emit FileSelectionWidgetAdded( fileSelection ); } void diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetInputFilenameListParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetInputFilenameListParameter : public QtWidgetParameterBase { Q_OBJECT public: @@ -41,6 +41,7 @@ signals: void Change(); + void FileSelectionWidgetAdded( QWidget * ); protected slots: //void SetFileName( const QString& value ); diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputFilenameParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetInputFilenameParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetInputFilenameParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.cxx otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.cxx --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -313,13 +313,20 @@ m_FileSelectionList.push_back(fileSelection); /* No need of AddNullElement() here. Moved adding NullElement when updating the list */ //m_InputImageListParam->AddNullElement(); - connect(fileSelection->GetInput(), SIGNAL(textChanged(const QString&)), this, SLOT(UpdateImageList())); + connect( + fileSelection->GetInput(), + SIGNAL( textChanged( const QString & ) ), + this, + SLOT( UpdateImageList() ) + ); QGroupBox *mainGroup = new QGroupBox(); mainGroup->setLayout(m_FileLayout); m_Scroll->setWidget(mainGroup); this->update(); + + emit FileSelectionWidgetAdded( fileSelection ); } void diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetInputImageListParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetInputImageListParameter : public QtWidgetParameterBase { Q_OBJECT public: @@ -41,6 +41,7 @@ signals: void Change(); + void FileSelectionWidgetAdded( QWidget * ); protected slots: //void SetFileName( const QString& value ); diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetInputImageParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetInputImageParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputProcessXMLParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputProcessXMLParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputProcessXMLParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputProcessXMLParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetInputProcessXMLParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetInputProcessXMLParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.cxx otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.cxx --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -304,6 +304,8 @@ m_Scroll->setWidget(mainGroup); this->update(); + + emit FileSelectionWidgetAdded( fileSelection ); } void diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetInputVectorDataListParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetInputVectorDataListParameter : public QtWidgetParameterBase { Q_OBJECT public: @@ -41,6 +41,7 @@ signals: void Change(); + void FileSelectionWidgetAdded( QWidget * ); protected slots: //void SetFileName( const QString& value ); diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetInputVectorDataParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetInputVectorDataParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetInputVectorDataParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetIntParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetIntParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetIntParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetIntParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetIntParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetIntParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetListViewParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetListViewParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetListViewParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetListViewParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetListViewParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetListViewParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetModel.h 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ namespace Wrapper { -class AppliThread : public QThread +class ITK_ABI_EXPORT AppliThread : public QThread { Q_OBJECT @@ -76,7 +76,7 @@ /** \class * \brief */ -class QtWidgetModel : public QObject +class ITK_ABI_EXPORT QtWidgetModel : public QObject { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputFilenameParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputFilenameParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputFilenameParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputFilenameParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetOutputFilenameParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetOutputFilenameParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputImageParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetOutputImageParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetOutputImageParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputProcessXMLParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputProcessXMLParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputProcessXMLParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputProcessXMLParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetOutputProcessXMLParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetOutputProcessXMLParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputVectorDataParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputVectorDataParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputVectorDataParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetOutputVectorDataParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetOutputVectorDataParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetOutputVectorDataParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.cxx otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.cxx --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -63,7 +63,7 @@ } } -void QtWidgetParameterBase::ParameterChanged(const QString& key) +void QtWidgetParameterBase::ParameterChanged(const QString& itkNotUsed(key)) { m_Param->SetUserValue(true); } diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ /** \class * \brief */ -class QtWidgetParameterBase : public QWidget +class ITK_ABI_EXPORT QtWidgetParameterBase : public QWidget { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterFactory.h 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ /** \class ImageIOFactory * \brief Create instances of ImageIO objects using an object factory. */ -class ITK_EXPORT QtWidgetParameterFactory : public itk::Object +class ITK_ABI_EXPORT QtWidgetParameterFactory : public itk::Object { public: /** Standard class typedefs. */ diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterGroup.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterGroup.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterGroup.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterGroup.h 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ /** \class * \brief */ -class QtWidgetParameterGroup : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetParameterGroup : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterLabel.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterLabel.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterLabel.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetParameterLabel.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ /** \class * \brief */ -class QtWidgetParameterLabel : public QWidget +class ITK_ABI_EXPORT QtWidgetParameterLabel : public QWidget { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.cxx otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.cxx --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,7 +56,7 @@ } void -QtWidgetProgressReport::ProcessEvent( itk::Object * caller, +QtWidgetProgressReport::ProcessEvent( itk::Object * itkNotUsed(caller), const itk::EventObject & event ) { if( typeid( otb::Wrapper::AddProcessToWatchEvent ) == typeid( event ) ) diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetProgressReport.h 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ * \brief Create a widget reporting the progress of the application * process. */ -class QtWidgetProgressReport : public QWidget +class ITK_ABI_EXPORT QtWidgetProgressReport : public QWidget { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetRAMParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetRAMParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetRAMParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetRAMParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetRAMParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetRAMParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.cxx otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.cxx --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -63,7 +63,7 @@ } void -QtWidgetSimpleProgressReport::ProcessEvent( itk::Object * caller, +QtWidgetSimpleProgressReport::ProcessEvent( itk::Object * itkNotUsed(caller), const itk::EventObject & event ) { if( typeid( otb::Wrapper::AddProcessToWatchEvent ) == typeid( event ) ) diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetSimpleProgressReport.h 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ * \brief Create a widget reporting the progress of the application * process. */ -class QtWidgetSimpleProgressReport : public QWidget +class ITK_ABI_EXPORT QtWidgetSimpleProgressReport : public QWidget { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringListParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringListParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringListParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringListParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetStringListParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetStringListParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringParameter.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringParameter.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringParameter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetStringParameter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ /** \class * \brief */ -class QtWidgetStringParameter : public QtWidgetParameterBase +class ITK_ABI_EXPORT QtWidgetStringParameter : public QtWidgetParameterBase { Q_OBJECT public: diff -Nru otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h --- otb-4.0.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Code/Wrappers/QtWidget/otbWrapperQtWidgetView.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /** \class * \brief */ -class QtWidgetView : public QWidget +class ITK_ABI_EXPORT QtWidgetView : public QWidget { Q_OBJECT public: diff -Nru otb-4.0.0/debian/changelog otb-4.2.0/debian/changelog --- otb-4.0.0/debian/changelog 2014-06-17 17:39:11.000000000 +0000 +++ otb-4.2.0/debian/changelog 2014-09-22 15:39:48.000000000 +0000 @@ -1,8 +1,10 @@ -otb (4.0.0-1otb1~trusty3) trusty; urgency=low +otb (4.2.0-1otb1~trusty2) trusty; urgency=low - * Launchpad build for Trusty + * Version 4.2.0 released + * Fix index space conventions + * Switch to ITK 4.6 - -- Jerome Villeneuve Larouche Tue, 17 Jun 2014 13:38:54 -0400 + -- OTB Team Fri, 29 Aug 2014 10:07:02 +0200 otb (4.0.0-1otb1~trusty2) trusty; urgency=low diff -Nru otb-4.0.0/debian/changelog.in otb-4.2.0/debian/changelog.in --- otb-4.0.0/debian/changelog.in 2014-05-09 08:24:30.000000000 +0000 +++ otb-4.2.0/debian/changelog.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -otb (4.0.0-1otb1~@DIST@@PKGVERSION@) @DIST@; urgency=low - - * Switch to ITK 4.5.2 - - -- OTB Team Fri, 02 Apr 2014 12:03:54 +0100 - -otb (4.0.0-0ppa~quantal1) quantal; urgency=low - - * New major version 4.0.0 released - * Switch to ITK 4.5.0 - * New naming convention for packages - - -- OTB Team Thu, 13 Feb 2014 20:53:50 +0100 - -otb (3.20.0-0ppa~precise3) precise; urgency=low - - * Add conflict with previous OTB version - - -- Julien Malik Thu, 28 Nov 2013 12:03:58 +0100 - -otb (3.20.0-0ppa~precise2) precise; urgency=low - - * Fix muparser incompatibilities - - -- Julien Malik Tue, 26 Nov 2013 16:21:06 +0100 - -otb (3.12.0-1) lucid; urgency=low - - * Version 3.12.0 released - - -- OTB Team Thu, 31 Jan 2012 09:12:12 +0100 - -otb (3.10.0-0) lucid; urgency=low - - * Version 3.10.0 released - - -- OTB Team Thu, 30 Jun 2011 08:59:14 +0200 - -otb (3.8.0-7) lucid; urgency=low - - * Version 3.8.0 released - - -- OTB Team Wed, 15 Dec 2010 16:50:52 +0100 - -otb (3.6.0-1) lucid; urgency=low - - * Version 3.6.0 released (first public package) - - -- OTB Team Thu, 30 Nov 2010 12:22:17 +0200 diff -Nru otb-4.0.0/debian/control otb-4.2.0/debian/control --- otb-4.0.0/debian/control 2014-05-09 08:55:07.000000000 +0000 +++ otb-4.2.0/debian/control 2014-09-22 15:39:48.000000000 +0000 @@ -152,7 +152,7 @@ ${misc:Depends}, otb-bin-common, python (>= 2.6), - python-central (>= 0.6.11) + dh-python (>= 1.20131003) Description: ORFEO Toolbox Python API for applications ORFEO Toolbox (OTB) is distributed as an open source library of image processing algorithms. OTB is based on the medical image processing library diff -Nru otb-4.0.0/debian/control.in otb-4.2.0/debian/control.in --- otb-4.0.0/debian/control.in 2014-06-17 17:39:34.000000000 +0000 +++ otb-4.2.0/debian/control.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,165 +0,0 @@ -Source: otb -Priority: extra -Maintainer: OTB Team -Build-Depends: - debhelper (>= 9), - dpkg-dev (>= 1.16.1~), - cmake (>= 2.8.3), - libc6-dev (>= 2.4), - libgcc1 (>= 1:4.1), - libstdc++6 (>= 4.4), - libinsighttoolkit4-dev (>= 4.5.0), - libgdal-dev (>= 1.10.0), - libgeotiff-dev, - libpng-dev, - libproj-dev, - libexpat1-dev, - libtool, - libcurl4-gnutls-dev, - libopenthreads-dev, - libboost-graph-dev, - libqt4-dev, - libqtcore4, - libqtgui4, - swig, - python-dev, - libkml-dev, - libmuparser-dev, - libopencv-dev, - libossim-dev, - libfftw3-dev -Standards-Version: 3.9.4 -Section: contrib/science -Homepage: http://www.orfeo-toolbox.org/ - -Package: libotb -Section: contrib/libs -Architecture: any -Provides: libotb -Conflicts: libotb3.16, libotb3.18, libotb3.20 -Depends: - libinsighttoolkit4.5, - libgdal1h (>= 1.10.0), - ${shlibs:Depends}, - ${misc:Depends} -Suggests: libotb-dev -Description: Free library of image processing algorithms - runtime - ORFEO Toolbox (OTB) is distributed as an open source library of image - processing algorithms. OTB is based on the medical image processing library - ITK and offers particular functionalities for remote sensing image processing - in general and for high spatial resolution images in particular. OTB is - distributed under a free software license CeCILL (similar to GNU GPL) to - encourage contribution from users and to promote reproducible research. - . - This package contains the shared libraries required by Monteverdi, - Monteverdi2 and the OTB applications. - -Package: libotb-dev -Section: contrib/libdevel -Architecture: any -Provides: libotb-dev -Conflicts: libotb3-dev -Depends: - libotb (= ${binary:Version}), - cmake (>= 2.8.3), - libc6-dev (>= 2.4), - libgcc1 (>= 1:4.1), - libstdc++6 (>= 4.4), - libinsighttoolkit4-dev (>= 4.5.0), - libgdal-dev (>= 1.10.0), - libgeotiff-dev, - libexpat1-dev, - libopenthreads-dev, - libboost-graph-dev, - libkml-dev, - libmuparser-dev, - libopencv-dev, - libossim-dev, - libfftw3-dev, - ${misc:Depends} -Description: Free library of image processing algorithms - development - ORFEO Toolbox (OTB) is distributed as an open source library of image - processing algorithms. OTB is based on the medical image processing library - ITK and offers particular functionalities for remote sensing image processing - in general and for high spatial resolution images in particular. OTB is - distributed under a free software license CeCILL (similar to GNU GPL) to - encourage contribution from users and to promote reproducible research. - . - This package contains the development files needed to build your own OTB - applications. - -Package: otb-bin-common -Section: contrib/science -Architecture: any -Depends: - libotb (= ${binary:Version}), - ${shlibs:Depends}, - ${misc:Depends} -Description: Plugins for ORFEO Toolbox applications - ORFEO Toolbox (OTB) is distributed as an open source library of image - processing algorithms. OTB is based on the medical image processing library - ITK and offers particular functionalities for remote sensing image processing - in general and for high spatial resolution images in particular. OTB is - distributed under a free software license CeCILL (similar to GNU GPL) to - encourage contribution from users and to promote reproducible research. - . - This package contains the application plugins used by otb-bin and otb-bin-qt - -Package: otb-bin -Section: contrib/science -Architecture: any -Depends: - otb-bin-common (= ${binary:Version}), - ${shlibs:Depends}, - ${misc:Depends} -Description: ORFEO Toolbox command line applications - ORFEO Toolbox (OTB) is distributed as an open source library of image - processing algorithms. OTB is based on the medical image processing library - ITK and offers particular functionalities for remote sensing image processing - in general and for high spatial resolution images in particular. OTB is - distributed under a free software license CeCILL (similar to GNU GPL) to - encourage contribution from users and to promote reproducible research. - . - This package contains the command line tools illustrating OTB features (using - plugins provided by otb-bin-common package). - -Package: otb-bin-qt -Section: contrib/science -Architecture: any -Depends: - otb-bin-common (= ${binary:Version}), - ${shlibs:Depends}, - ${misc:Depends}, - libqtcore4, - libqtgui4 -Description: ORFEO Toolbox graphical user interface applications - ORFEO Toolbox (OTB) is distributed as an open source library of image - processing algorithms. OTB is based on the medical image processing library - ITK and offers particular functionalities for remote sensing image processing - in general and for high spatial resolution images in particular. OTB is - distributed under a free software license CeCILL (similar to GNU GPL) to - encourage contribution from users and to promote reproducible research. - . - This package contains the GUI tools illustrating OTB features (using plugins - provided by otb-bin-common package). - -Package: python-otb -Section: contrib/python -Architecture: any -Depends: - libotb (= ${binary:Version}), - ${shlibs:Depends}, - ${misc:Depends}, - otb-bin-common, - python (>= 2.6), - python-central (>= 0.6.11) -Description: ORFEO Toolbox Python API for applications - ORFEO Toolbox (OTB) is distributed as an open source library of image - processing algorithms. OTB is based on the medical image processing library - ITK and offers particular functionalities for remote sensing image processing - in general and for high spatial resolution images in particular. OTB is - distributed under a free software license CeCILL (similar to GNU GPL) to - encourage contribution from users and to promote reproducible research. - . - This package contains the Python API for applications provided by the - otb-bin-common package. diff -Nru otb-4.0.0/debian/patches/01_include_order.patch otb-4.2.0/debian/patches/01_include_order.patch --- otb-4.0.0/debian/patches/01_include_order.patch 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/debian/patches/01_include_order.patch 2014-09-19 09:46:58.000000000 +0000 @@ -0,0 +1,33 @@ +Description: fix wrong order of include directories when building an + external project using OTB +Author: Guillaume PASERO +Bug: http://bugs.orfeo-toolbox.org/view.php?id=973 + +--- a/CMake/UseOTB.cmake.in Mon Sep 15 14:37:09 2014 +0200 ++++ b/CMake/UseOTB.cmake.in Tue Sep 16 15:13:25 2014 +0200 +@@ -53,13 +53,22 @@ + NO_SYSTEM_PATH) + + if(OTB_USE_EXTERNAL_ITK) +- find_package(ITK REQUIRED) +- include(${ITK_USE_FILE}) ++ find_package(ITK REQUIRED) + else() + find_package(ITK REQUIRED + HINTS ${OTB_INSTALL_PREFIX} ${OTB_BINARY_DIRS}/../Utilities/ITK) +- include(${ITK_USE_FILE}) + endif() ++# Don't call ITK_USE_FILE to avoid BEFORE includes of source directories, only ++# perform needed action from the ITK_USE_FILE script. ITK source directories ++# should be already contained in OTB_INCLUDE_DIRS. ++# - Add compiler flags needed to use ITK. ++set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ITK_REQUIRED_C_FLAGS}") ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ITK_REQUIRED_CXX_FLAGS}") ++set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}") ++set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}") ++set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${ITK_REQUIRED_LINK_FLAGS}") ++# - Add link directories needed to use ITK. ++link_directories(${ITK_LIBRARY_DIRS}) + + if(ITK_USE_FFTWF OR ITK_USE_FFTWD) + find_package(FFTW REQUIRED) diff -Nru otb-4.0.0/debian/patches/series otb-4.2.0/debian/patches/series --- otb-4.0.0/debian/patches/series 2012-03-23 21:15:49.000000000 +0000 +++ otb-4.2.0/debian/patches/series 2014-09-19 09:47:36.000000000 +0000 @@ -0,0 +1,2 @@ +01_include_order.patch + diff -Nru otb-4.0.0/debian/rules otb-4.2.0/debian/rules --- otb-4.0.0/debian/rules 2014-05-02 10:02:56.000000000 +0000 +++ otb-4.2.0/debian/rules 2014-09-03 15:52:54.000000000 +0000 @@ -23,6 +23,14 @@ PKGVERSION=1 endif +ifeq ($(DIST),$(filter $(DIST), saucy trusty utopic)) + PYTHON_HELPER_PKG = dh-python + PYTHON_HELPER_VER = 1.20131003 +else + PYTHON_HELPER_PKG = python-central + PYTHON_HELPER_VER = 0.6.11 +endif + OTB_VERSION_MAJOR = $(shell sed -ne 's/set(OTB_VERSION_MAJOR "\([0-9]*\)")/\1/p' CMakeLists.txt) OTB_VERSION_MINOR = $(shell sed -ne 's/set(OTB_VERSION_MINOR "\([0-9]*\)")/\1/p' CMakeLists.txt) OTB_VERSION_PATCH = $(shell sed -ne 's/set(OTB_VERSION_PATCH "\([0-9]*\)")/\1/p' CMakeLists.txt) @@ -64,6 +72,8 @@ -e "s/@OTB_VERSION_PATCH@/$(OTB_VERSION_PATCH)/g" \ -e "s/@OTB_VERSION_SONAME@/$(OTB_VERSION_SONAME)/g" \ -e "s/@OTB_VERSION_FULL@/$(OTB_VERSION_FULL)/g" \ + -e "s/@PYTHON_HELPER_PKG@/$(PYTHON_HELPER_PKG)/g" \ + -e "s/@PYTHON_HELPER_VER@/$(PYTHON_HELPER_VER)/g" \ < debian/control.in > debian/control changelog-file: diff -Nru otb-4.0.0/Examples/BasicFilters/BandMathFilterExample.cxx otb-4.2.0/Examples/BasicFilters/BandMathFilterExample.cxx --- otb-4.0.0/Examples/BasicFilters/BandMathFilterExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/BasicFilters/BandMathFilterExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,6 @@ typedef otb::VectorImage InputImageType; typedef otb::Image OutputImageType; typedef otb::ImageList ImageListType; - typedef OutputImageType::PixelType VPixelType; typedef otb::VectorImageToImageListFilter VectorImageToImageListType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Examples/Classification/ClassificationMapRegularizationExample.cxx otb-4.2.0/Examples/Classification/ClassificationMapRegularizationExample.cxx --- otb-4.0.0/Examples/Classification/ClassificationMapRegularizationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Classification/ClassificationMapRegularizationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,7 @@ #include "itkTimeProbe.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { // Software Guide : BeginLatex // diff -Nru otb-4.0.0/Examples/Classification/KMeansImageClassificationExample.cxx otb-4.2.0/Examples/Classification/KMeansImageClassificationExample.cxx --- otb-4.0.0/Examples/Classification/KMeansImageClassificationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Classification/KMeansImageClassificationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Examples/Classification/ScalarImageKmeansModelEstimator.cxx otb-4.2.0/Examples/Classification/ScalarImageKmeansModelEstimator.cxx --- otb-4.0.0/Examples/Classification/ScalarImageKmeansModelEstimator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Classification/ScalarImageKmeansModelEstimator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,6 @@ adaptor->SetImage(reader->GetOutput()); // Define the Measurement vector type from the AdaptorType - typedef AdaptorType::MeasurementVectorType MeasurementVectorType; // Create the K-d tree structure typedef itk::Statistics::WeightedCentroidKdTreeGenerator< diff -Nru otb-4.0.0/Examples/Classification/SOMImageClassificationExample.cxx otb-4.2.0/Examples/Classification/SOMImageClassificationExample.cxx --- otb-4.0.0/Examples/Classification/SOMImageClassificationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Classification/SOMImageClassificationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * somfname = argv[2]; diff -Nru otb-4.0.0/Examples/Classification/SupervisedImageClassificationExample.cxx otb-4.2.0/Examples/Classification/SupervisedImageClassificationExample.cxx --- otb-4.0.0/Examples/Classification/SupervisedImageClassificationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Classification/SupervisedImageClassificationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * modelfname = argv[2]; diff -Nru otb-4.0.0/Examples/DataRepresentation/Image/ImageListExample.cxx otb-4.2.0/Examples/DataRepresentation/Image/ImageListExample.cxx --- otb-4.0.0/Examples/DataRepresentation/Image/ImageListExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DataRepresentation/Image/ImageListExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Examples/DimensionReduction/ICAExample.cxx otb-4.2.0/Examples/DimensionReduction/ICAExample.cxx --- otb-4.0.0/Examples/DimensionReduction/ICAExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DimensionReduction/ICAExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,7 +53,7 @@ // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx otb-4.2.0/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx --- otb-4.0.0/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DimensionReduction/MaximumAutocorrelationFactor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,7 @@ #include "otbMaximumAutocorrelationFactorImageFilter.h" // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { char * infname = argv[1]; char * outfname = argv[2]; diff -Nru otb-4.0.0/Examples/DimensionReduction/MNFExample.cxx otb-4.2.0/Examples/DimensionReduction/MNFExample.cxx --- otb-4.0.0/Examples/DimensionReduction/MNFExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DimensionReduction/MNFExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -65,7 +65,7 @@ // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Examples/DimensionReduction/NAPCAExample.cxx otb-4.2.0/Examples/DimensionReduction/NAPCAExample.cxx --- otb-4.0.0/Examples/DimensionReduction/NAPCAExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DimensionReduction/NAPCAExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -66,7 +66,7 @@ // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Examples/DimensionReduction/PCAExample.cxx otb-4.2.0/Examples/DimensionReduction/PCAExample.cxx --- otb-4.0.0/Examples/DimensionReduction/PCAExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DimensionReduction/PCAExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ #include "otbPCAImageFilter.h" // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx otb-4.2.0/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx --- otb-4.0.0/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DisparityMap/FineRegistrationImageFilterExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -73,8 +73,6 @@ typedef double PixelType; typedef itk::Vector DisplacementPixelType; - typedef double CoordinateRepresentationType; - typedef unsigned char OutputPixelType; typedef otb::Image OutputImageType; diff -Nru otb-4.0.0/Examples/DisparityMap/NCCRegistrationFilterExample.cxx otb-4.2.0/Examples/DisparityMap/NCCRegistrationFilterExample.cxx --- otb-4.0.0/Examples/DisparityMap/NCCRegistrationFilterExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DisparityMap/NCCRegistrationFilterExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,8 +67,6 @@ typedef double PixelType; typedef itk::Vector DisplacementPixelType; - typedef double CoordinateRepresentationType; - typedef unsigned char OutputPixelType; typedef otb::Image OutputImageType; diff -Nru otb-4.0.0/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx otb-4.2.0/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx --- otb-4.0.0/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DisparityMap/SimpleDisparityMapEstimationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -159,10 +159,6 @@ // Software Guide : EndCodeSnippet typedef PointSetType::PointType PointType; - typedef PointSetType::PointsContainer::Iterator PointSetIteratorType; - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointSetType::PointDataContainer::Iterator PointDataIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; // Software Guide : BeginLatex // diff -Nru otb-4.0.0/Examples/DisparityMap/StereoReconstructionExample.cxx otb-4.2.0/Examples/DisparityMap/StereoReconstructionExample.cxx --- otb-4.0.0/Examples/DisparityMap/StereoReconstructionExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/DisparityMap/StereoReconstructionExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -76,12 +76,6 @@ typedef otb::Image FloatImageType; typedef otb::VectorImage FloatVectorImageType; - typedef otb::ImageList ImageListType; - - typedef otb::ImageListToVectorImageFilter - ImageListToVectorImageFilterType; - typedef otb::ImageFileReader ImageReaderType; @@ -274,7 +268,7 @@ #else std::string leftExpr = "if(inleft != 0,255,0)"; #endif - + m_LBandMathFilter->SetExpression(leftExpr); BandMathFilterType::Pointer m_RBandMathFilter = BandMathFilterType::New(); diff -Nru otb-4.0.0/Examples/FeatureExtraction/ComplexMomentPathExample.cxx otb-4.2.0/Examples/FeatureExtraction/ComplexMomentPathExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/ComplexMomentPathExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/ComplexMomentPathExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,8 +56,6 @@ unsigned int P((unsigned char) ::atoi(argv[1])); unsigned int Q((unsigned char) ::atoi(argv[2])); - typedef unsigned char InputPixelType; - // Software Guide : BeginLatex // // The \doxygen{otb}{ComplexMomentPathFunction} is templated over the diff -Nru otb-4.0.0/Examples/FeatureExtraction/EdgeDensityExample.cxx otb-4.2.0/Examples/FeatureExtraction/EdgeDensityExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/EdgeDensityExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/EdgeDensityExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,7 @@ #include "otbBinaryImageDensityFunction.h" // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx otb-4.2.0/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/ExtractRoadByStepsExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ // 228 316 207 282 0.00005 1.0 // Software Guide : EndCommandLineArgs -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; @@ -82,7 +82,6 @@ typedef itk::CovariantVector VectorPixelType; typedef otb::Image InternalImageType; typedef otb::VectorImage MultiSpectralImageType; - typedef otb::Image OutputImageType; typedef otb::Image VectorImageType; typedef otb::PolyLineParametricPathWithValue PathType; @@ -384,12 +383,10 @@ // Software Guide : BeginCodeSnippet InternalImageType::Pointer output = InternalImageType::New(); - output->SetRegions(multispectralReader->GetOutput() - ->GetLargestPossibleRegion()); + output->CopyInformation(multispectralReader->GetOutput()); + output->SetRegions(output->GetLargestPossibleRegion()); output->Allocate(); output->FillBuffer(0.0); - output->SetOrigin(multispectralReader->GetOutput()->GetOrigin()); - output->SetSpacing(multispectralReader->GetOutput()->GetSpacing()); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff -Nru otb-4.0.0/Examples/FeatureExtraction/ExtractRoadExample.cxx otb-4.2.0/Examples/FeatureExtraction/ExtractRoadExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/ExtractRoadExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/ExtractRoadExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -64,9 +64,9 @@ std::cerr << " inputFileName outputFileName firstPixelComponent secondPixelComponent "; std::cerr << - "thirdPixelComponent fourthPixelComponent amplitudeThrehsold tolerance "; + "thirdPixelComponent fourthPixelComponent alpha amplitudeThrehsold tolerance "; std::cerr << - "angularThreshold firstMeanDistanceThreshold secondMeanDistanceThreshold "; + "angularThreshold-maxAngle firstMeanDistanceThreshold secondMeanDistanceThreshold "; std::cerr << "distanceThreshold" << std::endl; return EXIT_FAILURE; } @@ -286,7 +286,8 @@ // Software Guide : BeginCodeSnippet reader->GenerateOutputInformation(); InputImageType::Pointer blackBackground = InputImageType::New(); - blackBackground->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); + blackBackground->CopyInformation(reader->GetOutput()); + blackBackground->SetRegions(blackBackground->GetLargestPossibleRegion()); blackBackground->Allocate(); blackBackground->FillBuffer(0); // Software Guide : EndCodeSnippet diff -Nru otb-4.0.0/Examples/FeatureExtraction/ExtractSegmentsByStepsExample.cxx otb-4.2.0/Examples/FeatureExtraction/ExtractSegmentsByStepsExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/ExtractSegmentsByStepsExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/ExtractSegmentsByStepsExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -88,8 +88,6 @@ typedef otb::Image OutputImageType; // Software Guide : EndCodeSnippet - typedef otb::LineSpatialObjectList LinesListType; - // Software Guide : BeginLatex // // The filter can be instantiated using the image types defined above. diff -Nru otb-4.0.0/Examples/FeatureExtraction/LocalHoughExample.cxx otb-4.2.0/Examples/FeatureExtraction/LocalHoughExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/LocalHoughExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/LocalHoughExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -78,8 +78,6 @@ typedef otb::Image OutputImageType; // Software Guide : EndCodeSnippet - typedef otb::LineSpatialObjectList LinesListType; - // Software Guide : BeginLatex // // The filter can be instantiated using the image types defined above. diff -Nru otb-4.0.0/Examples/FeatureExtraction/SeamCarvingExample.cxx otb-4.2.0/Examples/FeatureExtraction/SeamCarvingExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/SeamCarvingExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/SeamCarvingExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ #include "itkImageDuplicator.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { typedef float InputPixelType; diff -Nru otb-4.0.0/Examples/FeatureExtraction/SeamCarvingOtherExample.cxx otb-4.2.0/Examples/FeatureExtraction/SeamCarvingOtherExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/SeamCarvingOtherExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/SeamCarvingOtherExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,7 +50,7 @@ #include "itkImageDuplicator.h" #include "otbObjectList.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { typedef float InputPixelType; diff -Nru otb-4.0.0/Examples/FeatureExtraction/SFSExample.cxx otb-4.2.0/Examples/FeatureExtraction/SFSExample.cxx --- otb-4.0.0/Examples/FeatureExtraction/SFSExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/FeatureExtraction/SFSExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ #include "otbSFSTexturesImageFilter.h" // Software Guide : EndCodeSnippet -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Examples/Filtering/GeometriesChangeSpatialReference.cxx otb-4.2.0/Examples/Filtering/GeometriesChangeSpatialReference.cxx --- otb-4.0.0/Examples/Filtering/GeometriesChangeSpatialReference.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Filtering/GeometriesChangeSpatialReference.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -51,25 +51,15 @@ typedef OGRGeometry TransformedElementType; otb::ogr::UniqueGeometryPtr operator()(OGRGeometry const* in) const; - void SetSpatialReferenceFromWkt(std::string const& wkt) - { - m_osr .reset (static_cast(OSRNewSpatialReference(wkt.c_str()))); - } - //TODO: find a way to call it from DoProcessLayer - void UpdateTransformation(OGRSpatialReference & in) - { - SetSpatialReferences(in, *m_osr); - } -private: - void SetSpatialReferences(OGRSpatialReference & in, OGRSpatialReference & out) + void SetTransformation(OGRSpatialReference & in, OGRSpatialReference & out) { m_reprojector.reset(OGRCreateCoordinateTransformation(&in, &out)); } + +private: boost::interprocess::unique_ptr m_reprojector; - boost::interprocess::unique_ptr m_osr; }; - otb::ogr::UniqueGeometryPtr ReprojectTransformationFunctor::operator()(OGRGeometry const* in) const { @@ -77,7 +67,7 @@ if (out) { const OGRErr err = out->transform(m_reprojector.get()); - if (!err != OGRERR_NONE) + if (err != OGRERR_NONE) { itkGenericExceptionMacro(<< "Cannot reproject a geometry: " << CPLGetLastErrorMsg()); } @@ -86,9 +76,72 @@ } /*===========================================================================*/ +/*==========================[ reprojection filter ]==========================*/ +/*===========================================================================*/ +class MyReprojectionFilter : public otb::DefaultGeometriesToGeometriesFilter +{ +public: + typedef MyReprojectionFilter Self; + typedef otb::DefaultGeometriesToGeometriesFilter Superclass; + typedef itk::SmartPointer Pointer; + typedef itk::SmartPointer ConstPointer; + + itkNewMacro(Self); + itkTypeMacro(MyReprojectionFilter, otb::DefaultGeometriesToGeometriesFilter); + + void SetOutputSpatialReference(std::string const& srs); + + void UpdateTransformation(OGRSpatialReference &in) + { + (*this)->SetTransformation(in, *m_osr); + } + +protected: + /** Default constructor. */ + MyReprojectionFilter(){ } + /** Destructor. */ + virtual ~MyReprojectionFilter(){ } + +private: + + virtual OGRSpatialReference* DoDefineNewLayerSpatialReference(otb::ogr::Layer const& itkNotUsed(source)) const + { + return m_osr.get(); + } + + boost::interprocess::unique_ptr m_osr; +}; + + +void +MyReprojectionFilter::SetOutputSpatialReference(std::string const& srs) +{ + OGRSpatialReference outSrs; + + char *name = const_cast(srs.c_str()); + + OGRErr ret = outSrs.importFromWkt(&name); + if (ret) + { + ret = outSrs.importFromProj4(name); + } + if (ret) + { + ret = outSrs.importFromEPSG(atoi(name)); + } + + if (ret) + { + std::cout << "Error : spatial reference system not recognized ("< FilterType; +typedef MyReprojectionFilter FilterType; struct Options { @@ -97,13 +150,16 @@ workingInplace = true; outputIsStdout = false; - std::string inputFile = argv[1]; - std::string outputFile = workingInplace ? argv[1] : argv[2]; - for (int a=1; a!=argc; ++a) { - if (!strcmp(argv[a], "-wkt")) - wkt = argv[a]; + if (!strcmp(argv[a], "-srs")) + { + if (a+1 < argc) + { + ++a; + srs = argv[a]; + } + } else if (!strcmp(argv[a], "-")) outputIsStdout = true; else if (inputFile.empty()) @@ -119,16 +175,16 @@ if (!outputFile.empty() && outputIsStdout) throw std::runtime_error(usage(argv[0])+"An output file ("+outputFile+") has already been set, cannot dump to stdout"); - if (inputFile.empty()) + if (inputFile.empty() || srs.empty()) throw std::runtime_error(usage(argv[0])+"Not enough parameters"); } static std::string usage(std::string const& progname) { - return progname + " [] -wkt \n"; + return progname + " [] -srs \n"; } std::string inputFile; std::string outputFile; - std::string wkt; + std::string srs; bool workingInplace; bool outputIsStdout; }; @@ -150,7 +206,7 @@ otb::ogr::DataSource::Pointer output = options.workingInplace ? input : options.outputIsStdout ? 0 - : otb::ogr::DataSource::New( options.outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly); + : otb::ogr::DataSource::New( options.outputFile, otb::ogr::DataSource::Modes::Update_LayerCreateOnly); std::cout << "input: " << input -> ogr().GetName() << " should be: " << options.inputFile << "\n"; if (output) { @@ -160,7 +216,8 @@ FilterType::Pointer filter = FilterType::New(); // TODO: this make no sense for in-place transformations - (*filter)->SetSpatialReferenceFromWkt(options.wkt); + filter->SetOutputSpatialReference(options.srs); + filter->UpdateTransformation( *(const_cast(input->GetLayer(0).GetSpatialRef())) ); if (!options.workingInplace) { diff -Nru otb-4.0.0/Examples/Fusion/BayesianFusionImageFilter.cxx otb-4.2.0/Examples/Fusion/BayesianFusionImageFilter.cxx --- otb-4.0.0/Examples/Fusion/BayesianFusionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Fusion/BayesianFusionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -211,16 +211,11 @@ typedef otb::VectorRescaleIntensityImageFilter VectorRescalerBayesianType; - typedef otb::Image - PanchroOutputImageType; typedef otb::ImageToVectorImageCastFilter CasterType; typedef otb::MultiChannelExtractROI ChannelExtractorType; - typedef otb::ImageFileWriter - WriterType2; multiSpectReader->GenerateOutputInformation(); multiSpectInterpReader->GenerateOutputInformation(); diff -Nru otb-4.0.0/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx otb-4.2.0/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx --- otb-4.0.0/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Hyperspectral/HyperspectralUnmixingExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -60,8 +60,6 @@ const unsigned int Dimension = 2; typedef double PixelType; - typedef otb::VectorImage OutputPrettyImageType; - // Software Guide : BeginLatex // // We start by defining the types for the images and the reader and @@ -78,12 +76,8 @@ // Software Guide : EndCodeSnippet typedef otb::VectorRescaleIntensityImageFilter RescalerType; - typedef otb::StreamingStatisticsVectorImageFilter StreamingStatisticsVectorImageFilterType; typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; - typedef vnl_vector VectorType; - typedef vnl_matrix MatrixType; - // Software Guide : BeginLatex // // We instantiate now the image reader and we set the image file name. diff -Nru otb-4.0.0/Examples/IO/HDFReaderExample.cxx otb-4.2.0/Examples/IO/HDFReaderExample.cxx --- otb-4.0.0/Examples/IO/HDFReaderExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/IO/HDFReaderExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { // Software Guide : EndCodeSnippet diff -Nru otb-4.0.0/Examples/IO/MetadataExample.cxx otb-4.2.0/Examples/IO/MetadataExample.cxx --- otb-4.0.0/Examples/IO/MetadataExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/IO/MetadataExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ #include "otbImage.h" #include "otbImageFileReader.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line diff -Nru otb-4.0.0/Examples/IO/OGRWrappersExample.cxx otb-4.2.0/Examples/IO/OGRWrappersExample.cxx --- otb-4.0.0/Examples/IO/OGRWrappersExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/IO/OGRWrappersExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -265,7 +265,7 @@ OGRFeatureDefn /*const*/& defn, otb::ogr::Layer & destLayer) { AnyListFieldList_t fields; - for (size_t i=0, N=defn.GetFieldCount(); i!=N; ++i) + for (int i=0, N=defn.GetFieldCount(); i!=N; ++i) { const char* name = defn.GetFieldDefn(i)->GetNameRef(); OGRFieldType type = static_cast(-1); diff -Nru otb-4.0.0/Examples/IO/VectorDataIOExample.cxx otb-4.2.0/Examples/IO/VectorDataIOExample.cxx --- otb-4.0.0/Examples/IO/VectorDataIOExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/IO/VectorDataIOExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -122,11 +122,8 @@ // Software Guide : BeginCodeSnippet typedef otb::Polygon PolygonType; - typedef PolygonType::VertexListConstIteratorType PolygonIteratorType; typedef otb::ObjectList PolygonListType; - typedef PolygonListType::Iterator PolygonListIteratorType; - PolygonListType::Pointer polygonList = PolygonListType::New(); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff -Nru otb-4.0.0/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx otb-4.2.0/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx --- otb-4.0.0/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Iterators/ImageLinearIteratorWithIndex2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -89,7 +89,6 @@ typedef Image4DType::IndexType Index4DType; typedef Image4DType::SizeType Size4DType; - typedef Image4DType::RegionType Region4DType; typedef Image4DType::SpacingType Spacing4DType; typedef Image4DType::PointType Origin4DType; diff -Nru otb-4.0.0/Examples/Learning/SOMExample.cxx otb-4.2.0/Examples/Learning/SOMExample.cxx --- otb-4.0.0/Examples/Learning/SOMExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SOMExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -77,7 +77,7 @@ #include "otbImageFileWriter.h" #include "itkListSample.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx otb-4.2.0/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx --- otb-4.0.0/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SVMGenericKernelImageClassificationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -64,7 +64,6 @@ const char * outputFilename = argv[2]; typedef double PixelType; - typedef std::vector VectorType; typedef int LabelPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Examples/Learning/SVMImageClassificationExample.cxx otb-4.2.0/Examples/Learning/SVMImageClassificationExample.cxx --- otb-4.0.0/Examples/Learning/SVMImageClassificationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SVMImageClassificationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -82,7 +82,6 @@ // Software Guide : BeginCodeSnippet typedef double PixelType; - typedef std::vector VectorType; typedef int LabelPixelType; // Software Guide : EndCodeSnippet const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx otb-4.2.0/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx --- otb-4.0.0/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SVMImageEstimatorClassificationMultiExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -63,7 +63,7 @@ #include "otbImageFileReader.h" -int main(int argc, char *argv[]) +int main(int itkNotUsed(argc), char *argv[]) { const char* inputImageFileName = argv[1]; diff -Nru otb-4.0.0/Examples/Learning/SVMImageModelEstimatorExample.cxx otb-4.2.0/Examples/Learning/SVMImageModelEstimatorExample.cxx --- otb-4.0.0/Examples/Learning/SVMImageModelEstimatorExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SVMImageModelEstimatorExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,7 +53,7 @@ #include "otbImageFileReader.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { const char* inputImageFileName = argv[1]; diff -Nru otb-4.0.0/Examples/Learning/SVMPointSetClassificationExample.cxx otb-4.2.0/Examples/Learning/SVMPointSetClassificationExample.cxx --- otb-4.0.0/Examples/Learning/SVMPointSetClassificationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SVMPointSetClassificationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,7 @@ #include "otbSVMClassifier.h" // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { // Software Guide : BeginLatex // @@ -76,8 +76,6 @@ // Software Guide : BeginCodeSnippet typedef itk::PointSet MeasurePointSetType; - - typedef itk::PointSet LabelPointSetType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -91,10 +89,7 @@ // Software Guide : BeginCodeSnippet typedef MeasurePointSetType::PointType MeasurePointType; - typedef LabelPointSetType::PointType LabelPointType; - typedef MeasurePointSetType::PointsContainer MeasurePointsContainer; - typedef LabelPointSetType::PointsContainer LabelPointsContainer; MeasurePointSetType::Pointer tPSet = MeasurePointSetType::New(); MeasurePointsContainer::Pointer tCont = MeasurePointsContainer::New(); diff -Nru otb-4.0.0/Examples/Learning/SVMPointSetExample.cxx otb-4.2.0/Examples/Learning/SVMPointSetExample.cxx --- otb-4.0.0/Examples/Learning/SVMPointSetExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SVMPointSetExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "itkListSample.h" #include "otbSVMClassifier.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef float InputPixelType; diff -Nru otb-4.0.0/Examples/Learning/SVMPointSetModelEstimatorExample.cxx otb-4.2.0/Examples/Learning/SVMPointSetModelEstimatorExample.cxx --- otb-4.0.0/Examples/Learning/SVMPointSetModelEstimatorExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/SVMPointSetModelEstimatorExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ #include "otbSVMPointSetModelEstimator.h" // Software Guide : EndCodeSnippet -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { // Software Guide : BeginLatex diff -Nru otb-4.0.0/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx otb-4.2.0/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx --- otb-4.0.0/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/TrainMachineLearningModelFromImagesExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ //#include "otbShiftScaleSampleListFilter.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingShpFileName = argv[2]; @@ -60,13 +60,8 @@ typedef unsigned int InputPixelType; const unsigned int Dimension = 2; - - typedef otb::VectorImage InputImageType; - typedef otb::Image ImageType; - typedef otb::VectorData VectorDataType; - typedef otb::ImageFileReader InputReaderType; typedef otb::VectorDataFileReader VectorDataReaderType; @@ -189,4 +184,3 @@ // Software Guide : EndLatex } - diff -Nru otb-4.0.0/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx otb-4.2.0/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx --- otb-4.0.0/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Learning/TrainMachineLearningModelFromSamplesExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,7 @@ int nbClasses = 4; // Software Guide : EndCodeSnippet - unsigned int inputSeed = 121212; +// unsigned int inputSeed = 121212; const char* outputModelFileName = argv[1]; //argv[5]; @@ -180,4 +180,3 @@ // Software Guide : EndCodeSnippet } - diff -Nru otb-4.0.0/Examples/MultiScale/MorphologicalPyramidSegmentationExample.cxx otb-4.2.0/Examples/MultiScale/MorphologicalPyramidSegmentationExample.cxx --- otb-4.0.0/Examples/MultiScale/MorphologicalPyramidSegmentationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/MultiScale/MorphologicalPyramidSegmentationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ #include "otbImage.h" #include "itkMacro.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; diff -Nru otb-4.0.0/Examples/MultiScale/MorphologicalPyramidSegmenterExample.cxx otb-4.2.0/Examples/MultiScale/MorphologicalPyramidSegmenterExample.cxx --- otb-4.0.0/Examples/MultiScale/MorphologicalPyramidSegmenterExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/MultiScale/MorphologicalPyramidSegmenterExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ #include "itkUnaryFunctorImageFilter.h" #include "itkScalarToRGBPixelFunctor.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; diff -Nru otb-4.0.0/Examples/OBIA/KeepNObjects.cxx otb-4.2.0/Examples/OBIA/KeepNObjects.cxx --- otb-4.0.0/Examples/OBIA/KeepNObjects.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/OBIA/KeepNObjects.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -71,8 +71,6 @@ typedef itk::StatisticsLabelMapFilter LabelObjectValuatorType; - typedef LabelObjectType::AttributeType - AttributeType; typedef itk::StatisticsKeepNObjectsLabelMapFilter KeepNObjectsType; typedef itk::LabelMapToLabelImageFilter LabelMapFilterType; - typedef otb::Polygon - PolygonType; - typedef otb::Functor::LabelObjectToPolygonFunctor FunctorType; - // Software Guide : EndCodeSnippet - typedef VectorDataType::DataNodeType DataNodeType; - - typedef otb::VectorDataProjectionFilter VectorDataFilterType; + // Software Guide : EndCodeSnippet LabeledReaderType::Pointer lreader = LabeledReaderType::New(); WriterType::Pointer writer = WriterType::New(); diff -Nru otb-4.0.0/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx otb-4.2.0/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx --- otb-4.0.0/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/OBIA/RadiometricAttributesLabelMapFilterExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -114,9 +114,6 @@ typedef otb::ShapeAttributesLabelMapFilter ShapeLabelMapFilterType; typedef otb::BandsStatisticsAttributesLabelMapFilter - StatisticsLabelMapFilterType; - typedef otb::BandsStatisticsAttributesLabelMapFilter RadiometricLabelMapFilterType; typedef otb::AttributesMapOpeningLabelMapFilter diff -Nru otb-4.0.0/Examples/Patented/EstimateAffineTransformationExample.cxx otb-4.2.0/Examples/Patented/EstimateAffineTransformationExample.cxx --- otb-4.0.0/Examples/Patented/EstimateAffineTransformationExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Patented/EstimateAffineTransformationExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -137,14 +137,11 @@ // Software Guide : BeginCodeSnippet typedef PointSetType::PointType PointType; typedef std::pair MatchType; - typedef std::vector MatchVectorType; typedef EuclideanDistanceMetricMatchingFilterType::LandmarkListType LandmarkListType; typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; typedef PointSetType::PointDataContainer PointDataContainerType; - typedef PointDataContainerType::Iterator PointDataIteratorType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff -Nru otb-4.0.0/Examples/Patented/SIFTDensityExample.cxx otb-4.2.0/Examples/Patented/SIFTDensityExample.cxx --- otb-4.0.0/Examples/Patented/SIFTDensityExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Patented/SIFTDensityExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ // Software Guide : EndCodeSnippet #include "otbImageToSIFTKeyPointSetFilter.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Examples/Patented/SIFTDisparityMapEstimation.cxx otb-4.2.0/Examples/Patented/SIFTDisparityMapEstimation.cxx --- otb-4.0.0/Examples/Patented/SIFTDisparityMapEstimation.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Patented/SIFTDisparityMapEstimation.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -127,11 +127,6 @@ typedef std::vector MatchVectorType; typedef EuclideanDistanceMetricMatchingFilterType::LandmarkListType LandmarkListType; - - typedef PointSetType::PointsContainer PointsContainerType; - typedef PointsContainerType::Iterator PointsIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; - typedef PointDataContainerType::Iterator PointDataIteratorType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex @@ -318,8 +313,6 @@ // // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef DisplacementSourceType::LandmarkContainerPointer - LandmarkContainerPointer; typedef DisplacementSourceType::LandmarkContainer LandmarkContainerType; typedef DisplacementSourceType::LandmarkPointType LandmarkPointType; diff -Nru otb-4.0.0/Examples/Patented/SIFTExample.cxx otb-4.2.0/Examples/Patented/SIFTExample.cxx --- otb-4.0.0/Examples/Patented/SIFTExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Patented/SIFTExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -120,8 +120,6 @@ // Software Guide : BeginCodeSnippet typedef PointSetType::PointsContainer PointsContainerType; typedef PointsContainerType::Iterator PointsIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; - typedef PointDataContainerType::Iterator PointDataIteratorType; // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff -Nru otb-4.0.0/Examples/Projections/EstimateRPCSensorModelExample.cxx otb-4.2.0/Examples/Projections/EstimateRPCSensorModelExample.cxx --- otb-4.0.0/Examples/Projections/EstimateRPCSensorModelExample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Projections/EstimateRPCSensorModelExample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -134,9 +134,9 @@ // Software Guide : BeginLatex // Note that the \doxygen{otb}{GCPsToRPCSensorModelImageFilter} needs - // at least 16 GCPs to estimate a proper RPC sensor model, + // at least 20 GCPs to estimate a proper RPC sensor model, // although no warning will be reported to the user if - // the number of GCPs is lower than 16. + // the number of GCPs is lower than 20. // Actual estimation of the sensor model takes place in the // \code{GenerateOutputInformation()} method. // Software Guide : EndLatex diff -Nru otb-4.0.0/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx otb-4.2.0/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx --- otb-4.0.0/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Radiometry/AtmosphericCorrectionSequencement.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,17 @@ // \end{itemize} // // The manipulation of each class used for the different steps and the -// link with the 6S radiometry library will be explained. +// link with the 6S radiometry library will be explained. In particular, +// the API modifications that have been made in version 4.2 will be +// detailed. There was several reasons behind these modifications : +// \begin{itemize} +// \item fix design issues in the framework that were causing trouble +// when setting the atmospheric parameters +// \item allow the computation of the radiative terms by other libraries +// than 6S (such as SMAC method). +// \item allow the users of the OpticalCalibration application to set +// and override each correction parameter. +// \end{itemize} // // Let's look at the minimal code required to use this // algorithm. First, the following header defining the @@ -58,21 +68,40 @@ #include "otbImageToLuminanceImageFilter.h" #include "otbLuminanceToReflectanceImageFilter.h" #include "otbReflectanceToSurfaceReflectanceImageFilter.h" -#include "otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h" +#include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" // Software Guide : EndCodeSnippet // Software Guide : BeginLatex +// In version 4.2, the class \code{SurfaceAdjacencyEffect6SCorrectionSchemeFilter} +// has been renamed into \doxygen{otb}{SurfaceAdjacencyEffectCorrectionSchemeFilter}, +// but it still does the same thing. +// // This chain uses the 6S radiative -// transfer code to compute radiometric parameters. To manipulate 6S -// data, three classes are needed (the first one to store the metadata, -// the second one that calls 6S class and generates the information -// which will be stored in the last one). +// transfer code to compute radiative terms (for instance upward and +// downward transmittance). The inputs needed are separated into +// two categories : +// \begin{itemize} +// \item The atmospheric correction parameters : physical parameters of the +// atmosphere when the image was taken (for instance : atmospheric pressure, +// water vapour amount, aerosol data, ...). They are stored in the class +// \footnote{Before version 4.2, this class was storing all correction +// parameters} \doxygen{otb}{AtmosphericCorrectionParameters}. +// \item The acquisition correction parameters : sensor related information +// about the way the image was taken, usualy available with the image +// metadata (for instance : solar angles, spectral +// sensitivity, ...). They are stored in the class +// \doxygen{otb}{ImageMetadataCorrectionParameters}. +// \end{itemize} +// +// The class \doxygen{otb}{RadiometryCorrectionParametersToAtmisphericRadiativeTerms} +// computes the radiative terms using these two types of parameters. It +// contains a single static method that calls the 6S library. The header +// also includes the classes to manipulate correction parameters and radiative +// terms. // Software Guide : EndLatex // Software Guide : BeginCodeSnippet -#include "otbAtmosphericCorrectionParameters.h" -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" -#include "otbAtmosphericRadiativeTerms.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" // Software Guide : EndCodeSnippet #include "otbVectorImage.h" @@ -220,7 +249,7 @@ // $d_{0}$ from the Earth; // \item $d/d_{0}$ is the ratio between the Earth-Sun distance at // the acquisition date and the mean Earth-Sun distance. The ratio can be directly - // given to the class or computed using a 6S routine. + // given to the class or computed using a 6S routine. TODO // In the last case (that is the one of this example), the user has to precise // the month and the day of the acquisition. // \end{itemize} @@ -266,29 +295,35 @@ //------------------------------- // Software Guide : BeginLatex // -// At this step of the chain, radiometric informations are nedeed. Those informations -// will be computed from different parameters stored in a -// \doxygen{otb}{AtmosphericCorrectionParameters} class intance. -// This {\em container} will be given to an -// \doxygen{otb}{AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms} -// class instance which will call a 6S routine that will compute the needed +// At this step of the chain, radiative information are nedeed to compute +// the contribution of the atmosphere (such as atmosphere transmittance +// and reflectance). Those information will be computed from different +// correction parameters stored in \doxygen{otb}{AtmosphericCorrectionParameters} +// and \doxygen{otb}{ImageMetadataCorrectionParameters} instances. +// These {\em containers} will be given to the static function \texttt{Compute} +// from \doxygen{otb}{RadiometryCorrectionParametersToAtmosphericRadiativeTerms} +// class, which will call a 6S routine that will compute the needed // radiometric informations and store them in a // \doxygen{otb}{AtmosphericRadiativeTerms} class instance. // For this, -// \doxygen{otb}{AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms} -// \doxygen{otb}{AtmosphericCorrectionParameters} and +// \doxygen{otb}{RadiometryCorrectionParametersToAtmosphericRadiativeTerms}, +// \doxygen{otb}{AtmosphericCorrectionParameters}, +// \doxygen{otb}{ImageMetadataCorrectionParameters} and // \doxygen{otb}{AtmosphericRadiativeTerms} // types are defined and instancied. // // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms - AtmosphericCorrectionParametersTo6SRadiativeTermsType; + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms + RadiometryCorrectionParametersToRadiativeTermsType; typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; + typedef otb::ImageMetadataCorrectionParameters + AcquisitionCorrectionParametersType; + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; // Software Guide : EndCodeSnippet @@ -302,6 +337,9 @@ AtmosphericCorrectionParametersType::Pointer dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); + AcquisitionCorrectionParametersType::Pointer + dataAcquisitionCorrectionParameters = + AcquisitionCorrectionParametersType::New(); AtmosphericRadiativeTermsType::Pointer dataAtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); @@ -336,7 +374,7 @@ functionValues->SetMinSpectralValue(minSpectralValue); functionValues->SetMaxSpectralValue(maxSpectralValue); functionValues->SetUserStep(userStep); - dataAtmosphericCorrectionParameters->SetWavelengthSpectralBandWithIndex( + dataAcquisitionCorrectionParameters->SetWavelengthSpectralBandWithIndex( i, functionValues); } @@ -345,47 +383,64 @@ // Software Guide : BeginLatex // - // The \doxygen{otb}{AtmosphericCorrectionParameters} class needs several parameters : - // \begin{itemize} + // The \doxygen{otb}{ImageMetadataCorrectionParameters} class stores + // several parameters that are generaly present in the image metadata : + // \begin{itemize} // \item The zenithal and azimutal solar angles that describe the solar incidence // configuration (in degrees); // \item The zenithal and azimuthal viewing angles that describe the viewing // direction (in degrees); // \item The month and the day of the acquisition; - // \item The atmospheric pressure; - // \item The water vapor amount, that is, the total water vapor content over vertical - // atmospheric column; - // \item The ozone amount that is the Stratospheric ozone layer content; - // \item The aerosol model that is the kind of particles (no aerosol, continental, - // maritime, urban, desertic); - // \item The aerosol optical thickness at 550 nm that is the is the Radiative impact - // of aerosol for the reference wavelength 550 nm; // \item The filter function that is the values of the filter function for one // spectral band, from $\lambda_{inf}$ to $\lambda_{sup}$ by step of 2.5 nm. // One filter function by channel is required. // This last parameter are read in text files, the other one are directly given to the class. // \end{itemize} // + // When this container is not set in the ReflectanceToSurfaceReflectance + // filter, it is automatically filled using the image metadata. The + // following lines show that it is also possible to set the values manually. + // // Software Guide : EndLatex // Set parameters // Software Guide : BeginCodeSnippet - dataAtmosphericCorrectionParameters->SetSolarZenithalAngle( + dataAcquisitionCorrectionParameters->SetSolarZenithalAngle( static_cast(atof(argv[6]))); - dataAtmosphericCorrectionParameters->SetSolarAzimutalAngle( + dataAcquisitionCorrectionParameters->SetSolarAzimutalAngle( static_cast(atof(argv[9]))); - dataAtmosphericCorrectionParameters->SetViewingZenithalAngle( + dataAcquisitionCorrectionParameters->SetViewingZenithalAngle( static_cast(atof(argv[10]))); - dataAtmosphericCorrectionParameters->SetViewingAzimutalAngle( + dataAcquisitionCorrectionParameters->SetViewingAzimutalAngle( static_cast(atof(argv[11]))); - dataAtmosphericCorrectionParameters->SetMonth(atoi(argv[8])); + dataAcquisitionCorrectionParameters->SetMonth(atoi(argv[8])); + + dataAcquisitionCorrectionParameters->SetDay(atoi(argv[7])); + // Software Guide : EndCodeSnippet - dataAtmosphericCorrectionParameters->SetDay(atoi(argv[7])); + // Software Guide : BeginLatex + // + // The \doxygen{otb}{AtmosphericCorrectionParameters} class stores + // physical parameters of the atmosphere that are not impacted + // by the viewing angles of the image : + // \begin{itemize} + // \item The atmospheric pressure; + // \item The water vapor amount, that is, the total water vapor content over vertical + // atmospheric column; + // \item The ozone amount that is the Stratospheric ozone layer content; + // \item The aerosol model that is the kind of particles (no aerosol, continental, + // maritime, urban, desertic); + // \item The aerosol optical thickness at 550 nm that is the is the Radiative impact + // of aerosol for the reference wavelength 550 nm; + // \end{itemize} + // + // Software Guide : EndLatex + // Software Guide : BeginCodeSnippet dataAtmosphericCorrectionParameters->SetAtmosphericPressure( static_cast(atof(argv[12]))); @@ -406,27 +461,26 @@ // Software Guide : BeginLatex // - // Once those parameters are loaded and stored in the AtmosphericCorrectionParameters - // instance class, it is given in input of an instance of - // AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms that will compute - // the needed radiometric informations. + // Once those parameters are loaded, they are used by the 6S library + // to compute the needed radiometric informations. The + // RadiometryCorrectionParametersToAtmosphericRadiativeTerms class + // provides a static function to perform this step\footnote{Before version + // 4.2, it was done with the filter + // AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms}. // // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - AtmosphericCorrectionParametersTo6SRadiativeTermsType::Pointer - filterAtmosphericCorrectionParametersTo6SRadiativeTerms = - AtmosphericCorrectionParametersTo6SRadiativeTermsType::New(); - - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->SetInput( - dataAtmosphericCorrectionParameters); - - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->Update(); + AtmosphericRadiativeTermsType::Pointer atmosphericRadiativeTerms = + RadiometryCorrectionParametersToRadiativeTermsType::Compute( + dataAtmosphericCorrectionParameters, + dataAcquisitionCorrectionParameters); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex // - // The output of this class will be an instance of the AtmosphericRadiativeTerms class. + // The output is stored inside an instance of the + // \doxygen{otb}{AtmosphericRadiativeTerms} class. // This class contains (for each channel of the image) // \begin{itemize} // \item The Intrinsic atmospheric reflectance that takes into account for the molecular scattering @@ -481,25 +535,24 @@ // \item $T(\mu_{S})$ is the downward transmittance; // \item $T(\mu_{V})$ is the upward transmittance. // \end{itemize} - // All those parameters are contained in the AtmosphericCorrectionParametersTo6SRadiativeTerms - // output. + // All those parameters are contained in the AtmosphericRadiativeTerms + // container. // Software Guide : EndLatex // Software Guide : BeginCodeSnippet filterReflectanceToSurfaceReflectanceImageFilter-> - SetAtmosphericRadiativeTerms( - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput()); + SetAtmosphericRadiativeTerms(atmosphericRadiativeTerms); // Software Guide : EndCodeSnippet //------------------------------- // Software Guide : BeginLatex // Next (and last step) is the neighborhood correction. -// For this, the SurfaceAdjacencyEffect6SCorrectionSchemeFilter class is used. +// For this, the SurfaceAdjacencyEffectCorrectionSchemeFilter class is used. // The previous surface reflectance inversion is performed under the assumption of a // homogeneous ground environment. The following step allows to correct the adjacency // effect on the radiometry of pixels. The method is based on the decomposition of -// the observed signal as the summation of the own contribution of the target pixel and -// of the contribution of neighbored pixels moderated by their distance to the target pixel. +// the observed signal as the summation of the own contribution of the target pixel and +// of the contributions of neighbored pixels moderated by their distance to the target pixel. // A simplified relation may be : // \begin{equation} // \rho{S} = \frac{ \rho_{S}^{unif}.T(\mu_{V}) - <\rho{S}>.t_{d}(\mu_{V}) }{ exp(-\delta/\mu_{V}) } @@ -525,37 +578,46 @@ // \end{itemize} // \end{itemize} // The neighborhood consideration window size is given by the window radius. -// An instance of \doxygen{otb}{SurfaceAdjacencyEffect6SCorrectionSchemeFilter} is created. +// +// An instance of \doxygen{otb}{SurfaceAdjacencyEffectCorrectionSchemeFilter} +// is created. This class has an interface quite similar to +// \doxygen{otb}{ReflectanceToSurfaceReflectance}. They both need radiative terms +// (\doxygen{otb}{AtmosphericRadiativeTerms}), so it is possible to compute +// them outside the filter and set them directly in the filter. The other +// solution is to give as input the two parameters containers ("atmospheric" +// and "acquisition" parameters), then the filter will compute the radiative +// terms internally. If the "acquisition" correction parameters are not +// present, the filter will try to get them from the image metadata. +// // Software Guide : EndLatex // Software Guide : BeginCodeSnippet - typedef otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType; - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::Pointer - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter - = SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::New(); + SurfaceAdjacencyEffectCorrectionSchemeFilterType; + SurfaceAdjacencyEffectCorrectionSchemeFilterType::Pointer + filterSurfaceAdjacencyEffectCorrectionSchemeFilter + = SurfaceAdjacencyEffectCorrectionSchemeFilterType::New(); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex // - // The needs four input informations: + // Four inputs are needed to compute the neighborhood contribution: // \begin{itemize} - // \item Radiometric informations (the output of the AtmosphericCorrectionParametersTo6SRadiativeTerms filter); + // \item The radiative terms (stored in the AtmosphericRadiativeTerms container); // \item The zenithal viewing angle; // \item The neighborhood window radius; // \item The pixel spacing in kilometers. // \end{itemize} // // Software Guide : EndLatex - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter-> - SetAtmosphericRadiativeTerms( - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput()); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetZenithalViewingAngle( - dataAtmosphericCorrectionParameters->GetViewingZenithalAngle()); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetWindowRadius(atoi(argv + filterSurfaceAdjacencyEffectCorrectionSchemeFilter-> + SetAtmosphericRadiativeTerms(atmosphericRadiativeTerms); + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetZenithalViewingAngle( + dataAcquisitionCorrectionParameters->GetViewingZenithalAngle()); + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetWindowRadius(atoi(argv [17])); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter-> + filterSurfaceAdjacencyEffectCorrectionSchemeFilter-> SetPixelSpacingInKilometers(static_cast(atof(argv[18]))); //------------------------------- @@ -563,8 +625,8 @@ // Software Guide : BeginLatex // // At this step, each filter of the chain is instancied and every one has its -// input paramters set. A name can be given to the output image and each filter -// can linked to other to create the final processing chain. +// input paramters set. A name can be given to the output image, each filter +// can be linked to the next one and create the final processing chain. // // Software Guide : EndLatex @@ -575,11 +637,11 @@ filterLuminanceToReflectance->SetInput(filterImageToLuminance->GetOutput()); filterReflectanceToSurfaceReflectanceImageFilter->SetInput( filterLuminanceToReflectance->GetOutput()); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetInput( + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetInput( filterReflectanceToSurfaceReflectanceImageFilter->GetOutput()); writer->SetInput( - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->GetOutput()); + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->GetOutput()); // Software Guide : EndCodeSnippet // Software Guide : BeginLatex diff -Nru otb-4.0.0/Examples/README.txt otb-4.2.0/Examples/README.txt --- otb-4.0.0/Examples/README.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/README.txt 2014-09-03 08:29:34.000000000 +0000 @@ -24,42 +24,6 @@ * Make sure that the code is well documented, of consistent style, and always up-to-date with the current OTB code. -The following is a list of subdirectories with a description of the code -found in them. - - * Installation - a very simple example to demonstrate compiling against - the OTB libraries and configuring CMake. - - * DataRepresentation - creating images and meshes; shows the basics of - creating and executing the pipeline - - * Iterators - iterating over images and meshes. - - * IO - the basics of reading/writing data. - - * Filtering - examples of image processing and mesh filters. - - * FeatureExtraction - examples of low-level information extraction. - - * ChangeDetection - detecting changes between pairs of images. - - * Learning - Support Vector Machine examples. - - * MultiScale - Multiscale examples. - - * Classification - simple examples of image classification. - - * Segmentation - a suite of basic segmentation examples. - - * Visu - simple examples for image visualization. - - * Fusion - Image fusion examples. - - - - - - To learn the software from these examples, you may wish to refer to the "ORFEO Toolbox Software Guide". diff -Nru otb-4.0.0/Examples/Segmentation/OtsuMultipleThresholdImageFilter.cxx otb-4.2.0/Examples/Segmentation/OtsuMultipleThresholdImageFilter.cxx --- otb-4.0.0/Examples/Segmentation/OtsuMultipleThresholdImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Segmentation/OtsuMultipleThresholdImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,7 @@ { std::cerr << "Usage: " << argv[0]; std::cerr << - " inputImageFile outputImageFileName1 [OutputImageFilename2 ...] "; + " inputImageFile outputImageFileName1 [OutputImageFilename2 ...] " << std::endl; return EXIT_FAILURE; } diff -Nru otb-4.0.0/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx otb-4.2.0/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx --- otb-4.0.0/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Simulation/LAIAndPROSAILToSensorResponse.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -109,8 +109,6 @@ ArrayType GetUniqueValues() const { - typedef typename ImageType::IndexType IndexType; - if( !m_Image ) { itkExceptionMacro(<<"GetUniqueValues(): Null input image pointer."); @@ -335,7 +333,9 @@ // Software Guide : BeginLatex // - // Satellite RSR is initialized and set with \code{aResponse}. + // Satellite RSR is initialized and set with \code{aResponse}. Reflectance + // mode is used in this case to take into account solar irradiance into + // spectral response reduction. // // Software Guide : EndLatex @@ -343,6 +343,9 @@ ReduceResponseTypePointerType reduceResponse = ReduceResponseType::New(); reduceResponse->SetInputSatRSR(m_SatRSR); reduceResponse->SetInputSpectralResponse(aResponse); + + reduceResponse->SetReflectanceMode(true); + reduceResponse->CalculateResponse(); VectorPairType reducedResponse = reduceResponse->GetReduceResponse()->GetResponse(); @@ -918,5 +921,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Examples/Tutorials/HelloWorldOTB.cxx otb-4.2.0/Examples/Tutorials/HelloWorldOTB.cxx --- otb-4.0.0/Examples/Tutorials/HelloWorldOTB.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Examples/Tutorials/HelloWorldOTB.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImage.h" #include -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Image ImageType; diff -Nru otb-4.0.0/.hg_archival.txt otb-4.2.0/.hg_archival.txt --- otb-4.0.0/.hg_archival.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/.hg_archival.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,4 @@ repo: aba0c56ceeda5161830c14bced82592ab71dfb9b -node: ca1f99db3ad5ca32e71f31b53c721ab9df7262cf +node: 7db1f09e3054e73c663802624b69a7564e1396b2 branch: default -latesttag: 4.0-rc1 -latesttagdistance: 1 +tag: 4.2.0 diff -Nru otb-4.0.0/.hgtags otb-4.2.0/.hgtags --- otb-4.0.0/.hgtags 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/.hgtags 2014-09-03 08:29:34.000000000 +0000 @@ -50,3 +50,5 @@ 02113d4594c59f9951635643416d0b232b8a5c6f 3.20-rc1 3e7a91d3fbe595170753ce018a193dd28aef26af 3.20.0 9cafe3e2dc540f6008f86da44e5e37d95318380f 4.0-rc1 +8c14c4efeaec0e37b0213b367c5a9997751e3e2a 4.0.0 +97b540d916d7961a9f62b1c8d0192ebb889ad675 4.2-rc1 diff -Nru otb-4.0.0/RELEASE_NOTES.txt otb-4.2.0/RELEASE_NOTES.txt --- otb-4.0.0/RELEASE_NOTES.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/RELEASE_NOTES.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,25 +1,114 @@ -OTB-v.4.0 - Changes since version 3.20 (2013/02/21) +OTB-v.4.2.0 - Changes since version 4.0 (2014/09/04) -------------------------------------------------------- * Library: * Core: - * Change OTB API to support ITK with version 4.5 (More information is available in the migration guide at http://wiki.orfeo-toolbox.org/index.php/Migration_guide_OTBv4) - * Refactoring otbAttributesMapOpeningLabelMapFilter to be compatible with ITKv4.5.0 - * Remove Visualization part from OTB: all these projects are now in Monteverdi + * Major compliance upgrade with index coordinates convention between OTB, + GDAL and OSSIM. OTB uses pixel centered convention, whereas GDAL and + OSSIM use corner pixel convention. More details on JIRA #647 and Mantis + #942 + * Major performance improvment of Haralick Texture computation (6 to 10 times + faster) + * Add new texture feature (dissimilarity) in ScalarImageToAdvancedTexturesFilter + * Improvments of Simulation code in order to be able to use the solar + irradiance information when working with spectral responses for simulations. + * Support Jpeg2000 images through GDAL drivers (can use OpenJpeg, Kakadu, ECW) + * Reading/Writing RPC coefficients in GeoTIFF tags + * Cleaning of ITK pending patches + * Update internal ITK to 4.6.0 + * Support SPOT6 metadata + * Integrate improvements from Monteverdi2 + * Support clang 3.5.1 + * Support MinGW compiler + * API change on the TOC calibration filters, previous classes were not + fully functional. Now supports any correction parameters set by user. + See Examples/Radiometry/AtmosphericCorrectionSequencement.cxx for + details on the migration. + * Better support of atmospheric corrections for Pleiades images. Proper + computation of satellite zenital angle using incidence angles and + satellite orientation angle convention + +* Applications: + * Updated applications : + * Superimpose and BundleToPerfectSensor : Add a specific reprojection mode for PHR bundle + * OpticalCalibration : parameters more flexible, allow users to overwrite metadata values + +* Bugs fixed: + +* Monteverdi2 + * 0000915: In mvd2 applications wrappers InputImageList parameters, only the first item of the list is dropable + * 0000960: Drop from file explorer doest not work. + * 0000928: Output results of applications are not selected in the dataset manager + * 0000908: Vector-image model settings serialization persistence (gamma) + * 0000919: Inconsistent no-data checks in StreamingVectorImageFilter<> and StreamingHistogramVectorImageFilter<>. + * 0000918: Image-view shift on click + * 0000907: Serialization/persistence of viewport settings + * 0000906: Quantiles editing on mono-bands images. + * 0000909: Color-setup on PANCHRO images. + * 0000905: Calculation of zoom-extent in Quicklook-view. + * 0000964: Wrong update of Gamme cursor position + * 0000929: Drag and Drop in otb application a dataset leads to the disappearance of the dataset into the widget + * 0000921: Application freezes at the end of image import. + * 0000947: Droping dataset to the last subgroup of the data tree crash the application + * 0000933: Drag a dataset from temporary in the dataset manager outside the tree leads to a crash + * 0000903: Removing mvd2 directory content leads to a core dumped as startup + * 0000920: Wide unzoom aborts application + * 0000917: Applying same quantiles to all channels crash the application + * 0000962: Monteverdi2 cannot be run on OSX (image file not found). + * 0000924: Monteverdi2 does not start after the check of OpenGL was added + * 0000923: Monteverdi2 does not start after the check of OpenGL was added + + * Documentation + * 0000948: Softwareguide OTB 4-0 : section 14.2.2 SIFT Detector (from chapter 14 Feature Extraction) is empty. + + * OTB-lib + * 0000955: Wrong computation of SFS Textures + * 0000940: Some output states are not correctly manage into Qt Application + * 0000939: crash with a GIF/BMP image with ColorInterp=Palette when we request overviews via GDAL + * 0000966: VectorDataExtractROIApplication does a strange reprojection + * 0000932: Error in LSMS + * 0000936: Sub-pixel disparity filter is not compatible with disparity maps over subsampled grids + * 0000914: MeanShiftSmoothing application foutpos parameters is always mandatory + * 0000943: TrainImagesClassifier and ListSampleGenerator problem + * 0000954: GeometriesChangeSpatialReference does not work + * 0000949: BundleToPerfectSensor application: in PHR mode, the ourpur geom file is the XS one, not the PAN one + * 0000926: OTB does not compile with clang 5.1 + * 0000968: CommandLineLauncher needs 2 passes to load parameters + * 0000951: BundleToPerfectSensor application does not work in default mode with external ITK (internal ITK is fine) + * 0000944: OTB does not compile with ITK4.6 git version + + * Monteverdi + * 0000957: Unable to display input and output of ExtractRoadExample in transparency mode in Monteverdi + + +OTB-v.4.0.0 - Changes since version 3.20 (2014/03/13) +-------------------------------------------------------- + +* Library: + + * Core: + * [Breaking change !] Change OTB implementation and API to support ITK version 4.5 + * More information at http://wiki.orfeo-toolbox.org/index.php/Migration_guide_OTBv4 + * Refactor otbAttributesMapOpeningLabelMapFilter to be compatible with ITK 4.5 + * Remove FLTK based Visualization part from OTB: all these projects are now in Monteverdi * Rename EuclideanDistance as EuclideanDistanceMetric * Remove otbMaskedScalarImageToGreyLevelCoocurenceMatrixGenerator * Use local masks in otbHaralickTexturesImageFunction * Remove methods of otbSystem.h which can be replaced by similar ones in itksys/SystemTools.hxx - * Move classes about Amplitude and Phase functors from visualzation to basic filter + * Move classes about Amplitude and Phase functors from visualization to basic filter * otbImageToLabelMapWithAttributesFilter inherits from itkImageToImageFilter instead of itkLabelMapFilter * Overload GenerateInputRequestedRegion in otbImageToLabelMapWithAttributesFilter * Override VerifyInputInformation in otbImportGeoInformationImageFilter * Adding a gamma parameter in VectorRescaleIntensityImageFilter to allow for gamma correction + * Clean up JoinHistogramMI code + * Fix race condition in BinaryFunctorNeighborhoodJoinHistogramImageFilter * Remove unused OTB_USE_SYSTEM_VXL and OTB_VXL_DIR from OTBConfig and UseOTB - * Improve support of VS2013 - * Improve support of large files - * Support of MacOSX 10.9 + * Improve detection of Large Files Support by not unconditionnally defining LFS related macros + * Support for Visual Studio 2012 + * Support for Visual Studio 2013 + * Support compilation in MacOSX 10.9 with latest XCode + * Support for clang 3.5 * Testing: * Correct multibaseline support @@ -41,8 +130,11 @@ * Applications: * Updated applications: - * Remove dependency of Colormapping to Visualization class - * Adding gamma correction method the convert application + * ColorMapping : Remove dependency of ColorMapping to Visualization class + * Convert : Adding gamma correction method the convert application + * HomologousPointsExtraction : add mode.geobins.binsizey and mode.geobins.binstepy to allow for anisotropic geobins mode + * HomologousPointsExtraction : new mode.geobins.margin parameter to only search inside image center. + * Core framework: * Improve the support of XML parameters input/output file * Improve the input VectorData/Image/Filename parameter to give access to m_Input attribute diff -Nru otb-4.0.0/Testing/Applications/Classification/CMakeLists.txt otb-4.2.0/Testing/Applications/Classification/CMakeLists.txt --- otb-4.0.0/Testing/Applications/Classification/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Applications/Classification/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -45,12 +45,12 @@ set(knn_output_format ".knn") # Training algorithms parameters - set(libsvm_parameters "-classifier.libsvm.opt true") - set(svm_parameters "-classifier.svm.opt true") + set(libsvm_parameters "-classifier.libsvm.opt" "true") + set(svm_parameters "-classifier.svm.opt" "true") set(boost_parameters "") set(dt_parameters "") set(gbt_parameters "") - set(ann_parameters "-classifier.ann.sizes 100") + set(ann_parameters "-classifier.ann.sizes" "100") set(bayes_parameters "") set(rf_parameters "") set(knn_parameters "") diff -Nru otb-4.0.0/Testing/Applications/DisparityMap/CMakeLists.txt otb-4.2.0/Testing/Applications/DisparityMap/CMakeLists.txt --- otb-4.0.0/Testing/Applications/DisparityMap/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Applications/DisparityMap/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -82,8 +82,8 @@ -bm.medianfilter.radius 2 -bm.medianfilter.incoherence 2.0 VALID --compare-image ${EPSILON_10} - ${INPUTDATA}/sensor_stereo_blockmatching_output.tif - ${TEMP}/apTvDmBlockMatchingTest.tif + ${BASELINE}/apTvDmBlockMatchingTest.tif + ${TEMP}/apTvDmBlockMatchingTest.tif ) diff -Nru otb-4.0.0/Testing/Applications/FeatureExtraction/CMakeLists.txt otb-4.2.0/Testing/Applications/FeatureExtraction/CMakeLists.txt --- otb-4.0.0/Testing/Applications/FeatureExtraction/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Applications/FeatureExtraction/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -131,6 +131,7 @@ -mode geobins -mode.geobins.binsize 100 -mode.geobins.binstep 25 + -mode.geobins.margin 12 -mfilter 1 -precision 10 -2wgs84 1 @@ -141,6 +142,28 @@ ${BASELINE_FILES}/apTvHomologousPointsExtractionGeoBins.txt ${TEMP}/apTvHomologousPointsExtractionGeoBins.txt) +OTB_TEST_APPLICATION(NAME apTvHomologousPointsExtractionGeoBinsAnisotropic + APP HomologousPointsExtraction + OPTIONS -in1 ${INPUTDATA}/QB_TOULOUSE_MUL_Extract_500_500.tif + -in2 ${INPUTDATA}/QB_TOULOUSE_MUL_Extract_500_500.tif + -algorithm surf + -mode geobins + -mode.geobins.binsize 100 + -mode.geobins.binsizey 150 + -mode.geobins.binstep 25 + -mode.geobins.binstepy 10 + -mode.geobins.margin 12 + -mfilter 1 + -precision 10 + -2wgs84 1 + -elev.dem ${INPUTDATA}/DEM/srtm_directory + -elev.geoid ${INPUTDATA}/DEM/egm96.grd + -out ${TEMP}/apTvHomologousPointsExtractionGeoBinsAnisotropic.txt + VALID --compare-ascii ${EPSILON_9} + ${BASELINE_FILES}/apTvHomologousPointsExtractionGeoBinsAnisotropic.txt + ${TEMP}/apTvHomologousPointsExtractionGeoBinsAnisotropic.txt) + + OTB_TEST_APPLICATION(NAME apTvFEDimensionalityReductionPCA APP DimensionalityReduction OPTIONS -in ${INPUTDATA}/cupriteSubHsi.tif diff -Nru otb-4.0.0/Testing/Applications/Projections/CMakeLists.txt otb-4.2.0/Testing/Applications/Projections/CMakeLists.txt --- otb-4.0.0/Testing/Applications/Projections/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Applications/Projections/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -239,7 +239,7 @@ -out.vd ${TEMP}/apTvPrVectorDataReprojectionFromMapToMap.kml -out.proj user -out.proj.user.map lambert93 - VALID --compare-ascii ${NOTOL} + VALID --compare-ogr ${NOTOL} ${BASELINE_FILES}/prTvVectorDataProjectionFilterFromMapToMap.kml ${TEMP}/apTvPrVectorDataReprojectionFromMapToMap.kml) @@ -284,7 +284,7 @@ OTB_TEST_APPLICATION(NAME apTvPrRefineSensorModel APP RefineSensorModel OPTIONS -ingeom ${INPUTDATA}/QB_TOULOUSE_MUL_Extract_500_500.geom - -inpoints ${BASELINE_FILES}/apTvHomologousPointsExtractionGeoBins.txt + -inpoints ${INPUTDATA}/QB_TOULOUSE_MUL_Extract_500_500_in_tie_points.txt -outgeom ${TEMP}/apTvPrRefineSensorModelGeomOutput.geom -outstat ${TEMP}/apTvPrRefineSensorModelStatsOutput.txt -outvector ${TEMP}/apTvPrRefineSensorModelVectorOutput.shp @@ -297,7 +297,7 @@ OTB_TEST_APPLICATION(NAME apTvPrGenerateRPCSensorModel APP GenerateRPCSensorModel - OPTIONS -inpoints ${BASELINE_FILES}/apTvHomologousPointsExtractionGeoBins.txt + OPTIONS -inpoints ${INPUTDATA}/QB_TOULOUSE_MUL_Extract_500_500_in_tie_points.txt -outgeom ${TEMP}/apTvPrGenerateRPCSensorModelGeomOutput.geom -outstat ${TEMP}/apTvPrGenerateRPCSensorModelStatsOutput.txt -outvector ${TEMP}/apTvPrGenerateRPCSensorModelVectorOutput.shp diff -Nru otb-4.0.0/Testing/Applications/Radiometry/CMakeLists.txt otb-4.2.0/Testing/Applications/Radiometry/CMakeLists.txt --- otb-4.0.0/Testing/Applications/Radiometry/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Applications/Radiometry/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,48 @@ +OTB_TEST_APPLICATION(NAME apTvRaOpticalCalibration_UnknownSensor + APP OpticalCalibration + OPTIONS + -in ${EXAMPLEDATA}/Romania_Extract.tif + -out ${TEMP}/apTvRaOpticalCalibration_Spot4_UnknownSensor_test.tif + -level toc + -acqui.gainbias ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorGainsBiases2.txt + -acqui.day 4 + -acqui.month 12 + -acqui.sun.elev 62.7 + -acqui.sun.azim 152.7 + -acqui.view.elev 87.5 + -acqui.view.azim -77.0 + -acqui.solarilluminations ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorSolarIllumations2.txt + -atmo.rsr ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorRSR.txt + -atmo.pressure 1013.0 + -atmo.wa 2.48134 + -atmo.oz 0.34400 + -atmo.aerosol continental + -atmo.opt 0.199854 + -atmo.radius 2 + -atmo.pixsize 0.02 + -milli false + -clamp false + VALID --compare-image ${EPSILON_6} + ${OTB_DATA_ROOT}/Baseline/Examples/Radiometry/Example_RomaniaAtmosphericCorrectionSequencement.tif + ${TEMP}/apTvRaOpticalCalibration_Spot4_UnknownSensor_test.tif ) + +OTB_TEST_APPLICATION(NAME apTvRaOpticalCalibration_Reverse_UnknownSensor + APP OpticalCalibration + OPTIONS + -in ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif + -out ${TEMP}/apTvRaOpticalCalibration_Rev_QB-XS_UnknownSensor_test.tif + -level toatoim + -acqui.gainbias ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorGainsBiases.txt + -acqui.day 1 + -acqui.month 4 + -acqui.sun.elev 48.6 + -acqui.solarilluminations ${INPUTDATA}/apTvRaOpticalCalibrationUnknownSensorSolarIllumations.txt + -milli false + -clamp false + VALID --compare-image ${EPSILON_6} + ${INPUTDATA}/QB_MUL_ROI_1000_100.tif + ${TEMP}/apTvRaOpticalCalibration_Rev_QB-XS_UnknownSensor_test.tif ) + OTB_TEST_APPLICATION(NAME apTvRaOpticalCalibration_QuickbirdPAN APP OpticalCalibration diff -Nru otb-4.0.0/Testing/Applications/Segmentation/CMakeLists.txt otb-4.2.0/Testing/Applications/Segmentation/CMakeLists.txt --- otb-4.0.0/Testing/Applications/Segmentation/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Applications/Segmentation/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -11,7 +11,7 @@ -foutpos ${TEMP}/apTvSeMeanShiftSmoothingFilter_SpatialOutput.tif -spatialr 4 -ranger 25 - -maxiter 100 + -maxiter 10 -thres 0.1 -modesearch 0) # VALID --compare-image ${EPSILON_7} @@ -60,17 +60,17 @@ #--- Segmentation ---# # Segmentation algorithms parameters -set(cc_parameters "-filter.cc.expr distance<25") -set(edison_parameters "-filter.edison.spatialr 5 -filter.edison.ranger 50 -filter.edison.minsize 10") -set(meanshift_parameters "-filter.meanshift.spatialr 5 -filter.meanshift.ranger 50 -filter.meanshift.minsize 10") -set(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ovw") +set(cc_parameters "-filter.cc.expr" "distance<25") +set(edison_parameters "-filter.edison.spatialr" "5" "-filter.edison.ranger" "50" "-filter.edison.minsize" "10") +set(meanshift_parameters "-filter.meanshift.spatialr" "5" "-filter.meanshift.ranger" "50" "-filter.meanshift.minsize" "10") +set(vector_parameters "-mode.vector.tilesize" "500" "-mode.vector.minsize" "50" "-mode.vector.simplify" "0.1" "-mode.vector.outmode" "ovw") # validation option set(meanshift_option "--without-threads") # Output type dependning on mode set(raster_output_format ".tif") -set(raster_output_option " uint16") +set(raster_output_option "uint16") set(vector_output_format ".sqlite") # Validation depending on mode @@ -98,7 +98,7 @@ -filter ${lfilter} ${${lfilter}_parameters} -mode ${lmode} - -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option} + -mode.${lmode}.out ${TEMP}/${OUTFILE} ${${lmode}_output_option} ${${lmode}_parameters} VALID ${${lfilter}_option} ${${lmode}_comparison} @@ -115,7 +115,7 @@ string(TOLOWER ${filter} lfilter) # Add a test for ULOVW -set(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ulovw") +set(vector_parameters "-mode.vector.tilesize" "500" "-mode.vector.minsize" "50" "-mode.vector.simplify" "0.1" "-mode.vector.outmode" "ulovw") set(OUTFILE apTvSeSegmentation${filter}${mode}${${lmode}_output_format}) @@ -125,7 +125,7 @@ -filter ${lfilter} ${${lfilter}_parameters} -mode ${lmode} - -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option} + -mode.${lmode}.out ${TEMP}/${OUTFILE} ${${lmode}_output_option} ${${lmode}_parameters} VALID ${${lfilter}_option} ${${lmode}_comparison} @@ -138,7 +138,7 @@ RESOURCE_LOCK ${OUTFILE}) # Add a test for ULU -set(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ulu") +set(vector_parameters "-mode.vector.tilesize" "500" "-mode.vector.minsize" "50" "-mode.vector.simplify" "0.1" "-mode.vector.outmode" "ulu") OTB_TEST_APPLICATION(NAME apTvSeSegmentation${filter}${mode}_ULU APP Segmentation @@ -146,7 +146,7 @@ -filter ${lfilter} ${${lfilter}_parameters} -mode ${lmode} - -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option} + -mode.${lmode}.out ${TEMP}/${OUTFILE} ${${lmode}_output_option} ${${lmode}_parameters} VALID ${${lfilter}_option} ${${lmode}_comparison} @@ -159,7 +159,7 @@ RESOURCE_LOCK ${OUTFILE}) # Add a test for ULCO -set(vector_parameters "-mode.vector.tilesize 500 -mode.vector.minsize 50 -mode.vector.simplify 0.1 -mode.vector.outmode ulco") +set(vector_parameters "-mode.vector.tilesize" "500" "-mode.vector.minsize" "50" "-mode.vector.simplify" "0.1" "-mode.vector.outmode" "ulco") OTB_TEST_APPLICATION(NAME apTvSeSegmentation${filter}${mode}_ULCO APP Segmentation @@ -167,7 +167,7 @@ -filter ${lfilter} ${${lfilter}_parameters} -mode ${lmode} - -mode.${lmode}.out ${TEMP}/${OUTFILE}${${lmode}_output_option} + -mode.${lmode}.out ${TEMP}/${OUTFILE} ${${lmode}_output_option} ${${lmode}_parameters} VALID ${${lfilter}_option} ${${lmode}_comparison} diff -Nru otb-4.0.0/Testing/Applications/Utils/CMakeLists.txt otb-4.2.0/Testing/Applications/Utils/CMakeLists.txt --- otb-4.0.0/Testing/Applications/Utils/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Applications/Utils/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -48,6 +48,14 @@ ${BASELINE_FILES}/apTvUtReadImageInfoTest.txt ${TEMP}/apTvUtReadImageInfoTest.txt) +OTB_TEST_APPLICATION(NAME apTvUtReadImageInfoRpcTag + APP ReadImageInfo + OPTIONS -in ${INPUTDATA}/QB_TOULOUSE_RpcTag_100_100.tif + -outkwl ${TEMP}/apTvUtReadImageInfoRpcTag.geom + VALID --compare-ascii ${EPSILON_7} + ${BASELINE_FILES}/apTvUtReadImageInfoRpcTag.geom + ${TEMP}/apTvUtReadImageInfoRpcTag.geom) + if(OTB_DATA_USE_LARGEINPUT) OTB_TEST_APPLICATION(NAME apTvUtReadImageInfoSpot5 @@ -229,9 +237,9 @@ ${OTBAPP_BASELINE_FILES}/utTvVectorDataTransformFilter_Translation_rotation.shp ${TEMP}/apTvUtVectorDataTransform_Translation_rotation.shp) -#--- VectorDataExtractROIApplication --- -OTB_TEST_APPLICATION(NAME apTvUtVectorDataExtractROIApplication - APP VectorDataExtractROIApplication +#--- VectorDataExtractROI --- +OTB_TEST_APPLICATION(NAME apTvUtVectorDataExtractROI + APP VectorDataExtractROI OPTIONS -io.in ${INPUTDATA}/QB_Toulouse_Ortho_XS.tif -io.vd ${OTB_DATA_LARGEINPUT_ROOT}/VECTOR/MidiPyrenees/roads.shp -io.out ${TEMP}/apTvUtVectorDataExtractROIApplicationTest.shp diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGeneratorTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGeneratorTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGeneratorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperApplicationHtmlDocGeneratorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbWrapperApplicationRegistry.h" #include "otbWrapperApplication.h" -int otbWrapperApplicationHtmlDocGeneratorNew(int argc, char* argv[]) +int otbWrapperApplicationHtmlDocGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::ApplicationHtmlDocGenerator DocGeneratorType; DocGeneratorType generator; @@ -31,7 +31,7 @@ return EXIT_SUCCESS; } -int otbWrapperApplicationHtmlDocGeneratorTest1(int argc, char* argv[]) +int otbWrapperApplicationHtmlDocGeneratorTest1(int argc, char * argv[]) { if (argc != 5) { diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperApplicationRegistryTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperApplicationRegistryTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperApplicationRegistryTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperApplicationRegistryTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperApplicationRegistry.h" -int otbWrapperApplicationRegistry(int argc, char* argv[]) +int otbWrapperApplicationRegistry(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { using otb::Wrapper::ApplicationRegistry; std::vector list = ApplicationRegistry::GetAvailableApplications(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperApplicationTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperApplicationTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperApplicationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperApplicationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,10 +21,9 @@ #include "otbWrapperApplication.h" -int otbWrapperApplicationNew(int argc, char* argv[]) +int otbWrapperApplicationNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { - typedef otb::Wrapper::Application ApplicationType; - //ApplicationType::Pointer application = ApplicationType::New(); - +// typedef otb::Wrapper::Application ApplicationType; +// ApplicationType application = ApplicationType::New(); return EXIT_SUCCESS; } diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperChoiceParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperChoiceParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperChoiceParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperChoiceParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperChoiceParameter.h" -int otbWrapperChoiceParameterNew(int argc, char* argv[]) +int otbWrapperChoiceParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::ChoiceParameter ChoiceParameterType; ChoiceParameterType::Pointer parameter = ChoiceParameterType::New(); @@ -29,7 +29,7 @@ return EXIT_SUCCESS; } -int otbWrapperChoiceParameterTest1(int argc, char* argv[]) +int otbWrapperChoiceParameterTest1(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { // TODO return EXIT_FAILURE; diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperDocExampleStructureTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperDocExampleStructureTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperDocExampleStructureTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperDocExampleStructureTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itksys/SystemTools.hxx" #include -int otbWrapperDocExampleStructureNew(int argc, char* argv[]) +int otbWrapperDocExampleStructureNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::DocExampleStructure DocExampleStructureType; DocExampleStructureType::Pointer docStruct = DocExampleStructureType::New(); @@ -32,7 +32,7 @@ } -int otbWrapperDocExampleStructureTest(int argc, char* argv[]) +int otbWrapperDocExampleStructureTest(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::DocExampleStructure DocExampleStructureType; DocExampleStructureType::Pointer docStruct = DocExampleStructureType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperEmptyParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperEmptyParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperEmptyParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperEmptyParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperEmptyParameter.h" -int otbWrapperEmptyParameterNew(int argc, char* argv[]) +int otbWrapperEmptyParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::EmptyParameter EmptyParameterType; EmptyParameterType::Pointer parameter = EmptyParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputImageListParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputImageListParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputImageListParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputImageListParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperInputImageListParameter.h" -int otbWrapperInputImageListParameterNew(int argc, char* argv[]) +int otbWrapperInputImageListParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::InputImageListParameter ParameterType; ParameterType::Pointer parameter = ParameterType::New(); @@ -30,7 +30,7 @@ } -int otbWrapperInputImageListParameterTest1(int argc, char* argv[]) +int otbWrapperInputImageListParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::InputImageListParameter ParameterType; ParameterType::Pointer param = ParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputImageParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputImageParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputImageParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputImageParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperInputImageParameter.h" -int otbWrapperInputImageParameterNew(int argc, char* argv[]) +int otbWrapperInputImageParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::InputImageParameter InputImageParameterType; InputImageParameterType::Pointer parameter = InputImageParameterType::New(); @@ -29,7 +29,7 @@ return EXIT_SUCCESS; } -int otbWrapperInputImageParameterTest1(int argc, char* argv[]) +int otbWrapperInputImageParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::InputImageParameter InputImageParameterType; InputImageParameterType::Pointer param = InputImageParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataListParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataListParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataListParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataListParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperInputVectorDataListParameter.h" -int otbWrapperInputVectorDataListParameterNew(int argc, char* argv[]) +int otbWrapperInputVectorDataListParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::InputVectorDataListParameter ParameterType; ParameterType::Pointer parameter = ParameterType::New(); @@ -30,7 +30,7 @@ } -int otbWrapperInputVectorDataListParameterTest1(int argc, char* argv[]) +int otbWrapperInputVectorDataListParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::InputVectorDataListParameter ParameterType; ParameterType::Pointer param = ParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperInputVectorDataParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperInputVectorDataParameter.h" -int otbWrapperInputVectorDataParameterNew(int argc, char* argv[]) +int otbWrapperInputVectorDataParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::InputVectorDataParameter InputVectorDataParameterType; InputVectorDataParameterType::Pointer parameter = InputVectorDataParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperNumericalParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperNumericalParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperNumericalParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperNumericalParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperNumericalParameter.h" -int otbWrapperNumericalParameterNew(int argc, char* argv[]) +int otbWrapperNumericalParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::NumericalParameter NumericalParameterType; NumericalParameterType::Pointer parameter = NumericalParameterType::New(); @@ -30,7 +30,7 @@ } -int otbWrapperNumericalParameterTest1(int argc, char* argv[]) +int otbWrapperNumericalParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::NumericalParameter NumericalParameterType; NumericalParameterType::Pointer numParam = NumericalParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperOutputImageParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperOutputImageParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperOutputImageParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperOutputImageParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbWrapperTypes.h" -int otbWrapperOutputImageParameterNew(int argc, char* argv[]) +int otbWrapperOutputImageParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::OutputImageParameter OutputImageParameterType; OutputImageParameterType::Pointer parameter = OutputImageParameterType::New(); @@ -32,7 +32,7 @@ } -int otbWrapperOutputImageParameterTest1(int argc, char* argv[]) +int otbWrapperOutputImageParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::OutputImageParameter OutputImageParameterType; OutputImageParameterType::Pointer param = OutputImageParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperParameterKeyTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperParameterKeyTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperParameterKeyTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperParameterKeyTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperParameterKey.h" -int otbWrapperParameterKey(int argc, char* argv[]) +int otbWrapperParameterKey(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { std::string theKey = "parent.current.child"; diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperParameterListTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperParameterListTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperParameterListTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperParameterListTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperParameterGroup.h" -int otbWrapperParameterListNew(int argc, char* argv[]) +int otbWrapperParameterListNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { using otb::Wrapper::ParameterGroup; ParameterGroup::Pointer parameters = ParameterGroup::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperParameter.h" -int otbWrapperParameterNew(int argc, char* argv[]) +int otbWrapperParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::Parameter ParameterBaseType; ParameterBaseType::Pointer parameter = ParameterBaseType::New(); @@ -31,7 +31,7 @@ return EXIT_SUCCESS; } -int otbWrapperParameterTest1(int argc, char* argv[]) +int otbWrapperParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::Parameter ParameterBaseType; ParameterBaseType::Pointer parameter = ParameterBaseType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperRAMParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperRAMParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperRAMParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperRAMParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperRAMParameter.h" -int otbWrapperRAMParameterNew(int argc, char* argv[]) +int otbWrapperRAMParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::RAMParameter RAMParameterType; RAMParameterType::Pointer parameter = RAMParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperStringListParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperStringListParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperStringListParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperStringListParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperStringListParameter.h" -int otbWrapperStringListParameterNew(int argc, char* argv[]) +int otbWrapperStringListParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::StringListParameter StringListParameterType; StringListParameterType::Pointer parameter = StringListParameterType::New(); @@ -30,7 +30,7 @@ } -int otbWrapperStringListParameterTest1(int argc, char* argv[]) +int otbWrapperStringListParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::StringListParameter StringListParameterType; StringListParameterType::Pointer numParam = StringListParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperStringParameterTest.cxx otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperStringParameterTest.cxx --- otb-4.0.0/Testing/Code/ApplicationEngine/otbWrapperStringParameterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ApplicationEngine/otbWrapperStringParameterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWrapperStringParameter.h" -int otbWrapperStringParameterNew(int argc, char* argv[]) +int otbWrapperStringParameterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Wrapper::StringParameter StringParameterType; StringParameterType::Pointer parameter = StringParameterType::New(); @@ -30,7 +30,7 @@ } -int otbWrapperStringParameterTest1(int argc, char* argv[]) +int otbWrapperStringParameterTest1(int itkNotUsed(argc), char* argv[]) { typedef otb::Wrapper::StringParameter StringParameterType; StringParameterType::Pointer numParam = StringParameterType::New(); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/CMakeLists.txt otb-4.2.0/Testing/Code/BasicFilters/CMakeLists.txt --- otb-4.0.0/Testing/Code/BasicFilters/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -2494,7 +2494,6 @@ ### MNF ### - # Test input->MNF->inverse MNF add_test(bfTvMNFImageFilter1 ${BASICFILTERS_TESTS13} @@ -2531,7 +2530,6 @@ -inv ${TEMP}/bfTvMNFImageFilter3Inv.tif -norm) - # Test the direct transform, reducing dimensionnality add_test(bfTvMNFImageFilter4 ${BASICFILTERS_TESTS13} @@ -2897,6 +2895,11 @@ ) +#-------- StreamingHistogramVectorImageFilter.cxx ---- +add_test(bfTuStreamingHistogramVIFilterNew ${BASICFILTERS_TESTS15} + otbStreamingHistogramVectorImageFilterNew +) + # A enrichir set(BasicFilters_SRCS1 otbBasicFiltersTests1.cxx @@ -3192,6 +3195,7 @@ otbClampVectorImageFilter.cxx otbClampImageFilter.cxx otbTileImageFilter.cxx +otbStreamingHistogramVectorImageFilter.cxx ) OTB_ADD_EXECUTABLE(otbBasicFiltersTests1 "${BasicFilters_SRCS1}" "OTBBasicFilters;OTBIO;OTBTesting") diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbAmplitudeFunctorTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbAmplitudeFunctorTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbAmplitudeFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbAmplitudeFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkRGBPixel.h" #include "itkRGBAPixel.h" -int otbAmplitudeFunctorTest(int argc, char * argv[]) +int otbAmplitudeFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double ScalarType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx otb-4.2.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkComplexToPhaseImageFilter.h" #include "itkShiftScaleImageFilter.h" -int otbAmplitudePhaseToRGBFunctor(int argc, char * argv[]) +int otbAmplitudePhaseToRGBFunctor(int itkNotUsed(argc), char * argv[]) { typedef float PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbAmplitudePhaseToRGBFunctorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkTernaryFunctorImageFilter.h" #include "otbAmplitudePhaseToRGBFunctor.h" -int otbAmplitudePhaseToRGBFunctorNew(int argc, char * argv[]) +int otbAmplitudePhaseToRGBFunctorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbAngularProjectionBinaryImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbAngularProjectionBinaryImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbAngularProjectionBinaryImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbAngularProjectionBinaryImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbAngularProjectionBinaryImageFilter.h" -int otbAngularProjectionBinaryImageFilterNewTest ( int argc, char * argv[] ) +int otbAngularProjectionBinaryImageFilterNewTest ( int itkNotUsed(argc), char * argv[] ) { const unsigned int Dimension = 2; typedef float PixelType; @@ -40,7 +40,7 @@ return EXIT_SUCCESS; } -int otbAngularProjectionBinaryImageFilterTest ( int argc, char * argv[] ) +int otbAngularProjectionBinaryImageFilterTest ( int itkNotUsed(argc), char * argv[] ) { typedef otb::CommandLineArgumentParser ParserType; ParserType::Pointer parser = ParserType::New(); @@ -120,6 +120,3 @@ } return EXIT_SUCCESS; } - - - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbAngularProjectionImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbAngularProjectionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbAngularProjectionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbAngularProjectionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbAngularProjectionImageFilter.h" -int otbAngularProjectionImageFilterNew ( int argc, char * argv[] ) +int otbAngularProjectionImageFilterNew ( int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; @@ -41,5 +41,3 @@ FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbAngularProjectionSetImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbAngularProjectionSetImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbAngularProjectionSetImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbAngularProjectionSetImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbAngularProjectionSetImageFilter.h" -int otbAngularProjectionSetImageFilterNew ( int argc, char * argv[] ) +int otbAngularProjectionSetImageFilterNew ( int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; const unsigned int SpaceDimension = 3; @@ -44,4 +44,3 @@ FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBandMathImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbBandMathImageFilter.h" #include "otbImageFileWriter.h" -int otbBandMathImageFilterNew( int argc, char* argv[]) +int otbBandMathImageFilterNew( int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef double PixelType; //typedef float PixelType; @@ -38,7 +38,7 @@ return EXIT_SUCCESS; } -int otbBandMathImageFilter( int argc, char* argv[]) +int otbBandMathImageFilter( int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef double PixelType; //typedef float PixelType; @@ -178,7 +178,7 @@ } -int otbBandMathImageFilterWithIdx( int argc, char* argv[]) +int otbBandMathImageFilterWithIdx( int itkNotUsed(argc), char* argv[]) { const char * outfname1 = argv[1]; const char * outfname2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBasicFiltersTests15.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBasicFiltersTests15.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBasicFiltersTests15.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBasicFiltersTests15.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,4 +45,5 @@ REGISTER_TEST(otbClampImageFilterTest); REGISTER_TEST(otbTileImageFilterNew); REGISTER_TEST(otbTileImageFilter); + REGISTER_TEST(otbStreamingHistogramVectorImageFilterNew); } diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBCOInterpolateImageFunction.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBCOInterpolateImageFunction.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBCOInterpolateImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBCOInterpolateImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbStreamingResampleImageFilter.h" -int otbBCOInterpolateImageFunctionNew(int argc, char * argv[]) +int otbBCOInterpolateImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::BCOInterpolateImageFunction InterpolatorType; @@ -99,7 +99,7 @@ } -int otbBCOInterpolateImageFunctionOverVectorImageNew(int argc, char * argv[]) +int otbBCOInterpolateImageFunctionOverVectorImageNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorImage ImageType; typedef otb::BCOInterpolateImageFunction InterpolatorType; @@ -171,7 +171,7 @@ } -int otbBCOInterpolateImageFunctionTest(int argc, char * argv[]) +int otbBCOInterpolateImageFunctionTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; @@ -214,7 +214,7 @@ return EXIT_SUCCESS; } -int otbBCOInterpolateImageFunctionVectorImageTest(int argc, char * argv[]) +int otbBCOInterpolateImageFunctionVectorImageTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageDensityFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include -int otbBinaryImageDensityFunction(int argc, char* argv[]) +int otbBinaryImageDensityFunction(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageList.h" -int otbBinaryImageMinimalBoundingRegionCalculator(int argc, char* argv[]) +int otbBinaryImageMinimalBoundingRegionCalculator(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageMinimalBoundingRegionCalculatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbImage.h" #include "otbBinaryImageMinimalBoundingRegionCalculator.h" -int otbBinaryImageMinimalBoundingRegionCalculatorNew(int argc, char* argv[]) +int otbBinaryImageMinimalBoundingRegionCalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBinaryImageToDensityImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbBinaryImageDensityFunction.h" #include "otbBinaryImageToDensityImageFilter.h" -int otbBinaryImageToDensityImageFilter(int argc, char* argv[]) +int otbBinaryImageToDensityImageFilter(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkImageRegionConstIterator.h" #include "itkImageRegionIterator.h" -int otbBoxAndWhiskerImageFilter(int argc, char * argv[]) +int otbBoxAndWhiskerImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBoxAndWhiskerImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVectorImage.h" #include "otbBoxAndWhiskerImageFilter.h" -int otbBoxAndWhiskerImageFilterNew(int argc, char * argv[]) +int otbBoxAndWhiskerImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbBSplineDecompositionImageFilter(int argc, char * argv[]) +int otbBSplineDecompositionImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBSplineDecompositionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbBSplineDecompositionImageFilter.h" #include "otbImage.h" -int otbBSplineDecompositionImageFilterNew(int argc, char * argv[]) +int otbBSplineDecompositionImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::BSplineDecompositionImageFilter BSplineDecompositionImageFilterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbBSplineInterpolateImageFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbBSplineInterpolateImageFunction.h" #include "otbImage.h" -int otbBSplineInterpolateImageFunctionNew(int argc, char * argv[]) +int otbBSplineInterpolateImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::BSplineInterpolateImageFunction InterpolatorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbChangeLabelImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbImageFileReader.h" -int otbChangeLabelImageFilter(int argc, char * argv[]) +int otbChangeLabelImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int ImageDimension = 2; const char * inputFilename(argv[1]); @@ -34,8 +34,6 @@ typedef otb::VectorImage OutputImageType; typedef InputImageType::PixelType InputPixelType; typedef OutputImageType::PixelType OutputPixelType; - typedef itk::ImageRegionIteratorWithIndex InputIteratorType; - typedef itk::ImageRegionIteratorWithIndex OutputIteratorType; typedef otb::ChangeLabelImageFilter FilterType; typedef otb::ImageFileWriter WriterType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbChangeLabelImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkChangeLabelImageFilter.h" #include "otbImage.h" -int otbChangeLabelImageFilterNew(int argc, char * argv[]) +int otbChangeLabelImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int ImageDimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbClampImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbClampImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbClampImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbClampImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ typedef otb::ClampImageFilter FilterType; -int otbClampImageFilterNew(int argc, char* argv[]) +int otbClampImageFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { /** instantiating the filter */ FilterType::Pointer filter = FilterType::New(); @@ -43,7 +43,7 @@ return EXIT_SUCCESS; } -int otbClampImageFilterTest(int argc, char* argv[]) +int otbClampImageFilterTest(int itkNotUsed(argc), char* argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbClampVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbClampVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbClampVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbClampVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ typedef otb::ClampVectorImageFilter FilterType; -int otbClampVectorImageFilterNew(int argc, char* argv[]) +int otbClampVectorImageFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { /** instantiating the filter */ FilterType::Pointer filter = FilterType::New(); @@ -43,7 +43,7 @@ return EXIT_SUCCESS; } -int otbClampVectorImageFilterTest(int argc, char* argv[]) +int otbClampVectorImageFilterTest(int itkNotUsed(argc), char* argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbClosingOpeningMorphologicalFilter(int argc, char * argv[]) +int otbClosingOpeningMorphologicalFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const unsigned int Radius = atoi(argv[3]); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbClosingOpeningMorphologicalFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkBinaryBallStructuringElement.h" #include "otbImage.h" -int otbClosingOpeningMorphologicalFilterNew(int argc, char * argv[]) +int otbClosingOpeningMorphologicalFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbComplexToVectorImageCastFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbComplexToVectorImageCastFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbComplexToVectorImageCastFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbComplexToVectorImageCastFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" -int otbComplexToVectorImageCastFilterNew(int argc, char * argv[]) +int otbComplexToVectorImageCastFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef std::complex ComplexType; typedef otb::VectorImage CplxImageType; @@ -39,7 +39,7 @@ return EXIT_SUCCESS; } -int otbComplexToVectorImageCastFilterTest(int argc, char * argv[]) +int otbComplexToVectorImageCastFilterTest(int itkNotUsed(argc), char * argv[]) { typedef std::complex ComplexType; typedef otb::Image CplxImageType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbConcatenateScalarValueImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbConcatenateScalarValueImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbConcatenateScalarValueImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbConcatenateScalarValueImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,14 +29,14 @@ typedef otb::VectorImage ImageType; typedef otb::ConcatenateScalarValueImageFilter FilterType; -int otbConcatenateScalarValueImageFilterNew(int argc, char * argv[]) +int otbConcatenateScalarValueImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { FilterType::Pointer filter = FilterType::New(); std::cout << filter << std::endl; return EXIT_SUCCESS; } -int otbConcatenateScalarValueImageFilterTest(int argc, char * argv[]) +int otbConcatenateScalarValueImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { ImageType::Pointer image = ImageType::New(); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbConcatenateVectorDataFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbConcatenateVectorDataFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbConcatenateVectorDataFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbConcatenateVectorDataFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ typedef otb::VectorDataFileWriter WriterType; typedef otb::ConcatenateVectorDataFilter ConcatenateFilterType; -int otbConcatenateVectorDataFilterNew (int argc, char * argv[]) +int otbConcatenateVectorDataFilterNew (int itkNotUsed(argc), char * itkNotUsed(argv) []) { ConcatenateFilterType::Pointer concatenate = ConcatenateFilterType::New(); return EXIT_SUCCESS; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbConnectedComponentMuParserFunctorTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbConnectedComponentMuParserFunctorTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbConnectedComponentMuParserFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbConnectedComponentMuParserFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,11 +31,9 @@ -int otbConnectedComponentMuParserFunctorTest(int argc, char * argv[]) +int otbConnectedComponentMuParserFunctorTest(int argc, char *argv[]) { - - const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; const char * expression = argv[3]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbContinuousMinimumMaximumImageCalculatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbContinuousMinimumMaximumImageCalculator.h" -int otbContinuousMinimumMaximumImageCalculatorNew(int argc, char * argv[]) +int otbContinuousMinimumMaximumImageCalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int ImageDimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbConvolutionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbConvolutionImageFilter.h" #include "itkConstantBoundaryCondition.h" -int otbConvolutionImageFilter(int argc, char * argv[]) +int otbConvolutionImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbConvolutionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbConvolutionImageFilter.h" -int otbConvolutionImageFilterNew(int argc, char * argv[]) +int otbConvolutionImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbDBOverlapDataNodeFeatureFunction.cxx otb-4.2.0/Testing/Code/BasicFilters/otbDBOverlapDataNodeFeatureFunction.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbDBOverlapDataNodeFeatureFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbDBOverlapDataNodeFeatureFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVectorDataFileWriter.h" #include "itkPreOrderTreeIterator.h" -int otbDBOverlapDataNodeFeatureFunctionNew(int argc, char* argv[]) +int otbDBOverlapDataNodeFeatureFunctionNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef double CoordRepType; typedef double PrecisionType; @@ -38,7 +38,7 @@ return EXIT_SUCCESS; } -int otbDBOverlapDataNodeFeatureFunction(int argc, char* argv[]) +int otbDBOverlapDataNodeFeatureFunction(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * inputDB = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbEdgeDensityImageFilter(int argc, char* argv[]) +int otbEdgeDensityImageFilter(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; @@ -41,7 +41,6 @@ typedef float PixelType; typedef otb::Image ImageType; - typedef ImageType::IndexType IndexType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbEdgeDensityImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,8 +27,6 @@ typedef float PixelType; typedef otb::Image ImageType; - typedef ImageType::IndexType IndexType; - typedef otb::BinaryImageDensityFunction CountFunctionType; typedef itk::CannyEdgeDetectionImageFilter CannyDetectorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbEdgeDetectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileWriter.h" #include "itkSobelEdgeDetectionImageFilter.h" -int otbEdgeDetectorImageFilter(int argc, char* argv[]) +int otbEdgeDetectorImageFilter(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorImage.h" -int otbEstimateInnerProductPCAImageFilter(int argc, char* argv[]) +int otbEstimateInnerProductPCAImageFilter(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbEstimateInnerProductPCAImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbEstimateInnerProductPCAImageFilter.h" #include "otbVectorImage.h" -int otbEstimateInnerProductPCAImageFilterNew(int argc, char* argv[]) +int otbEstimateInnerProductPCAImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValue.cxx otb-4.2.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValue.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValue.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValue.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkVariableLengthVector.h" #include "otbEuclideanDistanceMetricWithMissingValue.h" -int otbEuclideanDistanceMetricWithMissingValue(int argc, char * argv[]) +int otbEuclideanDistanceMetricWithMissingValue(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::VariableLengthVector VectorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValueNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValueNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValueNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbEuclideanDistanceMetricWithMissingValueNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkVariableLengthVector.h" #include "otbEuclideanDistanceMetricWithMissingValue.h" -int otbEuclideanDistanceMetricWithMissingValueNew(int argc, char * argv[]) +int otbEuclideanDistanceMetricWithMissingValueNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::VariableLengthVector VectorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFastICAImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFastICAImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFastICAImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFastICAImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbFastICAImageFilter.h" #include "otbFastICAInternalOptimizerVectorImageFilter.h" -int otbFastICAInternalOptimizerVectorImageFilterNewTest ( int argc, char* argv[] ) +int otbFastICAInternalOptimizerVectorImageFilterNewTest ( int itkNotUsed(argc), char* itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -35,7 +35,7 @@ return EXIT_SUCCESS; } -int otbFastICAImageFilterNewTest ( int argc, char* argv[] ) +int otbFastICAImageFilterNewTest ( int itkNotUsed(argc), char* itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -143,5 +143,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValue.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkVariableLengthVector.h" #include "otbFlexibleDistanceWithMissingValue.h" -int otbFlexibleDistanceWithMissingValue(int argc, char * argv[]) +int otbFlexibleDistanceWithMissingValue(int itkNotUsed(argc), char * argv[]) { typedef itk::VariableLengthVector VectorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFlexibleDistanceWithMissingValueNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkVariableLengthVector.h" #include "otbFlexibleDistanceWithMissingValue.h" -int otbFlexibleDistanceWithMissingValueNew(int argc, char * argv[]) +int otbFlexibleDistanceWithMissingValueNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::VariableLengthVector VectorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFrostFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFrostFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFrostFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFrostFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbFrostFilter(int argc, char * argv[]) +int otbFrostFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFrostFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFrostFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFrostFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFrostFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbFrostImageFilter.h" #include "otbImage.h" -int otbFrostFilterNew(int argc, char * argv[]) +int otbFrostFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFunctionToImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbFunctionToImageFilter(int argc, char * argv[]) +int otbFunctionToImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFunctionToImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbFunctionToImageFilter.h" #include "itkVarianceImageFunction.h" -int otbFunctionToImageFilterNew(int argc, char * argv[]) +int otbFunctionToImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbFunctionWithNeighborhoodToImageFilter(int argc, char * argv[]) +int otbFunctionWithNeighborhoodToImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbFunctionWithNeighborhoodToImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,14 +55,11 @@ OffsetType m_Offset; }; -int otbFunctionWithNeighborhoodToImageFilterNew(int argc, char * argv[]) +int otbFunctionWithNeighborhoodToImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::Image ImageType; - typedef itk::VariableLengthVector VectorType; - typedef itk::ConstNeighborhoodIterator IteratorType; - typedef TextureFunctorTest FunctorType; typedef otb::TextureImageFunction FunctionType; typedef otb::FunctionWithNeighborhoodToImageFilter FilterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbGaborFilterGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbGaborFilterGenerator.h" -int otbGaborFilterGeneratorNew(int argc, char * argv[]) +int otbGaborFilterGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PrecisionType; typedef otb::GaborFilterGenerator GaborGeneratorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbHorizontalSobelVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbHorizontalSobelVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbHorizontalSobelVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbHorizontalSobelVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbHorizontalSobelVectorImageFilter.h" -int otbHorizontalSobelVectorImageFilterNewTest ( int argc, char * argv[] ) +int otbHorizontalSobelVectorImageFilterNewTest ( int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; @@ -97,4 +97,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVectorImage.h" #include "otbImageAndVectorImageOperationFilter.h" -int otbImageAndVectorImageOperationFilterNew(int argc, char * argv[]) +int otbImageAndVectorImageOperationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; typedef otb::Image ScalarImageType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImageAndVectorImageOperationFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbImageAndVectorImageOperationFilter.h" -int otbImageAndVectorImageOperationFilterTest(int argc, char * argv[]) +int otbImageAndVectorImageOperationFilterTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * invectfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageListToImageListApplyFilter(int argc, char * argv[]) +int otbImageListToImageListApplyFilter(int itkNotUsed(argc), char * argv[]) { char * infname1 = argv[1]; char * infname2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImageListToImageListApplyFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "itkMeanImageFilter.h" -int otbImageListToImageListApplyFilterNew(int argc, char * argv[]) +int otbImageListToImageListApplyFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImageListToSingleImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImageListToSingleImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImageListToSingleImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImageListToSingleImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbBandMathImageFilter.h" -int otbImageListToSingleImageFilterNew(int argc, char * argv[]) +int otbImageListToSingleImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; @@ -46,7 +46,7 @@ -int otbImageListToSingleImageFilter(int argc, char * argv[]) +int otbImageListToSingleImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImagePCAShapeModelEstimatorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ itk::LightProcessObject::Pointer m_Process; }; -int otbImagePCAShapeModelEstimatorTest(int argc, char* argv[]) +int otbImagePCAShapeModelEstimatorTest(int itkNotUsed(argc), char* argv[]) { /* const unsigned int numberOfPrincipalComponentsRequired(atoi(argv[1])); const unsigned int numberOfTrainingImages(atoi(argv[2])); @@ -77,11 +77,6 @@ //------------------------------------------------------ typedef otb::Image InputImageType; typedef otb::Image OutputImageType; - typedef - itk::ImageRegionIterator InputImageIterator; - - typedef - itk::ImageRegionIterator OutputImageIterator; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImageToPointSetFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,17 +22,17 @@ #include "otbImage.h" #include "itkPointSet.h" -int otbImageToPointSetFilterTest(int argc, char *argv[]) +int otbImageToPointSetFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { +/* const unsigned int Dimension = 2; typedef unsigned char PixelType; typedef otb::Image ImageType; typedef itk::PointSet PointSetType; - typedef otb::ImageToPointSetFilter FunctionType; //FunctionType::Pointer function = FunctionType::New(); - +*/ return EXIT_SUCCESS; } diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImaginaryImageToComplexImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImaginaryImageToComplexImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImaginaryImageToComplexImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImaginaryImageToComplexImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkComplexToImaginaryImageFilter.h" #include "otbStreamingCompareImageFilter.h" -int otbImaginaryImageToComplexImageFilterTest(int argc, char * argv[]) +int otbImaginaryImageToComplexImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImportGeoInformationImageFilter(int argc, char * argv[]) +int otbImportGeoInformationImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImportGeoInformationImageFilter.h" #include "otbImage.h" -int otbImportGeoInformationImageFilterNew(int argc, char * argv[]) +int otbImportGeoInformationImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx otb-4.2.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbImportGeoInformationImageFilterWithKeywordList.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageKeywordlist.h" -int otbImportGeoInformationImageFilterWithKeywordList(int argc, char * argv[]) +int otbImportGeoInformationImageFilterWithKeywordList(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outputAsciiFilenameOtbImage = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbInnerProductPCAImageFilter.h" #include "otbMultiToMonoChannelExtractROI.h" -int otbInnerProductPCAImageFilter(int argc, char* argv[]) +int otbInnerProductPCAImageFilter(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbInnerProductPCAImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbInnerProductPCAImageFilter.h" #include "otbVectorImage.h" -int otbInnerProductPCAImageFilterNew(int argc, char* argv[]) +int otbInnerProductPCAImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx otb-4.2.0/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbInverseLogPolarTransform.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include #include "otbMath.h" -int otbInverseLogPolarTransform(int argc, char* argv[]) +int otbInverseLogPolarTransform(int itkNotUsed(argc), char* argv[]) { double radialStep = atof(argv[1]); double angularStep = atof(argv[2]); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbInverseLogPolarTransform.h" #include -int otbInverseLogPolarTransformNew(int argc, char* argv[]) +int otbInverseLogPolarTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PrecisionType; typedef otb::InverseLogPolarTransform InverseLogPolarTransformType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx otb-4.2.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbInverseLogPolarTransformResample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbInverseLogPolarTransformResample(int argc, char* argv[]) +int otbInverseLogPolarTransformResample(int itkNotUsed(argc), char* argv[]) { char * inputFileName = argv[1]; char * outputFileName = argv[2]; @@ -41,7 +41,7 @@ ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); - reader->Update(); + reader->UpdateOutputInformation(); InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetInputImage(reader->GetOutput()); @@ -73,6 +73,16 @@ resampler->SetDefaultPixelValue(0); resampler->SetSize(size); + ImageType::PointType origin; + origin[0] = 0.5; + origin[1] = 0.5; + resampler->SetOutputOrigin(origin); + + ImageType::SpacingType spacing; + spacing[0] = 1.0; + spacing[1] = 1.0; + resampler->SetOutputSpacing(spacing); + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFileName); writer->SetInput(resampler->GetOutput()); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,6 @@ typedef float PixelType; typedef otb::Image ImageType; - typedef ImageType::IndexType IndexType; typedef itk::VariableLengthVector RealVectorType; typedef itk::PointSet PointSetType; typedef otb::ImageToSIFTKeyPointSetFilter DetectorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbKeyPointDensityImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbKeyPointDensityImageFilterTest(int argc, char* argv[]) +int otbKeyPointDensityImageFilterTest(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; @@ -39,7 +39,6 @@ typedef float PixelType; typedef otb::Image ImageType; - typedef ImageType::IndexType IndexType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; typedef itk::VariableLengthVector RealVectorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelImageRegionMergingFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelImageRegionMergingFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelImageRegionMergingFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelImageRegionMergingFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,6 @@ const unsigned int Dimension = 2; typedef float PixelType; - typedef double KernelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelImageRegionPruningFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelImageRegionPruningFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelImageRegionPruningFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelImageRegionPruningFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,6 @@ const unsigned int Dimension = 2; typedef float PixelType; - typedef double KernelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLabelizeConfidenceConnectedImageFilter(int argc, char * argv[]) +int otbLabelizeConfidenceConnectedImageFilter(int itkNotUsed(argc), char * argv[]) { // Arguments char* inputImageName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConfidenceConnectedImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbLabelizeConfidenceConnectedImageFilter.h" #include "otbImage.h" -int otbLabelizeConfidenceConnectedImageFilterNew(int argc, char * argv[]) +int otbLabelizeConfidenceConnectedImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLabelizeConnectedThresholdImageFilter(int argc, char * argv[]) +int otbLabelizeConnectedThresholdImageFilter(int itkNotUsed(argc), char * argv[]) { // Arguments char* inputImageName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeConnectedThresholdImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbLabelizeConnectedThresholdImageFilter.h" #include "otbImage.h" -int otbLabelizeConnectedThresholdImageFilterNew(int argc, char * argv[]) +int otbLabelizeConnectedThresholdImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLabelizeNeighborhoodConnectedImageFilter(int argc, char * argv[]) +int otbLabelizeNeighborhoodConnectedImageFilter(int itkNotUsed(argc), char * argv[]) { // Arguments char* inputImageName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelizeNeighborhoodConnectedImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbLabelizeNeighborhoodConnectedImageFilter.h" #include "otbImage.h" -int otbLabelizeNeighborhoodConnectedImageFilterNew(int argc, char * argv[]) +int otbLabelizeNeighborhoodConnectedImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbAttributesMapLabelObject.h" #include "otbLabelObjectOpeningMuParserFilter.h" -int otbLabelObjectOpeningMuParserFilterNew( int argc, char* argv[]) +int otbLabelObjectOpeningMuParserFilterNew( int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLabelObjectOpeningMuParserFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ #include "itkLabelMapToLabelImageFilter.h" #include "otbBandsStatisticsAttributesLabelMapFilter.h" -int otbLabelObjectOpeningMuParserFilterTest(int argc, char * argv[]) +int otbLabelObjectOpeningMuParserFilterTest(int itkNotUsed(argc), char * argv[]) { const char * imageInputFilename = argv[1]; @@ -45,7 +45,6 @@ typedef unsigned int LabelType; typedef otb::Image LabelImageType; typedef otb::VectorImage InputVectorImageType; - typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileReader ImageReaderType; typedef otb::ImageFileReader LabelImageReaderType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLeeFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLeeFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLeeFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLeeFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbLeeImageFilter.h" -int otbLeeFilter(int argc, char * argv[]) +int otbLeeFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,12 +21,11 @@ #include "otbImageFileReader.h" #include "itkImageRegionIterator.h" -int otbListSampleToHistogramListGenerator(int argc, char * argv[]) +int otbListSampleToHistogramListGenerator(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; typedef otb::VectorImage VectorImageType; typedef VectorImageType::PixelType VectorPixelType; - typedef VectorImageType::SizeType SizeType; typedef itk::Statistics::ListSample ListSampleType; typedef otb::ListSampleToHistogramListGenerator HistogramGeneratorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToHistogramListGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkListSample.h" #include "otbListSampleToHistogramListGenerator.h" -int otbListSampleToHistogramListGeneratorNew(int argc, char * argv[]) +int otbListSampleToHistogramListGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "itkImageRegionIterator.h" -int otbListSampleToVariableDimensionHistogramGenerator(int argc, char * argv[]) +int otbListSampleToVariableDimensionHistogramGenerator(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; typedef otb::VectorImage VectorImageType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbListSampleToVariableDimensionHistogramGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkListSample.h" #include "otbListSampleToVariableDimensionHistogramGenerator.h" -int otbListSampleToVariableDimensionHistogramGeneratorNew(int argc, char * argv[]) +int otbListSampleToVariableDimensionHistogramGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLocalActivityVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLocalActivityVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLocalActivityVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLocalActivityVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbLocalActivityVectorImageFilter.h" -int otbLocalActivityVectorImageFilterNewTest ( int argc, char* argv[] ) +int otbLocalActivityVectorImageFilterNewTest ( int itkNotUsed(argc), char* itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -106,4 +106,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLocalGradientVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLocalGradientVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLocalGradientVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLocalGradientVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbLocalGradientVectorImageFilter.h" -int otbLocalGradientVectorImageFilterNewTest ( int argc, char * argv[] ) +int otbLocalGradientVectorImageFilterNewTest ( int itkNotUsed(argc), char * itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -97,4 +97,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLogPolarTransform.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLogPolarTransform.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLogPolarTransform.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLogPolarTransform.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include #include -int otbLogPolarTransform(int argc, char* argv[]) +int otbLogPolarTransform(int itkNotUsed(argc), char* argv[]) { double radialStep = atof(argv[1]); double angularStep = atof(argv[2]); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLogPolarTransformNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbLogPolarTransform.h" #include -int otbLogPolarTransformNew(int argc, char* argv[]) +int otbLogPolarTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PrecisionType; typedef otb::LogPolarTransform LogPolarTransformType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx otb-4.2.0/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbLogPolarTransformResample.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbLogPolarTransformResample(int argc, char* argv[]) +int otbLogPolarTransformResample(int itkNotUsed(argc), char* argv[]) { char * inputFileName = argv[1]; char * outputFileName = argv[2]; @@ -41,7 +41,7 @@ ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(inputFileName); - reader->Update(); + reader->UpdateOutputInformation(); InterpolatorType::Pointer interpolator = InterpolatorType::New(); interpolator->SetInputImage(reader->GetOutput()); @@ -71,6 +71,16 @@ resampler->SetDefaultPixelValue(0); resampler->SetSize(size); + ImageType::PointType origin; + origin[0] = 0.5; + origin[1] = 0.5; + resampler->SetOutputOrigin(origin); + + ImageType::SpacingType spacing; + spacing[0] = 1.0; + spacing[1] = 1.0; + resampler->SetOutputSpacing(spacing); + WriterType::Pointer writer = WriterType::New(); writer->SetFileName(outputFileName); writer->SetInput(resampler->GetOutput()); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMaskMuParserFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMaskMuParserFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMaskMuParserFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMaskMuParserFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbMaskMuParserFilter.h" -int otbMaskMuParserFilterNew( int argc, char* argv[]) +int otbMaskMuParserFilterNew( int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float InputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMatrixImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMatrixImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMatrixImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMatrixImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorImage.h" -int otbApplyTransitionMatrixImageFilterNew(int argc, char * argv[]) +int otbApplyTransitionMatrixImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef float OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMatrixImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMatrixImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMatrixImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMatrixImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include -int otbMatrixImageFilterNew(int argc, char * argv[]) +int otbMatrixImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef std::complex PixelType; @@ -37,7 +37,7 @@ } -int otbMatrixImageFilterTest(int argc, char * argv[]) +int otbMatrixImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbStreamingMatrixTransposeMatrixImageFilter.h" -int otbMatrixTransposeMatrixImageFilter(int argc, char * argv[]) +int otbMatrixTransposeMatrixImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname1 = argv[1]; const char * infname2 = argv[2]; @@ -32,7 +32,6 @@ //typedef double InputPixelType; //typedef double OutputPixelType; typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; typedef otb::VectorImage InputImage1Type; typedef otb::VectorImage InputImage2Type; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMatrixTransposeMatrixImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,11 +21,10 @@ #include "otbVectorImage.h" #include "otbStreamingMatrixTransposeMatrixImageFilter.h" -int otbMatrixTransposeMatrixImageFilterNew(int argc, char * argv[]) +int otbMatrixTransposeMatrixImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; - typedef unsigned char OutputPixelType; typedef otb::VectorImage InputImage1Type; typedef otb::VectorImage InputImage2Type; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMaximumAutocorrelationFactorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ typedef otb::ImageFileWriter WriterType; typedef otb::MaximumAutocorrelationFactorImageFilter MADFilterType; -int otbMaximumAutocorrelationFactorImageFilterNew(int argc, char* argv[]) +int otbMaximumAutocorrelationFactorImageFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { MADFilterType::Pointer madFilter = MADFilterType::New(); @@ -34,7 +34,7 @@ } -int otbMaximumAutocorrelationFactorImageFilter(int argc, char* argv[]) +int otbMaximumAutocorrelationFactorImageFilter(int itkNotUsed(argc), char* argv[]) { char * infname = argv[1]; char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMeanFunctorImageTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkUnaryFunctorImageFilter.h" #include "otbMeanFunctor.h" -int otbMeanFunctorImageTest(int argc, char * argv[]) +int otbMeanFunctorImageTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbImage.h" #include "otbMeanShiftImageFilter.h" -int otbMeanShiftImageFilterNew(int argc, char * argv[]) +int otbMeanShiftImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef short PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,6 @@ const unsigned int Dimension = 2; typedef float PixelType; - typedef double KernelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorImage.h" #include "otbMeanShiftSmoothingImageFilter.h" -int otbMeanShiftSmoothingImageFilterNew(int argc, char * argv[]) +int otbMeanShiftSmoothingImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef short PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterSpatialStability.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterSpatialStability.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterSpatialStability.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterSpatialStability.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,14 +53,11 @@ const unsigned int Dimension = 2; typedef float PixelType; - typedef double KernelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; typedef otb::MeanShiftSmoothingImageFilter FilterType; - typedef FilterType::OutputIterationImageType IterationImageType; typedef FilterType::OutputSpatialImageType SpatialImageType; typedef SpatialImageType::InternalPixelType SpatialPixelType; - typedef FilterType::OutputLabelImageType LabelImageType; typedef otb::MultiChannelExtractROI ExtractROIFilterType; typedef otb::MultiChannelExtractROI SpatialExtractROIFilterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterThreading.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterThreading.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterThreading.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftSmoothingImageFilterThreading.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,6 @@ const unsigned int Dimension = 2; typedef float PixelType; - typedef double KernelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMeanShiftVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbMeanShiftVectorImageFilter.h" -int otbMeanShiftVectorImageFilterNew(int argc, char * argv[]) +int otbMeanShiftVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef short PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbMNFImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbMNFImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbMNFImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbMNFImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbLocalActivityVectorImageFilter.h" -int otbMNFImageFilterNewTest ( int argc, char* argv[] ) +int otbMNFImageFilterNewTest ( int itkNotUsed(argc), char* itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -148,4 +148,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbNAPCAImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbNAPCAImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbNAPCAImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbNAPCAImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbLocalActivityVectorImageFilter.h" -int otbNAPCAImageFilterNewTest ( int argc, char* argv[] ) +int otbNAPCAImageFilterNewTest ( int itkNotUsed(argc), char* itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -148,8 +148,3 @@ return EXIT_SUCCESS; } - - - - - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbNDVIDataNodeFeatureFunction.cxx otb-4.2.0/Testing/Code/BasicFilters/otbNDVIDataNodeFeatureFunction.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbNDVIDataNodeFeatureFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbNDVIDataNodeFeatureFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbVectorDataFileWriter.h" #include "itkPreOrderTreeIterator.h" -int otbNDVIDataNodeFeatureFunctionNew(int argc, char* argv[]) +int otbNDVIDataNodeFeatureFunctionNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef double CoordRepType; typedef double PrecisionType; @@ -42,7 +42,7 @@ return EXIT_SUCCESS; } -int otbNDVIDataNodeFeatureFunction(int argc, char* argv[]) +int otbNDVIDataNodeFeatureFunction(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * inputImg = argv[2]; @@ -138,4 +138,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageFileWriter.h" #include "otbVectorImage.h" -int otbNormalizeInnerProductPCAImageFilter(int argc, char* argv[]) +int otbNormalizeInnerProductPCAImageFilter(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbNormalizeInnerProductPCAImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbNormalizeInnerProductPCAImageFilter.h" #include "otbVectorImage.h" -int otbNormalizeInnerProductPCAImageFilterNew(int argc, char* argv[]) +int otbNormalizeInnerProductPCAImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbNormalizeVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbNormalizeVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbNormalizeVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbNormalizeVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbNormalizeVectorImageFilter.h" -int otbNormalizeVectorImageFilterNewTest ( int argc, char* argv[] ) +int otbNormalizeVectorImageFilterNewTest ( int itkNotUsed(argc), char* itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -95,6 +95,3 @@ return EXIT_SUCCESS; } - - - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbOpeningClosingMorphologicalFilter(int argc, char * argv[]) +int otbOpeningClosingMorphologicalFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const unsigned int Radius = atoi(argv[3]); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbOpeningClosingMorphologicalFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkBinaryBallStructuringElement.h" #include "otbImage.h" -int otbOpeningClosingMorphologicalFilterNew(int argc, char * argv[]) +int otbOpeningClosingMorphologicalFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "otbOverlapSaveConvolutionImageFilter.h" -int otbOverlapSaveConvolutionImageFilter(int argc, char * argv[]) +int otbOverlapSaveConvolutionImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbOverlapSaveConvolutionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbOverlapSaveConvolutionImageFilter.h" -int otbOverlapSaveConvolutionImageFilterNew(int argc, char * argv[]) +int otbOverlapSaveConvolutionImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbParserConditionDataNodeFeatureFunction.cxx otb-4.2.0/Testing/Code/BasicFilters/otbParserConditionDataNodeFeatureFunction.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbParserConditionDataNodeFeatureFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbParserConditionDataNodeFeatureFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbVectorDataFileWriter.h" #include "itkPreOrderTreeIterator.h" -int otbParserConditionDataNodeFeatureFunctionNew(int argc, char* argv[]) +int otbParserConditionDataNodeFeatureFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double CoordRepType; typedef double PrecisionType; @@ -42,7 +42,7 @@ return EXIT_SUCCESS; } -int otbParserConditionDataNodeFeatureFunction(int argc, char* argv[]) +int otbParserConditionDataNodeFeatureFunction(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * inputImg = argv[2]; @@ -131,4 +131,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPCAImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPCAImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPCAImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPCAImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbPCAImageFilter.h" -int otbPCAImageFilterNewTest ( int argc, char* argv[] ) +int otbPCAImageFilterNewTest ( int itkNotUsed(argc), char* itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -129,8 +129,3 @@ return EXIT_SUCCESS; } - - - - - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "itkMeanImageFilter.h" -int otbPerBandVectorImageFilterNew(int argc, char * argv[]) +int otbPerBandVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithMeanFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbPerBandVectorImageFilterWithMeanFilter(int argc, char * argv[]) +int otbPerBandVectorImageFilterWithMeanFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPerBandVectorImageFilterWithSobelFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbPerBandVectorImageFilterWithSobelFilter(int argc, char * argv[]) +int otbPerBandVectorImageFilterWithSobelFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include -int otbPersistentVectorizationFilter(int argc, char * argv[]) +int otbPersistentVectorizationFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPersistentVectorizationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbPolygon.h" #include "otbPersistentVectorizationImageFilter.h" -int otbPersistentVectorizationFilterNew(int argc, char * argv[]) +int otbPersistentVectorizationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int ImageDimension = 2; typedef unsigned short LabelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPhaseFunctorTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPhaseFunctorTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPhaseFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPhaseFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkRGBPixel.h" #include "itkRGBAPixel.h" -int otbPhaseFunctorTest(int argc, char * argv[]) +int otbPhaseFunctorTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double ScalarType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPointSetDensityEpanechnikovFunctionTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include -int otbPointSetDensityEpanechnikovFunctionTest(int argc, char* argv[]) +int otbPointSetDensityEpanechnikovFunctionTest(int itkNotUsed(argc), char* argv[]) { const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPointSetDensityFunctionTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include -int otbPointSetDensityFunctionTest(int argc, char* argv[]) +int otbPointSetDensityFunctionTest(int itkNotUsed(argc), char* argv[]) { const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPointSetDensityGaussianFunctionTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include -int otbPointSetDensityGaussianFunctionTest(int argc, char* argv[]) +int otbPointSetDensityGaussianFunctionTest(int itkNotUsed(argc), char* argv[]) { const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPointSetExtractROITest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPointSetExtractROITest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPointSetExtractROITest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPointSetExtractROITest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,6 @@ typedef float PixelType; typedef itk::PointSet PointSetType; typedef PointSetType::PointsContainer PointsContainerType; - typedef PointSetType::PointsContainerPointer PointsContainerPointer; typedef PointSetType::PointType PointType; typedef otb::RandomPointSetSource PointSetSource; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPointSetToDensityImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbImageToSIFTKeyPointSetFilter.h" -int otbPointSetToDensityImageFilterTest(int argc, char* argv[]) +int otbPointSetToDensityImageFilterTest(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPrintableImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbPrintableImageFilter.h" -int otbPrintableImageFilter(int argc, char * argv[]) +int otbPrintableImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPrintableImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbPrintableImageFilter.h" -int otbPrintableImageFilterNew(int argc, char * argv[]) +int otbPrintableImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx otb-4.2.0/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbPrintableImageFilterWithMask.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbPrintableImageFilter.h" -int otbPrintableImageFilterWithMask(int argc, char * argv[]) +int otbPrintableImageFilterWithMask(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * masktFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbProjectiveProjection.cxx otb-4.2.0/Testing/Code/BasicFilters/otbProjectiveProjection.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbProjectiveProjection.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbProjectiveProjection.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,14 +44,14 @@ typedef StreamingStatisticsVectorImageFilterType::MatrixType MatrixType; -int otbProjectiveProjectionNew(int argc, char * argv[]) +int otbProjectiveProjectionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { ProjectiveProjectionImageFilterType::Pointer filter = ProjectiveProjectionImageFilterType::New(); std::cout << filter << std::endl; return EXIT_SUCCESS; } -int otbProjectiveProjectionTestHighSNR(int argc, char * argv[]) +int otbProjectiveProjectionTestHighSNR(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const unsigned int nbEndmembers = atoi(argv[2]); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbProlateInterpolateImageFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbProlateInterpolateImageFunction.h" #include "otbImage.h" -int otbProlateInterpolateImageFunctionNew(int argc, char * argv[]) +int otbProlateInterpolateImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::ProlateInterpolateImageFunction ProlateInterpolatorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbProlateValidationTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbProlateValidationTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbProlateValidationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbProlateValidationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbStreamingResampleImageFilter.h" -int otbProlateValidationTest(int argc, char * argv[]) +int otbProlateValidationTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.cxx otb-4.2.0/Testing/Code/BasicFilters/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbVectorDataFileWriter.h" #include "itkPreOrderTreeIterator.h" -int otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunctionNew(int argc, char* argv[]) +int otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunctionNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef double CoordRepType; typedef double PrecisionType; @@ -40,7 +40,7 @@ return EXIT_SUCCESS; } -int otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction(int argc, char* argv[]) +int otbRadiometryHomogenousWithNeighborhoodDataNodeFeatureFunction(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * inputImg = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbRealAndImaginaryImageToComplexImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbRealAndImaginaryImageToComplexImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbRealAndImaginaryImageToComplexImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbRealAndImaginaryImageToComplexImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkComplexToImaginaryImageFilter.h" #include "otbStreamingCompareImageFilter.h" -int otbRealAndImaginaryImageToComplexImageFilterTest(int argc, char * argv[]) +int otbRealAndImaginaryImageToComplexImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputFilenameRealPart = argv[1]; const char * inputFilenameImagPart = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbRealImageToComplexImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbRealImageToComplexImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbRealImageToComplexImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbRealImageToComplexImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkComplexToRealImageFilter.h" #include "otbStreamingCompareImageFilter.h" -int otbRealImageToComplexImageFilterTest(int argc, char * argv[]) +int otbRealImageToComplexImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbResampleSLCImage.cxx otb-4.2.0/Testing/Code/BasicFilters/otbResampleSLCImage.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbResampleSLCImage.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbResampleSLCImage.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbComplexToIntensityImageFilter.h" #include "otbStreamingCompareImageFilter.h" -int otbResampleSLCImage(int argc, char * argv[]) +int otbResampleSLCImage(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx otb-4.2.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkUnaryFunctorImageFilter.h" #include "otbScalarToRainbowRGBPixelFunctor.h" -int otbScalarToRainbowRGBPixelFunctor(int argc, char * argv[]) +int otbScalarToRainbowRGBPixelFunctor(int itkNotUsed(argc), char * argv[]) { typedef unsigned char PixelType; typedef itk::RGBPixel RGBPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbScalarToRainbowRGBPixelFunctorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkUnaryFunctorImageFilter.h" #include "otbScalarToRainbowRGBPixelFunctor.h" -int otbScalarToRainbowRGBPixelFunctorNew(int argc, char * argv[]) +int otbScalarToRainbowRGBPixelFunctorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbShiftScaleVectorImageFilter.h" #include "otbVectorImage.h" -int otbShiftScaleVectorImageFilterNew(int argc, char * argv[]) +int otbShiftScaleVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbShiftScaleVectorImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbVectorImageToImageListFilter.h" #include "otbStreamingStatisticsImageFilter.h" -int otbShiftScaleVectorImageFilterTest(int argc, char * argv[]) +int otbShiftScaleVectorImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbSobelVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbSobelVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbSobelVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbSobelVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbSobelVectorImageFilter.h" -int otbSobelVectorImageFilterNewTest ( int argc, char *argv[] ) +int otbSobelVectorImageFilterNewTest ( int itkNotUsed(argc), char * itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -94,4 +94,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbSparseWvltToAngleMapperListFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbSparseWvltToAngleMapperListFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbSparseWvltToAngleMapperListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbSparseWvltToAngleMapperListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ #include "otbSparseWvltToAngleMapperListFilter.h" -int otbSparseWvltToAngleMapperListFilterNew ( int argc, char * argv[] ) +int otbSparseWvltToAngleMapperListFilterNew ( int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; const unsigned int SpaceDimension = 3; @@ -51,4 +51,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbSpatialObjectToImageDrawingFilter(int argc, char * argv[]) +int otbSpatialObjectToImageDrawingFilter(int itkNotUsed(argc), char * argv[]) { const char * outputFilename = argv[1]; const double radiusx = atof(argv[2]); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbSpatialObjectToImageDrawingFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkGroupSpatialObject.h" #include "otbImage.h" -int otbSpatialObjectToImageDrawingFilterNew(int argc, char * argv[]) +int otbSpatialObjectToImageDrawingFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbSpectralAngleDataNodeFeatureFunction.cxx otb-4.2.0/Testing/Code/BasicFilters/otbSpectralAngleDataNodeFeatureFunction.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbSpectralAngleDataNodeFeatureFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbSpectralAngleDataNodeFeatureFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbVectorDataFileWriter.h" #include "itkPreOrderTreeIterator.h" -int otbSpectralAngleDataNodeFeatureFunctionNew(int argc, char* argv[]) +int otbSpectralAngleDataNodeFeatureFunctionNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef double CoordRepType; typedef double PrecisionType; @@ -42,7 +42,7 @@ return EXIT_SUCCESS; } -int otbSpectralAngleDataNodeFeatureFunction(int argc, char* argv[]) +int otbSpectralAngleDataNodeFeatureFunction(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * inputImg = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "otbSpectralAngleDistanceImageFilter.h" -int otbSpectralAngleDistanceImageFilter(int argc, char * argv[]) +int otbSpectralAngleDistanceImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbSpectralAngleDistanceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbSpectralAngleDistanceImageFilter.h" -int otbSpectralAngleDistanceImageFilterNew(int argc, char * argv[]) +int otbSpectralAngleDistanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingCompareImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingCompareImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingCompareImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingCompareImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include #include "otbStreamingTraits.h" -int otbStreamingCompareImageFilterNew(int argc, char * argv[]) +int otbStreamingCompareImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; @@ -40,7 +40,7 @@ return EXIT_SUCCESS; } -int otbStreamingCompareImageFilter(int argc, char * argv[]) +int otbStreamingCompareImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingHistogramVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,35 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + +#include "otbStreamingHistogramVectorImageFilter.h" +#include "otbVectorImage.h" + +typedef otb::VectorImage VectorImageType; +typedef otb::StreamingHistogramVectorImageFilter SHVIFType; + + + +int otbStreamingHistogramVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) +{ + + SHVIFType::Pointer SHVIFFilter = SHVIFType::New(); + + std::cout << SHVIFFilter << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageFileReader.h" #include -int otbStreamingInnerProductVectorImageFilter(int argc, char* argv[]) +int otbStreamingInnerProductVectorImageFilter(int itkNotUsed(argc), char* argv[]) { const char * inputFileName = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingInnerProductVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbStreamingInnerProductVectorImageFilter.h" #include "otbVectorImage.h" -int otbStreamingInnerProductVectorImageFilterNew(int argc, char* argv[]) +int otbStreamingInnerProductVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbStreamingTraits.h" #include "otbStandardFilterWatcher.h" -int otbStreamingMinMaxImageFilter(int argc, char * argv[]) +int otbStreamingMinMaxImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbStreamingMinMaxImageFilter.h" #include "otbImage.h" -int otbStreamingMinMaxImageFilterNew(int argc, char * argv[]) +int otbStreamingMinMaxImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbStreamingTraits.h" #include "otbStandardFilterWatcher.h" -int otbStreamingMinMaxVectorImageFilter(int argc, char * argv[]) +int otbStreamingMinMaxVectorImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingMinMaxVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbStreamingMinMaxVectorImageFilter.h" #include "otbVectorImage.h" -int otbStreamingMinMaxVectorImageFilterNew(int argc, char * argv[]) +int otbStreamingMinMaxVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterCompareWithITK.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkResampleImageFilter.h" -int otbStreamingResampleImageFilterCompareWithITK(int argc, char * argv[]) +int otbStreamingResampleImageFilterCompareWithITK(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; unsigned int sizeXOutputImage = atoi(argv[2]); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "itkTranslationTransform.h" -int otbStreamingResampleImageFilter(int argc, char * argv[]) +int otbStreamingResampleImageFilter(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; const char* outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbStreamingResampleImageFilter.h" #include "otbImage.h" -int otbStreamingResampleImageFilterNew(int argc, char * argv[]) +int otbStreamingResampleImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterWithAffineTransform.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterWithAffineTransform.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterWithAffineTransform.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingResampleImageFilterWithAffineTransform.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,9 +46,6 @@ const char * outfname = argv[3]; unsigned int isize = atoi(argv[2]); - typedef itk::Transform< - InternalPixelType, Dimension, Dimension> TransformType; - typedef itk::AffineTransform< InternalPixelType, Dimension> AffineTransformType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbStreamingShrinkImageFilter.h" -int otbStreamingShrinkImageFilter(int argc, char * argv[]) +int otbStreamingShrinkImageFilter(int itkNotUsed(argc), char * argv[]) { char * inputFilename = argv[1]; char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingShrinkImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbVectorImage.h" #include "otbStreamingShrinkImageFilter.h" -int otbStreamingShrinkImageFilterNew(int argc, char * argv[]) +int otbStreamingShrinkImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingStatisticsImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbStreamingStatisticsImageFilter.h" #include "otbImage.h" -int otbStreamingStatisticsImageFilterNew(int argc, char * argv[]) +int otbStreamingStatisticsImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingStatisticsMapFromLabelImageFilterTest.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingStatisticsMapFromLabelImageFilterTest.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingStatisticsMapFromLabelImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingStatisticsMapFromLabelImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ template -int generic_StreamingStatisticsMapFromLabelImageFilterTest(int argc, char * argv[]) +int generic_StreamingStatisticsMapFromLabelImageFilterTest(int itkNotUsed(argc), char * argv[]) { typedef unsigned int LabelPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingStatisticsVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbStreamingStatisticsVectorImageFilter.h" #include "otbVectorImage.h" -int otbStreamingStatisticsVectorImageFilterNew(int argc, char * argv[]) +int otbStreamingStatisticsVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbStreamingTraits.cxx otb-4.2.0/Testing/Code/BasicFilters/otbStreamingTraits.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbStreamingTraits.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbStreamingTraits.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ std::cout << instance << std::endl; } -int otbStreamingTraitsImage(int argc, char* argv[]) +int otbStreamingTraitsImage(int itkNotUsed(argc), char* itkNotUsed(argv) []) { // Images definition typedef otb::Image ImageType; @@ -55,7 +55,7 @@ return EXIT_SUCCESS; } -int otbStreamingTraitsVectorImage(int argc, char* argv[]) +int otbStreamingTraitsVectorImage(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Images definition typedef otb::VectorImage ImageType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbThresholdVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbThresholdVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbThresholdVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbThresholdVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ typedef otb::ThresholdVectorImageFilter FilterType; -int otbThresholdVectorImageFilterNew(int argc, char* argv[]) +int otbThresholdVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { /** instantiating the filter */ FilterType::Pointer filter = FilterType::New(); @@ -43,7 +43,7 @@ return EXIT_SUCCESS; } -int otbThresholdVectorImageFilterTest(int argc, char* argv[]) +int otbThresholdVectorImageFilterTest(int itkNotUsed(argc), char* argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbTileImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbTileImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbTileImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbTileImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ typedef otb::ImageFileWriter VectorImageWriterType; -int otbTileImageFilterNew(int argc, char * argv[]) +int otbTileImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { TileImageFilterType::Pointer tileFilter = TileImageFilterType::New(); TileVectorImageFilterType::Pointer tileVectorFilter = TileVectorImageFilterType::New(); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbUnaryFunctorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbUnaryFunctorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbUnaryFunctorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbUnaryFunctorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbPhaseFunctor.h" #include "otbUnaryFunctorImageFilter.h" -int otbUnaryFunctorImageFilterNew(int argc, char * argv[]) +int otbUnaryFunctorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "itkCastImageFilter.h" -int otbUnaryImageFunctorWithVectorImageFilter(int argc, char * argv[]) +int otbUnaryImageFunctorWithVectorImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbUnaryImageFunctorWithVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "itkCosImageFilter.h" -int otbUnaryImageFunctorWithVectorImageFilterNew(int argc, char * argv[]) +int otbUnaryImageFunctorWithVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVarianceImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbVarianceImageFilter(int argc, char * argv[]) +int otbVarianceImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVarianceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbVarianceImageFilter.h" #include "otbImage.h" -int otbVarianceImageFilterNew(int argc, char * argv[]) +int otbVarianceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorDataToRandomLineGenerator.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorDataToRandomLineGenerator.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorDataToRandomLineGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorDataToRandomLineGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorDataFileWriter.h" #include "otbVectorDataToRandomLineGenerator.h" -int otbVectorDataToRandomLineGeneratorNew(int argc, char* argv[]) +int otbVectorDataToRandomLineGeneratorNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataToRandomLineGenerator GeneratorType; @@ -35,7 +35,7 @@ return EXIT_SUCCESS; } -int otbVectorDataToRandomLineGenerator(int argc, char* argv[]) +int otbVectorDataToRandomLineGenerator(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * outputVD = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkImageRegionIterator.h" #include "itkImageSliceConstIteratorWithIndex.h" -int otbVectorImageTo3DScalarImageFilter(int argc, char * argv[]) +int otbVectorImageTo3DScalarImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int BiDimension = 2; const unsigned int TriDimension = 3; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageTo3DScalarImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbVectorImageTo3DScalarImageFilter.h" -int otbVectorImageTo3DScalarImageFilterNew(int argc, char * argv[]) +int otbVectorImageTo3DScalarImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int BiDimension = 2; const unsigned int TriDimension = 3; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbVectorImageToAmplitudeImageFilter(int argc, char * argv[]) +int otbVectorImageToAmplitudeImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToAmplitudeImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorImage.h" #include "otbImage.h" -int otbVectorImageToAmplitudeImageFilterNew(int argc, char * argv[]) +int otbVectorImageToAmplitudeImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbVectorImageToImageListFilter(int argc, char * argv[]) +int otbVectorImageToImageListFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; char * infname = argv[1]; @@ -71,7 +71,7 @@ return EXIT_SUCCESS; } -int otbVectorImageToImageListFilterIterator(int argc, char * argv[]) +int otbVectorImageToImageListFilterIterator(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToImageListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageList.h" #include "otbImage.h" -int otbVectorImageToImageListFilterNew(int argc, char * argv[]) +int otbVectorImageToImageListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "otbVectorImageToIntensityImageFilter.h" -int otbVectorImageToIntensityImageFilter(int argc, char * argv[]) +int otbVectorImageToIntensityImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToIntensityImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbVectorImageToIntensityImageFilter.h" -int otbVectorImageToIntensityImageFilterNew(int argc, char * argv[]) +int otbVectorImageToIntensityImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToMatrixImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToMatrixImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorImageToMatrixImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorImageToMatrixImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,14 +27,14 @@ typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; typedef VectorImageToMatrixImageFilterType::MatrixType MatrixType; -int otbVectorImageToMatrixNewTest(int argc, char * argv[]) +int otbVectorImageToMatrixNewTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { VectorImageToMatrixImageFilterType::Pointer vim2matrix = VectorImageToMatrixImageFilterType::New(); std::cout << vim2matrix << std::endl; return EXIT_SUCCESS; } -int otbVectorImageToMatrixTest(int argc, char * argv[]) +int otbVectorImageToMatrixTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { ImageType::Pointer image = ImageType::New(); diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbMultiChannelExtractROI.h" -int otbVectorRescaleIntensityImageFilter(int argc, char * argv[]) +int otbVectorRescaleIntensityImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVectorRescaleIntensityImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorRescaleIntensityImageFilter.h" #include "otbVectorImage.h" -int otbVectorRescaleIntensityImageFilterNew(int argc, char * argv[]) +int otbVectorRescaleIntensityImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbVerticalSobelVectorImageFilter.cxx otb-4.2.0/Testing/Code/BasicFilters/otbVerticalSobelVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbVerticalSobelVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbVerticalSobelVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbVerticalSobelVectorImageFilter.h" -int otbVerticalSobelVectorImageFilterNewTest ( int argc, char * argv[] ) +int otbVerticalSobelVectorImageFilterNewTest ( int itkNotUsed(argc), char * itkNotUsed(argv) [] ) { const unsigned int Dimension = 2; typedef double PixelType; @@ -96,4 +96,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageBlackmanFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbWindowedSincInterpolateImageBlackmanFunction.h" #include "otbImage.h" -int otbWindowedSincInterpolateImageBlackmanFunctionNew(int argc, char * argv[]) +int otbWindowedSincInterpolateImageBlackmanFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::WindowedSincInterpolateImageBlackmanFunction InterpolatorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageCosineFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbWindowedSincInterpolateImageCosineFunction.h" #include "otbImage.h" -int otbWindowedSincInterpolateImageCosineFunctionNew(int argc, char * argv[]) +int otbWindowedSincInterpolateImageCosineFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::WindowedSincInterpolateImageCosineFunction InterpolatorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageFunctionBaseNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ } -int otbWindowedSincInterpolateImageFunctionBaseNew(int argc, char * argv[]) +int otbWindowedSincInterpolateImageFunctionBaseNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef Function::SameFunction FunctionType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageGaussianFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbWindowedSincInterpolateImageGaussianFunction.h" #include "otbImage.h" -int otbWindowedSincInterpolateImageGaussianFunctionNew(int argc, char * argv[]) +int otbWindowedSincInterpolateImageGaussianFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::WindowedSincInterpolateImageGaussianFunction InterpolatorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageHammingFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbWindowedSincInterpolateImageHammingFunction.h" #include "otbImage.h" -int otbWindowedSincInterpolateImageHammingFunctionNew(int argc, char * argv[]) +int otbWindowedSincInterpolateImageHammingFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::WindowedSincInterpolateImageHammingFunction InterpolatorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageLanczosFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbWindowedSincInterpolateImageLanczosFunction.h" #include "otbImage.h" -int otbWindowedSincInterpolateImageLanczosFunctionNew(int argc, char * argv[]) +int otbWindowedSincInterpolateImageLanczosFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::WindowedSincInterpolateImageLanczosFunction InterpolatorType; diff -Nru otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx --- otb-4.0.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/BasicFilters/otbWindowedSincInterpolateImageWelchFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbWindowedSincInterpolateImageWelchFunction.h" #include "otbImage.h" -int otbWindowedSincInterpolateImageWelchFunctionNew(int argc, char * argv[]) +int otbWindowedSincInterpolateImageWelchFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef otb::WindowedSincInterpolateImageWelchFunction InterpolatorType; diff -Nru otb-4.0.0/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx otb-4.2.0/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ChangeDetection/otbKullbackLeiblerDistanceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbImage.h" #include "otbKullbackLeiblerDistanceImageFilter.h" -int otbKullbackLeiblerDistanceImageFilterNew(int argc, char * argv[]) +int otbKullbackLeiblerDistanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx otb-4.2.0/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx --- otb-4.0.0/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ChangeDetection/otbKullbackLeiblerProfileImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbKullbackLeiblerProfileImageFilter.h" -int otbKullbackLeiblerProfileImageFilterNew(int argc, char * argv[]) +int otbKullbackLeiblerProfileImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx otb-4.2.0/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ChangeDetection/otbKullbackLeiblerSupervizedDistanceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbImage.h" #include "otbKullbackLeiblerSupervizedDistanceImageFilter.h" -int otbKullbackLeiblerSupervizedDistanceImageFilterNew(int argc, char * argv[]) +int otbKullbackLeiblerSupervizedDistanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx otb-4.2.0/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx --- otb-4.0.0/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ChangeDetection/otbMultivariateAlterationDetectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ typedef otb::MultivariateAlterationDetectorImageFilter MADFilterType; -int otbMultivariateAlterationDetectorImageFilterNew(int argc, char* argv[]) +int otbMultivariateAlterationDetectorImageFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { MADFilterType::Pointer madFilter = MADFilterType::New(); @@ -35,7 +35,7 @@ } -int otbMultivariateAlterationDetectorImageFilter(int argc, char* argv[]) +int otbMultivariateAlterationDetectorImageFilter(int itkNotUsed(argc), char* argv[]) { char * infname1 = argv[1]; char * infname2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx otb-4.2.0/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbConcatenateVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "otbConcatenateVectorImageFilter.h" -int otbConcatenateVectorImageFilter(int argc, char * argv[]) +int otbConcatenateVectorImageFilter(int itkNotUsed(argc), char * argv[]) { const char * filename1 = argv[1]; const char * filename2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbConcatenateVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbConcatenateVectorImageFilter.h" #include "otbVectorImage.h" -int otbConcatenateVectorImageFilterNew(int argc, char * argv[]) +int otbConcatenateVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbConfigurationTest.cxx otb-4.2.0/Testing/Code/Common/otbConfigurationTest.cxx --- otb-4.0.0/Testing/Code/Common/otbConfigurationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbConfigurationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include #include "otbConfigurationFile.h" -int otbConfigurationTest(int argc, char * argv[]) +int otbConfigurationTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // std::cout << "begin config test" << std::endl; @@ -51,9 +51,8 @@ } -int otbConfigurationTestDEM(int argc, char * argv[]) +int otbConfigurationTestDEM(int argc, char *argv[]) { - typedef otb::ConfigurationFile ConfigurationType; std::string demDir = otb::ConfigurationFile::GetInstance()->GetDEMDirectory(); if (argc > 1) @@ -93,4 +92,3 @@ } return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/Common/otbDataNodeTest.cxx otb-4.2.0/Testing/Code/Common/otbDataNodeTest.cxx --- otb-4.0.0/Testing/Code/Common/otbDataNodeTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbDataNodeTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbDataNode.h" -int otbDataNodeTest(int argc, char * argv[]) +int otbDataNodeTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::DataNode DataNodeType; typedef DataNodeType::PointType PointType; diff -Nru otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObject.cxx otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObject.cxx --- otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "otbDrawLineSpatialObjectFilter.h" -int otbDrawLineSpatialObject(int argc, char* argv[]) +int otbDrawLineSpatialObject(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx --- otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObjectList.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ #include "otbDrawLineSpatialObjectListFilter.h" -int otbDrawLineSpatialObjectList(int argc, char* argv[]) +int otbDrawLineSpatialObjectList(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx --- otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObjectListNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImage.h" #include "otbDrawLineSpatialObjectListFilter.h" -int otbDrawLineSpatialObjectListNew(int argc, char* argv[]) +int otbDrawLineSpatialObjectListNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx --- otb-4.0.0/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbDrawLineSpatialObjectNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImage.h" #include "otbDrawLineSpatialObjectFilter.h" -int otbDrawLineSpatialObjectNew(int argc, char* argv[]) +int otbDrawLineSpatialObjectNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbDrawPathFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbDrawPathFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbDrawPathFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbDrawPathFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "itkPolyLineParametricPath.h" -int otbDrawPathFilterNew(int argc, char * argv[]) +int otbDrawPathFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbDrawPathListFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbDrawPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbDrawPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbDrawPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include "itkPolyLineParametricPath.h" -int otbDrawPathListFilterNew(int argc, char * argv[]) +int otbDrawPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbExtractROI2.cxx otb-4.2.0/Testing/Code/Common/otbExtractROI2.cxx --- otb-4.0.0/Testing/Code/Common/otbExtractROI2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbExtractROI2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbExtractROI.h" -int otbExtractROI2(int argc, char * argv[]) +int otbExtractROI2(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbExtractROI.cxx otb-4.2.0/Testing/Code/Common/otbExtractROI.cxx --- otb-4.0.0/Testing/Code/Common/otbExtractROI.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbExtractROI.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbExtractROI.h" -int otbExtractROI(int argc, char * argv[]) +int otbExtractROI(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbExtractROINew.cxx otb-4.2.0/Testing/Code/Common/otbExtractROINew.cxx --- otb-4.0.0/Testing/Code/Common/otbExtractROINew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbExtractROINew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbExtractROI.h" -int otbExtractROINew(int argc, char * argv[]) +int otbExtractROINew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef std::complex InputPixelType; typedef std::complex OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbExtractROI_RGB.cxx otb-4.2.0/Testing/Code/Common/otbExtractROI_RGB.cxx --- otb-4.0.0/Testing/Code/Common/otbExtractROI_RGB.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbExtractROI_RGB.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbExtractROI.h" #include "itkRGBPixel.h" -int otbExtractROI_RGB(int argc, char * argv[]) +int otbExtractROI_RGB(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbExtractROITestMetaData.cxx otb-4.2.0/Testing/Code/Common/otbExtractROITestMetaData.cxx --- otb-4.0.0/Testing/Code/Common/otbExtractROITestMetaData.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbExtractROITestMetaData.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ #include "boost/algorithm/string.hpp" -int otbExtractROITestMetaData(int argc, char * argv[]) +int otbExtractROITestMetaData(int itkNotUsed(argc), char * argv[]) { typedef float PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx otb-4.2.0/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx --- otb-4.0.0/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbGenericInterpolateImageFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ } -int otbGenericInterpolateImageFunctionNew(int argc, char * argv[]) +int otbGenericInterpolateImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbGISTableNew.cxx otb-4.2.0/Testing/Code/Common/otbGISTableNew.cxx --- otb-4.0.0/Testing/Code/Common/otbGISTableNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbGISTableNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbGISTable.h" #include "otbPostGISConnectionImplementation.h" -int otbGISTableNew(int argc, char * argv[]) +int otbGISTableNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::PostGISConnectionImplementation GISConnectionType; diff -Nru otb-4.0.0/Testing/Code/Common/otbGISTableSourceNew.cxx otb-4.2.0/Testing/Code/Common/otbGISTableSourceNew.cxx --- otb-4.0.0/Testing/Code/Common/otbGISTableSourceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbGISTableSourceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbGISTable.h" #include "otbPostGISConnectionImplementation.h" -int otbGISTableSourceNew(int argc, char * argv[]) +int otbGISTableSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::PostGISConnectionImplementation GISConnectionType; diff -Nru otb-4.0.0/Testing/Code/Common/otbGISTableToGISTableFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbGISTableToGISTableFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbGISTableToGISTableFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbGISTableToGISTableFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbPostGISConnectionImplementation.h" #include "otbGISTableToGISTableFilter.h" -int otbGISTableToGISTableFilterNew(int argc, char * argv[]) +int otbGISTableToGISTableFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::PostGISConnectionImplementation GISConnectionType; typedef otb::GISTable GISTableType; diff -Nru otb-4.0.0/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx otb-4.2.0/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbGISTableToVectorDataFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbGISTableToVectorDataFilter.h" #include "otbPostGISConnectionImplementation.h" -int otbGISTableToVectorDataFilter(int argc, char * argv[]) +int otbGISTableToVectorDataFilter(int itkNotUsed(argc), char * itkNotUsed(argv) []) { /** Read a PostGIS table and write it in a VectorData. The Filter is based on the OGR reader/writer factory*/ if (argc != 6) diff -Nru otb-4.0.0/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbGISTableToVectorDataFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbGISTableToVectorDataFilter.h" #include "otbPostGISConnectionImplementation.h" -int otbGISTableToVectorDataFilterNew(int argc, char * argv[]) +int otbGISTableToVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char PType; diff -Nru otb-4.0.0/Testing/Code/Common/otbHistogramStatisticsFunction.cxx otb-4.2.0/Testing/Code/Common/otbHistogramStatisticsFunction.cxx --- otb-4.0.0/Testing/Code/Common/otbHistogramStatisticsFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbHistogramStatisticsFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkHistogram.h" #include "otbHistogramStatisticsFunction.h" -int otbHistogramStatisticsFunction(int argc, char* argv[]) +int otbHistogramStatisticsFunction(int itkNotUsed(argc), char * argv[]) { unsigned int NbOfBins((unsigned int) ::atoi(argv[1])); diff -Nru otb-4.0.0/Testing/Code/Common/otbImageList.cxx otb-4.2.0/Testing/Code/Common/otbImageList.cxx --- otb-4.0.0/Testing/Code/Common/otbImageList.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageList.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageList.h" #include "otbImage.h" -int otbImageList(int argc, char * argv[]) +int otbImageList(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageListNew.cxx otb-4.2.0/Testing/Code/Common/otbImageListNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageListNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageListNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageList.h" #include "otbImage.h" -int otbImageListNew(int argc, char * argv[]) +int otbImageListNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageListSourceNew.cxx otb-4.2.0/Testing/Code/Common/otbImageListSourceNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageListSourceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageListSourceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageListSource.h" #include "otbImage.h" -int otbImageListSourceNew(int argc, char * argv[]) +int otbImageListSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageListToImageFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageListToImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageListToImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageListToImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageListToImageFilter.h" #include "otbImage.h" -int otbImageListToImageFilterNew(int argc, char * argv[]) +int otbImageListToImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageListToImageListFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageListToImageListFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageListToImageListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageListToImageListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageListToImageListFilter.h" #include "otbImage.h" -int otbImageListToImageListFilterNew(int argc, char * argv[]) +int otbImageListToImageListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageListToVectorImageFilter2.cxx otb-4.2.0/Testing/Code/Common/otbImageListToVectorImageFilter2.cxx --- otb-4.0.0/Testing/Code/Common/otbImageListToVectorImageFilter2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageListToVectorImageFilter2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageList.h" #include "otbImageFileReader.h" -int otbImageListToVectorImageFilter2(int argc, char * argv[]) +int otbImageListToVectorImageFilter2(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageListToVectorImageFilter.cxx otb-4.2.0/Testing/Code/Common/otbImageListToVectorImageFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbImageListToVectorImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageListToVectorImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageListToVectorImageFilter(int argc, char * argv[]) +int otbImageListToVectorImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageListToVectorImageFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageListToVectorImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageListToVectorImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageListToVectorImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "otbImageList.h" -int otbImageListToVectorImageFilterNew(int argc, char * argv[]) +int otbImageListToVectorImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx otb-4.2.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx --- otb-4.0.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROI.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbImageOfVectorsToMonoChannelExtractROI(int argc, char * argv[]) +int otbImageOfVectorsToMonoChannelExtractROI(int itkNotUsed(argc), char * argv[]) { const int Dimension = 2; typedef unsigned char ScalarPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx otb-4.2.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageOfVectorsToMonoChannelExtractROINew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbImageOfVectorsToMonoChannelExtractROI.h" #include "otbImage.h" -int otbImageOfVectorsToMonoChannelExtractROINew(int argc, char * argv[]) +int otbImageOfVectorsToMonoChannelExtractROINew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const int Dimension = 2; typedef unsigned char ScalarPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageRegionAdaptativeSplitter.cxx otb-4.2.0/Testing/Code/Common/otbImageRegionAdaptativeSplitter.cxx --- otb-4.0.0/Testing/Code/Common/otbImageRegionAdaptativeSplitter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageRegionAdaptativeSplitter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ typedef RegionType::SizeType SizeType; typedef RegionType::IndexType IndexType; -int otbImageRegionAdaptativeSplitterNew(int argc, char * argv[]) +int otbImageRegionAdaptativeSplitterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { SplitterType::Pointer splitter = SplitterType::New(); @@ -33,7 +33,7 @@ return EXIT_SUCCESS; } -int otbImageRegionAdaptativeSplitter(int argc, char * argv[]) +int otbImageRegionAdaptativeSplitter(int itkNotUsed(argc), char * argv[]) { SizeType regionSize, tileHint; IndexType regionIndex; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx otb-4.2.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx --- otb-4.0.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbImageRegionNonUniformMultidimensionalSplitter.h" #include -int otbImageRegionNonUniformMultidimensionalSplitter(int argc, char * argv[]) +int otbImageRegionNonUniformMultidimensionalSplitter(int itkNotUsed(argc), char * argv[]) { const int Dimension = 2; typedef otb::ImageRegionNonUniformMultidimensionalSplitter FilterType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageRegionNonUniformMultidimensionalSplitterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -17,7 +17,7 @@ =========================================================================*/ #include "otbImageRegionNonUniformMultidimensionalSplitter.h" -int otbImageRegionNonUniformMultidimensionalSplitterNew(int argc, char * argv[]) +int otbImageRegionNonUniformMultidimensionalSplitterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const int Dimension = 2; typedef otb::ImageRegionNonUniformMultidimensionalSplitter FilterType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageRegionSquareTileSplitter.cxx otb-4.2.0/Testing/Code/Common/otbImageRegionSquareTileSplitter.cxx --- otb-4.0.0/Testing/Code/Common/otbImageRegionSquareTileSplitter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageRegionSquareTileSplitter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ typedef SquareTileSplitterType::RegionType RegionType; -int otbImageRegionSquareTileSplitterNew(int argc, char * argv[]) +int otbImageRegionSquareTileSplitterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { SquareTileSplitterType::Pointer splitter = SquareTileSplitterType::New(); @@ -80,7 +80,7 @@ } -int otbImageRegionSquareTileSplitter(int argc, char * argv[]) +int otbImageRegionSquareTileSplitter(int itkNotUsed(argc), char * argv[]) { std::ofstream outfile(argv[1]); RegionType region; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx otb-4.2.0/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx --- otb-4.0.0/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageRegionTileMapSplitter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbImageRegionTileMapSplitter.h" #include -int otbImageRegionTileMapSplitter(int argc, char * argv[]) +int otbImageRegionTileMapSplitter(int itkNotUsed(argc), char * argv[]) { const int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageRegionTileMapSplitterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -17,7 +17,7 @@ =========================================================================*/ #include "otbImageRegionTileMapSplitter.h" -int otbImageRegionTileMapSplitterNew(int argc, char * argv[]) +int otbImageRegionTileMapSplitterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const int Dimension = 2; typedef otb::ImageRegionTileMapSplitter FilterType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageToImageListFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageToImageListFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageToImageListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageToImageListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageToImageListFilter.h" #include "otbImage.h" -int otbImageToImageListFilterNew(int argc, char * argv[]) +int otbImageToImageListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx otb-4.2.0/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageToLineSpatialObjectListNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImage.h" #include "otbImageToLineSpatialObjectListFilter.h" -int otbImageToLineSpatialObjectListNew(int argc, char* argv[]) +int otbImageToLineSpatialObjectListNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageToPathFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageToPathFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageToPathFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageToPathFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageToPathFilter.h" #include "otbImage.h" -int otbImageToPathFilterNew(int argc, char * argv[]) +int otbImageToPathFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx otb-4.2.0/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageToVectorImageCastFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorImage.h" #include "otbImage.h" -int otbImageToVectorImageCastFilter(int argc, char * argv[]) +int otbImageToVectorImageCastFilter(int itkNotUsed(argc), char * argv[]) { const char * infilename = argv[1]; const char * outfilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbImageToVectorImageCastFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbImage.h" -int otbImageToVectorImageCastFilterNew(int argc, char * argv[]) +int otbImageToVectorImageCastFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Common/otbLabelImageToOGRDataSourceFilter.cxx otb-4.2.0/Testing/Code/Common/otbLabelImageToOGRDataSourceFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbLabelImageToOGRDataSourceFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbLabelImageToOGRDataSourceFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbVectorDataFileWriter.h" -int otbLabelImageToOGRDataSourceFilterNew(int argc, char * argv[]) +int otbLabelImageToOGRDataSourceFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned short LabelType; @@ -46,8 +46,6 @@ return EXIT_FAILURE; } const char * infname = argv[1]; - const char * outfname = argv[2]; - const unsigned int Dimension = 2; typedef unsigned short LabelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbLabelImageToVectorDataFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbLabelImageToVectorDataFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbLabelImageToVectorDataFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbLabelImageToVectorDataFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbLabelImageToVectorDataFilter.h" #include "otbImage.h" -int otbLabelImageToVectorDataFilterNew(int argc, char * argv[]) +int otbLabelImageToVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned short LabelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbLineSpatialObjectList.cxx otb-4.2.0/Testing/Code/Common/otbLineSpatialObjectList.cxx --- otb-4.0.0/Testing/Code/Common/otbLineSpatialObjectList.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbLineSpatialObjectList.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbLineSpatialObjectList.h" #include -int otbLineSpatialObjectList(int argc, char * argv[]) +int otbLineSpatialObjectList(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::LineSpatialObjectList LineSpatialObjectListType; typedef LineSpatialObjectListType::LineType LineSpatialObjecType; diff -Nru otb-4.0.0/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbLineSpatialObjectListToPointSetFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbLineSpatialObjectListToPointSetFilter.h" -int otbLineSpatialObjectListToPointSetFilterNew(int argc, char* argv[]) +int otbLineSpatialObjectListToPointSetFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float InputPixelType; typedef otb::LineSpatialObjectList LinesListType; diff -Nru otb-4.0.0/Testing/Code/Common/otbLineSpatialObjectNew.cxx otb-4.2.0/Testing/Code/Common/otbLineSpatialObjectNew.cxx --- otb-4.0.0/Testing/Code/Common/otbLineSpatialObjectNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbLineSpatialObjectNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbLineSpatialObject.h" -int otbLineSpatialObjectNew(int argc, char * argv[]) +int otbLineSpatialObjectNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef otb::LineSpatialObject LineSpatialObjectType; diff -Nru otb-4.0.0/Testing/Code/Common/otbMultiChannelExtractROI.cxx otb-4.2.0/Testing/Code/Common/otbMultiChannelExtractROI.cxx --- otb-4.0.0/Testing/Code/Common/otbMultiChannelExtractROI.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbMultiChannelExtractROI.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ template -int generic_otbMultiChannelExtractROI(int argc, char * argv[], const char * inputFilename, const char * outputFilename) +int generic_otbMultiChannelExtractROI(int itkNotUsed(argc), char * argv[], const char * inputFilename, const char * outputFilename) { typedef otb::MultiChannelExtractROI ExtractROIFilterType; diff -Nru otb-4.0.0/Testing/Code/Common/otbMultiChannelExtractROINew.cxx otb-4.2.0/Testing/Code/Common/otbMultiChannelExtractROINew.cxx --- otb-4.0.0/Testing/Code/Common/otbMultiChannelExtractROINew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbMultiChannelExtractROINew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkMacro.h" #include "otbMultiChannelExtractROI.h" -int otbMultiChannelExtractROINew(int argc, char * argv[]) +int otbMultiChannelExtractROINew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // typedef unsigned char InputPixelType; // typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx otb-4.2.0/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx --- otb-4.0.0/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbMultiToMonoChannelExtractROI.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbMultiToMonoChannelExtractROI.h" template -int generic_otbMultiToMonoChannelExtractROI(int argc, +int generic_otbMultiToMonoChannelExtractROI(int itkNotUsed(argc), char * argv[], const char * inputFilename, const char * outputFilename) diff -Nru otb-4.0.0/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx otb-4.2.0/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx --- otb-4.0.0/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbMultiToMonoChannelExtractROINew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkMacro.h" #include "otbMultiToMonoChannelExtractROI.h" -int otbMultiToMonoChannelExtractROINew(int argc, char * argv[]) +int otbMultiToMonoChannelExtractROINew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbObjectList2.cxx otb-4.2.0/Testing/Code/Common/otbObjectList2.cxx --- otb-4.0.0/Testing/Code/Common/otbObjectList2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbObjectList2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbMacro.h" #include -int otbObjectList2(int argc, char * argv[]) +int otbObjectList2(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon PolygonType; diff -Nru otb-4.0.0/Testing/Code/Common/otbObjectList.cxx otb-4.2.0/Testing/Code/Common/otbObjectList.cxx --- otb-4.0.0/Testing/Code/Common/otbObjectList.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbObjectList.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "otbMacro.h" -int otbObjectList(int argc, char * argv[]) +int otbObjectList(int itkNotUsed(argc), char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbObjectListNew.cxx otb-4.2.0/Testing/Code/Common/otbObjectListNew.cxx --- otb-4.0.0/Testing/Code/Common/otbObjectListNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbObjectListNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbObjectList.h" #include "otbImage.h" -int otbObjectListNew(int argc, char * argv[]) +int otbObjectListNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbObjectListToObjectListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbPolyLineParametricPathWithValue.h" #include "otbPolygon.h" -int otbObjectListToObjectListFilterNew(int argc, char * argv[]) +int otbObjectListToObjectListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::PolyLineParametricPathWithValue, 2> InputObjectType; typedef otb::Polygon OutputObjectType; diff -Nru otb-4.0.0/Testing/Code/Common/otbOGRDataSourceToLabelImageFilter.cxx otb-4.2.0/Testing/Code/Common/otbOGRDataSourceToLabelImageFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbOGRDataSourceToLabelImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbOGRDataSourceToLabelImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,13 +32,13 @@ typedef otb::ImageFileWriter WriterType; typedef otb::OGRDataSourceToLabelImageFilter RasterizationFilterType; -int otbOGRDataSourceToLabelImageFilterNew(int argc, char* argv[]) +int otbOGRDataSourceToLabelImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { RasterizationFilterType::Pointer rasterization = RasterizationFilterType::New(); return EXIT_SUCCESS; } -int otbOGRDataSourceToLabelImageFilter(int argc, char* argv[]) +int otbOGRDataSourceToLabelImageFilter(int itkNotUsed(argc), char * argv[]) { ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/Common/otbParserTest.cxx otb-4.2.0/Testing/Code/Common/otbParserTest.cxx --- otb-4.0.0/Testing/Code/Common/otbParserTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbParserTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ typedef otb::Parser ParserType; -int otbParserTestNew(int argc, char * argv[]) +int otbParserTestNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiating object ParserType::Pointer parser = ParserType::New(); @@ -112,7 +112,7 @@ otbParserTest_ThrowIfNotEqual(static_cast(parser->Eval()), 1, "LogicalOperator or"); } -int otbParserTest(int argc, char * argv[]) +int otbParserTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otbParserTest_Numerical(); otbParserTest_BuildInFun(); diff -Nru otb-4.0.0/Testing/Code/Common/otbPathListToHistogramGenerator.cxx otb-4.2.0/Testing/Code/Common/otbPathListToHistogramGenerator.cxx --- otb-4.0.0/Testing/Code/Common/otbPathListToHistogramGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPathListToHistogramGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,14 +25,13 @@ #include "otbMath.h" #include "otbObjectList.h" -int otbPathListToHistogramGenerator(int argc, char* argv[]) +int otbPathListToHistogramGenerator(int itkNotUsed(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 PathType; typedef PathType::Pointer PathPointer; - typedef PathType::ConstPointer PathConstPointerType; typedef otb::ObjectList PathListType; typedef otb::OrientationPathFunction FunctionType; diff -Nru otb-4.0.0/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx otb-4.2.0/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx --- otb-4.0.0/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPathListToHistogramGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbOrientationPathFunction.h" #include "otbPathListToHistogramGenerator.h" -int otbPathListToHistogramGeneratorNew(int argc, char* argv[]) +int otbPathListToHistogramGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/Common/otbPathListToPathListFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbPathListToPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbPathListToPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPathListToPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbPathListToPathListFilter.h" #include "itkPolyLineParametricPath.h" -int otbPathListToPathListFilterNew(int argc, char * argv[]) +int otbPathListToPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/Common/otbPipelineMemoryPrintCalculatorTest.cxx otb-4.2.0/Testing/Code/Common/otbPipelineMemoryPrintCalculatorTest.cxx --- otb-4.0.0/Testing/Code/Common/otbPipelineMemoryPrintCalculatorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPipelineMemoryPrintCalculatorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbVectorImageToIntensityImageFilter.h" -int otbPipelineMemoryPrintCalculatorNew(int argc, char * argv[]) +int otbPipelineMemoryPrintCalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::PipelineMemoryPrintCalculator::Pointer calculator = otb::PipelineMemoryPrintCalculator::New(); @@ -30,7 +30,7 @@ } -int otbPipelineMemoryPrintCalculatorTest(int argc, char * argv[]) +int otbPipelineMemoryPrintCalculatorTest(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorImage VectorImageType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Common/otbPointSetSourceTest.cxx otb-4.2.0/Testing/Code/Common/otbPointSetSourceTest.cxx --- otb-4.0.0/Testing/Code/Common/otbPointSetSourceTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPointSetSourceTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbPointSetSource.h" #include "itkMacro.h" -int otbPointSetSourceTest(int argc, char* argv[]) +int otbPointSetSourceTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Declare the PointSet pixel type. // Those are the values associated diff -Nru otb-4.0.0/Testing/Code/Common/otbPolygon.cxx otb-4.2.0/Testing/Code/Common/otbPolygon.cxx --- otb-4.0.0/Testing/Code/Common/otbPolygon.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPolygon.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbPolygon.h" -int otbPolygon(int argc, char * argv[]) +int otbPolygon(int itkNotUsed(argc), char * argv[]) { typedef otb::Polygon<> PolygonType; typedef PolygonType::ContinuousIndexType ContinuousIndexType; diff -Nru otb-4.0.0/Testing/Code/Common/otbPolygonizationRasterizationTest.cxx otb-4.2.0/Testing/Code/Common/otbPolygonizationRasterizationTest.cxx --- otb-4.0.0/Testing/Code/Common/otbPolygonizationRasterizationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPolygonizationRasterizationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,14 +30,13 @@ #include "itkNumericTraits.h" #include "itkImageRegionConstIteratorWithIndex.h" -int otbPolygonizationRasterizationTest(int argc, char* argv[]) +int otbPolygonizationRasterizationTest(int itkNotUsed(argc), char * argv[]) { typedef unsigned int PixelType; typedef otb::Image ImageType; typedef otb::ImageFileReader ReaderType; typedef otb::VectorData<> VectorDataType; - typedef otb::VectorDataFileReader VDReaderType; typedef otb::LabelImageToVectorDataFilter LabelImageToVDFilterType; typedef otb::VectorDataToLabelImageFilter PolygonType; diff -Nru otb-4.0.0/Testing/Code/Common/otbPolyLineImageConstIterator.cxx otb-4.2.0/Testing/Code/Common/otbPolyLineImageConstIterator.cxx --- otb-4.0.0/Testing/Code/Common/otbPolyLineImageConstIterator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPolyLineImageConstIterator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,8 +39,6 @@ typedef otb::Image ImageType; typedef itk::PolyLineParametricPath PathType; typedef PathType::VertexType VertexType; - typedef otb::PolyLineImageIterator IteratorType; - typedef otb::PolyLineImageConstIterator ConstIteratorType; ImageType::SizeType size; diff -Nru otb-4.0.0/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx otb-4.2.0/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx --- otb-4.0.0/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPolyLineParametricPathWithValueNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbPolyLineParametricPathWithValue.h" -int otbPolyLineParametricPathWithValueNew(int argc, char * argv[]) +int otbPolyLineParametricPathWithValueNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double ValueType; diff -Nru otb-4.0.0/Testing/Code/Common/otbPostGISTableNew.cxx otb-4.2.0/Testing/Code/Common/otbPostGISTableNew.cxx --- otb-4.0.0/Testing/Code/Common/otbPostGISTableNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbPostGISTableNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbPostGISTable.h" #include "otbPostGISConnectionImplementation.h" -int otbPostGISTableNew(int argc, char * argv[]) +int otbPostGISTableNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::PostGISConnectionImplementation GISConnectionType; diff -Nru otb-4.0.0/Testing/Code/Common/otbRectangle.cxx otb-4.2.0/Testing/Code/Common/otbRectangle.cxx --- otb-4.0.0/Testing/Code/Common/otbRectangle.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbRectangle.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,14 +20,12 @@ #include #include -int otbRectangle(int argc, char * argv[]) +int otbRectangle(int itkNotUsed(argc), char * argv[]) { const char * outfname = argv[1]; typedef otb::Rectangle<> RectangleType; typedef RectangleType::ContinuousIndexType ContinuousIndexType; - typedef RectangleType::VertexListType VertexListType; - typedef VertexListType::ConstIterator IteratorType; // Instantiating object RectangleType::Pointer rectangle1 = RectangleType::New(); diff -Nru otb-4.0.0/Testing/Code/Common/otbRectangleNew.cxx otb-4.2.0/Testing/Code/Common/otbRectangleNew.cxx --- otb-4.0.0/Testing/Code/Common/otbRectangleNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbRectangleNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbRectangle.h" -int otbRectangleNew(int argc, char * argv[]) +int otbRectangleNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Rectangle<> RectangleType; diff -Nru otb-4.0.0/Testing/Code/Common/otbRemoteSensingRegion.cxx otb-4.2.0/Testing/Code/Common/otbRemoteSensingRegion.cxx --- otb-4.0.0/Testing/Code/Common/otbRemoteSensingRegion.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbRemoteSensingRegion.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbRemoteSensingRegion.h" -int otbRemoteSensingRegion(int argc, char * argv[]) +int otbRemoteSensingRegion(int itkNotUsed(argc), char * argv[]) { typedef double Type; diff -Nru otb-4.0.0/Testing/Code/Common/otbRemoteSensingRegionNew.cxx otb-4.2.0/Testing/Code/Common/otbRemoteSensingRegionNew.cxx --- otb-4.0.0/Testing/Code/Common/otbRemoteSensingRegionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbRemoteSensingRegionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbRemoteSensingRegion.h" -int otbRemoteSensingRegionNew(int argc, char * argv[]) +int otbRemoteSensingRegionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double Type; diff -Nru otb-4.0.0/Testing/Code/Common/otbRGBAPixelConverter.cxx otb-4.2.0/Testing/Code/Common/otbRGBAPixelConverter.cxx --- otb-4.0.0/Testing/Code/Common/otbRGBAPixelConverter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbRGBAPixelConverter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbRGBAPixelConverter.h" -int otbRGBAPixelConverterNew(int argc, char * argv[]) +int otbRGBAPixelConverterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char PixelType0; typedef double PixelType1; @@ -47,7 +47,7 @@ return EXIT_SUCCESS; } -int otbRGBAPixelConverter(int argc, char * argv[]) +int otbRGBAPixelConverter(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned int PixelType0; typedef double PixelType1; diff -Nru otb-4.0.0/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx otb-4.2.0/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx --- otb-4.0.0/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbShiftScaleImageAdaptor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkRescaleIntensityImageFilter.h" #include "otbShiftScaleImageAdaptor.h" -int otbShiftScaleImageAdaptor(int argc, char * argv[]) +int otbShiftScaleImageAdaptor(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx otb-4.2.0/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx --- otb-4.0.0/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbShiftScaleImageAdaptorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbShiftScaleImageAdaptor.h" -int otbShiftScaleImageAdaptorNew(int argc, char * argv[]) +int otbShiftScaleImageAdaptorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef otb::VectorImage ImageType; diff -Nru otb-4.0.0/Testing/Code/Common/otbSpatialObjectSourceNew.cxx otb-4.2.0/Testing/Code/Common/otbSpatialObjectSourceNew.cxx --- otb-4.0.0/Testing/Code/Common/otbSpatialObjectSourceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbSpatialObjectSourceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbSpatialObjectSource.h" #include "itkGroupSpatialObject.h" -int otbSpatialObjectSourceNew(int argc, char* argv[]) +int otbSpatialObjectSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::GroupSpatialObject SpatialObjectType; diff -Nru otb-4.0.0/Testing/Code/Common/otbStandardFilterWatcherNew.cxx otb-4.2.0/Testing/Code/Common/otbStandardFilterWatcherNew.cxx --- otb-4.0.0/Testing/Code/Common/otbStandardFilterWatcherNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbStandardFilterWatcherNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbStandardFilterWatcher.h" #include "itkGradientMagnitudeImageFilter.h" -int otbStandardFilterWatcherNew(int argc, char * argv[]) +int otbStandardFilterWatcherNew(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbStandardOneLineFilterWatcherTest.cxx otb-4.2.0/Testing/Code/Common/otbStandardOneLineFilterWatcherTest.cxx --- otb-4.0.0/Testing/Code/Common/otbStandardOneLineFilterWatcherTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbStandardOneLineFilterWatcherTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbStandardOneLineFilterWatcher.h" #include "itkGradientMagnitudeImageFilter.h" -int otbStandardOneLineFilterWatcherTest(int argc, char * argv[]) +int otbStandardOneLineFilterWatcherTest(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbStandardWriterWatcher.cxx otb-4.2.0/Testing/Code/Common/otbStandardWriterWatcher.cxx --- otb-4.0.0/Testing/Code/Common/otbStandardWriterWatcher.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbStandardWriterWatcher.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbImageFileWriter.h" -int otbStandardWriterWatcher(int argc, char * argv[]) +int otbStandardWriterWatcher(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbStreamingManager.cxx otb-4.2.0/Testing/Code/Common/otbStreamingManager.cxx --- otb-4.0.0/Testing/Code/Common/otbStreamingManager.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbStreamingManager.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,7 +50,7 @@ return image; } -int otbStreamingManagerNew(int argc, char * argv[]) +int otbStreamingManagerNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { NbLinesStrippedStreamingManagerType::Pointer streamingManager1 = NbLinesStrippedStreamingManagerType::New(); std::cout << streamingManager1 << std::endl; @@ -71,7 +71,7 @@ } -int otbNumberOfLinesStrippedStreamingManager(int argc, char * argv[]) +int otbNumberOfLinesStrippedStreamingManager(int itkNotUsed(argc), char * argv[]) { std::ofstream outfile(argv[1]); @@ -103,7 +103,7 @@ } -int otbRAMDrivenStrippedStreamingManager(int argc, char * argv[]) +int otbRAMDrivenStrippedStreamingManager(int itkNotUsed(argc), char * argv[]) { std::ofstream outfile(argv[1]); @@ -135,7 +135,7 @@ } -int otbTileDimensionTiledStreamingManager(int argc, char * argv[]) +int otbTileDimensionTiledStreamingManager(int itkNotUsed(argc), char * argv[]) { std::ofstream outfile(argv[1]); @@ -166,7 +166,7 @@ return EXIT_SUCCESS; } -int otbRAMDrivenTiledStreamingManager(int argc, char * argv[]) +int otbRAMDrivenTiledStreamingManager(int itkNotUsed(argc), char * argv[]) { std::ofstream outfile(argv[1]); @@ -198,7 +198,7 @@ } -int otbRAMDrivenAdaptativeStreamingManager(int argc, char * argv[]) +int otbRAMDrivenAdaptativeStreamingManager(int itkNotUsed(argc), char * argv[]) { std::ofstream outfile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/Common/otbSystemTest.cxx otb-4.2.0/Testing/Code/Common/otbSystemTest.cxx --- otb-4.0.0/Testing/Code/Common/otbSystemTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbSystemTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itksys/SystemTools.hxx" #include "otbSystem.h" -int otbSystemTest(int argc, char* argv[]) +int otbSystemTest(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * inputDirName = argv[2]; @@ -56,7 +56,7 @@ } -int otbParseHdfSubsetName(int argc, char* argv []) +int otbParseHdfSubsetName(int itkNotUsed(argc), char * itkNotUsed(argv) []) { std::string input(""); std::string key(""); @@ -74,7 +74,7 @@ return EXIT_SUCCESS; } -int otbParseHdfFileName(int argc, char* argv []) +int otbParseHdfFileName(int itkNotUsed(argc), char * itkNotUsed(argv) []) { std::string id(""); std::string file(""); diff -Nru otb-4.0.0/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx otb-4.2.0/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx --- otb-4.0.0/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbTestMultiExtractMultiUpdate.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSystem.h" -int otbTestMultiExtractMultiUpdate(int argc, char * argv[]) +int otbTestMultiExtractMultiUpdate(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double InternPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ }; } -int otbUnaryFunctorNeighborhoodImageFilter(int argc, char * argv[]) +int otbUnaryFunctorNeighborhoodImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ }; } -int otbUnaryFunctorNeighborhoodImageFilterNew(int argc, char * argv[]) +int otbUnaryFunctorNeighborhoodImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; const int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -63,7 +63,7 @@ }; } -int otbUnaryFunctorNeighborhoodWithOffsetImageFilter(int argc, char * argv[]) +int otbUnaryFunctorNeighborhoodWithOffsetImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -72,10 +72,8 @@ const int Dimension = 2; typedef otb::VectorImage ImageType; typedef ImageType::OffsetType OffsetType; - typedef ImageType::PixelType PixelType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; - typedef itk::ConstNeighborhoodIterator IterType; typedef Functor::UnaryFunctorNeighborhoodWithOffseImageFilterTest FunctorType; typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter UnaryFunctorNeighborhoodImageFilterType; diff -Nru otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -63,15 +63,12 @@ }; } -int otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew(int argc, char * argv[]) +int otbUnaryFunctorNeighborhoodWithOffsetImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; const int Dimension = 2; typedef otb::VectorImage ImageType; - typedef ImageType::PixelType - PixelType; - typedef itk::ConstNeighborhoodIterator IterType; typedef Functor::UnaryFunctorNeighborhoodWithOffsetImageFilterFunctorNewTest FunctorType; typedef otb::UnaryFunctorNeighborhoodWithOffsetImageFilter IndexType; - inline TOutput operator ()(const TInput& inPix, IndexType index) + inline TOutput operator ()(const TInput& inPix, IndexType itkNotUsed(index)) { return (static_cast(inPix)); } }; } -int otbUnaryFunctorWithIndexImageFilter(int argc, char * argv[]) +int otbUnaryFunctorWithIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbUnaryFunctorWithIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,14 +30,14 @@ typedef itk::Index<2> IndexType; - inline TOutput operator ()(const TInput& inPix, IndexType index) + inline TOutput operator ()(const TInput& inPix, IndexType itkNotUsed(index)) { return (static_cast(inPix)); } }; } -int otbUnaryFunctorWithIndexImageFilterNew(int argc, char * argv[]) +int otbUnaryFunctorWithIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Common/otbVariableLengthVectorConverter.cxx otb-4.2.0/Testing/Code/Common/otbVariableLengthVectorConverter.cxx --- otb-4.0.0/Testing/Code/Common/otbVariableLengthVectorConverter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVariableLengthVectorConverter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVariableLengthVectorConverter.h" -int otbVariableLengthVectorConverterNew(int argc, char * argv[]) +int otbVariableLengthVectorConverterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::VariableLengthVector InputType0; typedef std::vector< std::vector< double > > InputType1; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataExtractROI.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataExtractROI.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataExtractROI.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataExtractROI.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorDataFileReader.h" #include "otbVectorDataFileWriter.h" -int otbVectorDataExtractROI(int argc, char * argv[]) +int otbVectorDataExtractROI(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataExtractROINew.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataExtractROINew.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataExtractROINew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataExtractROINew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbVectorData.h" #include "otbVectorDataExtractROI.h" -int otbVectorDataExtractROINew(int argc, char * argv[]) +int otbVectorDataExtractROINew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataExtractROI FilterType; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataNew.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataNew.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorData.h" -int otbVectorDataNew(int argc, char * argv[]) +int otbVectorDataNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorData VectorDataType; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataRasterizeFilter.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataRasterizeFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataRasterizeFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataRasterizeFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,13 +39,13 @@ ImageType, ImageType> RasterizationFilterType; -int otbVectorDataRasterizeFilterNew(int argc, char* argv[]) +int otbVectorDataRasterizeFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { RasterizationFilterType::Pointer rasterization = RasterizationFilterType::New(); return EXIT_SUCCESS; } -int otbVectorDataRasterizeFilter(int argc, char* argv[]) +int otbVectorDataRasterizeFilter(int itkNotUsed(argc), char * argv[]) { ReaderType::Pointer reader = ReaderType::New(); @@ -76,9 +76,6 @@ outputcolor[3] = 0.; rasterization->AddColor(outputcolor); - otb::StandardOneLineFilterWatcher * watch = new otb::StandardOneLineFilterWatcher(rasterization.GetPointer(), - "rasterization"); - WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(rasterization->GetOutput()); diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataSourceNew.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataSourceNew.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataSourceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataSourceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorDataSource.h" #include "otbVectorData.h" -int otbVectorDataSourceNew(int argc, char * argv[]) +int otbVectorDataSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToGISTableFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbPostGISConnectionImplementation.h" #include "otbPostGISTable.h" -int otbVectorDataToGISTableFilter(int argc, char * argv[]) +int otbVectorDataToGISTableFilter(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc != 5) { diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToGISTableFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbGISTable.h" #include "otbVectorData.h" -int otbVectorDataToGISTableFilterNew(int argc, char * argv[]) +int otbVectorDataToGISTableFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToImageFilter.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToImageFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImage.h" #include "otbVectorDataToImageFilter.h" -int otbVectorDataToImageFilter(int argc, char * argv[]) +int otbVectorDataToImageFilter(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc < 4) @@ -106,7 +106,7 @@ return EXIT_SUCCESS; } -int otbVectorDataToImageFilterBinary(int argc, char * argv[]) +int otbVectorDataToImageFilterBinary(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc < 3) diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToLabelImageFilter.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToLabelImageFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToLabelImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToLabelImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,13 +38,13 @@ typedef otb::VectorDataToLabelImageFilter RasterizationFilterType; -int otbVectorDataToLabelImageFilterNew(int argc, char* argv[]) +int otbVectorDataToLabelImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { RasterizationFilterType::Pointer rasterization = RasterizationFilterType::New(); return EXIT_SUCCESS; } -int otbVectorDataToLabelImageFilter(int argc, char* argv[]) +int otbVectorDataToLabelImageFilter(int itkNotUsed(argc), char * argv[]) { ReaderType::Pointer reader = ReaderType::New(); @@ -67,9 +67,6 @@ rasterization->SetOutputParametersFromImage(reader->GetOutput()); rasterization->SetBurnAttribute("DN"); - otb::StandardOneLineFilterWatcher * watch = new otb::StandardOneLineFilterWatcher(rasterization.GetPointer(), - "rasterization"); - WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[3]); writer->SetInput(rasterization->GetOutput()); diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilter.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilter.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImage.h" #include "otbVectorDataToMapFilter.h" -int otbVectorDataToMapFilter(int argc, char * argv[]) +int otbVectorDataToMapFilter(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc < 4) @@ -106,7 +106,7 @@ return EXIT_SUCCESS; } -int otbVectorDataToMapFilterBinary(int argc, char * argv[]) +int otbVectorDataToMapFilterBinary(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc < 3) diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorData.h" #include "otbVectorDataToMapFilter.h" -int otbVectorDataToMapFilterNew(int argc, char * argv[]) +int otbVectorDataToMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorData<> VectorDataType; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterNoFonts.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterNoFonts.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterNoFonts.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterNoFonts.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImage.h" #include "otbVectorDataToMapFilter.h" -int otbVectorDataToMapFilterNoFonts(int argc, char * argv[]) +int otbVectorDataToMapFilterNoFonts(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc < 3) diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterSensorModel.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterSensorModel.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterSensorModel.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterSensorModel.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "otbImageFileReader.h" #include "otbVectorDataToMapFilter.h" -int otbVectorDataToMapFilterSensorModel(int argc, char * argv[]) +int otbVectorDataToMapFilterSensorModel(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc < 5) diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterWorld.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterWorld.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToMapFilterWorld.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToMapFilterWorld.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImage.h" #include "otbVectorDataToMapFilter.h" -int otbVectorDataToMapFilterWorld(int argc, char * argv[]) +int otbVectorDataToMapFilterWorld(int itkNotUsed(argc), char * itkNotUsed(argv) []) { if (argc < 11) diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx otb-4.2.0/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorDataToVectorDataFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorDataToVectorDataFilter.h" #include "otbVectorData.h" -int otbVectorDataToVectorDataFilterNew(int argc, char * argv[]) +int otbVectorDataToVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorData InputVectorDataType; diff -Nru otb-4.0.0/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx otb-4.2.0/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx --- otb-4.0.0/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Common/otbVectorImageToASImageAdaptorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorImageToASImageAdaptor.h" #include "otbVectorImage.h" -int otbVectorImageToASImageAdaptorNew(int argc, char * argv[]) +int otbVectorImageToASImageAdaptorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorImage ImageType; typedef otb::VectorImageToASImageAdaptor FilterType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/CMakeLists.txt otb-4.2.0/Testing/Code/DisparityMap/CMakeLists.txt --- otb-4.0.0/Testing/Code/DisparityMap/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -695,8 +695,8 @@ 1 0 0 - 1.432817727834504 - 43.584395676937191 + 1.43283322941157 + 43.5843844479961 103 107 0.000031003154124 diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbAdhesionCorrectionFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbAdhesionCorrectionFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbAdhesionCorrectionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbAdhesionCorrectionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ typedef otb::AdhesionCorrectionFilter AdhesionCorrectionFilterType; -int otbAdhesionCorrectionFilterNew(int argc, char* argv[]) +int otbAdhesionCorrectionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation @@ -131,5 +131,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbBijectionCoherencyFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbBijectionCoherencyFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbBijectionCoherencyFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbBijectionCoherencyFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ FloatImageType> BijectionFilterType; -int otbBijectionCoherencyFilterNew(int argc, char* argv[]) +int otbBijectionCoherencyFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation BijectionFilterType::Pointer bijectFilter = BijectionFilterType::New(); @@ -42,7 +42,6 @@ int otbBijectionCoherencyFilter(int argc, char* argv[]) { - typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileReader ReaderVectorType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.cxx otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbBSplinesInterpolateDisplacementFieldGenerator.h" #include "otbImageFileWriter.h" -int otbBSplinesInterpolateDisplacementFieldGenerator(int argc, char * argv[]) +int otbBSplinesInterpolateDisplacementFieldGenerator(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbBSplinesInterpolateDisplacementFieldGenerator.h" -int otbBSplinesInterpolateDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbBSplinesInterpolateDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.cxx otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "itkEuler2DTransform.h" -int otbBSplinesInterpolateTransformDisplacementFieldGenerator(int argc, char * argv[]) +int otbBSplinesInterpolateTransformDisplacementFieldGenerator(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbBSplinesInterpolateTransformDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbBSplinesInterpolateTransformDisplacementFieldGenerator.h" -int otbBSplinesInterpolateTransformDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbBSplinesInterpolateTransformDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethod.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbThresholdImageToPointSetFilter.h" #include "itkMinimumMaximumImageCalculator.h" -int otbDisparityMapEstimationMethod(int argc, char* argv[]) +int otbDisparityMapEstimationMethod(int itkNotUsed(argc), char* argv[]) { const char* fixedFileName = argv[1]; const char* movingFileName = argv[2]; @@ -48,9 +48,7 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ThresholdImageToPointSetFilter 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(); diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapEstimationMethodNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "itkTranslationTransform.h" -int otbDisparityMapEstimationMethodNew(int argc, char* argv[]) +int otbDisparityMapEstimationMethodNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapMedianFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapMedianFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapMedianFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapMedianFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ typedef otb::DisparityMapMedianFilter DisparityMapMedianFilterType; -int otbDisparityMapMedianFilterNew(int argc, char* argv[]) +int otbDisparityMapMedianFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation DisparityMapMedianFilterType::Pointer filter = DisparityMapMedianFilterType::New(); diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapTo3DFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapTo3DFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapTo3DFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapTo3DFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,8 +33,7 @@ FloatVectorImageType, FloatImageType> StereoFilterType; - -int otbDisparityMapTo3DFilterNew(int argc, char* argv[]) +int otbDisparityMapTo3DFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { // Instantiation StereoFilterType::Pointer filter = StereoFilterType::New(); @@ -111,6 +110,3 @@ return EXIT_SUCCESS; } - - - diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapToDEMFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapToDEMFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbDisparityMapToDEMFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbDisparityMapToDEMFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,7 @@ typedef otb::DisparityMapToDEMFilter DisparityToElevationFilterType; -int otbDisparityMapToDEMFilterNew(int argc, char* argv[]) +int otbDisparityMapToDEMFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation @@ -115,5 +115,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbDisparityTranslateFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbDisparityTranslateFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbDisparityTranslateFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbDisparityTranslateFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,7 +55,7 @@ FloatImageType> TranslateFilter; -int otbDisparityTranslateFilterNew(int argc, char* argv[]) +int otbDisparityTranslateFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation TranslateFilter::Pointer filter = TranslateFilter::New(); diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbFineRegistrationImageFilterNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbFineRegistrationImageFilterNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbFineRegistrationImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbFineRegistrationImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbFineRegistrationImageFilter.h" -int otbFineRegistrationImageFilterNew( int argc, char * argv[] ) +int otbFineRegistrationImageFilterNew( int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbMulti3DMapToDEMFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbMulti3DMapToDEMFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbMulti3DMapToDEMFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbMulti3DMapToDEMFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ ImageType> Multi3DFilterType; -int otbMulti3DMapToDEMFilterNew(int argc, char* argv[]) +int otbMulti3DMapToDEMFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation Multi3DFilterType::Pointer multiFilter = Multi3DFilterType::New(); @@ -52,17 +52,8 @@ typedef otb::ImageFileReader ReaderVectorType; - - typedef otb::ImageFileWriter WriterType; - - typedef otb::ImageList ImageListType; - - typedef otb::VectorImageToImageListFilter - VectorToListFilterType; - typedef otb::ObjectList MaskReaderListType; typedef otb::ObjectList MapReaderListType; @@ -319,12 +310,6 @@ typedef otb::ImageFileWriter WriterType; -typedef otb::ImageList ImageListType; - -typedef otb::VectorImageToImageListFilter - VectorToListFilterType; - typedef otb::ObjectList MaskReaderListType; typedef otb::ObjectList MapReaderListType; @@ -499,21 +484,11 @@ typedef otb::ImageFileReader ReaderVectorType; - - typedef otb::ImageFileWriter WriterType; - - typedef otb::ImageList ImageListType; - - typedef otb::VectorImageToImageListFilter - VectorToListFilterType; - typedef otb::ObjectList MaskReaderListType; typedef otb::ObjectList MapReaderListType; - if ((argc-6)%2 !=0) { std::cout << "Usage: "< Multi3DFilterType; -int otbMultiDisparityMapTo3DFilterNew(int argc, char* argv[]) +int otbMultiDisparityMapTo3DFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation Multi3DFilterType::Pointer multiFilter = Multi3DFilterType::New(); diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNCCRegistrationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,9 +38,6 @@ typedef double PixelType; typedef itk::Vector DisplacementPixelType; - typedef double CoordinateRepresentationType; - typedef double OutputPixelType; - typedef otb::Image OutputImageType; typedef otb::Image MovingImageType; typedef otb::Image FixedImageType; typedef otb::Image DisplacementPixelType; - typedef double CoordinateRepresentationType; - //Allocate Images typedef otb::Image MovingImageType; typedef otb::Image FixedImageType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGenerator.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGenerator.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbNearestPointDisplacementFieldGenerator.h" #include "otbImageFileWriter.h" -int otbNearestPointDisplacementFieldGenerator(int argc, char * argv[]) +int otbNearestPointDisplacementFieldGenerator(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNearestPointDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,14 +20,15 @@ #include "otbVectorImage.h" #include "otbNearestPointDisplacementFieldGenerator.h" -int otbNearestPointDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbNearestPointDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage ImageType; - typedef ImageType::PointType PointType; - typedef itk::PointSet PointSetType; - typedef otb::NearestPointDisplacementFieldGenerator FilterType; + typedef double PixelType; + typedef otb::VectorImage ImageType; + typedef itk::FixedArray PointDataType; + typedef itk::PointSet PointSetType; + typedef otb::NearestPointDisplacementFieldGenerator + FilterType; // Instantiating object FilterType::Pointer filter = FilterType::New(); diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGenerator.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGenerator.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "itkEuler2DTransform.h" -int otbNearestTransformDisplacementFieldGenerator(int argc, char * argv[]) +int otbNearestTransformDisplacementFieldGenerator(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNearestTransformDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbNearestTransformDisplacementFieldGenerator.h" -int otbNearestTransformDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbNearestTransformDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h" #include "otbImageFileWriter.h" -int otbNNearestPointsLinearInterpolateDisplacementFieldGenerator(int argc, char * argv[]) +int otbNNearestPointsLinearInterpolateDisplacementFieldGenerator(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNNearestPointsLinearInterpolateDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbNNearestPointsLinearInterpolateDisplacementFieldGenerator.h" -int otbNNearestPointsLinearInterpolateDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbNNearestPointsLinearInterpolateDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "itkEuler2DTransform.h" -int otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator(int argc, char * argv[]) +int otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbNNearestTransformsLinearInterpolateDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbNNearestTransformsLinearInterpolateDisplacementFieldGenerator.h" -int otbNNearestTransformsLinearInterpolateDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbNNearestTransformsLinearInterpolateDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbPixelWiseBlockMatchingImageFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbPixelWiseBlockMatchingImageFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbPixelWiseBlockMatchingImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbPixelWiseBlockMatchingImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ typedef otb::PixelWiseBlockMatchingImageFilter PixelWiseNCCBlockMatchingImageFilterType; -int otbPixelWiseBlockMatchingImageFilterNew(int argc, char * argv[]) +int otbPixelWiseBlockMatchingImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instanciation PixelWiseBlockMatchingImageFilterType::Pointer bmFilter = PixelWiseBlockMatchingImageFilterType::New(); @@ -79,11 +79,9 @@ metricWriter->Update(); - return EXIT_SUCCESS; } - int otbPixelWiseBlockMatchingImageFilterNCC(int argc, char * argv[]) { ReaderType::Pointer leftReader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbPointSetToDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbPointSetToDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbPointSetToDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbPointSetToDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbPointSetToDisplacementFieldGenerator.h" -int otbPointSetToDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbPointSetToDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbPointSetWithTransformToDisplacementFieldGeneratorNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbPointSetWithTransformToDisplacementFieldGeneratorNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbPointSetWithTransformToDisplacementFieldGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbPointSetWithTransformToDisplacementFieldGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbPointSetWithTransformToDisplacementFieldGenerator.h" -int otbPointSetWithTransformToDisplacementFieldGeneratorNew(int argc, char * argv[]) +int otbPointSetWithTransformToDisplacementFieldGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.cxx otb-4.2.0/Testing/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbStereorectificationDisplacementFieldSource.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; -int otbStereorectificationDisplacementFieldSourceNew(int argc, char * argv[]) +int otbStereorectificationDisplacementFieldSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation DisplacementFieldSourceType::Pointer dfSource = DisplacementFieldSourceType::New(); @@ -37,7 +37,7 @@ return EXIT_SUCCESS; } -int otbStereorectificationDisplacementFieldSource(int argc, char * argv[]) +int otbStereorectificationDisplacementFieldSource(int itkNotUsed(argc), char * argv[]) { char * infname1 = argv[1]; char * infname2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbStereoSensorModelToElevationMapFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ typedef otb::ImageFileWriter WriterType; -int otbStereoSensorModelToElevationMapFilterNew( int argc, char * argv[] ) +int otbStereoSensorModelToElevationMapFilterNew( int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation StereoFilterType::Pointer stereoFilter = StereoFilterType::New(); @@ -53,7 +53,7 @@ } -int otbStereoSensorModelToElevationMapFilter( int argc, char * argv[] ) +int otbStereoSensorModelToElevationMapFilter( int itkNotUsed(argc), char * argv[] ) { ReaderType::Pointer masterReader = ReaderType::New(); masterReader->SetFileName(argv[1]); diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx otb-4.2.0/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbStreamingWarpImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkVector.h" #include "otbStreamingWarpImageFilter.h" -int otbStreamingWarpImageFilterNew(int argc, char* argv[]) +int otbStreamingWarpImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Images definition const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/DisparityMap/otbSubPixelDisparityImageFilter.cxx otb-4.2.0/Testing/Code/DisparityMap/otbSubPixelDisparityImageFilter.cxx --- otb-4.0.0/Testing/Code/DisparityMap/otbSubPixelDisparityImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/DisparityMap/otbSubPixelDisparityImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,7 +56,7 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; -int otbSubPixelDisparityImageFilterNew(int argc, char* argv[]) +int otbSubPixelDisparityImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiation @@ -201,12 +201,3 @@ return EXIT_FAILURE; } - - - - - - - - - diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/CMakeLists.txt otb-4.2.0/Testing/Code/FeatureExtraction/CMakeLists.txt --- otb-4.0.0/Testing/Code/FeatureExtraction/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -675,7 +675,7 @@ ${INPUTDATA}/InputForRoadDetection_NonMaxRem.hdr ${INPUTDATA}/InputForRoadDetectionScalarProductDir.hdr ${TEMP}/feTvVectorizationPathListOutput.txt - ${TEMP}/feTvVectorizationPathListOutput.png + ${TEMP}/feTvVectorizationPathListOutputIgnored.png 0.0005 ) @@ -686,7 +686,7 @@ otbVectorizationPathListFilter ${INPUTDATA}/InputForRoadDetection_NonMaxRem.hdr ${INPUTDATA}/InputForRoadDetectionScalarProductDir.hdr - ${TEMP}/feTvVectorizationPathListOutput.txt + ${TEMP}/feTvVectorizationPathListOutputIgnored.txt ${TEMP}/feTvVectorizationPathListOutput.png 0.0001 ) @@ -1324,7 +1324,7 @@ ) add_test(feTvScalarImageToTexturesFilter ${FEATUREEXTRACTION_TESTS15} - --compare-n-images ${NOTOL} 8 + --compare-n-images ${EPSILON_10} 8 ${BASELINE}/feTvScalarImageToTexturesFilterOutputEnergy.tif ${TEMP}/feTvScalarImageToTexturesFilterOutputEnergy.tif ${BASELINE}/feTvScalarImageToTexturesFilterOutputEntropy.tif @@ -1346,6 +1346,14 @@ ${TEMP}/feTvScalarImageToTexturesFilterOutput 8 3 2 2) +add_test(feTuGreyLevelCooccurrenceIndexedListNew ${FEATUREEXTRACTION_TESTS15} + otbGreyLevelCooccurrenceIndexedListNew +) + +add_test(feTvGreyLevelCooccurrenceIndexedList ${FEATUREEXTRACTION_TESTS15} + otbGreyLevelCooccurrenceIndexedList +) + add_test(feTuotbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew ${FEATUREEXTRACTION_TESTS15} otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew ) @@ -1359,11 +1367,13 @@ ) add_test(feTvScalarImageToAdvancedTexturesFilter ${FEATUREEXTRACTION_TESTS15} - --compare-n-images ${NOTOL} 9 + --compare-n-images ${NOTOL} 10 ${BASELINE}/feTvScalarImageToAdvancedTexturesFilterOutputVariance.tif ${TEMP}/feTvScalarImageToAdvancedTexturesFilterOutputVariance.tif ${BASELINE}/feTvScalarImageToAdvancedTexturesFilterOutputMean.tif ${TEMP}/feTvScalarImageToAdvancedTexturesFilterOutputMean.tif + ${BASELINE}/feTvScalarImageToAdvancedTexturesFilterOutputDissimilarity.tif + ${TEMP}/feTvScalarImageToAdvancedTexturesFilterOutputDissimilarity.tif ${BASELINE}/feTvScalarImageToAdvancedTexturesFilterOutputSumAverage.tif ${TEMP}/feTvScalarImageToAdvancedTexturesFilterOutputSumAverage.tif ${BASELINE}/feTvScalarImageToAdvancedTexturesFilterOutputSumVariance.tif @@ -1707,6 +1717,8 @@ otbSqrtSpectralAngleImageFilter.cxx otbScalarImageToTexturesFilterNew.cxx otbScalarImageToTexturesFilter.cxx +otbGreyLevelCooccurrenceIndexedListNew.cxx +otbGreyLevelCooccurrenceIndexedList.cxx otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx otbScalarImageToAdvancedTexturesFilterNew.cxx diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbAddCarvingPathFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbAddCarvingPathFilter.h" #include "itkPolyLineParametricPath.h" -int otbAddCarvingPathFilterNew(int argc, char* argv[]) +int otbAddCarvingPathFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbAlignImageToPath.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,27 +38,23 @@ #include -int otbAlignImageToPath(int argc, char * argv[]) +int otbAlignImageToPath(int itkNotUsed(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 otb::Image InputImageType; - typedef otb::Image RealImageType; typedef itk::PolyLineParametricPath PathType; - typedef PathType::Pointer PathTypePointer; PathType::Pointer ltoto = PathType::New(); typedef otb::Image OutputImageType; - typedef otb::ImageFileReader ReaderType; typedef otb::ImageToPathListAlignFilter ListAlignFilterType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSum.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbAssociativeSymmetricalSumImageFilter.h" -int otbAssociativeSymmetricalSum(int argc, char* argv[]) +int otbAssociativeSymmetricalSum(int itkNotUsed(argc), char* argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbAssociativeSymmetricalSumNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbAssociativeSymmetricalSumImageFilter.h" -int otbAssociativeSymmetricalSumNew(int argc, char* argv[]) +int otbAssociativeSymmetricalSumNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetector.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileWriter.h" #include "otbAssymmetricFusionOfLineDetectorImageFilter.h" -int otbAssymmetricFusionOfLineDetector(int argc, char * argv[]) +int otbAssymmetricFusionOfLineDetector(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbAssymmetricFusionOfLineDetectorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "otbAssymmetricFusionOfLineDetectorImageFilter.h" -int otbAssymmetricFusionOfLineDetectorNew(int argc, char * argv[]) +int otbAssymmetricFusionOfLineDetectorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbMath.h" #include -int otbBreakAngularPathListFilter(int argc, char * argv[]) +int otbBreakAngularPathListFilter(int itkNotUsed(argc), char * argv[]) { const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbBreakAngularPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "itkPolyLineParametricPath.h" #include -int otbBreakAngularPathListFilterNew(int argc, char * argv[]) +int otbBreakAngularPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbCloudDetectionFilter(int argc, char * argv[]) +int otbCloudDetectionFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudDetectionFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorImage.h" #include "otbCloudDetectionFilter.h" -int otbCloudDetectionFilterNew(int argc, char * argv[]) +int otbCloudDetectionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudEstimatorDefaultFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbCloudEstimatorDefaultFilter(int argc, char * argv[]) +int otbCloudEstimatorDefaultFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbCloudEstimatorFilter(int argc, char * argv[]) +int otbCloudEstimatorFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCloudEstimatorFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorImage.h" #include "otbCloudEstimatorFilter.h" -int otbCloudEstimatorFilterNew(int argc, char * argv[]) +int otbCloudEstimatorFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathCircle.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkMacro.h" #include "otbMath.h" -int otbCompacityPathCircle(int argc, char * argv[]) +int otbCompacityPathCircle(int itkNotUsed(argc), char * argv[]) { unsigned int NbOfPoints((unsigned int) ::atoi(argv[1])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkPolyLineParametricPath.h" #include "itkMacro.h" -int otbCompacityPathNew(int argc, char * argv[]) +int otbCompacityPathNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathRectangle.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkMacro.h" #include "otbMath.h" -int otbCompacityPathRectangle(int argc, char * argv[]) +int otbCompacityPathRectangle(int itkNotUsed(argc), char * argv[]) { double A ((double) ::atof(argv[1])); double B ((double) ::atof(argv[2])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbCompacityPathSquare.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkMacro.h" #include "otbMath.h" -int otbCompacityPathSquare(int argc, char * argv[]) +int otbCompacityPathSquare(int itkNotUsed(argc), char * argv[]) { double A ((double) ::atof(argv[1])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentPath.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkMacro.h" #include "itkPolyLineParametricPath.h" -int otbComplexMomentPath(int argc, char * argv[]) +int otbComplexMomentPath(int itkNotUsed(argc), char * argv[]) { unsigned int p((unsigned int) ::atoi(argv[1])); unsigned int q((unsigned int) ::atoi(argv[2])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentPathFloat.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkMacro.h" #include "itkPolyLineParametricPath.h" -int otbComplexMomentPathFloat(int argc, char * argv[]) +int otbComplexMomentPathFloat(int itkNotUsed(argc), char * argv[]) { unsigned int p((unsigned int) ::atoi(argv[1])); unsigned int q((unsigned int) ::atoi(argv[2])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentPathNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbComplexMomentPathFunction.h" #include "itkPolyLineParametricPath.h" -int otbComplexMomentPathNew(int argc, char * argv[]) +int otbComplexMomentPathNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentsImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentsImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbComplexMomentsImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbComplexMomentsImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ #include "otbStreamingResampleImageFilter.h" -int otbComplexMomentsImageFunctionNew(int argc, char * argv[]) +int otbComplexMomentsImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; @@ -46,7 +46,7 @@ return EXIT_SUCCESS; } -int otbComplexMomentsImageFunction(int argc, char * argv[]) +int otbComplexMomentsImageFunction(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; unsigned int p((unsigned int) ::atoi(argv[2])); @@ -97,7 +97,7 @@ } -int otbComplexMomentsImageFunctionScaleInvariant(int argc, char * argv[]) +int otbComplexMomentsImageFunctionScaleInvariant(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; unsigned int p((unsigned int) ::atoi(argv[2])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbDrawPathAlign.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbDrawPathListFilter.h" #include "otbImageFileWriter.h" -int otbDrawPathAlign(int argc, char * argv[]) +int otbDrawPathAlign(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -41,7 +41,6 @@ typedef otb::Image OutputImageType; typedef itk::PolyLineParametricPath PathType; - typedef PathType::Pointer PathPointerType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbDrawPath.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbDrawPath.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbDrawPath.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbDrawPath.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbDrawPathFilter.h" #include "otbImageFileWriter.h" -int otbDrawPathDessinCarre(int argc, char * argv[]) +int otbDrawPathDessinCarre(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbExtractSegments.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbExtractSegments.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbExtractSegments.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbExtractSegments.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbExtractSegmentsImageFilter.h" #include "itkRescaleIntensityImageFilter.h" -int otbExtractSegments(int argc, char * argv[]) +int otbExtractSegments(int itkNotUsed(argc), char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbExtractSegmentsNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbExtractSegmentsImageFilter.h" -int otbExtractSegmentsNew(int argc, char * argv[]) +int otbExtractSegmentsNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFeatureExtractionTests15.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,6 +31,8 @@ REGISTER_TEST(otbScalarImageToTexturesFilter); REGISTER_TEST(otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew); REGISTER_TEST(otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator); + REGISTER_TEST(otbGreyLevelCooccurrenceIndexedListNew); + REGISTER_TEST(otbGreyLevelCooccurrenceIndexedList); REGISTER_TEST(otbScalarImageToAdvancedTexturesFilterNew); REGISTER_TEST(otbScalarImageToAdvancedTexturesFilter); REGISTER_TEST(otbScalarImageToPanTexTextureFilterNew); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFillGapsFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbDrawLineSpatialObjectListFilter.h" -int otbFillGapsFilter(int argc, char * argv[]) +int otbFillGapsFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFillGapsFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkMacro.h" #include "otbFillGapsFilter.h" -int otbFillGapsFilterNew(int argc, char * argv[]) +int otbFillGapsFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::FillGapsFilter FillGapsFilterType; FillGapsFilterType::Pointer filter = FillGapsFilterType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFlusserMomentsImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFlusserMomentsImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFlusserMomentsImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFlusserMomentsImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ #include "itkAffineTransform.h" -int otbFlusserMomentsImageFunctionNew(int argc, char * argv[]) +int otbFlusserMomentsImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; const unsigned int Dimension = 2; @@ -49,7 +49,7 @@ return EXIT_SUCCESS; } -int otbFlusserMomentsImageFunction(int argc, char * argv[]) +int otbFlusserMomentsImageFunction(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -91,7 +91,7 @@ return EXIT_SUCCESS; } -int otbFlusserMomentsImageFunctionScaleInvariant(int argc, char * argv[]) +int otbFlusserMomentsImageFunctionScaleInvariant(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; @@ -168,7 +168,7 @@ return EXIT_SUCCESS; } -int otbFlusserMomentsImageFunctionRotationInvariant(int argc, char * argv[]) +int otbFlusserMomentsImageFunctionRotationInvariant(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const double angleInDegrees = atoi(argv[2]); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFlusserPath.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFlusserPath.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFlusserPath.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFlusserPath.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkPolyLineParametricPath.h" #include "itkMacro.h" -int otbFlusserPath(int argc, char * argv[]) +int otbFlusserPath(int itkNotUsed(argc), char * argv[]) { unsigned int Number; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFlusserPathNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkPolyLineParametricPath.h" #include "itkMacro.h" -int otbFlusserPathNew(int argc, char * argv[]) +int otbFlusserPathNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFourierMellinDescriptors.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFourierMellinDescriptors.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFourierMellinDescriptors.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFourierMellinDescriptors.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "itkAffineTransform.h" -int otbFourierMellinDescriptorsNew(int argc, char * argv[]) +int otbFourierMellinDescriptorsNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; @@ -45,7 +45,7 @@ return EXIT_SUCCESS; } -int otbFourierMellinDescriptors(int argc, char * argv[]) +int otbFourierMellinDescriptors(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; unsigned int p((unsigned int) ::atoi(argv[2])); @@ -93,7 +93,7 @@ return EXIT_SUCCESS; } -int otbFourierMellinDescriptorsScaleInvariant(int argc, char * argv[]) +int otbFourierMellinDescriptorsScaleInvariant(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; unsigned int p((unsigned int) ::atoi(argv[2])); @@ -180,7 +180,7 @@ } -int otbFourierMellinDescriptorsRotationInvariant(int argc, char * argv[]) +int otbFourierMellinDescriptorsRotationInvariant(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; unsigned int p((unsigned int) ::atoi(argv[2])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,13 +29,12 @@ #include "itkImageRegionIterator.h" #include "itkRescaleIntensityImageFilter.h" -int otbFourierMellinImageFilter(int argc, char* argv[]) +int otbFourierMellinImageFilter(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputRealFilename = argv[2]; const char * outputImaginaryFilename = argv[3]; typedef double InputPixelType; - typedef std::complex OutputPixelType; const unsigned int Dimension = 2; typedef otb::Image InputImageType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbFourierMellinImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,14 +22,13 @@ #include "otbForwardFourierMellinTransformImageFilter.h" #include "itkLinearInterpolateImageFunction.h" -int otbFourierMellinImageFilterNew(int argc, char* argv[]) +int otbFourierMellinImageFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; typedef otb::Image InputImageType; - typedef otb::Image OutputImageType; typedef itk::LinearInterpolateImageFunction InterpolatorType; typedef otb::ForwardFourierMellinTransformImageFilter -int otbFourierMellinImageFilterTestFFT(int argc, char* argv[]) +int otbFourierMellinImageFilterTestFFT(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedList.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,250 @@ +/*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ + + +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. + + +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. + +=========================================================================*/ +#include "itkMacro.h" +#include "otbGreyLevelCooccurrenceIndexedList.h" +#include "itkImageRegionIteratorWithIndex.h" +#include "itkConstNeighborhoodIterator.h" +#include "itkImageRegionIterator.h" + +int otbGreyLevelCooccurrenceIndexedList(int, char* [] ) +{ + + //Data definitions + const unsigned int IMGWIDTH = 4; + const unsigned int IMGHEIGHT = 4; + const unsigned int NDIMENSION = 2; + + //------------------------------------------------------ + //Create a simple test images + //------------------------------------------------------ + typedef unsigned char InputPixelType; + typedef itk::Image InputImageType; + + + typedef itk::ImageRegionIterator< InputImageType > InputImageIterator; + typedef InputImageType::RegionType InputRegionType; + + InputImageType::Pointer image = InputImageType::New(); + + InputImageType::SizeType inputImageSize = {{ IMGWIDTH, IMGHEIGHT }}; + + InputImageType::IndexType index; + index.Fill(0); + InputRegionType region; + + region.SetSize( inputImageSize ); + region.SetIndex( index ); + + image->SetRegions( region ); + image->Allocate(); + + //-------------------------------------------------------------------------- + // Set up the image first. It looks like: + // 1 2 1 2 1 + // 1 2 1 2 1 + // 1 2 1 2 1 + // 1 2 1 2 1 + // 1 2 1 2 1 + //-------------------------------------------------------------------------- + + // setup the iterator + InputImageIterator imageIt( image, image->GetBufferedRegion() ); + + imageIt.GoToBegin(); + + for(unsigned int i = 0; i < IMGWIDTH; i++) + { + for(unsigned int j = 0; j < IMGHEIGHT; j++, ++imageIt) + { + imageIt.Set(j % 2 + 1); + } + } + + typedef otb::GreyLevelCooccurrenceIndexedList< InputPixelType > CooccurrenceIndexedListType; + typedef CooccurrenceIndexedListType::FrequencyType FrequencyType; + typedef CooccurrenceIndexedListType::TotalFrequencyType TotalFrequencyType; + CooccurrenceIndexedListType::Pointer cooccurrenceObj1 = CooccurrenceIndexedListType::New(); + std::cout << "Class name = "; + std::cout << cooccurrenceObj1->GetNameOfClass() << std::endl; + + bool passed = true; + try + { + // Check Intialize method. + cooccurrenceObj1->Initialize(4, 0, 8); + bool symmetry = cooccurrenceObj1->GetSymmetry(); + float totalFrequency = cooccurrenceObj1->GetTotalFrequency(); + + if( !symmetry || totalFrequency != 0) + { + std::cerr << "Error" << std::endl; + std::cerr << "Expected symmetry = 1, totalFrequency = 0, got symmetry = " + << symmetry << " totalFrequency = " << totalFrequency << std::endl; + passed = false; + } + } + catch( itk::ExceptionObject & err ) + { + std::cerr << "ExceptionObject caught !" << std::endl; + std::cerr << err << std::endl; + std::cerr << "Test failed" << std::endl; + return EXIT_FAILURE; + } + + static const FrequencyType out1[] = {12,6,12,12,12,12,12,6,12,6,12,12,12,12,12,6,12,6,12,12,12,12,12,6,8,4,8,8,8,8,8,4}; + std::vector avector (out1, out1 + sizeof(out1) / sizeof(out1[0]) ); + + static const FrequencyType out2[] = {18,24,24,18,18,24,24,18,18,24,24,18,12,16,16,12}; + std::vector< TotalFrequencyType> tavector(out2, out2 + sizeof(out2) / sizeof(out2[0]) ); ; + + InputImageType::OffsetType offset = {{0, 1}}; + + //vector to save results + std::vector< FrequencyType> fvector; + std::vector< TotalFrequencyType> tfvector; + + InputImageType::SizeType neighborhoodRadius; + + unsigned int minRadius = 0; + for ( unsigned int i = 0; i < offset.GetOffsetDimension(); i++ ) + { + unsigned int distance = vcl_abs(offset[i]); + if ( distance > minRadius ) + { + minRadius = distance; + } + } + neighborhoodRadius.Fill(minRadius); + + InputImageType::SizeType radius = {{ 2, 2 }}; + + // Iterate over input image and create co-occurrence list + itk::ImageRegionIteratorWithIndex imageItWithIndex(image, region); + imageItWithIndex.GoToBegin(); + while (!imageItWithIndex.IsAtEnd()) + { + InputRegionType::IndexType inputIndex; + InputRegionType::SizeType inputSize; + for (unsigned int dim = 0; dim < InputImageType::ImageDimension; ++dim) + { + inputIndex[dim] = imageItWithIndex.GetIndex()[dim] - radius[dim]; + inputSize[dim] = 2 * radius[dim] + 1; + } + + // Build the input region + InputRegionType inputRegion; + inputRegion.SetIndex(inputIndex); + inputRegion.SetSize(inputSize); + inputRegion.Crop(image->GetRequestedRegion()); + + CooccurrenceIndexedListType::Pointer cooccurrenceObj2 = CooccurrenceIndexedListType::New(); + cooccurrenceObj2->Initialize(8, 0, 3); + + typedef itk::ConstNeighborhoodIterator< InputImageType > NeighborhoodIteratorType; + NeighborhoodIteratorType neighborIt; + neighborIt = NeighborhoodIteratorType(neighborhoodRadius, image, inputRegion); + for ( neighborIt.GoToBegin(); !neighborIt.IsAtEnd(); ++neighborIt ) + { + const InputPixelType centerPixelIntensity = neighborIt.GetCenterPixel(); + bool pixelInBounds; + const InputPixelType pixelIntensity = neighborIt.GetPixel(offset, pixelInBounds); + if ( !pixelInBounds ) + { + continue; // don't put a pixel in the co-occurrence list if it's out-of-bounds. + } + cooccurrenceObj2->AddPixelPair(centerPixelIntensity, pixelIntensity); + } + + typedef CooccurrenceIndexedListType::VectorType VectorType; + VectorType vector; + //get indexed list and total frequency + vector = cooccurrenceObj2->GetVector(); + //save total frequency + tfvector.push_back(cooccurrenceObj2->GetTotalFrequency()); + //save each vector to fvector so as to compare results later + VectorType::const_iterator it; + for (it = vector.begin(); it != vector.end(); ++it) + { + fvector.push_back( (*it).second ); + } + ++imageItWithIndex; + } + + //Check size of fvector against the actual results + if( fvector.size() != avector.size()) + { + std::cerr << "Size of computed co-occurrence indexed list for entire image is: " << fvector.size() + << " expected size is: " << avector.size() << std::endl; + passed = false; + } + else + { + //check contents individually + std::vector::const_iterator fit, ait; + ait = avector.begin(); + fit = fvector.begin(); + while(ait != avector.end()) + { + if ((*fit) != (*ait)) + { + std::cerr << "Expected value: " << (*ait) << " got :" << (*fit) << std::endl; + passed = false; + break; + } + ++ait; ++fit; + } + std::cerr << "Co-occurrence list frequencies are correct" << std::endl; + } + + //Check size of tfvector against the tavector + if( tfvector.size() != tavector.size()) + { + std::cerr << "Size of computed co-occurrence indexed list for entire image is: " << tfvector.size() + << " expected size is: " << tavector.size() << std::endl; + passed = false; + } + else + { + //check contents individually + std::vector::const_iterator fit, ait; + ait = tavector.begin(); + fit = tfvector.begin(); + while(ait != tavector.end()) + { + if ((*fit) != (*ait)) + { + std::cerr << "Expected value: " << (*ait) << " got :" << (*fit) << std::endl; + passed = false; + break; + } + ++ait; ++fit; + } + std::cerr << "Co-occurrence list total frequencies are correct" << std::endl; + } + + if (!passed) + { + std::cerr << "Test failed" << std::endl; + return EXIT_FAILURE; + } + else + { + std::cerr << "Test succeeded" << std::endl; + return EXIT_SUCCESS; + } +} diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedListNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedListNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedListNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceIndexedListNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,33 @@ +/*========================================================================= + +Program: ORFEO Toolbox +Language: C++ +Date: $Date$ +Version: $Revision$ + + +Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. +See OTBCopyright.txt for details. + + +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. + +=========================================================================*/ + +#include "itkMacro.h" +#include "otbGreyLevelCooccurrenceIndexedList.h" + +int otbGreyLevelCooccurrenceIndexedListNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) +{ + typedef float PixelType; + typedef otb::GreyLevelCooccurrenceIndexedList< PixelType > CooccurrenceIndexedListType; + CooccurrenceIndexedListType::Pointer lightObj = CooccurrenceIndexedListType::New(); + + std::cout << "Printing otb::GreyLevelCooccurrenceIndexedList: " << std::endl; + lightObj->Print( std::cout ); + + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h" -int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator(int argc, char * argv[]) +int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator(int itkNotUsed(argc), char * itkNotUsed(argv) []) { try // the rest of the function is in the try block... diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculator.h" -int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew(int argc, char * argv[]) +int otbGreyLevelCooccurrenceMatrixAdvancedTextureCoefficientsCalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float MeasurementType; typedef itk::Statistics::Histogram HistogramType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHaralickTexturesImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHaralickTexturesImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHaralickTexturesImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHaralickTexturesImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,14 +32,14 @@ typedef HaralickTexturesImageFunctionType::PointType PointType; typedef HaralickTexturesImageFunctionType::OutputType OutputType; -int otbHaralickTexturesImageFunctionNew(int argc, char * argv[]) +int otbHaralickTexturesImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { HaralickTexturesImageFunctionType::Pointer function = HaralickTexturesImageFunctionType::New(); return EXIT_SUCCESS; } -int otbHaralickTexturesImageFunction(int argc, char * argv[]) +int otbHaralickTexturesImageFunction(int itkNotUsed(argc), char * argv[]) { // Read the input image ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHarrisImage.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHarrisImage.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHarrisImage.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHarrisImage.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbHarrisImageFilter.h" -int otbHarrisImage(int argc, char * argv[]) +int otbHarrisImage(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHarrisToPointSet.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbHarrisImageToPointSetFilter.h" #include -int otbHarrisToPointSet(int argc, char * argv[]) +int otbHarrisToPointSet(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHistogramOfOrientedGradientCovariantImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHistogramOfOrientedGradientCovariantImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHistogramOfOrientedGradientCovariantImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHistogramOfOrientedGradientCovariantImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ typedef otb::HistogramOfOrientedGradientCovariantImageFunction FunctionType; -int otbHistogramOfOrientedGradientCovariantImageFunctionNew(int argc, char * argv[]) +int otbHistogramOfOrientedGradientCovariantImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Instantiating object FunctionType::Pointer function = FunctionType::New(); @@ -49,7 +49,7 @@ } -int otbHistogramOfOrientedGradientCovariantImageFunction(int argc, char * argv[]) +int otbHistogramOfOrientedGradientCovariantImageFunction(int itkNotUsed(argc), char * argv[]) { ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); @@ -88,4 +88,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHoughTransform2DLinesImageTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,7 @@ }; /** Main program */ -int otbHoughTransform2DLinesImageTest(int argc, char* argv[]) +int otbHoughTransform2DLinesImageTest(int itkNotUsed(argc), char* argv[]) { const char * outputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHuMomentsImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHuMomentsImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHuMomentsImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHuMomentsImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ #include "itkAffineTransform.h" -int otbHuMomentsImageFunctionNew(int argc, char * argv[]) +int otbHuMomentsImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; const unsigned int Dimension = 2; @@ -48,7 +48,7 @@ return EXIT_SUCCESS; } -int otbHuMomentsImageFunction(int argc, char * argv[]) +int otbHuMomentsImageFunction(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -89,7 +89,7 @@ return EXIT_SUCCESS; } -int otbHuMomentsImageFunctionScaleInvariant(int argc, char * argv[]) +int otbHuMomentsImageFunctionScaleInvariant(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; @@ -166,7 +166,7 @@ return EXIT_SUCCESS; } -int otbHuMomentsImageFunctionRotationInvariant(int argc, char * argv[]) +int otbHuMomentsImageFunctionRotationInvariant(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const double angleInDegrees = atoi(argv[2]); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHuPath.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHuPath.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHuPath.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHuPath.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkPolyLineParametricPath.h" #include "itkMacro.h" -int otbHuPath(int argc, char * argv[]) +int otbHuPath(int itkNotUsed(argc), char * argv[]) { unsigned int Number; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbHuPathNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbHuPathNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbHuPathNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbHuPathNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,12 +22,11 @@ #include "otbHuPathFunction.h" #include "itkPolyLineParametricPath.h" -int otbHuPathNew(int argc, char * argv[]) +int otbHuPathNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; typedef otb::HuPathFunction FunctionType; - typedef FunctionType::RealType RealType; FunctionType::Pointer function = FunctionType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include #include -int otbImageFittingPolygonListFilter(int argc, char * argv[]) +int otbImageFittingPolygonListFilter(int itkNotUsed(argc), char * argv[]) { const char * imageFileName = argv[1]; const char * polyFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageFittingPolygonListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include -int otbImageFittingPolygonListFilterNew(int argc, char * argv[]) +int otbImageFittingPolygonListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef otb::Polygon PolygonType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageFunctionAdaptor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ #include "otbLocalHistogramImageFunction.h" -int otbImageFunctionAdaptorNew(int argc, char * argv[]) +int otbImageFunctionAdaptorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef double PrecisionType; @@ -76,7 +76,7 @@ return EXIT_SUCCESS; } -int otbImageFunctionAdaptor(int argc, char * argv[]) +int otbImageFunctionAdaptor(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; @@ -407,4 +407,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToCarvingPathFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageToCarvingPathFilter.h" #include "itkPolyLineParametricPath.h" -int otbImageToCarvingPathFilterNew(int argc, char* argv[]) +int otbImageToCarvingPathFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageToEdgePathFilter(int argc, char * argv[]) +int otbImageToEdgePathFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -57,7 +57,6 @@ typedef PathType::VertexType VertexType; typedef PathType::VertexListType VertexListType; - typedef PathType::VertexListType::ConstIterator VertexListConstIterator; typedef VertexListType::ConstPointer VertexListTypePointer; VertexListTypePointer vertexList; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToEdgePathFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageToEdgePathFilter.h" #include "otbImage.h" -int otbImageToEdgePathFilterNew(int argc, char * argv[]) +int otbImageToEdgePathFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "itkPointSet.h" #include "itkVariableLengthVector.h" -int otbImageToFastSIFTKeyPointSetFilterNew(int argc, char * argv[]) +int otbImageToFastSIFTKeyPointSetFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float RealType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ return lexicographical_compare(a.begin(), a.begin() + 2, b.begin(), b.begin() + 2); } -int otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[]) +int otbImageToFastSIFTKeyPointSetFilterOutputDescriptorAscii(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ return lexicographical_compare(a.begin(), a.begin() + 2, b.begin(), b.begin() + 2); } -int otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii(int argc, char * argv[]) +int otbImageToFastSIFTKeyPointSetFilterOutputInterestPointAscii(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageToHessianDeterminantImageFilter(int argc, char * argv[]) +int otbImageToHessianDeterminantImageFilter(int itkNotUsed(argc), char * argv[]) { const char * ifname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToHessianDeterminantImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageToHessianDeterminantImageFilter.h" #include "otbImage.h" -int otbImageToHessianDeterminantImageFilterNew(int argc, char * argv[]) +int otbImageToHessianDeterminantImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterDistanceMap.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -225,8 +225,8 @@ } OutputImageType::Pointer invContrast(OutputImageType::Pointer input, - const unsigned int contrastMin, - const unsigned int contrastMax) + const unsigned int itkNotUsed(contrastMin), + const unsigned int itkNotUsed(contrastMax)) { return input; } diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "itkPointSet.h" #include "itkVariableLengthVector.h" -int otbImageToSIFTKeyPointSetFilterNew(int argc, char * argv[]) +int otbImageToSIFTKeyPointSetFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float RealType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputAscii.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkRGBPixel.h" #include "itkImageRegionIterator.h" -int otbImageToSIFTKeyPointSetFilterOutputAscii(int argc, char * argv[]) +int otbImageToSIFTKeyPointSetFilterOutputAscii(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkRGBPixel.h" #include "itkImageRegionIterator.h" -int otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii(int argc, char * argv[]) +int otbImageToSIFTKeyPointSetFilterOutputDescriptorAscii(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputImage.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include #include -int otbImageToSIFTKeyPointSetFilterOutputImage(int argc, char * argv[]) +int otbImageToSIFTKeyPointSetFilterOutputImage(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outputImageFilename = argv[2]; @@ -68,8 +68,6 @@ ImageType::OffsetType r = {{-1, 0}}; typedef unsigned char PixelType; - typedef otb::Image UCharImageType; - typedef itk::RGBPixel RGBPixelType; typedef otb::Image OutputImageType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkRGBPixel.h" #include "itkImageRegionIterator.h" -int otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii(int argc, char * argv[]) +int otbImageToSIFTKeyPointSetFilterOutputInterestPointAscii(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; @@ -49,8 +49,6 @@ typedef PointSetType::PointsContainer PointsContainerType; typedef PointsContainerType::Iterator PointsIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; - typedef PointDataContainerType::Iterator PointDataIteratorType; // Instantiating object ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkPointSet.h" #include "itkVariableLengthVector.h" -int otbImageToSURFKeyPointSetFilterNew(int argc, char * argv[]) +int otbImageToSURFKeyPointSetFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbImageToSURFKeyPointSetFilterOutputInterestPointAscii.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,8 +56,6 @@ typedef otb::ImageToSURFKeyPointSetFilter ImageToSURFKeyPointSetFilterType; typedef PointSetType::PointsContainer PointsContainerType; typedef PointsContainerType::Iterator PointsIteratorType; - typedef PointSetType::PointDataContainer PointDataContainerType; - typedef PointDataContainerType::Iterator PointDataIteratorType; // Instantiating object ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include #include -int otbKeyPointSetsMatchingFilter(int argc, char* argv[]) +int otbKeyPointSetsMatchingFilter(int itkNotUsed(argc), char* argv[]) { const char * outfname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbKeyPointSetsMatchingFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkVariableLengthVector.h" #include "otbKeyPointSetsMatchingFilter.h" -int otbKeyPointSetsMatchingFilterNew(int argc, char * argv[]) +int otbKeyPointSetsMatchingFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float RealType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLandmarkNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkVariableLengthVector.h" #include "itkPoint.h" -int otbLandmarkNew(int argc, char* argv[]) +int otbLandmarkNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::Point PointType; typedef itk::VariableLengthVector PointDataType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include -int otbLikelihoodPathListFilter(int argc, char * argv[]) +int otbLikelihoodPathListFilter(int itkNotUsed(argc), char * argv[]) { std::cout << std::endl; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLikelihoodPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbPolyLineParametricPathWithValue.h" #include "otbImage.h" -int otbLikelihoodPathListFilterNew(int argc, char * argv[]) +int otbLikelihoodPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetector.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbLineCorrelationDetectorImageFilter.h" -int otbLineCorrelationDetector(int argc, char* argv[]) +int otbLineCorrelationDetector(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorLinear.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkLinearInterpolateImageFunction.h" -int otbLineCorrelationDetectorLinear(int argc, char* argv[]) +int otbLineCorrelationDetectorLinear(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename1 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineCorrelationDetectorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbLineCorrelationDetectorImageFilter.h" -int otbLineCorrelationDetectorNew(int argc, char* argv[]) +int otbLineCorrelationDetectorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineDetectorBaseNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbLineDetectorImageFilterBase.h" -int otbLineDetectorBaseNew(int argc, char* argv[]) +int otbLineDetectorBaseNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineRatioDetector.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbLineRatioDetectorImageFilter.h" -int otbLineRatioDetector(int argc, char* argv[]) +int otbLineRatioDetector(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorLinear.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkLinearInterpolateImageFunction.h" -int otbLineRatioDetectorLinear(int argc, char* argv[]) +int otbLineRatioDetectorLinear(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename1 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineRatioDetectorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImage.h" #include "otbLineRatioDetectorImageFilter.h" -int otbLineRatioDetectorNew(int argc, char* argv[]) +int otbLineRatioDetectorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSegmentDetector.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorDataFileWriter.h" #include "otbImageFileWriter.h" -int otbLineSegmentDetectorNew(int argc, char * argv[]) +int otbLineSegmentDetectorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float InputPixelType; @@ -98,7 +98,7 @@ return EXIT_SUCCESS; } -int otbLineSegmentDetector_8b_16b_compare(int argc, char * argv[]) +int otbLineSegmentDetector_8b_16b_compare(int itkNotUsed(argc), char * argv[]) { const char * infname8 = argv[1]; const char * infname16 = argv[2]; @@ -110,13 +110,11 @@ typedef otb::Image ImageType8; typedef otb::ImageFileReader ReaderType8; typedef otb::LineSegmentDetector LSDFilterType8; - typedef otb::ImageFileWriter WriterType8; typedef unsigned short PixelType16; typedef otb::Image ImageType16; typedef otb::ImageFileReader ReaderType16; typedef otb::LineSegmentDetector LSDFilterType16; - typedef otb::ImageFileWriter WriterType16; typedef LSDFilterType8::VectorDataType VectorDataType; typedef otb::VectorDataFileWriter VectorDataWriterType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include #include -int otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii(int argc, char * argv[]) +int otbLineSpatialObjectListToRightAnglePointSetFilterByStepsOutputAscii(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include #include -int otbLineSpatialObjectListToRightAnglePointSetFilter(int argc, char * argv[]) +int otbLineSpatialObjectListToRightAnglePointSetFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLineSpatialObjectListToRightAnglePointSetFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbLineSpatialObjectList.h" #include "itkPointSet.h" -int otbLineSpatialObjectListToRightAnglePointSetFilterNew(int argc, char * argv[]) +int otbLineSpatialObjectListToRightAnglePointSetFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef float PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLinkPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include #include -int otbLinkPathListFilter(int argc, char * argv[]) +int otbLinkPathListFilter(int itkNotUsed(argc), char * argv[]) { std::cout << std::endl; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLinkPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "itkPolyLineParametricPath.h" #include -int otbLinkPathListFilterNew(int argc, char * argv[]) +int otbLinkPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include "otbLocalHistogramImageFunction.h" -int otbLocalHistogramImageFunctionNew(int argc, char * argv[]) +int otbLocalHistogramImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionTest.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionTest.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHistogramImageFunctionTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbLocalHistogramImageFunction.h" -int otbLocalHistogramImageFunctionTest(int argc, char * argv[]) +int otbLocalHistogramImageFunctionTest(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHough.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHough.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHough.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHough.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ #include #include -int otbLocalHough(int argc, char* argv[]) +int otbLocalHough(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHoughDraw.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ #include "itkRescaleIntensityImageFilter.h" -int otbLocalHoughDraw(int argc, char* argv[]) +int otbLocalHoughDraw(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbLocalHoughNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbLocalHoughFilter.h" -int otbLocalHoughNew(int argc, char* argv[]) +int otbLocalHoughNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbMetaImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,14 +36,14 @@ typedef MetaImageFunctionType::PointType PointType; typedef MetaImageFunctionType::OutputType OutputType; -int otbMetaImageFunctionNew(int argc, char * argv[]) +int otbMetaImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { MetaImageFunctionType::Pointer function = MetaImageFunctionType::New(); return EXIT_SUCCESS; } -int otbMetaImageFunction(int argc, char * argv[]) +int otbMetaImageFunction(int itkNotUsed(argc), char * argv[]) { // Read the input image ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbModulusAndDirectionImageFiltersNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageToModulusAndDirectionImageFilter.h" #include "otbModulusAndDirectionImageToImageFilter.h" -int otbModulusAndDirectionImageFiltersNew(int argc, char* argv[]) +int otbModulusAndDirectionImageFiltersNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbMultiplyByScalarImageTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkImageRegionIteratorWithIndex.h" #include "otbMultiplyByScalarImageFilter.h" -int otbMultiplyByScalarImageFilterTest(int argc, char * argv[]) +int otbMultiplyByScalarImageFilterTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // Define the dimension of the images const unsigned int ImageDimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "itkGradientRecursiveGaussianImageFilter.h" -int otbNeighborhoodScalarProductFilter(int argc, char * argv[]) +int otbNeighborhoodScalarProductFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; @@ -39,7 +39,6 @@ typedef otb::NeighborhoodScalarProductFilter FilterType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; - typedef otb::ImageFileWriter TempWriter; typedef itk::GradientRecursiveGaussianImageFilter GradientFilterType; // Instantiating object diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbNeighborhoodScalarProductFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbNeighborhoodScalarProductFilter.h" #include "otbImage.h" -int otbNeighborhoodScalarProductFilterNew(int argc, char * argv[]) +int otbNeighborhoodScalarProductFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbNonMaxRemovalByDirectionFilter(int argc, char * argv[]) +int otbNonMaxRemovalByDirectionFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbNonMaxRemovalByDirectionFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbNonMaxRemovalByDirectionFilter.h" #include "otbImage.h" -int otbNonMaxRemovalByDirectionFilterNew(int argc, char * argv[]) +int otbNonMaxRemovalByDirectionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbOrientationPath.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbOrientationPath.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbOrientationPath.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbOrientationPath.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkPolyLineParametricPath.h" #include "itkMacro.h" -int otbOrientationPath(int argc, char * argv[]) +int otbOrientationPath(int itkNotUsed(argc), char * argv[]) { double Theta((double) ::atof(argv[1])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbOrientationPathNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkPolyLineParametricPath.h" #include "itkMacro.h" -int otbOrientationPathNew(int argc, char * argv[]) +int otbOrientationPathNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkPolyLineParametricPath.h" #include -int otbParallelLinePathListFilter(int argc, char * argv[]) +int otbParallelLinePathListFilter(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // We create some lines diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbParallelLinePathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkPolyLineParametricPath.h" #include -int otbParallelLinePathListFilterNew(int argc, char * argv[]) +int otbParallelLinePathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirection.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbPixelSuppressionByDirectionImageFilter.h" -int otbPixelSuppressionByDirection(int argc, char* argv[]) +int otbPixelSuppressionByDirection(int itkNotUsed(argc), char* argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbPixelSuppressionByDirectionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbPixelSuppressionByDirectionImageFilter.h" -int otbPixelSuppressionByDirectionNew(int argc, char* argv[]) +int otbPixelSuppressionByDirectionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef double OutputPixelType; @@ -35,10 +35,6 @@ typedef otb::Image InputImageType; typedef otb::Image OutputImageType; - typedef otb::ImageFileReader ReaderType1; - typedef otb::ImageFileReader ReaderType2; - typedef otb::ImageFileWriter WriterType; - typedef otb::PixelSuppressionByDirectionImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "otbRadiometricMomentsImageFilter.h" -int otbRadiometricMomentsImageFilterNew(int argc, char * argv[]) +int otbRadiometricMomentsImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float InputPixelType; const unsigned int Dimension = 2; @@ -40,7 +40,7 @@ return EXIT_SUCCESS; } -int otbRadiometricMomentsImageFilter(int argc, char * argv[]) +int otbRadiometricMomentsImageFilter(int itkNotUsed(argc), char * argv[]) { typedef float InputPixelType; const unsigned int Dimension = 2; @@ -69,4 +69,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRadiometricMomentsImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileReader.h" #include "otbRadiometricMomentsImageFunction.h" -int otbRadiometricMomentsImageFunctionNew(int argc, char * argv[]) +int otbRadiometricMomentsImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; const unsigned int Dimension = 2; @@ -44,7 +44,7 @@ } -int otbRadiometricMomentsImageFunction(int argc, char * argv[]) +int otbRadiometricMomentsImageFunction(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRealMomentsImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRealMomentsImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRealMomentsImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRealMomentsImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileReader.h" #include "otbRealMomentsImageFunction.h" -int otbRealMomentsImageFunctionNew(int argc, char * argv[]) +int otbRealMomentsImageFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; const unsigned int Dimension = 2; @@ -43,7 +43,7 @@ return EXIT_SUCCESS; } -int otbRealMomentsImageFunction(int argc, char * argv[]) +int otbRealMomentsImageFunction(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; unsigned int p((unsigned int) ::atoi(argv[2])); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include #include -int otbRegionImageToRectangularPathListFilter(int argc, char * argv[]) +int otbRegionImageToRectangularPathListFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRegionImageToRectangularPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "itkPolyLineParametricPath.h" -int otbRegionImageToRectangularPathListFilterNew(int argc, char * argv[]) +int otbRegionImageToRectangularPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned short InputPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveCarvingPathFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbRemoveCarvingPathFilter.h" #include "itkPolyLineParametricPath.h" -int otbRemoveCarvingPathFilterNew(int argc, char* argv[]) +int otbRemoveCarvingPathFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbRemoveIsolatedByDirectionFilter(int argc, char * argv[]) +int otbRemoveIsolatedByDirectionFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveIsolatedByDirectionFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbRemoveIsolatedByDirectionFilter.h" #include "otbImage.h" -int otbRemoveIsolatedByDirectionFilterNew(int argc, char * argv[]) +int otbRemoveIsolatedByDirectionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include #include -int otbRemoveTortuousPathListFilter(int argc, char * argv[]) +int otbRemoveTortuousPathListFilter(int itkNotUsed(argc), char * argv[]) { const char * outfname = argv[1]; const double threshold = atof(argv[2]); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveTortuousPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkPolyLineParametricPath.h" #include -int otbRemoveTortuousPathListFilterNew(int argc, char * argv[]) +int otbRemoveTortuousPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbRemoveWrongDirectionFilter(int argc, char * argv[]) +int otbRemoveWrongDirectionFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRemoveWrongDirectionFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbRemoveWrongDirectionFilter.h" #include "otbImage.h" -int otbRemoveWrongDirectionFilterNew(int argc, char * argv[]) +int otbRemoveWrongDirectionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbPolyLineParametricPathWithValue.h" #include "otbMath.h" -int otbRoadExtractionFilter(int argc, char * argv[]) +int otbRoadExtractionFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; @@ -37,7 +37,6 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; typedef otb::RoadExtractionFilter RoadExtractionFilterType; - typedef RoadExtractionFilterType::OutputPathListType OutputPathListType; typedef RoadExtractionFilterType::InputPixelType InputPixelType; typedef otb::DrawPathListFilter DrawPathFilterType; @@ -81,7 +80,8 @@ reader->GenerateOutputInformation(); OutputImageType::Pointer image = OutputImageType::New(); - image->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); + image->CopyInformation(reader->GetOutput()); + image->SetRegions(image->GetLargestPossibleRegion()); image->Allocate(); image->FillBuffer(0); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbRoadExtractionFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorImage.h" #include "otbRoadExtractionFilter.h" -int otbRoadExtractionFilterNew(int argc, char * argv[]) +int otbRoadExtractionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -62,14 +62,14 @@ offset[1] = offsety; filter->SetInput(reader->GetOutput()); - filter->SetNumberOfBinsPerAxis(nbBins); filter->SetRadius(sradius); filter->SetOffset(offset); otb::StandardFilterWatcher watcher(filter, "Textures filter"); + filter->SetNumberOfBinsPerAxis(nbBins); filter->SetInputImageMinimum(0); - filter->SetInputImageMaximum(256); + filter->SetInputImageMaximum(255); // Write outputs std::ostringstream oss; @@ -88,6 +88,12 @@ writer->SetFileName(oss.str()); writer->Update(); + oss.str(""); + oss << outprefix << "Dissimilarity.tif"; + writer->SetInput(filter->GetDissimilarityOutput()); + writer->SetFileName(oss.str()); + writer->Update(); + oss.str(""); oss << outprefix << "SumAverage.tif"; writer->SetInput(filter->GetSumAverageOutput()); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToAdvancedTexturesFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbScalarImageToAdvancedTexturesFilter.h" #include "otbImage.h" -int otbScalarImageToAdvancedTexturesFilterNew(int argc, char * argv[]) +int otbScalarImageToAdvancedTexturesFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToHigherOrderTexturesFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToHigherOrderTexturesFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToHigherOrderTexturesFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToHigherOrderTexturesFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ typedef RunLengthFeaturesFilterType::OffsetVector OffsetVector; typedef RunLengthFeaturesFilterType::OffsetVectorPointer OffsetVectorPointer; -int otbScalarImageToHigherOrderTexturesFilterNew(int argc, char * argv[]) +int otbScalarImageToHigherOrderTexturesFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { TexturesFilterType::Pointer filter = TexturesFilterType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,11 +55,11 @@ sradius.Fill(radius); filter->SetInput(reader->GetOutput()); - filter->SetNumberOfBinsPerAxis(nbBins); filter->SetRadius(sradius); otb::StandardFilterWatcher watcher(filter, "Textures filter"); + filter->SetNumberOfBinsPerAxis(nbBins); filter->SetInputImageMinimum(0); filter->SetInputImageMaximum(255); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToPanTexTextureFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbScalarImageToPanTexTextureFilter.h" #include "otbImage.h" -int otbScalarImageToPanTexTextureFilterNew(int argc, char * argv[]) +int otbScalarImageToPanTexTextureFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -62,14 +62,14 @@ offset[1] = offsety; filter->SetInput(reader->GetOutput()); - filter->SetNumberOfBinsPerAxis(nbBins); filter->SetRadius(sradius); filter->SetOffset(offset); otb::StandardFilterWatcher watcher(filter, "Textures filter"); + filter->SetNumberOfBinsPerAxis(nbBins); filter->SetInputImageMinimum(0); - filter->SetInputImageMaximum(256); + filter->SetInputImageMaximum(255); // Write outputs std::ostringstream oss; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbScalarImageToTexturesFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbScalarImageToTexturesFilter.h" #include "otbImage.h" -int otbScalarImageToTexturesFilterNew(int argc, char * argv[]) +int otbScalarImageToTexturesFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,13 +21,11 @@ #include "otbVectorImage.h" #include "otbImage.h" -int otbSFSTexturesImageFilterNew(int argc, char * argv[]) +int otbSFSTexturesImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::Image ImageType; - typedef otb::VectorImage VectorImageType; - //typedef otb::ImageFileWriter WriterType; typedef otb::SFSTexturesImageFilter FilterType; FilterType::Pointer filter = FilterType::New(); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbSFSTexturesImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbSFSTexturesImageFilterTest(int argc, char * argv[]) +int otbSFSTexturesImageFilterTest(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; const unsigned int Dimension = 2; @@ -40,7 +40,6 @@ double alpha = atof(argv[11]); typedef otb::Image ImageType; - typedef ImageType::PixelType InputPixelType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; typedef otb::SFSTexturesImageFilter FilterType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplePointCountStrategyTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,14 +21,13 @@ #include "otbImage.h" #include "itkVariableLengthVector.h" -int otbSimplePointCountStrategyTest(int argc, char * argv[]) +int otbSimplePointCountStrategyTest(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef float RealType; typedef otb::Image ImageType; - typedef ImageType::PointType PointType; typedef itk::VariableLengthVector RealVectorType; typedef itk::PointSet PointSetType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplifyManyPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ * of the otb::UnaryFunctorObjectListFilter */ -int otbSimplifyManyPathListFilter(int argc, char * argv[]) +int otbSimplifyManyPathListFilter(int itkNotUsed(argc), char * argv[]) { const char * outfname = argv[1]; const double tolerance = atof(argv[2]); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include #include -int otbSimplifyPathListFilter(int argc, char * argv[]) +int otbSimplifyPathListFilter(int itkNotUsed(argc), char * argv[]) { const char * outfname = argv[1]; const double tolerance = atof(argv[2]); diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbSimplifyPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkPolyLineParametricPath.h" #include -int otbSimplifyPathListFilterNew(int argc, char * argv[]) +int otbSimplifyPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef itk::PolyLineParametricPath PathType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbSqrtSpectralAngleImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbSqrtSpectralAngleImageFilter(int argc, char * argv[]) +int otbSqrtSpectralAngleImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbStreamingLineSegmentDetector.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbStreamingLineSegmentDetector.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbStreamingLineSegmentDetector.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbStreamingLineSegmentDetector.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbPersistentImageToVectorDataFilter.h" #include "otbPersistentFilterStreamingDecorator.h" -int otbStreamingLineSegmentDetectorNew(int argc, char * argv[]) +int otbStreamingLineSegmentDetectorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef float InputPixelType; const unsigned int Dimension = 2; @@ -40,7 +40,7 @@ return EXIT_SUCCESS; } -int otbStreamingLineSegmentDetector(int argc, char * argv[]) +int otbStreamingLineSegmentDetector(int itkNotUsed(argc), char * argv[]) { typedef float InputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbTextureFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbTextureFunctors.h" template -int generic_TextureFunctor(int argc, char * argv[]) +int generic_TextureFunctor(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbTextureImageFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbTextureFunctors.h" template -int generic_TextureImageFunction(int argc, char * argv[]) +int generic_TextureImageFunction(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include -int otbThresholdImageToPointSetFilterNew(int argc, char* argv[]) +int otbThresholdImageToPointSetFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbThresholdImageToPointSetTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbThresholdImageToPointSetFilter.h" #include "itkPointSet.h" -int otbThresholdImageToPointSetTest(int argc, char * argv[]) +int otbThresholdImageToPointSetTest(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetector.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbTouziEdgeDetectorImageFilter.h" -int otbTouziEdgeDetector(int argc, char* argv[]) +int otbTouziEdgeDetector(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorDirection.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbTouziEdgeDetectorImageFilter.h" -int otbTouziEdgeDetectorDirection(int argc, char* argv[]) +int otbTouziEdgeDetectorDirection(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbTouziEdgeDetectorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbTouziEdgeDetectorImageFilter.h" -int otbTouziEdgeDetectorNew(int argc, char* argv[]) +int otbTouziEdgeDetectorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,15 +22,13 @@ #include "otbImageFileWriter.h" #include "otbUrbanAreaDetectionImageFilter.h" -int otbUrbanAreaDetectionImageFilter(int argc, char * argv[]) +int otbUrbanAreaDetectionImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage InputVectorImageType; typedef otb::Image OutputImageType; - typedef otb::Image SingleImageType; - typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbUrbanAreaDetectionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbVectorImage.h" #include "otbUrbanAreaDetectionImageFilter.h" -int otbUrbanAreaDetectionImageFilterNew(int argc, char * argv[]) +int otbUrbanAreaDetectionImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbVectorDataToRightAngleVectorDataFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbVectorDataToRightAngleVectorDataFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbVectorDataToRightAngleVectorDataFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbVectorDataToRightAngleVectorDataFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbMath.h" -int otbVectorDataToRightAngleVectorDataFilterNew(int argc, char * argv[]) +int otbVectorDataToRightAngleVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { /** Typedefs */ typedef otb::VectorData< > VectorDataType; @@ -42,7 +42,7 @@ } -int otbVectorDataToRightAngleVectorDataFilter(int argc, char * argv[]) +int otbVectorDataToRightAngleVectorDataFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; @@ -71,4 +71,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbDrawPathListFilter.h" #include "otbImageFileWriter.h" -int otbVectorizationPathListFilter(int argc, char * argv[]) +int otbVectorizationPathListFilter(int itkNotUsed(argc), char * argv[]) { const char * modfname = argv[1]; const char * dirfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx otb-4.2.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx --- otb-4.0.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/FeatureExtraction/otbVectorizationPathListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "itkPolyLineParametricPath.h" -int otbVectorizationPathListFilterNew(int argc, char * argv[]) +int otbVectorizationPathListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Fusion/otbBayesianFusionFilter.cxx otb-4.2.0/Testing/Code/Fusion/otbBayesianFusionFilter.cxx --- otb-4.0.0/Testing/Code/Fusion/otbBayesianFusionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fusion/otbBayesianFusionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbBayesianFusionFilter.h" -int otbBayesianFusionFilter(int argc, char * argv[]) +int otbBayesianFusionFilter(int itkNotUsed(argc), char * argv[]) { const char * multispect = argv[1]; const char * multispectinterp = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx otb-4.2.0/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx --- otb-4.0.0/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fusion/otbBayesianFusionFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbBayesianFusionFilter.h" -int otbBayesianFusionFilterNew(int argc, char * argv[]) +int otbBayesianFusionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; @@ -35,10 +35,6 @@ typedef otb::Image PanchroImageType; - typedef otb::ImageFileReader - VectorReaderType; - typedef otb::ImageFileReader - ImageReaderType; typedef otb::BayesianFusionFilter FilterType; FilterType::Pointer filter = FilterType::New(); diff -Nru otb-4.0.0/Testing/Code/Fusion/otbFusionImageBaseNew.cxx otb-4.2.0/Testing/Code/Fusion/otbFusionImageBaseNew.cxx --- otb-4.0.0/Testing/Code/Fusion/otbFusionImageBaseNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fusion/otbFusionImageBaseNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ }; } -int otbFusionImageBaseNew(int argc, char * argv[]) +int otbFusionImageBaseNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.cxx otb-4.2.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.cxx --- otb-4.0.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbLmvmPanSharpeningFusionImageFilter.h" -int otbLmvmPanSharpeningFusionImageFilter(int argc, char * argv[]) +int otbLmvmPanSharpeningFusionImageFilter(int itkNotUsed(argc), char * argv[]) { const char * panchro = argv[1]; const char * multispect = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilterNew.cxx otb-4.2.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fusion/otbLmvmPanSharpeningFusionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,15 +24,13 @@ #include "otbLmvmPanSharpeningFusionImageFilter.h" -int otbLmvmPanSharpeningFusionImageFilterNew(int argc, char * argv[]) +int otbLmvmPanSharpeningFusionImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage VectorImageType; typedef otb::Image PanchroImageType; - typedef otb::ImageFileReader VectorReaderType; - typedef otb::ImageFileReader ImageReaderType; typedef otb::LmvmPanSharpeningFusionImageFilter FilterType; diff -Nru otb-4.0.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx otb-4.2.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx --- otb-4.0.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSimpleRcsPanSharpeningFusionImageFilter.h" -int otbSimpleRcsPanSharpeningFusionImageFilter(int argc, char * argv[]) +int otbSimpleRcsPanSharpeningFusionImageFilter(int itkNotUsed(argc), char * argv[]) { const char * panchro = argv[1]; const char * multispect = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx otb-4.2.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fusion/otbSimpleRcsPanSharpeningFusionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,15 +24,13 @@ #include "otbSimpleRcsPanSharpeningFusionImageFilter.h" -int otbSimpleRcsPanSharpeningFusionImageFilterNew(int argc, char * argv[]) +int otbSimpleRcsPanSharpeningFusionImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; typedef otb::VectorImage VectorImageType; typedef otb::Image PanchroImageType; - typedef otb::ImageFileReader VectorReaderType; - typedef otb::ImageFileReader ImageReaderType; typedef otb::SimpleRcsPanSharpeningFusionImageFilter FilterType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbConfusionMatrixToMassOfBeliefTest.cxx otb-4.2.0/Testing/Code/Fuzzy/otbConfusionMatrixToMassOfBeliefTest.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbConfusionMatrixToMassOfBeliefTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbConfusionMatrixToMassOfBeliefTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbConfusionMatrixToMassOfBelief.h" -int otbConfusionMatrixToMassOfBeliefNew(int argc, char* argv[]) +int otbConfusionMatrixToMassOfBeliefNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef unsigned long ConfusionMatrixEltType; typedef itk::VariableSizeMatrix ConfusionMatrixType; @@ -51,7 +51,7 @@ } -int otbConfusionMatrixToMassOfBeliefTest(int argc, char* argv[]) +int otbConfusionMatrixToMassOfBeliefTest(int itkNotUsed(argc), char* argv[]) { typedef unsigned long ConfusionMatrixEltType; typedef itk::VariableSizeMatrix ConfusionMatrixType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbDempsterShaferFusionTests.cxx otb-4.2.0/Testing/Code/Fuzzy/otbDempsterShaferFusionTests.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbDempsterShaferFusionTests.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbDempsterShaferFusionTests.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -183,7 +183,7 @@ // OPTIMIZED RECURSIVE DS FUSION WITH CONFUSION MATRICES -int otbDempsterShaferFusionOptRecConfMatTest(int argc, char * argv[]) +int otbDempsterShaferFusionOptRecConfMatTest(int itkNotUsed(argc), char * argv[]) { unsigned int nbClassifiers = 6; @@ -1360,7 +1360,7 @@ vectorAllLabels.push_back(argv[it]); } - unsigned int nbClasses = vectorAllLabels.size(); +// unsigned int nbClasses = vectorAllLabels.size(); MassOfBeliefFunctionType::LabelSetType universe, labelSet; typedef std::map LabelSetMapType; @@ -1947,7 +1947,7 @@ unsigned int nbParameters = 1; unsigned int nbClassifiers = (argc - 1 - nbParameters); - IntLabelPixelType undefinedValue = 0; +// IntLabelPixelType undefinedValue = 0; std::string massOfBeliefDefMethodStr = argv[argc - 4]; MassOfBeliefDefinitionMethod massOfBeliefDefMethod; @@ -2067,7 +2067,7 @@ } // Number of classes in the universe - unsigned int nbClasses = universe.size(); +// unsigned int nbClasses = universe.size(); IntMassOfBeliefFunctionType::LabelSetType universeSet, labelSet; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbDSFusionOfClassifiersImageFilterTest.cxx otb-4.2.0/Testing/Code/Fuzzy/otbDSFusionOfClassifiersImageFilterTest.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbDSFusionOfClassifiersImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbDSFusionOfClassifiersImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -157,7 +157,7 @@ -int otbDSFusionOfClassifiersImageFilterNew(int argc, char* argv[]) +int otbDSFusionOfClassifiersImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyDescriptorsModelManager.cxx otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyDescriptorsModelManager.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyDescriptorsModelManager.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyDescriptorsModelManager.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,16 +20,16 @@ #include "otbFuzzyDescriptorsModelManager.h" #include #include +#include "itkMacro.h" - -int otbFuzzyDescriptorsModelManagerNew(int argc, char* argv[]) +int otbFuzzyDescriptorsModelManagerNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { otb::FuzzyDescriptorsModelManager mng; return EXIT_SUCCESS; } -int otbFuzzyDescriptorsModelManagerTest(int argc, char* argv[]) +int otbFuzzyDescriptorsModelManagerTest(int itkNotUsed(argc), char* argv[]) { otb::FuzzyDescriptorsModelManager::DescriptorsModelType model; otb::FuzzyDescriptorsModelManager::ParameterType param; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariable2Values.cxx otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariable2Values.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariable2Values.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariable2Values.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbFuzzyVariable.h" -int otbFuzzyVariable2Values(int argc, char* argv[]) +int otbFuzzyVariable2Values(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef float PrecisionType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableDSApplied.cxx otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableDSApplied.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableDSApplied.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableDSApplied.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbFuzzyVariable.h" -int otbFuzzyVariableDSApplied(int argc, char* argv[]) +int otbFuzzyVariableDSApplied(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef float PrecisionType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableGetMaxVar.cxx otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableGetMaxVar.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableGetMaxVar.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableGetMaxVar.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbFuzzyVariable.h" -int otbFuzzyVariableGetMaxVar(int argc, char* argv[]) +int otbFuzzyVariableGetMaxVar(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef float PrecisionType; typedef otb::FuzzyVariable FuzzyVarType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableNew.cxx otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableNew.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbFuzzyVariable.h" -int otbFuzzyVariableNew(int argc, char* argv[]) +int otbFuzzyVariableNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef float PrecisionType; typedef unsigned short LabelType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableSetValue.cxx otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableSetValue.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbFuzzyVariableSetValue.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbFuzzyVariableSetValue.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbFuzzyVariable.h" -int otbFuzzyVariableSetValue(int argc, char* argv[]) +int otbFuzzyVariableSetValue(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef float PrecisionType; typedef otb::FuzzyVariable FuzzyVarType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbJointMassOfBeliefFilter.cxx otb-4.2.0/Testing/Code/Fuzzy/otbJointMassOfBeliefFilter.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbJointMassOfBeliefFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbJointMassOfBeliefFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbJointMassOfBeliefFilter.h" #include "otbMath.h" -int otbJointMassOfBeliefFilter(int argc, char* argv[]) +int otbJointMassOfBeliefFilter(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef otb::MassOfBelief MassOfBeliefFunctionType; typedef otb::JointMassOfBeliefFilter JointMassOfBeliefFilterType; @@ -111,7 +111,7 @@ return EXIT_SUCCESS; } -int otbJointMassOfBeliefFilterLimit(int argc, char* argv[]) +int otbJointMassOfBeliefFilterLimit(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef otb::MassOfBelief MassOfBeliefFunctionType; typedef otb::JointMassOfBeliefFilter JointMassOfBeliefFilterType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbMassOfBelief.cxx otb-4.2.0/Testing/Code/Fuzzy/otbMassOfBelief.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbMassOfBelief.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbMassOfBelief.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ return os; } -int otbMassOfBelief(int argc, char* argv[]) +int otbMassOfBelief(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { // Instantiate function MassOfBeliefFunctionType::Pointer massFunction = MassOfBeliefFunctionType::New(); diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbMassOfBeliefDSApplied.cxx otb-4.2.0/Testing/Code/Fuzzy/otbMassOfBeliefDSApplied.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbMassOfBeliefDSApplied.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbMassOfBeliefDSApplied.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ return os; } -int otbMassOfBeliefDSApplied(int argc, char* argv[]) +int otbMassOfBeliefDSApplied(int itkNotUsed(argc), char* argv[]) { const char * hyp_1 = argv[1]; const char * hyp_2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbStandardDSCostFunction.cxx otb-4.2.0/Testing/Code/Fuzzy/otbStandardDSCostFunction.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbStandardDSCostFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbStandardDSCostFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorData.h" #include "otbVectorDataToDSValidatedVectorDataFilter.h" -int otbStandardDSCostFunctionNew(int argc, char* argv[]) +int otbStandardDSCostFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PrecisionType; typedef otb::VectorData VectorDataType; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.cxx otb-4.2.0/Testing/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbVectorDataToDSValidatedVectorDataFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbVectorDataFileWriter.h" #include "otbFuzzyDescriptorsModelManager.h" -int otbVectorDataToDSValidatedVectorDataFilterNew(int argc, char* argv[]) +int otbVectorDataToDSValidatedVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef float PrecisionType; typedef otb::VectorData VectorDataType; @@ -41,7 +41,7 @@ return EXIT_SUCCESS; } -int otbVectorDataToDSValidatedVectorDataFilter(int argc, char* argv[]) +int otbVectorDataToDSValidatedVectorDataFilter(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * outputVD = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbVectorDataToRoadDescriptionFilter.cxx otb-4.2.0/Testing/Code/Fuzzy/otbVectorDataToRoadDescriptionFilter.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbVectorDataToRoadDescriptionFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbVectorDataToRoadDescriptionFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ -int otbVectorDataToRoadDescriptionFilterNew(int argc, char* argv[]) +int otbVectorDataToRoadDescriptionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PrecisionType; typedef otb::VectorData VectorDataType; @@ -51,7 +51,7 @@ return EXIT_SUCCESS; } -int otbVectorDataToRoadDescriptionFilter(int argc, char* argv[]) +int otbVectorDataToRoadDescriptionFilter(int itkNotUsed(argc), char* argv[]) { const char * inputVD = argv[1]; const char * inputImg = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Fuzzy/otbVectorDataToSpecificDescriptionFilterBase.cxx otb-4.2.0/Testing/Code/Fuzzy/otbVectorDataToSpecificDescriptionFilterBase.cxx --- otb-4.0.0/Testing/Code/Fuzzy/otbVectorDataToSpecificDescriptionFilterBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Fuzzy/otbVectorDataToSpecificDescriptionFilterBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorData.h" -int otbVectorDataToSpecificDescriptionFilterBaseNew(int argc, char* argv[]) +int otbVectorDataToSpecificDescriptionFilterBaseNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef float PrecisionType; typedef otb::VectorData VectorDataType; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbEigenvalueLikelihoodMaximization.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbEigenvalueLikelihoodMaximization.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbEigenvalueLikelihoodMaximization.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbEigenvalueLikelihoodMaximization.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ typedef otb::EigenvalueLikelihoodMaximisation ELMType; -int otbEigenvalueLikelihoodMaximizationNewTest(int argc, char * argv[]) +int otbEigenvalueLikelihoodMaximizationNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { ELMType::Pointer elm = ELMType::New(); std::cout << elm << std::endl; @@ -38,7 +38,7 @@ } -int otbEigenvalueLikelihoodMaximizationTest(int argc, char * argv[]) +int otbEigenvalueLikelihoodMaximizationTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbFullyConstrainedLeastSquareImageFilter.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbFullyConstrainedLeastSquareImageFilter.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbFullyConstrainedLeastSquareImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbFullyConstrainedLeastSquareImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,14 +32,14 @@ typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; typedef otb::ImageFileWriter WriterType; -int otbFullyConstrainedLeastSquareImageFilterNewTest(int argc, char * argv[]) +int otbFullyConstrainedLeastSquareImageFilterNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { FullyConstrainedLeastSquareSolverType::Pointer filter = FullyConstrainedLeastSquareSolverType::New(); std::cout << filter << std::endl; return EXIT_SUCCESS; } -int otbFullyConstrainedLeastSquareImageFilterTest(int argc, char * argv[]) +int otbFullyConstrainedLeastSquareImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * inputEndmembers = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbISRAUnmixingImageFilter.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbISRAUnmixingImageFilter.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbISRAUnmixingImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbISRAUnmixingImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,14 +32,14 @@ typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; typedef otb::ImageFileWriter WriterType; -int otbISRAUnmixingImageFilterNewTest(int argc, char * argv[]) +int otbISRAUnmixingImageFilterNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { UnmixingImageFilterType::Pointer filter = UnmixingImageFilterType::New(); std::cout << filter << std::endl; return EXIT_SUCCESS; } -int otbISRAUnmixingImageFilterTest(int argc, char * argv[]) +int otbISRAUnmixingImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * inputEndmembers = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbLocalRxDetectorRoiTest.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbLocalRxDetectorRoiTest.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbLocalRxDetectorRoiTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbLocalRxDetectorRoiTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -7,7 +7,7 @@ #include "otbExtractROI.h" -int LocalRXDetectorROITest(int argc, char * argv[]) +int LocalRXDetectorROITest(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; typedef otb::VectorImage VectorImageType; @@ -74,5 +74,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbLocalRxDetectorTest.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbLocalRxDetectorTest.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbLocalRxDetectorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbLocalRxDetectorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -5,7 +5,7 @@ #include "otbLocalRxDetectorFilter.h" #include "itkRescaleIntensityImageFilter.h" -int LocalRXDetectorNewTest(int argc, char * argv[]) +int LocalRXDetectorNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::VectorImage VectorImageType; @@ -16,7 +16,7 @@ return EXIT_SUCCESS; } -int LocalRXDetectorTest(int argc, char * argv[]) +int LocalRXDetectorTest(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; typedef otb::VectorImage VectorImageType; @@ -62,5 +62,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbMDMDNMFImageFilter.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbMDMDNMFImageFilter.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbMDMDNMFImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbMDMDNMFImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorImageToMatrixImageFilter.h" #include "otbStandardWriterWatcher.h" -int otbMDMDNMFImageFilterNewTest(int argc, char * argv[]) +int otbMDMDNMFImageFilterNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::VectorImage VectorImageType; @@ -32,14 +32,13 @@ return EXIT_SUCCESS; } -int otbMDMDNMFImageFilterTest(int argc, char * argv[]) +int otbMDMDNMFImageFilterTest(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; typedef otb::VectorImage ImageType; typedef otb::MDMDNMFImageFilter MDMDNMFImageFilterType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; - typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; const char * inputImage = argv[1]; const char * outputImage = argv[2]; @@ -73,7 +72,7 @@ return EXIT_SUCCESS; } -int otbMDMDNMFImageFilterTest2(int argc, char * argv[]) +int otbMDMDNMFImageFilterTest2(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; typedef otb::VectorImage ImageType; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbNCLSUnmixingImageFilter.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbNCLSUnmixingImageFilter.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbNCLSUnmixingImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbNCLSUnmixingImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,14 +32,14 @@ typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; typedef otb::ImageFileWriter WriterType; -int otbNCLSUnmixingImageFilterNewTest(int argc, char * argv[]) +int otbNCLSUnmixingImageFilterNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { UnmixingImageFilterType::Pointer filter = UnmixingImageFilterType::New(); std::cout << filter << std::endl; return EXIT_SUCCESS; } -int otbNCLSUnmixingImageFilterTest(int argc, char * argv[]) +int otbNCLSUnmixingImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * inputEndmembers = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilter.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilter.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -112,5 +112,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilterNew.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbSparseUnmixingImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSparseUnmixingImageFilter.h" -int otbSparseUnmixingImageFilterNew ( int argc, char * argv[] ) +int otbSparseUnmixingImageFilterNew ( int itkNotUsed(argc), char * itkNotUsed(argv)[]) { // number of images to consider const unsigned int nbInputImages = 2; @@ -37,5 +37,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbUnConstrainedLeastSquareImageFilter.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbUnConstrainedLeastSquareImageFilter.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbUnConstrainedLeastSquareImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbUnConstrainedLeastSquareImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,14 +31,14 @@ typedef otb::VectorImageToMatrixImageFilter VectorImageToMatrixImageFilterType; typedef otb::ImageFileWriter WriterType; -int otbUnConstrainedLeastSquareImageFilterNewTest(int argc, char * argv[]) +int otbUnConstrainedLeastSquareImageFilterNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { UnConstrainedLeastSquareSolverType::Pointer filter = UnConstrainedLeastSquareSolverType::New(); std::cout << filter << std::endl; return EXIT_SUCCESS; } -int otbUnConstrainedLeastSquareImageFilterTest(int argc, char * argv[]) +int otbUnConstrainedLeastSquareImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * inputEndmembers = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbVCAImageFilter.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbVCAImageFilter.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbVCAImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbVCAImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,14 +32,14 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; -int otbVCAImageFilterNew(int argc, char * argv[]) +int otbVCAImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { VCAFilterType::Pointer vca = VCAFilterType::New(); std::cout << vca << std::endl; return EXIT_SUCCESS; } -int otbVCAImageFilterTestHighSNR(int argc, char * argv[]) +int otbVCAImageFilterTestHighSNR(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * outputImage = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Hyperspectral/otbVirtualDimensionality.cxx otb-4.2.0/Testing/Code/Hyperspectral/otbVirtualDimensionality.cxx --- otb-4.0.0/Testing/Code/Hyperspectral/otbVirtualDimensionality.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Hyperspectral/otbVirtualDimensionality.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ typedef otb::VirtualDimensionality VDType; -int otbVirtualDimensionalityNewTest(int argc, char * argv[]) +int otbVirtualDimensionalityNewTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { VDType::Pointer vd = VDType::New(); std::cout << vd << std::endl; @@ -38,7 +38,7 @@ } -int otbVirtualDimensionalityTest(int argc, char * argv[]) +int otbVirtualDimensionalityTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/IO/CMakeLists.txt otb-4.2.0/Testing/Code/IO/CMakeLists.txt --- otb-4.0.0/Testing/Code/IO/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ set(IO_TESTS11 ${CXX_TEST_PATH}/otbIOTests11) set(IO_TESTS12 ${CXX_TEST_PATH}/otbIOTests12) -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) set(IO_TESTS13 ${CXX_TEST_PATH}/otbIOTests13) endif() @@ -71,6 +71,21 @@ PHR_JP2_DIMAPv1_PRIMARY_PMS_lossless_12bits PHR_JP2_DIMAPv1_ORTHO_PMS_lossless_12bits ) + + set(GenericTestSPOT6_DATA_INPUTS + ${GenericTestSPOT6_DATA_INPUTS} + ${LARGEINPUT}/SPOT6/SPOT6_Ortho_Bundle_12_bits/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_MS_001_A/IMG_SPOT6_MS_201306031242000_ORT_816005101_R1C1.JP2 + ${LARGEINPUT}/SPOT6/SPOT6_Ortho_Pan-sharpened_12_bits/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_PMS_001_A/IMG_SPOT6_PMS_201305251604372_ORT_816009101_R1C1.JP2 + ${LARGEINPUT}/SPOT6/SPOT6_Primary_Bundle_12_bits/PROD_SPOT6_001/VOL_SPOT6_001_A/IMG_SPOT6_MS_001_A/IMG_SPOT6_MS_201211100138085_SEN_816007101_R1C1.JP2 + ) + + set(GenericTestSPOT6_DATA_TYPES + ${GenericTestSPOT6_DATA_TYPES} + SPOT6_Ortho_Bundle_12_bits + SPOT6_Ortho_Pan-sharpened_12_bits + SPOT6_Primary_Bundle_12_bits + ) + endif() if(OTB_DATA_USE_SPOTPHRINPUT) @@ -87,7 +102,7 @@ SPOT_PHR_ORTHO_UTM_P SPOT_PHR_ORTHO_UTM_MS SPOT_PHR_ORTHO_GEO_P - SPOT_PHR_ORTHO_GEO_MS + SPOT_PHR_ORTHO_GEO_MS SPOT_PHR_PRIMARY_MS SPOT_PHR_PRIMARY_P ) @@ -947,8 +962,8 @@ ${TEMP}/ioTvImageKeywordlistErs.txt ${TEMP}/ioTvImageKeywordlistErs_saveState_loadState.txt ) -endif() +endif() if(OTB_DATA_USE_LARGEINPUT OR OTB_DATA_USE_SPOTPHRINPUT OR OTB_DATA_USE_CNESPHRINPUT) @@ -974,6 +989,29 @@ endforeach() + + set( GenericTestSPOT6_TESTNB 0) + + foreach( current_file ${GenericTestSPOT6_DATA_INPUTS} ) + list(GET GenericTestSPOT6_DATA_TYPES ${GenericTestSPOT6_TESTNB} current_type ) + math(EXPR GenericTestSPOT6_TESTNB "${GenericTestSPOT6_TESTNB} + 1") + + # Get and manipulate ImageKeywordlist + add_test(ioTvImageKeywordlist_${current_type} ${IO_TESTS4} + --ignore-order --compare-n-ascii ${NOTOL} 2 + ${BASELINE_FILES}/ioTvImageKeywordlist_${current_type}.txt + ${TEMP}/ioTvImageKeywordlist_${current_type}_OUT.txt + ${BASELINE_FILES}/ioTvImageKeywordlist_${current_type}.txt + ${TEMP}/ioTvImageKeywordlist_${current_type}_saveState_loadState_OUT.txt + --ignore-lines-with 2 meters_per_pixel_x meters_per_pixel_y + otbImageKeywordlist + ${current_file} + ${TEMP}/ioTvImageKeywordlist_${current_type}_OUT.txt + ${TEMP}/ioTvImageKeywordlist_${current_type}_saveState_loadState_OUT.txt + ) + + endforeach() + endif() @@ -1305,6 +1343,16 @@ ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2PNG_poupees.png ) +#reader writer with box parameter (extract roi) +add_test(ioTvImageReaderWriterRgbPNG2PNGBox ${IO_TESTS7} + --compare-image ${NOTOL} + ${BASELINE}/coTvExtractROI_QB.png + ${TEMP}/coTvExtractROI_QB_Box.png + otbImageFileReaderRGBTest + ${INPUTDATA}/QB_Suburb.png + ${TEMP}/coTvExtractROI_QB_Box.png?&box=0:0:70:70 + ) + add_test(ioTvImageReaderWriterRgbPNG2TIF ${IO_TESTS7} --compare-image ${EPSILON_9} ${INPUTDATA}/poupees.png ${TEMP}/ioImageReaderWriterRgbPNG2TIF_poupees.tif @@ -2025,11 +2073,11 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbIOTESTS13 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) # -------------------------------------------------------------------------------- # old test suite: - +if(OTB_USE_JPEG2000) # --- JPEG2000 can read --- add_test(ioTuJ2KImageIOCanRead ${IO_TESTS13} otbJPEG2000ImageIOTestCanRead @@ -2043,6 +2091,8 @@ ) endif() +endif() + #NOTE: baseline generated by openjpeg if(OTB_DATA_USE_LARGEINPUT) add_test(ioTvVectorImageFileReaderWriterJP22TIF ${IO_TESTS9} @@ -2217,6 +2267,7 @@ ${INPUTDATA}/bretagne.j2k?&resol=5 ${TEMP}/ioExtractROI_JPEG2K_2_TIF_bretagne_res5_OUT.tif ) +if(OTB_USE_JPEG2000) # -------------------------------------------------------------------------------- # Test the possibility to modify the size of cache used to reduce the decoding operations # O tile in the cache (500K) @@ -2257,6 +2308,7 @@ otbGenerateClassicalQLWithJPEG2000 ${INPUTDATA}/bretagne.j2k ${TEMP}/ioClassicalQLJPEG2K_bretagne_OUT.tif) +endif() # -------------------------------------------------------------------------------- # Special Case (deactivated by MSD, OpenJPEG now support the larges files so this tests is not relevant @@ -2287,7 +2339,7 @@ math(EXPR GenericTestPHR_TESTNB "${GenericTestPHR_TESTNB} + 1") string(REGEX MATCH "TIFF" PHR_TIFF_FILE ${current_type}) - if(NOT PHR_TIFF_FILE) + if((NOT PHR_TIFF_FILE) AND OTB_USE_JPEG2000) # CanRead add_test(ioTuJ2KImageIOCanRead_${current_type} ${IO_TESTS13} otbJPEG2000ImageIOTestCanRead @@ -2297,8 +2349,9 @@ # Read info from the input file add_test(ioTvVectorImageReadingInfo_${current_type} ${IO_TESTS13} - --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}.txt + --ignore-order --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}.txt ${TEMP}/ioTvMultiResolutionReading_${current_type}_OUT.txt + --ignore-lines-with 3 CacheSizeInBytes Driver Corner[ otbVectorImageTest ${current_file}?&resol=0 ${TEMP}/ioTvMultiResolutionReading_${current_type}_OUT.txt @@ -2307,8 +2360,9 @@ if(NOT PHR_TIFF_FILE) # Read info from the input file (res=5) add_test(ioTvVectorImageReadingInfo_${current_type}_res5 ${IO_TESTS13} - --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}_res5.txt + --ignore-order --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvMultiResolutionReading_${current_type}_res5.txt ${TEMP}/ioTvMultiResolutionReading_${current_type}_res5_OUT.txt + --ignore-lines-with 3 CacheSizeInBytes Driver Corner[ otbVectorImageTest ${current_file}?&resol=5 ${TEMP}/ioTvMultiResolutionReading_${current_type}_res5_OUT.txt @@ -2318,7 +2372,7 @@ if(NOT PHR_TIFF_FILE) # Extract resolution of input file add_test(ioTvMultiResolutionReadingInfo_${current_type} ${IO_TESTS13} - --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvMultiResolutionReadingInfo_${current_type}.txt + --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/ioTvMultiResolutionReadingInfo_${current_type}.txt ${TEMP}/ioTvMultiResolutionReadingInfo_${current_type}_OUT.txt otbMultiResolutionReadingInfo ${current_file} @@ -2544,7 +2598,7 @@ ) add_test(ioTvKMLVectorDataFileGeoReaderWriter2 ${IO_TESTS15} - --compare-ascii ${EPSILON_9} + --compare-ogr ${EPSILON_9} ${BASELINE_FILES}/ioTvKMLVectorDataFileGeoReaderWriterOutput2.kml ${TEMP}/ioTvKMLVectorDataFileGeoReaderWriterOutput2.kml otbVectorDataFileGeoReaderWriter @@ -2732,6 +2786,10 @@ otbPleiadesImageMetadataInterfaceNew ) +add_test(ioTuSpot6ImageMetadataInterfaceNew ${IO_TESTS18} + otbSpot6ImageMetadataInterfaceNew +) + if(OTB_DATA_USE_LARGEINPUT) #------------ ImageMetadataInterfaceBaseTest --------------- @@ -2811,6 +2869,31 @@ endforeach() +# SPOT 6 +set( GenericTestSPOT6_TESTNB 0) + +foreach( current_file ${GenericTestSPOT6_DATA_INPUTS} ) + list(GET GenericTestSPOT6_DATA_TYPES ${GenericTestSPOT6_TESTNB} current_type ) + math(EXPR GenericTestSPOT6_TESTNB "${GenericTestSPOT6_TESTNB} + 1") + + add_test(ioTvImageMetadataInterfaceBaseTest_${current_type} ${IO_TESTS18} + --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvImageMetadataInterfaceBase_${current_type}.txt + ${TEMP}/ioTvImageMetadataInterfaceBase_${current_type}_OUT.txt + otbImageMetadataInterfaceBaseTest + ${current_file} + ${TEMP}/ioTvImageMetadataInterfaceBase_${current_type}_OUT.txt + ) + + add_test(ioTvOpticalImageMetadataInterfaceTest_${current_type} ${IO_TESTS18} + --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvOpticalImageMetadataInterface_${current_type}.txt + ${TEMP}/ioTvOpticalImageMetadataInterface_${current_type}_OUT.txt + otbOpticalImageMetadataInterfaceTest + ${current_file} + ${TEMP}/ioTvOpticalImageMetadataInterface_${current_type}_OUT.txt + ) + + endforeach() + add_test(ioTvImageMetadataInterfaceBaseTest_FORMOSAT2 ${IO_TESTS18} --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvImageMetadataInterfaceBase_FORMOSAT2.txt ${TEMP}/ioTvImageMetadataInterfaceBase_FORMOSAT2.txt @@ -2856,7 +2939,6 @@ #------------ OpticalImageMetadataInterfaceTest --------------- - add_test(ioTvOpticalImageMetadataInterfaceTest_QB ${IO_TESTS18} --compare-ascii ${NOTOL} ${BASELINE_FILES}/ioTvOpticalImageMetadataInterface_QB.txt ${TEMP}/ioTvOpticalImageMetadataInterface_QB.txt @@ -3890,18 +3972,25 @@ ) -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) #Reserved for jpeg 2000 + set(BasicIO_SRCS13 otbIOTests13.cxx -otbJPEG2000ImageIOTestCanRead.cxx -otbJPEG2000ImageIOTestCanWrite.cxx otbVectorImageTest.cxx otbMultiResolutionReadingInfo.cxx +) +# add tests specific for JPEG2000ImageIO +if(OTB_USE_JPEG2000) +set(BasicIO_SRCS13 ${BasicIO_SRCS13} +otbJPEG2000ImageIOTestCanRead.cxx +otbJPEG2000ImageIOTestCanWrite.cxx otbGenerateClassicalQLWithJPEG2000.cxx ) endif() +endif() + set(BasicIO_SRCS14 otbIOTests14.cxx @@ -3951,6 +4040,7 @@ otbIOTests18.cxx otbSpotImageMetadataInterfaceNew.cxx otbPleiadesImageMetadataInterfaceNew.cxx +otbSpot6ImageMetadataInterfaceNew.cxx otbFormosatImageMetadataInterfaceNew.cxx otbQuickBirdImageMetadataInterfaceNew.cxx otbWorldView2ImageMetadataInterfaceNew.cxx @@ -4051,7 +4141,7 @@ OTB_ADD_EXECUTABLE(otbIOTests11 "${BasicIO_SRCS11}" "OTBIO;OTBTesting") OTB_ADD_EXECUTABLE(otbIOTests12 "${BasicIO_SRCS12}" "OTBIO;OTBTesting") -if(OTB_USE_JPEG2000) +if(OTB_USE_JPEG2000_TESTING) if(NOT BUILD_SHARED_LIBS) add_definitions(-DOPJ_STATIC) endif() diff -Nru otb-4.0.0/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbBSQImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbBSQImageIOTestCanRead(int argc, char* argv[]) +int otbBSQImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); bool lCanRead = lBSQImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx otb-4.2.0/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx --- otb-4.0.0/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbBSQImageIOTestCanWrite.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbBSQImageIOTestCanWrite(int argc, char* argv[]) +int otbBSQImageIOTestCanWrite(int itkNotUsed(argc), char* argv[]) { otb::BSQImageIO::Pointer lBSQImageIO = otb::BSQImageIO::New(); bool lCanRead = lBSQImageIO->CanWriteFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbComplexImageManipulationTest.cxx otb-4.2.0/Testing/Code/IO/otbComplexImageManipulationTest.cxx --- otb-4.0.0/Testing/Code/IO/otbComplexImageManipulationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbComplexImageManipulationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -117,7 +117,7 @@ * out : real = in, imag = 0 ***********/ template -int otbMonobandScalarToImageComplexGeneric(int argc, char * argv[]) +int otbMonobandScalarToImageComplexGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; typedef std::complex ComplexType; @@ -172,7 +172,7 @@ * out : norm(in) ***********/ template -int otbMonobandComplexToImageScalarGeneric(int argc, char * argv[]) +int otbMonobandComplexToImageScalarGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType InputType; typedef std::complex ComplexType; @@ -232,7 +232,7 @@ * out : in ***********/ template -int otbMonobandComplexToImageComplexGeneric(int argc, char * argv[]) +int otbMonobandComplexToImageComplexGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; typedef std::complex ComplexType; @@ -286,10 +286,9 @@ * out : [0]=in.real(), [1]=in.imag() ***********/ template -int otbMonobandComplexToVectorImageScalarGeneric(int argc, char * argv[]) +int otbMonobandComplexToVectorImageScalarGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; - typedef std::complex ComplexType; typedef otb::VectorImage ImageType; typedef typename ImageType::PixelType PixelType; @@ -345,7 +344,7 @@ * out : [0]=in ***********/ template -int otbMonobandComplexToVectorImageComplexGeneric(int argc, char * argv[]) +int otbMonobandComplexToVectorImageComplexGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; typedef std::complex ComplexType; @@ -403,7 +402,7 @@ * out : out.real=in[0], out.imag=in[1] ***********/ template -int otbMultibandScalarToImageComplexGeneric(int argc, char * argv[]) +int otbMultibandScalarToImageComplexGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; typedef std::complex ComplexType; @@ -461,7 +460,7 @@ * out : (out[0].real=in[0], out[0].imag=0), (out[1].real=in[1], out[1].imag=0), ... ***********/ template -int otbMultibandScalarToVectorImageComplexGeneric(int argc, char * argv[]) +int otbMultibandScalarToVectorImageComplexGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; typedef std::complex ComplexType; @@ -521,11 +520,9 @@ * out : out[0]=in[0].real, out[1]=in[0].imag, out[2]=in[0].real, out[3]=in[0].imag, ... ***********/ template -int otbMultibandComplexToVectorImageScalarGeneric(int argc, char * argv[]) +int otbMultibandComplexToVectorImageScalarGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; - typedef std::complex ComplexType; - typedef otb::VectorImage ImageType; typedef typename ImageType::PixelType PixelType; @@ -585,7 +582,7 @@ * out : out[0]=in[0], out[1]=in[1], ... ***********/ template -int otbMultibandComplexToVectorImageComplexGeneric(int argc, char * argv[]) +int otbMultibandComplexToVectorImageComplexGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; typedef std::complex ComplexType; @@ -649,7 +646,7 @@ * out : out[0].real=in, out[0].imag=0 ***********/ template -int otbMonobandScalarToVectorImageComplexGeneric(int argc, char * argv[]) +int otbMonobandScalarToVectorImageComplexGeneric(int itkNotUsed(argc), char * argv[]) { typedef InternalType RealType; typedef std::complex ComplexType; @@ -707,7 +704,7 @@ * out : ??? ***********/ template -int otbMultibandComplexToImageScalarGeneric(int argc, char * argv[]) +int otbMultibandComplexToImageScalarGeneric(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // This case is not handled yet. // We need more time to decide what we want to do with this case. ( perhaps return exception ???) @@ -736,4 +733,3 @@ { return otbMultibandComplexToImageScalarGeneric(argc, argv); } - diff -Nru otb-4.0.0/Testing/Code/IO/otbComplexImageTests.cxx otb-4.2.0/Testing/Code/IO/otbComplexImageTests.cxx --- otb-4.0.0/Testing/Code/IO/otbComplexImageTests.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbComplexImageTests.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbVectorImage.h" #include "otbImageFileReader.h" -int otbVectorImageComplexNew(int argc, char* argv[]) +int otbVectorImageComplexNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef std::complex PixelType; typedef otb::VectorImage ImageType; @@ -39,7 +39,7 @@ template -int otbVectorImageComplexGenericTest(int argc, char* argv[]) +int otbVectorImageComplexGenericTest(int itkNotUsed(argc), char* argv[]) { typedef std::complex PixelType; typedef otb::VectorImage ImageType; @@ -80,7 +80,7 @@ } template -int otbImageComplexGenericTest(int argc, char* argv[]) +int otbImageComplexGenericTest(int itkNotUsed(argc), char* argv[]) { typedef std::complex PixelType; typedef otb::Image ImageType; @@ -135,7 +135,7 @@ template -int otbVectorImageComplexIntoRealGenericTest(int argc, char* argv[]) +int otbVectorImageComplexIntoRealGenericTest(int itkNotUsed(argc), char* argv[]) { typedef InternalType PixelType; typedef otb::VectorImage ImageType; diff -Nru otb-4.0.0/Testing/Code/IO/otbDefaultImageMetadataInterface.cxx otb-4.2.0/Testing/Code/IO/otbDefaultImageMetadataInterface.cxx --- otb-4.0.0/Testing/Code/IO/otbDefaultImageMetadataInterface.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbDefaultImageMetadataInterface.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkMacro.h" #include "otbDefaultImageMetadataInterface.h" -int otbDefaultImageMetadataInterface(int argc, char* argv[]) +int otbDefaultImageMetadataInterface(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef otb::DefaultImageMetadataInterface ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbDefaultImageMetadataInterfaceFactoryNew.cxx otb-4.2.0/Testing/Code/IO/otbDefaultImageMetadataInterfaceFactoryNew.cxx --- otb-4.0.0/Testing/Code/IO/otbDefaultImageMetadataInterfaceFactoryNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbDefaultImageMetadataInterfaceFactoryNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbDefaultImageMetadataInterfaceFactory.h" -int otbDefaultImageMetadataInterfaceFactoryNew(int argc, char* argv[]) +int otbDefaultImageMetadataInterfaceFactoryNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::DefaultImageMetadataInterfaceFactory ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx otb-4.2.0/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx --- otb-4.0.0/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbDEMToImageGeneratorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbDEMToImageGenerator.h" #include "otbImage.h" -int otbDEMToImageGeneratorNew(int argc, char * argv[]) +int otbDEMToImageGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/IO/otbDoubleImageIOTest.cxx otb-4.2.0/Testing/Code/IO/otbDoubleImageIOTest.cxx --- otb-4.0.0/Testing/Code/IO/otbDoubleImageIOTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbDoubleImageIOTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbDoubleImageIOTest(int argc, char* argv[]) +int otbDoubleImageIOTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbExtendedFilenameTest.cxx otb-4.2.0/Testing/Code/IO/otbExtendedFilenameTest.cxx --- otb-4.0.0/Testing/Code/IO/otbExtendedFilenameTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbExtendedFilenameTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileReaderWithExtendedFilename(int argc, char* argv[]) +int otbImageFileReaderWithExtendedFilename(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; @@ -57,7 +57,7 @@ return EXIT_SUCCESS; } -int otbImageFileWriterWithExtendedFilename(int argc, char* argv[]) +int otbImageFileWriterWithExtendedFilename(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; @@ -81,4 +81,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/IO/otbExtendedFilenameToReaderOptionsTest.cxx otb-4.2.0/Testing/Code/IO/otbExtendedFilenameToReaderOptionsTest.cxx --- otb-4.0.0/Testing/Code/IO/otbExtendedFilenameToReaderOptionsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbExtendedFilenameToReaderOptionsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ typedef otb::ExtendedFilenameToReaderOptions FilenameHelperType; -int otbExtendedFilenameToReaderOptions(int argc, char* argv[]) +int otbExtendedFilenameToReaderOptions(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputExtendedFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbExtendedFilenameToWriterOptionsTest.cxx otb-4.2.0/Testing/Code/IO/otbExtendedFilenameToWriterOptionsTest.cxx --- otb-4.0.0/Testing/Code/IO/otbExtendedFilenameToWriterOptionsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbExtendedFilenameToWriterOptionsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ typedef otb::ExtendedFilenameToWriterOptions FilenameHelperType; -int otbExtendedFilenameToWriterOptions(int argc, char* argv[]) +int otbExtendedFilenameToWriterOptions(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputExtendedFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbFloatImageIOTest.cxx otb-4.2.0/Testing/Code/IO/otbFloatImageIOTest.cxx --- otb-4.0.0/Testing/Code/IO/otbFloatImageIOTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbFloatImageIOTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbFloatImageIOTest(int argc, char* argv[]) +int otbFloatImageIOTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbFormosatImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbFormosatImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbFormosatImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbFormosatImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbFormosatImageMetadataInterface.h" -int otbFormosatImageMetadataInterfaceNew(int argc, char* argv[]) +int otbFormosatImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::FormosatImageMetadataInterface::Pointer object = otb::FormosatImageMetadataInterface::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx otb-4.2.0/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx --- otb-4.0.0/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbGDALDriverDoubleWritingTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageFileWriter.h" #include "otbImageFileWriter.h" -int otbGDALDriverDoubleWritingTest(int argc, char * argv[]) +int otbGDALDriverDoubleWritingTest(int itkNotUsed(argc), char * argv[]) { const char * infname1 = argv[1]; const char * infname2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbGDALImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbGDALImageIOTestCanRead(int argc, char* argv[]) +int otbGDALImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); bool lCanRead = lGDALImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx otb-4.2.0/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx --- otb-4.0.0/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbGDALImageIOTestCanWrite.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbGDALImageIOTestCanWrite(int argc, char* argv[]) +int otbGDALImageIOTestCanWrite(int itkNotUsed(argc), char* argv[]) { otb::GDALImageIO::Pointer lGDALImageIO = otb::GDALImageIO::New(); bool lCanWrite = lGDALImageIO->CanWriteFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbGDALImageIOTestWriteMetadata.cxx otb-4.2.0/Testing/Code/IO/otbGDALImageIOTestWriteMetadata.cxx --- otb-4.0.0/Testing/Code/IO/otbGDALImageIOTestWriteMetadata.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbGDALImageIOTestWriteMetadata.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,6 +23,7 @@ #include "gdal_priv.h" #include "cpl_string.h" #include "ogr_spatialref.h" +#include "itkMacro.h" // Class to store ProjRef, GEOTransform and GCP info class DatasetInfoGDAL @@ -128,7 +129,7 @@ std::ostream& os); /////// // MAIN -int otbGDALImageIOTestWriteMetadata(int argc, char * argv[]) +int otbGDALImageIOTestWriteMetadata(int itkNotUsed(argc), char * argv[]) { // Parameters std::string filenameTIFF = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbGDALOverviewsBuilder.cxx otb-4.2.0/Testing/Code/IO/otbGDALOverviewsBuilder.cxx --- otb-4.0.0/Testing/Code/IO/otbGDALOverviewsBuilder.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbGDALOverviewsBuilder.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ using namespace otb; -int otbGDALOverviewsBuilderNew(int argc, char* argv[]) +int otbGDALOverviewsBuilderNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef otb::GDALOverviewsBuilder GDALOverviewsBuilderType; GDALOverviewsBuilderType::Pointer object = GDALOverviewsBuilderType::New(); @@ -32,7 +32,7 @@ return EXIT_SUCCESS; } -int otbGDALOverviewsBuilder(int argc, char* argv[]) +int otbGDALOverviewsBuilder(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; int nbResolution = atoi(argv[2]); diff -Nru otb-4.0.0/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbIkonosImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbIkonosImageMetadataInterface.h" -int otbIkonosImageMetadataInterfaceNew(int argc, char* argv[]) +int otbIkonosImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::IkonosImageMetadataInterface::Pointer object = otb::IkonosImageMetadataInterface::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderMSTAR.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderMSTAR.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderMSTAR.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderMSTAR.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkRescaleIntensityImageFilter.h" -int otbImageFileReaderMSTAR(int argc, char* argv[]) +int otbImageFileReaderMSTAR(int itkNotUsed(argc), char* argv[]) { typedef float InputPixelType; typedef unsigned char OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderONERAComplex.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileWriter.h" #include "otbExtractROI.h" -int otbImageFileReaderONERAComplex(int argc, char* argv[]) +int otbImageFileReaderONERAComplex(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADChar.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADChar.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADChar.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADChar.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbExtractROI.h" -int otbImageFileReaderRADChar(int argc, char* argv[]) +int otbImageFileReaderRADChar(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexDouble.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbExtractROI.h" -int otbImageFileReaderRADComplexDouble(int argc, char* argv[]) +int otbImageFileReaderRADComplexDouble(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexFloat.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbExtractROI.h" -int otbImageFileReaderRADComplexFloat(int argc, char* argv[]) +int otbImageFileReaderRADComplexFloat(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexFloatExtract.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbComplexToVectorImageCastFilter.h" -int otbImageFileReaderRADComplexFloatExtract(int argc, char* argv[]) +int otbImageFileReaderRADComplexFloatExtract(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; @@ -41,7 +41,6 @@ typedef otb::Image InputImageType; typedef otb::Image OutputCplxImageType; - typedef otb::Image OutputScalarImageType; typedef otb::VectorImage OutputImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADComplexInt.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbExtractROI.h" -int otbImageFileReaderRADComplexInt(int argc, char* argv[]) +int otbImageFileReaderRADComplexInt(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADFloat.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADFloat.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADFloat.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADFloat.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileReaderRADFloat(int argc, char* argv[]) +int otbImageFileReaderRADFloat(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADInt.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADInt.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRADInt.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRADInt.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbExtractROI.h" -int otbImageFileReaderRADInt(int argc, char* argv[]) +int otbImageFileReaderRADInt(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderRGBTest.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderRGBTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderRGBTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderRGBTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkMacro.h" #include -int otbImageFileReaderRGBTest(int argc, char* argv[]) +int otbImageFileReaderRGBTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderServerName.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderServerName.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderServerName.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderServerName.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbTileMapImageIO.h" -int otbImageFileReaderServerName(int argc, char* argv[]) +int otbImageFileReaderServerName(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderTest.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileReaderTest(int argc, char* argv[]) +int otbImageFileReaderTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderTestFloat.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderTestFloat.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderTestFloat.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderTestFloat.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileReaderTestFloat(int argc, char* argv[]) +int otbImageFileReaderTestFloat(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileReaderWithComplexPixel.cxx otb-4.2.0/Testing/Code/IO/otbImageFileReaderWithComplexPixel.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileReaderWithComplexPixel.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileReaderWithComplexPixel.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -90,7 +90,6 @@ typedef std::complex PixelType; const unsigned int Dimension = 2; - typedef otb::Image ImageType; typedef otb::VectorImage CplVectorImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx otb-4.2.0/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileWriterONERAComplex.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbExtractROI.h" -int otbImageFileWriterONERAComplex(int argc, char* argv[]) +int otbImageFileWriterONERAComplex(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileWriterRGBTest.cxx otb-4.2.0/Testing/Code/IO/otbImageFileWriterRGBTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileWriterRGBTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileWriterRGBTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileWriterRGBTest(int argc, char* argv[]) +int otbImageFileWriterRGBTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx otb-4.2.0/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileWriterStreamingONERAComplex.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileWriterStreamingONERAComplex(int argc, char* argv[]) +int otbImageFileWriterStreamingONERAComplex(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileWriterTest.cxx otb-4.2.0/Testing/Code/IO/otbImageFileWriterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileWriterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileWriterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileWriterTest(int argc, char* argv[]) +int otbImageFileWriterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileWriterTestWithoutInput.cxx otb-4.2.0/Testing/Code/IO/otbImageFileWriterTestWithoutInput.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileWriterTestWithoutInput.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileWriterTestWithoutInput.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,14 +34,13 @@ * Write Image with an ImageFileWriter ***********/ template -int otbImageScalarFileWriterTestWithoutInputGeneric(int argc, char* argv[]) +int otbImageScalarFileWriterTestWithoutInputGeneric(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * outputFilename = argv[1]; typedef InternalType PixelType; typedef otb::Image ImageType; - typedef typename ImageType::PixelType ImagePixelType; typedef typename ImageType::RegionType RegionType; typedef typename ImageType::SizeType SizeType; typedef typename ImageType::IndexType IndexType; @@ -59,6 +58,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->Allocate(); @@ -104,14 +112,13 @@ * Write Image with an ImageFileWriter ***********/ template -int otbImageComplexFileWriterTestWithoutInputGeneric(int argc, char* argv[]) +int otbImageComplexFileWriterTestWithoutInputGeneric(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * outputFilename = argv[1]; typedef std::complex PixelType; typedef otb::Image ImageType; - typedef typename ImageType::PixelType ImagePixelType; typedef typename ImageType::RegionType RegionType; typedef typename ImageType::SizeType SizeType; typedef typename ImageType::IndexType IndexType; @@ -129,6 +136,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->Allocate(); diff -Nru otb-4.0.0/Testing/Code/IO/otbImageFileWriterWithExtendedOptionBox.cxx otb-4.2.0/Testing/Code/IO/otbImageFileWriterWithExtendedOptionBox.cxx --- otb-4.0.0/Testing/Code/IO/otbImageFileWriterWithExtendedOptionBox.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageFileWriterWithExtendedOptionBox.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbMultiChannelExtractROI.h" -int otbImageFileWriterWithExtendedOptionBox(int argc, char* argv[]) +int otbImageFileWriterWithExtendedOptionBox(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const std::string inputFilename = argv[1]; @@ -39,19 +39,13 @@ const std::string separator = ":"; typedef float InputPixelType; - typedef float OutputPixelType; - typedef otb::VectorImage InputImageType; - - typedef InputImageType::PixelType PixelType; - typedef otb::MultiChannelExtractROI ExtractROIFilterType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; - typedef itk::ImageRegionIterator< InputImageType > IteratorType; typedef itk::ImageRegionConstIterator< InputImageType > ConstIteratorType; ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbImageIOFactoryNew.cxx otb-4.2.0/Testing/Code/IO/otbImageIOFactoryNew.cxx --- otb-4.0.0/Testing/Code/IO/otbImageIOFactoryNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageIOFactoryNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbImageIOFactoryNew(int argc, char* argv[]) +int otbImageIOFactoryNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::ImageIOFactory *lImageIOFactory; lImageIOFactory = NULL; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx otb-4.2.0/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageMetadataFileWriterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageMetadataFileWriterTest(int argc, char* argv[]) +int otbImageMetadataFileWriterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageMetadataInterfaceBaseTest.cxx otb-4.2.0/Testing/Code/IO/otbImageMetadataInterfaceBaseTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageMetadataInterfaceBaseTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageMetadataInterfaceBaseTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageMetadataInterfaceBase.h" #include "otbImageMetadataInterfaceFactory.h" -int otbImageMetadataInterfaceBaseTest(int argc, char* argv[]) +int otbImageMetadataInterfaceBaseTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx otb-4.2.0/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx --- otb-4.0.0/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageMetadataInterfaceTest2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageMetadataInterfaceBase.h" #include "otbImageMetadataInterfaceFactory.h" -int otbImageMetadataInterfaceTest2(int argc, char* argv[]) +int otbImageMetadataInterfaceTest2(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx otb-4.2.0/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageMetadataStreamingFileWriterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageMetadataStreamingFileWriterTest(int argc, char* argv[]) +int otbImageMetadataStreamingFileWriterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageSeriesFileReader.cxx otb-4.2.0/Testing/Code/IO/otbImageSeriesFileReader.cxx --- otb-4.0.0/Testing/Code/IO/otbImageSeriesFileReader.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageSeriesFileReader.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "itksys/SystemTools.hxx" -int otbImageSeriesFileReader(int argc, char* argv[]) +int otbImageSeriesFileReader(int itkNotUsed(argc), char* argv[]) { const char * enviMetaFile = argv[1]; const char * outputFile = argv[2]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageStreamingFileWriterTestWithoutInput.cxx otb-4.2.0/Testing/Code/IO/otbImageStreamingFileWriterTestWithoutInput.cxx --- otb-4.0.0/Testing/Code/IO/otbImageStreamingFileWriterTestWithoutInput.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageStreamingFileWriterTestWithoutInput.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,14 +35,13 @@ * Write Image with an ImageFileWriter ***********/ template -int otbImageScalarStreamingFileWriterTestWithoutInputGeneric(int argc, char* argv[]) +int otbImageScalarStreamingFileWriterTestWithoutInputGeneric(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * outputFilename = argv[1]; typedef InternalType PixelType; typedef otb::Image ImageType; - typedef typename ImageType::PixelType ImagePixelType; typedef typename ImageType::RegionType RegionType; typedef typename ImageType::SizeType SizeType; typedef typename ImageType::IndexType IndexType; @@ -60,6 +59,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->Allocate(); @@ -106,14 +114,13 @@ * Write Image with an ImageFileWriter ***********/ template -int otbImageComplexStreamingFileWriterTestWithoutInputGeneric(int argc, char* argv[]) +int otbImageComplexStreamingFileWriterTestWithoutInputGeneric(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * outputFilename = argv[1]; typedef std::complex PixelType; typedef otb::Image ImageType; - typedef typename ImageType::PixelType ImagePixelType; typedef typename ImageType::RegionType RegionType; typedef typename ImageType::SizeType SizeType; typedef typename ImageType::IndexType IndexType; @@ -131,6 +138,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->Allocate(); diff -Nru otb-4.0.0/Testing/Code/IO/otbImageTest.cxx otb-4.2.0/Testing/Code/IO/otbImageTest.cxx --- otb-4.0.0/Testing/Code/IO/otbImageTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImage.h" #include "otbImageFileReader.h" -int otbImageTest(int argc, char* argv[]) +int otbImageTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbImageToOSMVectorDataGenerator.cxx otb-4.2.0/Testing/Code/IO/otbImageToOSMVectorDataGenerator.cxx --- otb-4.0.0/Testing/Code/IO/otbImageToOSMVectorDataGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbImageToOSMVectorDataGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ typedef otb::VectorDataFileWriter VectorDataFileWriterType; -int otbImageToOSMVectorDataGeneratorNew(int argc, char * argv[]) +int otbImageToOSMVectorDataGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { FilterType::Pointer vdgenerator = FilterType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbIntImageIOTest.cxx otb-4.2.0/Testing/Code/IO/otbIntImageIOTest.cxx --- otb-4.0.0/Testing/Code/IO/otbIntImageIOTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbIntImageIOTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbIntImageIOTest(int argc, char* argv[]) +int otbIntImageIOTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbIOTests13.cxx otb-4.2.0/Testing/Code/IO/otbIOTests13.cxx --- otb-4.0.0/Testing/Code/IO/otbIOTests13.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbIOTests13.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,10 +24,14 @@ void RegisterTests() { +#ifdef OTB_USE_JPEG2000 REGISTER_TEST(otbJPEG2000ImageIOTestCanRead); REGISTER_TEST(otbJPEG2000ImageIOTestCanWrite); +#endif REGISTER_TEST(otbMultiResolutionReadingInfo); REGISTER_TEST(otbVectorImageTest); REGISTER_TEST(otbVectorImageLegacyTest); +#ifdef OTB_USE_JPEG2000 REGISTER_TEST(otbGenerateClassicalQLWithJPEG2000); +#endif } diff -Nru otb-4.0.0/Testing/Code/IO/otbIOTests18.cxx otb-4.2.0/Testing/Code/IO/otbIOTests18.cxx --- otb-4.0.0/Testing/Code/IO/otbIOTests18.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbIOTests18.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,11 +26,13 @@ { REGISTER_TEST(otbSpotImageMetadataInterfaceNew); REGISTER_TEST(otbPleiadesImageMetadataInterfaceNew); + REGISTER_TEST(otbSpot6ImageMetadataInterfaceNew); REGISTER_TEST(otbFormosatImageMetadataInterfaceNew); REGISTER_TEST(otbIkonosImageMetadataInterfaceNew); REGISTER_TEST(otbQuickBirdImageMetadataInterfaceNew); REGISTER_TEST(otbWorldView2ImageMetadataInterfaceNew); REGISTER_TEST(otbTerraSarImageMetadataInterfaceNew); + REGISTER_TEST(otbImageMetadataInterfaceBaseTest); REGISTER_TEST(otbOpticalImageMetadataInterfaceTest); REGISTER_TEST(otbSarImageMetadataInterfaceTest); diff -Nru otb-4.0.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbJPEG2000ImageIOTestCanRead(int argc, char* argv[]) +int otbJPEG2000ImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); bool lCanRead = lJPEG2000ImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx otb-4.2.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx --- otb-4.0.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbJPEG2000ImageIOTestCanWrite.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbJPEG2000ImageIOTestCanWrite(int argc, char* argv[]) +int otbJPEG2000ImageIOTestCanWrite(int itkNotUsed(argc), char* argv[]) { otb::JPEG2000ImageIO::Pointer lJPEG2000ImageIO = otb::JPEG2000ImageIO::New(); bool lCanWrite = lJPEG2000ImageIO->CanWriteFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbKMLVectorDataIONew.cxx otb-4.2.0/Testing/Code/IO/otbKMLVectorDataIONew.cxx --- otb-4.0.0/Testing/Code/IO/otbKMLVectorDataIONew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbKMLVectorDataIONew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbKMLVectorDataIO.h" -int otbKMLVectorDataIONew(int argc, char * argv[]) +int otbKMLVectorDataIONew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::KMLVectorDataIO KMLVectorDataIOType; KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbKMLVectorDataIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbKMLVectorDataIO.h" #include -int otbKMLVectorDataIOTestCanRead(int argc, char* argv[]) +int otbKMLVectorDataIOTestCanRead(int itkNotUsed(argc), char* argv[]) { typedef otb::KMLVectorDataIO KMLVectorDataIOType; KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx otb-4.2.0/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx --- otb-4.0.0/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbKMLVectorDataIOTestCanWrite.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbKMLVectorDataIO.h" #include -int otbKMLVectorDataIOTestCanWrite(int argc, char* argv[]) +int otbKMLVectorDataIOTestCanWrite(int itkNotUsed(argc), char* argv[]) { typedef otb::KMLVectorDataIO KMLVectorDataIOType; KMLVectorDataIOType::Pointer object = KMLVectorDataIOType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbKmzProductWriter.cxx otb-4.2.0/Testing/Code/IO/otbKmzProductWriter.cxx --- otb-4.0.0/Testing/Code/IO/otbKmzProductWriter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbKmzProductWriter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ typedef GCPsToSensorModelFilterType::Point3DType Point3DType; -int otbKmzProductWriterNew(int argc, char* argv[]) +int otbKmzProductWriterNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { KmzProductWriterType::Pointer kmzWriter = KmzProductWriterType::New(); return EXIT_SUCCESS; diff -Nru otb-4.0.0/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbLUMImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbLUMImageIOTestCanRead(int argc, char* argv[]) +int otbLUMImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); bool lCanRead = lLUMImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx otb-4.2.0/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx --- otb-4.0.0/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbLUMImageIOTestCanWrite.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbLUMImageIOTestCanWrite(int argc, char* argv[]) +int otbLUMImageIOTestCanWrite(int itkNotUsed(argc), char* argv[]) { otb::LUMImageIO::Pointer lLUMImageIO = otb::LUMImageIO::New(); bool lCanRead = lLUMImageIO->CanWriteFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbMapFileProductWriter.cxx otb-4.2.0/Testing/Code/IO/otbMapFileProductWriter.cxx --- otb-4.0.0/Testing/Code/IO/otbMapFileProductWriter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbMapFileProductWriter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorImage.h" #include "otbImageFileReader.h" -int otbMapFileProductWriter(int argc, char* argv[]) +int otbMapFileProductWriter(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; const char * path = argv[2]; @@ -52,4 +52,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/IO/otbMapFileProductWriterNew.cxx otb-4.2.0/Testing/Code/IO/otbMapFileProductWriterNew.cxx --- otb-4.0.0/Testing/Code/IO/otbMapFileProductWriterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbMapFileProductWriterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbMapFileProductWriter.h" #include "otbVectorImage.h" -int otbMapFileProductWriterNew(int argc, char* argv[]) +int otbMapFileProductWriterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorImage ImageType; diff -Nru otb-4.0.0/Testing/Code/IO/otbMapProjectionAdapterTest.cxx otb-4.2.0/Testing/Code/IO/otbMapProjectionAdapterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbMapProjectionAdapterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbMapProjectionAdapterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbMapProjectionAdapter.h" -int otbMapProjectionAdapterTest(int argc, char* argv[]) +int otbMapProjectionAdapterTest(int itkNotUsed(argc), char* argv[]) { const char * outFileName = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbMSTARImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbMSTARImageIOTestCanRead(int argc, char* argv[]) +int otbMSTARImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::MSTARImageIO::Pointer lMSTARImageIO = otb::MSTARImageIO::New(); bool lCanRead = lMSTARImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbMWImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbMWImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbMWImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbMWImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbMWImageIOTestCanRead(int argc, char* argv[]) +int otbMWImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::MWImageIO::Pointer lMWImageIO = otb::MWImageIO::New(); bool lCanRead = lMWImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx otb-4.2.0/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx --- otb-4.0.0/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbMWImageIOTestCanWrite.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbMWImageIOTestCanWrite(int argc, char* argv[]) +int otbMWImageIOTestCanWrite(int itkNotUsed(argc), char* argv[]) { otb::MWImageIO::Pointer lMWImageIO = otb::MWImageIO::New(); bool lCanRead = lMWImageIO->CanWriteFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx otb-4.2.0/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx --- otb-4.0.0/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbOGRVectorDataIOCanWrite.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbOGRVectorDataIO.h" #include -int otbOGRVectorDataIOCanWrite(int argc, char* argv[]) +int otbOGRVectorDataIOCanWrite(int itkNotUsed(argc), char* argv[]) { typedef otb::OGRVectorDataIO OGRVectorDataIOType; OGRVectorDataIOType::Pointer object = OGRVectorDataIOType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbOGRVectorDataIONew.cxx otb-4.2.0/Testing/Code/IO/otbOGRVectorDataIONew.cxx --- otb-4.0.0/Testing/Code/IO/otbOGRVectorDataIONew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbOGRVectorDataIONew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbOGRVectorDataIO.h" #include "otbVectorData.h" -int otbOGRVectorDataIONew(int argc, char * argv[]) +int otbOGRVectorDataIONew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::OGRVectorDataIO OGRVectorDataIOType; OGRVectorDataIOType::Pointer object = OGRVectorDataIOType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbONERAImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbONERAImageIOTestCanRead(int argc, char* argv[]) +int otbONERAImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::ONERAImageIO::Pointer lONERAImageIO = otb::ONERAImageIO::New(); bool lCanRead = lONERAImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterface.cxx otb-4.2.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterface.cxx --- otb-4.0.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterface.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterface.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkMacro.h" #include "otbOpticalDefaultImageMetadataInterface.h" -int otbOpticalDefaultImageMetadataInterface(int argc, char* argv[]) +int otbOpticalDefaultImageMetadataInterface(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef otb::OpticalDefaultImageMetadataInterface ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceFactoryNew.cxx otb-4.2.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceFactoryNew.cxx --- otb-4.0.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceFactoryNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceFactoryNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbOpticalDefaultImageMetadataInterfaceFactory.h" -int otbOpticalDefaultImageMetadataInterfaceFactoryNew(int argc, char* argv[]) +int otbOpticalDefaultImageMetadataInterfaceFactoryNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::OpticalDefaultImageMetadataInterfaceFactory ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbOpticalDefaultImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbOpticalDefaultImageMetadataInterface.h" -int otbOpticalDefaultImageMetadataInterfaceNew(int argc, char* argv[]) +int otbOpticalDefaultImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::OpticalDefaultImageMetadataInterface ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbOpticalImageMetadataInterfaceTest.cxx otb-4.2.0/Testing/Code/IO/otbOpticalImageMetadataInterfaceTest.cxx --- otb-4.0.0/Testing/Code/IO/otbOpticalImageMetadataInterfaceTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbOpticalImageMetadataInterfaceTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbOpticalImageMetadataInterface.h" #include "otbOpticalImageMetadataInterfaceFactory.h" -int otbOpticalImageMetadataInterfaceTest(int argc, char* argv[]) +int otbOpticalImageMetadataInterfaceTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbOSMDataToVectorDataTests.cxx otb-4.2.0/Testing/Code/IO/otbOSMDataToVectorDataTests.cxx --- otb-4.0.0/Testing/Code/IO/otbOSMDataToVectorDataTests.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbOSMDataToVectorDataTests.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,14 +24,14 @@ typedef otb::VectorDataFileWriter VectorDataFileWriterType; -int otbOSMToVectorDataGeneratorNew (int argc, char * argv[]) +int otbOSMToVectorDataGeneratorNew (int itkNotUsed(argc), char * itkNotUsed(argv) []) { FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } -int otbOSMToVectorDataGeneratorTest (int argc, char * argv[]) +int otbOSMToVectorDataGeneratorTest (int itkNotUsed(argc), char * argv[]) { FilterType::Pointer filter = FilterType::New(); filter->SetFileName(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbPipeline.cxx otb-4.2.0/Testing/Code/IO/otbPipeline.cxx --- otb-4.0.0/Testing/Code/IO/otbPipeline.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbPipeline.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbPipeline(int argc, char * argv[]) +int otbPipeline(int itkNotUsed(argc), char * argv[]) { typedef otb::Image ImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx otb-4.2.0/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx --- otb-4.0.0/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbPipelineMetadataHandlingTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbPipelineMetadataHandlingTest(int argc, char* argv[]) +int otbPipelineMetadataHandlingTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx otb-4.2.0/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbPipelineMetadataHandlingWithUFFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbPipelineMetadataHandlingWithUFFilterTest(int argc, char* argv[]) +int otbPipelineMetadataHandlingWithUFFilterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbPleiadesImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbPleiadesImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbPleiadesImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbPleiadesImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbPleiadesImageMetadataInterface.h" -int otbPleiadesImageMetadataInterfaceNew(int argc, char* argv[]) +int otbPleiadesImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::PleiadesImageMetadataInterface::Pointer object = otb::PleiadesImageMetadataInterface::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx otb-4.2.0/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx --- otb-4.0.0/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbPNGIndexedNbBandsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkMacro.h" #include -int otbPNGIndexedNbBandsTest(int argc, char* argv[]) +int otbPNGIndexedNbBandsTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbQuickBirdImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbQuickBirdImageMetadataInterface.h" -int otbQuickBirdImageMetadataInterfaceNew(int argc, char* argv[]) +int otbQuickBirdImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::QuickBirdImageMetadataInterface::Pointer object = otb::QuickBirdImageMetadataInterface::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbRADImageIOTestCanRead.cxx otb-4.2.0/Testing/Code/IO/otbRADImageIOTestCanRead.cxx --- otb-4.0.0/Testing/Code/IO/otbRADImageIOTestCanRead.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbRADImageIOTestCanRead.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkMacro.h" #include -int otbRADImageIOTestCanRead(int argc, char* argv[]) +int otbRADImageIOTestCanRead(int itkNotUsed(argc), char* argv[]) { otb::RADImageIO::Pointer lRADImageIO = otb::RADImageIO::New(); bool lCanRead = lRADImageIO->CanReadFile(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx otb-4.2.0/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx --- otb-4.0.0/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbReadingComplexDataIntoComplexImageTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorImage.h" #include "otbMacro.h" -int otbReadingComplexDataIntoComplexImageTest(int argc, char * argv[]) +int otbReadingComplexDataIntoComplexImageTest(int itkNotUsed(argc), char * argv[]) { typedef double RealType; typedef std::complex PixelType; diff -Nru otb-4.0.0/Testing/Code/IO/otbSarDefaultImageMetadataInterface.cxx otb-4.2.0/Testing/Code/IO/otbSarDefaultImageMetadataInterface.cxx --- otb-4.0.0/Testing/Code/IO/otbSarDefaultImageMetadataInterface.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSarDefaultImageMetadataInterface.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkMacro.h" #include "otbSarDefaultImageMetadataInterface.h" -int otbSarDefaultImageMetadataInterface(int argc, char* argv[]) +int otbSarDefaultImageMetadataInterface(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef otb::SarDefaultImageMetadataInterface ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceFactoryNew.cxx otb-4.2.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceFactoryNew.cxx --- otb-4.0.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceFactoryNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceFactoryNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbSarDefaultImageMetadataInterfaceFactory.h" -int otbSarDefaultImageMetadataInterfaceFactoryNew(int argc, char* argv[]) +int otbSarDefaultImageMetadataInterfaceFactoryNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::SarDefaultImageMetadataInterfaceFactory ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSarDefaultImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbSarDefaultImageMetadataInterface.h" -int otbSarDefaultImageMetadataInterfaceNew(int argc, char* argv[]) +int otbSarDefaultImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::SarDefaultImageMetadataInterface ObjectType; diff -Nru otb-4.0.0/Testing/Code/IO/otbSarImageMetadataInterfaceTest.cxx otb-4.2.0/Testing/Code/IO/otbSarImageMetadataInterfaceTest.cxx --- otb-4.0.0/Testing/Code/IO/otbSarImageMetadataInterfaceTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSarImageMetadataInterfaceTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ } } -int otbSarImageMetadataInterfaceTest(int argc, char* argv[]) +int otbSarImageMetadataInterfaceTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbScalarBufferToImageFileWriterNew.cxx otb-4.2.0/Testing/Code/IO/otbScalarBufferToImageFileWriterNew.cxx --- otb-4.0.0/Testing/Code/IO/otbScalarBufferToImageFileWriterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbScalarBufferToImageFileWriterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbScalarBufferToImageFileWriter.h" -int otbScalarBufferToImageFileWriterNew(int argc, char* argv[]) +int otbScalarBufferToImageFileWriterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::ScalarBufferToImageFileWriter FilterType; FilterType::Pointer filter = FilterType::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbScalarBufferToImageFileWriterTest.cxx otb-4.2.0/Testing/Code/IO/otbScalarBufferToImageFileWriterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbScalarBufferToImageFileWriterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbScalarBufferToImageFileWriterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbScalarBufferToImageFileWriter.h" -int otbScalarBufferToImageFileWriterTest(int argc, char* argv[]) +int otbScalarBufferToImageFileWriterTest(int itkNotUsed(argc), char* argv[]) { unsigned int nbCh = atoi(argv[1]); unsigned int sizeX = atoi(argv[2]); diff -Nru otb-4.0.0/Testing/Code/IO/otbShortImageIOTest.cxx otb-4.2.0/Testing/Code/IO/otbShortImageIOTest.cxx --- otb-4.0.0/Testing/Code/IO/otbShortImageIOTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbShortImageIOTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbShortImageIOTest(int argc, char* argv[]) +int otbShortImageIOTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbShortRGBImageIOTest.cxx otb-4.2.0/Testing/Code/IO/otbShortRGBImageIOTest.cxx --- otb-4.0.0/Testing/Code/IO/otbShortRGBImageIOTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbShortRGBImageIOTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkMacro.h" #include -int otbShortRGBImageIOTest(int argc, char* argv[]) +int otbShortRGBImageIOTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbSpectralSensitivityReaderNew.cxx otb-4.2.0/Testing/Code/IO/otbSpectralSensitivityReaderNew.cxx --- otb-4.0.0/Testing/Code/IO/otbSpectralSensitivityReaderNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSpectralSensitivityReaderNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ using namespace otb; -int otbSpectralSensitivityReaderNew(int argc, char* argv[]) +int otbSpectralSensitivityReaderNew(int itkNotUsed(argc) char * itkNotUsed(argv) []) { SpectralSensitivityReader::Pointer spectSen = SpectralSensitivityReader::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbSpectralSensitivityReaderTest.cxx otb-4.2.0/Testing/Code/IO/otbSpectralSensitivityReaderTest.cxx --- otb-4.0.0/Testing/Code/IO/otbSpectralSensitivityReaderTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSpectralSensitivityReaderTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ using namespace otb; -int otbSpectralSensitivityReaderNew(int argc, char* argv[]) +int otbSpectralSensitivityReaderNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { SpectralSensitivityReader::Pointer spectSen = SpectralSensitivityReader::New(); @@ -33,7 +33,7 @@ return EXIT_SUCCESS; } -int otbSpectralSensitivityReaderTest(int argc, char* argv[]) +int otbSpectralSensitivityReaderTest(int itkNotUsed(argc), char* argv[]) { const char * dataPath = argv[1]; const char * imageName = argv[2]; @@ -60,7 +60,7 @@ return EXIT_SUCCESS; } -int otbSpectralSensitivityReaderGenericTest(int argc, char* argv[]) +int otbSpectralSensitivityReaderGenericTest(int itkNotUsed(argc), char* argv[]) { const char * sensitivityFileName = argv[1]; const char * imageName = argv[2]; @@ -87,4 +87,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/IO/otbSpot6ImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbSpot6ImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbSpot6ImageMetadataInterfaceNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSpot6ImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,34 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + + + +#include "itkMacro.h" + +#include + +#include "otbSpot6ImageMetadataInterface.h" + +int otbSpot6ImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) +{ + otb::Spot6ImageMetadataInterface::Pointer object = otb::Spot6ImageMetadataInterface::New(); + + std::cout << object << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbSpotImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSpotImageMetadataInterface.h" -int otbSpotImageMetadataInterfaceNew(int argc, char* argv[]) +int otbSpotImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::SpotImageMetadataInterface::Pointer object = otb::SpotImageMetadataInterface::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx otb-4.2.0/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx --- otb-4.0.0/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbStreamingImageFileWriterTestCalculateNumberOfDivisions.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbImageFileWriterTestCalculateNumberOfDivisions(int argc, char* argv[]) +int otbImageFileWriterTestCalculateNumberOfDivisions(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx otb-4.2.0/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbStreamingImageFileWriterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbStreamingImageFileWriter.h" #include "otbImageFileWriter.h" -int otbStreamingImageFileWriterTest(int argc, char* argv[]) +int otbStreamingImageFileWriterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx otb-4.2.0/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbStreamingImageFileWriterWithFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbImageFileWriter.h" #include "itkMeanImageFilter.h" -int otbImageFileWriterWithFilterTest(int argc, char* argv[]) +int otbImageFileWriterWithFilterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbStreamingImageFilterTest.cxx otb-4.2.0/Testing/Code/IO/otbStreamingImageFilterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbStreamingImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbStreamingImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbStreamingImageFilterTest(int argc, char* argv[]) +int otbStreamingImageFilterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx otb-4.2.0/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbStreamingShortImageFileWriterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileWriter.h" #include "otbImageFileWriter.h" -int otbStreamingShortImageFileWriterTest(int argc, char* argv[]) +int otbStreamingShortImageFileWriterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line const char * inputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbTerraSarImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileReader.h" #include "otbTerraSarImageMetadataInterface.h" -int otbTerraSarImageMetadataInterfaceNew(int argc, char* argv[]) +int otbTerraSarImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::TerraSarImageMetadataInterface::Pointer object = otb::TerraSarImageMetadataInterface::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbThreadsTest.cxx otb-4.2.0/Testing/Code/IO/otbThreadsTest.cxx --- otb-4.0.0/Testing/Code/IO/otbThreadsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbThreadsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,8 +18,9 @@ #include #include "otbThreads.h" +#include "itkMacro.h" -int otbThreadsTest(int argc, char* argv[]) +int otbThreadsTest(int itkNotUsed(argc), char* itkNotUsed(argv) []) { otb::Threads::Sleep(10); return EXIT_SUCCESS; diff -Nru otb-4.0.0/Testing/Code/IO/otbTileMapImageIOHelperTest.cxx otb-4.2.0/Testing/Code/IO/otbTileMapImageIOHelperTest.cxx --- otb-4.0.0/Testing/Code/IO/otbTileMapImageIOHelperTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbTileMapImageIOHelperTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include #include "otbTileMapImageIOHelper.h" -int otbTileMapImageIOHelperNew(int argc, char * argv[]) +int otbTileMapImageIOHelperNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::TileMapImageIOHelper::Pointer myTileMapImageIOHelper; @@ -27,7 +27,7 @@ return EXIT_SUCCESS; } -int otbTileMapImageIOHelperTest(int argc, char * argv[]) +int otbTileMapImageIOHelperTest(int itkNotUsed(argc), char * argv[]) { otb::TileMapImageIOHelper::Pointer myTileMapImageIOHelper; myTileMapImageIOHelper = otb::TileMapImageIOHelper::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbTileMapWriter.cxx otb-4.2.0/Testing/Code/IO/otbTileMapWriter.cxx --- otb-4.0.0/Testing/Code/IO/otbTileMapWriter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbTileMapWriter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,16 +45,12 @@ int depth = 14; typedef otb::Image ImageType; - typedef otb::Image CharImageType; typedef otb::Image DoubleImageType; typedef otb::VectorImage VectorImageType; typedef otb::VectorImage CharVectorImageType; typedef otb::VectorImage DoubleVectorImageType; - typedef itk::RGBPixel RGBPixelType; - typedef otb::Image RGBImageType; - typedef otb::ImageFileReader VectorReaderType; VectorReaderType::Pointer readerXS = VectorReaderType::New(); readerXS->SetFileName(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileGeoReaderWriter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkMetaDataObject.h" #include "otbMetaDataKey.h" -int otbVectorDataFileGeoReaderWriter(int argc, char * argv[]) +int otbVectorDataFileGeoReaderWriter(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorData VectorDataType; diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileReader.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileReader.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileReader.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileReader.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkDataObject.h" #include "otbDataNode.h" -int otbVectorDataFileReader(int argc, char * argv[]) +int otbVectorDataFileReader(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader VectorDataFileReaderType; @@ -34,7 +34,6 @@ typedef DataNodeType::Pointer DataNodePointerType; typedef itk::TreeContainer DataTreeType; - typedef itk::DataObject dataobjectType; itk::Indent indent; reader->SetFileName(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileReaderNew.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileReaderNew.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileReaderNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileReaderNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorDataFileReader.h" #include "otbVectorData.h" -int otbVectorDataFileReaderNew(int argc, char * argv[]) +int otbVectorDataFileReaderNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataFileReader VectorDataFileReaderType; diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileReaderWriter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorDataFileWriter.h" #include "otbVectorDataFileReader.h" -int otbVectorDataFileReaderWriter(int argc, char * argv[]) +int otbVectorDataFileReaderWriter(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorData VectorDataType; diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriter.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriter.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,15 +21,13 @@ #include "otbVectorData.h" #include "otbVectorDataFileWriter.h" -int otbVectorDataFileWriter(int argc, char * argv[]) +int otbVectorDataFileWriter(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorData VectorDataType; typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter WriterType; - typedef DataNodeType::PointType PointType; typedef DataNodeType::LineType LineType; - typedef DataNodeType::PolygonType PolygonType; typedef LineType::VertexType VertexType; //Instantiation diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriterMultiPolygons.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriterMultiPolygons.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriterMultiPolygons.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriterMultiPolygons.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,16 +21,14 @@ #include "otbVectorData.h" #include "otbVectorDataFileWriter.h" -int otbVectorDataFileWriterMultiPolygons(int argc, char * argv[]) +int otbVectorDataFileWriterMultiPolygons(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorData VectorDataType; typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter WriterType; - typedef DataNodeType::PointType PointType; typedef DataNodeType::LineType LineType; typedef DataNodeType::PolygonType PolygonType; - typedef DataNodeType::PolygonListType PolygonListType; typedef LineType::VertexType VertexType; //Instantiation diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriterNew.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriterNew.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,10 +19,9 @@ #include "otbVectorDataFileWriter.h" #include "otbVectorData.h" -int otbVectorDataFileWriterNew(int argc, char * argv[]) +int otbVectorDataFileWriterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorData VectorDataType; - typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter WriterType; //Instantiation diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataFileWriterPolygons.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,13 +21,12 @@ #include "otbVectorData.h" #include "otbVectorDataFileWriter.h" -int otbVectorDataFileWriterPolygons(int argc, char * argv[]) +int otbVectorDataFileWriterPolygons(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorData VectorDataType; typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter WriterType; - typedef DataNodeType::PointType PointType; typedef DataNodeType::LineType LineType; typedef DataNodeType::PolygonType PolygonType; typedef LineType::VertexType VertexType; diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataIOFactory.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataIOFactory.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataIOFactory.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataIOFactory.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorDataIOFactory.h" #include "otbVectorData.h" -int otbVectorDataIOFactory(int argc, char * argv[]) +int otbVectorDataIOFactory(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorDataIOFactory VectorData1IOFactoryType; typedef VectorData1IOFactoryType::VectorDataIOBasePointerType VectorData1IOBasePointerType; @@ -29,4 +29,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataKeywordlistTest.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataKeywordlistTest.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataKeywordlistTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataKeywordlistTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,14 +23,14 @@ #include "otbVectorDataFileReader.h" #include "otbMetaDataKey.h" -int otbVectorDataKeywordlistNew(int argc, char * argv[]) +int otbVectorDataKeywordlistNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::VectorDataKeywordlist kwl; std::cout << kwl << std::endl; return EXIT_SUCCESS; } -int otbVectorDataKeywordlist(int argc, char * argv[]) +int otbVectorDataKeywordlist(int itkNotUsed(argc), char * argv[]) { typedef otb::VectorData<> VectorDataType; @@ -41,7 +41,6 @@ typedef DataNodeType::Pointer DataNodePointerType; typedef itk::TreeContainer DataTreeType; - typedef itk::DataObject dataobjectType; itk::Indent indent; reader->SetFileName(argv[1]); diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorDataSourceNew.cxx otb-4.2.0/Testing/Code/IO/otbVectorDataSourceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorDataSourceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorDataSourceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorDataSource.h" #include "otbVectorData.h" -int otbVectorDataSourceNew(int argc, char * argv[]) +int otbVectorDataSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorData<> VectorDataType; typedef otb::VectorDataSource VectorDataSourceType; diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx otb-4.2.0/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorImageFileReaderWriterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbVectorImageFileReaderWriterTest(int argc, char* argv[]) +int otbVectorImageFileReaderWriterTest(int itkNotUsed(argc), char* argv[]) { // Verify the number of parameters in the command line diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorImageFileWriterTestWithoutInput.cxx otb-4.2.0/Testing/Code/IO/otbVectorImageFileWriterTestWithoutInput.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorImageFileWriterTestWithoutInput.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorImageFileWriterTestWithoutInput.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,6 +67,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); image->Allocate(); @@ -161,6 +170,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); image->Allocate(); diff -Nru otb-4.0.0/Testing/Code/IO/otbVectorImageStreamingFileWriterTestWithoutInput.cxx otb-4.2.0/Testing/Code/IO/otbVectorImageStreamingFileWriterTestWithoutInput.cxx --- otb-4.0.0/Testing/Code/IO/otbVectorImageStreamingFileWriterTestWithoutInput.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbVectorImageStreamingFileWriterTestWithoutInput.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,6 +67,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); image->Allocate(); @@ -161,6 +170,15 @@ region.SetSize(size); region.SetIndex(orig); + typedef typename ImageType::PointType PointType; + typedef typename ImageType::SpacingType SpacingType; + PointType origin; + origin.Fill(0.5); + SpacingType spacing; + spacing.Fill(1.0); + image->SetOrigin(origin); + image->SetSpacing(spacing); + image->SetRegions(region); image->SetNumberOfComponentsPerPixel(atoi(argv[3])); image->Allocate(); diff -Nru otb-4.0.0/Testing/Code/IO/otbWavelengthSpectralBandsTest.cxx otb-4.2.0/Testing/Code/IO/otbWavelengthSpectralBandsTest.cxx --- otb-4.0.0/Testing/Code/IO/otbWavelengthSpectralBandsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbWavelengthSpectralBandsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ using namespace otb; -int otbFilterFunctionValuesNew(int argc, char* argv[]) +int otbFilterFunctionValuesNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { FilterFunctionValues::Pointer spectSen = FilterFunctionValues::New(); @@ -29,11 +29,10 @@ return EXIT_SUCCESS; } -int otbWavelengthSpectralBandsNew(int argc, char* argv[]) +int otbWavelengthSpectralBandsNew(int itkNotUsed(argc), char* itkNotUsed(argv) []) { WavelengthSpectralBands::Pointer spectSen = WavelengthSpectralBands::New(); return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/IO/otbWorldView2ImageMetadataInterfaceNew.cxx otb-4.2.0/Testing/Code/IO/otbWorldView2ImageMetadataInterfaceNew.cxx --- otb-4.0.0/Testing/Code/IO/otbWorldView2ImageMetadataInterfaceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbWorldView2ImageMetadataInterfaceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbWorldView2ImageMetadataInterface.h" -int otbWorldView2ImageMetadataInterfaceNew(int argc, char* argv[]) +int otbWorldView2ImageMetadataInterfaceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::WorldView2ImageMetadataInterface::Pointer object = otb::WorldView2ImageMetadataInterface::New(); diff -Nru otb-4.0.0/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx otb-4.2.0/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx --- otb-4.0.0/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/IO/otbWritingComplexDataWithComplexImageTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImage.h" #include "otbMacro.h" -int otbWritingComplexDataWithComplexImageTest(int argc, char * argv[]) +int otbWritingComplexDataWithComplexImageTest(int itkNotUsed(argc), char * argv[]) { typedef double RealType; typedef std::complex PixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbConcatenateSampleListFilter.cxx otb-4.2.0/Testing/Code/Learning/otbConcatenateSampleListFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbConcatenateSampleListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbConcatenateSampleListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -16,8 +16,6 @@ =========================================================================*/ - - #include "itkListSample.h" #include "itkVariableLengthVector.h" #include "otbConcatenateSampleListFilter.h" @@ -29,14 +27,14 @@ typedef otb::Statistics::ConcatenateSampleListFilter ConcatenateFilterType; -int otbConcatenateSampleListFilterNew(int argc, char * argv[]) +int otbConcatenateSampleListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { ConcatenateFilterType::Pointer instance = ConcatenateFilterType::New(); return EXIT_SUCCESS; } -int otbConcatenateSampleListFilter(int argc, char * argv[]) +int otbConcatenateSampleListFilter(int itkNotUsed(argc), char * argv[]) { // Compute the number of samples const char * outfname = argv[1]; @@ -106,5 +104,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Learning/otbConfusionMatrixCalculatorTest.cxx otb-4.2.0/Testing/Code/Learning/otbConfusionMatrixCalculatorTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbConfusionMatrixCalculatorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbConfusionMatrixCalculatorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkListSample.h" #include "otbConfusionMatrixCalculator.h" -int otbConfusionMatrixCalculatorNew(int argc, char* argv[]) +int otbConfusionMatrixCalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::VariableLengthVector PLabelType; @@ -278,7 +278,7 @@ } -int otbConfusionMatrixCalculatorComputeWithBaseline(int argc, char* argv[]) +int otbConfusionMatrixCalculatorComputeWithBaseline(int itkNotUsed(argc), char* itkNotUsed(argv) []) { typedef char ClassLabelType; typedef itk::VariableLengthVector PLabelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbConfusionMatrixMeasurementsTest.cxx otb-4.2.0/Testing/Code/Learning/otbConfusionMatrixMeasurementsTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbConfusionMatrixMeasurementsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbConfusionMatrixMeasurementsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -142,7 +142,7 @@ -int otbConfusionMatrixMeasurementsNew(int argc, char* argv[]) +int otbConfusionMatrixMeasurementsNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { /*typedef unsigned long ConfusionMatrixEltType; typedef itk::VariableSizeMatrix ConfusionMatrixType; @@ -172,7 +172,7 @@ } -int otbConfusionMatrixMeasurementsTest(int argc, char* argv[]) +int otbConfusionMatrixMeasurementsTest(int itkNotUsed(argc), char* itkNotUsed(argv) []) { /*typedef unsigned long ConfusionMatrixEltType; typedef itk::VariableSizeMatrix ConfusionMatrixType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbDecisionTreeBuild.cxx otb-4.2.0/Testing/Code/Learning/otbDecisionTreeBuild.cxx --- otb-4.0.0/Testing/Code/Learning/otbDecisionTreeBuild.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbDecisionTreeBuild.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ enum WheatTypes { WinterWheat, SummerWheat }; -int otbDecisionTreeBuild(int argc, char* argv[]) +int otbDecisionTreeBuild(int itkNotUsed(argc), char* itkNotUsed(argv) []) { /** We build the following decision tree @@ -111,4 +111,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/Learning/otbDecisionTreeNew.cxx otb-4.2.0/Testing/Code/Learning/otbDecisionTreeNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbDecisionTreeNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbDecisionTreeNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ enum WheatTypes { WinterWheat, SummerWheat }; -int otbDecisionTreeNew(int argc, char* argv[]) +int otbDecisionTreeNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef bool AttributeValueType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbDecisionTreeWithRealValues.cxx otb-4.2.0/Testing/Code/Learning/otbDecisionTreeWithRealValues.cxx --- otb-4.0.0/Testing/Code/Learning/otbDecisionTreeWithRealValues.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbDecisionTreeWithRealValues.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ enum WheatTypes { WinterWheat, SummerWheat }; -int otbDecisionTreeWithRealValues(int argc, char* argv[]) +int otbDecisionTreeWithRealValues(int itkNotUsed(argc), char* itkNotUsed(argv) []) { /** We build the following decision tree @@ -111,4 +111,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx otb-4.2.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbExhaustiveExponentialOptimizer.h" -int otbExhaustiveExponentialOptimizerNew(int argc, char* argv[]) +int otbExhaustiveExponentialOptimizerNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { otb::ExhaustiveExponentialOptimizer::Pointer opt = otb::ExhaustiveExponentialOptimizer::New(); diff -Nru otb-4.0.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerTest.cxx otb-4.2.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbExhaustiveExponentialOptimizerTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ virtual unsigned int GetNumberOfParameters(void) const {return 2; }; /** \return The accuracy derivative corresponding to the parameters */ - virtual void GetDerivative(const ParametersType& parameters, DerivativeType& derivative) const {}; + virtual void GetDerivative(const ParametersType& itkNotUsed(parameters), DerivativeType& itkNotUsed(derivative)) const {}; /// Constructor Quadratic2DCostFunction() @@ -103,7 +103,7 @@ }; // class Quadratic2DCostFunction -int otbExhaustiveExponentialOptimizerTest(int argc, char* argv[]) +int otbExhaustiveExponentialOptimizerTest(int itkNotUsed(argc), char* argv[]) { Quadratic2DCostFunction::Pointer costFunction = Quadratic2DCostFunction::New(); diff -Nru otb-4.0.0/Testing/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.cxx otb-4.2.0/Testing/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbGaussianAdditiveNoiseSampleListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ GaussianFilterType; -int otbGaussianAdditiveNoiseSampleListFilterNew(int argc, char * argv[]) +int otbGaussianAdditiveNoiseSampleListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { GaussianFilterType::Pointer filter = GaussianFilterType::New(); return EXIT_SUCCESS; @@ -88,5 +88,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Learning/otbGaussianModelComponent.cxx otb-4.2.0/Testing/Code/Learning/otbGaussianModelComponent.cxx --- otb-4.0.0/Testing/Code/Learning/otbGaussianModelComponent.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbGaussianModelComponent.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbGaussianModelComponent.h" #include "itkVariableLengthVector.h" -int otbGaussianModelComponentNew(int argc, char * argv[]) +int otbGaussianModelComponentNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::Statistics::ListSample > SampleType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbImageClassificationFilter.cxx otb-4.2.0/Testing/Code/Learning/otbImageClassificationFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbImageClassificationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbImageClassificationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,13 +36,13 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; -int otbImageClassificationFilterNew(int argc, char * argv[]) +int otbImageClassificationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { ClassificationFilterType::Pointer filter = ClassificationFilterType::New(); return EXIT_SUCCESS; } -int otbImageClassificationFilter(int argc, char * argv[]) +int otbImageClassificationFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * modelfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx otb-4.2.0/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbKMeansImageClassificationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbKMeansImageClassificationFilter(int argc, char * argv[]) +int otbKMeansImageClassificationFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx otb-4.2.0/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbKMeansImageClassificationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorImage.h" #include "otbImage.h" -int otbKMeansImageClassificationFilterNew(int argc, char * argv[]) +int otbKMeansImageClassificationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbListSampleGeneratorTest.cxx otb-4.2.0/Testing/Code/Learning/otbListSampleGeneratorTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbListSampleGeneratorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbListSampleGeneratorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbListSampleGenerator.h" -int otbListSampleGeneratorNew(int argc, char* argv[]) +int otbListSampleGeneratorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::VectorImage ImageType; typedef otb::VectorData VectorDataType; @@ -58,7 +58,6 @@ std::string classKey = "Class"; typedef double PixelType; - typedef int LabeledPixelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbListSampleToBalancedListSampleFilter.cxx otb-4.2.0/Testing/Code/Learning/otbListSampleToBalancedListSampleFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbListSampleToBalancedListSampleFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbListSampleToBalancedListSampleFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ BalancingFilterType; -int otbListSampleToBalancedListSampleFilterNew(int argc, char * argv[]) +int otbListSampleToBalancedListSampleFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { BalancingFilterType::Pointer filter = BalancingFilterType::New(); return EXIT_SUCCESS; diff -Nru otb-4.0.0/Testing/Code/Learning/otbNeighborhoodMajorityVotingImageFilterNew.cxx otb-4.2.0/Testing/Code/Learning/otbNeighborhoodMajorityVotingImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbNeighborhoodMajorityVotingImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbNeighborhoodMajorityVotingImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkBinaryBallStructuringElement.h" #include "otbNeighborhoodMajorityVotingImageFilter.h" -int otbNeighborhoodMajorityVotingImageFilterNew(int argc, char* argv[]) +int otbNeighborhoodMajorityVotingImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputLabelPixelType; // 8 bits typedef unsigned short OutputLabelPixelType; // 16 bits diff -Nru otb-4.0.0/Testing/Code/Learning/otbPeriodicSOM.cxx otb-4.2.0/Testing/Code/Learning/otbPeriodicSOM.cxx --- otb-4.0.0/Testing/Code/Learning/otbPeriodicSOM.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbPeriodicSOM.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkListSample.h" #include "itkImageRegionIterator.h" -int otbPeriodicSOMTest(int argc, char* argv[]) +int otbPeriodicSOMTest(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; char * inputFileName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbPeriodicSOMNew.cxx otb-4.2.0/Testing/Code/Learning/otbPeriodicSOMNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbPeriodicSOMNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbPeriodicSOMNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkEuclideanDistanceMetric.h" #include "itkListSample.h" -int otbPeriodicSOMNew(int argc, char* argv[]) +int otbPeriodicSOMNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef float ComponentType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbROIdataConversion.cxx otb-4.2.0/Testing/Code/Learning/otbROIdataConversion.cxx --- otb-4.0.0/Testing/Code/Learning/otbROIdataConversion.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbROIdataConversion.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkImageRegionIterator.h" #include -int otbROIdataConversion(int argc, char* argv[]) +int otbROIdataConversion(int itkNotUsed(argc), char* argv[]) { typedef double PixelType; const unsigned int Dimension = 2; @@ -34,7 +34,6 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileReader ROIReaderType; - typedef otb::ImageFileWriter WriterType; ConvertorType::Pointer convertor = ConvertorType::New(); ReaderType::Pointer readerIm = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/Learning/otbROIdataConversionNew.cxx otb-4.2.0/Testing/Code/Learning/otbROIdataConversionNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbROIdataConversionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbROIdataConversionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbROIdataConversionNew(int argc, char* argv[]) +int otbROIdataConversionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSEMClassifierNew.cxx otb-4.2.0/Testing/Code/Learning/otbSEMClassifierNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSEMClassifierNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSEMClassifierNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include -int otbSEMClassifierNew(int argc, char* argv[]) +int otbSEMClassifierNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double PixelType; typedef otb::VectorImage ImageType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbShiftScaleSampleListFilter.cxx otb-4.2.0/Testing/Code/Learning/otbShiftScaleSampleListFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbShiftScaleSampleListFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbShiftScaleSampleListFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ typedef otb::Statistics::ShiftScaleSampleListFilter ShiftScaleFilterType; -int otbShiftScaleSampleListFilterNew(int argc, char * argv[]) +int otbShiftScaleSampleListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { ShiftScaleFilterType::Pointer instance = ShiftScaleFilterType::New(); @@ -110,5 +110,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMActivationBuilder.cxx otb-4.2.0/Testing/Code/Learning/otbSOMActivationBuilder.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMActivationBuilder.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMActivationBuilder.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbVectorImage.h" #include "itkImageRegionIterator.h" -int otbSOMActivationBuilder(int argc, char* argv[]) +int otbSOMActivationBuilder(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; char * vectorSetFileName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx otb-4.2.0/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMActivationBuilderNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbSOMActivationBuilderNew(int argc, char* argv[]) +int otbSOMActivationBuilderNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef float ComponentType; @@ -34,7 +34,7 @@ typedef itk::Statistics::EuclideanDistanceMetric DistanceType; typedef otb::SOMMap MapType; - typedef otb::VectorImage InputImageType; + typedef itk::Statistics::ListSample ListSampleType; typedef otb::Image OutputImageType; typedef otb::SOMActivationBuilder SOMActivationBuilderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMbasedImageFilter.cxx otb-4.2.0/Testing/Code/Learning/otbSOMbasedImageFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMbasedImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMbasedImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkEuclideanDistanceMetric.h" -int otbSOMbasedImageFilterTest(int argc, char * argv[]) +int otbSOMbasedImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * somfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx otb-4.2.0/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMbasedImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbFlexibleDistanceWithMissingValue.h" #include "otbSOMbasedImageFilter.h" -int otbSOMbasedImageFilterNew(int argc, char * argv[]) +int otbSOMbasedImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMClassifier.cxx otb-4.2.0/Testing/Code/Learning/otbSOMClassifier.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMClassifier.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMClassifier.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -87,6 +87,8 @@ OutputImageType::Pointer outputImage = OutputImageType::New(); outputImage->SetRegions(reader->GetOutput()->GetLargestPossibleRegion()); + outputImage->SetOrigin(reader->GetOutput()->GetOrigin()); + outputImage->SetSpacing(reader->GetOutput()->GetSpacing()); outputImage->Allocate(); ClassifierType::OutputType* membershipSample = classifier->GetOutput(); diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMClassifierNew.cxx otb-4.2.0/Testing/Code/Learning/otbSOMClassifierNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMClassifierNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMClassifierNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkListSample.h" #include "otbVectorImage.h" -int otbSOMClassifierNew(int argc, char* argv[]) +int otbSOMClassifierNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef int LabelPixelType; @@ -33,7 +33,6 @@ typedef itk::VariableLengthVector PixelType; typedef itk::Statistics::EuclideanDistanceMetric DistanceType; typedef otb::SOMMap SOMMapType; - typedef otb::VectorImage InputImageType; typedef itk::Statistics::ListSample SampleType; typedef otb::SOMClassifier ClassifierType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOM.cxx otb-4.2.0/Testing/Code/Learning/otbSOM.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOM.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOM.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "itkListSample.h" #include "itkImageRegionIterator.h" -int otbSOM(int argc, char* argv[]) +int otbSOM(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; char * inputFileName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx otb-4.2.0/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMImageClassificationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbSOMImageClassificationFilter(int argc, char * argv[]) +int otbSOMImageClassificationFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * somfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx otb-4.2.0/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMImageClassificationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbSOMMap.h" -int otbSOMImageClassificationFilterNew(int argc, char * argv[]) +int otbSOMImageClassificationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMMap.cxx otb-4.2.0/Testing/Code/Learning/otbSOMMap.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMMap.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMMap.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkEuclideanDistanceMetric.h" #include "itkVariableLengthVector.h" -int otbSOMMap(int argc, char* argv[]) +int otbSOMMap(int itkNotUsed(argc), char* itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef float InternalPixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMMapNew.cxx otb-4.2.0/Testing/Code/Learning/otbSOMMapNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMMapNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMMapNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "itkRGBPixel.h" #include "itkEuclideanDistanceMetric.h" -int otbSOMMapNew(int argc, char* argv[]) +int otbSOMMapNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef float ComponentType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMNew.cxx otb-4.2.0/Testing/Code/Learning/otbSOMNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "itkEuclideanDistanceMetric.h" #include "itkListSample.h" -int otbSOMNew(int argc, char* argv[]) +int otbSOMNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef float ComponentType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMWithMissingValue.cxx otb-4.2.0/Testing/Code/Learning/otbSOMWithMissingValue.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMWithMissingValue.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMWithMissingValue.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ -int otbSOMWithMissingValueTest(int argc, char* argv[]) +int otbSOMWithMissingValueTest(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; char * inputFileName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx otb-4.2.0/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSOMWithMissingValueNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "otbFlexibleDistanceWithMissingValue.h" -int otbSOMWithMissingValueNew(int argc, char * argv[]) +int otbSOMWithMissingValueNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMClassifierImage.cxx otb-4.2.0/Testing/Code/Learning/otbSVMClassifierImage.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMClassifierImage.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMClassifierImage.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,6 @@ /** Read the input image and build the sample */ typedef double InputPixelType; - typedef std::vector InputVectorType; typedef int LabelPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMClassifierNew.cxx otb-4.2.0/Testing/Code/Learning/otbSVMClassifierNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMClassifierNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMClassifierNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkSubsample.h" #include "otbSVMClassifier.h" -int otbSVMClassifierNew(int argc, char* argv[]) +int otbSVMClassifierNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef int LabelPixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx otb-4.2.0/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMCrossValidationCostFunctionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,13 +25,11 @@ #include "otbSVMModel.h" #include "otbSVMCrossValidationCostFunction.h" -int otbSVMCrossValidationCostFunctionNew(int argc, char* argv[]) +int otbSVMCrossValidationCostFunctionNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - typedef otb::Image InputImageType; typedef otb::SVMModel ModelType; typedef otb::SVMCrossValidationCostFunction FunctionType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbSVMImageClassificationFilter(int argc, char * argv[]) +int otbSVMImageClassificationFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * modelfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorImage.h" #include "otbImage.h" -int otbSVMImageClassificationFilterNew(int argc, char * argv[]) +int otbSVMImageClassificationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilter.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilter.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbSVMImageClassificationWithRuleFilter(int argc, char * argv[]) +int otbSVMImageClassificationWithRuleFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * modelfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilterNew.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilterNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageClassificationWithRuleFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorImage.h" #include "otbImage.h" -int otbSVMImageClassificationWithRuleFilterNew(int argc, char * argv[]) +int otbSVMImageClassificationWithRuleFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorModelAccessor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ #include "otbImageFileReader.h" -int otbSVMImageModelEstimatorModelAccessor(int argc, char* argv[]) +int otbSVMImageModelEstimatorModelAccessor(int itkNotUsed(argc), char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingImageFileName = argv[2]; @@ -68,7 +68,6 @@ svmEstimator->Update(); typedef EstimatorType::SVMModelPointer SVMModelPointer; - typedef EstimatorType::SVMModelType SVMModelType; SVMModelPointer ptrModel = svmEstimator->GetModel(); std::ofstream f; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbSVMImageModelEstimator.h" -int otbSVMImageModelEstimatorNew(int argc, char* argv[]) +int otbSVMImageModelEstimatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; const unsigned int Dimension = 2; @@ -34,8 +34,6 @@ typedef otb::Image TrainingImageType; - typedef std::vector VectorType; - typedef otb::SVMImageModelEstimator EstimatorType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrain.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileReader.h" -int otbSVMImageModelEstimatorTrain(int argc, char* argv[]) +int otbSVMImageModelEstimatorTrain(int itkNotUsed(argc), char* argv[]) { // Force the pseudo-random number generator to always output // the same sequence of random numbers @@ -43,7 +43,6 @@ const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; typedef otb::Image TrainingImageType; - typedef std::vector VectorType; typedef otb::SVMImageModelEstimator EstimatorType; typedef otb::ImageFileReader InputReaderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMImageModelEstimatorTrainOneClass.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "otbImageFileReader.h" -int otbSVMImageModelEstimatorTrainOneClass(int argc, char* argv[]) +int otbSVMImageModelEstimatorTrainOneClass(int itkNotUsed(argc), char* argv[]) { const char* inputImageFileName = argv[1]; const char* trainingImageFileName = argv[2]; @@ -37,7 +37,6 @@ const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; typedef otb::Image TrainingImageType; - typedef std::vector VectorType; typedef otb::SVMImageModelEstimator EstimatorType; typedef otb::ImageFileReader InputReaderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx otb-4.2.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageClassificationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,6 @@ const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; typedef otb::Image TrainingImageType; - typedef std::vector VectorType; typedef otb::SVMImageModelEstimator EstimatorType; typedef otb::ImageFileReader InputReaderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx otb-4.2.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMInverseCosSpectralAngleKernelFunctorImageModelEstimatorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,6 @@ const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; typedef otb::Image TrainingImageType; - typedef std::vector VectorType; typedef otb::SVMImageModelEstimator EstimatorType; typedef otb::ImageFileReader InputReaderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMMarginSampler.cxx otb-4.2.0/Testing/Code/Learning/otbSVMMarginSampler.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMMarginSampler.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMMarginSampler.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbSVMMarginSampler.h" #include "otbSVMModel.h" -int otbSVMMarginSamplerNew(int argc, char* argv[]) +int otbSVMMarginSamplerNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef itk::VariableLengthVector SampleType; typedef itk::Statistics::ListSample SampleListType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMModelAccessor.cxx otb-4.2.0/Testing/Code/Learning/otbSVMModelAccessor.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMModelAccessor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMModelAccessor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,13 +25,10 @@ #include "otbSVMModel.h" -int otbSVMModelAccessor(int argc, char* argv[]) +int otbSVMModelAccessor(int itkNotUsed(argc), char* argv[]) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image InputImageType; typedef otb::SVMModel ModelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMModelCopyTest.cxx otb-4.2.0/Testing/Code/Learning/otbSVMModelCopyTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMModelCopyTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMModelCopyTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -16,21 +16,17 @@ =========================================================================*/ - - #include "itkMacro.h" #include "otbImage.h" #include #include "otbSVMModel.h" -int otbSVMModelCopyTest(int argc, char* argv[]) +int otbSVMModelCopyTest(int itkNotUsed(argc), char* argv[]) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - typedef otb::Image InputImageType; typedef otb::SVMModel ModelType; ModelType::Pointer svmModel = ModelType::New(); diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx otb-4.2.0/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMModelGenericKernelLoadSave.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -63,13 +63,10 @@ } -int otbSVMModelGenericKernelLoadSave(int argc, char* argv[]) +int otbSVMModelGenericKernelLoadSave(int itkNotUsed(argc), char* argv[]) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image InputImageType; typedef otb::SVMModel ModelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx otb-4.2.0/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMModelGenericKernelsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -251,7 +251,6 @@ std::string classKey = "Class"; typedef double PixelType; - typedef int LabeledPixelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMModelLoad.cxx otb-4.2.0/Testing/Code/Learning/otbSVMModelLoad.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMModelLoad.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMModelLoad.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,14 +24,10 @@ #include "otbSVMModel.h" -int otbSVMModelLoad(int argc, char* argv[]) +int otbSVMModelLoad(int itkNotUsed(argc), char* argv[]) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image InputImageType; - typedef otb::SVMModel ModelType; ModelType::Pointer svmModel = ModelType::New(); diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMModelLoadSave.cxx otb-4.2.0/Testing/Code/Learning/otbSVMModelLoadSave.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMModelLoadSave.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMModelLoadSave.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,13 +24,10 @@ #include "otbSVMModel.h" -int otbSVMModelLoadSave(int argc, char* argv[]) +int otbSVMModelLoadSave(int itkNotUsed(argc), char* argv[]) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - - typedef otb::Image InputImageType; typedef otb::SVMModel ModelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMModelNew.cxx otb-4.2.0/Testing/Code/Learning/otbSVMModelNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMModelNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMModelNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,13 +24,11 @@ #include "otbSVMModel.h" -int otbSVMModelNew(int argc, char* argv[]) +int otbSVMModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; - const unsigned int Dimension = 2; - typedef otb::Image InputImageType; typedef otb::SVMModel ModelType; ModelType::Pointer svmModel = ModelType::New(); diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx otb-4.2.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSVMPointSetModelEstimator.h" -int otbSVMPointSetModelEstimatorNew(int argc, char* argv[]) +int otbSVMPointSetModelEstimatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef std::vector InputPixelType; typedef double LabelPixelType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx otb-4.2.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMPointSetModelEstimatorTrain.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSVMPointSetModelEstimator.h" -int otbSVMPointSetModelEstimatorTrain(int argc, char* argv[]) +int otbSVMPointSetModelEstimatorTrain(int itkNotUsed(argc), char* argv[]) { const char* outputModelFileName = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Learning/otbSVMSampleListModelEstimatorTest.cxx otb-4.2.0/Testing/Code/Learning/otbSVMSampleListModelEstimatorTest.cxx --- otb-4.0.0/Testing/Code/Learning/otbSVMSampleListModelEstimatorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbSVMSampleListModelEstimatorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ #include "otbListSampleGenerator.h" -int otbSVMSampleListModelEstimatorNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) +int otbSVMSampleListModelEstimatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef double InputPixelType; typedef double LabelPixelType; @@ -72,7 +72,6 @@ std::string classKey = "Class"; typedef double PixelType; - typedef int LabeledPixelType; typedef otb::VectorImage ImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/Learning/otbTrainMachineLearningModel.cxx otb-4.2.0/Testing/Code/Learning/otbTrainMachineLearningModel.cxx --- otb-4.0.0/Testing/Code/Learning/otbTrainMachineLearningModel.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Learning/otbTrainMachineLearningModel.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -112,7 +112,7 @@ return true; } -int otbLibSVMMachineLearningModelNew(int argc, char * argv[]) +int otbLibSVMMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::LibSVMMachineLearningModel SVMType; SVMType::Pointer svmclassifier = SVMType::New(); @@ -194,7 +194,7 @@ } } -int otbSVMMachineLearningModelNew(int argc, char * argv[]) +int otbSVMMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::SVMMachineLearningModel SVMType; SVMType::Pointer svmclassifier = SVMType::New(); @@ -276,7 +276,7 @@ } } -int otbKNearestNeighborsMachineLearningModelNew(int argc, char * argv[]) +int otbKNearestNeighborsMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::KNearestNeighborsMachineLearningModel KNearestNeighborsType; KNearestNeighborsType::Pointer knnclassifier = KNearestNeighborsType::New(); @@ -358,7 +358,7 @@ } } -int otbRandomForestsMachineLearningModelNew(int argc, char * argv[]) +int otbRandomForestsMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::RandomForestsMachineLearningModel RandomForestType; RandomForestType::Pointer rfclassifier = RandomForestType::New(); @@ -449,7 +449,7 @@ } } -int otbBoostMachineLearningModelNew(int argc, char * argv[]) +int otbBoostMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::BoostMachineLearningModel BoostType; BoostType::Pointer classifier = BoostType::New(); @@ -540,7 +540,7 @@ } } -int otbANNMachineLearningModelNew(int argc, char * argv[]) +int otbANNMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::NeuralNetworkMachineLearningModel ANNType; ANNType::Pointer classifier = ANNType::New(); @@ -635,7 +635,7 @@ } } -int otbNormalBayesMachineLearningModelNew(int argc, char * argv[]) +int otbNormalBayesMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::NormalBayesMachineLearningModel NormalBayesType; NormalBayesType::Pointer classifier = NormalBayesType::New(); @@ -717,7 +717,7 @@ } } -int otbDecisionTreeMachineLearningModelNew(int argc, char * argv[]) +int otbDecisionTreeMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::DecisionTreeMachineLearningModel DecisionTreeType; DecisionTreeType::Pointer classifier = DecisionTreeType::New(); @@ -800,7 +800,7 @@ } -int otbGradientBoostedTreeMachineLearningModelNew(int argc, char * argv[]) +int otbGradientBoostedTreeMachineLearningModelNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::GradientBoostedTreeMachineLearningModel GBTreeType; GBTreeType::Pointer classifier = GBTreeType::New(); @@ -881,5 +881,3 @@ return EXIT_FAILURE; } } - - diff -Nru otb-4.0.0/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx otb-4.2.0/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx --- otb-4.0.0/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMarkovRandomFieldFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "otbMRFOptimizerMetropolis.h" #include "otbMRFSamplerRandom.h" -int otbMarkovRandomFieldFilter(int argc, char* argv[]) +int otbMarkovRandomFieldFilter(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx otb-4.2.0/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMarkovRandomFieldFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMarkovRandomFieldFilter.h" #include "otbImage.h" -int otbMarkovRandomFieldFilterNew(int argc, char * argv[]) +int otbMarkovRandomFieldFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelity.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include -int otbMRFEnergyEdgeFidelity(int argc, char * argv[]) +int otbMRFEnergyEdgeFidelity(int itkNotUsed(argc), char * argv[]) { const char * outputFile = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyEdgeFidelityNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,13 +20,10 @@ #include "otbMRFEnergyEdgeFidelity.h" #include "otbImage.h" -int otbMRFEnergyEdgeFidelityNew(int argc, char * argv[]) +int otbMRFEnergyEdgeFidelityNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; - typedef int PixelType2; - typedef otb::Image ImageType; - typedef otb::Image ImageType2; typedef otb::MRFEnergyEdgeFidelity MRFEnergyType; MRFEnergyType::Pointer object = MRFEnergyType::New(); diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyFisherClassification.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyFisherClassification.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyFisherClassification.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyFisherClassification.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include -int otbMRFEnergyFisherClassificationNew(int argc, char * argv[]) +int otbMRFEnergyFisherClassificationNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelTypeInput; typedef int PixelTypeLabel; @@ -38,7 +38,7 @@ return EXIT_SUCCESS; } -int otbMRFEnergyFisherClassification(int argc, char * argv[]) +int otbMRFEnergyFisherClassification(int itkNotUsed(argc), char * argv[]) { const char * outputFile = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussianClassification.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include -int otbMRFEnergyGaussianClassification(int argc, char * argv[]) +int otbMRFEnergyGaussianClassification(int itkNotUsed(argc), char * argv[]) { const char * outputFile = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussianClassificationNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFEnergyGaussianClassification.h" #include "otbImage.h" -int otbMRFEnergyGaussianClassificationNew(int argc, char * argv[]) +int otbMRFEnergyGaussianClassificationNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussian.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussian.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussian.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussian.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include -int otbMRFEnergyGaussian(int argc, char * argv[]) +int otbMRFEnergyGaussian(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef int PixelType2; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyGaussianNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFEnergyGaussian.h" #include "otbImage.h" -int otbMRFEnergyGaussianNew(int argc, char * argv[]) +int otbMRFEnergyGaussianNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyPotts.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyPotts.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyPotts.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyPotts.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include -int otbMRFEnergyPotts(int argc, char * argv[]) +int otbMRFEnergyPotts(int itkNotUsed(argc), char * argv[]) { const char * outputFile = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFEnergyPottsNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFEnergyPotts.h" #include "otbImage.h" -int otbMRFEnergyPottsNew(int argc, char * argv[]) +int otbMRFEnergyPottsNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerICM.cxx otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerICM.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerICM.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerICM.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFOptimizerICM.h" #include -int otbMRFOptimizerICM(int argc, char * argv[]) +int otbMRFOptimizerICM(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::MRFOptimizerICM MRFOptimizerICMType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerICMNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFOptimizerICM.h" #include -int otbMRFOptimizerICMNew(int argc, char * argv[]) +int otbMRFOptimizerICMNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::MRFOptimizerICM MRFOptimizerType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerMetropolis.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include #include -int otbMRFOptimizerMetropolis(int argc, char * argv[]) +int otbMRFOptimizerMetropolis(int itkNotUsed(argc), char * argv[]) { const char * outputFile = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFOptimizerMetropolisNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFOptimizerMetropolis.h" #include -int otbMRFOptimizerMetropolisNew(int argc, char * argv[]) +int otbMRFOptimizerMetropolisNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::MRFOptimizerMetropolis MRFOptimizerType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFSamplerMAP.cxx otb-4.2.0/Testing/Code/Markov/otbMRFSamplerMAP.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFSamplerMAP.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFSamplerMAP.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbMRFEnergyPotts.h" #include -int otbMRFSamplerMAP(int argc, char * argv[]) +int otbMRFSamplerMAP(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * labelImage = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFSamplerMAPNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbMRFSamplerMAP.h" #include "otbImage.h" -int otbMRFSamplerMAPNew(int argc, char * argv[]) +int otbMRFSamplerMAPNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandom.cxx otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandom.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandom.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandom.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbMRFEnergyPotts.h" #include -int otbMRFSamplerRandom(int argc, char * argv[]) +int otbMRFSamplerRandom(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * labelImage = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandomMAP.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include -int otbMRFSamplerRandomMAP(int argc, char * argv[]) +int otbMRFSamplerRandomMAP(int itkNotUsed(argc), char * argv[]) { const char * inputImage = argv[1]; const char * labelImage = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandomMAPNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFSamplerRandomMAP.h" #include "otbImage.h" -int otbMRFSamplerRandomMAPNew(int argc, char * argv[]) +int otbMRFSamplerRandomMAPNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx --- otb-4.0.0/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Markov/otbMRFSamplerRandomNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMRFSamplerRandom.h" #include "otbImage.h" -int otbMRFSamplerRandomNew(int argc, char * argv[]) +int otbMRFSamplerRandomNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double PixelType; typedef otb::Image ImageType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbConvexOrConcaveClassificationFilter(int argc, char * argv[]) +int otbConvexOrConcaveClassificationFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * levelingfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbConvexOrConcaveClassificationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbConvexOrConcaveClassificationFilter.h" #include "otbImage.h" -int otbConvexOrConcaveClassificationFilterNew(int argc, char * argv[]) +int otbConvexOrConcaveClassificationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image InputImageType; typedef otb::Image OutputImageType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImage.h" #include "itkBinaryBallStructuringElement.h" -int otbGeodesicMorphologyDecompositionImageFilter(int argc, char * argv[]) +int otbGeodesicMorphologyDecompositionImageFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbGeodesicMorphologyDecompositionImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbImage.h" #include "itkBinaryBallStructuringElement.h" -int otbGeodesicMorphologyDecompositionImageFilterNew(int argc, char * argv[]) +int otbGeodesicMorphologyDecompositionImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Image ImageType; typedef itk::BinaryBallStructuringElement ImageType; typedef otb::GeodesicMorphologyLevelingFilter FilterType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkMacro.h" -int otbMorphologicalClosingProfileFilter(int argc, char * argv[]) +int otbMorphologicalClosingProfileFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilenamePrefix = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalClosingProfileFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,15 +21,12 @@ #include "itkMacro.h" -int otbMorphologicalClosingProfileFilterNew(int argc, char * argv[]) +int otbMorphologicalClosingProfileFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; - typedef double OutputPixelType; typedef otb::Image InputImageType; - typedef otb::Image OutputImageType; - typedef itk::BinaryBallStructuringElement StructuringElementType; typedef otb::MorphologicalClosingProfileFilter ClosingProfileFilterType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkMacro.h" -int otbMorphologicalOpeningProfileFilter(int argc, char * argv[]) +int otbMorphologicalOpeningProfileFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilenamePrefix = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalOpeningProfileFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,14 +21,12 @@ #include "itkMacro.h" -int otbMorphologicalOpeningProfileFilterNew(int argc, char * argv[]) +int otbMorphologicalOpeningProfileFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; - typedef double OutputPixelType; typedef otb::Image InputImageType; - typedef otb::Image OutputImageType; typedef itk::BinaryBallStructuringElement StructuringElementType; typedef otb::MorphologicalOpeningProfileFilter diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,9 +24,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -#include "itkMacro.h" - -int otbMorphologicalPyramidAnalysisFilter(int argc, char * argv[]) +int otbMorphologicalPyramidAnalysisFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilenamePrefix = argv[2]; @@ -101,7 +99,7 @@ writer->SetInput(itInfDeci.Get()); writer->SetFileName(oss.str().c_str()); writer->Update(); - std::cout << "File " << oss << " written" << std::endl; + std::cout << "File " << oss.str() << " written" << std::endl; oss.str(""); oss << outputFilenamePrefix << "_sd_" << i << "." << outputFilenameSuffix; writer->SetInput(itSupDeci.Get()); diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidAnalysisFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkBinaryBallStructuringElement.h" #include "otbImage.h" -int otbMorphologicalPyramidAnalysisFilterNew(int argc, char * argv[]) +int otbMorphologicalPyramidAnalysisFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbMorphologicalPyramidMRToMSConverter(int argc, char * argv[]) +int otbMorphologicalPyramidMRToMSConverter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename1 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidMRToMSConverterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMorphologicalPyramidMRToMSConverter.h" #include "otbImage.h" -int otbMorphologicalPyramidMRToMSConverterNew(int argc, char * argv[]) +int otbMorphologicalPyramidMRToMSConverterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidResampler.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbMorphologicalPyramidResampler(int argc, char * argv[]) +int otbMorphologicalPyramidResampler(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; const char* outputFilename1 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidResamplerNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbMorphologicalPyramidResampler.h" #include "otbImage.h" -int otbMorphologicalPyramidResamplerNew(int argc, char * argv[]) +int otbMorphologicalPyramidResamplerNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbMorphologicalPyramidSegmentationFilter(int argc, char * argv[]) +int otbMorphologicalPyramidSegmentationFilter(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; const char* outputFilenamePrefix = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmentationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbMorphologicalPyramidSegmentationFilter.h" #include "otbImage.h" -int otbMorphologicalPyramidSegmentationFilterNew(int argc, char * argv[]) +int otbMorphologicalPyramidSegmentationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbMorphologicalPyramidSegmenter(int argc, char * argv[]) +int otbMorphologicalPyramidSegmenter(int itkNotUsed(argc), char * argv[]) { const char* inputFilename = argv[1]; const char* originalFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSegmenterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbMorphologicalPyramidSegmenter.h" #include "otbImage.h" -int otbMorphologicalPyramidSegmenterNew(int argc, char * argv[]) +int otbMorphologicalPyramidSegmenterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbImage.h" -int otbMorphologicalPyramidSynthesisFilter(int argc, char * argv[]) +int otbMorphologicalPyramidSynthesisFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMorphologicalPyramidSynthesisFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMorphologicalPyramidSynthesisFilter.h" #include "otbImage.h" -int otbMorphologicalPyramidSynthesisFilterNew(int argc, char * argv[]) +int otbMorphologicalPyramidSynthesisFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned char InputPixelType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx otb-4.2.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ #include "itkMacro.h" -int otbMultiScaleConvexOrConcaveClassificationFilter(int argc, char * argv[]) +int otbMultiScaleConvexOrConcaveClassificationFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbMultiScaleConvexOrConcaveClassificationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,15 +20,13 @@ #include "otbImage.h" #include "itkMacro.h" -int otbMultiScaleConvexOrConcaveClassificationFilterNew(int argc, char * argv[]) +int otbMultiScaleConvexOrConcaveClassificationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef double InputPixelType; - typedef double OutputPixelType; typedef unsigned short LabeledPixelType; typedef otb::Image InputImageType; - typedef otb::Image OutputImageType; typedef otb::Image LabeledImageType; typedef otb::MultiScaleConvexOrConcaveClassificationFilter -int otbWaveletPacketTransform_generic(int argc, char * argv[]) +int otbWaveletPacketTransform_generic(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbWaveletPacketTransformNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbWaveletPacketTransform.h" #include "otbWaveletPacketDecompositionCosts.h" -int otbWaveletPacketTransformNew(int argc, char * argv[]) +int otbWaveletPacketTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/MultiScale/otbWaveletTransformNew.cxx otb-4.2.0/Testing/Code/MultiScale/otbWaveletTransformNew.cxx --- otb-4.0.0/Testing/Code/MultiScale/otbWaveletTransformNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiScale/otbWaveletTransformNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbWaveletFilterBank.h" #include "otbWaveletTransform.h" -int otbWaveletTransformNew(int argc, char * argv[]) +int otbWaveletTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/MultiTemporal/otbEnvelopeSavitzkyGolayInterpolationFunctorTest.cxx otb-4.2.0/Testing/Code/MultiTemporal/otbEnvelopeSavitzkyGolayInterpolationFunctorTest.cxx --- otb-4.0.0/Testing/Code/MultiTemporal/otbEnvelopeSavitzkyGolayInterpolationFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiTemporal/otbEnvelopeSavitzkyGolayInterpolationFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbEnvelopeSavitzkyGolayInterpolationFunctor.h" #include "otbTimeSeries.h" -int otbEnvelopeSavitzkyGolayInterpolationFunctorTest(int argc, char* argv[]) +int otbEnvelopeSavitzkyGolayInterpolationFunctorTest(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef float PixelType; diff -Nru otb-4.0.0/Testing/Code/MultiTemporal/otbPolynomialTimeSeriesTest.cxx otb-4.2.0/Testing/Code/MultiTemporal/otbPolynomialTimeSeriesTest.cxx --- otb-4.0.0/Testing/Code/MultiTemporal/otbPolynomialTimeSeriesTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiTemporal/otbPolynomialTimeSeriesTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "itkFixedArray.h" #include "otbTimeSeries.h" -int otbPolynomialTimeSeriesTest(int argc, char* argv[]) +int otbPolynomialTimeSeriesTest(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef double CoefficientPrecisionType; diff -Nru otb-4.0.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorNew.cxx otb-4.2.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorNew.cxx --- otb-4.0.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbSavitzkyGolayInterpolationFunctor.h" #include "otbTimeSeries.h" -int otbSavitzkyGolayInterpolationFunctorNew(int argc, char* argv[]) +int otbSavitzkyGolayInterpolationFunctorNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef float PixelType; diff -Nru otb-4.0.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorTest.cxx otb-4.2.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorTest.cxx --- otb-4.0.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiTemporal/otbSavitzkyGolayInterpolationFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbSavitzkyGolayInterpolationFunctor.h" #include "otbTimeSeries.h" -int otbSavitzkyGolayInterpolationFunctorTest(int argc, char* argv[]) +int otbSavitzkyGolayInterpolationFunctorTest(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef float PixelType; diff -Nru otb-4.0.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorNew.cxx otb-4.2.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorNew.cxx --- otb-4.0.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbTimeSeriesLeastSquareFittingFunctor.h" #include "otbTimeSeries.h" -int otbTimeSeriesLeastSquareFittingFunctorNew(int argc, char* argv[]) +int otbTimeSeriesLeastSquareFittingFunctorNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef float PixelType; diff -Nru otb-4.0.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorTest.cxx otb-4.2.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorTest.cxx --- otb-4.0.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbTimeSeriesLeastSquareFittingFunctor.h" #include "otbTimeSeries.h" -int otbTimeSeriesLeastSquareFittingFunctorTest(int argc, char* argv[]) +int otbTimeSeriesLeastSquareFittingFunctorTest(int itkNotUsed(argc), char* argv[]) { const unsigned int Degree = 2; diff -Nru otb-4.0.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorWeightsTest.cxx otb-4.2.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorWeightsTest.cxx --- otb-4.0.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorWeightsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/MultiTemporal/otbTimeSeriesLeastSquareFittingFunctorWeightsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbTimeSeriesLeastSquareFittingFunctor.h" #include "otbTimeSeries.h" -int otbTimeSeriesLeastSquareFittingFunctorWeightsTest(int argc, char* argv[]) +int otbTimeSeriesLeastSquareFittingFunctorWeightsTest(int itkNotUsed(argc), char* argv[]) { const unsigned int Degree = 2; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbAttributesMapLabelObjectNew.cxx otb-4.2.0/Testing/Code/OBIA/otbAttributesMapLabelObjectNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbAttributesMapLabelObjectNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbAttributesMapLabelObjectNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbAttributesMapLabelObject.h" -int otbAttributesMapLabelObjectNew(int argc, char* argv[]) +int otbAttributesMapLabelObjectNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObject LabelObjectType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbAttributesMapLabelObjectWithClassLabelNew.cxx otb-4.2.0/Testing/Code/OBIA/otbAttributesMapLabelObjectWithClassLabelNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbAttributesMapLabelObjectWithClassLabelNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbAttributesMapLabelObjectWithClassLabelNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbAttributesMapLabelObjectWithClassLabel.h" -int otbAttributesMapLabelObjectWithClassLabelNew(int argc, char* argv[]) +int otbAttributesMapLabelObjectWithClassLabelNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObjectWithClassLabel LabelObjectType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbAttributesMapOpeningLabelMapFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbAttributesMapOpeningLabelMapFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbAttributesMapOpeningLabelMapFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbAttributesMapOpeningLabelMapFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkLabelMap.h" #include "otbAttributesMapOpeningLabelMapFilter.h" -int otbAttributesMapOpeningLabelMapFilterNew(int argc, char* argv[]) +int otbAttributesMapOpeningLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbBandsStatisticsAttributesLabelMapFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbBandsStatisticsAttributesLabelMapFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbBandsStatisticsAttributesLabelMapFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbBandsStatisticsAttributesLabelMapFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,13 +45,13 @@ typedef otb::BandsStatisticsAttributesLabelMapFilter BandsStatisticsFilterType; -int otbBandsStatisticsAttributesLabelMapFilterNew(int argc, char* argv[]) +int otbBandsStatisticsAttributesLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { BandsStatisticsFilterType::Pointer object = BandsStatisticsFilterType::New(); return EXIT_SUCCESS; } -int otbBandsStatisticsAttributesLabelMapFilter(int argc, char* argv[]) +int otbBandsStatisticsAttributesLabelMapFilter(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; const char * lfname = argv[2]; @@ -104,4 +104,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/OBIA/otbGISTableToLabelMapFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbGISTableToLabelMapFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbGISTableToLabelMapFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbGISTableToLabelMapFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbGISTable.h" #include "itkAttributeLabelObject.h" -int otbGISTableToLabelMapFilterNew(int argc, char * argv[]) +int otbGISTableToLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const int Dimension = 2; typedef double PType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbImageToLabelMapWithAttributesFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbImageToLabelMapWithAttributesFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbImageToLabelMapWithAttributesFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbImageToLabelMapWithAttributesFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,17 +24,14 @@ #include "otbImageFileReader.h" #include "otbAttributesMapLabelObjectWithClassLabel.h" -int otbImageToLabelMapWithAttributesFilter(int argc, char* argv[]) +int otbImageToLabelMapWithAttributesFilter(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; const char * lfname = argv[2]; // Convenient typedefs typedef otb::VectorImage ImageType; - typedef ImageType::IndexType IndexType; - typedef otb::Image LabeledImageType; - typedef otb::AttributesMapLabelObjectWithClassLabel LabelObjectType; typedef otb::ImageToLabelMapWithAttributesFilter ImageType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbKMeansAttributesLabelMapFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbKMeansAttributesLabelMapFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbKMeansAttributesLabelMapFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbKMeansAttributesLabelMapFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -48,13 +48,13 @@ typedef otb::ShapeAttributesLabelMapFilter ShapeFilterType; typedef otb::KMeansAttributesLabelMapFilter KMeansAttributesLabelMapFilterType; -int otbKMeansAttributesLabelMapFilterNew(int argc, char * argv[]) +int otbKMeansAttributesLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { KMeansAttributesLabelMapFilterType::Pointer radiometricLabelMapFilter = KMeansAttributesLabelMapFilterType::New(); return EXIT_SUCCESS; } -int otbKMeansAttributesLabelMapFilter(int argc, char * argv[]) +int otbKMeansAttributesLabelMapFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * lfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelImageToLabelMapWithAdjacencyFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelImageToLabelMapWithAdjacencyFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelImageToLabelMapWithAdjacencyFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelImageToLabelMapWithAdjacencyFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ < LabelImageType, LabelMapType> FilterType; -int otbLabelImageToLabelMapWithAdjacencyFilterNew(int argc, char * argv[]) +int otbLabelImageToLabelMapWithAdjacencyFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { // Instantiation FilterType::Pointer filter = FilterType::New(); @@ -44,7 +44,7 @@ return EXIT_SUCCESS; } -int otbLabelImageToLabelMapWithAdjacencyFilter(int argc, char * argv[]) +int otbLabelImageToLabelMapWithAdjacencyFilter(int itkNotUsed(argc), char * argv[]) { LabelReaderType::Pointer reader = LabelReaderType::New(); reader->SetFileName(argv[1]); diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapSourceNew.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapSourceNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapSourceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapSourceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkLabelMap.h" #include "otbAttributesMapLabelObject.h" -int otbLabelMapSourceNew(int argc, char * argv[]) +int otbLabelMapSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef unsigned short LabelType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapSVMClassifier.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapSVMClassifier.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapSVMClassifier.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapSVMClassifier.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -76,13 +76,13 @@ return newLabelObject; } -int otbLabelMapSVMClassifierNew(int argc, char * argv[]) +int otbLabelMapSVMClassifierNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { ClassifierType::Pointer classifier = ClassifierType::New(); return EXIT_SUCCESS; } -int otbLabelMapSVMClassifier(int argc, char * argv[]) +int otbLabelMapSVMClassifier(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * lfname = argv[2]; @@ -176,5 +176,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapToAttributeImageFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapToAttributeImageFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapToAttributeImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapToAttributeImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkLabelMap.h" #include "otbVectorImage.h" -int otbLabelMapToAttributeImageFilterNew(int argc, char* argv[]) +int otbLabelMapToAttributeImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapToGISTableFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapToGISTableFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapToGISTableFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapToGISTableFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbGISTable.h" #include "itkAttributeLabelObject.h" -int otbLabelMapToGISTableFilterNew(int argc, char * argv[]) +int otbLabelMapToGISTableFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const int Dimension = 2; typedef unsigned char PType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapToSampleListFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapToSampleListFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapToSampleListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapToSampleListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkVariableLengthVector.h" #include "itkListSample.h" -int otbLabelMapToSampleListFilterNew(int argc, char* argv[]) +int otbLabelMapToSampleListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -51,10 +51,7 @@ typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; typedef itk::LabelImageToLabelMapFilter LabelMapFilterType; - typedef otb::Polygon PolygonType; - typedef otb::Functor::LabelObjectToPolygonFunctor FunctorType; typedef otb::VectorData VectorDataType; - typedef VectorDataType::DataNodeType DataNodeType; typedef otb::VectorDataFileWriter WriterType; typedef otb::VectorDataProjectionFilter VectorDataFilterType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapToVectorDataFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,11 +20,9 @@ #include "otbVectorData.h" #include "itkAttributeLabelObject.h" -int otbLabelMapToVectorDataFilterNew(int argc, char * argv[]) +int otbLabelMapToVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const int dim = 2; - typedef unsigned char PType; - typedef otb::VectorData<> VectorDataType; typedef itk::AttributeLabelObject LabelObjectType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelMapWithClassLabelToLabeledSampleListFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelMapWithClassLabelToLabeledSampleListFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelMapWithClassLabelToLabeledSampleListFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelMapWithClassLabelToLabeledSampleListFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkVariableLengthVector.h" #include "itkListSample.h" -int otbLabelMapWithClassLabelToLabeledSampleListFilterNew(int argc, char* argv[]) +int otbLabelMapWithClassLabelToLabeledSampleListFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObjectWithClassLabel LabelObjectType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbLabelObjectToPolygonFunctorNew.cxx otb-4.2.0/Testing/Code/OBIA/otbLabelObjectToPolygonFunctorNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbLabelObjectToPolygonFunctorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbLabelObjectToPolygonFunctorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbAttributesMapLabelObject.h" #include -int otbLabelObjectToPolygonFunctorNew(int argc, char * argv[]) +int otbLabelObjectToPolygonFunctorNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef unsigned short LabelType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx otb-4.2.0/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx --- otb-4.0.0/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbMeanShiftConnectedComponentSegmentationFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ typedef otb::MeanShiftSmoothingImageFilter MeanShiftFilterType; -int otbMeanShiftConnectedComponentSegmentationFilter(int argc, char * argv[]) +int otbMeanShiftConnectedComponentSegmentationFilter(int itkNotUsed(argc), char * argv[]) { /* mean shift parameters */ diff -Nru otb-4.0.0/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx otb-4.2.0/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx --- otb-4.0.0/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbMeanShiftStreamingConnectedComponentOBIATest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,7 +50,7 @@ typedef otb::MeanShiftSmoothingImageFilter MeanShiftFilterType; -int otbMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter(int argc, char * argv[]) +int otbMeanShiftStreamingConnectedComponentSegmentationOBIAToVectorDataFilter(int itkNotUsed(argc), char * argv[]) { /* mean shift parameters */ diff -Nru otb-4.0.0/Testing/Code/OBIA/otbMinMaxAttributesLabelMapFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbMinMaxAttributesLabelMapFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbMinMaxAttributesLabelMapFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbMinMaxAttributesLabelMapFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,13 +43,13 @@ typedef otb::ShapeAttributesLabelMapFilter ShapeFilterType; typedef otb::MinMaxAttributesLabelMapFilter MinMaxAttributesLabelMapFilterType; -int otbMinMaxAttributesLabelMapFilterNew(int argc, char * argv[]) +int otbMinMaxAttributesLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { MinMaxAttributesLabelMapFilterType::Pointer radiometricLabelMapFilter = MinMaxAttributesLabelMapFilterType::New(); return EXIT_SUCCESS; } -int otbMinMaxAttributesLabelMapFilter(int argc, char * argv[]) +int otbMinMaxAttributesLabelMapFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * lfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbNormalizeAttributesLabelMapFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,13 +45,13 @@ typedef otb::MinMaxAttributesLabelMapFilter MinMaxAttributesLabelMapFilterType; typedef otb::NormalizeAttributesLabelMapFilter NormalizeAttributesLabelMapFilterType; -int otbNormalizeAttributesLabelMapFilterNew(int argc, char * argv[]) +int otbNormalizeAttributesLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { NormalizeAttributesLabelMapFilterType::Pointer normalizeLabelMapFilter = NormalizeAttributesLabelMapFilterType::New(); return EXIT_SUCCESS; } -int otbNormalizeAttributesLabelMapFilter(int argc, char * argv[]) +int otbNormalizeAttributesLabelMapFilter(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * lfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbShapeAttributesLabelMapFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbShapeAttributesLabelMapFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbShapeAttributesLabelMapFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbShapeAttributesLabelMapFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkLabelMap.h" #include "otbShapeAttributesLabelMapFilter.h" -int otbShapeAttributesLabelMapFilterNew(int argc, char* argv[]) +int otbShapeAttributesLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbStatisticsAttributesLabelMapFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbStatisticsAttributesLabelMapFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbStatisticsAttributesLabelMapFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbStatisticsAttributesLabelMapFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbStatisticsAttributesLabelMapFilter.h" #include "otbImage.h" -int otbStatisticsAttributesLabelMapFilterNew(int argc, char* argv[]) +int otbStatisticsAttributesLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Image ImageType; typedef otb::AttributesMapLabelObject LabelObjectType; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbStreamingConnectedComponentOBIATest.cxx otb-4.2.0/Testing/Code/OBIA/otbStreamingConnectedComponentOBIATest.cxx --- otb-4.0.0/Testing/Code/OBIA/otbStreamingConnectedComponentOBIATest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbStreamingConnectedComponentOBIATest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ MaskImageType, VectorDataType > ConnectedComponentSegmentationOBIAToVectorDataFilterType; -int otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilterNew(int argc, char * argv[]) +int otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { ConnectedComponentSegmentationOBIAToVectorDataFilterType::FilterType::Pointer connected = ConnectedComponentSegmentationOBIAToVectorDataFilterType::FilterType::New(); @@ -49,7 +49,7 @@ return EXIT_SUCCESS; } -int otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter(int argc, char * argv[]) +int otbStreamingConnectedComponentSegmentationOBIAToVectorDataFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilter.cxx otb-4.2.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilter.cxx --- otb-4.0.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -79,9 +79,6 @@ p->SetVectorDataObject(reader->GetOutput()); typedef VectorDataType::DataNodeType::PolygonType::RegionType RegionType; RegionType region; - typedef RegionType::IndexType index; - typedef RegionType::SizeType size; - p->SetBoundingRegion(region); //Compute the global bounding box of the vectordata diff -Nru otb-4.0.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilterNew.cxx otb-4.2.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilterNew.cxx --- otb-4.0.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/OBIA/otbVectorDataToLabelMapFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbVectorDataToLabelMapFilter.h" #include "otbAttributesMapLabelObject.h" -int otbVectorDataToLabelMapFilterNew(int argc, char * argv[]) +int otbVectorDataToLabelMapFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef unsigned short LabelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx otb-4.2.0/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx --- otb-4.0.0/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ObjectDetection/otbLabeledSampleLocalizationGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbVectorDataFileWriter.h" #include "otbLabeledSampleLocalizationGenerator.h" -int otbLabeledSampleLocalizationGeneratorNew(int argc, char* argv[]) +int otbLabeledSampleLocalizationGeneratorNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef otb::VectorData<> VectorDataType; typedef otb::LabeledSampleLocalizationGenerator GeneratorType; @@ -35,7 +35,7 @@ return EXIT_SUCCESS; } -int otbLabeledSampleLocalizationGenerator(int argc, char* argv[]) +int otbLabeledSampleLocalizationGenerator(int itkNotUsed(argc), char* argv[]) { const char * inputVD1 = argv[1]; const char * inputVD2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.cxx otb-4.2.0/Testing/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.cxx --- otb-4.0.0/Testing/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/ObjectDetection/otbStandardMetaImageFunctionBuilder.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ #include "otbHaralickTexturesImageFunction.h" -int otbStandardMetaImageFunctionBuilderNew(int argc, char* argv[]) +int otbStandardMetaImageFunctionBuilderNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef double PrecisionType; typedef otb::StandardMetaImageFunctionBuilder BuilderType; @@ -43,7 +43,7 @@ return EXIT_SUCCESS; } -int otbStandardMetaImageFunctionBuilder(int argc, char* argv[]) +int otbStandardMetaImageFunctionBuilder(int itkNotUsed(argc), char* argv[]) { const char * inputFilename = argv[1]; @@ -67,16 +67,9 @@ typedef otb::RadiometricMomentsImageFunction RadiometricMomentsIF; typedef otb::ImageFunctionAdaptor AdaptedRadiometricMomentsIF; - typedef otb::FourierMellinDescriptorsImageFunction FourierMellinDescriptorsIF; typedef otb::ImageFunctionAdaptor AdaptedFourierMellinDescriptorsIF; - typedef otb::FlusserMomentsImageFunction LocalHistogramIF; - typedef otb::ImageFunctionAdaptor AdaptedLocalHistogramIF; - - typedef otb::HaralickTexturesImageFunction HaralickTexturesIF; - typedef otb::ImageFunctionAdaptor AdaptedHaralickTexturesIF; - p1.push_back(7); p1.push_back(128); p1.push_back(0); diff -Nru otb-4.0.0/Testing/Code/Projections/CMakeLists.txt otb-4.2.0/Testing/Code/Projections/CMakeLists.txt --- otb-4.0.0/Testing/Code/Projections/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -121,7 +121,7 @@ ) add_test(prTvSensorModelPleiades-JP2 ${PROJECTIONS_TESTS1} - --ignore-order --compare-ascii ${NOTOL} + --ignore-order --compare-ascii ${EPSILON_9} ${BASELINE_FILES}/prTvSensorModelPleiades.txt ${TEMP}/prTvSensorModelPleiades_OUT.txt --ignore-lines-with 2 meters_per_pixel_x meters_per_pixel_y @@ -386,7 +386,7 @@ -5 39 N - 5 + 50 ) add_test(prTvOrthoRectificationMonoThreadSPOT5 ${PROJECTIONS_TESTS2} @@ -403,7 +403,7 @@ -5 39 N - 5 + 50 ) endif() @@ -1376,7 +1376,7 @@ endif() add_test(prTvVectorDataProjectionFilterFromMapToGeo ${PROJECTIONS_TESTS3} - --compare-ascii ${NOTOL} + --compare-ogr ${NOTOL} ${BASELINE_FILES}/prTvVectorDataProjectionFilterFromMapToGeo.kml ${TEMP}/prTvVectorDataProjectionFilterFromMapToGeo.kml otbVectorDataProjectionFilterFromMapToGeo @@ -1385,7 +1385,7 @@ ) add_test(prTvGeometriesProjectionFilterFromMapToGeo ${PROJECTIONS_TESTS3} - --compare-ascii ${NOTOL} + --compare-ogr ${NOTOL} ${BASELINE_FILES}/prTvVectorDataProjectionFilterFromMapToGeo.kml ${TEMP}/prTvGeometriesProjectionFilterFromMapToGeo.kml otbGeometriesProjectionFilterFromMapToGeo @@ -1682,7 +1682,7 @@ if(OTB_DATA_USE_LARGEINPUT) add_test(prTvImageToEnvelopeVectorDataFilter ${PROJECTIONS_TESTS4} ---compare-ascii ${EPSILON_6} +--compare-ogr ${EPSILON_6} ${BASELINE_FILES}/prTvImageToEnvelopeVectorDataFilterOutput.kml ${TEMP}/prTvImageToEnvelopeVectorDataFilterOutput.kml otbImageToEnvelopeVectorDataFilter diff -Nru otb-4.0.0/Testing/Code/Projections/otbCompositeTransformNew.cxx otb-4.2.0/Testing/Code/Projections/otbCompositeTransformNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbCompositeTransformNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbCompositeTransformNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbMapProjections.h" #include "otbInverseSensorModel.h" -int otbCompositeTransformNew(int argc, char* argv[]) +int otbCompositeTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::UtmInverseProjection MapProjectionType; typedef otb::InverseSensorModel SensorModelType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbForwardBackwardProjectionConsistency.cxx otb-4.2.0/Testing/Code/Projections/otbForwardBackwardProjectionConsistency.cxx --- otb-4.0.0/Testing/Code/Projections/otbForwardBackwardProjectionConsistency.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbForwardBackwardProjectionConsistency.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ typedef itk::Statistics::EuclideanDistanceMetric DistanceType; typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGeneratorType; -int otbForwardBackwardProjectionConsistency(int argc, char* argv[]) +int otbForwardBackwardProjectionConsistency(int itkNotUsed(argc), char* argv[]) { std::string infname = argv[1]; std::string demDir = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx otb-4.2.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx --- otb-4.0.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterCheckRpcModel.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbGenericRSTransform.h" #include "otbGeographicalDistance.h" -int otbGCPsToRPCSensorModelImageFilterCheckRpcModel(int argc, char* argv[]) +int otbGCPsToRPCSensorModelImageFilterCheckRpcModel(int argc, char * argv[]) { // Set command line arguments typedef otb::CommandLineArgumentParser ParserType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx otb-4.2.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGCPsToRPCSensorModelImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImage.h" #include "otbGCPsToRPCSensorModelImageFilter.h" -int otbGCPsToRPCSensorModelImageFilterNew(int argc, char* argv[]) +int otbGCPsToRPCSensorModelImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Image ImageType; typedef otb::GCPsToRPCSensorModelImageFilter GCPToSensorModelFilterType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericMapProjection.cxx otb-4.2.0/Testing/Code/Projections/otbGenericMapProjection.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericMapProjection.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericMapProjection.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbGenericMapProjection.h" -int otbGenericMapProjection(int argc, char* argv[]) +int otbGenericMapProjection(int itkNotUsed(argc), char* argv[]) { const char * outFileName = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericMapProjectionNew.cxx otb-4.2.0/Testing/Code/Projections/otbGenericMapProjectionNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericMapProjectionNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericMapProjectionNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbGenericMapProjection.h" -int otbGenericMapProjectionNew(int argc, char* argv[]) +int otbGenericMapProjectionNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::GenericMapProjection MapProjectionType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx otb-4.2.0/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericRSResampleImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,7 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; -int otbGenericRSResampleImageFilterNew(int argc, char* argv[]) +int otbGenericRSResampleImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { // SmartPointer instanciation ImageResamplerType::Pointer resampler = ImageResamplerType::New(); @@ -49,7 +49,7 @@ return EXIT_SUCCESS; } -int otbGenericRSResampleImageFilter(int argc, char* argv[]) +int otbGenericRSResampleImageFilter(int itkNotUsed(argc), char* argv[]) { // SmartPointer instanciation @@ -132,7 +132,7 @@ } -int otbGenericRSResampleImageFilterFromMap(int argc, char* argv[]) +int otbGenericRSResampleImageFilterFromMap(int itkNotUsed(argc), char* argv[]) { typedef otb::MultiChannelExtractROI ExtractROIType; @@ -205,4 +205,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericRSTransform.cxx otb-4.2.0/Testing/Code/Projections/otbGenericRSTransform.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericRSTransform.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericRSTransform.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbGenericRSTransform.h" #include -int otbGenericRSTransform(int argc, char* argv[]) +int otbGenericRSTransform(int itkNotUsed(argc), char* argv[]) { OGRSpatialReference oSRS; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformFromImage.cxx otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformFromImage.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformFromImage.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformFromImage.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,7 @@ typedef otb::GeographicalDistance GeoDistanceType; typedef otb::GeographicalDistance GeoDistance3DType; -int otbGenericRSTransformFromImage(int argc, char* argv[]) +int otbGenericRSTransformFromImage(int itkNotUsed(argc), char* argv[]) { /* * This test checks if we can instanciate a GenericRSTransform from the image information @@ -76,7 +76,7 @@ return EXIT_SUCCESS; } -int otbGenericRSTransformImageAndMNTToWGS84ConversionChecking(int argc, char* argv[]) +int otbGenericRSTransformImageAndMNTToWGS84ConversionChecking(int itkNotUsed(argc), char* argv[]) { std::string infname = argv[1]; std::string demdir = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformGenericConversionCheckingFromGCP.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ typedef itk::Statistics::EuclideanDistanceMetric DistanceType; typedef otb::GeographicalDistance GeoDistanceType; -int otbGenericRSTransformGenericConversionCheckingFromGCP(int argc, char* argv[]) +int otbGenericRSTransformGenericConversionCheckingFromGCP(int itkNotUsed(argc), char* argv[]) { std::string infname = argv[1]; std::string demDir = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformNew.cxx otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbGenericRSTransform.h" -int otbGenericRSTransformNew(int argc, char* argv[]) +int otbGenericRSTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::GenericRSTransform<> TransformType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformWithSRID.cxx otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformWithSRID.cxx --- otb-4.0.0/Testing/Code/Projections/otbGenericRSTransformWithSRID.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGenericRSTransformWithSRID.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ * except using the SRID to build the wkt. */ -int otbGenericRSTransformWithSRID(int argc, char* argv[]) +int otbGenericRSTransformWithSRID(int itkNotUsed(argc), char* argv[]) { OGRSpatialReference oSRS; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGeocentricTransform.cxx otb-4.2.0/Testing/Code/Projections/otbGeocentricTransform.cxx --- otb-4.0.0/Testing/Code/Projections/otbGeocentricTransform.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGeocentricTransform.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImage.h" #include "otbGeocentricTransform.h" -int otbGeocentricTransform(int argc, char* argv[]) +int otbGeocentricTransform(int itkNotUsed(argc), char* argv[]) { const char * outFileName = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGeocentricTransformNew.cxx otb-4.2.0/Testing/Code/Projections/otbGeocentricTransformNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbGeocentricTransformNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGeocentricTransformNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include "otbGeocentricTransform.h" -int otbGeocentricTransformNew(int argc, char* argv[]) +int otbGeocentricTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::GeocentricTransform ProjectionType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbGeographicalDistance.cxx otb-4.2.0/Testing/Code/Projections/otbGeographicalDistance.cxx --- otb-4.0.0/Testing/Code/Projections/otbGeographicalDistance.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbGeographicalDistance.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "itkPoint.h" #include "otbGeographicalDistance.h" -int otbGeographicalDistanceNew(int argc, char * argv[]) +int otbGeographicalDistanceNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef itk::Point PointType; typedef otb::GeographicalDistance DistanceType; @@ -29,7 +29,7 @@ return EXIT_SUCCESS; } -int otbGeographicalDistance(int argc, char * argv[]) +int otbGeographicalDistance(int itkNotUsed(argc), char * argv[]) { typedef itk::Point PointType; typedef otb::GeographicalDistance GeoDistanceType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbImageToEnvelopeVectorDataFilter.cxx otb-4.2.0/Testing/Code/Projections/otbImageToEnvelopeVectorDataFilter.cxx --- otb-4.0.0/Testing/Code/Projections/otbImageToEnvelopeVectorDataFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbImageToEnvelopeVectorDataFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ typedef otb::ImageToEnvelopeVectorDataFilter FilterType; -int otbImageToEnvelopeVectorDataFilterNew(int argc, char* argv[]) +int otbImageToEnvelopeVectorDataFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { // Instantiation FilterType::Pointer filter = FilterType::New(); @@ -38,7 +38,7 @@ return EXIT_SUCCESS; } -int otbImageToEnvelopeVectorDataFilter(int argc, char* argv[]) +int otbImageToEnvelopeVectorDataFilter(int itkNotUsed(argc), char* argv[]) { ReaderType::Pointer reader = ReaderType::New(); reader->SetFileName(argv[1]); diff -Nru otb-4.0.0/Testing/Code/Projections/otbImageToGenericRSOutputParameters.cxx otb-4.2.0/Testing/Code/Projections/otbImageToGenericRSOutputParameters.cxx --- otb-4.0.0/Testing/Code/Projections/otbImageToGenericRSOutputParameters.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbImageToGenericRSOutputParameters.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,14 +28,14 @@ typedef otb::VectorImage ImageType; typedef otb::ImageToGenericRSOutputParameters FilterType; -int otbImageToGenericRSOutputParametersNew (int argc, char * argv[]) +int otbImageToGenericRSOutputParametersNew (int itkNotUsed(argc), char * itkNotUsed(argv)[]) { FilterType::Pointer filter = FilterType::New(); return EXIT_SUCCESS; } -int otbImageToGenericRSOutputParameters (int argc, char * argv[]) +int otbImageToGenericRSOutputParameters (int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outfname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx otb-4.2.0/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbLeastSquareAffineTransformEstimatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbLeastSquareAffineTransformEstimator.h" #include "itkPoint.h" -int otbLeastSquareAffineTransformEstimatorNew(int argc, char* argv[]) +int otbLeastSquareAffineTransformEstimatorNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef itk::Point PointType; typedef otb::LeastSquareAffineTransformEstimator EstimatorType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbMapProjection.cxx otb-4.2.0/Testing/Code/Projections/otbMapProjection.cxx --- otb-4.0.0/Testing/Code/Projections/otbMapProjection.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbMapProjection.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImage.h" #include "otbMapProjections.h" -int otbMapProjection(int argc, char* argv[]) +int otbMapProjection(int itkNotUsed(argc), char* argv[]) { const char * outFileName = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/Projections/otbMapProjectionsNew.cxx otb-4.2.0/Testing/Code/Projections/otbMapProjectionsNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbMapProjectionsNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbMapProjectionsNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImage.h" #include "otbMapProjections.h" -int otbMapProjectionsNew(int argc, char* argv[]) +int otbMapProjectionsNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { otb::AlbersInverseProjection::Pointer lAlbersProjection = otb::AlbersInverseProjection::New(); otb::AlbersForwardProjection::Pointer lAlbersProjection2 = otb::AlbersForwardProjection::New(); @@ -115,7 +115,7 @@ //Test the specific accessors for some map projection -int otbMapProjectionsTest(int argc, char * argv[]) +int otbMapProjectionsTest(int itkNotUsed(argc), char * argv[]) { char * filename = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/Projections/otbOrthoRectificationFilter.cxx otb-4.2.0/Testing/Code/Projections/otbOrthoRectificationFilter.cxx --- otb-4.0.0/Testing/Code/Projections/otbOrthoRectificationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbOrthoRectificationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,9 @@ if (argc != 12) { std::cout << argv[0] << - " " + " " + " " + " " << std::endl; return EXIT_FAILURE; diff -Nru otb-4.0.0/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx otb-4.2.0/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbOrthoRectificationFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbMapProjections.h" #include "otbOrthoRectificationFilter.h" -int otbOrthoRectificationFilterNew(int argc, char* argv[]) +int otbOrthoRectificationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Image ImageType; typedef otb::UtmInverseProjection UtmMapProjectionType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbOssimElevManagerTest2.cxx otb-4.2.0/Testing/Code/Projections/otbOssimElevManagerTest2.cxx --- otb-4.0.0/Testing/Code/Projections/otbOssimElevManagerTest2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbOssimElevManagerTest2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,8 +37,6 @@ const ossimFilename srtmDir(argv[1]); const char * outfname = argv[2]; - typedef double PixelType; - typedef itk::Point PointType; PointType origin; double spacing; diff -Nru otb-4.0.0/Testing/Code/Projections/otbOssimElevManagerTest.cxx otb-4.2.0/Testing/Code/Projections/otbOssimElevManagerTest.cxx --- otb-4.0.0/Testing/Code/Projections/otbOssimElevManagerTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbOssimElevManagerTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,6 @@ typedef otb::ImageFileWriter WriterType; typedef itk::ImageRegionIteratorWithIndex IteratorType; - typedef ImageType::PointType PoinType; typedef ImageType::RegionType RegionType; typedef ImageType::SpacingType SpacingType; typedef RegionType::IndexType IndexType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbPhysicalToRPCSensorModelImageFilter.cxx otb-4.2.0/Testing/Code/Projections/otbPhysicalToRPCSensorModelImageFilter.cxx --- otb-4.0.0/Testing/Code/Projections/otbPhysicalToRPCSensorModelImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbPhysicalToRPCSensorModelImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,6 @@ typedef double PixelType; typedef otb::VectorImage ImageType; typedef otb::PhysicalToRPCSensorModelImageFilter PhysicalToSensorModelType; - typedef PhysicalToSensorModelType::SizeType SizeType; // Object instanciation PhysicalToSensorModelType::Pointer estimator = PhysicalToSensorModelType::New(); diff -Nru otb-4.0.0/Testing/Code/Projections/otbProjectionBaseNew.cxx otb-4.2.0/Testing/Code/Projections/otbProjectionBaseNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbProjectionBaseNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbProjectionBaseNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbMapProjections.h" -int otbProjectionBaseNew(int argc, char* argv[]) +int otbProjectionBaseNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { otb::AlbersInverseProjection::Pointer lAlbersProjection = otb::AlbersInverseProjection::New(); otb::AzimEquDistForwardProjection::Pointer lAzimEquDistProjection = otb::AzimEquDistForwardProjection::New(); diff -Nru otb-4.0.0/Testing/Code/Projections/otbRationalTransform.cxx otb-4.2.0/Testing/Code/Projections/otbRationalTransform.cxx --- otb-4.0.0/Testing/Code/Projections/otbRationalTransform.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbRationalTransform.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbRationalTransform.h" #include -int otbRationalTransformNew(int argc, char* argv[]) +int otbRationalTransformNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::RationalTransform<> RationalTransformType; @@ -96,4 +96,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/Projections/otbRationalTransformToDisplacementFieldSource.cxx otb-4.2.0/Testing/Code/Projections/otbRationalTransformToDisplacementFieldSource.cxx --- otb-4.0.0/Testing/Code/Projections/otbRationalTransformToDisplacementFieldSource.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbRationalTransformToDisplacementFieldSource.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,6 @@ int otbRationalTransformToDisplacementFieldSourceTest(int argc, char* argv[]) { - typedef otb::RationalTransform<> RationalTransformType; /** Check command line arguments. */ if( argc < 2 ) @@ -42,7 +41,6 @@ const unsigned int Dimension = 2; typedef float ScalarPixelType; typedef double CoordRepresentationType; - const unsigned int SplineOrder = 3; typedef itk::Vector VectorPixelType; typedef otb::Image DisplacementFieldImageType; @@ -58,7 +56,6 @@ typedef DisplacementFieldGeneratorType::SpacingType SpacingType; typedef DisplacementFieldGeneratorType::OriginType OriginType; typedef DisplacementFieldGeneratorType::IndexType IndexType; - typedef DisplacementFieldGeneratorType::RegionType RegionType; typedef otb::ImageFileWriter WriterType; /** Create output information. */ diff -Nru otb-4.0.0/Testing/Code/Projections/otbRegionProjectionResampler.cxx otb-4.2.0/Testing/Code/Projections/otbRegionProjectionResampler.cxx --- otb-4.0.0/Testing/Code/Projections/otbRegionProjectionResampler.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbRegionProjectionResampler.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -66,8 +66,6 @@ typedef itk::LinearInterpolateImageFunction InterpolatorType; typedef itk::RescaleIntensityImageFilter RescalerType; typedef otb::StreamingResampleImageFilter ResamplerType; - typedef itk::TranslationTransform TransformType; - typedef otb::CompositeTransform CompositeType; ImageType::IndexType start; ImageType::SizeType size; diff -Nru otb-4.0.0/Testing/Code/Projections/otbSensorModelsNew.cxx otb-4.2.0/Testing/Code/Projections/otbSensorModelsNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbSensorModelsNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbSensorModelsNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbForwardSensorModel.h" #include "otbInverseSensorModel.h" -int otbSensorModelsNew(int argc, char* argv[]) +int otbSensorModelsNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::SensorModelBase SensorModelBaseType; SensorModelBaseType::Pointer lSensorModelBase = SensorModelBaseType::New(); diff -Nru otb-4.0.0/Testing/Code/Projections/otbTileMapTransform.cxx otb-4.2.0/Testing/Code/Projections/otbTileMapTransform.cxx --- otb-4.0.0/Testing/Code/Projections/otbTileMapTransform.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbTileMapTransform.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include #include "otbTileMapTransform.h" -int otbTileMapTransform(int argc, char* argv[]) +int otbTileMapTransform(int itkNotUsed(argc), char* argv[]) { const char * outFileName = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/Projections/otbUtmMapProjection.cxx otb-4.2.0/Testing/Code/Projections/otbUtmMapProjection.cxx --- otb-4.0.0/Testing/Code/Projections/otbUtmMapProjection.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbUtmMapProjection.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbMapProjections.h" #include "otbUtils.h" -int otbUtmMapProjection(int argc, char* argv[]) +int otbUtmMapProjection(int itkNotUsed(argc), char* argv[]) { const char * outFileName = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx otb-4.2.0/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx --- otb-4.0.0/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbVectorDataExtractROIandProjection.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include #include -int otbVectorDataExtractROIandProjection(int argc, char * argv[]) +int otbVectorDataExtractROIandProjection(int itkNotUsed(argc), char * argv[]) { //Read the vector data diff -Nru otb-4.0.0/Testing/Code/Projections/otbVectorDataIntoImageProjectionFilterTest.cxx otb-4.2.0/Testing/Code/Projections/otbVectorDataIntoImageProjectionFilterTest.cxx --- otb-4.0.0/Testing/Code/Projections/otbVectorDataIntoImageProjectionFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbVectorDataIntoImageProjectionFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ * prTvVectorDataIntoImageProjectionFilterTest_4 failed because of the bug http://bugs.orfeo-toolbox.org/view.php?id=333. */ -int otbVectorDataIntoImageProjectionFilterTest(int argc, char * argv[]) +int otbVectorDataIntoImageProjectionFilterTest(int itkNotUsed(argc), char * argv[]) { typedef float PixelType; typedef otb::VectorImage VectorImageType; @@ -99,7 +99,7 @@ -int otbVectorDataIntoImageProjectionFilterCompareImplTest(int argc, char * argv[]) +int otbVectorDataIntoImageProjectionFilterCompareImplTest(int itkNotUsed(argc), char * argv[]) { typedef float PixelType; typedef otb::VectorImage VectorImageType; @@ -120,8 +120,6 @@ typedef otb::VectorDataExtractROI VectorDataExtractROIType; typedef VectorDataExtractROIType::RegionType RemoteSensingRegionType; - typedef itk::PreOrderTreeIterator TreeIteratorType; - std::string imageInputFilename = argv[1]; std::string vectorDataInputFilename = argv[2]; std::string demDirectory = argv[3]; diff -Nru otb-4.0.0/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx otb-4.2.0/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx --- otb-4.0.0/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbVectorDataProjectionFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbVectorDataProjectionFilter.h" #include "otbVectorData.h" -int otbVectorDataProjectionFilterNew(int argc, char * argv[]) +int otbVectorDataProjectionFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::VectorData InputVectorDataType; diff -Nru otb-4.0.0/Testing/Code/Projections/otbVectorDataTransformFilter.cxx otb-4.2.0/Testing/Code/Projections/otbVectorDataTransformFilter.cxx --- otb-4.0.0/Testing/Code/Projections/otbVectorDataTransformFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Projections/otbVectorDataTransformFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,13 +32,13 @@ typedef otb::VectorDataTransformFilter VectorDataTransformType; -int otbVectorDataTransformFilterNew (int argc, char * argv[]) +int otbVectorDataTransformFilterNew (int itkNotUsed(argc), char * itkNotUsed(argv)[]) { VectorDataTransformType::Pointer transformFilter = VectorDataTransformType::New(); return EXIT_SUCCESS; } -int otbVectorDataTransformFilter (int argc, char * argv[]) +int otbVectorDataTransformFilter (int itkNotUsed(argc), char * argv[]) { typedef otb::VectorImage ImageType; typedef otb::VectorData<> VectorDataType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/CMakeLists.txt otb-4.2.0/Testing/Code/Radiometry/CMakeLists.txt --- otb-4.0.0/Testing/Code/Radiometry/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -95,7 +95,7 @@ ${TEMP}/raTvImageToLuminanceImageFilterAutoSpot5.tif ) -add_test(raTvImageToLuminanceImageFilterAutoIkonos ${RADIOMETRY_TESTS2} +add_test(raTvImageToLuminanceImageFilterAutoIkonos ${RADIOMETRY_TESTS2} --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif ${TEMP}/raTvImageToLuminanceImageFilterAutoIkonos.tif otbImageToLuminanceImageFilterAuto @@ -340,6 +340,407 @@ endif() + +# ------- otb::LuminanceToImageImageFilter ------------------------------ +add_test(raTuLuminanceToImageImageFilterNew ${RADIOMETRY_TESTS2} + otbLuminanceToImageImageFilterNew +) + +add_test(raTvLuminanceToImageImageFilter ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif + ${TEMP}/raTvverySmallFSATSWImageFilter.tif + otbLuminanceToImageImageFilter + ${BASELINE}/raTvImageToLuminanceImageFilter.tif + ${TEMP}/raTvverySmallFSATSWImageFilter.tif + 10 #channel 1 alpha + 20 #channel 2 alpha + 30 #channel 3 alpha + 40 #channel 4 alpha + 1 #channel 1 beta + 2 #channel 2 beta + 3 #channel 3 beta + 4 #channel 4 beta + ) + +if(OTB_DATA_USE_LARGEINPUT) + +set(TEHERANSPOT5DIR ${TEMP}/OpticalCalibLumToImSPOT5) +file(MAKE_DIRECTORY ${TEHERANSPOT5DIR}) +file(GLOB MTDATA ${LARGEINPUT}/SPOT5/TEHERAN/*.DIM) +foreach(f ${MTDATA}) + configure_file(${f} ${TEHERANSPOT5DIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF COPYONLY) +add_test(raTvLuminanceToImageImageFilterAutoSpot5 ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvLuminanceToImageImageFilterAutoSpot5.tif + otbLuminanceToImageImageFilterAuto + ${TEHERANSPOT5DIR}/IMAGERY.TIF + ${LARGEINPUT}/SPOT5/TEHERAN/IMAGERY.TIF + ${TEHERANSPOT5DIR}/raTvLuminanceToImageImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvSMALLTEHERANLuminanceToImageImageFilterAutoSpot5.tif + ) + +set(BLOSSEVILLEIKONOSDIR ${TEMP}/OpticalCalibLumToImIkonos) +file(MAKE_DIRECTORY ${BLOSSEVILLEIKONOSDIR}) +file(GLOB MTDATA ${LARGEINPUT}/IKONOS/BLOSSEVILLE/*metadata.txt ${LARGEINPUT}/IKONOS/BLOSSEVILLE/*pan*) +foreach(f ${MTDATA}) + configure_file(${f} ${BLOSSEVILLEIKONOSDIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif COPYONLY) +add_test(raTvLuminanceToImageImageFilterAutoIkonos ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${BLOSSEVILLEIKONOSDIR}/raTvSMALLBLOSSEVILLELuminanceToImageImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvLuminanceToImageImageFilterAutoIkonos.tif + otbLuminanceToImageImageFilterAuto + ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif + ${LARGEINPUT}/IKONOS/BLOSSEVILLE/po_2619900_pan_0000000.tif + ${BLOSSEVILLEIKONOSDIR}/raTvLuminanceToImageImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvSMALLBLOSSEVILLELuminanceToImageImageFilterAutoIkonos.tif + ) + +set(ROMEWV2DIR ${TEMP}/OpticalCalibLumToImWv2PAN) +file(MAKE_DIRECTORY ${ROMEWV2DIR}) +set(MTDATADIR ${LARGEINPUT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF COPYONLY) +add_test(raTvLuminanceToImageImageFilterAutoWV2PAN ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2PAN.tif + otbLuminanceToImageImageFilterAuto + ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF + ${LARGEINPUT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN/09DEC10103019-P2AS-052298844010_01_P001.TIF + ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2PAN.tif + ) + +set(ROMEWV2DIR ${TEMP}/OpticalCalibLumToImWv2MULTI) +file(MAKE_DIRECTORY ${ROMEWV2DIR}) +set(MTDATADIR ${LARGEINPUT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF COPYONLY) +add_test(raTvLuminanceToImageImageFilterAutoWV2MULTI ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2Multi.tif + otbLuminanceToImageImageFilterAuto + ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF + ${LARGEINPUT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL/09DEC10103019-M2AS-052298844010_01_P001.TIF + ${ROMEWV2DIR}/raTvLuminanceToImageImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvSMALLROMELuminanceToImageImageFilterAutoWV2Multi.tif + ) + +set(TOULOUSEQBDIR ${TEMP}/OpticalCalibLumToImQBPAN) +file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) +set(MTDATADIR ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF COPYONLY) +add_test(raTvLuminanceToImageImageFilterAutoQuickbirdPAN ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdPAN.tif + otbLuminanceToImageImageFilterAuto + ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF + ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN/02APR01105228-P1BS-000000128955_01_P001.TIF + ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdPAN.tif + ) + +set(TOULOUSEQBDIR ${TEMP}/OpticalCalibLumToImQBXS) +file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) +set(MTDATADIR ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF COPYONLY) +add_test(raTvLuminanceToImageImageFilterAutoQuickbirdXS ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdXS.tif + otbLuminanceToImageImageFilterAuto + ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF + ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL/02APR01105228-M1BS-000000128955_01_P001.TIF + ${TOULOUSEQBDIR}/raTvLuminanceToImageImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvSMALLTOULOUSELuminanceToImageImageFilterAutoQuickbirdXS.tif + ) + +set(SUDOUESTFORMOSATDIR ${TEMP}/OpticalCalibLumToImFormosat) +file(MAKE_DIRECTORY ${SUDOUESTFORMOSATDIR}) +set(MTDATADIR ${LARGEINPUT}/FORMOSAT/Sudouest_20071013_MS_fmsat) +file(GLOB MTDATA ${MTDATADIR}/*.DIM) +foreach(f ${MTDATA}) + configure_file(${f} ${SUDOUESTFORMOSATDIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToLuminanceImageFilterAutoFormosat.tif ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF COPYONLY) +add_test(raTvLuminanceToImageImageFilterAutoFORMOSAT ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.tif + ${SUDOUESTFORMOSATDIR}/raTvLuminanceToImageImageFilterAutoFormosat.tif + otbLuminanceToImageImageFilterAuto + ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF + ${LARGEINPUT}/FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF + ${SUDOUESTFORMOSATDIR}/raTvLuminanceToImageImageFilterAutoFormosat.tif + ${SUDOUESTFORMOSATDIR}/raTvSMALLSOLuminanceToImageImageFilterAutoFormosat.tif + ) + +endif() + + +# ------- otb::ReflectanceToLuminanceImageFilter ------------------------------ +add_test(raTuReflectanceToLuminanceImageFilterNew ${RADIOMETRY_TESTS2} + otbReflectanceToLuminanceImageFilterNew +) + +add_test(raTvReflectanceToLuminanceImageFilter ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif + ${TEMP}/raTvverySmallFSATSWImageFilterDsol.tif + otbReflectanceToLuminanceImageFilter + ${BASELINE}/raTvLuminanceToReflectanceImageFilterDsol.tif + ${TEMP}/raTvverySmallFSATSWImageFilterDsol.tif + 0.2 #radius + 10 #channel 1 illumination + 20 #channel 2 illumination + 30 #channel 3 illumination + 40 #channel 4 illumination + 0.9923885328 +) + +add_test(raTvReflectanceToLuminanceImageFilterDayMonth ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif + ${TEMP}/raTvverySmallFSATSWImageFilterDayMounth.tif + otbReflectanceToLuminanceImageFilter + ${BASELINE}/raTvLuminanceToReflectanceImageFilter.tif + ${TEMP}/raTvverySmallFSATSWImageFilterDayMounth.tif + 0.2 #radius + 10 #channel 1 illumination + 20 #channel 2 illumination + 30 #channel 3 illumination + 40 #channel 4 illumination + 3 #day + 5 #mounth + ) + +if(OTB_DATA_USE_LARGEINPUT) + +set(TEHERANSPOT5DIR ${TEMP}/OpticalCalibRefToLumSPOT5) +file(MAKE_DIRECTORY ${TEHERANSPOT5DIR}) +file(GLOB MTDATA ${LARGEINPUT}/SPOT5/TEHERAN/*.DIM) +foreach(f ${MTDATA}) + configure_file(${f} ${TEHERANSPOT5DIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoSpot5.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF COPYONLY) +add_test(raTvReflectanceToLuminanceImageFilterAutoSpot5 ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.tif + otbReflectanceToLuminanceImageFilterAuto + ${TEHERANSPOT5DIR}/IMAGERY.TIF + ${TEHERANSPOT5DIR}/raTvReflectanceToLuminanceImageFilterAutoSpot5.tif + ) + +set(BLOSSEVILLEIKONOSDIR ${TEMP}/OpticalCalibRefToLumIkonos) +file(MAKE_DIRECTORY ${BLOSSEVILLEIKONOSDIR}) +file(GLOB MTDATA ${LARGEINPUT}/IKONOS/BLOSSEVILLE/*metadata.txt ${LARGEINPUT}/IKONOS/BLOSSEVILLE/*pan*) +foreach(f ${MTDATA}) + configure_file(${f} ${BLOSSEVILLEIKONOSDIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoIkonos.tif ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif COPYONLY) +add_test(raTvReflectanceToLuminanceImageFilterAutoIkonos ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoIkonos.tif + ${BLOSSEVILLEIKONOSDIR}/raTvReflectanceToLuminanceImageFilterAutoIkonos.tif + otbReflectanceToLuminanceImageFilterAuto + ${BLOSSEVILLEIKONOSDIR}/po_2619900_pan_0000000.tif + ${BLOSSEVILLEIKONOSDIR}/raTvReflectanceToLuminanceImageFilterAutoIkonos.tif + ) + +set(ROMEWV2DIR ${TEMP}/OpticalCalibRefToLumWv2PAN) +file(MAKE_DIRECTORY ${ROMEWV2DIR}) +set(MTDATADIR ${LARGEINPUT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_PAN) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2PAN.tif ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF COPYONLY) +add_test(raTvReflectanceToLuminanceImageFilterAutoWV2PAN ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2PAN.tif + ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2PAN.tif + otbReflectanceToLuminanceImageFilterAuto + ${ROMEWV2DIR}/09DEC10103019-P2AS-052298844010_01_P001.TIF + ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2PAN.tif + ) + +set(ROMEWV2DIR ${TEMP}/OpticalCalibRefToLumWv2MULTI) +file(MAKE_DIRECTORY ${ROMEWV2DIR}) +set(MTDATADIR ${LARGEINPUT}/WORLDVIEW2/ROME/WV-2_standard_8band_bundle_16bit/052298844010_01_P001_MUL) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${ROMEWV2DIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoWV2Multi.tif ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF COPYONLY) +add_test(raTvReflectanceToLuminanceImageFilterAutoWV2MULTI ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoWV2Multi.tif + ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2Multi.tif + otbReflectanceToLuminanceImageFilterAuto + ${ROMEWV2DIR}/09DEC10103019-M2AS-052298844010_01_P001.TIF + ${ROMEWV2DIR}/raTvReflectanceToLuminanceImageFilterAutoWV2Multi.tif + ) + +set(TOULOUSEQBDIR ${TEMP}/OpticalCalibRefToLumQBPAN) +file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) +set(MTDATADIR ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_PAN) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdPAN.tif ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF COPYONLY) +add_test(raTvReflectanceToLuminanceImageFilterAutoQuickbirdPAN ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdPAN.tif + ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdPAN.tif + otbReflectanceToLuminanceImageFilterAuto + ${TOULOUSEQBDIR}/02APR01105228-P1BS-000000128955_01_P001.TIF + ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdPAN.tif + ) + +set(TOULOUSEQBDIR ${TEMP}/OpticalCalibRefToLumQBXS) +file(MAKE_DIRECTORY ${TOULOUSEQBDIR}) +set(MTDATADIR ${LARGEINPUT}/QUICKBIRD/TOULOUSE/000000128955_01_P001_MUL) +file(GLOB MTDATA ${MTDATADIR}/*TIL ${MTDATADIR}/*RPB ${MTDATADIR}/*XML ${MTDATADIR}/*IMD) +foreach(f ${MTDATA}) + configure_file(${f} ${TOULOUSEQBDIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoQuickbirdXS.tif ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF COPYONLY) +add_test(raTvReflectanceToLuminanceImageFilterAutoQuickbirdXS ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoQuickbirdXS.tif + ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdXS.tif + otbReflectanceToLuminanceImageFilterAuto + ${TOULOUSEQBDIR}/02APR01105228-M1BS-000000128955_01_P001.TIF + ${TOULOUSEQBDIR}/raTvReflectanceToLuminanceImageFilterAutoQuickbirdXS.tif + ) + +# ${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif : this image seems to be corrupted +#set(SUDOUESTFORMOSATDIR ${TEMP}/OpticalCalibRefToLumFormosat) +#file(MAKE_DIRECTORY ${SUDOUESTFORMOSATDIR}) +#set(MTDATADIR ${LARGEINPUT}/FORMOSAT/Sudouest_20071013_MS_fmsat) +#file(GLOB MTDATA ${MTDATADIR}/*.DIM) +#foreach(f ${MTDATA}) +# configure_file(${f} ${SUDOUESTFORMOSATDIR} COPYONLY) +#endforeach(f) +#configure_file(${BASELINE}/raTvLuminanceToReflectanceImageFilterAutoFormosat.tif ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF COPYONLY) +#add_test(raTvReflectanceToLuminanceImageFilterAutoFORMOSAT ${RADIOMETRY_TESTS2} +# --compare-image ${EPSILON_12} ${BASELINE}/raTvImageToLuminanceImageFilterAutoFormosat.tif +# ${SUDOUESTFORMOSATDIR}/raTvReflectanceToLuminanceImageFilterAutoFormosat.tif +# otbReflectanceToLuminanceImageFilterAuto +# ${SUDOUESTFORMOSATDIR}/IMAGERY.TIF +# ${SUDOUESTFORMOSATDIR}/raTvReflectanceToLuminanceImageFilterAutoFormosat.tif +# ) + +endif() + +# ------- otb::ReflectanceToImageImageFilter ------------------------------ +add_test(raTuReflectanceToImageImageFilterNew ${RADIOMETRY_TESTS2} + otbReflectanceToImageImageFilterNew +) + +add_test(raTvReflectanceToImageImageFilter ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif + ${TEMP}/raTvReflectanceToImageImageFilterDsol.tif + otbReflectanceToImageImageFilter + ${BASELINE}/raTvImageToReflectanceImageFilterDsol.tif + ${TEMP}/raTvReflectanceToImageImageFilterDsol.tif + 0.2 #radius + 1 #channel 1 alpha + 2 #channel 2 alpha + 3 #channel 3 alpha + 4 #channel 4 alpha + 10 #channel 1 beta + 11 #channel 2 beta + 12 #channel 3 beta + 13 #channel 4 beta + 10 #channel 1 illumination + 20 #channel 2 illumination + 30 #channel 3 illumination + 40 #channel 4 illumination + 0.9923885328 #d/d0 corresponding to the date 03/05 + ) + +add_test(raTvRomaniaReflectanceToImage ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} + ${INPUTDATA}/Romania_Extract.tif + ${TEMP}/raTvRomaniaImage.tif + otbReflectanceToImageImageFilter + ${BASELINE}/raTvRomania_Reflectance.tif + ${TEMP}/raTvRomaniaImage.tif + 27.3 # = 90-62.70 : elevation et azimuth solaire + 1.981247824 #channel 1 alpha = 0.881338*2.24800 + 4.332207085 #channel 2 alpha = 0.858713*5.04500 + 2.32064768 #channel 3 alpha = 0.685568*3.38500 + 9.3177861 #channel 4 alpha = 6.19122*1.50500 + 0 #channel 1 beta + 0 #channel 2 beta + 0 #channel 3 beta + 0 #channel 4 beta + 1057.56 #channel 1 illumination + 1570.23 #channel 2 illumination + 1842.94 #channel 3 illumination + 232.820 #channel 4 illumination + 0.9889145564708814 #= sqrt(0.977952) d/d0 corresponding to the date 03/05 + ) + +add_test(raTvReflectanceToImageImageFilterDayMounth ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${INPUTDATA}/verySmallFSATSW.tif + ${TEMP}/raTvReflectanceToImageImageFilterDayMounth.tif + otbReflectanceToImageImageFilter + ${BASELINE}/raTvImageToReflectanceImageFilter.tif + ${TEMP}/raTvReflectanceToImageImageFilterDayMounth.tif + 0.2 #radius + 1 #channel 1 alpha + 2 #channel 2 alpha + 3 #channel 3 alpha + 4 #channel 4 alpha + 10 #channel 1 beta + 11 #channel 2 beta + 12 #channel 3 beta + 13 #channel 4 beta + 10 #channel 1 illumination + 20 #channel 2 illumination + 30 #channel 3 illumination + 40 #channel 4 illumination + 3 #day + 5 #mounth + ) + +if(OTB_DATA_USE_LARGEINPUT) + +set(TEHERANSPOT5DIR ${TEMP}/OpticalCalibRefToImSPOT5) +file(MAKE_DIRECTORY ${TEHERANSPOT5DIR}) +file(GLOB MTDATA ${LARGEINPUT}/SPOT5/TEHERAN/*.DIM) +foreach(f ${MTDATA}) + configure_file(${f} ${TEHERANSPOT5DIR} COPYONLY) +endforeach(f) +configure_file(${BASELINE}/raTvImageToReflectanceImageFilterAuto.tif ${TEHERANSPOT5DIR}/IMAGERY.TIF COPYONLY) +add_test(raTvReflectanceToImageImageFilterAutoSpot5 ${RADIOMETRY_TESTS2} + --compare-image ${EPSILON_12} ${TEHERANSPOT5DIR}/raTvSMALLTEHERANReflectanceToImageImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvReflectanceToImageImageFilterAutoSpot5.tif + otbReflectanceToImageImageFilterAuto + ${TEHERANSPOT5DIR}/IMAGERY.TIF + ${LARGEINPUT}/SPOT5/TEHERAN/IMAGERY.TIF + ${TEHERANSPOT5DIR}/raTvReflectanceToImageImageFilterAutoSpot5.tif + ${TEHERANSPOT5DIR}/raTvSMALLTEHERANReflectanceToImageImageFilterAutoSpot5.tif + ) + + +add_test(raTuReflectanceToImageImageFilterAutoFORMOSAT2 ${RADIOMETRY_TESTS2} + otbReflectanceToImageImageFilterAuto + ${LARGEINPUT}/FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF + ${LARGEINPUT}/FORMOSAT/Sudouest_20071013_MS_fmsat/IMAGERY.TIF + ${TEMP}/raTvReflectanceToImageImageFilterAutoFORMOSAT2.tif + ${TEMP}/raTvSMALLReflectanceToImageImageFilterAutoFORMOSAT2.tif + ) +endif() # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbRADIOMETRY_TESTS3 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -379,6 +780,11 @@ otbAtmosphericCorrectionParametersNew ) +# ------- otb::ImageMetadataCorrectionParameters ------------------------------ +add_test(raTuImageMetadataCorrectionParametersNew ${RADIOMETRY_TESTS3} + otbImageMetadataCorrectionParametersNew +) + ########## otb::FilterFunctionValues ------------------- # in otbAtmosphericCorrectionParameters.h/.cxx add_test(raTuFilterFunctionValuesTest ${RADIOMETRY_TESTS3} @@ -464,6 +870,24 @@ ) # ------- otb::ReflectanceToSurfaceReflectanceImageFilter ------------------------------ +#add_test(raTuReflectanceToSurfaceReflectanceImageFilterNew ${RADIOMETRY_TESTS3} +# otbReflectanceToSurfaceReflectanceImageFilterNew +#) +#add_test(raTvReflectanceToSurfaceReflectanceImageFilter ${RADIOMETRY_TESTS3} +# --compare-image ${EPSILON_12} ${BASELINE}/raTvReflectanceToSurfaceReflectanceImageFilter.tif +# ${TEMP}/raTvReflectanceToSurfaceReflectanceImageFilter.tif +# otbReflectanceToSurfaceReflectanceImageFilterTest +# ${INPUTDATA}/verySmallFSATSW.tif +# ${TEMP}/raTvReflectanceToSurfaceReflectanceImageFilter.tif +# # SAME VALUE FOR EACH CHANNEL +# 1 1 1 1 # intrinsic atmospheric reflectance +# 2 2 2 2 # spherical albedo of the atmosphere +# 3 3 3 3 # total transmission +# 2 2 2 2 # downward transmittance +# 3 3 3 3 # upward transmittance +# ) + +# ------- otb::ReflectanceToSurfaceReflectanceImageFilter ------------------------------ add_test(raTuReflectanceToSurfaceReflectanceImageFilterNew ${RADIOMETRY_TESTS3} otbReflectanceToSurfaceReflectanceImageFilterNew ) @@ -481,10 +905,24 @@ 3 3 3 3 # upward transmittance ) +add_test(raTvReflectanceToSurfaceReflectanceImageFilter2 ${RADIOMETRY_TESTS3} + --compare-image ${EPSILON_12} ${BASELINE}/raTvReflectanceToSurfaceReflectanceImageFilter2.tif + ${TEMP}/raTvReflectanceToSurfaceReflectanceImageFilter2.tif + otbReflectanceToSurfaceReflectanceImageFilterTest2 + ${INPUTDATA}/ToulouseExtract_WithGeom.tif + ${TEMP}/raTvReflectanceToSurfaceReflectanceImageFilter2.tif + 1013 + 1.424 + 0.344 + 1 + 0.1 + ) + + if(OTB_DATA_USE_LARGEINPUT) #this test was comment after the refactoring of astmospheric correction classes #//TODO Need to rewrite tests with baselines generated directly with 6S. -#add_test(raTvReflectanceToSurfaceReflectanceImageFilter2 ${RADIOMETRY_TESTS3} +#add_test(raTvReflectanceToSurfaceReflectanceImageFilter3 ${RADIOMETRY_TESTS3} # --compare-ascii ${EPSILON_12} ${BASELINE_FILES}/raTvReflectanceToSurfaceReflectanceImageFilter2.txt # ${TEMP}/raTvReflectanceToSurfaceReflectanceImageFilter2.txt # otbReflectanceToSurfaceReflectanceImageFilterTest2 @@ -507,17 +945,17 @@ ${INPUTDATA}/RADIO_WAVELENGHT_SPECTRAL_BAND_SPOT4_1_MIR.txt # wavelengths, channel 4 ) -# ------- otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter ------------------------------ -add_test(raTuSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew ${RADIOMETRY_TESTS3} - otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew +# ------- otb::SurfaceAdjacencyEffectCorrectionSchemeFilter ------------------------------ +add_test(raTuSurfaceAdjacencyEffectCorrectionSchemeFilterNew ${RADIOMETRY_TESTS3} + otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew ) -add_test(raTvSurfaceAdjacencyEffect6SCorrectionSchemeFilter ${RADIOMETRY_TESTS3} +add_test(raTvSurfaceAdjacencyEffectCorrectionSchemeFilter ${RADIOMETRY_TESTS3} --compare-image ${EPSILON_12} ${BASELINE}/raTvSurfaceAdjacencyEffect6SCorrectionSchemeFilter.tif ${TEMP}/raTvSurfaceAdjacencyEffect6SCorrectionSchemeFilter.tif # --compare-ascii ${EPSILON_6} ${BASELINE_FILES}/raTvSurfaceAdjacencyEffect6SCorrectionSchemeFilterOutput6SVallues.txt # ${TEMP}/raTvSurfaceAdjacencyEffect6SCorrectionSchemeFilterOutput6SVallues.txt - otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter + otbSurfaceAdjacencyEffectCorrectionSchemeFilter ${BASELINE}/raTvRomania_Correction.tif ${TEMP}/raTvSurfaceAdjacencyEffect6SCorrectionSchemeFilter.tif 2 # Radius; @@ -534,15 +972,25 @@ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ otbRADIOMETRY_TESTS4 ~~~~~~~~~~~~~~~~~~~~~~~~~~~ # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -# ------- otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms ------------------------------ -add_test(raTuAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew ${RADIOMETRY_TESTS4} - otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew) +# ------- otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms ------------------------------ +add_test(raTuRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew ${RADIOMETRY_TESTS4} + otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew) + +add_test(raTvRadiometryCorrectionParametersToAtmosphericRadiativeTerms ${RADIOMETRY_TESTS4} +--compare-ascii ${EPSILON_4} + ${BASELINE_FILES}/raTvSIXSTraitsComputeAtmosphericParametersTest.txt + ${TEMP}/raTvCorrectionTo6SRadiative.txt + otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms + ${INPUTDATA}/in6S_otb + ${TEMP}/raTvCorrectionTo6SRadiative.txt +) -add_test(raTvAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms ${RADIOMETRY_TESTS4} +# New test +add_test(raTvRadiometryCorrectionParametersToAtmosphericRadiativeTerms ${RADIOMETRY_TESTS4} --compare-ascii ${EPSILON_4} ${BASELINE_FILES}/raTvSIXSTraitsComputeAtmosphericParametersTest.txt ${TEMP}/raTvCorrectionTo6SRadiative.txt - otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms + otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms ${INPUTDATA}/in6S_otb ${TEMP}/raTvCorrectionTo6SRadiative.txt ) @@ -1693,25 +2141,35 @@ otbImageToReflectanceImageFilterNew.cxx otbImageToReflectanceImageFilter.cxx otbImageToReflectanceImageFilterAuto.cxx +otbLuminanceToImageImageFilterNew.cxx +otbLuminanceToImageImageFilter.cxx +otbLuminanceToImageImageFilterAuto.cxx +otbReflectanceToLuminanceImageFilterNew.cxx +otbReflectanceToLuminanceImageFilter.cxx +otbReflectanceToLuminanceImageFilterAuto.cxx +otbReflectanceToImageImageFilterNew.cxx +otbReflectanceToImageImageFilter.cxx +otbReflectanceToImageImageFilterAuto.cxx ) set(Radiometry_SRCS3 otbRadiometryTests3.cxx otbDEMCaracteristicsExtractorNew.cxx otbDEMCaracteristicsExtractor.cxx otbAtmosphericCorrectionParametersNew.cxx +otbImageMetadataCorrectionParametersNew.cxx otbFilterFunctionValues.cxx otbSIXSTraitsTest.cxx otbSIXSTraitsComputeAtmosphericParameters.cxx otbAtmosphericRadiativeTermsTest.cxx otbReflectanceToSurfaceReflectanceImageFilterTest.cxx -otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew.cxx -otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.cxx +otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew.cxx +otbSurfaceAdjacencyEffectCorrectionSchemeFilter.cxx otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx ) set(Radiometry_SRCS4 otbRadiometryTests4.cxx -otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx -otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx +otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew.cxx +otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.cxx otbAtmosphericCorrectionSequencement.cxx otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx otb-4.2.0/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAeronetExtractDataBadData.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbAeronetFileReader.h" #include "otbSystem.h" -int otbAeronetExtractDataBadData(int argc, char * argv[]) +int otbAeronetExtractDataBadData(int itkNotUsed(argc), char * argv[]) { otb::AeronetFileReader::Pointer reader = otb::AeronetFileReader::New(); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAeronetExtractData.cxx otb-4.2.0/Testing/Code/Radiometry/otbAeronetExtractData.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAeronetExtractData.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAeronetExtractData.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include #include -int otbAeronetExtractData(int argc, char * argv[]) +int otbAeronetExtractData(int itkNotUsed(argc), char * argv[]) { otb::AeronetFileReader::Pointer reader = otb::AeronetFileReader::New(); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAeronetNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbAeronetNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAeronetNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAeronetNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbAeronetData.h" #include "otbAeronetFileReader.h" -int otbAeronetNew(int argc, char * argv[]) +int otbAeronetNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { otb::AeronetData::Pointer data = otb::AeronetData::New(); otb::AeronetFileReader::Pointer reader = otb::AeronetFileReader::New(); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include -int otbAtmosphericCorrectionParametersNew(int argc, char * argv[]) +int otbAtmosphericCorrectionParametersNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; typedef otb::FilterFunctionValues FilterFunctionValuesType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.cxx 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - 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. - -=========================================================================*/ - -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" -#include "otbAtmosphericCorrectionParameters.h" -#include "otbAtmosphericRadiativeTerms.h" -#include -#include -#include -#include -#include - -int otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms(int argc, char * argv[]) -{ - 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::WavelengthSpectralBandType ValueType; - typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; - - // Instantiating object - CorrectionParametersTo6SRadiativeTermsType::Pointer object = CorrectionParametersTo6SRadiativeTermsType::New(); - CorrectionParametersType::Pointer param = CorrectionParametersType::New(); - AerosolModelType aerosolModel; - FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); - ValuesVectorType vect; - RadiativeTermsType::Pointer radiative = RadiativeTermsType::New(); - - ValueType val = 0.0025; - - //for(unsigned int i=0; i> 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; - aerosolModel = static_cast(aer); - fin >> aerosolOptical; //taer55; - fin >> minSpectralValue; //wlinf; - fin >> maxSpectralValue; //wlsup; - - std::string line; - std::getline(fin, line); - while (std::getline(fin, line)) - { - value = atof(line.c_str()); - vect.push_back(value); - } - - fin.close(); - functionValues->SetFilterFunctionValues(vect); - functionValues->SetMinSpectralValue(minSpectralValue); - functionValues->SetMaxSpectralValue(maxSpectralValue); - functionValues->SetUserStep(val); - param->SetWavelengthSpectralBandWithIndex(0, functionValues); - //} - - //aerosolModel = static_cast(::atoi(argv[16])); - - // Set parameters - param->SetSolarZenithalAngle(static_cast(solarZenithalAngle)); - param->SetSolarAzimutalAngle(static_cast(solarAzimutalAngle)); - param->SetViewingZenithalAngle(static_cast(viewingZenithalAngle)); - param->SetViewingAzimutalAngle(static_cast(viewingAzimutalAngle)); - param->SetMonth(month); - param->SetDay(day); - param->SetAtmosphericPressure(static_cast(atmosphericPressure)); - param->SetWaterVaporAmount(static_cast(waterVaporAmount)); - param->SetOzoneAmount(static_cast(ozoneAmount)); - param->SetAerosolModel(aerosolModel); - param->SetAerosolOptical(static_cast(aerosolOptical)); - - 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 wavelength 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 wavelength 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 -Nru otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew.cxx 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - 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. - -=========================================================================*/ - -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" -#include - -int otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew(int argc, char * argv[]) -{ - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms - AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType; - // Instantiating object - AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::Pointer object = - AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsType::New(); - - std::cout << object << std::endl; - - return EXIT_SUCCESS; -} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericCorrectionSequencement.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,11 +19,11 @@ #include "otbImageToLuminanceImageFilter.h" #include "otbLuminanceToReflectanceImageFilter.h" -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" #include "otbAtmosphericCorrectionParameters.h" #include "otbAtmosphericRadiativeTerms.h" #include "otbReflectanceToSurfaceReflectanceImageFilter.h" -#include "otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h" +#include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" @@ -120,23 +120,42 @@ filterLuminanceToReflectance->SetInput(filterImageToLuminance->GetOutput()); //------------------------------- - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms - AtmosphericCorrectionParametersTo6SRadiativeTermsType; - typedef otb::AtmosphericCorrectionParameters - AtmosphericCorrectionParametersType; - typedef otb::AtmosphericRadiativeTerms - AtmosphericRadiativeTermsType; - typedef AtmosphericCorrectionParametersType::AerosolModelType - AerosolModelType; - - typedef otb::FilterFunctionValues - FilterFunctionValuesType; - typedef FilterFunctionValuesType::ValuesVectorType - ValuesVectorType; + /*typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms RadiometryCorrectionParametersToRadiativeTermsType; + typedef otb::AtmosphericCorrectionParameters AtmosphericCorrectionParametersType; + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; + + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; AtmosphericCorrectionParametersType::Pointer dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); - AtmosphericRadiativeTermsType::Pointer dataAtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); + AtmosphericRadiativeTermsType::Pointer dataAtmosphericRadiativeTerms = AtmosphericRadiativeTermsType::New(); */ + + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; + + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; //float + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; //std::vector + + typedef AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType; + + AcquiCorrectionParametersPointerType paramAcqui = AcquiCorrectionParametersType::New(); + AtmoCorrectionParametersPointerType paramAtmo = AtmoCorrectionParametersType::New(); + FilterFunctionValuesType::Pointer functionValues; + + double minSpectralValue(0.); double maxSpectralValue(0.); @@ -168,13 +187,13 @@ functionValues->SetMinSpectralValue(minSpectralValue); functionValues->SetMaxSpectralValue(maxSpectralValue); functionValues->SetUserStep(userStep); - dataAtmosphericCorrectionParameters->SetWavelengthSpectralBandWithIndex(i, functionValues); + paramAcqui->SetWavelengthSpectralBandWithIndex(i, functionValues); } fin.close(); // Set parameters - dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(filterLuminanceToReflectance->GetZenithalSolarAngle()); + /*dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(filterLuminanceToReflectance->GetZenithalSolarAngle()); dataAtmosphericCorrectionParameters->SetSolarAzimutalAngle(static_cast(atof(argv[8]))); dataAtmosphericCorrectionParameters->SetViewingZenithalAngle(static_cast(atof(argv[9]))); dataAtmosphericCorrectionParameters->SetViewingAzimutalAngle(static_cast(atof(argv[10]))); @@ -187,11 +206,26 @@ dataAtmosphericCorrectionParameters->SetAerosolModel(aerosolModel); dataAtmosphericCorrectionParameters->SetAerosolOptical(static_cast(atof(argv[15]))); - AtmosphericCorrectionParametersTo6SRadiativeTermsType::Pointer + RadiometryCorrectionParametersToRadiativeTermsType::Pointer filterAtmosphericCorrectionParametersTo6SRadiativeTerms = - AtmosphericCorrectionParametersTo6SRadiativeTermsType::New(); + RadiometryCorrectionParametersToRadiativeTermsType::New(); filterAtmosphericCorrectionParametersTo6SRadiativeTerms->SetInput(dataAtmosphericCorrectionParameters); - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->Update(); + filterAtmosphericCorrectionParametersTo6SRadiativeTerms->Update(); */ + + paramAcqui->SetSolarZenithalAngle(filterLuminanceToReflectance->GetZenithalSolarAngle()); + paramAcqui->SetSolarAzimutalAngle(static_cast(atof(argv[8]))); + paramAcqui->SetViewingZenithalAngle(static_cast(atof(argv[9]))); + paramAcqui->SetViewingAzimutalAngle(static_cast(atof(argv[10]))); + paramAcqui->SetMonth(month); + paramAcqui->SetDay(day); + paramAtmo->SetAtmosphericPressure(static_cast(atof(argv[11]))); + paramAtmo->SetWaterVaporAmount(static_cast(atof(argv[12]))); + paramAtmo->SetOzoneAmount(static_cast(atof(argv[13]))); + AerosolModelType aerosolModel = static_cast(::atoi(argv[14])); + paramAtmo->SetAerosolModel(aerosolModel); + paramAtmo->SetAerosolOptical(static_cast(atof(argv[15]))); + + AtmosphericRadiativeTermsPointerType radiative = CorrectionParametersToRadiativeTermsType::Compute(paramAtmo,paramAcqui); //------------------------------- @@ -200,29 +234,25 @@ ReflectanceToSurfaceReflectanceImageFilterType::Pointer filterReflectanceToSurfaceReflectanceImageFilter = ReflectanceToSurfaceReflectanceImageFilterType::New(); - filterReflectanceToSurfaceReflectanceImageFilter->SetAtmosphericRadiativeTerms( - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput()); + filterReflectanceToSurfaceReflectanceImageFilter->SetAtmosphericRadiativeTerms(radiative); filterReflectanceToSurfaceReflectanceImageFilter->SetInput(filterLuminanceToReflectance->GetOutput()); //------------------------------- - typedef otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter SurfaceAdjacencyEffect6SCorrectionSchemeFilterType; - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::Pointer filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter = - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::New(); - - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetAtmosphericRadiativeTerms( - filterAtmosphericCorrectionParametersTo6SRadiativeTerms->GetOutput()); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetWindowRadius(atoi(argv[17])); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetPixelSpacingInKilometers(static_cast(atof(argv[18]))); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetZenithalViewingAngle( - dataAtmosphericCorrectionParameters->GetViewingZenithalAngle()); - filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->SetInput( - filterReflectanceToSurfaceReflectanceImageFilter->GetOutput()); + typedef otb::SurfaceAdjacencyEffectCorrectionSchemeFilter SurfaceAdjacencyEffectCorrectionSchemeFilterType; + SurfaceAdjacencyEffectCorrectionSchemeFilterType::Pointer filterSurfaceAdjacencyEffectCorrectionSchemeFilter = + SurfaceAdjacencyEffectCorrectionSchemeFilterType::New(); + + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetAtmosphericRadiativeTerms(radiative); + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetWindowRadius(atoi(argv[17])); + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetPixelSpacingInKilometers(static_cast(atof(argv[18]))); + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetZenithalViewingAngle(paramAcqui->GetViewingZenithalAngle()); + filterSurfaceAdjacencyEffectCorrectionSchemeFilter->SetInput(filterReflectanceToSurfaceReflectanceImageFilter->GetOutput()); //------------------------------- WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[2]); - writer->SetInput(filterSurfaceAdjacencyEffect6SCorrectionSchemeFilter->GetOutput()); + writer->SetInput(filterSurfaceAdjacencyEffectCorrectionSchemeFilter->GetOutput()); writer->Update(); return EXIT_SUCCESS; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAtmosphericRadiativeTermsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbAtmosphericRadiativeTerms.h" #include -int otbAtmosphericRadiativeTermsNew(int argc, char * argv[]) +int otbAtmosphericRadiativeTermsNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; @@ -33,7 +33,7 @@ return EXIT_SUCCESS; } -int otbAtmosphericRadiativeTermsSingleChannelNew(int argc, char * argv[]) +int otbAtmosphericRadiativeTermsSingleChannelNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::AtmosphericRadiativeTermsSingleChannel AtmosphericRadiativeTermsType; @@ -60,7 +60,7 @@ return os; } -int otbAtmosphericRadiativeTermsTest(int argc, char * argv[]) +int otbAtmosphericRadiativeTermsTest(int itkNotUsed(argc), char * argv[]) { char * filename = argv[1]; std::ofstream file; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" -int otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int otbAVIMultiChannelRAndGAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbAVIRAndGAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" -int otbAVIRAndGAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int otbAVIRAndGAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx otb-4.2.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileWriter.h" #include "otbImageFileReader.h" -int otbDEMCaracteristicsExtractor(int argc, char * argv[]) +int otbDEMCaracteristicsExtractor(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputSlotFileName = argv[6]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbDEMCaracteristicsExtractorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbDEMCaracteristicsExtractor.h" #include "otbImage.h" -int otbDEMCaracteristicsExtractorNew(int argc, char * argv[]) +int otbDEMCaracteristicsExtractorNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbVegetationIndicesFunctor.h" template -int generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int generic_EVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbEVIRAndBAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVegetationIndicesFunctor.h" template -int generic_EVIRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int generic_EVIRAndBAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader RReaderType; typedef otb::ImageFileReader BReaderType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbFilterFunctionValues.cxx otb-4.2.0/Testing/Code/Radiometry/otbFilterFunctionValues.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbFilterFunctionValues.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbFilterFunctionValues.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,8 +26,6 @@ #include "itksys/SystemTools.hxx" #include "otbSpectralResponse.h" - - int otbFilterFunctionValuesSpectralResponseTest(int argc, char * argv[]) { @@ -123,7 +121,7 @@ return EXIT_SUCCESS; } -int otbFilterFunctionValuesDigitalGlobeTest(int argc, char * argv[]) +int otbFilterFunctionValuesDigitalGlobeTest(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const char * outname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbGAndRIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSoilIndicesFunctor.h" template -int generic_GAndRIndexImageFilter(int argc, char * argv[]) +int generic_GAndRIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader GReaderType; typedef otb::ImageFileReader RReaderType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbGAndRIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImage.h" #include "otbImage.h" -int otbGAndRIndexImageFilterNew(int argc, char * argv[]) +int otbGAndRIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbIBGAndRAndNIRIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbSoilIndicesFunctor.h" -int otbIBGAndRAndNIRIndexImageFilter(int argc, char * argv[]) +int otbIBGAndRAndNIRIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbIBMultiChannelGAndRAndNIRIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbSoilIndicesFunctor.h" -int otbIBMultiChannelGAndRAndNIRIndexImageFilter(int argc, char * argv[]) +int otbIBMultiChannelGAndRAndNIRIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbImageMetadataCorrectionParametersNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbImageMetadataCorrectionParametersNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbImageMetadataCorrectionParametersNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbImageMetadataCorrectionParametersNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,31 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + +#include "otbImageMetadataCorrectionParameters.h" + +int otbImageMetadataCorrectionParametersNew(int argc, char * argv[]) +{ + typedef otb::ImageMetadataCorrectionParameters CorrectionParametersType; + + // Instantiating object + CorrectionParametersType::Pointer objectAtmo = CorrectionParametersType::New(); + + std::cout << objectAtmo << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx otb-4.2.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterAuto.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbMultiChannelExtractROI.h" //Test the retrieval of parameters from the image metadata -int otbImageToLuminanceImageFilterAuto(int argc, char * argv[]) +int otbImageToLuminanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -37,7 +37,6 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; typedef otb::ImageToLuminanceImageFilter ImageToLuminanceImageFilterType; - typedef ImageToLuminanceImageFilterType::VectorType VectorType; typedef otb::MultiChannelExtractROI RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "itkVariableLengthVector.h" -int otbImageToLuminanceImageFilter(int argc, char * argv[]) +int otbImageToLuminanceImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbImageToLuminanceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageToLuminanceImageFilter.h" #include "otbVectorImage.h" -int otbImageToLuminanceImageFilterNew(int argc, char * argv[]) +int otbImageToLuminanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx otb-4.2.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterAuto.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkVariableLengthVector.h" #include "otbMultiChannelExtractROI.h" -int otbImageToReflectanceImageFilterAuto(int argc, char * argv[]) +int otbImageToReflectanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -36,7 +36,7 @@ typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; typedef otb::ImageToReflectanceImageFilter ImageToReflectanceImageFilterType; - typedef ImageToReflectanceImageFilterType::VectorType VectorType; + typedef otb::MultiChannelExtractROI RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbImageToReflectanceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbImageToReflectanceImageFilter.h" #include "otbVectorImage.h" -int otbImageToReflectanceImageFilterNew(int argc, char * argv[]) +int otbImageToReflectanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbISUMultiChannelRAndNIRIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" -int otbISUMultiChannelRAndNIRIndexImageFilter(int argc, char * argv[]) +int otbISUMultiChannelRAndNIRIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbISURAndNIRIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" -int otbISURAndNIRIndexImageFilter(int argc, char * argv[]) +int otbISURAndNIRIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLAIFromNDVILogarithmicFunctorTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLAIFromNDVILogarithmicFunctorTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLAIFromNDVILogarithmicFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLAIFromNDVILogarithmicFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "itkMacro.h" #include "otbVegetationIndicesFunctor.h" -int otbLAIFromNDVILogarithmic(int argc, char * argv[]) +int otbLAIFromNDVILogarithmic(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLAIFromReflectancesLinearFunctorTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLAIFromReflectancesLinearFunctorTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLAIFromReflectancesLinearFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLAIFromReflectancesLinearFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "itkMacro.h" #include "otbVegetationIndicesFunctor.h" -int otbLAIFromReflectancesLinear(int argc, char * argv[]) +int otbLAIFromReflectancesLinear(int itkNotUsed(argc), char * argv[]) { typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMBrightTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMBrightTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMBrightTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMBrightTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include #include -int otbLandsatTMBrightTest(int argc, char * argv[]) +int otbLandsatTMBrightTest(int itkNotUsed(argc), char * argv[]) { typedef float InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexBIOTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexBIOTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexBIOTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexBIOTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexBIO(int argc, char * argv[]) +int otbLandsatTMIndexBIO(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexBrightTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexBrightTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexBrightTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexBrightTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexBright(int argc, char * argv[]) +int otbLandsatTMIndexBright(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR1Test.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR1Test.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR1Test.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR1Test.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexMIR1(int argc, char * argv[]) +int otbLandsatTMIndexMIR1(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR2Test.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR2Test.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR2Test.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexMIR2Test.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexMIR2(int argc, char * argv[]) +int otbLandsatTMIndexMIR2(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexMIRTIRTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexMIRTIRTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexMIRTIRTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexMIRTIRTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexMIRTIR(int argc, char * argv[]) +int otbLandsatTMIndexMIRTIR(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBBBITest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBBBITest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBBBITest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBBBITest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexNDBBBI(int argc, char * argv[]) +int otbLandsatTMIndexNDBBBI(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBSITest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBSITest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBSITest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDBSITest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexNDBSI(int argc, char * argv[]) +int otbLandsatTMIndexNDBSI(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSITest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSITest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSITest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSITest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexNDSI(int argc, char * argv[]) +int otbLandsatTMIndexNDSI(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSIVisTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSIVisTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSIVisTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDSIVisTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexNDSIVis(int argc, char * argv[]) +int otbLandsatTMIndexNDSIVis(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDVITest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDVITest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNDVITest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNDVITest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexNDVI(int argc, char * argv[]) +int otbLandsatTMIndexNDVI(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNIRTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNIRTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexNIRTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexNIRTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexNIR(int argc, char * argv[]) +int otbLandsatTMIndexNIR(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexTIRTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexTIRTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexTIRTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexTIRTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexTIR(int argc, char * argv[]) +int otbLandsatTMIndexTIR(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > L7InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexVisTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexVisTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMIndexVisTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMIndexVisTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMIndexVis(int argc, char * argv[]) +int otbLandsatTMIndexVis(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMKernelSpectralRules.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMKernelSpectralRules.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMKernelSpectralRules.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMKernelSpectralRules.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -331,7 +331,7 @@ } -int otbLandsatTMKernelSpectralRules(int argc, char * argv[]) +int otbLandsatTMKernelSpectralRules(int itkNotUsed(argc), char * argv[]) { double TM1 = (::atof(argv[1])); double TM2 = (::atof(argv[2])); @@ -347,7 +347,7 @@ } -int otbLandsatTMKernelSpectralRulesWithImage(int argc, char * argv[]) +int otbLandsatTMKernelSpectralRulesWithImage(int itkNotUsed(argc), char * argv[]) { typedef double InputPixelType; @@ -401,6 +401,3 @@ return EXIT_SUCCESS; } - - - diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMLinguisticLabelsTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMLinguisticLabelsTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMLinguisticLabelsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMLinguisticLabelsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "itkFixedArray.h" #include "otbLandsatTMIndices.h" -int otbLandsatTMLinguisticLabels(int argc, char * argv[]) +int otbLandsatTMLinguisticLabels(int itkNotUsed(argc), char * argv[]) { typedef double OutputPixelType; typedef itk::FixedArray< double, 8 > InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMSpectralRuleBasedClassifierTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMSpectralRuleBasedClassifierTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMSpectralRuleBasedClassifierTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMSpectralRuleBasedClassifierTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkUnaryFunctorImageFilter.h" #include -int otbLandsatTMSpectralRuleBasedClassifierTest(int argc, char * argv[]) +int otbLandsatTMSpectralRuleBasedClassifierTest(int itkNotUsed(argc), char * argv[]) { typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMThickCloudTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMThickCloudTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMThickCloudTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMThickCloudTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include #include -int otbLandsatTMThickCloudTest(int argc, char * argv[]) +int otbLandsatTMThickCloudTest(int itkNotUsed(argc), char * argv[]) { typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMThinCloudTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMThinCloudTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMThinCloudTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMThinCloudTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include #include -int otbLandsatTMThinCloudTest(int argc, char * argv[]) +int otbLandsatTMThinCloudTest(int itkNotUsed(argc), char * argv[]) { typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMVegetationTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMVegetationTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLandsatTMVegetationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLandsatTMVegetationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include #include -int otbLandsatTMVegetationTest(int argc, char * argv[]) +int otbLandsatTMVegetationTest(int itkNotUsed(argc), char * argv[]) { typedef double InputPixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterAuto.cxx otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterAuto.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterAuto.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterAuto.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,73 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbLuminanceToImageImageFilter.h" +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkVariableLengthVector.h" +#include "otbMultiChannelExtractROI.h" + +//Test the retrieval of parameters from the image metadata +int otbLuminanceToImageImageFilterAuto(int itkNotUsed(argc), char * argv[]) +{ + const char * inputFileName = argv[1]; + const char * inputFileName2 = argv[2]; + const char * outputFileName = argv[3]; + const char * outputFileName2 = argv[4]; + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + typedef otb::LuminanceToImageImageFilter LuminanceToImageImageFilterType; + typedef otb::MultiChannelExtractROI RoiFilterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + + ReaderType::Pointer reader2 = ReaderType::New(); + WriterType::Pointer writer2 = WriterType::New(); + reader2->SetFileName(inputFileName2); + writer2->SetFileName(outputFileName2); + reader2->UpdateOutputInformation(); + + // Instantiating object + LuminanceToImageImageFilterType::Pointer filter = LuminanceToImageImageFilterType::New(); + + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); + writer->Update(); + + RoiFilterType::Pointer roiFilter = RoiFilterType::New(); + roiFilter->SetStartX(1000); + roiFilter->SetStartY(1000); + roiFilter->SetSizeX(100); + roiFilter->SetSizeY(100); + roiFilter->SetInput(reader2->GetOutput()); + writer2->SetInput(roiFilter->GetOutput()); + writer2->Update(); + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilter.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,68 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbLuminanceToImageImageFilter.h" +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkVariableLengthVector.h" + +int otbLuminanceToImageImageFilter(int itkNotUsed(argc), char * argv[]) +{ + const char * inputFileName = argv[1]; + const char * outputFileName = argv[2]; + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + typedef otb::LuminanceToImageImageFilter LuminanceToImageImageFilterType; + typedef LuminanceToImageImageFilterType::VectorType VectorType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + + unsigned int nbOfComponent = reader->GetOutput()->GetNumberOfComponentsPerPixel(); + + VectorType alpha(nbOfComponent); + VectorType beta(nbOfComponent); + alpha.Fill(0); + beta.Fill(0); + + for (unsigned int i = 0; i < nbOfComponent; ++i) + { + alpha[i] = static_cast(atof(argv[i + 3])); + beta[i] = static_cast(atof(argv[i + 7])); + } + + // Instantiating object + LuminanceToImageImageFilterType::Pointer filter = LuminanceToImageImageFilterType::New(); + filter->SetAlpha(alpha); + filter->SetBeta(beta); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); + writer->Update(); + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToImageImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,37 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbLuminanceToImageImageFilter.h" +#include "otbVectorImage.h" + +int otbLuminanceToImageImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +{ + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + + typedef otb::LuminanceToImageImageFilter LuminanceToImageImageFilterType; + + // Instantiating object + LuminanceToImageImageFilterType::Pointer filter = LuminanceToImageImageFilterType::New(); + + std::cout << filter << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterAuto.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkVariableLengthVector.h" #include "otbMultiChannelExtractROI.h" -int otbLuminanceToReflectanceImageFilterAuto(int argc, char * argv[]) +int otbLuminanceToReflectanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -39,7 +39,6 @@ typedef otb::ImageToLuminanceImageFilter ImageToLuminanceImageFilterType; typedef otb::LuminanceToReflectanceImageFilter LuminanceToReflectanceImageFilterType; - typedef ImageToLuminanceImageFilterType::VectorType VectorType; typedef otb::MultiChannelExtractROI RoiFilterType; ReaderType::Pointer reader = ReaderType::New(); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbLuminanceToReflectanceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbLuminanceToReflectanceImageFilter.h" #include "otbVectorImage.h" -int otbLuminanceToReflectanceImageFilterNew(int argc, char * argv[]) +int otbLuminanceToReflectanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbVegetationIndicesFunctor.h" template -int generic_MultiChannelGAndRIndexImageFilter(int argc, char * argv[]) +int generic_MultiChannelGAndRIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelGAndRIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbMultiChannelGAndRIndexImageFilterNew(int argc, char * argv[]) +int otbMultiChannelGAndRIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbVegetationIndicesFunctor.h" template -int generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int generic_MultiChannelRAndBAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) +int otbMultiChannelRAndBAndNIRVegetationIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndGAndNIRIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbMultiChannelRAndGAndNIRIndexImageFilterNew(int argc, char * argv[]) +int otbMultiChannelRAndGAndNIRIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbVegetationIndicesFunctor.h" template -int generic_MultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int generic_MultiChannelRAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbMultiChannelRAndNIRVegetationIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImage.h" #include "otbVectorImage.h" -int otbMultiChannelRAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) +int otbMultiChannelRAndNIRVegetationIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbNDBIMultiChannelTM4AndTM5IndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" -int otbNDBIMultiChannelTM4AndTM5IndexImageFilter(int argc, char * argv[]) +int otbNDBIMultiChannelTM4AndTM5IndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbNDBITM4AndTM5IndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbBuiltUpIndicesFunctor.h" -int otbNDBITM4AndTM5IndexImageFilter(int argc, char * argv[]) +int otbNDBITM4AndTM5IndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbNDWIMultiChannelWaterIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbWaterIndicesFunctor.h" -int otbNDWIMultiChannelWaterIndexImageFilter(int argc, char * argv[]) +int otbNDWIMultiChannelWaterIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbNDWIWaterIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbWaterIndicesFunctor.h" -int otbNDWIWaterIndexImageFilter(int argc, char * argv[]) +int otbNDWIWaterIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.cxx otb-4.2.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,178 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" +#include "otbAtmosphericCorrectionParameters.h" +#include "otbImageMetadataCorrectionParameters.h" +#include "otbAtmosphericRadiativeTerms.h" +#include +#include +#include +#include +#include + +int otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms(int argc, char * argv[]) +{ + const char * wavelenghFile = argv[1]; + const char * outputFile = argv[2]; + + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; + + // Instantiating object + AtmoCorrectionParametersType::Pointer paramAtmo = AtmoCorrectionParametersType::New(); + AcquiCorrectionParametersType::Pointer paramAcqui = AcquiCorrectionParametersType::New(); + AerosolModelType aerosolModel; + FilterFunctionValuesType::Pointer functionValues = FilterFunctionValuesType::New(); + ValuesVectorType vect; + + ValueType val = 0.0025; + + vect.clear(); + + // Filter function values initialization + float minSpectralValue(0.); + float maxSpectralValue(0.); + float value(0.); + // Correction parameters initialization + 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.); + + 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; + unsigned int aer(0); + fin >> aer; //iaer; + aerosolModel = static_cast(aer); + fin >> aerosolOptical; //taer55; + fin >> minSpectralValue; //wlinf; + fin >> maxSpectralValue; //wlsup; + + std::string line; + std::getline(fin, line); + while (std::getline(fin, line)) + { + value = atof(line.c_str()); + vect.push_back(value); + } + + fin.close(); + functionValues->SetFilterFunctionValues(vect); + functionValues->SetMinSpectralValue(minSpectralValue); + functionValues->SetMaxSpectralValue(maxSpectralValue); + functionValues->SetUserStep(val); + paramAcqui->SetWavelengthSpectralBandWithIndex(0, functionValues); + + // Set parameters + paramAcqui->SetSolarZenithalAngle(static_cast(solarZenithalAngle)); + paramAcqui->SetSolarAzimutalAngle(static_cast(solarAzimutalAngle)); + paramAcqui->SetViewingZenithalAngle(static_cast(viewingZenithalAngle)); + paramAcqui->SetViewingAzimutalAngle(static_cast(viewingAzimutalAngle)); + paramAcqui->SetMonth(month); + paramAcqui->SetDay(day); + paramAtmo->SetAtmosphericPressure(static_cast(atmosphericPressure)); + paramAtmo->SetWaterVaporAmount(static_cast(waterVaporAmount)); + paramAtmo->SetOzoneAmount(static_cast(ozoneAmount)); + paramAtmo->SetAerosolModel(aerosolModel); + paramAtmo->SetAerosolOptical(static_cast(aerosolOptical)); + + RadiativeTermsType::Pointer radiative = CorrectionParametersToRadiativeTermsType::Compute(paramAtmo,paramAcqui); + + + 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 wavelength 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 wavelength 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 -Nru otb-4.0.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,35 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ + +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" +#include + +int otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew(int argc, char * argv[]) +{ + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms + RadiometryCorrectionParametersToAtmosphericRadiativeTermsType; + // Instantiating object + //RadiometryCorrectionParametersToAtmosphericRadiativeTermsType::Pointer object = + // RadiometryCorrectionParametersToAtmosphericRadiativeTermsType::New(); + + RadiometryCorrectionParametersToAtmosphericRadiativeTermsType* object = new RadiometryCorrectionParametersToAtmosphericRadiativeTermsType; + + std::cout << object << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRadiometryTests2.cxx otb-4.2.0/Testing/Code/Radiometry/otbRadiometryTests2.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRadiometryTests2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRadiometryTests2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,4 +37,13 @@ REGISTER_TEST(otbImageToReflectanceImageFilterNew); REGISTER_TEST(otbImageToReflectanceImageFilter); REGISTER_TEST(otbImageToReflectanceImageFilterAuto); + REGISTER_TEST(otbLuminanceToImageImageFilterNew); + REGISTER_TEST(otbLuminanceToImageImageFilter); + REGISTER_TEST(otbLuminanceToImageImageFilterAuto); + REGISTER_TEST(otbReflectanceToLuminanceImageFilterNew); + REGISTER_TEST(otbReflectanceToLuminanceImageFilter); + REGISTER_TEST(otbReflectanceToLuminanceImageFilterAuto); + REGISTER_TEST(otbReflectanceToImageImageFilterNew); + REGISTER_TEST(otbReflectanceToImageImageFilter); + REGISTER_TEST(otbReflectanceToImageImageFilterAuto); } diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRadiometryTests3.cxx otb-4.2.0/Testing/Code/Radiometry/otbRadiometryTests3.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRadiometryTests3.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRadiometryTests3.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,6 +27,7 @@ REGISTER_TEST(otbDEMCaracteristicsExtractorNew); REGISTER_TEST(otbDEMCaracteristicsExtractor); REGISTER_TEST(otbAtmosphericCorrectionParametersNew); + REGISTER_TEST(otbImageMetadataCorrectionParametersNew); REGISTER_TEST(otbFilterFunctionValuesTest); REGISTER_TEST(otbFilterFunctionValuesSpectralResponseTest); REGISTER_TEST(otbFilterFunctionValuesDigitalGlobeTest); @@ -38,7 +39,7 @@ REGISTER_TEST(otbReflectanceToSurfaceReflectanceImageFilterNew); REGISTER_TEST(otbReflectanceToSurfaceReflectanceImageFilterTest); REGISTER_TEST(otbReflectanceToSurfaceReflectanceImageFilterTest2); - REGISTER_TEST(otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew); - REGISTER_TEST(otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter); + REGISTER_TEST(otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew); + REGISTER_TEST(otbSurfaceAdjacencyEffectCorrectionSchemeFilter); REGISTER_TEST(otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter); } diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRadiometryTests4.cxx otb-4.2.0/Testing/Code/Radiometry/otbRadiometryTests4.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRadiometryTests4.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRadiometryTests4.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,8 +24,8 @@ void RegisterTests() { - REGISTER_TEST(otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTermsNew); - REGISTER_TEST(otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms); + REGISTER_TEST(otbRadiometryCorrectionParametersToAtmosphericRadiativeTermsNew); + REGISTER_TEST(otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms); REGISTER_TEST(otbAtmosphericCorrectionSequencementTest); REGISTER_TEST(otbEVIRAndBAndNIRVegetationIndexImageFilter); REGISTER_TEST(otbEVIMultiChannelRAndBAndNIRVegetationIndexImageFilter); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVegetationIndicesFunctor.h" template -int generic_RAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int generic_RAndBAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader RReaderType; typedef otb::ImageFileReader BReaderType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRAndBAndNIRVegetationIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbRAndBAndNIRIndexImageFilter.h" #include "otbImage.h" -int otbRAndBAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) +int otbRAndBAndNIRVegetationIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRAndGAndNIRVegetationIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbRAndGAndNIRIndexImageFilter.h" #include "otbImage.h" -int otbRAndGAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) +int otbRAndGAndNIRVegetationIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVegetationIndicesFunctor.h" template -int generic_RAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int generic_RAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader RReaderType; typedef otb::ImageFileReader NIRReaderType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRAndNIRVegetationIndexImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImage.h" #include "otbImage.h" -int otbRAndNIRVegetationIndexImageFilterNew(int argc, char * argv[]) +int otbRAndNIRVegetationIndexImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterAuto.cxx otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterAuto.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterAuto.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterAuto.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,71 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbReflectanceToImageImageFilter.h" +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkVariableLengthVector.h" +#include "otbMultiChannelExtractROI.h" + +int otbReflectanceToImageImageFilterAuto(int itkNotUsed(argc), char * argv[]) +{ + const char * inputFileName = argv[1]; + const char * inputFileName2 = argv[2]; + const char * outputFileName = argv[3]; + const char * outputFileName2 = argv[4]; + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + typedef otb::ReflectanceToImageImageFilter ReflectanceToImageImageFilterType; + typedef otb::MultiChannelExtractROI RoiFilterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + + ReaderType::Pointer reader2 = ReaderType::New(); + WriterType::Pointer writer2 = WriterType::New(); + reader2->SetFileName(inputFileName2); + writer2->SetFileName(outputFileName2); + reader2->UpdateOutputInformation(); + + // Instantiating object + ReflectanceToImageImageFilterType::Pointer filter = ReflectanceToImageImageFilterType::New(); + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); + writer->Update(); + + RoiFilterType::Pointer roiFilter = RoiFilterType::New(); + roiFilter->SetStartX(1000); + roiFilter->SetStartY(1000); + roiFilter->SetSizeX(100); + roiFilter->SetSizeY(100); + roiFilter->SetInput(reader2->GetOutput()); + writer2->SetInput(roiFilter->GetOutput()); + writer2->Update(); + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilter.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,183 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbReflectanceToImageImageFilter.h" + +//#include "otbReflectanceToLuminanceImageFilter.h" +//#include "otbLuminanceToImageImageFilter.h" + +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkVariableLengthVector.h" + +int otbReflectanceToImageImageFilter(int argc, char * argv[]) +{ + const char * inputFileName = argv[1]; + const char * outputFileName = argv[2]; + const double angle = static_cast(atof(argv[3])); + double flux = 0.; + int day = 1; + int month = 1; + + if (argc == 17) + { + flux = static_cast(atof(argv[16])); + } + else + { + day = atoi(argv[16]); + month = atoi(argv[17]); + } + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + typedef otb::ReflectanceToImageImageFilter ReflectanceToImageImageFilterType; + typedef ReflectanceToImageImageFilterType::VectorType VectorType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + + unsigned int nbOfComponent = reader->GetOutput()->GetNumberOfComponentsPerPixel(); + + VectorType alpha(nbOfComponent); + VectorType beta(nbOfComponent); + VectorType solarIllumination(nbOfComponent); + alpha.Fill(0); + beta.Fill(0); + solarIllumination.Fill(0); + + for (unsigned int i = 0; i < nbOfComponent; ++i) + { + alpha[i] = static_cast(atof(argv[i + 4])); + beta[i] = static_cast(atof(argv[i + 8])); + solarIllumination[i] = static_cast(atof(argv[i + 12])); + } + + // Instantiating object + ReflectanceToImageImageFilterType::Pointer filter = ReflectanceToImageImageFilterType::New(); + + filter->SetAlpha(alpha); + filter->SetBeta(beta); + filter->SetZenithalSolarAngle(angle); + filter->SetSolarIllumination(solarIllumination); + + 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; + + + /*const char * inputFileName = argv[1]; + const char * outputFileName = argv[2]; + const double angle = static_cast(atof(argv[3])); + double flux = 0.; + int day = 1; + int month = 1; + + if (argc == 17) + { + flux = static_cast(atof(argv[16])); + } + else + { + day = atoi(argv[16]); + month = atoi(argv[17]); + } + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + +typedef otb::ReflectanceToLuminanceImageFilter ReflectanceToLuminanceImageFilterType; +typedef otb::LuminanceToImageImageFilter LuminanceToImageImageFilterType; + + typedef ReflectanceToLuminanceImageFilterType::VectorType VectorType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + + unsigned int nbOfComponent = reader->GetOutput()->GetNumberOfComponentsPerPixel(); + + VectorType alpha(nbOfComponent); + VectorType beta(nbOfComponent); + VectorType solarIllumination(nbOfComponent); + alpha.Fill(0); + beta.Fill(0); + solarIllumination.Fill(0); + + for (unsigned int i = 0; i < nbOfComponent; ++i) + { + alpha[i] = static_cast(atof(argv[i + 4])); + beta[i] = static_cast(atof(argv[i + 8])); + solarIllumination[i] = static_cast(atof(argv[i + 12])); + } + + // Instantiating object + +ReflectanceToLuminanceImageFilterType::Pointer filter = ReflectanceToLuminanceImageFilterType::New(); +LuminanceToImageImageFilterType::Pointer filter2 = LuminanceToImageImageFilterType::New(); + + filter2->SetAlpha(alpha); + filter2->SetBeta(beta); + filter->SetZenithalSolarAngle(angle); + filter->SetSolarIllumination(solarIllumination); + + if (argc == 17) + { + filter->SetFluxNormalizationCoefficient(flux); + } + else + { + filter->SetDay(day); + filter->SetMonth(month); + } + + filter->SetInput(reader->GetOutput()); + filter2->SetInput(filter->GetOutput()); + writer->SetInput(filter2->GetOutput()); + writer->Update(); + + return EXIT_SUCCESS; */ + +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToImageImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,37 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbReflectanceToImageImageFilter.h" +#include "otbVectorImage.h" + +int otbReflectanceToImageImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +{ + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + + typedef otb::ReflectanceToImageImageFilter ReflectanceToImageImageFilterType; + + // Instantiating object + ReflectanceToImageImageFilterType::Pointer filter = ReflectanceToImageImageFilterType::New(); + + std::cout << filter << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterAuto.cxx otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterAuto.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterAuto.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterAuto.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,57 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkVariableLengthVector.h" +#include "otbMultiChannelExtractROI.h" + +int otbReflectanceToLuminanceImageFilterAuto(int itkNotUsed(argc), char * argv[]) +{ + +const char * inputFileName = argv[1]; + const char * outputFileName = argv[2]; + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + typedef otb::ReflectanceToLuminanceImageFilter ReflectanceToLuminanceImageFilterType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + + // Instantiating object + ReflectanceToLuminanceImageFilterType::Pointer filterToLuminance = ReflectanceToLuminanceImageFilterType::New(); + + filterToLuminance->SetInput(reader->GetOutput()); + writer->SetInput(filterToLuminance->GetOutput()); + writer->Update(); + + return EXIT_SUCCESS; + +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilter.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,90 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbVectorImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "itkVariableLengthVector.h" + +int otbReflectanceToLuminanceImageFilter(int argc, char * argv[]) +{ + const char * inputFileName = argv[1]; + const char * outputFileName = argv[2]; + const double angle = static_cast(atof(argv[3])); + double flux = 0.; + int day = 1; + int month = 1; + + if (argc == 9) + { + flux = static_cast(atof(argv[8])); + } + else + { + day = atoi(argv[8]); + month = atoi(argv[9]); + } + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + typedef otb::ReflectanceToLuminanceImageFilter ReflectanceToLuminanceImageFilterType; + typedef ReflectanceToLuminanceImageFilterType::VectorType VectorType; + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + + unsigned int nbOfComponent = reader->GetOutput()->GetNumberOfComponentsPerPixel(); + // WARNING : 1 ELEMENT FOR EACH PIXEL IMAGE COMPONENT + VectorType solarIllumination(nbOfComponent); + solarIllumination.Fill(0); + solarIllumination[0] = static_cast(atof(argv[4])); + solarIllumination[1] = static_cast(atof(argv[5])); + solarIllumination[2] = static_cast(atof(argv[6])); + solarIllumination[3] = static_cast(atof(argv[7])); + + // Instantiating object + ReflectanceToLuminanceImageFilterType::Pointer filter = ReflectanceToLuminanceImageFilterType::New(); + + filter->SetZenithalSolarAngle(angle); + filter->SetSolarIllumination(solarIllumination); + filter->SetUseClamp(false); + 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 -Nru otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToLuminanceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,37 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbReflectanceToLuminanceImageFilter.h" +#include "otbVectorImage.h" + +int otbReflectanceToLuminanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) +{ + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + + typedef otb::ReflectanceToLuminanceImageFilter ReflectanceToLuminanceImageFilterType; + + // Instantiating object + ReflectanceToLuminanceImageFilterType::Pointer filter = ReflectanceToLuminanceImageFilterType::New(); + + std::cout << filter << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbReflectanceToSurfaceReflectanceImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,14 +18,20 @@ #include "itkMacro.h" #include +#include #include "otbReflectanceToSurfaceReflectanceImageFilter.h" #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" #include "otbAtmosphericRadiativeTerms.h" +#include "otbAtmosphericCorrectionParameters.h" -int otbReflectanceToSurfaceReflectanceImageFilterNew(int argc, char * argv[]) +#include "itkMetaDataDictionary.h" +#include "otbOpticalImageMetadataInterfaceFactory.h" +#include "otbOpticalImageMetadataInterface.h" + +int otbReflectanceToSurfaceReflectanceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; @@ -42,7 +48,7 @@ return EXIT_SUCCESS; } -int otbReflectanceToSurfaceReflectanceImageFilterTest(int argc, char * argv[]) +int otbReflectanceToSurfaceReflectanceImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -53,11 +59,14 @@ typedef otb::VectorImage OutputImageType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; + typedef otb::ReflectanceToSurfaceReflectanceImageFilter ReflectanceToSurfaceReflectanceImageFilterType; + typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; - otb::AtmosphericRadiativeTerms::Pointer atmo = otb::AtmosphericRadiativeTerms::New(); + otb::AtmosphericRadiativeTerms::Pointer atmoRadTerms = otb::AtmosphericRadiativeTerms::New(); + ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); @@ -82,16 +91,16 @@ upTrans.push_back(static_cast(atof(argv[3 + j + 4 * nbChannel]))); } - atmo->SetIntrinsicAtmosphericReflectances(intrinsic); - atmo->SetSphericalAlbedos(albedo); - atmo->SetTotalGaseousTransmissions(gaseous); - atmo->SetDownwardTransmittances(downTrans); - atmo->SetUpwardTransmittances(upTrans); + atmoRadTerms->SetIntrinsicAtmosphericReflectances(intrinsic); + atmoRadTerms->SetSphericalAlbedos(albedo); + atmoRadTerms->SetTotalGaseousTransmissions(gaseous); + atmoRadTerms->SetDownwardTransmittances(downTrans); + atmoRadTerms->SetUpwardTransmittances(upTrans); // Instantiating object ReflectanceToSurfaceReflectanceImageFilterType::Pointer filter = ReflectanceToSurfaceReflectanceImageFilterType::New(); - filter->SetAtmosphericRadiativeTerms(atmo); + filter->SetAtmosphericRadiativeTerms(atmoRadTerms); filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); @@ -101,7 +110,7 @@ } //Check the correct generation of the atmospheric parameters -int otbReflectanceToSurfaceReflectanceImageFilterTest2(int argc, char * argv[]) +int otbReflectanceToSurfaceReflectanceImageFilterTest2(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -116,6 +125,18 @@ OutputImageType> ReflectanceToSurfaceReflectanceImageFilterType; + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + AtmoCorrectionParametersType::Pointer paramAtmo = AtmoCorrectionParametersType::New(); + + + paramAtmo->SetAtmosphericPressure(static_cast(atof(argv[3]))); + paramAtmo->SetWaterVaporAmount(static_cast(atof(argv[4]))); + paramAtmo->SetOzoneAmount(static_cast(atof(argv[5]))); + paramAtmo->SetAerosolModel(static_cast(atoi(argv[6]))); + paramAtmo->SetAerosolOptical(static_cast(atof(argv[7]))); + + ReaderType::Pointer reader = ReaderType::New(); WriterType::Pointer writer = WriterType::New(); reader->SetFileName(inputFileName); @@ -127,12 +148,17 @@ ReflectanceToSurfaceReflectanceImageFilterType::Pointer filter = ReflectanceToSurfaceReflectanceImageFilterType::New(); filter->SetInput(reader->GetOutput()); - filter->GenerateParameters(); + filter->SetAtmoCorrectionParameters(paramAtmo); + writer->SetInput(filter->GetOutput()); + + writer->Update(); + + /*filter->GenerateParameters(); otb::AtmosphericRadiativeTerms::Pointer terms = filter->GetAtmosphericRadiativeTerms(); std::ofstream fout (outputFileName); fout << terms; - fout.close(); + fout.close(); */ return EXIT_SUCCESS; } diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,13 +21,13 @@ #include "otbVectorImage.h" #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" #include "otbAtmosphericCorrectionParameters.h" #include "otbAtmosphericRadiativeTerms.h" #include #include -int otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter(int argc, char * argv[]) +int otbRomaniaReflectanceToRomaniaSurfaceReflectanceImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; @@ -44,19 +44,40 @@ typedef otb::ReflectanceToSurfaceReflectanceImageFilter ReflectanceToSurfaceReflectanceImageFilterType; - typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; - typedef otb::AtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms - CorrectionParametersTo6SRadiativeTermsType; - typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; + + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms + CorrectionParametersToRadiativeTermsType; + /*typedef otb::AtmosphericCorrectionParameters CorrectionParametersType; chris typedef otb::AtmosphericRadiativeTerms RadiativeTermsType; typedef otb::FilterFunctionValues FilterFunctionValuesType; typedef CorrectionParametersType::AerosolModelType AerosolModelType; typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; - typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; */ + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; + + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; //float + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; //std::vector - RadiativeTermsType::Pointer radiative = RadiativeTermsType::New(); - CorrectionParametersType::Pointer param = CorrectionParametersType::New(); - CorrectionParametersTo6SRadiativeTermsType::Pointer corrToRadia = CorrectionParametersTo6SRadiativeTermsType::New(); + typedef AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType; + + + + //AtmosphericRadiativeTermsType::Pointer radiative = AtmosphericRadiativeTermsType::New(); chris + //CorrectionParametersType::Pointer param = CorrectionParametersType::New(); chris + //CorrectionParametersToRadiativeTermsType* corrToRadia = new CorrectionParametersToRadiativeTermsType; chris + AcquiCorrectionParametersPointerType paramAcqui = AcquiCorrectionParametersType::New(); + AtmoCorrectionParametersPointerType paramAtmo = AtmoCorrectionParametersType::New(); FilterFunctionValuesType::Pointer functionValues; ReaderType::Pointer reader = ReaderType::New(); @@ -103,7 +124,7 @@ fin >> aerosolOptical; //taer55; fin.close(); // Set atmospheric parameters - param->SetSolarZenithalAngle(static_cast(solarZenithalAngle)); + /*param->SetSolarZenithalAngle(static_cast(solarZenithalAngle)); param->SetSolarAzimutalAngle(static_cast(solarAzimutalAngle)); param->SetViewingZenithalAngle(static_cast(viewingZenithalAngle)); param->SetViewingAzimutalAngle(static_cast(viewingAzimutalAngle)); @@ -113,7 +134,20 @@ param->SetWaterVaporAmount(static_cast(waterVaporAmount)); param->SetOzoneAmount(static_cast(ozoneAmount)); param->SetAerosolModel(aerosolModel); - param->SetAerosolOptical(static_cast(aerosolOptical)); + param->SetAerosolOptical(static_cast(aerosolOptical)); */ + + paramAcqui->SetSolarZenithalAngle(solarZenithalAngle); + paramAcqui->SetSolarAzimutalAngle(solarAzimutalAngle); + paramAcqui->SetViewingZenithalAngle(viewingZenithalAngle); + paramAcqui->SetViewingAzimutalAngle(viewingAzimutalAngle); + paramAcqui->SetMonth(month); + paramAcqui->SetDay(day); + paramAtmo->SetAtmosphericPressure(atmosphericPressure); + paramAtmo->SetWaterVaporAmount(waterVaporAmount); + paramAtmo->SetOzoneAmount(ozoneAmount); + paramAtmo->SetAerosolModel(aerosolModel); + paramAtmo->SetAerosolOptical(aerosolOptical); + ValuesVectorType vect; for (unsigned int j = 0; j < nbChannel; ++j) @@ -150,15 +184,14 @@ functionValues->SetMaxSpectralValue(maxSpectralValue); functionValues->SetUserStep(val); - param->SetWavelengthSpectralBandWithIndex(j, functionValues); + paramAcqui->SetWavelengthSpectralBandWithIndex(j, functionValues); } - corrToRadia->SetInput(param); - corrToRadia->Update(); + AtmosphericRadiativeTermsPointerType radiative = CorrectionParametersToRadiativeTermsType::Compute(paramAtmo,paramAcqui); // Instantiating object ReflectanceToSurfaceReflectanceImageFilterType::Pointer filter = ReflectanceToSurfaceReflectanceImageFilterType::New(); - filter->SetAtmosphericRadiativeTerms(corrToRadia->GetOutput()); + filter->SetAtmosphericRadiativeTerms(radiative); filter->SetInput(reader->GetOutput()); writer->SetInput(filter->GetOutput()); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunction.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunction.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include -int otbSarBrightnessFunction(int argc, char* argv[]) +int otbSarBrightnessFunction(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunctionWithoutNoise.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunctionWithoutNoise.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunctionWithoutNoise.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunctionWithoutNoise.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include -int otbSarBrightnessFunctionWithoutNoise(int argc, char* argv[]) +int otbSarBrightnessFunctionWithoutNoise(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunctor.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunctor.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbSarBrightnessFunctor.h" -int otbSarBrightnessFunctor(int argc, char * argv[]) +int otbSarBrightnessFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double ScalarType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunctorWithoutNoise.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunctorWithoutNoise.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarBrightnessFunctorWithoutNoise.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarBrightnessFunctorWithoutNoise.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbSarBrightnessFunctor.h" -int otbSarBrightnessFunctorWithoutNoise(int argc, char * argv[]) +int otbSarBrightnessFunctorWithoutNoise(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double ScalarType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarParametricMapFunctionTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarParametricMapFunctionTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarParametricMapFunctionTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarParametricMapFunctionTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbSarParametricMapFunction.h" #include "itkPointSet.h" -int otbSarParametricMapFunctionTest(int argc, char* argv[]) +int otbSarParametricMapFunctionTest(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; @@ -37,7 +37,6 @@ typedef InputImageType::PixelType InputPixelType; typedef otb::ImageFileReader ReaderType; typedef otb::SarParametricMapFunction FunctionType; - typedef FunctionType::PointType PointType; typedef FunctionType::PointSetType PointSetType; /**Instantiation ofa Smart Pointer*/ @@ -106,4 +105,3 @@ return EXIT_SUCCESS; } - diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarParametricMapFunctionToImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarParametricMapFunctionToImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarParametricMapFunctionToImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarParametricMapFunctionToImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "itkPointSet.h" -int otbSarParametricMapFunctionToImageFilter(int argc, char * argv[]) +int otbSarParametricMapFunctionToImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef float PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunction.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunction.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include -int otbSarRadiometricCalibrationFunction(int argc, char* argv[]) +int otbSarRadiometricCalibrationFunction(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctionWithoutNoise.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctionWithoutNoise.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctionWithoutNoise.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctionWithoutNoise.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageFileReader.h" #include -int otbSarRadiometricCalibrationFunctionWithoutNoise(int argc, char* argv[]) +int otbSarRadiometricCalibrationFunctionWithoutNoise(int itkNotUsed(argc), char* argv[]) { const char * infname = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctor.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctor.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbSarRadiometricCalibrationFunctor.h" -int otbSarRadiometricCalibrationFunctor(int argc, char * argv[]) +int otbSarRadiometricCalibrationFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double ScalarType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctorWithoutNoise.cxx otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctorWithoutNoise.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctorWithoutNoise.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSarRadiometricCalibrationFunctorWithoutNoise.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbSarRadiometricCalibrationFunctor.h" -int otbSarRadiometricCalibrationFunctorWithoutNoise(int argc, char * argv[]) +int otbSarRadiometricCalibrationFunctorWithoutNoise(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double ScalarType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSetASetBMultiChannelRAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbVegetationIndicesFunctor.h" template -void generic_SetASetBMultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +void generic_SetASetBMultiChannelRAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSetASetBRAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVegetationIndicesFunctor.h" template -void generic_SetASetBRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +void generic_SetASetBRAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { typedef otb::ImageFileReader RReaderType; typedef otb::ImageFileReader NIRReaderType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx otb-4.2.0/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSIXSTraitsComputeAtmosphericParameters.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include #include -int otbSIXSTraitsComputeAtmosphericParametersTest(int argc, char * argv[]) +int otbSIXSTraitsComputeAtmosphericParametersTest(int itkNotUsed(argc), char * argv[]) { const char * inname = argv[1]; const char * outname = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSIXSTraitsTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbSIXSTraitsTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSIXSTraitsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSIXSTraitsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,7 @@ #include "otbSIXSTraits.h" -int otbSIXSTraitsTest(int argc, char * argv[]) +int otbSIXSTraitsTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { otb::SIXSTraits *var(NULL); var = new otb::SIXSTraits(); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.cxx 1970-01-01 00:00:00.000000000 +0000 @@ -1,173 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - 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. - -=========================================================================*/ -#include "itkMacro.h" - -#include "otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h" -#include "otbVectorImage.h" -#include "otbImage.h" -#include "otbImageFileReader.h" -#include "otbImageFileWriter.h" -#include "otbAtmosphericCorrectionParametersTo6SAtmosphericRadiativeTerms.h" -#include "otbAtmosphericCorrectionParameters.h" -#include "otbAtmosphericRadiativeTerms.h" -#include -#include - -int otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter(int argc, char * argv[]) -{ - const char * inputFileName = argv[1]; - const char * outputFileName = argv[2]; - const char * paramFile = argv[5]; - - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage InputImageType; - typedef otb::VectorImage OutputImageType; - typedef otb::ImageFileReader ReaderType; - typedef otb::ImageFileWriter WriterType; - - typedef otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType; - typedef SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::WeightingMatrixType WeightingMatrixType; - typedef SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::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::WavelengthSpectralBandType 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 - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::Pointer filter = - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::New(); - - ReaderType::Pointer reader = ReaderType::New(); - WriterType::Pointer writer = WriterType::New(); - reader->SetFileName(inputFileName); - writer->SetFileName(outputFileName); - reader->UpdateOutputInformation(); - std::vector wavelenghFiles; - 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.); - unsigned int month(0); - unsigned int day(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; - unsigned int aer(0); - fin >> aer; //iaer; - AerosolModelType aerosolModel = static_cast(aer); - fin >> aerosolOptical; //taer55; - fin.close(); - // Set atmospheric parameters - param->SetSolarZenithalAngle(static_cast(solarZenithalAngle)); - param->SetSolarAzimutalAngle(static_cast(solarAzimutalAngle)); - param->SetViewingZenithalAngle(static_cast(viewingZenithalAngle)); - param->SetViewingAzimutalAngle(static_cast(viewingAzimutalAngle)); - param->SetMonth(month); - param->SetDay(day); - param->SetAtmosphericPressure(static_cast(atmosphericPressure)); - param->SetWaterVaporAmount(static_cast(waterVaporAmount)); - param->SetOzoneAmount(static_cast(ozoneAmount)); - param->SetAerosolModel(aerosolModel); - param->SetAerosolOptical(static_cast(aerosolOptical)); - - ValuesVectorType vect; - for (unsigned int j = 0; j < nbChannel; ++j) - { - functionValues = FilterFunctionValuesType::New(); - vect.clear(); - - // Filter function values initialization - float minSpectralValue(0.); - float maxSpectralValue(0.); - float value(0.); - - std::ifstream fin; - //Read input file parameters - fin.open(wavelenghFiles[j]); - fin >> minSpectralValue; //wlinf; - fin >> maxSpectralValue; //wlsup; - - std::string line; - std::getline(fin, line); - while (std::getline(fin, line) ) - { - value = atof(line.c_str()); - vect.push_back(value); - std::cout << "value " << value << std::endl; - } - std::cout << "vec size " << vect.size()<< std::endl; - fin.close(); - functionValues->SetFilterFunctionValues(vect); - functionValues->SetMinSpectralValue(minSpectralValue); - functionValues->SetMaxSpectralValue(maxSpectralValue); - functionValues->SetUserStep(val); - - param->SetWavelengthSpectralBandWithIndex(j, functionValues); - } - - corrToRadia->SetInput(param); - corrToRadia->Update(); - - filter->SetAtmosphericRadiativeTerms(corrToRadia->GetOutput()); - filter->SetWindowRadius(atoi(argv[3])); - filter->SetPixelSpacingInKilometers(static_cast(atof(argv[4]))); - filter->SetZenithalViewingAngle(param->GetViewingZenithalAngle()); - - filter->SetInput(reader->GetOutput()); - writer->SetInput(filter->GetOutput()); - - writer->Update(); - - return EXIT_SUCCESS; -} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew.cxx 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - 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. - -=========================================================================*/ -#include "itkMacro.h" - -#include "otbSurfaceAdjacencyEffect6SCorrectionSchemeFilter.h" -#include "otbVectorImage.h" -#include "otbImage.h" - -int otbSurfaceAdjacencyEffect6SCorrectionSchemeFilterNew(int argc, char * argv[]) -{ - const unsigned int Dimension = 2; - typedef double PixelType; - typedef otb::VectorImage InputImageType; - typedef otb::SurfaceAdjacencyEffect6SCorrectionSchemeFilter - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType; - - // Instantiating object - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::Pointer filter = - SurfaceAdjacencyEffect6SCorrectionSchemeFilterType::New(); - - std::cout << filter << std::endl; - - return EXIT_SUCCESS; -} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,182 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" +#include "otbVectorImage.h" +#include "otbImage.h" +#include "otbImageFileReader.h" +#include "otbImageFileWriter.h" +#include "otbRadiometryCorrectionParametersToAtmosphericRadiativeTerms.h" +#include "otbAtmosphericCorrectionParameters.h" +#include "otbAtmosphericRadiativeTerms.h" +#include +#include + +int otbSurfaceAdjacencyEffectCorrectionSchemeFilter(int argc, char * argv[]) +{ + const char * inputFileName = argv[1]; + const char * outputFileName = argv[2]; + const char * paramFile = argv[5]; + + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::VectorImage OutputImageType; + typedef otb::ImageFileReader ReaderType; + typedef otb::ImageFileWriter WriterType; + + typedef otb::SurfaceAdjacencyEffectCorrectionSchemeFilter + SurfaceAdjacencyEffectCorrectionSchemeFilterType; + + + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + typedef otb::AtmosphericRadiativeTerms::DataVectorType DataVectorType; + + typedef otb::FilterFunctionValues FilterFunctionValuesType; + typedef FilterFunctionValuesType::WavelengthSpectralBandType ValueType; //float + typedef FilterFunctionValuesType::ValuesVectorType ValuesVectorType; //std::vector + + typedef AcquiCorrectionParametersType::WavelengthSpectralBandVectorType WavelengthSpectralBandVectorType; + + + AcquiCorrectionParametersPointerType paramAcqui = AcquiCorrectionParametersType::New(); + AtmoCorrectionParametersPointerType paramAtmo = AtmoCorrectionParametersType::New(); + FilterFunctionValuesType::Pointer functionValues; + + // Instantiating object + SurfaceAdjacencyEffectCorrectionSchemeFilterType::Pointer filter = SurfaceAdjacencyEffectCorrectionSchemeFilterType::New(); + + ReaderType::Pointer reader = ReaderType::New(); + WriterType::Pointer writer = WriterType::New(); + reader->SetFileName(inputFileName); + writer->SetFileName(outputFileName); + reader->UpdateOutputInformation(); + std::vector wavelenghFiles; + 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.); + unsigned int month(0); + unsigned int day(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; + unsigned int aer(0); + fin >> aer; //iaer; + AerosolModelType aerosolModel = static_cast(aer); + fin >> aerosolOptical; //taer55; + fin.close(); + + // Set atmospheric parameters + paramAcqui->SetSolarZenithalAngle(solarZenithalAngle); + paramAcqui->SetSolarAzimutalAngle(solarAzimutalAngle); + paramAcqui->SetViewingZenithalAngle(viewingZenithalAngle); + paramAcqui->SetViewingAzimutalAngle(viewingAzimutalAngle); + paramAcqui->SetMonth(month); + paramAcqui->SetDay(day); + paramAtmo->SetAtmosphericPressure(atmosphericPressure); + paramAtmo->SetWaterVaporAmount(waterVaporAmount); + paramAtmo->SetOzoneAmount(ozoneAmount); + paramAtmo->SetAerosolModel(aerosolModel); + paramAtmo->SetAerosolOptical(aerosolOptical); + + ValuesVectorType vect; + for (unsigned int j = 0; j < nbChannel; ++j) + { + functionValues = FilterFunctionValuesType::New(); + vect.clear(); + + // Filter function values initialization + float minSpectralValue(0.); + float maxSpectralValue(0.); + float value(0.); + + std::ifstream fin; + //Read input file parameters + fin.open(wavelenghFiles[j]); + fin >> minSpectralValue; //wlinf; + fin >> maxSpectralValue; //wlsup; + + std::string line; + std::getline(fin, line); + while (std::getline(fin, line) ) + { + value = atof(line.c_str()); + vect.push_back(value); + std::cout << "value " << value << std::endl; + } + std::cout << "vec size " << vect.size()<< std::endl; + fin.close(); + functionValues->SetFilterFunctionValues(vect); + functionValues->SetMinSpectralValue(minSpectralValue); + functionValues->SetMaxSpectralValue(maxSpectralValue); + functionValues->SetUserStep(val); + + paramAcqui->SetWavelengthSpectralBandWithIndex(j, functionValues); + } + + + AtmosphericRadiativeTermsPointerType radiative = CorrectionParametersToRadiativeTermsType::Compute(paramAtmo,paramAcqui); + + filter->SetAtmosphericRadiativeTerms(radiative); + filter->SetWindowRadius(atoi(argv[3])); + filter->SetPixelSpacingInKilometers(static_cast(atof(argv[4]))); + filter->SetZenithalViewingAngle(paramAcqui->GetViewingZenithalAngle()); + + filter->SetInput(reader->GetOutput()); + writer->SetInput(filter->GetOutput()); + + writer->Update(); + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,40 @@ +/*========================================================================= + + Program: ORFEO Toolbox + Language: C++ + Date: $Date$ + Version: $Revision$ + + + Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. + See OTBCopyright.txt for details. + + + 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. + +=========================================================================*/ +#include "itkMacro.h" + +#include "otbSurfaceAdjacencyEffectCorrectionSchemeFilter.h" +#include "otbVectorImage.h" +#include "otbImage.h" + +int otbSurfaceAdjacencyEffectCorrectionSchemeFilterNew(int argc, char * argv[]) +{ + const unsigned int Dimension = 2; + typedef double PixelType; + typedef otb::VectorImage InputImageType; + typedef otb::SurfaceAdjacencyEffectCorrectionSchemeFilter + SurfaceAdjacencyEffectCorrectionSchemeFilterType; + + // Instantiating object + SurfaceAdjacencyEffectCorrectionSchemeFilterType::Pointer filter = + SurfaceAdjacencyEffectCorrectionSchemeFilterType::New(); + + std::cout << filter << std::endl; + + return EXIT_SUCCESS; +} diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbTerraSarBrightnessFunctor.h" -int otbTerraSarBrightnessFunctor(int argc, char * argv[]) +int otbTerraSarBrightnessFunctor(int itkNotUsed(argc), char * argv[]) { char * outFilename = argv[5]; double calFact = atof(argv[4]); diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageComplexFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbComplexToVectorImageCastFilter.h" -int otbTerraSarBrightnessImageComplexFilterTest(int argc, char * argv[]) +int otbTerraSarBrightnessImageComplexFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbTerraSarBrightnessImageFilter.h" #include "otbImage.h" -int otbTerraSarBrightnessImageFilterNew(int argc, char * argv[]) +int otbTerraSarBrightnessImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Image ImageType; typedef otb::Image, 2> ComplexImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbTerraSarBrightnessImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbTerraSarBrightnessImageFilterTest(int argc, char * argv[]) +int otbTerraSarBrightnessImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * inputFileName = argv[1]; const char * outputFileName = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx otb-4.2.0/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbTerraSarCalibrationImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbTerraSarCalibrationImageFilter.h" #include "otbImage.h" -int otbTerraSarCalibrationImageFilterNew(int argc, char * argv[]) +int otbTerraSarCalibrationImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::Image ImageType; typedef otb::Image, 2> ComplexImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" -int otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int otbTSARVIMultiChannelRAndBAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbTSARVIRAndBAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" -int otbTSARVIRAndBAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int otbTSARVIRAndBAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbWaterSqrtSpectralAngleImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileReader.h" #include "otbImageFileWriter.h" -int otbWaterSqrtSpectralAngleImageFilter(int argc, char * argv[]) +int otbWaterSqrtSpectralAngleImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" -int otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int otbWDVIMultiChannelRAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef otb::VectorImage InputImageType; diff -Nru otb-4.0.0/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx otb-4.2.0/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx --- otb-4.0.0/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Radiometry/otbWDVIRAndNIRVegetationIndexImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImageFileWriter.h" #include "otbVegetationIndicesFunctor.h" -int otbWDVIRAndNIRVegetationIndexImageFilter(int argc, char * argv[]) +int otbWDVIRAndNIRVegetationIndexImageFilter(int itkNotUsed(argc), char * argv[]) { const unsigned int Dimension = 2; typedef double PixelType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbSinclairToMuellerMatrixFunctor.h" -int otbMuellerToPolarisationDegreeAndPowerImageFilter(int argc, char * argv[]) +int otbMuellerToPolarisationDegreeAndPowerImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToPolarisationDegreeAndPowerImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorImage.h" #include "otbMuellerToPolarisationDegreeAndPowerImageFilter.h" -int otbMuellerToPolarisationDegreeAndPowerImageFilterNew(int argc, char * argv[]) +int otbMuellerToPolarisationDegreeAndPowerImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkVariableLengthVector.h" #include -int otbMuellerToReciprocalCovarianceFunctor(int argc, char * argv[]) +int otbMuellerToReciprocalCovarianceFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector VectorDoubleType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbMuellerToReciprocalCovarianceImageFilter.h" #include "otbExtractROI.h" -int otbMuellerToReciprocalCovarianceImageFilter(int argc, char * argv[]) +int otbMuellerToReciprocalCovarianceImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbMuellerToReciprocalCovarianceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorImage.h" #include "otbMuellerToReciprocalCovarianceImageFilter.h" -int otbMuellerToReciprocalCovarianceImageFilterNew(int argc, char * argv[]) +int otbMuellerToReciprocalCovarianceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbMultiChannelsPolarimetricSynthesisFilter.h" -int otbMultiChannelsPolarimetricSynthesisFilter(int argc, char * argv[]) +int otbMultiChannelsPolarimetricSynthesisFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbMultiChannelsPolarimetricSynthesisFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbVectorImage.h" #include "otbMultiChannelsPolarimetricSynthesisFilter.h" -int otbMultiChannelsPolarimetricSynthesisFilterNew(int argc, char * argv[]) +int otbMultiChannelsPolarimetricSynthesisFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef double InputPixelType; typedef double OutputPixelType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbPolarimetricData.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbPolarimetricData.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbPolarimetricData.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbPolarimetricData.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbPolarimetricData.h" -int otbPolarimetricDataNew(int argc, char * argv[]) +int otbPolarimetricDataNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { otb::PolarimetricData::Pointer data = otb::PolarimetricData::New(); @@ -30,7 +30,7 @@ -int otbPolarimetricDataTest(int argc, char * argv[]) +int otbPolarimetricDataTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { otb::PolarimetricData::Pointer data = otb::PolarimetricData::New(); diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbPolarimetricSynthesisFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "vcl_cmath.h" #include "otbPolarimetricSynthesisFunctor.h" -int otbPolarimetricSynthesisFunctor(int argc, char * argv[]) +int otbPolarimetricSynthesisFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbReciprocalCoherencyToReciprocalMuellerImageFilter.h" -int otbReciprocalCoherencyToReciprocalMuellerImageFilter(int argc, char * argv[]) +int otbReciprocalCoherencyToReciprocalMuellerImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCoherencyToReciprocalMuellerImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorImage.h" #include "otbReciprocalCoherencyToReciprocalMuellerImageFilter.h" -int otbReciprocalCoherencyToReciprocalMuellerImageFilterNew(int argc, char * argv[]) +int otbReciprocalCoherencyToReciprocalMuellerImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbReciprocalCovarianceToCoherencyDegreeImageFilter.h" -int otbReciprocalCovarianceToCoherencyDegreeImageFilter(int argc, char * argv[]) +int otbReciprocalCovarianceToCoherencyDegreeImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToCoherencyDegreeImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorImage.h" #include "otbReciprocalCovarianceToCoherencyDegreeImageFilter.h" -int otbReciprocalCovarianceToCoherencyDegreeImageFilterNew(int argc, char * argv[]) +int otbReciprocalCovarianceToCoherencyDegreeImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,17 +25,14 @@ #include "otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h" -int otbReciprocalCovarianceToReciprocalCoherencyImageFilter(int argc, char * argv[]) +int otbReciprocalCovarianceToReciprocalCoherencyImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; typedef double PixelType; typedef std::complex InputPixelType; - - typedef otb::VectorImage RealImageType; typedef otb::VectorImage ImageType; - typedef otb::ReciprocalCovarianceToReciprocalCoherencyImageFilter FilterType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalCovarianceToReciprocalCoherencyImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorImage.h" #include "otbReciprocalCovarianceToReciprocalCoherencyImageFilter.h" -int otbReciprocalCovarianceToReciprocalCoherencyImageFilterNew(int argc, char * argv[]) +int otbReciprocalCovarianceToReciprocalCoherencyImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileWriter.h" #include "otbReciprocalHAlphaImageFilter.h" -int otbReciprocalHAlphaImageFilter(int argc, char * argv[]) +int otbReciprocalHAlphaImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalHAlphaImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorImage.h" #include "otbReciprocalHAlphaImageFilter.h" -int otbReciprocalHAlphaImageFilterNew(int argc, char * argv[]) +int otbReciprocalHAlphaImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageFileWriter.h" #include "otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h" -int otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter(int argc, char * argv[]) +int otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilterNew.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilterNew.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbVectorImage.h" #include "otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilter.h" -int otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilterNew(int argc, char * argv[]) +int otbReciprocalLinearCovarianceToReciprocalCircularCovarianceImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ #include "otbMultiChannelExtractROI.h" -int otbSinclairImageFilterNew(int argc, char * argv[]) +int otbSinclairImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef otb::Image CplxImageType; @@ -50,7 +50,7 @@ template -int generic_SinclairImageFilter(int argc, char * argv[]) +int generic_SinclairImageFilter(int itkNotUsed(argc), char * argv[]) { const char * outputFilename = argv[4]; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairReciprocalImageFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairReciprocalImageFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairReciprocalImageFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairReciprocalImageFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ #include "otbMultiChannelExtractROI.h" -int otbSinclairReciprocalImageFilterNew(int argc, char * argv[]) +int otbSinclairReciprocalImageFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef otb::Image CplxImageType; @@ -48,7 +48,7 @@ template -int generic_SinclairReciprocalImageFilter(int argc, char * argv[]) +int generic_SinclairReciprocalImageFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename1 = argv[1]; const char * inputFilename2 = argv[2]; @@ -98,11 +98,9 @@ const unsigned int Dimension = 2; typedef std::complex InputPixelType; typedef std::complex OutputPixelType; - typedef double OutputRealPixelType; typedef otb::Image InputImageType; typedef otb::VectorImage OutputImageType; - typedef otb::VectorImage OutputRealImageType; std::string strArgv(argv[1]); argc--; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToCircularCovarianceMatrixFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToCircularCovarianceMatrixFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToCircularCovarianceMatrixFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToCircularCovarianceMatrixFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbSinclairToCircularCovarianceMatrixFunctor.h" #include "itkVariableLengthVector.h" -int otbSinclairToCircularCovarianceMatrixFunctor(int argc, char * argv[]) +int otbSinclairToCircularCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector OutputType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToCoherencyMatrixFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToCoherencyMatrixFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToCoherencyMatrixFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToCoherencyMatrixFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbSinclairToCoherencyMatrixFunctor.h" #include "itkVariableLengthVector.h" -int otbSinclairToCoherencyMatrixFunctor(int argc, char * argv[]) +int otbSinclairToCoherencyMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector OutputType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToCovarianceMatrixFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToCovarianceMatrixFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToCovarianceMatrixFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToCovarianceMatrixFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbSinclairToCovarianceMatrixFunctor.h" #include "itkVariableLengthVector.h" -int otbSinclairToCovarianceMatrixFunctor(int argc, char * argv[]) +int otbSinclairToCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector OutputType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToMuellerMatrixFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToMuellerMatrixFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToMuellerMatrixFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToMuellerMatrixFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbSinclairToMuellerMatrixFunctor.h" #include "itkVariableLengthVector.h" -int otbSinclairToMuellerMatrixFunctor(int argc, char * argv[]) +int otbSinclairToMuellerMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector OutputType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCircularCovarianceMatrixFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbSinclairToReciprocalCircularCovarianceMatrixFunctor.h" #include "itkVariableLengthVector.h" -int otbSinclairToReciprocalCircularCovarianceMatrixFunctor(int argc, char * argv[]) +int otbSinclairToReciprocalCircularCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector OutputType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCoherencyMatrixFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbSinclairToReciprocalCoherencyMatrixFunctor.h" #include "itkVariableLengthVector.h" -int otbSinclairToReciprocalCoherencyMatrixFunctor(int argc, char * argv[]) +int otbSinclairToReciprocalCoherencyMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector OutputType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbSinclairToReciprocalCovarianceMatrixFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbSinclairToReciprocalCovarianceMatrixFunctor.h" #include "itkVariableLengthVector.h" -int otbSinclairToReciprocalCovarianceMatrixFunctor(int argc, char * argv[]) +int otbSinclairToReciprocalCovarianceMatrixFunctor(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef std::complex ComplexType; typedef itk::VariableLengthVector OutputType; diff -Nru otb-4.0.0/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx otb-4.2.0/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx --- otb-4.0.0/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SARPolarimetry/otbVectorMultiChannelsPolarimetricSynthesisFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include "otbImageFileWriter.h" #include "otbMultiChannelsPolarimetricSynthesisFilter.h" -int otbVectorMultiChannelsPolarimetricSynthesisFilter(int argc, char * argv[]) +int otbVectorMultiChannelsPolarimetricSynthesisFilter(int itkNotUsed(argc), char * argv[]) { const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; @@ -43,7 +43,6 @@ typedef otb::Image OutputImageType; typedef otb::ImageFileReader ReaderType; typedef otb::ImageFileWriter WriterType; - typedef itk::FixedArray IndexArrayType; typedef otb::MultiChannelsPolarimetricSynthesisFilter FilterType; FilterType::Pointer polarimetricSynthesis = FilterType::New(); diff -Nru otb-4.0.0/Testing/Code/Segmentation/otbHooverInstanceFilterNew.cxx otb-4.2.0/Testing/Code/Segmentation/otbHooverInstanceFilterNew.cxx --- otb-4.0.0/Testing/Code/Segmentation/otbHooverInstanceFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Segmentation/otbHooverInstanceFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkLabelMap.h" #include "otbAttributesMapLabelObject.h" -int otbHooverInstanceFilterNew(int argc, char* argv[]) +int otbHooverInstanceFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; diff -Nru otb-4.0.0/Testing/Code/Segmentation/otbHooverMatrixFilterNew.cxx otb-4.2.0/Testing/Code/Segmentation/otbHooverMatrixFilterNew.cxx --- otb-4.0.0/Testing/Code/Segmentation/otbHooverMatrixFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Segmentation/otbHooverMatrixFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "itkLabelMap.h" #include "itkLabelObject.h" -int otbHooverMatrixFilterNew(int argc, char* argv[]) +int otbHooverMatrixFilterNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef itk::LabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; diff -Nru otb-4.0.0/Testing/Code/Segmentation/otbMeanShiftSegmentationFilter.cxx otb-4.2.0/Testing/Code/Segmentation/otbMeanShiftSegmentationFilter.cxx --- otb-4.0.0/Testing/Code/Segmentation/otbMeanShiftSegmentationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Segmentation/otbMeanShiftSegmentationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,6 @@ const unsigned int Dimension = 2; typedef float PixelType; - typedef double KernelType; typedef otb::VectorImage ImageType; typedef otb::Image LabelImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.cxx otb-4.2.0/Testing/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.cxx --- otb-4.0.0/Testing/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Segmentation/otbStreamingImageToOGRLayerSegmentationFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #include "otbOGRDataSourceWrapper.h" -int otbStreamingImageToOGRLayerSegmentationFilterNew(int argc, char * argv[]) +int otbStreamingImageToOGRLayerSegmentationFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef float InputPixelType; const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/Simulation/CMakeLists.txt otb-4.2.0/Testing/Code/Simulation/CMakeLists.txt --- otb-4.0.0/Testing/Code/Simulation/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -49,26 +49,81 @@ 2 #num band ) +add_test(siTuSatelliteRSRCheckValue ${Simulation_TESTS2} + otbSatelliteRSRCheckValue + ${INPUTDATA}/Radiometry/SPOT5/HRG2/rep6S.dat + 4 #nb band + 0.50 #lambda + 0 #num band + 0.557 #expected + ) + +add_test(siTuSatelliteRSRCheckValue2 ${Simulation_TESTS2} + otbSatelliteRSRCheckValue + ${INPUTDATA}/Radiometry/SPOT5/HRG2/rep6S.dat + 4 #nb band + 0.68 #lambda + 1 #num band + 0.717 #expected + ) + +add_test(siTuSatelliteRSRSolarIrradianceCheckValue ${Simulation_TESTS2} + otbSatelliteRSRSolarIrradianceCheckValue + ${INPUTDATA}/Radiometry/SPOT5/HRG2/rep6S.dat + 4 #nb band + 0.45 #lambda + 2.0573899e3 #expected + ) + +add_test(siTuSatelliteRSRSolarIrradianceCheckValue2 ${Simulation_TESTS2} + otbSatelliteRSRSolarIrradianceCheckValue + ${INPUTDATA}/Radiometry/SPOT5/HRG2/rep6S.dat + 4 #nb band + 1.7525000e+00 #lambda + 1.8526000e+02 #expected + ) + add_test(siTuReduceSpectralResponseNew ${Simulation_TESTS2} otbReduceSpectralResponseNew ) + +add_test(siTuReduceSpectralResponseSimpleValues ${Simulation_TESTS2} + otbReduceSpectralResponseSimpleValues + ${TEMP}/siTuReduceSpectralResponseSimpleValuesRSRLum.txt + 0 # reflectance mode + ) + +add_test(siTuReduceSpectralResponseSimpleValuesReflectance ${Simulation_TESTS2} + otbReduceSpectralResponseSimpleValues + ${TEMP}/siTuReduceSpectralResponseSimpleValuesRSRRefl.txt + 1 # reflectance mode + ) + add_test(siTuReduceSpectralResponse ${Simulation_TESTS2} otbReduceSpectralResponse ${SPECTRUM_DB}/jpl/beckman/minerals/Arsenate/txt/A01Ac.txt ${INPUTDATA}/Radiometry/SPOT5/HRG2/rep6S.dat 4 #nb band + 0 #reflectance mode ) -add_test(siTvReduceSpectralResponse ${Simulation_TESTS2} - --compare-ascii ${NOTOL} ${BASELINE_FILES}/Simulation/siTvReduceSpectralResponse.txt - ${TEMP}/siTvReduceSpectralResponse.txt +add_test(siTuReduceSpectralResponseReflectanceMode ${Simulation_TESTS2} + otbReduceSpectralResponse + ${SPECTRUM_DB}/jpl/beckman/minerals/Arsenate/txt/A01Ac.txt + ${INPUTDATA}/Radiometry/SPOT5/HRG2/rep6S.dat + 4 #nb band + 1 #reflectance mode + ) + +add_test(siTvReduceSpectralResponseReflectanceMode ${Simulation_TESTS2} otbReduceSpectralResponse ${INPUTDATA}/SpectralResponse1.txt ${INPUTDATA}/Radiometry/Test/rep6S.dat 4 #nb band - ${TEMP}/siTvReduceSpectralResponse.txt - ) + 1 #reflectance mode + ${TEMP}/siTvReduceSpectralResponseReflectanceMode.txt + ) add_test(siTuReduceSpectralResponseClassifierRAndNIR ${Simulation_TESTS2} otbReduceSpectralResponseClassifierRAndNIR diff -Nru otb-4.0.0/Testing/Code/Simulation/otbAtmosphericCorrectionsRSRSVMClassifier.cxx otb-4.2.0/Testing/Code/Simulation/otbAtmosphericCorrectionsRSRSVMClassifier.cxx --- otb-4.0.0/Testing/Code/Simulation/otbAtmosphericCorrectionsRSRSVMClassifier.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbAtmosphericCorrectionsRSRSVMClassifier.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,9 +45,24 @@ typedef otb::AtmosphericEffects AtmosphericEffectsType; - typedef AtmosphericEffectsType::AtmosphericCorrectionParametersType AtmosphericCorrectionParametersType; - typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; + /*typedef AtmosphericEffectsType::AtmosphericCorrectionParametersType AtmosphericCorrectionParametersType; chris typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; + typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; */ + + + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; + + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + typedef itk::VariableLengthVector SampleType; typedef itk::Statistics::ListSample SampleListType; @@ -109,15 +124,19 @@ float percentage = atof(argv[19]); //Instantiation - AtmosphericCorrectionParametersType::Pointer - dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); + /*AtmosphericCorrectionParametersType::Pointer chris + dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); */ + + AcquiCorrectionParametersPointerType paramAcqui = AcquiCorrectionParametersType::New(); + AtmoCorrectionParametersPointerType paramAtmo = AtmoCorrectionParametersType::New(); + SatRSRPointerType satRSR = SatRSRType::New(); satRSR->SetNbBands(nbBand); satRSR->Load(fileSatG); // Set parameters - dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(zenithSolarAngle); + /*dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(zenithSolarAngle); chris dataAtmosphericCorrectionParameters->SetSolarAzimutalAngle(azimutSolarAngle); dataAtmosphericCorrectionParameters->SetViewingZenithalAngle(viewingZenitalAngle); dataAtmosphericCorrectionParameters->SetViewingAzimutalAngle(viewingAzimutalAngle); @@ -129,7 +148,22 @@ AerosolModelType aerosolModel = static_cast (aerosolModelValue); dataAtmosphericCorrectionParameters->SetAerosolModel(aerosolModel); - dataAtmosphericCorrectionParameters->SetAerosolOptical(aerosolOptical); + dataAtmosphericCorrectionParameters->SetAerosolOptical(aerosolOptical); */ + + paramAcqui->SetSolarZenithalAngle(zenithSolarAngle); + paramAcqui->SetSolarAzimutalAngle(azimutSolarAngle); + paramAcqui->SetViewingZenithalAngle(viewingZenitalAngle); + paramAcqui->SetViewingAzimutalAngle(viewingAzimutalAngle); + paramAcqui->SetMonth(month); + paramAcqui->SetDay(day); + paramAtmo->SetAtmosphericPressure(atmoPressure); + paramAtmo->SetWaterVaporAmount(waterVaporAmount); + paramAtmo->SetOzoneAmount(ozoneAmount); + AerosolModelType aerosolModel = static_cast(aerosolModelValue); + paramAtmo->SetAerosolModel(aerosolModel); + paramAtmo->SetAerosolOptical(aerosolOptical); + + AtmosphericRadiativeTermsPointerType radiative = CorrectionParametersToRadiativeTermsType::Compute(paramAtmo,paramAcqui); //divide into training and testing files //90% of files are used for training and 10% for testing @@ -205,10 +239,10 @@ reduceSpectralResponse->SetInputSpectralResponse(spectralResponse); reduceSpectralResponse->CalculateResponse(); - atmosphericEffectsFilter->SetDataAtmosphericCorrectionParameters(dataAtmosphericCorrectionParameters); + atmosphericEffectsFilter->SetAtmosphericRadiativeTerms(radiative); atmosphericEffectsFilter->SetInputSatRSR(satRSR); atmosphericEffectsFilter->SetInputSpectralResponse(reduceSpectralResponse->GetReduceResponse()); - atmosphericEffectsFilter->Process6S(); + atmosphericEffectsFilter->Process(); //Get the response in an itk::VariableLengthVector and add it to the sample list for SVMModelEstimator SampleType sample; @@ -252,10 +286,10 @@ reduceSpectralResponse->SetInputSpectralResponse(spectralResponse); reduceSpectralResponse->CalculateResponse(); - atmosphericEffectsFilter->SetDataAtmosphericCorrectionParameters(dataAtmosphericCorrectionParameters); + atmosphericEffectsFilter->SetAtmosphericRadiativeTerms(radiative); atmosphericEffectsFilter->SetInputSatRSR(satRSR); atmosphericEffectsFilter->SetInputSpectralResponse(reduceSpectralResponse->GetReduceResponse()); - atmosphericEffectsFilter->Process6S(); + atmosphericEffectsFilter->Process(); //Get the response in an itk::VariableLengthVector and add it to the sample list for SVMClassifier SampleType sample; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbAtmosphericEffects.cxx otb-4.2.0/Testing/Code/Simulation/otbAtmosphericEffects.cxx --- otb-4.0.0/Testing/Code/Simulation/otbAtmosphericEffects.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbAtmosphericEffects.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,9 @@ #include "otbAtmosphericEffects.h" #include "otbReduceSpectralResponse.h" - +#include "otbAtmosphericCorrectionParameters.h" +#include "otbImageMetadataCorrectionParameters.h" +#include "otbAtmosphericRadiativeTerms.h" int otbAtmosphericEffects(int argc, char * argv[]) { @@ -36,10 +38,21 @@ typedef otb::AtmosphericEffects< SpectralResponseType, SatRSRType> AtmosphericEffectsType; - typedef AtmosphericEffectsType::AtmosphericCorrectionParametersType AtmosphericCorrectionParametersType; - typedef AtmosphericCorrectionParametersType::AerosolModelType AerosolModelType; + typedef otb::RadiometryCorrectionParametersToAtmosphericRadiativeTerms CorrectionParametersToRadiativeTermsType; + + typedef otb::AtmosphericCorrectionParameters AtmoCorrectionParametersType; + typedef AtmoCorrectionParametersType::Pointer AtmoCorrectionParametersPointerType; + + typedef AtmoCorrectionParametersType::AerosolModelType AerosolModelType; + + typedef otb::ImageMetadataCorrectionParameters AcquiCorrectionParametersType; + typedef AcquiCorrectionParametersType::Pointer AcquiCorrectionParametersPointerType; + typedef otb::AtmosphericRadiativeTerms AtmosphericRadiativeTermsType; + typedef AtmosphericRadiativeTermsType::Pointer AtmosphericRadiativeTermsPointerType; + + @@ -69,7 +82,11 @@ //Instantiation SpectralResponseType::Pointer spectrum = SpectralResponseType::New(); SatRSRType::Pointer satRSR=SatRSRType::New(); - AtmosphericCorrectionParametersType::Pointer dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); + //AtmosphericCorrectionParametersType::Pointer dataAtmosphericCorrectionParameters = AtmosphericCorrectionParametersType::New(); + + AcquiCorrectionParametersPointerType paramAcqui = AcquiCorrectionParametersType::New(); + AtmoCorrectionParametersPointerType paramAtmo = AtmoCorrectionParametersType::New(); + ReduceSpectralResponseType::Pointer reduceSpectralResponse = ReduceSpectralResponseType::New(); AtmosphericEffectsType::Pointer atmosphericEffectsFilter = AtmosphericEffectsType::New(); @@ -80,18 +97,20 @@ satRSR->Load(fileSatG); // Set parameters - dataAtmosphericCorrectionParameters->SetSolarZenithalAngle(zenithSolarAngle); - dataAtmosphericCorrectionParameters->SetSolarAzimutalAngle(azimutSolarAngle); - dataAtmosphericCorrectionParameters->SetViewingZenithalAngle(viewingZenitalAngle); - dataAtmosphericCorrectionParameters->SetViewingAzimutalAngle(viewingAzimutalAngle); - dataAtmosphericCorrectionParameters->SetMonth(month); - dataAtmosphericCorrectionParameters->SetDay(day); - dataAtmosphericCorrectionParameters->SetAtmosphericPressure(atmoPressure); - dataAtmosphericCorrectionParameters->SetWaterVaporAmount(waterVaporAmount); - dataAtmosphericCorrectionParameters->SetOzoneAmount(ozoneAmount); + paramAcqui->SetSolarZenithalAngle(zenithSolarAngle); + paramAcqui->SetSolarAzimutalAngle(azimutSolarAngle); + paramAcqui->SetViewingZenithalAngle(viewingZenitalAngle); + paramAcqui->SetViewingAzimutalAngle(viewingAzimutalAngle); + paramAcqui->SetMonth(month); + paramAcqui->SetDay(day); + paramAtmo->SetAtmosphericPressure(atmoPressure); + paramAtmo->SetWaterVaporAmount(waterVaporAmount); + paramAtmo->SetOzoneAmount(ozoneAmount); AerosolModelType aerosolModel = static_cast(aerosolModelValue); - dataAtmosphericCorrectionParameters->SetAerosolModel(aerosolModel); - dataAtmosphericCorrectionParameters->SetAerosolOptical(aerosolOptical); + paramAtmo->SetAerosolModel(aerosolModel); + paramAtmo->SetAerosolOptical(aerosolOptical); + + AtmosphericRadiativeTermsPointerType radiative = CorrectionParametersToRadiativeTermsType::Compute(paramAtmo,paramAcqui); //Compute Reduce Spectral Response @@ -99,10 +118,10 @@ reduceSpectralResponse->SetInputSpectralResponse(spectrum); reduceSpectralResponse->CalculateResponse(); - atmosphericEffectsFilter->SetDataAtmosphericCorrectionParameters(dataAtmosphericCorrectionParameters); + atmosphericEffectsFilter->SetAtmosphericRadiativeTerms(radiative); atmosphericEffectsFilter->SetInputSatRSR(satRSR); atmosphericEffectsFilter->SetInputSpectralResponse(reduceSpectralResponse->GetReduceResponse()); - atmosphericEffectsFilter->Process6S(); + atmosphericEffectsFilter->Process(); atmosphericEffectsFilter->GetCorrectedSpectralResponse(); diff -Nru otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodKMeansClassif.cxx otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodKMeansClassif.cxx --- otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodKMeansClassif.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodKMeansClassif.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ #include "otbKMeansImageClassificationFilter.h" #include "itkImageRegionIterator.h" -int otbImageSimulationMethodKMeansClassif(int argc, char * argv[]) +int otbImageSimulationMethodKMeansClassif(int itkNotUsed(argc), char * argv[]) { const char * satRSRFilename = argv[1]; unsigned int nbBands = static_cast(atoi(argv[2])); @@ -57,8 +57,6 @@ typedef otb::VectorData VectorDataType; typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; - typedef otb::VectorDataFileReader VectorDataFileReaderType; - typedef otb::SpatialisationFilter SpatialisationFilterType; typedef otb::ProspectModel SimulationStep1Type; typedef otb::SailModel SimulationStep2Type; @@ -73,8 +71,6 @@ typedef itk::Statistics::KdTreeBasedKmeansEstimator EstimatorType; typedef otb::KMeansImageClassificationFilter ClassificationFilterType; - typedef ClassificationFilterType::KMeansParametersType KMeansParametersType; - typedef itk::ImageRegionIterator ImageRegionIteratorType; @@ -198,5 +194,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodSVMClassif.cxx otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodSVMClassif.cxx --- otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodSVMClassif.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodSVMClassif.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ #include "otbSVMImageClassificationFilter.h" #include "otbImageFileReader.h" -int otbImageSimulationMethodSVMClassif(int argc, char * argv[]) +int otbImageSimulationMethodSVMClassif(int itkNotUsed(argc), char * argv[]) { const char * satRSRFilename = argv[1]; unsigned int nbBands = static_cast(atoi(argv[2])); diff -Nru otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodWithSpatialisationTest.cxx otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodWithSpatialisationTest.cxx --- otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodWithSpatialisationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodWithSpatialisationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbAttributesMapLabelObject.h" #include "otbImageFileReader.h" -int otbImageSimulationMethodWithSpatialisationTest(int argc, char * argv[]) +int otbImageSimulationMethodWithSpatialisationTest(int itkNotUsed(argc), char * argv[]) { const char * satRSRFilename = argv[1]; unsigned int nbBands = static_cast(atoi(argv[2])); diff -Nru otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodWithVectorDataTest.cxx otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodWithVectorDataTest.cxx --- otb-4.0.0/Testing/Code/Simulation/otbImageSimulationMethodWithVectorDataTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbImageSimulationMethodWithVectorDataTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "otbAttributesMapLabelObject.h" #include "otbImageFileReader.h" -int otbImageSimulationMethodWithVectorDataTest(int argc, char * argv[]) +int otbImageSimulationMethodWithVectorDataTest(int itkNotUsed(argc), char * argv[]) { const char * infilename = argv[1]; const char * satRSRFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbLabelMapToSimulatedImageFilterTest.cxx otb-4.2.0/Testing/Code/Simulation/otbLabelMapToSimulatedImageFilterTest.cxx --- otb-4.0.0/Testing/Code/Simulation/otbLabelMapToSimulatedImageFilterTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbLabelMapToSimulatedImageFilterTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbProspectModel.h" #include "otbSailModel.h" -int otbLabelMapToSimulatedImageFilterTest(int argc, char * argv[]) +int otbLabelMapToSimulatedImageFilterTest(int itkNotUsed(argc), char * argv[]) { const char * infilename = argv[1]; const char * satRSRFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbReduceSpectralResponseClassifierRAndNIR.cxx otb-4.2.0/Testing/Code/Simulation/otbReduceSpectralResponseClassifierRAndNIR.cxx --- otb-4.0.0/Testing/Code/Simulation/otbReduceSpectralResponseClassifierRAndNIR.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbReduceSpectralResponseClassifierRAndNIR.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,10 +39,8 @@ typedef otb::SpectralResponse< double, double> ResponseType; - typedef ResponseType::Pointer ResponsePointerType; typedef otb::SatelliteRSR< double, double> SatRSRType; - typedef SatRSRType::Pointer SatRSRPointerType; typedef otb::ReduceSpectralResponse < ResponseType, SatRSRType> ReduceResponseType; typedef ReduceResponseType::Pointer ReduceResponseTypePointerType; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbReduceSpectralResponse.cxx otb-4.2.0/Testing/Code/Simulation/otbReduceSpectralResponse.cxx --- otb-4.0.0/Testing/Code/Simulation/otbReduceSpectralResponse.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbReduceSpectralResponse.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,67 +22,193 @@ #include "otbSatelliteRSR.h" #include "otbReduceSpectralResponse.h" +typedef otb::SpectralResponse ResponseType; +typedef ResponseType::Pointer ResponsePointerType; +typedef ResponseType::VectorPairType SpectrumType; +typedef ResponseType::PairType PairType; +typedef otb::SatelliteRSR SatRSRType; +typedef SatRSRType::Pointer SatRSRPointerType; +typedef otb::ReduceSpectralResponse ReduceResponseType; +typedef ReduceResponseType::Pointer ReduceResponseTypePointerType; + int otbReduceSpectralResponse(int argc, char * argv[]) { - if ((argc != 4) && (argc != 5)) + if ((argc != 5) && (argc != 6)) { std::cout << argv[0] << std::endl << "\t" << ""; std::cout << "\t" << "" << "\t" << ""; - std::cout << "\t" << "()" << std::endl; + std::cout << "\t" << "" << "\t" << "()" << std::endl; return EXIT_FAILURE; } - typedef otb::SpectralResponse ResponseType; - typedef ResponseType::Pointer ResponsePointerType; - - typedef otb::SatelliteRSR SatRSRType; - typedef SatRSRType::Pointer SatRSRPointerType; - - typedef otb::ReduceSpectralResponse ReduceResponseType; - typedef ReduceResponseType::Pointer ReduceResponseTypePointerType; - const std::string spectreFile(argv[1]); const std::string RSRfile(argv[2]); unsigned int nbBand = atoi(argv[3]); - + bool reflectanceMode(atoi(argv[4])); //Instantiation ResponsePointerType mySpectralResponse = ResponseType::New(); /** Load the spectral response file*/ mySpectralResponse->Load(spectreFile, 100.0); - SatRSRPointerType myRSR = SatRSRType::New(); /** Set the satelite number of bands */ myRSR->SetNbBands(nbBand); /** Load the satelite response file*/ myRSR->Load(RSRfile); - - ReduceResponseTypePointerType myReduceResponse = ReduceResponseType::New(); //Instantiation - //ResponsePointerType myResponse=ResponseType::New(); + ReduceResponseTypePointerType myReduceResponse = ReduceResponseType::New(); /** Load the satelite response in the simulator */ myReduceResponse->SetInputSatRSR(myRSR); /** Load the spectral response of the object in the simulator*/ myReduceResponse->SetInputSpectralResponse(mySpectralResponse); - //Load file into vector - - /** Print the input spectral response*/ - //std::cout << mySpectralResponse << std::endl; - //itk::Indent ind; - /** Print the input Satelite RSR*/ - //std::cout << myRSR << std::endl; - //myResponse->PrintSelf(std::cout, ind); - /** Compute the RSR reduce spectral response*/ + /** Set the reflectance or luminance mode */ + myReduceResponse->SetReflectanceMode(reflectanceMode); myReduceResponse->CalculateResponse(); /** Print the Reduce SR*/ std::cout << myReduceResponse << std::endl; - if (argc == 5) + if (argc == 6) { - char * outputName = argv[4]; + char * outputName = argv[5]; std::ofstream outputFile(outputName, std::ios::out); - outputFile << myReduceResponse << std::endl; } else std::cout << myReduceResponse << std::endl; + return EXIT_SUCCESS; +} + +bool check_spectral_response(ResponsePointerType spectralResponse, + SpectrumType::const_iterator first, + SpectrumType::const_iterator last, + ResponseType::ValuePrecisionType tolerance) +{ + while( first != last ) + { + ResponseType::ValuePrecisionType expected = (*first).second; + ResponseType::ValuePrecisionType actual = (*spectralResponse)((*first).first); + if(fabs(expected - actual) > tolerance) return false; + ++first; + } + return true; +} + +int otbReduceSpectralResponseSimpleValues(int argc, char * argv[]) +{ + if (argc != 3) + { + std::cout << argv[0] << "\t "; + std::cout << "\t "; + std::cout << std::endl; + return EXIT_FAILURE; + } + + // let's create a spectral response + const ResponseType::PrecisionType lambdaMin(0.4); + const ResponseType::PrecisionType lambdaMax(1.4); + const ResponseType::PrecisionType lambdaStep(0.001); + ResponseType::PrecisionType currentLambda(lambdaMin); + SpectrumType spectrum; + while(currentLambda < lambdaMax) + { + PairType spectralValue; + spectralValue.first = currentLambda; + spectralValue.second = ResponseType::ValuePrecisionType(1.0); + spectrum.push_back(spectralValue); + currentLambda += lambdaStep; + } + ResponsePointerType spectralResponse = ResponseType::New(); + spectralResponse->SetResponse(spectrum); + // Check that the spectral response is OK + const ResponseType::ValuePrecisionType tolerance = 10e-6; + if(!check_spectral_response(spectralResponse, spectrum.begin(), + spectrum.end(), tolerance)) + { + std::cout << "Error detected in stored spectral response (without guess)" + << std::endl; + return EXIT_FAILURE; + } + spectralResponse->SetUsePosGuess(true); + if(!check_spectral_response(spectralResponse, spectrum.begin(), + spectrum.end(), tolerance)) + { + std::cout << "Error detected in stored spectral response (with guess)" + << std::endl; + return EXIT_FAILURE; + } + + // Let's create a satellite RSR with 2 bands and constant solar irradiance per band + // Disjoint bands and B0 is shorter wavelength than B1 for simplicity + const std::string RSRfileName(argv[1]); + std::ofstream satFile(RSRfileName.c_str()); + const ResponseType::PrecisionType lambdaMinB0(0.45); + const ResponseType::PrecisionType lambdaMaxB0(0.65); + const ResponseType::PrecisionType lambdaMinB1(0.75); + const ResponseType::PrecisionType lambdaMaxB1(0.85); + const ResponseType::ValuePrecisionType rsrValueB0(0.5); + const ResponseType::ValuePrecisionType rsrValueB1(1.0); + const ResponseType::ValuePrecisionType solarIrradianceB0(2.0); + const ResponseType::ValuePrecisionType solarIrradianceB1(4.0); + currentLambda = lambdaMin; + while(currentLambda < lambdaMax) + { + ResponseType::ValuePrecisionType solarIrradiance(0); + ResponseType::ValuePrecisionType rsrB0(0); + ResponseType::ValuePrecisionType rsrB1(0); + // B0 + if(currentLambda >= lambdaMinB0 && currentLambda <= lambdaMaxB0) + { + solarIrradiance = solarIrradianceB0; + rsrB0 = rsrValueB0; + } + // B1 + if(currentLambda >= lambdaMinB1 && currentLambda <= lambdaMaxB1) + { + solarIrradiance = solarIrradianceB1; + rsrB1 = rsrValueB1; + } + satFile.setf( std::ios::fixed, std:: ios::floatfield ); + satFile.precision(4); + satFile << currentLambda << "\t" + << solarIrradiance << "\t" + << rsrB0 << "\t" + << rsrB1 << "\t" << std::endl; + currentLambda += lambdaStep; + } + satFile.close(); + + SatRSRPointerType myRSR = SatRSRType::New(); + myRSR->SetNbBands(2); + myRSR->Load(RSRfileName); + + ReduceResponseTypePointerType myReduceResponse = ReduceResponseType::New(); + myReduceResponse->SetInputSatRSR(myRSR); + myReduceResponse->SetInputSpectralResponse(spectralResponse); + myReduceResponse->SetReflectanceMode(static_cast(atoi(argv[2]))); + myReduceResponse->CalculateResponse(); + + //check B0 + ResponseType::ValuePrecisionType b0Result = (*myReduceResponse)(0); + ResponseType::PrecisionType centralLambda = 0.5*(lambdaMaxB0+lambdaMinB0); + ResponseType::ValuePrecisionType b0Expected = ((*spectralResponse)(centralLambda)); + + if(fabs(b0Result-b0Expected)>tolerance) + { + std::cout << "Wrong value for B0: expected eq. luminance = " << b0Expected + << "; got " << b0Result + << std::endl; + return EXIT_FAILURE; + } + + //check B1 + ResponseType::ValuePrecisionType b1Result = (*myReduceResponse)(1); + centralLambda = 0.5*(lambdaMaxB1+lambdaMinB1); + ResponseType::ValuePrecisionType b1Expected = ((*spectralResponse)(centralLambda)); + + if(fabs(b1Result-b1Expected)>tolerance) + { + std::cout << "Wrong value for B1: expected eq. luminance = " << b1Expected + << "; got " << b1Result + << std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } diff -Nru otb-4.0.0/Testing/Code/Simulation/otbReduceSpectralResponseNew.cxx otb-4.2.0/Testing/Code/Simulation/otbReduceSpectralResponseNew.cxx --- otb-4.0.0/Testing/Code/Simulation/otbReduceSpectralResponseNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbReduceSpectralResponseNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbSatelliteRSR.h" #include "otbReduceSpectralResponse.h" -int otbReduceSpectralResponseNew(int argc, char * argv[]) +int otbReduceSpectralResponseNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::SpectralResponse< double, double> ResponseType; //typedef ResponseType::Pointer ResponsePointerType; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbSatelliteRSR.cxx otb-4.2.0/Testing/Code/Simulation/otbSatelliteRSR.cxx --- otb-4.0.0/Testing/Code/Simulation/otbSatelliteRSR.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbSatelliteRSR.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -51,3 +51,69 @@ return EXIT_SUCCESS; } + +int otbSatelliteRSRCheckValue(int argc, char * argv[]) +{ + typedef otb::SatelliteRSR< double, double> ResponseType; + typedef ResponseType::Pointer ResponsePointerType; + + if ( argc!=6 ) + { + std::cout << argv[0] << std::endl << "\t" << ""<< "\t" << ""<< "\t" + << ""<< "\t" << ""<< "\t" << "" << std::endl; + return EXIT_FAILURE; + } + //Instantiation + ResponsePointerType myResponse=ResponseType::New(); + + myResponse->SetNbBands(atoi(argv[2])); + //Load file into vector + const std::string file(argv[1]); + myResponse->Load(file); + //itk::Indent ind; + unsigned int NumBand = atoi(argv[4]); + double lambda = atof(argv[3]); + double expected = atof(argv[5]); + + double rsr_value = (*myResponse)(lambda, NumBand); + + std::cout << "RSR("<"<< "\t" << ""<< "\t" + << ""<< "\t" << "\t" << "" << std::endl; + return EXIT_FAILURE; + } + //Instantiation + ResponsePointerType myResponse=ResponseType::New(); + + myResponse->SetNbBands(atoi(argv[2])); + //Load file into vector + const std::string file(argv[1]); + myResponse->Load(file); + //itk::Indent ind; + double lambda = atof(argv[3]); + double expected = atof(argv[4]); + + double solar_irradiance = (*(myResponse->GetSolarIrradiance()))(lambda); + + std::cout << "SolarIrradiance("< ResponseType; typedef ResponseType::Pointer ResponsePointerType; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbSimulationTests2.cxx otb-4.2.0/Testing/Code/Simulation/otbSimulationTests2.cxx --- otb-4.0.0/Testing/Code/Simulation/otbSimulationTests2.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbSimulationTests2.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,11 @@ REGISTER_TEST(otbSpectralResponse); REGISTER_TEST(otbSatelliteRSRNew); REGISTER_TEST(otbSatelliteRSR); + REGISTER_TEST(otbSatelliteRSRCheckValue); + REGISTER_TEST(otbSatelliteRSRSolarIrradianceCheckValue); REGISTER_TEST(otbReduceSpectralResponseNew); REGISTER_TEST(otbReduceSpectralResponse); + REGISTER_TEST(otbReduceSpectralResponseSimpleValues); REGISTER_TEST(otbReduceSpectralResponseClassifierRAndNIR); REGISTER_TEST(otbAtmosphericEffects); REGISTER_TEST(otbSpatialisationTestNew); diff -Nru otb-4.0.0/Testing/Code/Simulation/otbSpatialisationTest.cxx otb-4.2.0/Testing/Code/Simulation/otbSpatialisationTest.cxx --- otb-4.0.0/Testing/Code/Simulation/otbSpatialisationTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbSpatialisationTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbImage.h" #include "otbAttributesMapLabelObject.h" -int otbSpatialisationTest(int argc, char * argv[]) +int otbSpatialisationTest(int itkNotUsed(argc), char * argv[]) { const char * outfilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbSpatialisationTestNew.cxx otb-4.2.0/Testing/Code/Simulation/otbSpatialisationTestNew.cxx --- otb-4.0.0/Testing/Code/Simulation/otbSpatialisationTestNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbSpatialisationTestNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,11 +23,10 @@ #include "otbImage.h" #include "otbAttributesMapLabelObject.h" -int otbSpatialisationTestNew(int argc, char * argv[]) +int otbSpatialisationTestNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef unsigned short LabelType; const unsigned int Dimension = 2; - typedef otb::Image ImageType; typedef otb::AttributesMapLabelObject LabelObjectType; typedef itk::LabelMap LabelMapType; typedef otb::SpatialisationFilter FilterType; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbSpectralResponseNew.cxx otb-4.2.0/Testing/Code/Simulation/otbSpectralResponseNew.cxx --- otb-4.0.0/Testing/Code/Simulation/otbSpectralResponseNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbSpectralResponseNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbSpectralResponse.h" -int otbSpectralResponseNew(int argc, char * argv[]) +int otbSpectralResponseNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { typedef otb::SpectralResponse< double, double> ResponseType; typedef ResponseType::Pointer ResponsePointerType; diff -Nru otb-4.0.0/Testing/Code/Simulation/otbSurfaceReflectanceToReflectanceFilterNew.cxx otb-4.2.0/Testing/Code/Simulation/otbSurfaceReflectanceToReflectanceFilterNew.cxx --- otb-4.0.0/Testing/Code/Simulation/otbSurfaceReflectanceToReflectanceFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Simulation/otbSurfaceReflectanceToReflectanceFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbSurfaceReflectanceToReflectanceFilter.h" #include "otbAtmosphericRadiativeTerms.h" -int otbSurfaceReflectanceToReflectanceFilterNew(int argc, char * argv[]) +int otbSurfaceReflectanceToReflectanceFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { const unsigned int Dimension = 2; typedef double PixelType; @@ -51,7 +51,7 @@ typedef double PixelType; typedef otb::VectorImage ImageType; - typedef itk::ImageRegionIterator< ImageType > IteratorType; +// typedef itk::ImageRegionIterator< ImageType > IteratorType; //typedef ResponseType::PairType PairType; //typedef otb::ObjectList< PairType > PairListType; // PairListType::Pointer pairList = PairListType::New(); diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbImageListToRCC8GraphFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageListToRCC8GraphFilter.h" #include "otbPolygon.h" -int otbImageListToRCC8GraphFilterNew(int argc, char* argv[]) +int otbImageListToRCC8GraphFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned short LabelPixelType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "otbImageFileReader.h" #include "otbRCC8GraphFileWriter.h" -int otbImageMultiSegmentationToRCC8GraphFilter(int argc, char* argv[]) +int otbImageMultiSegmentationToRCC8GraphFilter(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; char * outputFilename = argv[1]; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbImageMultiSegmentationToRCC8GraphFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbPolygon.h" #include "otbImageMultiSegmentationToRCC8GraphFilter.h" -int otbImageMultiSegmentationToRCC8GraphFilterNew(int argc, char* argv[]) +int otbImageMultiSegmentationToRCC8GraphFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int Dimension = 2; typedef unsigned short LabelPixelType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8Calculator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbImageList.h" #include "otbImageFileReader.h" -int otbImageToImageRCC8Calculator(int argc, char* argv[]) +int otbImageToImageRCC8Calculator(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8CalculatorNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8CalculatorNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8CalculatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbImageToImageRCC8CalculatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbImageToImageRCC8Calculator.h" #include "otbImage.h" -int otbImageToImageRCC8CalculatorNew(int argc, char* argv[]) +int otbImageToImageRCC8CalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // const unsigned int Dimension = 2; // typedef unsigned char PixelType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -42,10 +42,8 @@ } -int otbPolygonListToRCC8GraphFilter(int argc, char* argv[]) +int otbPolygonListToRCC8GraphFilter(int itkNotUsed(argc), char* argv[]) { - const unsigned int Dimension = 2; - char * outfile = argv[1]; PolygonListType::Pointer regions = PolygonListType::New(); diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonListToRCC8GraphFilterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbRCC8VertexBase.h" #include "otbPolygonListToRCC8GraphFilter.h" -int otbPolygonListToRCC8GraphFilterNew(int argc, char* argv[]) +int otbPolygonListToRCC8GraphFilterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { // typedefs typedef otb::Polygon<> PolygonType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8Calculator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbImageToEdgePathFilter.h" #include "otbSimplifyPathListFilter.h" -int otbPolygonToPolygonRCC8Calculator(int argc, char* argv[]) +int otbPolygonToPolygonRCC8Calculator(int itkNotUsed(argc), char* argv[]) { const unsigned int Dimension = 2; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbPolygonToPolygonRCC8CalculatorNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbPolygonToPolygonRCC8Calculator.h" #include "otbPolygon.h" -int otbPolygonToPolygonRCC8CalculatorNew(int argc, char* argv[]) +int otbPolygonToPolygonRCC8CalculatorNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon<> PolygonType; typedef otb::PolygonToPolygonRCC8Calculator CalculatorType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8Edge.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbRCC8Edge.h" #include -int otbRCC8Edge(int argc, char* argv[]) +int otbRCC8Edge(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::RCC8Edge RCC8EdgeType; typedef RCC8EdgeType::RCC8ValueType RCC8ValueType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8EdgeNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbRCC8Edge.h" #include -int otbRCC8EdgeNew(int argc, char* argv[]) +int otbRCC8EdgeNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::RCC8Edge RCC8EdgeType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8Graph.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,18 +25,15 @@ #include "otbMacro.h" #include "otbPolygon.h" -int otbRCC8Graph(int argc, char* argv[]) +int otbRCC8Graph(int itkNotUsed(argc), char * itkNotUsed(argv) []) { const unsigned int nbVertices = 2; typedef otb::Polygon<> PathType; typedef PathType::VertexType PointType; typedef otb::RCC8VertexBase VertexType; typedef otb::RCC8Graph RCC8GraphType; - typedef RCC8GraphType::EdgeType EdgeType; typedef otb::RCC8VertexIterator VertexIteratorType; typedef otb::RCC8EdgeIterator EdgeIteratorType; - typedef otb::RCC8InEdgeIterator InEdgeIteratorType; - typedef otb::RCC8OutEdgeIterator OutEdgeIteratorType; // Instantiation RCC8GraphType::Pointer rcc8Graph = RCC8GraphType::New(); diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReader.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ #include "otbMacro.h" #include "otbPolygon.h" -int otbRCC8GraphFileReader(int argc, char* argv[]) +int otbRCC8GraphFileReader(int itkNotUsed(argc), char* argv[]) { char * inputFilename = argv[1]; typedef otb::Polygon<> PathType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileReaderNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbRCC8GraphFileReader.h" #include "otbPolygon.h" -int otbRCC8GraphFileReaderNew(int argc, char* argv[]) +int otbRCC8GraphFileReaderNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon<> PathType; typedef otb::RCC8VertexBase VertexType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbRCC8GraphFileWriter.h" #include "otbPolygon.h" -int otbRCC8GraphFileWriter(int argc, char* argv[]) +int otbRCC8GraphFileWriter(int itkNotUsed(argc), char* argv[]) { const char * outputFile = argv[1]; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphFileWriterNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbRCC8GraphFileWriter.h" #include "otbPolygon.h" -int otbRCC8GraphFileWriterNew(int argc, char* argv[]) +int otbRCC8GraphFileWriterNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon<> PathType; typedef otb::RCC8VertexBase VertexType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphIOEndToEnd.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbRCC8GraphFileWriter.h" #include "otbPolygon.h" -int otbRCC8GraphIOEndToEnd(int argc, char* argv[]) +int otbRCC8GraphIOEndToEnd(int itkNotUsed(argc), char* argv[]) { char * inputFilename = argv[1]; char * outputFilename = argv[2]; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbRCC8VertexBase.h" #include "otbPolygon.h" -int otbRCC8GraphNew(int argc, char* argv[]) +int otbRCC8GraphNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon<> PathType; typedef otb::RCC8VertexBase VertexType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8GraphSourceNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ #include "otbRCC8VertexBase.h" #include "otbPolygon.h" -int otbRCC8GraphSourceNew(int argc, char* argv[]) +int otbRCC8GraphSourceNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon<> PathType; typedef otb::RCC8VertexBase VertexType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbPolygon.h" #include "otbMacro.h" -int otbRCC8VertexBase(int argc, char* argv[]) +int otbRCC8VertexBase(int itkNotUsed(argc), char* argv[]) { typedef otb::Polygon<> PathType; unsigned int imageLevel = atoi(argv[1]); diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexBaseNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbRCC8VertexBase.h" #include "otbPolygon.h" -int otbRCC8VertexBaseNew(int argc, char* argv[]) +int otbRCC8VertexBaseNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon<> PathType; typedef otb::RCC8VertexBase RCC8VertexType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacity.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "otbMacro.h" #include "otbPolygon.h" -int otbRCC8VertexWithCompacity(int argc, char* argv[]) +int otbRCC8VertexWithCompacity(int itkNotUsed(argc), char* argv[]) { typedef otb::Polygon<> PathType; typedef double PrecisionType; diff -Nru otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx --- otb-4.0.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/SpatialReasoning/otbRCC8VertexWithCompacityNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ #include "otbRCC8VertexWithCompacity.h" #include "otbPolygon.h" -int otbRCC8VertexWithCompacityNew(int argc, char* argv[]) +int otbRCC8VertexWithCompacityNew(int itkNotUsed(argc), char * itkNotUsed(argv) []) { typedef otb::Polygon<> PathType; typedef float PrecisionType; diff -Nru otb-4.0.0/Testing/Code/TestSystem/otbCompareAsciiTestsEpsilon3_WhiteSpace.cxx otb-4.2.0/Testing/Code/TestSystem/otbCompareAsciiTestsEpsilon3_WhiteSpace.cxx --- otb-4.0.0/Testing/Code/TestSystem/otbCompareAsciiTestsEpsilon3_WhiteSpace.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/TestSystem/otbCompareAsciiTestsEpsilon3_WhiteSpace.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbMacro.h" -int otbCompareAsciiTestsEpsilon3_WhiteSpace(int argc, char * argv[]) +int otbCompareAsciiTestsEpsilon3_WhiteSpace(int itkNotUsed(argc), char * argv[]) { std::cout << "ASCII COMPARISON TEST: it will use directly the baseline and input files in OTB-Data " "to avoid problem with otb-bot." << std::endl; @@ -34,7 +34,7 @@ // Transfer to temporary object std::string strFileTest; std::vector listLineFileTest; - while (std::getline(fileTestInput, strFileTest) != 0) + while (std::getline(fileTestInput, strFileTest)) { listLineFileTest.push_back(strFileTest); } diff -Nru otb-4.0.0/Testing/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapperNew.cxx otb-4.2.0/Testing/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapperNew.cxx --- otb-4.0.0/Testing/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapperNew.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/UtilitiesAdapters/OGRAdapters/otbOGRDataSourceWrapperNew.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -603,7 +603,7 @@ ogr::Layer l = ds -> CreateLayer(layer1, 0, wkbPoint); BOOST_CHECK_EQUAL(l.GetFeatureCount(true), 0); - OGRFeatureDefn & defn = l.GetLayerDefn(); +// OGRFeatureDefn & defn = l.GetLayerDefn(); l.CreateField(k_f0); l.CreateField(k_f1); diff -Nru otb-4.0.0/Testing/Code/UtilitiesAdapters/otbGeometricSarSensorModelAdapter.cxx otb-4.2.0/Testing/Code/UtilitiesAdapters/otbGeometricSarSensorModelAdapter.cxx --- otb-4.0.0/Testing/Code/UtilitiesAdapters/otbGeometricSarSensorModelAdapter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/UtilitiesAdapters/otbGeometricSarSensorModelAdapter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbGeometricSarSensorModelAdapter.h" -int otbGeometricSarSensorModelAdapterNewTest(int argc, char* argv[]) +int otbGeometricSarSensorModelAdapterNewTest(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef otb::GeometricSarSensorModelAdapter SarSensorModelType; SarSensorModelType::Pointer masterPlatform = SarSensorModelType::New(); diff -Nru otb-4.0.0/Testing/Code/UtilitiesAdapters/otbPlatformPositionAdapter.cxx otb-4.2.0/Testing/Code/UtilitiesAdapters/otbPlatformPositionAdapter.cxx --- otb-4.0.0/Testing/Code/UtilitiesAdapters/otbPlatformPositionAdapter.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/UtilitiesAdapters/otbPlatformPositionAdapter.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbImageFileReader.h" #include "otbPlatformPositionAdapter.h" -int otbPlatformPositionComputeBaselineNewTest(int argc, char* argv[]) +int otbPlatformPositionComputeBaselineNewTest(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef otb::PlatformPositionAdapter PlatformType; PlatformType::Pointer masterPlatform = PlatformType::New(); diff -Nru otb-4.0.0/Testing/Code/Wrappers/CommandLine/CMakeLists.txt otb-4.2.0/Testing/Code/Wrappers/CommandLine/CMakeLists.txt --- otb-4.0.0/Testing/Code/Wrappers/CommandLine/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Wrappers/CommandLine/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -14,28 +14,28 @@ add_test(NAME clTvWrapperCommandLineParserTest_GetAtt COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest1 "-key" - "this is a line test to extract -key name1 name2" ) + "this" "is" "a" "line" "test" "to" "extract" "-key" "name1" "name2" ) add_test(NAME clTvWrapperCommandLineParserTest_IsAttExists_Wrong COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest3 "-m" - " TrainImagesClassifier test -il QB_1_ortho.tif -vd vd .shape " ) + "TrainImagesClassifier" "test" "-il" "QB_1_ortho.tif" "-vd" "vd" ".shape" ) add_test(NAME clTvWrapperCommandLineParserTest_IsAttExists COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest4 "-m" - " TrainImagesClassifier test -il QB_1_ortho.tif -vd vd .shape -m name") + "TrainImagesClassifier" "test" "-il" "QB_1_ortho.tif" "-vd" "vd" ".shape" "-m" "name") add_test(NAME clTvWrapperCommandLineParserTest_IsAttExistsEnd COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest4 "-m" - " TrainImagesClassifier test -il QB_1_ortho.tif -vd vd .shape -m name") + "TrainImagesClassifier" "test" "-il" "QB_1_ortho.tif" "-vd" "vd" ".shape" "-m" "name") add_test(NAME clTvWrapperCommandLineParserTest_IsAttExistsEndNoParam COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest4 "-m" - " TrainImagesClassifier test -il QB_1_ortho.tif -vd vd .shape test -m") + "TrainImagesClassifier" "test" "-il" "QB_1_ortho.tif" "-vd" "vd" ".shape" "test" "-m") add_test(NAME clTvWrapperCommandLineParserTest_GetAttWithoutValue COMMAND ${OTB_WRAPPER_COMMAND_LINE_TESTS} otbWrapperCommandLineParserTest1 diff -Nru otb-4.0.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncherTests.cxx otb-4.2.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncherTests.cxx --- otb-4.0.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncherTests.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineLauncherTests.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ #include "otbWrapperCommandLineLauncher.h" -int otbWrapperCommandLineLauncherNew(int argc, char* argv[]) +int otbWrapperCommandLineLauncherNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { typedef otb::Wrapper::CommandLineLauncher LauncherType; LauncherType::Pointer launcher = LauncherType::New(); @@ -38,17 +38,16 @@ typedef otb::Wrapper::CommandLineLauncher LauncherType; LauncherType::Pointer launcher = LauncherType::New(); - std::ostringstream input; + std::vector cmdVector; if (argc > 2) { - input << argv[1]; - for (int i = 2; i < argc; i++) + for (int i = 1; i < argc; i++) { - input << " " << argv[i]; + cmdVector.push_back(std::string(argv[i])); } } - if (launcher->Load(input.str()) == true) + if (launcher->Load(cmdVector) == true) { if (launcher->ExecuteAndWriteOutput() == false) { @@ -62,5 +61,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx otb-4.2.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx --- otb-4.0.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Code/Wrappers/CommandLine/otbWrapperCommandLineParserTests.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ typedef otb::Wrapper::CommandLineParser ParserType; -int otbWrapperCommandLineParserNew(int argc, char* argv[]) +int otbWrapperCommandLineParserNew(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { ParserType::Pointer parser = ParserType::New(); @@ -72,8 +72,13 @@ int otbWrapperCommandLineParserTest1(int argc, char* argv[]) { ParserType::Pointer parser = ParserType::New(); + std::vector cmdVector; + for (int i=2; i res = parser->GetAttribut( argv[1], argv[2] ); + std::vector res = parser->GetAttribut( argv[1], cmdVector ); if( res.size() == 0 ) { @@ -89,18 +94,17 @@ std::cout << "Search for paths..." << std::endl; - std::ostringstream input; + std::vector cmdVector; if (argc > 2) { - input << argv[1]; - for (int i = 2; i < argc; i++) + for (int i=1; i paths; - ParserType::ParseResultType res = parser->GetPaths(paths, input.str()); + ParserType::ParseResultType res = parser->GetPaths(paths, cmdVector); if (CheckReturn(res) != ParserType::OK) { std::cout << "Can't find paths." << std::endl; @@ -111,7 +115,7 @@ std::cout << "Search for module name..." << std::endl; std::string name; - res = parser->GetModuleName(name, argv[1]); + res = parser->GetModuleName(name, cmdVector); if (CheckReturn(res) != ParserType::OK) { @@ -126,8 +130,16 @@ int otbWrapperCommandLineParserTest3(int argc, char* argv[]) { ParserType::Pointer parser = ParserType::New(); + std::vector cmdVector; + if (argc > 2) + { + for (int i=2; iIsAttributExists(argv[1], argv[2])) + if (parser->IsAttributExists(argv[1], cmdVector)) { return EXIT_FAILURE; } @@ -138,11 +150,18 @@ int otbWrapperCommandLineParserTest4(int argc, char* argv[]) { ParserType::Pointer parser = ParserType::New(); + std::vector cmdVector; + if (argc > 2) + { + for (int i=2; iIsAttributExists(argv[1], argv[2])) + if (parser->IsAttributExists(argv[1], cmdVector)) { return EXIT_SUCCESS; } return EXIT_FAILURE; } - diff -Nru otb-4.0.0/Testing/Fa/0000094-PolygonsVectorization.cxx otb-4.2.0/Testing/Fa/0000094-PolygonsVectorization.cxx --- otb-4.0.0/Testing/Fa/0000094-PolygonsVectorization.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/0000094-PolygonsVectorization.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,25 +50,19 @@ int main(int argc, char * argv[]) { - typedef unsigned char PixelType; typedef unsigned long LabelPixelType; typedef unsigned char PixelTypeOutput; - typedef otb::Image SingleImageType; typedef otb::Image LabeledImageType; typedef otb::Image OutputImageType; - typedef itk::ImageRegionIterator IteratorType; - typedef otb::Polygon PolygonType; - typedef PolygonType::Pointer PolygonPointerType; - typedef PolygonType::ContinuousIndexType PolygonIndexType; typedef otb::ObjectList PolygonListType; typedef PolygonListType::Pointer PolygonListPointerType; typedef itk::ImageRegion<2> ImageRegionType; typedef otb::PersistentVectorizationImageFilter PersistentVectorizationFilterType; - typedef itk::RelabelComponentImageFilter RelabelFilterType; + typedef itk::ConnectedComponentImageFilter ConnectedFilterType; typedef itk::RescaleIntensityImageFilter RescalerType; /* diff -Nru otb-4.0.0/Testing/Fa/0000307-ExtractROICompareRegionsImplementations.cxx otb-4.2.0/Testing/Fa/0000307-ExtractROICompareRegionsImplementations.cxx --- otb-4.0.0/Testing/Fa/0000307-ExtractROICompareRegionsImplementations.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/0000307-ExtractROICompareRegionsImplementations.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,7 @@ return im; } -int otbITKExtractImageFilterROITestRegion(int argc, char * argv[]) +int otbITKExtractImageFilterROITestRegion(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { ImageType::Pointer in; RegionType extractionRegion; @@ -140,7 +140,7 @@ } -int otbITKVectorIndexSelectionCastTestRegion(int argc, char * argv[]) +int otbITKVectorIndexSelectionCastTestRegion(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { VectorImageType::Pointer in; RegionType extractionRegion; @@ -180,7 +180,7 @@ } -int otbMultiToMonoChannelExtractROITestRegion(int argc, char * argv[]) +int otbMultiToMonoChannelExtractROITestRegion(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { VectorImageType::Pointer in; RegionType extractionRegion; @@ -233,7 +233,7 @@ -int otbMultiChannelExtractROITestRegion(int argc, char * argv[]) +int otbMultiChannelExtractROITestRegion(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { VectorImageType::Pointer in; RegionType extractionRegion; @@ -285,7 +285,7 @@ } -int otbExtractROITestRegion(int argc, char * argv[]) +int otbExtractROITestRegion(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { ImageType::Pointer in; RegionType extractionRegion; @@ -415,4 +415,3 @@ return finalResult; } - diff -Nru otb-4.0.0/Testing/Fa/0000433-LineSegmentDetector_8b_16b_compare.cxx otb-4.2.0/Testing/Fa/0000433-LineSegmentDetector_8b_16b_compare.cxx --- otb-4.0.0/Testing/Fa/0000433-LineSegmentDetector_8b_16b_compare.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/0000433-LineSegmentDetector_8b_16b_compare.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,14 +45,10 @@ typedef otb::Image ImageType8; typedef otb::ImageFileReader ReaderType8; typedef otb::LineSegmentDetector LSDFilterType8; - typedef otb::ImageFileWriter WriterType8; - typedef unsigned short PixelType16; typedef otb::Image ImageType16; typedef otb::ImageFileReader ReaderType16; typedef otb::LineSegmentDetector LSDFilterType16; - typedef otb::ImageFileWriter WriterType16; - typedef LSDFilterType8::VectorDataType VectorDataType; typedef otb::VectorDataFileWriter VectorDataWriterType; diff -Nru otb-4.0.0/Testing/Fa/0000479-WriteInt8Image.cxx otb-4.2.0/Testing/Fa/0000479-WriteInt8Image.cxx --- otb-4.0.0/Testing/Fa/0000479-WriteInt8Image.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/0000479-WriteInt8Image.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ #include "itkImageRegionIterator.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { typedef char PixelType; diff -Nru otb-4.0.0/Testing/Fa/000295-MeanShiftVectorImageFilterWithStreamingShrink.cxx otb-4.2.0/Testing/Fa/000295-MeanShiftVectorImageFilterWithStreamingShrink.cxx --- otb-4.0.0/Testing/Fa/000295-MeanShiftVectorImageFilterWithStreamingShrink.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/000295-MeanShiftVectorImageFilterWithStreamingShrink.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "otbStreamingShrinkImageFilter.h" -int main(int argc, char * argv[]) +int main(int itkNotUsed(argc), char * argv[]) { const char * infname = argv[1]; const unsigned int spatialRadius = atoi(argv[2]); diff -Nru otb-4.0.0/Testing/Fa/00134-feature_extraction.cxx otb-4.2.0/Testing/Fa/00134-feature_extraction.cxx --- otb-4.0.0/Testing/Fa/00134-feature_extraction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/00134-feature_extraction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ #include "otbMultiChannelRAndNIRIndexImageFilter.h" #include "otbVegetationIndicesFunctor.h" -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { const char * inputName = argv[1]; const char * outputName = argv[2]; diff -Nru otb-4.0.0/Testing/Fa/CMakeLists.txt otb-4.2.0/Testing/Fa/CMakeLists.txt --- otb-4.0.0/Testing/Fa/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -23,8 +23,10 @@ add_executable(0000094-PolygonsVectorization 0000094-PolygonsVectorization.cxx) target_link_libraries(0000094-PolygonsVectorization OTBIO OTBCommon) +if(ITK_USE_FFTWD OR ITK_USE_FFTWF) add_executable(0000169-fftcomplextocomplex 0000169-fftcomplextocomplex.cxx) target_link_libraries(0000169-fftcomplextocomplex OTBIO OTBCommon) +endif(ITK_USE_FFTWD OR ITK_USE_FFTWF) add_executable(000295-MeanShiftVectorImageFilterWithStreamingShrink 000295-MeanShiftVectorImageFilterWithStreamingShrink.cxx) target_link_libraries(000295-MeanShiftVectorImageFilterWithStreamingShrink OTBIO OTBCommon) diff -Nru otb-4.0.0/Testing/Fa/otbVectorDataToLabelImageFilterWithoutReader.cxx otb-4.2.0/Testing/Fa/otbVectorDataToLabelImageFilterWithoutReader.cxx --- otb-4.0.0/Testing/Fa/otbVectorDataToLabelImageFilterWithoutReader.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/otbVectorDataToLabelImageFilterWithoutReader.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ typedef DataNodeType::PolygonType PolygonType; typedef LineType::VertexType VertexType; -int main(int argc, char* argv[]) +int main(int itkNotUsed(argc), char* argv[]) { //OGRRegisterAll(); @@ -144,14 +144,10 @@ spacing[0]=1; spacing[1]=1; - rasterization->SetOutputSize(size); rasterization->SetOutputOrigin(origin); rasterization->SetOutputSpacing(spacing); - otb::StandardOneLineFilterWatcher * watch = new otb::StandardOneLineFilterWatcher(rasterization.GetPointer(), - "rasterization"); - WriterType::Pointer writer = WriterType::New(); writer->SetFileName(argv[1]); writer->SetInput(rasterization->GetOutput()); diff -Nru otb-4.0.0/Testing/Fa/StreamingStat.cxx otb-4.2.0/Testing/Fa/StreamingStat.cxx --- otb-4.0.0/Testing/Fa/StreamingStat.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/StreamingStat.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -4,10 +4,8 @@ #include "otbStreamingStatisticsImageFilter.h" #include "otbVectorImageTo3DScalarImageFilter.h" -int main(int argc, char ** argv) +int main(int itkNotUsed(argc), char ** argv) { - - typedef otb::Image ImageType; typedef otb::Image Image3DType; typedef otb::VectorImage VectorImageType; typedef otb::ImageFileReader ReaderType; diff -Nru otb-4.0.0/Testing/Fa/WriteUnsignedLong.cxx otb-4.2.0/Testing/Fa/WriteUnsignedLong.cxx --- otb-4.0.0/Testing/Fa/WriteUnsignedLong.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Fa/WriteUnsignedLong.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ //TODO change the bug tracker url //http://bugs.orfeo-toolbox.org/view.php?id=406 -int main(int argc, char *argv[]) +int main(int itkNotUsed(argc), char *argv[]) { char * filename = argv[1]; diff -Nru otb-4.0.0/Testing/Utilities/6SFunctionMainTest.cxx otb-4.2.0/Testing/Utilities/6SFunctionMainTest.cxx --- otb-4.0.0/Testing/Utilities/6SFunctionMainTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/6SFunctionMainTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -172,18 +172,3 @@ return EXIT_SUCCESS; }; - - - - - - - - - - - - - - - diff -Nru otb-4.0.0/Testing/Utilities/kmlcreatekml.cc otb-4.2.0/Testing/Utilities/kmlcreatekml.cc --- otb-4.0.0/Testing/Utilities/kmlcreatekml.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlcreatekml.cc 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,8 @@ int kmlcreatekml(int argc, char* argv[]) { // Get the factory singleton to create KML elements. KmlFactory* factory = KmlFactory::GetFactory(); - + if(argc > 0) //silence warning! + std::cerr << "Running " << argv[0] << std::endl; // Create . CoordinatesPtr coordinates = factory->CreateCoordinates(); // Create -122.0816695,37.42052549 diff -Nru otb-4.0.0/Testing/Utilities/kmlhelloattrs.cc otb-4.2.0/Testing/Utilities/kmlhelloattrs.cc --- otb-4.0.0/Testing/Utilities/kmlhelloattrs.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlhelloattrs.cc 2014-09-03 08:29:34.000000000 +0000 @@ -1,9 +1,9 @@ // Copyright 2008, Google Inc. All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // -// 1. Redistributions of source code must retain the above copyright notice, +// 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation @@ -13,14 +13,14 @@ // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Sample of parse and DOM access of attributes. @@ -84,6 +84,8 @@ } int kmlhelloattrs(int argc, char* argv[]) { + if(argc > 0) //silence warning! + std::cerr << "Running " << argv[0] << std::endl; CheckId(); CheckHotSpot(); return 0; // All is well if we got this far. diff -Nru otb-4.0.0/Testing/Utilities/kmlhelloenum.cc otb-4.2.0/Testing/Utilities/kmlhelloenum.cc --- otb-4.0.0/Testing/Utilities/kmlhelloenum.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlhelloenum.cc 2014-09-03 08:29:34.000000000 +0000 @@ -1,9 +1,9 @@ // Copyright 2008, Google Inc. All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // -// 1. Redistributions of source code must retain the above copyright notice, +// 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation @@ -13,14 +13,14 @@ // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. @@ -140,6 +140,8 @@ } int kmlhelloenum(int argc, char* argv[]) { + if(argc > 0) //silence warning! + std::cerr << "Running " << argv[0] << std::endl; CheckParseLookAt(); CheckParseLink(); CheckSerializeLookAt(); diff -Nru otb-4.0.0/Testing/Utilities/kmlhellofolder.cc otb-4.2.0/Testing/Utilities/kmlhellofolder.cc --- otb-4.0.0/Testing/Utilities/kmlhellofolder.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlhellofolder.cc 2014-09-03 08:29:34.000000000 +0000 @@ -1,9 +1,9 @@ // Copyright 2008, Google Inc. All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // -// 1. Redistributions of source code must retain the above copyright notice, +// 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation @@ -13,14 +13,14 @@ // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include @@ -60,6 +60,9 @@ int kmlhellofolder(int argc, char* argv[]) { KmlFactory* factory(KmlFactory::GetFactory()); + if(argc > 0) //silence warning! + std::cerr << "Running " << argv[0] << std::endl; + // Create a Folder, fill it with Placemarks. cout << "Creating " << kHowManyPoints << " Placemarks:" << endl; FolderPtr folder = factory->CreateFolder(); diff -Nru otb-4.0.0/Testing/Utilities/kmlhelloregion.cc otb-4.2.0/Testing/Utilities/kmlhelloregion.cc --- otb-4.0.0/Testing/Utilities/kmlhelloregion.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlhelloregion.cc 2014-09-03 08:29:34.000000000 +0000 @@ -1,9 +1,9 @@ // Copyright 2008, Google Inc. All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // -// 1. Redistributions of source code must retain the above copyright notice, +// 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation @@ -13,14 +13,14 @@ // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This program generates GroundOverlays with Regions. The two overlays have @@ -125,6 +125,8 @@ int kmlhelloregion(int argc, char* argv[]) { + if(argc > 0) //silence warning! + std::cerr << "Running " << argv[0] << std::endl; SwapOverlays(); return EXIT_SUCCESS; } diff -Nru otb-4.0.0/Testing/Utilities/kmlparsekml.cc otb-4.2.0/Testing/Utilities/kmlparsekml.cc --- otb-4.0.0/Testing/Utilities/kmlparsekml.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlparsekml.cc 2014-09-03 08:29:34.000000000 +0000 @@ -32,6 +32,9 @@ #include "kml/dom.h" // The KML DOM header. int kmlparsekml(int argc, char* argv[]) { + + if(argc > 0) //silence warning! + std::cerr << "Running " << argv[0] << std::endl; // Parse KML from a memory buffer. std::string errors; kmldom::ElementPtr element = kmldom::Parse( diff -Nru otb-4.0.0/Testing/Utilities/kmlprintgeometry.cc otb-4.2.0/Testing/Utilities/kmlprintgeometry.cc --- otb-4.0.0/Testing/Utilities/kmlprintgeometry.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlprintgeometry.cc 2014-09-03 08:29:34.000000000 +0000 @@ -1,9 +1,9 @@ // Copyright 2008, Google Inc. All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // -// 1. Redistributions of source code must retain the above copyright notice, +// 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation @@ -13,14 +13,14 @@ // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Walks a Feature hierarchy, looking for Placemarks with Geometry, printing @@ -109,6 +109,8 @@ } int kmlprintgeometry(int argc, char* argv[]) { + if(argc > 0) //silence warning! + std::cerr << "Running " << argv[0] << std::endl; std::string kml; kmlbase::File::ReadFileToString(argv[1], &kml); std::string errors; @@ -120,4 +122,3 @@ } return 0; } - diff -Nru otb-4.0.0/Testing/Utilities/kmlsharedstyles.cc otb-4.2.0/Testing/Utilities/kmlsharedstyles.cc --- otb-4.0.0/Testing/Utilities/kmlsharedstyles.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/kmlsharedstyles.cc 2014-09-03 08:29:34.000000000 +0000 @@ -1,9 +1,9 @@ // Copyright 2008, Google Inc. All rights reserved. // -// Redistribution and use in source and binary forms, with or without +// Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // -// 1. Redistributions of source code must retain the above copyright notice, +// 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // 2. Redistributions in binary form must reproduce the above copyright notice, // this list of conditions and the following disclaimer in the documentation @@ -13,14 +13,14 @@ // specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // This sample program creates shared style selectors. @@ -39,6 +39,10 @@ using kmldom::StyleMapPtr; int kmlsharedstyles(int argc, char* argv[]) { + + if(argc > 0) + std::cerr << "Running " << argv[0] << std::endl; + KmlFactory* kml_factory = KmlFactory::GetFactory(); DocumentPtr document = kml_factory->CreateDocument(); diff -Nru otb-4.0.0/Testing/Utilities/ossimElevManagerTest.cxx otb-4.2.0/Testing/Utilities/ossimElevManagerTest.cxx --- otb-4.0.0/Testing/Utilities/ossimElevManagerTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/ossimElevManagerTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -14,13 +14,14 @@ #include #include +#include "itkMacro.h" #include "ossim/elevation/ossimElevManager.h" // this is the most important class and is called as the first line of all applications. // without this alll the important factories are not created. #include "ossim/init/ossimInit.h" -int ossimElevManagerTest(int argc, char* argv[]) +int ossimElevManagerTest(int itkNotUsed(argc), char* itkNotUsed(argv)[]) { ossimElevManager * ElevManager(NULL); ElevManager=ossimElevManager::instance(); @@ -35,6 +36,3 @@ } } - - - diff -Nru otb-4.0.0/Testing/Utilities/ossimpluginsHermiteInterpolation.cxx otb-4.2.0/Testing/Utilities/ossimpluginsHermiteInterpolation.cxx --- otb-4.0.0/Testing/Utilities/ossimpluginsHermiteInterpolation.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/ossimpluginsHermiteInterpolation.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,8 +25,7 @@ #include "ossim/otb/HermiteInterpolator.h" #include "itkTimeProbe.h" - -int ossimpluginsHermiteInterpolationTest(int argc, char * argv[]) +int ossimpluginsHermiteInterpolationTest(int itkNotUsed(argc), char * itkNotUsed(argv)[]) { double epsilon = 0.0000001; diff -Nru otb-4.0.0/Testing/Utilities/ossimXmlDocumentTest.cxx otb-4.2.0/Testing/Utilities/ossimXmlDocumentTest.cxx --- otb-4.0.0/Testing/Utilities/ossimXmlDocumentTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/ossimXmlDocumentTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -15,12 +15,12 @@ #include #include "ossim/base/ossimXmlDocument.h" - +#include "itkMacro.h" // this is the most important class and is called as the first line of all applications. // without this alll the important factories are not created. #include "ossim/init/ossimInit.h" -int ossimXmlDocumentTest(int argc, char* argv[]) +int ossimXmlDocumentTest(int itkNotUsed(argc), char* argv[]) { ossimXmlDocument* xdoc = new ossimXmlDocument(); bool result = xdoc->openFile(argv[1]); @@ -36,6 +36,3 @@ } } - - - diff -Nru otb-4.0.0/Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx otb-4.2.0/Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx --- otb-4.0.0/Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/otbSVMComposedKernelFunctorTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ #define Malloc(type,n) new type[n] #endif -int otbSVMComposedKernelFunctorTest( int argc, char* argv[] ) +int otbSVMComposedKernelFunctorTest( int itkNotUsed(argc), char* argv[] ) { typedef unsigned char InputPixelType; typedef unsigned char LabelPixelType; @@ -161,7 +161,3 @@ return EXIT_SUCCESS; } - - - - diff -Nru otb-4.0.0/Testing/Utilities/svmGenericKernelBasicOperationsTest.cxx otb-4.2.0/Testing/Utilities/svmGenericKernelBasicOperationsTest.cxx --- otb-4.0.0/Testing/Utilities/svmGenericKernelBasicOperationsTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/svmGenericKernelBasicOperationsTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -6,8 +6,7 @@ #include "svm.h" #include "otbSVMKernels.h" - -int svmGenericKernelBasicOperationsTest( int argc, char *argv[] ) +int svmGenericKernelBasicOperationsTest( int itkNotUsed(argc), char *argv[] ) { const char * outputFileName = argv[1]; @@ -84,5 +83,3 @@ return EXIT_SUCCESS; } - - diff -Nru otb-4.0.0/Testing/Utilities/svmGenericKernelFunctor.cxx otb-4.2.0/Testing/Utilities/svmGenericKernelFunctor.cxx --- otb-4.0.0/Testing/Utilities/svmGenericKernelFunctor.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/svmGenericKernelFunctor.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ * image. We write the output to an image for * comparison. */ -int svmGenericKernelFunctor( int argc, char *argv[] ) +int svmGenericKernelFunctor( int itkNotUsed(argc), char *itkNotUsed(argv)[] ) { try @@ -92,18 +92,3 @@ return EXIT_SUCCESS; }; - - - - - - - - - - - - - - - diff -Nru otb-4.0.0/Testing/Utilities/svmGenericKernelTest.cxx otb-4.2.0/Testing/Utilities/svmGenericKernelTest.cxx --- otb-4.0.0/Testing/Utilities/svmGenericKernelTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/svmGenericKernelTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,12 +52,10 @@ * image. We write the output to an image for * comparison. */ -int svmGenericKernelTest( int argc, char *argv[] ) +int svmGenericKernelTest( int itkNotUsed(argc), char *argv[] ) { - try { - const char * inputFilename = argv[1]; const char * outputFilename = argv[2]; otb::LinearKernelFunctor lFunctor; @@ -93,18 +91,3 @@ return EXIT_SUCCESS; }; - - - - - - - - - - - - - - - diff -Nru otb-4.0.0/Testing/Utilities/svmTest.cxx otb-4.2.0/Testing/Utilities/svmTest.cxx --- otb-4.0.0/Testing/Utilities/svmTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/svmTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ * image. We write the output to an image for * comparison. */ -int svmTest( int argc, char *argv[] ) +int svmTest( int itkNotUsed(argc), char *argv[] ) { try @@ -91,18 +91,3 @@ return EXIT_SUCCESS; }; - - - - - - - - - - - - - - - diff -Nru otb-4.0.0/Testing/Utilities/tinyXMLlibTest.cxx otb-4.2.0/Testing/Utilities/tinyXMLlibTest.cxx --- otb-4.0.0/Testing/Utilities/tinyXMLlibTest.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Testing/Utilities/tinyXMLlibTest.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ // and show how to add and remove nodes. // -int tinyXMLlibTest(int argc, char *argv[] ) +int tinyXMLlibTest(int itkNotUsed(argc), char *argv[] ) { const char * inputUtf8TestFilename = argv[1]; const char * inputUtf8TestVerifyFilename = argv[2]; @@ -910,8 +910,8 @@ // Long filenames crashing STL version { TiXmlDocument doc( "midsummerNightsDreamWithAVeryLongFilenameToConfuseTheStringHandlingRoutines.xml" ); - bool loadOkay = doc.LoadFile(); - loadOkay = true; // get rid of compiler warning. +// bool loadOkay = doc.LoadFile(); +// loadOkay = true; // get rid of compiler warning. // Won't pass on non-dev systems. Just a "no crash" check. //XmlTest(file, "Long filename. ", true, loadOkay ); } @@ -1316,5 +1316,3 @@ if( gFail == 0 ) return EXIT_SUCCESS; else return EXIT_FAILURE; } - - diff -Nru otb-4.0.0/Utilities/CMakeLists.txt otb-4.2.0/Utilities/CMakeLists.txt --- otb-4.0.0/Utilities/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -101,10 +101,15 @@ # By default activate FFTW, but with an external fftw build # These variables are used in ITK to initialize the value of the ITK_USE_FFTW_XXX options - set(USE_FFTWF ON) - set(USE_FFTWD ON) - set(USE_SYSTEM_FFTW ON) - + if (WIN32) + set(USE_FFTWF OFF) + set(USE_FFTWD OFF) + set(USE_SYSTEM_FFTW OFF) + else() + set(USE_FFTWF ON) + set(USE_FFTWD ON) + set(USE_SYSTEM_FFTW ON) + endif() set(ITK_INSTALL_RUNTIME_DIR ${OTB_INSTALL_BIN_DIR}) set(ITK_INSTALL_LIBRARY_DIR ${OTB_INSTALL_LIB_DIR}) set(ITK_INSTALL_ARCHIVE_DIR ${OTB_INSTALL_LIB_DIR}) @@ -115,7 +120,7 @@ # set(ITK_INSTALL_PACKAGE_DIR "lib/cmake/ITK-${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}") add_subdirectory(ITK) - + # Load the ITKConfig generated at configuration time # Be sure to avoid loading an external ITK find_package(ITK @@ -213,7 +218,7 @@ message(STATUS "Configuring otbconfigfile...") add_subdirectory(otbconfigfile) -if(WIN32) +if(MSVC) message(STATUS "Configuring otbmsinttypes...") add_subdirectory(otbmsinttypes) endif() diff -Nru otb-4.0.0/Utilities/ITK/CMake/CTestCustom.cmake.in otb-4.2.0/Utilities/ITK/CMake/CTestCustom.cmake.in --- otb-4.0.0/Utilities/ITK/CMake/CTestCustom.cmake.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/CTestCustom.cmake.in 2014-09-03 08:29:34.000000000 +0000 @@ -90,8 +90,10 @@ ".*include.opencv2.*warning.*" ".*core.vidl.*warning.*" ".*core.vnl.vnl_matrix_fixed.h.*warning.*" - # DCMTK + # ExternalProject: Git writes status to stderr + "Cloning into.*" "Note: checking out.*" + "HEAD is now at.*" # FFTW ExternalProject ".*fftw[fd]/src/fftw[fd]./*" "libtool: install: warning: relinking .libfftw3f?_threads.la." diff -Nru otb-4.0.0/Utilities/ITK/CMake/FindKWStyle.cmake otb-4.2.0/Utilities/ITK/CMake/FindKWStyle.cmake --- otb-4.0.0/Utilities/ITK/CMake/FindKWStyle.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/FindKWStyle.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -31,12 +31,19 @@ ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE ) - string(REPLACE - "Version: " - "" - KWSTYLE_VERSION_STRING - ${KWSTYLE_VERSION_STRING} - ) + if(KWSTYLE_VERSION_STRING) + # string(REPLACE ..) fails if the input is an empty string + string(REPLACE + "Version: " + "" + KWSTYLE_VERSION_STRING + ${KWSTYLE_VERSION_STRING} + ) + else(KWSTYLE_VERSION_STRING) + # CMake's find_package_handle_standard_args has a bug where the + # version empty string ("") is always acceptable + set(KWSTYLE_VERSION_STRING "?") + endif(KWSTYLE_VERSION_STRING) endif(KWSTYLE_EXECUTABLE) include(FindPackageHandleStandardArgs) diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKExternalData.cmake otb-4.2.0/Utilities/ITK/CMake/ITKExternalData.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKExternalData.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKExternalData.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -27,16 +27,18 @@ "Additional URL templates for the ExternalData CMake script to look for testing data. E.g. file:///var/bigharddrive/%(algo)/%(hash)") mark_as_advanced(ExternalData_URL_TEMPLATES) -list(APPEND ExternalData_URL_TEMPLATES - # Data published by MIDAS - "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)" +if(NOT ITK_FORBID_DOWNLOADS) + list(APPEND ExternalData_URL_TEMPLATES + # Data published by MIDAS + "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)" - # Data published by developers using git-gerrit-push. - "http://www.itk.org/files/ExternalData/%(algo)/%(hash)" + # Data published by developers using git-gerrit-push. + "http://www.itk.org/files/ExternalData/%(algo)/%(hash)" - # Mirror supported by the Slicer community. - "http://slicer.kitware.com/midas3/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)" - ) + # Mirror supported by the Slicer community. + "http://slicer.kitware.com/midas3/api/rest?method=midas.bitstream.download&checksum=%(hash)&algorithm=%(algo)" + ) +endif() # Tell ExternalData commands to transform raw files to content links. # TODO: Condition this feature on presence of our pre-commit hook. diff -Nru otb-4.0.0/Utilities/ITK/CMake/itkExternal_FFTW.cmake otb-4.2.0/Utilities/ITK/CMake/itkExternal_FFTW.cmake --- otb-4.0.0/Utilities/ITK/CMake/itkExternal_FFTW.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/itkExternal_FFTW.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -53,11 +53,17 @@ set(FFTW_SHARED_FLAG --enable-shared) endif() + set(_fftw_target_version 3.3.3) + set(_fftw_url_md5 "0a05ca9c7b3bfddc8278e7c40791a1c2") + set(_fftw_url "http://midas3.kitware.com/midas/api/rest?method=midas.bitstream.download&checksum=${_fftw_url_md5}&name=fftw-${_fftw_target_version}.tar.gz") + if(ITK_USE_FFTWF) + itk_download_attempt_check(FFTW) ExternalProject_add(fftwf PREFIX fftwf - URL "http://www.fftw.org/fftw-3.3.2.tar.gz" - URL_MD5 6977ee770ed68c85698c7168ffa6e178 + URL "${_fftw_url}" + URL_MD5 "${_fftw_url_md5}" + DOWNLOAD_NAME "fftw-${_fftw_target_version}.tar.gz" CONFIGURE_COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" @@ -77,10 +83,12 @@ endif() if(ITK_USE_FFTWD) + itk_download_attempt_check(FFTW) ExternalProject_add(fftwd PREFIX fftwd - URL "http://www.fftw.org/fftw-3.3.2.tar.gz" - URL_MD5 6977ee770ed68c85698c7168ffa6e178 + URL "${_fftw_url}" + URL_MD5 "${_fftw_url_md5}" + DOWNLOAD_NAME "fftw-${_fftw_target_version}.tar.gz" CONFIGURE_COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKGroups.cmake otb-4.2.0/Utilities/ITK/CMake/ITKGroups.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKGroups.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKGroups.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,18 @@ # Set a list of group names -set(group_list Core IO Filtering Registration Segmentation Numerics Video ThirdParty Bridge Nonunit Compatibility) +set(group_list + Core + IO + Filtering + Registration + Segmentation + Numerics + Video + ThirdParty + Bridge + Nonunit + Compatibility + Remote + ) set(Core_documentation "This group of modules contain the toolkit framework used by other modules. There are common base classes for data objects and process @@ -44,22 +57,33 @@ set(Nonunit_documentation "This group of modules are intended to make use of an extensive set of the toolkit modules.") -# Set a module name list for each group +set(Remote_documentation "This group of modules is for ITK based code that have +additional third-party dependencies not bundled with the toolkit, +new algorithms or implementations seeking greater exposure and adoption, +algorithms that hope to eventually be integrated into the toolkit, +niche algorithms with limited application, and Modules in progress that do not +yet have the test coverage and cross-platform standards required by the main toolkit. +The modules are OFF by default in ITK's CMake configuration. +Note that these modules do get the same level of support and backwards +compatibility as other modules in the toolkit.") + +#------------------------------------------------ +# Find the modules in each group and the module name line in itk-module.cmake foreach( group ${group_list} ) - set( ${group}_module_list ) - file( GLOB_RECURSE _module_files ${ITK_SOURCE_DIR}/Modules/${group}/itk-module.cmake ) - foreach( _module_f ${_module_files} ) - get_filename_component (module_file_dir ${_module_f} PATH) - if (NOT EXISTS "${module_file_dir}/itk-module-init.cmake") - file( STRINGS ${_module_f} _module_line REGEX "itk_module[ \n]*\\([ \n]*ITK[A-Za-z0-9]*" ) - string( REGEX MATCH "ITK[A-Za-z0-9]*" _module_name ${_module_line} ) - list( APPEND ${group}_module_list ${_module_name} ) - endif() + set( _${group}_module_list ) + file( GLOB_RECURSE _${group}_module_files ${ITK_SOURCE_DIR}/Modules/${group}/itk-module.cmake ) + foreach( _module_file ${_${group}_module_files} ) + file( STRINGS ${_module_file} _module_line REGEX "itk_module[ \n]*\\([ \n]*[A-Za-z0-9]*" ) + string( REGEX MATCH "(\\([ \n]*)([A-Za-z0-9]*)" _module_name ${_module_line} ) + set( _module_name ${CMAKE_MATCH_2} ) + set( _${_module_name}_module_line ${_module_line} ) + list( APPEND _${group}_module_list ${_module_name} ) endforeach() endforeach() #------------------------------------------------ -#------------------------------------------------ +# Set up Doxygen Group descriptions + set( group_list_dox ) foreach(group ${group_list} ) set( group_list_dox @@ -70,7 +94,7 @@ ${${group}_documentation} */\n" ) - foreach(mod ${${group}_module_list} ) + foreach(mod ${_${group}_module_list} ) set( group_list_dox "${group_list_dox} /** \\defgroup ${mod} Module ${mod} @@ -87,6 +111,22 @@ #------------------------------------------------ # Turn on the ITK_BUILD option for each group + +# Set a module name list for each group and exclude +# Modules that should be OFF +foreach( group ${group_list} ) + set( _${group}_on_module_list ) + list( LENGTH _${group}_module_list _num_modules ) + set( _current_module 0 ) + while( ${_current_module} LESS ${_num_modules} ) + list( GET _${group}_module_list ${_current_module} _module_name ) + if( NOT ITK_MODULE_${_module_name}_EXCLUDE_FROM_DEFAULT ) + list( APPEND _${group}_on_module_list ${_module_name} ) + endif() + math( EXPR _current_module "${_current_module} + 1" ) + endwhile() +endforeach() + if("$ENV{DASHBOARD_TEST_FROM_CTEST}" STREQUAL "") # developer build option(ITKGroup_Core "Request building core modules" ON) @@ -94,7 +134,7 @@ foreach( group ${group_list}) option(ITKGroup_${group} "Request building ${group} modules" OFF) if (ITKGroup_${group}) - foreach (itk-module ${${group}_module_list} ) + foreach (itk-module ${_${group}_on_module_list} ) list(APPEND ITK_MODULE_${itk-module}_REQUEST_BY ITKGroup_${group}) endforeach() endif() diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKModuleDoxygen.cmake otb-4.2.0/Utilities/ITK/CMake/ITKModuleDoxygen.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKModuleDoxygen.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKModuleDoxygen.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -12,7 +12,7 @@ # _content defines the content of the ${_name}.dox file set( _content "/**\n" ) - set( _content "${_content} \\defgroup ${_name} ${_name} \n" ) + set( _content "${_content} \\defgroup ${_name} Module ${_name} \n" ) set( _content "${_content} ${ITK_MODULE_${_name}_DESCRIPTION} \n" ) set( _content "${_content} \\par Dependencies:\n" ) diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKModuleEnablement.cmake otb-4.2.0/Utilities/ITK/CMake/ITKModuleEnablement.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKModuleEnablement.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKModuleEnablement.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -76,6 +76,12 @@ # options or ITKGroup_* options. option(ITK_BUILD_DEFAULT_MODULES "Build the default ITK modules." ON) +#---------------------------------------------------------------------- +# Provide an option to build the tests of dependencies of a module when +# BUILD_TESTING is ON. +option(ITK_BUILD_ALL_MODULES_FOR_TESTS "Build the tests of module dependencies." OFF) +mark_as_advanced(ITK_BUILD_ALL_MODULES_FOR_TESTS) + # To maintain backward compatibility if(DEFINED ITK_BUILD_ALL_MODULES) message(WARNING "ITK_BUILD_ALL_MODULES is deprecated, please remove this entry from the CMake " @@ -112,7 +118,7 @@ foreach(dep IN LISTS ITK_MODULE_${itk-module}_DEPENDS) itk_module_enable(${dep} ${itk-module}) endforeach() - if(${itk-module}_TESTED_BY) + if(${itk-module}_TESTED_BY AND (ITK_BUILD_DEFAULT_MODULES OR ITK_BUILD_ALL_MODULES_FOR_TESTS OR Module_${itk-module})) itk_module_enable(${${itk-module}_TESTED_BY} "") endif() endif() diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKModuleHeaderTest.cmake otb-4.2.0/Utilities/ITK/CMake/ITKModuleHeaderTest.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKModuleHeaderTest.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKModuleHeaderTest.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -23,6 +23,7 @@ if( NOT ${_name}_THIRD_PARTY AND EXISTS ${${_name}_SOURCE_DIR}/include AND PYTHON_EXECUTABLE + AND NOT (PYTHON_VERSION_STRING VERSION_LESS 2.6) AND NOT (${_name} STREQUAL ITKTestKernel) AND NOT (CMAKE_GENERATOR MATCHES "^Visual Studio 10.*")) diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKModuleMacros.cmake otb-4.2.0/Utilities/ITK/CMake/ITKModuleMacros.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKModuleMacros.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKModuleMacros.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -6,6 +6,11 @@ include(${_ITKModuleMacros_DIR}/ITKModuleDoxygen.cmake) include(${_ITKModuleMacros_DIR}/ITKModuleHeaderTest.cmake) +# With Apple's GGC <=4.2 and LLVM-GCC <=4.2 visibility of template +# don't work. Set the option to off and hide it. +if(APPLE AND CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.3") + set( USE_COMPILER_HIDDEN_VISIBILITY OFF CACHE INTERNAL "" ) +endif() include(GenerateExportHeader) if(ITK_CPPCHECK_TEST) diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKModuleRemote.cmake otb-4.2.0/Utilities/ITK/CMake/ITKModuleRemote.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKModuleRemote.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKModuleRemote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ # Is the hash checkout out that we want? if(NOT ("${tag_hash}" STREQUAL "${head_hash}")) execute_process( - COMMAND "${git_executable}" fetch + COMMAND "${git_executable}" fetch "${git_repository}" WORKING_DIRECTORY "${module_dir}" RESULT_VARIABLE error_code ) @@ -133,6 +133,7 @@ endif() if(Module_${_name}) + itk_download_attempt_check(Module_${_name}) include(CMakeParseArguments) cmake_parse_arguments(_fetch_options "" "GIT_REPOSITORY;GIT_TAG" "" ${ARGN}) find_package(Git) diff -Nru otb-4.0.0/Utilities/ITK/CMake/itkOpenCL.cmake otb-4.2.0/Utilities/ITK/CMake/itkOpenCL.cmake --- otb-4.0.0/Utilities/ITK/CMake/itkOpenCL.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/itkOpenCL.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -38,13 +38,14 @@ file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE} "${${GPUFILTER_KERNELNAME}_KernelString}") - add_custom_target(${GPUFILTER_KERNELNAME}_Target - SOURCES ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}) - add_dependencies(${GPUFILTER_KERNELNAME}_Target ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}) - add_dependencies(${GPUFILTER_KERNELNAME}_Target ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) configure_file(${OPENCL_FILE} - ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}.cl COPYONLY) - add_dependencies(${GPUFILTER_KERNELNAME}_Target ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}.cl) + ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}.cl COPYONLY) + add_custom_target(${GPUFILTER_KERNELNAME}_Target + DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE} + ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt + ${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE}.cl + ) set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${OUTPUT_FILE} PROPERTIES GENERATED ON) set(${SRC_VAR} ${${SRC_VAR}} ${OUTPUT_FILE}) diff -Nru otb-4.0.0/Utilities/ITK/CMake/itkSampleBuildTest.cmake.in otb-4.2.0/Utilities/ITK/CMake/itkSampleBuildTest.cmake.in --- otb-4.0.0/Utilities/ITK/CMake/itkSampleBuildTest.cmake.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/itkSampleBuildTest.cmake.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -# -# This is a recommended file for ITK dashboard submissions -# The generated file will use the current settings in the CMakeCache.txt file -# The file should be copied, edited if necessary and moved to another location -# -# This file was generated from -# @ITK_SOURCE_DIR@/CMake/itkSampleBuildTest.cmake -# - -###################### -# Set the Dashboard to one of Nightly, Continuous or Experimental -# -set(DASHBOARD Nightly) -set(DASHBOARD Continuous) -set(DASHBOARD Experimental) - -###################### -# Set the Default Build Type to one of Release, Debug, RelWithDebInfo -# or MinSizeRel -# -set(DEFAULT_BUILD_TYPE "Debug") -set(DEFAULT_BUILD_TYPE "RelWithDebInfo") -set(DEFAULT_BUILD_TYPE "MinSizeRel") -set(DEFAULT_BUILD_TYPE "Release") - -if("@CMAKE_BUILD_TYPE@" STREQUAL "") - set(BUILD_TYPE ${DEFAULT_BUILD_TYPE}) -else() - set(BUILD_TYPE @CMAKE_BUILD_TYPE@) -endif() - - -# These are the the locations of the source and binary directory -set(CTEST_SOURCE_DIRECTORY "@ITK_SOURCE_DIR@") -set(CTEST_BINARY_DIRECTORY "@ITK_BINARY_DIR@") - -# The ctest command to use for running the dashboard -set(CTEST_COMMAND - "@CMAKE_COMMAND@ -P \"${CTEST_BINARY_DIRECTORY}/CMake/RemoveTemporaryFiles.cmake\"" - "@CMAKE_CTEST_COMMAND@ -D ${DASHBOARD} -A \"${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}\"" -) - -# CMake/RemoveTemporaryFiles.cmake must exist before the CTEST_COMMAND runs -if(NOT EXISTS ${CTEST_BINARY_DIRECTORY}/CMake/RemoveTemporaryFiles.cmake) - set(CTEST_CMAKE_COMMAND "@CMAKE_COMMAND@") -endif() - -# CMakeCache.txt must exist before the CTEST_COMMAND runs -if(NOT EXISTS ${CTEST_BINARY_DIRECTORY}/CMakeCache.txt) - set(CTEST_CMAKE_COMMAND "@CMAKE_COMMAND@") -endif() - -# Specify how long to run the continuous in minutes -if(${DASHBOARD} STREQUAL "Continuous") - set(CTEST_CONTINUOUS_DURATION 1080) - set(CTEST_CONTINUOUS_MINIMUM_INTERVAL 15) -endif() - -# Set defaults -set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY FALSE) -set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE FALSE) - -# For Nightly builds, this should be TRUE -if(${DASHBOARD} STREQUAL "Nightly") - set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) -else() - set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY FALSE) -endif() - -# For Continuous builds. this should be TRUE -if(${DASHBOARD} STREQUAL "Continuous") - set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE TRUE) -else() - set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE FALSE) -endif() - -# For Experimental builds, these should be FALSE -if(${DASHBOARD} STREQUAL "Experimental") - set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY FALSE) - set(CTEST_START_WITH_EMPTY_BINARY_DIRECTORY_ONCE FALSE) -endif() - -# This is the initial cache to use for the binary tree, be careful to escape -# any quotes inside of this string if you use it -set(CTEST_INITIAL_CACHE " -SITE:STRING=@SITE@ -BUILDNAME:STRING=@BUILDNAME@ -CVSCOMMAND:FILEPATH=@CVSCOMMAND@ -CVS_UPDATE_OPTIONS:STRING=-d -A -P - -CMAKE_C_FLAGS_RELEASE:STRING=@CMAKE_C_FLAGS_RELEASE@ -CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=@CMAKE_C_FLAGS_RELWITHDEBINFO@ -CMAKE_CXX_FLAGS_RELEASE:STRING=@CMAKE_CXX_FLAGS_RELEASE@ -CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=@CMAKE_CXX_FLAGS_RELWITHDEBINFO@ - -TCL_TCLSH:FILEPATH=@TCL_TCLSH@ -CMAKE_BUILD_TOOL:INTERNAL=@CMAKE_BUILD_TOOL@ -CMAKE_MAKE_PROGRAM:FILEPATH=@CMAKE_MAKE_PROGRAM@ -CMAKE_GENERATOR:INTERNAL=@CMAKE_GENERATOR@ -CMAKE_CXX_COMPILER:FILEPATH=@CMAKE_CXX_COMPILER@ -CMAKE_CXX_FLAGS:STRING=@CMAKE_CXX_FLAGS@ -CMAKE_C_COMPILER:FILEPATH=@CMAKE_C_COMPILER@ -CMAKE_C_FLAGS:STRING=@CMAKE_C_FLAGS@ -CMAKE_CONFIGURATION_TYPES:STRING=${BUILD_TYPE} -CMAKE_BUILD_TYPE:STRING=${BUILD_TYPE} - -BUILD_SHARED_LIBS:BOOL=@BUILD_SHARED_LIBS@ -BUILD_TESTING:BOOL=@BUILD_TESTING@ -BUILD_EXAMPLES:BOOL=@BUILD_EXAMPLES@ - -ITK_USE_PATENTED:BOOL=@ITK_USE_PATENTED@ -ITK_USE_CONCEPT_CHECKING:BOOL=@ITK_USE_CONCEPT_CHECKING@ - -ITK_USE_SYSTEM_GDCM:BOOL=@ITK_USE_SYSTEM_GDCM@ -ITK_USE_SYSTEM_JPEG:BOOL=@ITK_USE_SYSTEM_JPEG@ -ITK_USE_SYSTEM_PNG:BOOL=@ITK_USE_SYSTEM_PNG@ -ITK_USE_SYSTEM_TIFF:BOOL=@ITK_USE_SYSTEM_TIFF@ -ITK_USE_SYSTEM_VXL:BOOL=@ITK_USE_SYSTEM_VXL@ -ITK_USE_SYSTEM_ZLIB:BOOL=@ITK_USE_SYSTEM_ZLIB@ - -ITK_LEGACY_REMOVE:BOOL=@ITK_LEGACY_REMOVE@ -ITK_LEGACY_SILENT:BOOL=@ITK_LEGACY_SILENT@ -ITK_FUTURE_LEGACY_REMOVE:BOOL=@ITK_FUTURE_LEGACY_REMOVE@ -GDCM_LEGACY_REMOVE:BOOL=@GDCM_LEGACY_REMOVE@ -GDCM_LEGACY_SILENT:BOOL=@GDCM_LEGACY_SILENT@ - -ITK_USE_KWSTYLE:BOOL=@ITK_USE_KWSTYLE@ -KWSTYLE_EXECUTABLE:PATH=@KWSTYLE_EXECUTABLE@ -KWSTYLE_USE_VIM_FORMAT:BOOL=@KWSTYLE_USE_VIM_FORMAT@ -KWSTYLE_USE_GCC_FORMAT:BOOL=@KWSTYLE_USE_GCC_FORMAT@ -KWSTYLE_USE_MSVC_FORMAT:BOOL=@KWSTYLE_USE_MSVC_FORMAT@ - -ITK_CSWIG_JAVA:BOOL=@ITK_CSWIG_JAVA@ -ITK_CSWIG_PYTHON:BOOL=@ITK_CSWIG_PYTHON@ -ITK_CSWIG_TCL:BOOL=@ITK_CSWIG_TCL@ - -ITK_WRAPPING:BOOL=@ITK_WRAPPING@ -ITK_USE_FFTWD:BOOL=@USE_FFTWD@ -ITK_USE_FFTWF:BOOL=@USE_FFTWF@ -") - -# Set any extra envionment variables here -set(CTEST_ENVIRONMENT - ) diff -Nru otb-4.0.0/Utilities/ITK/CMake/ITKSetStandardCompilerFlags.cmake otb-4.2.0/Utilities/ITK/CMake/ITKSetStandardCompilerFlags.cmake --- otb-4.0.0/Utilities/ITK/CMake/ITKSetStandardCompilerFlags.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/ITKSetStandardCompilerFlags.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -110,7 +110,6 @@ -Wwrite-strings -funit-at-a-time -Wno-strict-overflow - -Wno-unused-local-typedefs ) # Check this list on C++ compiler only @@ -190,8 +189,10 @@ #----------------------------------------------------------------------------- #ITK requires special compiler flags on some platforms. if(CMAKE_COMPILER_IS_GNUCXX) - # GCC's -Warray-bounds has been shown to throw false positives with -O3 on 4.7 and 4.8. - if(UNIX AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "4.6" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9") + # GCC's -Warray-bounds has been shown to throw false positives with -O3 on 4.8. + if(UNIX AND ( + ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_EQUAL "4.8") OR + ("${CMAKE_CXX_COMPILER_VERSION}" VERSION_GREATER "4.8" AND "${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "4.9") )) set(ITK_REQUIRED_CXX_FLAGS "${ITK_REQUIRED_CXX_FLAGS} -Wno-array-bounds") endif() diff -Nru otb-4.0.0/Utilities/ITK/CMake/UseITK.cmake otb-4.2.0/Utilities/ITK/CMake/UseITK.cmake --- otb-4.0.0/Utilities/ITK/CMake/UseITK.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMake/UseITK.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -33,9 +33,9 @@ # a list of image IOs to be registered when the corresponding modules are enabled set(LIST_OF_IMAGEIO_FORMATS - Nifti Nrrd Gipl HDF5 JPEG GDCM BMP LSM PNG TIFF VTK Stimulate BioRad Meta MRC + Nifti Nrrd Gipl HDF5 JPEG GDCM BMP LSM PNG TIFF VTK Stimulate BioRad Meta MRC GE4 GE5 MINC - MGH SCIFIO + MGH SCIFIO FDF ) # Set each IO format's module name and factory name @@ -48,6 +48,12 @@ set(MGH_module_name MGHIO) set(MGH_factory_name MGHImageIO) +set(GE4_module_name ITKIOGE) +set(GE4_factory_name GE4ImageIO) +set(GE5_module_name ITKIOGE) +set(GE5_factory_name GE5ImageIO) + + set(SCIFIO_module_name SCIFIO) set(SCIFIO_factory_name SCIFIOImageIO) diff -Nru otb-4.0.0/Utilities/ITK/CMakeLists.txt otb-4.2.0/Utilities/ITK/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,15 +1,25 @@ -cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) -include(CMakeDependentOption) -# -# use ExternalProject -include(ExternalProject) - if(WIN32) - cmake_minimum_required(VERSION 2.8.8) + cmake_minimum_required(VERSION 2.8.8 FATAL_ERROR) +else() + cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) endif() +foreach(p + CMP0025 # CMake 3.0 + CMP0042 # CMake 3.0 + ) + if(POLICY ${p}) + cmake_policy(SET ${p} NEW) + endif() +endforeach() + project(ITK) +include(CMakeDependentOption) +# +# use ExternalProject +include(ExternalProject) + if( CMAKE_HOST_WIN32 ) string( LENGTH "${CMAKE_CURRENT_SOURCE_DIR}" n ) @@ -44,7 +54,7 @@ #----------------------------------------------------------------------------- # ITK version number. set(ITK_VERSION_MAJOR "4") -set(ITK_VERSION_MINOR "5") +set(ITK_VERSION_MINOR "6") set(ITK_VERSION_PATCH "0") if(NOT ITK_INSTALL_RUNTIME_DIR) @@ -89,16 +99,33 @@ #----------------------------------------------------------------------------- -# Enable runinng cppcheck for each module on its source and test directories. +# Enable running cppcheck for each module on its source and test directories. option(ITK_CPPCHECK_TEST "Run cppcheck for static code analysis" OFF) mark_as_advanced(ITK_CPPCHECK_TEST) +#----------------------------------------------------------------------------- +# Forbid downloading resources from the network during a build. This helps +# when building on systems without network connectivity to determine which +# resources much be obtained manually and made available to the build. +option(ITK_FORBID_DOWNLOADS "Do not download source code or data from the network" OFF) +mark_as_advanced(ITK_FORBID_DOWNLOADS) +macro(itk_download_attempt_check _name) + if(ITK_FORBID_DOWNLOADS) + message(SEND_ERROR "Attempted to download ${_name} when ITK_FORBID_DOWNLOADS is ON") + endif() +endmacro() #----------------------------------------------------------------------------- # Enable the download and use of BrainWeb datasets. # When this data is available, additional 3D tests are enabled. option(ITK_USE_BRAINWEB_DATA "Download and use BrainWeb data for advanced testing" OFF) mark_as_advanced(ITK_USE_BRAINWEB_DATA) +if(ITK_BRAINWEB_DATA_ROOT) + message(WARNING + "ITK_BRAINWEB_DATA_ROOT is not longer supported!" + "Please update to ITK_USE_BRAINWEB_DATA." + ) +endif() #----------------------------------------------------------------------------- # ITK wrapper for add_test that automatically sets the test's LABELS property @@ -134,8 +161,16 @@ endmacro() #----------------------------------------------------------------------------- +# Python Wrapping +option(ITK_WRAP_PYTHON "Build python support" OFF) + +#----------------------------------------------------------------------------- # ITK build configuration options. -option(BUILD_SHARED_LIBS "Build ITK with shared libraries." OFF) +if(ITK_WRAP_PYTHON) + option(BUILD_SHARED_LIBS "Build ITK with shared libraries." ON) +else() + option(BUILD_SHARED_LIBS "Build ITK with shared libraries." OFF) +endif() set(ITK_BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS}) include(ITKSetStandardCompilerFlags) @@ -170,7 +205,11 @@ # Provide compatibility options. option(ITKV3_COMPATIBILITY "Enable compatibility with ITK3.x when possible." OFF) option(ITK_LEGACY_REMOVE "Remove all legacy code completely." OFF) -option(ITK_LEGACY_SILENT "Silence all legacy code messages." OFF) +if(ITK_WRAP_PYTHON) + option(ITK_LEGACY_SILENT "Silence all legacy code messages." ON) +else() + option(ITK_LEGACY_SILENT "Silence all legacy code messages." OFF) +endif() # The ITK_FUTURE_LEGACY_REMOVE is a very advanced feature only # available to developers at configuration time by manually # adding this to the CMakeCache.txt -DITK_FUTURE_LEGACY_REMOVE:BOOL=ON @@ -178,7 +217,7 @@ mark_as_advanced(ITK_LEGACY_SILENT ITK_LEGACY_REMOVE ITK_V3_COMPATIBILITY) # The disabling of legacy code, and the ITKv3 compatibility option can not both be -# requested. If removal of legacy code is requested, then ITKV3_COMPATIBILITY must +# requested. If removal of legacy code is requested, then ITKV3_COMPATIBILITY must # be off. if(ITKV3_COMPATIBILITY AND ITK_LEGACY_REMOVE) message(FATAL_ERROR "Invlaid configuration: ITKV3_COMPATIBILITY AND ITK_LEGACY_REMOVE can not both be ON") @@ -354,15 +393,11 @@ #----------------------------------------------------------------------------- # The subdirectories added below this line should use only the public -# interface with find_package(ITK). Set ITK_DIR to use this ITK build. +# interface with find_package(ITK). Set ITK_DIR to use this ITK build. set(ITK_DIR "${ITK_BINARY_DIR}") include(Wrapping/itkWrapSetup.cmake) if(ITK_WRAPPING) - if(ITK_USE_64BITS_IDS AND WIN32) - message(FATAL_ERROR "WRAPPING with ITK_USE_64BITS_IDS is not supported on Windows. -Please turn of ITK_USE_64BITS_IDS.") - endif() add_subdirectory(Wrapping) endif() @@ -374,6 +409,6 @@ # Provide an option for generating documentation. add_subdirectory(Utilities/Doxygen) -# Create target to download data from the ITKData group. This must come after +# Create target to download data from the ITKData group. This must come after # all tests have been added that reference the group, so we put it last. ExternalData_Add_Target(ITKData) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkExponentialDeformationFieldImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkExponentialDeformationFieldImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkExponentialDeformationFieldImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkExponentialDeformationFieldImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -114,7 +114,7 @@ maxnorm2 /= vnl_math_sqr(minpixelspacing); InputPixelRealValueType numiterfloat = 2.0 - + 0.5 * vcl_log(maxnorm2) / vnl_math::ln2; + + 0.5 * std::log(maxnorm2) / vnl_math::ln2; if ( numiterfloat >= 0.0 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkInverseDeformationFieldImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkInverseDeformationFieldImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkInverseDeformationFieldImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkInverseDeformationFieldImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,6 @@ typedef typename InputImageType::RegionType InputRegionType; typedef typename InputImageType::SizeType InputSizeType; - typedef typename InputImageType::IndexType InputIndexType; InputRegionType region; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkIterativeInverseDeformationFieldImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkIterativeInverseDeformationFieldImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkIterativeInverseDeformationFieldImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkIterativeInverseDeformationFieldImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ { itkExceptionMacro("\n Input is missing."); } - if ( !TInputImage::ImageDimension == TOutputImage::ImageDimension ) + if ( ! ( TInputImage::ImageDimension == TOutputImage::ImageDimension ) ) { itkExceptionMacro("\n Image Dimensions must be the same."); } @@ -150,9 +150,9 @@ smallestError = 0; for ( unsigned int j = 0; j < ImageDimension; j++ ) { - smallestError += vcl_pow(mappedPoint[j] + forwardVector[j] - originalPoint[j], 2); + smallestError += std::pow(mappedPoint[j] + forwardVector[j] - originalPoint[j], 2); } - smallestError = vcl_sqrt(smallestError); + smallestError = std::sqrt(smallestError); } // iteration loop @@ -174,9 +174,9 @@ tmp = 0; for ( unsigned int l = 0; l < ImageDimension; l++ ) { - tmp += vcl_pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); + tmp += std::pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); } - tmp = vcl_sqrt(tmp); + tmp = std::sqrt(tmp); if ( tmp < smallestError ) { smallestError = tmp; @@ -194,9 +194,9 @@ tmp = 0; for ( unsigned int l = 0; l < ImageDimension; l++ ) { - tmp += vcl_pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); + tmp += std::pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); } - tmp = vcl_sqrt(tmp); + tmp = std::sqrt(tmp); if ( tmp < smallestError ) { smallestError = tmp; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.h otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -99,7 +99,7 @@ protected: OtsuThresholdImageCalculator(); virtual ~OtsuThresholdImageCalculator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: OtsuThresholdImageCalculator(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Compatibility/V3Compatibility/include/itkOtsuThresholdImageCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ OtsuThresholdImageCalculator< TInputImage > ::OtsuThresholdImageCalculator() { - m_Image = NULL; + m_Image = ITK_NULLPTR; m_Threshold = NumericTraits< PixelType >::Zero; m_NumberOfHistogramBins = 128; m_RegionSetByUser = false; @@ -98,7 +98,7 @@ } else { - binNumber = (unsigned int)vcl_ceil( ( value - imageMin ) * binMultiplier ) - 1; + binNumber = (unsigned int)std::ceil( ( value - imageMin ) * binMultiplier ) - 1; if ( binNumber == m_NumberOfHistogramBins ) // in case of rounding errors { binNumber -= 1; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAnnulusOperator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAnnulusOperator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAnnulusOperator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAnnulusOperator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -166,13 +166,13 @@ double mean = sumNotExterior / num; double var = ( sumNotExteriorSq - ( sumNotExterior * sumNotExterior / num ) ) / ( num - 1.0 ); - double std = vcl_sqrt(var); + double std = std::sqrt(var); // convert std to a scaling factor k such that // // || (coeffP - mean) / k || = 1.0 // - double k = std * vcl_sqrt(num - 1.0); + double k = std * std::sqrt(num - 1.0); // Run through the kernel again, shifting and normalizing the // elements that are not exterior to the annulus. This forces the diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.h 2014-09-03 08:29:34.000000000 +0000 @@ -35,20 +35,20 @@ * * Template parameters for class Array2D: * - * - TValueType = Element type stored at each location in the array. + * - TValue = Element type stored at each location in the array. * * \ingroup DataRepresentation * \ingroup ITKCommon */ -template< typename TValueType > -class Array2D: public vnl_matrix< TValueType > +template< typename TValue > +class Array2D: public vnl_matrix< TValue > { public: /** The element type stored at each location in the Array2D. */ - typedef TValueType ValueType; - typedef Array2D Self; - typedef vnl_matrix< TValueType > VnlMatrixType; + typedef TValue ValueType; + typedef Array2D Self; + typedef vnl_matrix< TValue > VnlMatrixType; Array2D(); Array2D(unsigned int rows, unsigned int cols); @@ -59,7 +59,7 @@ const Self & operator=(const VnlMatrixType & matrix); - void Fill(TValueType const & v) { this->fill(v); } + void Fill(TValue const & v) { this->fill(v); } /** Destructively set the size to that given. Will lose data. */ void SetSize(unsigned int m, unsigned int n); @@ -69,8 +69,8 @@ ~Array2D() {} }; -template< typename TValueType > -std::ostream & operator<<(std::ostream & os, const Array2D< TValueType > & arr) +template< typename TValue > +std::ostream & operator<<(std::ostream & os, const Array2D< TValue > & arr) { const unsigned int numberOfRows = arr.rows(); const unsigned int numberOfColumns = arr.cols(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray2D.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,34 +23,34 @@ namespace itk { /** Default constructor */ -template< typename TValueType > -Array2D< TValueType > -::Array2D():vnl_matrix< TValueType >() +template< typename TValue > +Array2D< TValue > +::Array2D():vnl_matrix< TValue >() {} /** Constructor with number of rows and columns as arguments */ -template< typename TValueType > -Array2D< TValueType > +template< typename TValue > +Array2D< TValue > ::Array2D(unsigned int numberOfRows, unsigned int numberOfCols): - vnl_matrix< TValueType >(numberOfRows, numberOfCols) + vnl_matrix< TValue >(numberOfRows, numberOfCols) {} /** Constructor from a vnl_matrix */ -template< typename TValueType > -Array2D< TValueType > -::Array2D(const VnlMatrixType & matrix):vnl_matrix< TValueType >(matrix) +template< typename TValue > +Array2D< TValue > +::Array2D(const VnlMatrixType & matrix):vnl_matrix< TValue >(matrix) {} /** Copy Constructor */ -template< typename TValueType > -Array2D< TValueType > -::Array2D(const Self & array):vnl_matrix< TValueType >(array) +template< typename TValue > +Array2D< TValue > +::Array2D(const Self & array):vnl_matrix< TValue >(array) {} /** Assignment Operator from Array */ -template< typename TValueType > -const Array2D< TValueType > & -Array2D< TValueType > +template< typename TValue > +const Array2D< TValue > & +Array2D< TValue > ::operator=(const Self & array) { this->VnlMatrixType::operator=(array); @@ -58,9 +58,9 @@ } /** Assignment Operator from vnl_matrix */ -template< typename TValueType > -const Array2D< TValueType > & -Array2D< TValueType > +template< typename TValue > +const Array2D< TValue > & +Array2D< TValue > ::operator=(const VnlMatrixType & matrix) { this->VnlMatrixType::operator=(matrix); @@ -68,8 +68,8 @@ } /** Set the size of the array */ -template< typename TValueType > -void Array2D< TValueType > +template< typename TValue > +void Array2D< TValue > ::SetSize(unsigned int m, unsigned int n) { this->set_size(m, n); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray.h 2014-09-03 08:29:34.000000000 +0000 @@ -41,21 +41,21 @@ * * Template parameters for class Array: * - * - TValueType = Element type stored at each location in the array. + * - TValue = Element type stored at each location in the array. * * \ingroup DataRepresentation * \ingroup ITKCommon */ -template< typename TValueType > -class Array : public vnl_vector< TValueType > +template< typename TValue > +class Array : public vnl_vector< TValue > { public: /** The element type stored at each location in the Array. */ - typedef TValueType ValueType; - typedef Array Self; - typedef vnl_vector< TValueType > VnlVectorType; - typedef typename vnl_vector< TValueType>::size_type SizeValueType; + typedef TValue ValueType; + typedef Array Self; + typedef vnl_vector< TValue > VnlVectorType; + typedef typename vnl_vector< TValue>::size_type SizeValueType; public: @@ -78,6 +78,14 @@ * memory when this object is destroyed. */ Array(ValueType *data, SizeValueType sz, bool LetArrayManageMemory = false); +#if defined ( ITK_FUTURE_LEGACY_REMOVE ) + /** Constructor that initializes array with contents from a user supplied + * const buffer. The pointer to the buffer and the length is specified. By default, + * the array does a deep copy of the const pointer data, so the array class also + * manages memory. */ + Array(const ValueType *datain, SizeValueType sz); + +#else // defined ( ITK_FUTURE_LEGACY_REMOVE ) /** Constructor that initializes array with contents from a user supplied * buffer. The pointer to the buffer and the length is specified. By default, * the array does not manage the memory of the buffer. It merely points to @@ -86,6 +94,7 @@ * memory when this object is destroyed. */ Array(const ValueType *data, SizeValueType sz, bool LetArrayManageMemory = false); +#endif /** Constructor to initialize an array from another of any data type */ template< typename TArrayValue > @@ -95,12 +104,12 @@ this->SetSize( r.GetSize() ); for( SizeValueType i=0; ioperator[](i) = static_cast< TValueType >( r[i] ); + this->operator[](i) = static_cast< TValue >( r[i] ); } } /** Set the all the elements of the array to the specified value */ - void Fill(TValueType const & v) + void Fill(TValue const & v) { this->fill(v); } @@ -117,11 +126,11 @@ { return static_cast( this->size() ); } /** Get one element */ - const TValueType & GetElement(SizeValueType i) const + const TValue & GetElement(SizeValueType i) const { return this->operator[](i); } /** Set one element */ - void SetElement(SizeValueType i, const TValueType & value) + void SetElement(SizeValueType i, const TValue & value) { this->operator[](i) = value; } /** Destructively set the size to that given. Will lose data. */ @@ -135,7 +144,7 @@ * the responsibility of freeing the memory for this data. If * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. */ - void SetData(TValueType *data, bool LetArrayManageMemory = false); + void SetData(TValue *data, bool LetArrayManageMemory = false); /** Similar to the previous method. In the above method, the size must be * separately set prior to using user-supplied data. This introduces an @@ -146,7 +155,7 @@ * the responsibility of freeing the memory for this data. If * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. */ - void SetData(TValueType *data, SizeValueType sz, + void SetData(TValue *data, SizeValueType sz, bool LetArrayManageMemory = false); @@ -157,13 +166,20 @@ * means that subclasses cannot allocate memory. */ ~Array(); + void swap(Array &other) + { + using std::swap; + this->VnlVectorType::swap(other); + swap(this->m_LetArrayManageMemory, other.m_LetArrayManageMemory); + } + private: bool m_LetArrayManageMemory; }; -template< typename TValueType > -std::ostream & operator<<(std::ostream & os, const Array< TValueType > & arr) +template< typename TValue > +std::ostream & operator<<(std::ostream & os, const Array< TValue > & arr) { os << "["; const unsigned int length = arr.size(); @@ -184,6 +200,13 @@ template<> ITKCommon_EXPORT std::ostream & operator<< (std::ostream & os, const Array< double > & arr); template<> ITKCommon_EXPORT std::ostream & operator<< (std::ostream & os, const Array< float > & arr); + +template +inline void swap( Array &a, Array &b ) +{ + a.swap(b); +} + } // namespace itk #ifndef ITK_MANUAL_INSTANTIATION diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkArray.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkArray.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,18 +24,18 @@ namespace itk { /** Default constructor */ -template< typename TValueType > -Array< TValueType > -::Array():vnl_vector< TValueType >() +template< typename TValue > +Array< TValue > +::Array():vnl_vector< TValue >() { m_LetArrayManageMemory = true; } /** Copy constructor */ -template < typename TValueType > -Array +template < typename TValue > +Array ::Array(const Self & rhs) - : vnl_vector(rhs), + : vnl_vector(rhs), // The vnl vector copy constructor creates new memory // no matter the setting of let array manage memory of rhs m_LetArrayManageMemory(true) @@ -43,42 +43,62 @@ } /** Constructor with size */ -template< typename TValueType > -Array< TValueType > -::Array(SizeValueType dimension):vnl_vector< TValueType >(dimension) +template< typename TValue > +Array< TValue > +::Array(SizeValueType dimension) + : vnl_vector< TValue >(dimension), + // The vnl vector copy constructor creates new memory + // no matter the setting of let array manage memory of rhs + m_LetArrayManageMemory(true) { - m_LetArrayManageMemory = true; } /** Constructor with user specified data */ -template< typename TValueType > -Array< TValueType > -::Array(ValueType *datain, SizeValueType sz, bool LetArrayManageMemory) +template< typename TValue > +Array< TValue > +::Array(ValueType *datain, SizeValueType sz, bool LetArrayManageMemory): + m_LetArrayManageMemory(LetArrayManageMemory) +{ + vnl_vector< TValue >::data = datain; + vnl_vector< TValue >::num_elmts = sz; +} + +#if defined ( ITK_FUTURE_LEGACY_REMOVE ) +/** Constructor with user specified const data */ +template< typename TValue > +Array< TValue > +::Array(const ValueType *datain, SizeValueType sz): + vnl_vector< TValue >( datain, sz), + // The vnl vector copy constructor creates new memory + // no matter the setting of let array manage memory of rhs + m_LetArrayManageMemory(true) { - vnl_vector< TValueType >::data = datain; - vnl_vector< TValueType >::num_elmts = sz; - m_LetArrayManageMemory = LetArrayManageMemory; } -/** Constructor with user specified data */ -template< typename TValueType > -Array< TValueType > -::Array(const ValueType *datain, SizeValueType sz, bool LetArrayManageMemory) -{ - vnl_vector< TValueType >::data = const_cast< TValueType * >( datain ); - // Argh!! Discard constness WRONG.!! - vnl_vector< TValueType >::num_elmts = sz; - m_LetArrayManageMemory = LetArrayManageMemory; +#else // defined ( ITK_FUTURE_LEGACY_REMOVE ) +/** Constructor with user specified const data */ +template< typename TValue > +Array< TValue > +::Array(const ValueType *datain, SizeValueType sz, bool /* LetArrayManageMemory */): + /* NOTE: The 3rd argument "LetArrayManageMemory, was never valid to use, but is + * preserved to maintain backwards compatibility*/ + vnl_vector< TValue >( datain, sz), + // The vnl vector copy constructor creates new memory + // no matter the setting of let array manage memory of rhs + m_LetArrayManageMemory(true) +{ } +#endif + /** Destructor */ -template< typename TValueType > -Array< TValueType > +template< typename TValue > +Array< TValue > ::~Array() { if ( !m_LetArrayManageMemory ) { - vnl_vector< TValueType >::data = 0; + vnl_vector< TValue >::data = ITK_NULLPTR; } } @@ -87,16 +107,16 @@ * the responsibility of freeing the memory for this data. If * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. */ -template< typename TValueType > +template< typename TValue > void -Array< TValueType > -::SetData(TValueType *datain, bool LetArrayManageMemory) +Array< TValue > +::SetData(TValue *datain, bool LetArrayManageMemory) { if ( m_LetArrayManageMemory ) { - vnl_vector< TValueType >::destroy(); + vnl_vector< TValue >::destroy(); } - vnl_vector< TValueType >::data = datain; + vnl_vector< TValue >::data = datain; m_LetArrayManageMemory = LetArrayManageMemory; } @@ -109,22 +129,22 @@ * the responsibility of freeing the memory for this data. If * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. */ -template< typename TValueType > +template< typename TValue > void -Array< TValueType > -::SetData(TValueType *datain, SizeValueType sz, bool LetArrayManageMemory) +Array< TValue > +::SetData(TValue *datain, SizeValueType sz, bool LetArrayManageMemory) { if ( m_LetArrayManageMemory ) { - vnl_vector< TValueType >::destroy(); + vnl_vector< TValue >::destroy(); } - vnl_vector< TValueType >::data = datain; - vnl_vector< TValueType >::num_elmts = sz; + vnl_vector< TValue >::data = datain; + vnl_vector< TValue >::num_elmts = sz; m_LetArrayManageMemory = LetArrayManageMemory; } -template< typename TValueType > -void Array< TValueType > +template< typename TValue > +void Array< TValue > ::SetSize(SizeValueType sz) { if ( this->size() != sz ) @@ -133,7 +153,7 @@ // on a resize if ( !m_LetArrayManageMemory ) { - vnl_vector< TValueType >::data = 0; + vnl_vector< TValue >::data = ITK_NULLPTR; } // Call the superclass's set_size @@ -145,10 +165,10 @@ } } -template< typename TValueType > -const typename Array< TValueType > +template< typename TValue > +const typename Array< TValue > ::Self & -Array< TValueType > +Array< TValue > ::operator=(const Self & rhs) { if ( this != &rhs ) @@ -166,10 +186,10 @@ return *this; } -template< typename TValueType > -const typename Array< TValueType > +template< typename TValue > +const typename Array< TValue > ::Self & -Array< TValueType > +Array< TValue > ::operator=(const VnlVectorType & rhs) { if ( this != &rhs ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAtanRegularizedHeavisideStepFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAtanRegularizedHeavisideStepFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAtanRegularizedHeavisideStepFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAtanRegularizedHeavisideStepFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,7 @@ ::Evaluate(const InputType & input) const { const RealType t = static_cast< RealType >( input ) * this->GetOneOverEpsilon(); - return 0.5 + static_cast< OutputType >( vnl_math::one_over_pi * vcl_atan( t ) ); + return 0.5 + static_cast< OutputType >( vnl_math::one_over_pi * std::atan( t ) ); } /** Evaluate the derivative at the specified input position */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointerDataObjectDecorator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointerDataObjectDecorator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointerDataObjectDecorator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointerDataObjectDecorator.h 2014-09-03 08:29:34.000000000 +0000 @@ -87,7 +87,7 @@ protected: AutoPointerDataObjectDecorator(); ~AutoPointerDataObjectDecorator(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkAutoPointer.h 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ typedef AutoPointer Self; /** Constructor. */ - AutoPointer ():m_Pointer(0), m_IsOwner(false) + AutoPointer ():m_Pointer(ITK_NULLPTR), m_IsOwner(false) {} /** Copy constructor. */ @@ -85,7 +85,7 @@ { delete m_Pointer; } - m_Pointer = 0; + m_Pointer = ITK_NULLPTR; m_IsOwner = false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBinaryThresholdSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ { m_LowerThreshold = NumericTraits< FunctionOutputType >::NonpositiveMin(); m_UpperThreshold = NumericTraits< FunctionOutputType >::max(); - m_Function = NULL; + m_Function = ITK_NULLPTR; } template< typename TFunction > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.h 2014-09-03 08:29:34.000000000 +0000 @@ -164,7 +164,7 @@ bool IsInside(const PointType &) const; /** Method Compute the Modified Time based on changed to the components. */ - ModifiedTimeType GetMTime(void) const; + virtual ModifiedTimeType GetMTime(void) const ITK_OVERRIDE; /** Duplicates this bounding box */ Pointer DeepCopy() const; @@ -172,7 +172,7 @@ protected: BoundingBox(); virtual ~BoundingBox(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; typedef typename PointsContainer::ConstIterator ConstIterator; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBoundingBox.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -98,12 +98,12 @@ radius[i] = m_Bounds[2 * i + 1] - center[i]; } - for ( unsigned int j = 0; j < vcl_pow(2.0, (double)VPointDimension); j++ ) + for ( unsigned int j = 0; j < std::pow(2.0, (double)VPointDimension); j++ ) { PointType pnt; for ( unsigned int i = 0; i < VPointDimension; i++ ) { - pnt[i] = center[i] + vcl_pow( -1.0, ( (double)( j / ( int( vcl_pow(2.0, (double)i) ) ) ) ) ) + pnt[i] = center[i] + std::pow( -1.0, ( (double)( j / ( int( std::pow(2.0, (double)i) ) ) ) ) ) * radius[i]; } @@ -118,7 +118,7 @@ template< typename TPointIdentifier, int VPointDimension, typename TCoordRep, typename TPointsContainer > BoundingBox< TPointIdentifier, VPointDimension, TCoordRep, TPointsContainer > -::BoundingBox():m_PointsContainer(NULL) +::BoundingBox():m_PointsContainer(ITK_NULLPTR) { m_Bounds.Fill(NumericTraits< CoordRepType >::Zero); m_CornersContainer = PointsContainer::New(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkBSplineInterpolationWeightFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ { // Initialize the number of weights; m_NumberOfWeights = - static_cast< unsigned int >( vcl_pow( static_cast< double >( SplineOrder + 1 ), + static_cast< unsigned int >( std::pow( static_cast< double >( SplineOrder + 1 ), static_cast< double >( SpaceDimension ) ) ); // Initialize support region is a hypercube of length SplineOrder + 1 @@ -46,8 +46,7 @@ typedef Image< char, SpaceDimension > CharImageType; typename CharImageType::Pointer tempImage = CharImageType::New(); tempImage->SetRegions(m_SupportSize); - tempImage->Allocate(); - tempImage->FillBuffer(0); + tempImage->Allocate(true); // initialize buffer to zero typedef ImageRegionConstIteratorWithIndex< CharImageType > IteratorType; IteratorType iterator( tempImage, tempImage->GetBufferedRegion() ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCellInterface.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCellInterface.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCellInterface.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCellInterface.h 2014-09-03 08:29:34.000000000 +0000 @@ -204,7 +204,7 @@ return ( *pos ).second; } } - return 0; + return ITK_NULLPTR; } void AddVisitor(VisitorType *v) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkChildTreeIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkChildTreeIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkChildTreeIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkChildTreeIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,7 +50,7 @@ bool ChildTreeIterator< TTreeType >::GoToChild(ChildIdentifier number) { - if ( m_ParentNode->GetChild(number) == NULL ) + if ( m_ParentNode->GetChild(number) == ITK_NULLPTR ) { return false; } @@ -69,7 +69,7 @@ { TreeNodeType *parent = m_ParentNode->GetParent(); - if ( parent == NULL ) + if ( parent == ITK_NULLPTR ) { return false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.h 2014-09-03 08:29:34.000000000 +0000 @@ -108,7 +108,7 @@ protected: ColorTable(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; unsigned int m_NumberOfColors; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkColorTable.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -386,7 +386,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCommand.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCommand.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCommand.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCommand.h 2014-09-03 08:29:34.000000000 +0000 @@ -117,7 +117,7 @@ } /** Invoke the member function. */ - virtual void Execute(Object *caller, const EventObject & event) + virtual void Execute(Object *caller, const EventObject & event) ITK_OVERRIDE { if ( m_MemberFunction ) { @@ -126,7 +126,7 @@ } /** Invoke the member function with a const object. */ - virtual void Execute(const Object *caller, const EventObject & event) + virtual void Execute(const Object *caller, const EventObject & event) ITK_OVERRIDE { if ( m_ConstMemberFunction ) { @@ -135,15 +135,16 @@ } protected: - T * m_This; TMemberFunctionPointer m_MemberFunction; TConstMemberFunctionPointer m_ConstMemberFunction; - MemberCommand(): - m_This( NULL ), - m_MemberFunction( NULL ), - m_ConstMemberFunction( NULL ) + + MemberCommand() : + m_This( ITK_NULLPTR ), + m_MemberFunction( ITK_NULLPTR ), + m_ConstMemberFunction( ITK_NULLPTR ) {} + virtual ~MemberCommand(){} private: @@ -187,7 +188,7 @@ } /** Invoke the member function. */ - virtual void Execute(Object *, const EventObject & event) + virtual void Execute(Object *, const EventObject & event) ITK_OVERRIDE { if ( m_MemberFunction ) { @@ -196,7 +197,7 @@ } /** Invoke the member function with a const object */ - virtual void Execute(const Object *, const EventObject & event) + virtual void Execute(const Object *, const EventObject & event) ITK_OVERRIDE { if ( m_MemberFunction ) { @@ -207,7 +208,12 @@ protected: T * m_This; TMemberFunctionPointer m_MemberFunction; - ReceptorMemberCommand():m_MemberFunction(0) {} + + ReceptorMemberCommand() : + m_This( ITK_NULLPTR ), + m_MemberFunction( ITK_NULLPTR ) + {} + virtual ~ReceptorMemberCommand() {} private: @@ -250,7 +256,7 @@ } /** Invoke the callback function. */ - virtual void Execute(Object *, const EventObject &) + virtual void Execute(Object *, const EventObject &) ITK_OVERRIDE { if ( m_MemberFunction ) { @@ -258,7 +264,7 @@ } } - virtual void Execute(const Object *, const EventObject &) + virtual void Execute(const Object *, const EventObject &) ITK_OVERRIDE { if ( m_MemberFunction ) { @@ -269,10 +275,12 @@ protected: T * m_This; TMemberFunctionPointer m_MemberFunction; - SimpleMemberCommand(): - m_This( NULL ), - m_MemberFunction( NULL ) + + SimpleMemberCommand() : + m_This( ITK_NULLPTR ), + m_MemberFunction( ITK_NULLPTR ) {} + virtual ~SimpleMemberCommand() {} private: @@ -315,7 +323,7 @@ } /** Invoke the const member method callback. */ - virtual void Execute(Object *, const EventObject &) + virtual void Execute(Object *, const EventObject &) ITK_OVERRIDE { if ( m_MemberFunction ) { @@ -323,7 +331,7 @@ } } - virtual void Execute(const Object *, const EventObject &) + virtual void Execute(const Object *, const EventObject &) ITK_OVERRIDE { if ( m_MemberFunction ) { @@ -334,10 +342,12 @@ protected: const T * m_This; TMemberFunctionPointer m_MemberFunction; - SimpleConstMemberCommand(): + + SimpleConstMemberCommand() : m_This( NULL ), m_MemberFunction( NULL ) {} + virtual ~SimpleConstMemberCommand() {} private: @@ -391,7 +401,7 @@ { m_ClientDataDeleteCallback = f; } /** Execute the callback function. */ - void Execute(Object *caller, const EventObject & event) + virtual void Execute(Object *caller, const EventObject & event) ITK_OVERRIDE { if ( m_Callback ) { @@ -400,7 +410,7 @@ } /** Execute the callback function with a const Object */ - void Execute(const Object *caller, const EventObject & event) + virtual void Execute(const Object *caller, const EventObject & event) ITK_OVERRIDE { if ( m_ConstCallback ) { @@ -409,11 +419,12 @@ } protected: - CStyleCommand():m_ClientData(0), m_Callback(0), m_ConstCallback(0), - m_ClientDataDeleteCallback(0) - { - // not implemented - } + CStyleCommand() : + m_ClientData( ITK_NULLPTR ), + m_Callback( ITK_NULLPTR ), + m_ConstCallback( ITK_NULLPTR ), + m_ClientDataDeleteCallback( ITK_NULLPTR ) + {} ~CStyleCommand() { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConceptChecking.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConceptChecking.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConceptChecking.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConceptChecking.h 2014-09-03 08:29:34.000000000 +0000 @@ -591,13 +591,13 @@ struct Constraints { void constraints() { - typedef typename NumericTraits< T >::ValueType ValueType; - typedef typename NumericTraits< T >::PrintType PrintType; - typedef typename NumericTraits< T >::AbsType AbsType; - typedef typename NumericTraits< T >::AccumulateType AccumulateType; - typedef typename NumericTraits< T >::RealType RealType; - typedef typename NumericTraits< T >::ScalarRealType ScalarRealType; - typedef typename NumericTraits< T >::FloatType FloatType; + Detail::UniqueType< typename NumericTraits< T >::ValueType >(); + Detail::UniqueType< typename NumericTraits< T >::PrintType >(); + Detail::UniqueType< typename NumericTraits< T >::AbsType >(); + Detail::UniqueType< typename NumericTraits< T >::AccumulateType >(); + Detail::UniqueType< typename NumericTraits< T >::RealType >(); + Detail::UniqueType< typename NumericTraits< T >::ScalarRealType >(); + Detail::UniqueType< typename NumericTraits< T >::FloatType >(); T a; bool b; @@ -625,7 +625,7 @@ struct Constraints { void constraints() { - typedef typename PixelTraits< T >::ValueType ValueType; + Detail::UniqueType< typename PixelTraits< T >::ValueType >(); unsigned int a = PixelTraits< T >::Dimension; Detail::IgnoreUnusedVariable(a); } @@ -640,7 +640,7 @@ struct Constraints { void constraints() { - typedef typename T::ValueType ValueType; + Detail::UniqueType< typename T::ValueType >(); } }; @@ -669,7 +669,7 @@ struct Constraints { void constraints() { - typedef typename JoinTraits< T1, T2 >::ValueType ValueType; + Detail::UniqueType< typename JoinTraits< T1, T2 >::ValueType >(); } }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConditionalConstIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConditionalConstIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConditionalConstIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConditionalConstIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ { template< typename TImageType > ConditionalConstIterator< TImageType > -::ConditionalConstIterator() +::ConditionalConstIterator() : m_IsAtEnd(false) {} template< typename TImageType > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -57,12 +57,12 @@ typedef typename TImage::InternalPixelType InternalPixelType; typedef typename TImage::PixelType PixelType; - /** Save the image dimension. */ - itkStaticConstMacro(Dimension, unsigned int, TImage::ImageDimension); - /** Type used to refer to space dimensions */ typedef unsigned int DimensionValueType; + /** Save the image dimension. */ + itkStaticConstMacro(Dimension, DimensionValueType, TImage::ImageDimension); + /** Standard class typedefs. */ typedef ConstNeighborhoodIterator Self; typedef Neighborhood< InternalPixelType *, @@ -115,7 +115,7 @@ const RegionType & region) { this->Initialize(radius, ptr, region); - for ( unsigned int i = 0; i < Dimension; i++ ) + for ( DimensionValueType i = 0; i < Dimension; i++ ) { m_InBounds[i] = false; } this->ResetBoundaryCondition(); m_NeighborhoodAccessorFunctor = ptr->GetNeighborhoodAccessor(); @@ -130,7 +130,7 @@ /** Computes the internal, N-d offset of a pixel array position n from * (0,0, ..., 0) in the "upper-left" corner of the neighborhood. */ - OffsetType ComputeInternalIndex(NeighborIndexType n) const; + OffsetType ComputeInternalIndex(const NeighborIndexType n) const; /** Returns the array of upper loop bounds used during iteration. */ IndexType GetBound() const diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -146,7 +146,7 @@ template< typename TImage, typename TBoundaryCondition > typename ConstNeighborhoodIterator< TImage, TBoundaryCondition >::OffsetType ConstNeighborhoodIterator< TImage, TBoundaryCondition > -::ComputeInternalIndex(NeighborIndexType n) const +::ComputeInternalIndex(const NeighborIndexType n) const { OffsetType ans; long D = (long)Dimension; @@ -166,9 +166,9 @@ ConstNeighborhoodIterator< TImage, TBoundaryCondition > ::GetBoundingBoxAsImageRegion() const { + const IndexValueType zero = NumericTraits< IndexValueType >::Zero; RegionType ans; - IndexValueType zero = NumericTraits< IndexValueType >::Zero; ans.SetIndex( this->GetIndex(zero) ); ans.SetSize( this->GetSize() ); @@ -177,17 +177,19 @@ template< typename TImage, typename TBoundaryCondition > ConstNeighborhoodIterator< TImage, TBoundaryCondition > -::ConstNeighborhoodIterator() +::ConstNeighborhoodIterator() : + m_IsInBounds(false), + m_IsInBoundsValid(false), + m_NeedToUseBoundaryCondition(false) { IndexType zeroIndex; zeroIndex.Fill(0); - SizeType zeroSize; zeroSize.Fill(0); m_Bound.Fill(0); - m_Begin = 0; + m_Begin = ITK_NULLPTR; m_BeginIndex.Fill(0); - // m_ConstImage - m_End = 0; + + m_End = ITK_NULLPTR; m_EndIndex.Fill(0); m_Loop.Fill(0); m_Region.SetIndex(zeroIndex); @@ -202,9 +204,6 @@ this->ResetBoundaryCondition(); - m_IsInBounds = false; - m_IsInBoundsValid = false; - m_BoundaryCondition = &m_InternalBoundaryCondition; } @@ -411,8 +410,9 @@ m_NeedToUseBoundaryCondition = false; for ( DimensionValueType i = 0; i < Dimension; ++i ) { - OffsetValueType overlapLow = static_cast< OffsetValueType >( ( rStart[i] - static_cast( this->GetRadius(i) ) ) - bStart[i] ); - OffsetValueType overlapHigh = static_cast< OffsetValueType >( ( bStart[i] + bSize[i] ) + const OffsetValueType overlapLow = static_cast< OffsetValueType >( ( rStart[i] + - static_cast( this->GetRadius(i) ) ) - bStart[i] ); + const OffsetValueType overlapHigh = static_cast< OffsetValueType >( ( bStart[i] + bSize[i] ) - ( rStart[i] + rSize[i] + static_cast( this->GetRadius(i) ) ) ); if ( overlapLow < 0 ) // out of bounds condition, define a region of diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -162,6 +162,7 @@ m_IsInBounds = false; m_IsInBoundsValid = false; + m_NeedToUseBoundaryCondition = false; } template< typename TImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstShapedNeighborhoodIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstShapedNeighborhoodIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkConstShapedNeighborhoodIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkConstShapedNeighborhoodIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -117,7 +117,7 @@ /** Const Interator */ struct ConstIterator { - ConstIterator() { m_NeighborhoodIterator = 0; } + ConstIterator() { m_NeighborhoodIterator = ITK_NULLPTR; } ConstIterator(Self *s) { m_NeighborhoodIterator = s; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.h 2014-09-03 08:29:34.000000000 +0000 @@ -243,7 +243,7 @@ CovariantVector< T, NVectorDimension > operator*(const T & scalar, const CovariantVector< T, NVectorDimension > & v) { - return v * scalar; + return v.operator*(scalar); } /** Performs the scalar product of a covariant with a contravariant. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCovariantVector.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -194,7 +194,7 @@ CovariantVector< T, NVectorDimension > ::GetNorm(void) const { - return vcl_sqrt( this->GetSquaredNorm() ); + return std::sqrt( this->GetSquaredNorm() ); } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCreateObjectFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCreateObjectFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkCreateObjectFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkCreateObjectFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ /** Methods from itk:LightObject. */ itkFactorylessNewMacro(Self); - LightObject::Pointer CreateObject() { return T::New().GetPointer(); } + virtual LightObject::Pointer CreateObject() ITK_OVERRIDE { return T::New().GetPointer(); } protected: CreateObjectFunction() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.h 2014-09-03 08:29:34.000000000 +0000 @@ -74,6 +74,7 @@ /** Typedef for the component type (object being decorated) */ typedef T ComponentType; + typedef typename T::Pointer ComponentPointer; typedef typename T::ConstPointer ComponentConstPointer; /** Method for creation through the object factory. */ @@ -83,15 +84,49 @@ itkTypeMacro(DataObjectDecorator, DataObject); /** Set the contained object */ - virtual void Set(const T *val); + virtual void Set( const ComponentType *val); /** Get the contained object */ - virtual const T * Get() const; + virtual const ComponentType * Get() const; + virtual ComponentType * GetModifiable(); + + /** The most recent MTime of this object and the held component */ + virtual ModifiedTimeType GetMTime() const ITK_OVERRIDE; + + /** Restore the data object to its initial state. This means + * releasing the help component. + */ + virtual void Initialize() ITK_OVERRIDE; + + /** \brief Graft the content of one decorator onto another + * + * The DataObject is dynamically_cast to this type, if successful + * then the component pointer is copies to that both decorators + * refer to the same object. + */ + virtual void Graft( const DataObject * ) ITK_OVERRIDE; + void Graft( const Self * decorator ); + + /** Method to aid in dynamic Graft of polymorphic types. + * + * To this method by default a raw pointer must be used or explicit + * template parameter must be provided. + */ + template + void Graft( const DataObjectDecorator * decorator ) + { + ComponentType *component = const_cast< ComponentType * >( dynamic_cast< const ComponentType * >( decorator->Get() ) ); + if ( !component ) + { + return; + } + this->Set( component ); + } protected: DataObjectDecorator(); ~DataObjectDecorator(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; protected: @@ -99,7 +134,7 @@ DataObjectDecorator(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented - ComponentConstPointer m_Component; + ComponentPointer m_Component; }; } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDataObjectDecorator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,6 +29,7 @@ #define __itkDataObjectDecorator_hxx #include "itkDataObjectDecorator.h" +#include namespace itk { @@ -37,7 +38,7 @@ */ template< typename T > DataObjectDecorator< T > -::DataObjectDecorator():m_Component() +::DataObjectDecorator() {} /** @@ -54,11 +55,11 @@ template< typename T > void DataObjectDecorator< T > -::Set(const T *val) +::Set( const ComponentType *val) { if ( m_Component != val ) { - m_Component = val; + m_Component = const_cast(val); this->Modified(); } } @@ -71,7 +72,84 @@ DataObjectDecorator< T > ::Get() const { - return m_Component; + return m_Component.GetPointer(); +} + +/** + * + */ +template< typename T > +T * +DataObjectDecorator< T > +::GetModifiable() +{ + return m_Component.GetPointer(); +} + +/** + * + */ +template< typename T > +ModifiedTimeType +DataObjectDecorator< T > +::GetMTime() const +{ + const ModifiedTimeType t = Superclass::GetMTime(); + if (m_Component.IsNotNull()) + { + return std::max(t, m_Component->GetMTime()); + } + return t; +} + +/** + * + */ +template< typename T > +void +DataObjectDecorator< T > +::Initialize() +{ + Superclass::Initialize(); + + // make sure the MTime does not change + if ( m_Component.IsNull()) + { + return; + } + if ( m_Component->GetMTime() > Superclass::GetMTime() ) + { + this->SetTimeStamp(m_Component->GetTimeStamp()); + } + m_Component = ITK_NULLPTR; +} + +/** + * + */ +template< typename T > +void +DataObjectDecorator< T > +::Graft( const DataObject *data ) +{ + const Self *decorator = dynamic_cast< const Self * >( data ); + this->Graft(decorator); +} + +/** + * + */ +template< typename T > +void +DataObjectDecorator< T > +::Graft( const Self *data ) +{ + if ( !data ) + { + return; + } + + this->Set(data->m_Component); } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDataObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDataObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDataObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDataObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -124,7 +124,7 @@ * specific exception subtypes. The default is to print out the * location where the exception was first thrown and any description * provided by the ``thrower''. */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; }; /*----------------------------Data Object--------------------------------*/ @@ -481,7 +481,7 @@ protected: DataObject(); ~DataObject(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Propagate a call to ResetPipeline(). Called only from ProcessObject. */ virtual void PropagateResetPipeline(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDefaultVectorPixelAccessorFunctor.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDefaultVectorPixelAccessorFunctor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDefaultVectorPixelAccessorFunctor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDefaultVectorPixelAccessorFunctor.h 2014-09-03 08:29:34.000000000 +0000 @@ -76,6 +76,9 @@ return image->GetVectorLength(); } + + DefaultVectorPixelAccessorFunctor () : m_Begin(ITK_NULLPTR) {} + /** Set the PixelAccessor. This is set at construction time by the image iterators. * The type PixelAccessorType is obtained from the ImageType over which the iterators * are templated. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDiffusionTensor3D.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDiffusionTensor3D.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDiffusionTensor3D.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDiffusionTensor3D.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -127,7 +127,7 @@ ::GetFractionalAnisotropy() const { // Computed as - // FA = vcl_sqrt(1.5*sum(sum(N.*N))/sum((sum(D.*D)))) + // FA = std::sqrt(1.5*sum(sum(N.*N))/sum((sum(D.*D)))) // where N = D - ((1/3)*trace(D)*eye(3,3)) // equation (28) in // http://lmi.bwh.harvard.edu/papers/pdfs/2002/westinMEDIA02.pdf @@ -138,7 +138,7 @@ const RealValueType trace = this->GetTrace(); const RealValueType anisotropy = 3.0 * isp - trace * trace; // sometimes anisotropy has been reported to be a small negative - // number, and then vcl_sqrt returns NaN. If it is a small + // number, and then std::sqrt returns NaN. If it is a small // negative number, the obvious thing is to round to zero. If // it is a larger negative number, I'm not sure what the proper // result would be. In either case, returning zero makes as much @@ -146,7 +146,7 @@ if(anisotropy > 0.0) { const RealValueType fractionalAnisotropy = - static_cast< RealValueType >( vcl_sqrt( anisotropy / ( 2.0 * isp ) ) ); + static_cast< RealValueType >( std::sqrt( anisotropy / ( 2.0 * isp ) ) ); return fractionalAnisotropy; } } @@ -180,10 +180,10 @@ } const RealValueType relativeAnisotropySquared = - static_cast< RealValueType >( anisotropy / ( vcl_sqrt(3.0) * trace ) ); + static_cast< RealValueType >( anisotropy / ( std::sqrt(3.0) * trace ) ); const RealValueType relativeAnisotropy = - static_cast< RealValueType >( vcl_sqrt(relativeAnisotropySquared) ); + static_cast< RealValueType >( std::sqrt(relativeAnisotropySquared) ); return relativeAnisotropy; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDirectory.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDirectory.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDirectory.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDirectory.h 2014-09-03 08:29:34.000000000 +0000 @@ -66,7 +66,7 @@ protected: Directory(); ~Directory(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: Directory(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDomainThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDomainThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkDomainThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkDomainThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ this->m_DomainPartitioner = DomainPartitionerType::New(); this->m_MultiThreader = MultiThreader::New(); this->m_NumberOfThreadsUsed = 0; - this->m_Associate = NULL; + this->m_Associate = ITK_NULLPTR; } template< typename TDomainPartitioner, typename TAssociate > @@ -149,7 +149,7 @@ subdomain); // Execute the actual method with appropriate sub-domain. - // If the threadID is greater than the total number of regions + // If the threadId is greater than the total number of regions // that PartitionDomain will create, don't use this thread. // Sometimes the threads dont break up very well and it is just // as efficient to leave a few threads idle. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkEllipsoidInteriorExteriorSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ EllipsoidInteriorExteriorSpatialFunction< VDimension, TInput > ::EllipsoidInteriorExteriorSpatialFunction() { - m_Orientations = NULL; + m_Orientations = ITK_NULLPTR; m_Axes.Fill(1.0f); // Lengths of ellipsoid axes. m_Center.Fill(0.0f); // Origin of ellipsoid } @@ -72,7 +72,7 @@ { orientationVector[j] = m_Orientations[i][j]; } - distanceSquared += vcl_pow( static_cast< double >( ( orientationVector * pointVector ) / ( .5 * m_Axes[i] ) ), + distanceSquared += std::pow( static_cast< double >( ( orientationVector * pointVector ) / ( .5 * m_Axes[i] ) ), static_cast< double >( 2 ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkEquivalencyTable.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkEquivalencyTable.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkEquivalencyTable.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkEquivalencyTable.h 2014-09-03 08:29:34.000000000 +0000 @@ -140,7 +140,7 @@ EquivalencyTable(const Self &); // purposely not implemented void operator=(const Self &); // purposely not implemented - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; HashTableType m_HashMap; }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkEventObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkEventObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkEventObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkEventObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -143,6 +143,7 @@ itkEventMacro(ModifiedEvent, AnyEvent) itkEventMacro(InitializeEvent, AnyEvent) itkEventMacro(IterationEvent, AnyEvent) +itkEventMacro(MultiResolutionIterationEvent,IterationEvent) itkEventMacro(PickEvent, AnyEvent) itkEventMacro(StartPickEvent, PickEvent) itkEventMacro(EndPickEvent, PickEvent) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkExceptionObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkExceptionObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkExceptionObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkExceptionObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -104,8 +104,7 @@ virtual unsigned int GetLine() const; /** Provide std::exception::what() implementation. */ - virtual const char * what() const - throw( ); + virtual const char * what() const throw( ) ITK_OVERRIDE; private: /** \class ReferenceCounterInterface @@ -165,7 +164,7 @@ * \ingroup ITKSystemObjects * \ingroup ITKCommon */ -class MemoryAllocationError:public ExceptionObject +class ITKCommon_EXPORT MemoryAllocationError:public ExceptionObject { public: /** Default constructor. Needed to ensure the exception object can be @@ -185,10 +184,9 @@ const std::string & loc):ExceptionObject(file, lineNumber, desc, loc) {} /** Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~MemoryAllocationError() - throw( ) {} + virtual ~MemoryAllocationError() throw( ); - virtual const char * GetNameOfClass() const + virtual const char * GetNameOfClass() const ITK_OVERRIDE { return "MemoryAllocationError"; } }; @@ -197,7 +195,7 @@ * \ingroup ITKSystemObjects * \ingroup ITKCommon */ -class RangeError:public ExceptionObject +class ITKCommon_EXPORT RangeError:public ExceptionObject { public: /** Default constructor. Needed to ensure the exception object can be @@ -211,10 +209,9 @@ RangeError(const std::string & file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {} /** Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~RangeError() - throw( ) {} + virtual ~RangeError() throw( ); - virtual const char * GetNameOfClass() const + virtual const char * GetNameOfClass() const ITK_OVERRIDE { return "RangeError"; } }; @@ -224,7 +221,7 @@ * \ingroup ITKSystemObjects * \ingroup ITKCommon */ -class InvalidArgumentError:public ExceptionObject +class ITKCommon_EXPORT InvalidArgumentError:public ExceptionObject { public: /** @@ -244,10 +241,9 @@ InvalidArgumentError(const std::string & file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {} /** Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~InvalidArgumentError() - throw( ) {} + virtual ~InvalidArgumentError() throw( ); - virtual const char * GetNameOfClass() const + virtual const char * GetNameOfClass() const ITK_OVERRIDE { return "InvalidArgumentError"; } }; @@ -256,7 +252,7 @@ * \ingroup ITKSystemObjects * \ingroup ITKCommon */ -class IncompatibleOperandsError:public ExceptionObject +class ITKCommon_EXPORT IncompatibleOperandsError:public ExceptionObject { public: /** Default constructor. Needed to ensure the exception object can be @@ -270,10 +266,9 @@ IncompatibleOperandsError(const std::string & file, unsigned int lineNumber):ExceptionObject(file, lineNumber) {} /** Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~IncompatibleOperandsError() - throw( ) {} + virtual ~IncompatibleOperandsError() throw( ); - virtual const char * GetNameOfClass() const + virtual const char * GetNameOfClass() const ITK_OVERRIDE { return "IncompatibleOperandsError"; } }; @@ -282,7 +277,7 @@ * \ingroup ITKSystemObjects * \ingroup ITKCommon */ -class ProcessAborted:public ExceptionObject +class ITKCommon_EXPORT ProcessAborted:public ExceptionObject { public: /** Default constructor. Needed to ensure the exception object can be @@ -305,10 +300,9 @@ } /** Virtual destructor needed for subclasses. Has to have empty throw(). */ - virtual ~ProcessAborted() - throw( ) {} + virtual ~ProcessAborted() throw( ); - virtual const char * GetNameOfClass() const + virtual const char * GetNameOfClass() const ITK_OVERRIDE { return "ProcessAborted"; } }; } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFastMutexLock.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFastMutexLock.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFastMutexLock.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFastMutexLock.h 2014-09-03 08:29:34.000000000 +0000 @@ -82,7 +82,7 @@ ~FastMutexLock() {} SimpleFastMutexLock m_SimpleFastMutexLock; - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: FastMutexLock(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFileOutputWindow.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFileOutputWindow.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFileOutputWindow.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFileOutputWindow.h 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ itkTypeMacro(FileOutputWindow, OutputWindow); /** Send a string to display. */ - virtual void DisplayText(const char *); + virtual void DisplayText(const char *) ITK_OVERRIDE; /** Set the filename for the log file */ itkSetStringMacro(FileName); @@ -75,7 +75,7 @@ protected: FileOutputWindow(); virtual ~FileOutputWindow(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void Initialize(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFiniteCylinderSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFiniteCylinderSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFiniteCylinderSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFiniteCylinderSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ { // a normalized {1,1,...1} vector is // { 1.0 / sqrt( VDmim ), ... } - const double orientationVal = 1.0 / vcl_sqrt(static_cast(VDimension)); + const double orientationVal = 1.0 / std::sqrt(static_cast(VDimension)); m_Orientation.Fill(orientationVal); m_NormalizedOrientation.Fill(orientationVal); m_AxisLength = 1.0f; // Length of cylinder axis. @@ -59,7 +59,7 @@ { norm += this->m_Orientation[i] * this->m_Orientation[i]; } - norm = vcl_sqrt(norm); + norm = std::sqrt(norm); if(norm == 0.0) // avoid divide by zero { itkExceptionMacro(<< "Degenerate orientation vector " << this->m_Orientation); @@ -97,8 +97,8 @@ //the point is within the length of the cylinder along the medial axis const double distanceFromCenter = dot_product( medialAxisVector.GetVnlVector(), pointVector.GetVnlVector() ); - if ( vcl_fabs(distanceFromCenter) <= ( halfAxisLength ) - && m_Radius >= vcl_sqrt( vcl_pow(pointVector.GetVnlVector().magnitude(), 2.0) - vcl_pow(distanceFromCenter, 2.0) ) ) + if ( std::fabs(distanceFromCenter) <= ( halfAxisLength ) + && m_Radius >= std::sqrt( std::pow(pointVector.GetVnlVector().magnitude(), 2.0) - std::pow(distanceFromCenter, 2.0) ) ) { return 1; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ * assigned to one another, and size information is known for function * returns. * - * \tparam TValueType Element type stored at each location in the array. + * \tparam TValue Element type stored at each location in the array. * \tparam VLength = Length of the array. * * The length of the array is fixed at compile time. If you wish to @@ -46,7 +46,7 @@ * \wikiexample{Utilities/FixedArray,C-style array} * \endwiki */ -template< typename TValueType, unsigned int VLength = 3 > +template< typename TValue, unsigned int VLength = 3 > class FixedArray { public: @@ -57,7 +57,7 @@ itkStaticConstMacro(Dimension, unsigned int, VLength); /** The element type stored at each location in the FixedArray. */ - typedef TValueType ValueType; + typedef TValue ValueType; /** A type representing the C-array version of this FixedArray. */ typedef ValueType CArray[VLength]; @@ -142,7 +142,7 @@ Iterator i = this->Begin(); while ( i != this->End() ) { - *i++ = static_cast< TValueType >( *input++ ); + *i++ = static_cast< TValue >( *input++ ); } } @@ -169,13 +169,13 @@ template< typename TFixedArrayValueType > FixedArray & operator=(const FixedArray< TFixedArrayValueType, VLength > & r) { - if ( (void *)r.Begin() != (void *)m_InternalArray ) + if ( (const void *)r.Begin() != (const void *)m_InternalArray ) { typename FixedArray< TFixedArrayValueType, VLength >::ConstIterator input = r.Begin(); Iterator i = this->Begin(); while ( i != this->End() ) { - *i++ = static_cast< TValueType >( *input++ ); + *i++ = static_cast< TValue >( *input++ ); } } return *this; @@ -200,8 +200,20 @@ const_reference operator[](unsigned short index) const { return m_InternalArray[index]; } reference operator[](int index) { return m_InternalArray[index]; } const_reference operator[](int index) const { return m_InternalArray[index]; } +// false positive warnings with GCC 4.9 +#if defined( __GNUC__ ) +#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif +#endif reference operator[](unsigned int index) { return m_InternalArray[index]; } const_reference operator[](unsigned int index) const { return m_InternalArray[index]; } +#if defined( __GNUC__ ) +#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 ) +#pragma GCC diagnostic pop +#endif +#endif reference operator[](long index) { return m_InternalArray[index]; } const_reference operator[](long index) const { return m_InternalArray[index]; } reference operator[](unsigned long index) { return m_InternalArray[index]; } @@ -257,8 +269,8 @@ static FixedArray Filled(const ValueType &); }; -template< typename TValueType, unsigned int VLength > -std::ostream & operator<<(std::ostream & os, const FixedArray< TValueType, VLength > & arr); +template< typename TValue, unsigned int VLength > +std::ostream & operator<<(std::ostream & os, const FixedArray< TValue, VLength > & arr); } // namespace itk #ifndef ITK_MANUAL_INSTANTIATION diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFixedArray.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,16 +26,16 @@ * Default constructor uses compiler's default initialization of memory. * For efficiency, no initialization to zero is done. */ -template< typename TValueType, unsigned int VLength > -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +FixedArray< TValue, VLength > ::FixedArray() {} /** * Constructor to initialize entire array to one value. */ -template< typename TValueType, unsigned int VLength > -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +FixedArray< TValue, VLength > ::FixedArray(const ValueType & r) { for ( Iterator i = Begin(); i != End(); ++i ) @@ -49,8 +49,8 @@ * Values are copied individually instead of with a binary copy. This * allows the ValueType's assignment operator to be executed. */ -template< typename TValueType, unsigned int VLength > -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +FixedArray< TValue, VLength > ::FixedArray(const ValueType r[VLength]) { ConstIterator input = r; @@ -67,9 +67,9 @@ * Values are copied individually instead of with a binary copy. This * allows the ValueType's assignment operator to be executed. */ -template< typename TValueType, unsigned int VLength > -FixedArray< TValueType, VLength > & -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +FixedArray< TValue, VLength > & +FixedArray< TValue, VLength > ::operator=(const ValueType r[VLength]) { if ( r != m_InternalArray ) @@ -87,9 +87,9 @@ /** * Operator != compares different types of arrays. */ -template< typename TValueType, unsigned int VLength > +template< typename TValue, unsigned int VLength > bool -FixedArray< TValueType, VLength > +FixedArray< TValue, VLength > ::operator==(const FixedArray & r) const { ConstIterator i = this->Begin(); @@ -111,9 +111,9 @@ /** * Get an Iterator for the beginning of the FixedArray. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::Iterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::Iterator +FixedArray< TValue, VLength > ::Begin() { return Iterator(m_InternalArray); @@ -122,9 +122,9 @@ /** * Get a ConstIterator for the beginning of the FixedArray. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::ConstIterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::ConstIterator +FixedArray< TValue, VLength > ::Begin() const { return ConstIterator(m_InternalArray); @@ -133,9 +133,9 @@ /** * Get an Iterator for the end of the FixedArray. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::Iterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::Iterator +FixedArray< TValue, VLength > ::End() { return Iterator(m_InternalArray + VLength); @@ -144,9 +144,9 @@ /** * Get a ConstIterator for the end of the FixedArray. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::ConstIterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::ConstIterator +FixedArray< TValue, VLength > ::End() const { return ConstIterator(m_InternalArray + VLength); @@ -155,9 +155,9 @@ /** * Get a begin ReverseIterator. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::ReverseIterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::ReverseIterator +FixedArray< TValue, VLength > ::rBegin() { return ReverseIterator(m_InternalArray + VLength); @@ -166,9 +166,9 @@ /** * Get a begin ConstReverseIterator. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::ConstReverseIterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::ConstReverseIterator +FixedArray< TValue, VLength > ::rBegin() const { return ConstReverseIterator(m_InternalArray + VLength); @@ -177,9 +177,9 @@ /** * Get an end ReverseIterator. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::ReverseIterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::ReverseIterator +FixedArray< TValue, VLength > ::rEnd() { return ReverseIterator(m_InternalArray); @@ -188,9 +188,9 @@ /** * Get an end ConstReverseIterator. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::ConstReverseIterator -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::ConstReverseIterator +FixedArray< TValue, VLength > ::rEnd() const { return ConstReverseIterator(m_InternalArray); @@ -199,9 +199,9 @@ /** * Get the size of the FixedArray. */ -template< typename TValueType, unsigned int VLength > -typename FixedArray< TValueType, VLength >::SizeType -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +typename FixedArray< TValue, VLength >::SizeType +FixedArray< TValue, VLength > ::Size() const { return VLength; @@ -210,9 +210,9 @@ /** * Fill all elements of the array with the given value. */ -template< typename TValueType, unsigned int VLength > +template< typename TValue, unsigned int VLength > void -FixedArray< TValueType, VLength > +FixedArray< TValue, VLength > ::Fill(const ValueType & value) { Iterator i = this->Begin(); @@ -226,9 +226,9 @@ /** * Return an FixedArray with all elements assigned to the given value. */ -template< typename TValueType, unsigned int VLength > -FixedArray< TValueType, VLength > -FixedArray< TValueType, VLength > +template< typename TValue, unsigned int VLength > +FixedArray< TValue, VLength > +FixedArray< TValue, VLength > ::Filled(const ValueType & value) { FixedArray< ValueType, VLength > array; @@ -236,8 +236,8 @@ return array; } -template< typename TValueType, unsigned int VLength > -std::ostream & operator<<(std::ostream & os, const FixedArray< TValueType, VLength > & arr) +template< typename TValue, unsigned int VLength > +std::ostream & operator<<(std::ostream & os, const FixedArray< TValue, VLength > & arr) { os << "["; if ( VLength == 1 ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledFunctionConditionalConstIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -65,6 +65,7 @@ // Set up the temporary image this->InitializeIterator(); + } template< typename TImage, typename TFunction > @@ -72,6 +73,9 @@ FloodFilledFunctionConditionalConstIterator< TImage, TFunction > ::InitializeIterator() { + m_FoundUncheckedNeighbor = false; + m_IsValidIndex = false; + // Get the origin and spacing from the image in simple arrays m_ImageOrigin = this->m_Image->GetOrigin(); m_ImageSpacing = this->m_Image->GetSpacing(); @@ -84,8 +88,7 @@ m_TemporaryPointer->SetLargestPossibleRegion(tempRegion); m_TemporaryPointer->SetBufferedRegion(tempRegion); m_TemporaryPointer->SetRequestedRegion(tempRegion); - m_TemporaryPointer->Allocate(); - m_TemporaryPointer->FillBuffer(NumericTraits< typename TTempImage::PixelType >::Zero); + m_TemporaryPointer->Allocate(true); // initialize buffer to zero // Initialize the queue by adding the start index assuming one of // the m_Seeds is "inside" This might not be true, in which diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledSpatialFunctionConditionalConstIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledSpatialFunctionConditionalConstIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledSpatialFunctionConditionalConstIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFloodFilledSpatialFunctionConditionalConstIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -113,7 +113,7 @@ unsigned int counter; unsigned int counterCopy; unsigned int dim = TImage::ImageDimension; - unsigned int numReps = static_cast< unsigned int >( vcl_pow( + unsigned int numReps = static_cast< unsigned int >( std::pow( static_cast< double >( 2.0 ), static_cast< double >( dim ) ) ); @@ -160,7 +160,7 @@ unsigned int counter; unsigned int counterCopy; unsigned int dim = TImage::ImageDimension; - unsigned int numReps = static_cast< unsigned int >( vcl_pow( + unsigned int numReps = static_cast< unsigned int >( std::pow( static_cast< double >( 2.0 ), static_cast< double >( dim ) ) ); IndexType tempIndex; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFrustumSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFrustumSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkFrustumSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkFrustumSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -77,22 +77,22 @@ const double dy = relativePosition[1]; const double dz = relativePosition[2]; - const double distanceXZ = vcl_sqrt(dx * dx + dz * dz); + const double distanceXZ = std::sqrt(dx * dx + dz * dz); - const double deg2rad = vcl_atan(1.0f) / 45.0; + const double deg2rad = std::atan(1.0f) / 45.0; // Check planes along Y - const double angleY = vcl_atan2(dy, distanceXZ); - if ( vcl_fabs(angleY) > m_ApertureAngleY * deg2rad ) + const double angleY = std::atan2(dy, distanceXZ); + if ( std::fabs(angleY) > m_ApertureAngleY * deg2rad ) { return 0; } // Check planes along X - const double angleX = vcl_atan2(dx, dz); + const double angleX = std::atan2(dx, dz); - if ( vcl_cos(angleX + ( 180.0 + m_AngleZ ) * deg2rad) < - vcl_cos(deg2rad * m_ApertureAngleX) ) + if ( std::cos(angleX + ( 180.0 + m_AngleZ ) * deg2rad) < + std::cos(deg2rad * m_ApertureAngleX) ) { return 0; } @@ -105,22 +105,22 @@ const double dy = relativePosition[1]; const double dz = relativePosition[2]; - const double distanceYZ = vcl_sqrt(dy * dy + dz * dz); + const double distanceYZ = std::sqrt(dy * dy + dz * dz); - const double deg2rad = vcl_atan(1.0f) / 45.0; + const double deg2rad = std::atan(1.0f) / 45.0; // Check planes along X - const double angleX = vcl_atan2(dx, distanceYZ); - if ( vcl_fabs(angleX) > m_ApertureAngleX * deg2rad ) + const double angleX = std::atan2(dx, distanceYZ); + if ( std::fabs(angleX) > m_ApertureAngleX * deg2rad ) { return 0; } // Check planes along Y - const double angleY = vcl_atan2(dy, dz); + const double angleY = std::atan2(dy, dz); - if ( vcl_cos(angleY + ( 180.0 + m_AngleZ ) * deg2rad) < - vcl_cos(deg2rad * m_ApertureAngleY) ) + if ( std::cos(angleY + ( 180.0 + m_AngleZ ) * deg2rad) < + std::cos(deg2rad * m_ApertureAngleY) ) { return 0; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianDerivativeSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,7 @@ prefixDenom *= m_Sigma[i]; } - prefixDenom *= 2 * vcl_pow(2 * vnl_math::pi, VImageDimension / 2.0); + prefixDenom *= 2 * std::pow(2 * vnl_math::pi, VImageDimension / 2.0); } else { @@ -75,7 +75,7 @@ / ( 2 * m_Sigma[m_Direction] * m_Sigma[m_Direction] ); } - double value = -2 * ( position[m_Direction] - m_Mean[m_Direction] ) * m_Scale * ( 1 / prefixDenom ) * vcl_exp( + double value = -2 * ( position[m_Direction] - m_Mean[m_Direction] ) * m_Scale * ( 1 / prefixDenom ) * std::exp( -1 * suffixExp); return (TOutput)value; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianKernelFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianKernelFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianKernelFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianKernelFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -55,10 +55,10 @@ /** Evaluate the function. */ inline TRealValueType Evaluate(const TRealValueType & u) const - { return ( vcl_exp( static_cast< TRealValueType >(-0.5) * vnl_math_sqr(u) ) * m_Factor ); } + { return ( std::exp( static_cast< TRealValueType >(-0.5) * vnl_math_sqr(u) ) * m_Factor ); } protected: - GaussianKernelFunction(): m_Factor( NumericTraits< TRealValueType >::One / vcl_sqrt(static_cast< TRealValueType >(2.0 * vnl_math::pi )) ) {}; + GaussianKernelFunction(): m_Factor( NumericTraits< TRealValueType >::One / std::sqrt(static_cast< TRealValueType >(2.0 * vnl_math::pi )) ) {}; virtual ~GaussianKernelFunction() {}; void PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianOperator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianOperator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianOperator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianOperator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ typename CoefficientVector::iterator it; - const double et = vcl_exp(-m_Variance); + const double et = std::exp(-m_Variance); const double cap = 1.0 - m_MaximumError; // Create the kernel coefficients as a std::vector @@ -84,7 +84,7 @@ GaussianOperator< TPixel, VDimension, TAllocator > ::ModifiedBesselI0(double y) { - const double d = vcl_fabs(y); + const double d = std::fabs(y); double accumulator; if ( d < 3.75 ) @@ -98,7 +98,7 @@ else { const double m = 3.75 / d; - accumulator = ( vcl_exp(d) / vcl_sqrt(d) ) * ( 0.39894228 + m * ( 0.1328592e-1 + accumulator = ( std::exp(d) / std::sqrt(d) ) * ( 0.39894228 + m * ( 0.1328592e-1 + m * ( 0.225319e-2 + m * ( -0.157565e-2 + m * ( 0.916281e-2 @@ -123,7 +123,7 @@ GaussianOperator< TPixel, VDimension, TAllocator > ::ModifiedBesselI1(double y) { - const double d = vcl_fabs(y); + const double d = std::fabs(y); double accumulator; if ( d < 3.75 ) @@ -143,7 +143,7 @@ accumulator = 0.39894228 + m * ( -0.3988024e-1 + m * ( -0.362018e-2 + m * ( 0.163801e-2 + m * ( -0.1031555e-1 + m * accumulator ) ) ) ); - accumulator *= ( vcl_exp(d) / vcl_sqrt(d) ); + accumulator *= ( std::exp(d) / std::sqrt(d) ); } if ( y < 0.0 ) @@ -179,16 +179,16 @@ } else { - toy = 2.0 / vcl_fabs(y); + toy = 2.0 / std::fabs(y); qip = accumulator = 0.0; qi = 1.0; - for ( j = 2 * ( n + (int)vcl_sqrt(ACCURACY * n) ); j > 0; j-- ) + for ( j = 2 * ( n + (int)std::sqrt(ACCURACY * n) ); j > 0; j-- ) { qim = qip + j * toy * qi; qip = qi; qi = qim; - if ( vcl_fabs(qi) > 1.0e10 ) + if ( std::fabs(qi) > 1.0e10 ) { accumulator *= 1.0e-10; qi *= 1.0e-10; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkGaussianSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -54,7 +54,7 @@ if ( m_Normalized ) { - const double squareRootOfTwoPi = vcl_sqrt(2.0 * vnl_math::pi); + const double squareRootOfTwoPi = std::sqrt(2.0 * vnl_math::pi); for ( unsigned int i = 0; i < VImageDimension; i++ ) { @@ -70,7 +70,7 @@ / ( 2 * m_Sigma[i] * m_Sigma[i] ); } - double value = m_Scale * ( 1 / prefixDenom ) * vcl_exp(-1 * suffixExp); + double value = m_Scale * ( 1 / prefixDenom ) * std::exp(-1 * suffixExp); return (TOutput)value; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkHexahedronCell.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkHexahedronCell.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkHexahedronCell.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkHexahedronCell.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -397,7 +397,7 @@ d = vnl_determinant(mat); //d=vtkMath::Determinant3x3(rcol,scol,tcol); - if ( vcl_abs(d) < 1.e-20 ) + if ( std::abs(d) < 1.e-20 ) { return false; } @@ -438,17 +438,17 @@ } // check for convergence - if ( ( ( vcl_abs(pcoords[0] - params[0]) ) < ITK_HEX_CONVERGED ) - && ( ( vcl_abs(pcoords[1] - params[1]) ) < ITK_HEX_CONVERGED ) - && ( ( vcl_abs(pcoords[2] - params[2]) ) < ITK_HEX_CONVERGED ) ) + if ( ( ( std::abs(pcoords[0] - params[0]) ) < ITK_HEX_CONVERGED ) + && ( ( std::abs(pcoords[1] - params[1]) ) < ITK_HEX_CONVERGED ) + && ( ( std::abs(pcoords[2] - params[2]) ) < ITK_HEX_CONVERGED ) ) { converged = 1; } // Test for bad divergence (S.Hirschberg 11.12.2001) - else if ( ( vcl_abs(pcoords[0]) > ITK_DIVERGED ) - || ( vcl_abs(pcoords[1]) > ITK_DIVERGED ) - || ( vcl_abs(pcoords[2]) > ITK_DIVERGED ) ) + else if ( ( std::abs(pcoords[0]) > ITK_DIVERGED ) + || ( std::abs(pcoords[1]) > ITK_DIVERGED ) + || ( std::abs(pcoords[2]) > ITK_DIVERGED ) ) { return -1; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.h 2014-09-03 08:29:34.000000000 +0000 @@ -175,6 +175,34 @@ }; /** \endcond */ + /** Unary functor just for static_cast operator */ + template + struct StaticCast + : public std::unary_function + { + TOutputType operator() (const TInputType i) { return static_cast(i); } + }; + + + /** Function to dispatch to std::copy or std::transform. */ + template + static TType* CopyHelper(const TType *first, const TType *last, TType *result) + { + // Note: On some MS compilers the following may generate a + // warning. Please include itkMacro.h before or + // another stl header to avoid. + return std::copy(first, last, result); + } + +/** \cond HIDE_SPECIALIZATION_DOCUMENTATION */ + template + static TOutputType* CopyHelper(const TInputType *first, const TInputType *last, TOutputType *result) + { + return std::transform(first, last, result, StaticCast()); + } +/** \endcond */ + + }; } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageAlgorithm.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -131,10 +131,7 @@ const typename InputImageType::InternalPixelType* inBuffer = in + inOffset*NumberOfInternalComponents; typename OutputImageType::InternalPixelType* outBuffer = out + outOffset*NumberOfInternalComponents; - // Note: On some MS compilers the following may generate a - // warning. Please include itkMacro.h before or - // another stl header to avoid. - std::copy(inBuffer, + CopyHelper(inBuffer, inBuffer+sizeOfChunkInInternalComponents , outBuffer); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -164,7 +164,7 @@ typedef Matrix< SpacePrecisionType, VImageDimension, VImageDimension > DirectionType; /** Restore object to initialized state. */ - void Initialize(); + virtual void Initialize() ITK_OVERRIDE; /** Image dimension. The dimension of an image is fixed at construction. */ static unsigned int GetImageDimension() @@ -232,8 +232,9 @@ * * This method should be pure virtual, if backwards compatibility * was not required. + * */ - virtual void Allocate() {} + virtual void Allocate(bool initialize=false); /** Set the region object that defines the size and starting index * for the largest possible region this image could represent. This @@ -279,7 +280,7 @@ * the object to be modified. This method is called internally by * the pipeline and therefore bypasses the modified time * calculation. */ - virtual void SetRequestedRegion( const DataObject *data ); + virtual void SetRequestedRegion( const DataObject *data ) ITK_OVERRIDE; /** Get the region object that defines the size and starting index * for the region of the image requested (i.e., the region of the @@ -589,7 +590,7 @@ * ImageBase has more meta-data than its DataObject. Thus, it must * provide its own version of CopyInformation() in order to copy the * LargestPossibleRegion from the input parameter. */ - virtual void CopyInformation(const DataObject *data); + virtual void CopyInformation(const DataObject *data) ITK_OVERRIDE; /** Graft the data and information from one image to another. This * is a convenience method to setup a second image with all the meta @@ -601,7 +602,7 @@ * simply calls CopyInformation() and copies the region ivars. * Subclasses of ImageBase are responsible for copying the pixel * container. */ - virtual void Graft(const DataObject *data); + virtual void Graft(const DataObject *data) ITK_OVERRIDE; /** Update the information for this DataObject so that it can be used * as an output of a ProcessObject. This method is used the pipeline @@ -610,7 +611,7 @@ * ProcessObject::UpdateOutputInformation() which determines modified * times, LargestPossibleRegions, and any extra meta data like spacing, * origin, etc. */ - virtual void UpdateOutputInformation(); + virtual void UpdateOutputInformation() ITK_OVERRIDE; /** UpdateOutputData() is part of the pipeline infrastructure to * communicate between ProcessObjects and DataObjects. The method of @@ -619,12 +620,12 @@ * input's requested region to zero, to indicate that it does not * need to be updated or executed. */ - virtual void UpdateOutputData(); + virtual void UpdateOutputData() ITK_OVERRIDE; /** Set the RequestedRegion to the LargestPossibleRegion. This * forces a filter to produce all of the output in one execution * (i.e. not streaming) on the next call to Update(). */ - virtual void SetRequestedRegionToLargestPossibleRegion(); + virtual void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE; /** Determine whether the RequestedRegion is outside of the * BufferedRegion. This method returns true if the RequestedRegion @@ -635,7 +636,7 @@ * inside the BufferedRegion from the previous execution (and the * current filter is up to date), then a given filter does not need * to re-execute */ - virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); + virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE; /** Verify that the RequestedRegion is within the * LargestPossibleRegion. If the RequestedRegion is not within the @@ -645,7 +646,7 @@ * used by PropagateRequestedRegion(). PropagateRequestedRegion() * throws a InvalidRequestedRegionError exception is the requested * region is not within the LargestPossibleRegion. */ - virtual bool VerifyRequestedRegion(); + virtual bool VerifyRequestedRegion() ITK_OVERRIDE; /** INTERNAL This method is used internally by filters to copy meta-data from * the output to the input. Users should not have a need to use this method. @@ -671,7 +672,7 @@ protected: ImageBase(); ~ImageBase(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Calculate the offsets needed to move from one pixel to the next * along a row, column, slice, volume, etc. These offsets are based diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,6 +53,13 @@ m_PhysicalPointToIndex.SetIdentity(); } +template< unsigned int VImageDimension > +void +ImageBase< VImageDimension > +::Allocate(bool) +{ +} + /** * */ @@ -302,16 +309,7 @@ if ( data ) { // Attempt to cast data to an ImageBase - const ImageBase< VImageDimension > *imgData; - - try - { - imgData = dynamic_cast< const ImageBase< VImageDimension > * >( data ); - } - catch ( ... ) - { - return; - } + const ImageBase< VImageDimension > * const imgData = dynamic_cast< const ImageBase< VImageDimension > * >( data ); if ( imgData ) { @@ -341,16 +339,7 @@ { typedef ImageBase< VImageDimension > ImageBaseType; - const ImageBaseType *image; - - try - { - image = dynamic_cast< const ImageBaseType * >( data ); - } - catch ( ... ) - { - return; - } + const ImageBaseType *image = dynamic_cast< const ImageBaseType * >( data ); if ( !image ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -133,8 +133,8 @@ m_PixelAccessor(), m_PixelAccessorFunctor() { - m_Image = 0; - m_Buffer = 0; + m_Image = ITK_NULLPTR; + m_Buffer = ITK_NULLPTR; m_Offset = 0; m_BeginOffset = 0; m_EndOffset = 0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIteratorWithIndex.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIteratorWithIndex.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIteratorWithIndex.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageConstIteratorWithIndex.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,9 +29,9 @@ ImageConstIteratorWithIndex< TImage > ::ImageConstIteratorWithIndex() { - m_Position = 0; - m_Begin = 0; - m_End = 0; + m_Position = ITK_NULLPTR; + m_Begin = ITK_NULLPTR; + m_End = ITK_NULLPTR; m_Remaining = false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.h 2014-09-03 08:29:34.000000000 +0000 @@ -86,7 +86,7 @@ protected: ImageDuplicator(); virtual ~ImageDuplicator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: ImageDuplicator(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageDuplicator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ ImageDuplicator< TInputImage > ::ImageDuplicator() { - m_InputImage = NULL; - m_Output = NULL; + m_InputImage = ITK_NULLPTR; + m_Output = ITK_NULLPTR; m_InternalImageTime = 0; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImage.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImage.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImage.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImage.h 2014-09-03 08:29:34.000000000 +0000 @@ -169,7 +169,7 @@ /** Allocate the image memory. The size of the image must * already be set, e.g. by calling SetRegions(). */ - void Allocate(); + virtual void Allocate(bool initializePixels = false) ITK_OVERRIDE; /** Restore the data object to its initial state. This means releasing * memory. */ @@ -227,9 +227,9 @@ /** Return a pointer to the beginning of the buffer. This is used by * the image iterator class. */ virtual TPixel * GetBufferPointer() - { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; } + { return m_Buffer ? m_Buffer->GetBufferPointer() : ITK_NULLPTR; } virtual const TPixel * GetBufferPointer() const - { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; } + { return m_Buffer ? m_Buffer->GetBufferPointer() : ITK_NULLPTR; } /** Return a pointer to the container. */ PixelContainer * GetPixelContainer() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImage.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,18 +44,17 @@ m_Buffer = PixelContainer::New(); } -//---------------------------------------------------------------------------- template< typename TPixel, unsigned int VImageDimension > void Image< TPixel, VImageDimension > -::Allocate() +::Allocate(bool initializePixels) { SizeValueType num; this->ComputeOffsetTable(); num = static_cast(this->GetOffsetTable()[VImageDimension]); - m_Buffer->Reserve(num); + m_Buffer->Reserve(num, initializePixels); } template< typename TPixel, unsigned int VImageDimension > @@ -113,16 +112,7 @@ if ( data ) { // Attempt to cast data to an Image - const Self *imgData; - - try - { - imgData = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - return; - } + const Self * const imgData = dynamic_cast< const Self * >( data ); if ( imgData ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageIORegion.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageIORegion.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageIORegion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageIORegion.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ unsigned int GetRegionDimension() const; /** Return the region type. Images are described with structured regions. */ - virtual RegionType GetRegionType() const; + virtual RegionType GetRegionType() const ITK_OVERRIDE; /** Constructor. ImageIORegion is a lightweight object that is not reference * counted, so the constructor is public. */ @@ -152,7 +152,7 @@ * including superclasses. Typically not called by the user (use Print() * instead) but used in the hierarchical print process to combine the * output of several classes. */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: unsigned int m_ImageDimension; @@ -160,13 +160,14 @@ SizeType m_Size; }; + // Declare operator<< extern ITKCommon_EXPORT std::ostream & operator<<(std::ostream & os, const ImageIORegion & region); + /** \class ImageIORegionAdaptor * \brief Helper class for converting ImageRegions into ImageIORegions and back. * - * * \ingroup ITKCommon */ template< unsigned int VDimension > @@ -197,12 +198,12 @@ const unsigned int ioDimension = outIORegion.GetImageDimension(); const unsigned int imageDimension = VDimension; - unsigned int minDimension = ( ioDimension > imageDimension ) ? imageDimension : ioDimension; + const unsigned int minDimension = std::min( ioDimension, imageDimension ); - ImageSizeType size = inImageRegion.GetSize(); - ImageIndexType index = inImageRegion.GetIndex(); + const ImageSizeType & size = inImageRegion.GetSize(); + const ImageIndexType & index = inImageRegion.GetIndex(); - for ( unsigned int i = 0; i < minDimension; i++ ) + for( unsigned int i = 0; i < minDimension; ++i ) { outIORegion.SetSize(i, size[i]); outIORegion.SetIndex(i, index[i] - largestRegionIndex[i]); @@ -211,7 +212,7 @@ // // Fill in the remaining codimension (if any) with default values // - for ( unsigned int k = minDimension; k < ioDimension; k++ ) + for( unsigned int k = minDimension; k < ioDimension; ++k ) { outIORegion.SetSize(k, 1); // Note that default size in IO is 1 not 0 outIORegion.SetIndex(k, 0); @@ -242,9 +243,9 @@ const unsigned int ioDimension = inIORegion.GetImageDimension(); const unsigned int imageDimension = VDimension; - unsigned int minDimension = ( ioDimension > imageDimension ) ? imageDimension : ioDimension; + const unsigned int minDimension = std::min( ioDimension, imageDimension ); - for ( unsigned int i = 0; i < minDimension; i++ ) + for( unsigned int i = 0; i < minDimension; ++i ) { size[i] = inIORegion.GetSize(i); index[i] = inIORegion.GetIndex(i) + largestRegionIndex[i]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageLinearConstIteratorWithIndex.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageLinearConstIteratorWithIndex.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageLinearConstIteratorWithIndex.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageLinearConstIteratorWithIndex.h 2014-09-03 08:29:34.000000000 +0000 @@ -130,7 +130,11 @@ typedef typename PixelContainer::Pointer PixelContainerPointer; /** Default constructor. Needed since we provide a cast constructor. */ - ImageLinearConstIteratorWithIndex():ImageConstIteratorWithIndex< TImage >(), m_Direction(0) {} + ImageLinearConstIteratorWithIndex() : + ImageConstIteratorWithIndex< TImage >(), + m_Jump(0), + m_Direction(0) + {} /** Constructor establishes an iterator to walk a particular image and a * particular region of that image. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRandomNonRepeatingConstIteratorWithIndex.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ m_NumberOfPixelsInRegion = 0L; m_NumberOfSamplesRequested = 0L; m_NumberOfSamplesDone = 0L; - m_Permutation = NULL; + m_Permutation = ITK_NULLPTR; } /** Constructor establishes an iterator to walk a particular image and a diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegion.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegion.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegion.h 2014-09-03 08:29:34.000000000 +0000 @@ -104,7 +104,7 @@ typedef ImageRegion< itkGetStaticConstMacro(SliceDimension) > SliceRegion; /** Return the region type. Images are described with structured regions. */ - virtual typename Superclass::RegionType GetRegionType() const + virtual typename Superclass::RegionType GetRegionType() const ITK_OVERRIDE { return Superclass::ITK_STRUCTURED_REGION; } /** Constructor. ImageRegion is a lightweight object that is not reference @@ -308,7 +308,7 @@ * including superclasses. Typically not called by the user (use Print() * instead) but used in the hierarchical print process to combine the * output of several classes. */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: IndexType m_Index; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterBase.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -143,7 +143,7 @@ IndexValueType regionIndex[], SizeValueType regionSize[] ) const = 0; - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: ImageRegionSplitterBase(const ImageRegionSplitterBase &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterDirection.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterDirection.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterDirection.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterDirection.h 2014-09-03 08:29:34.000000000 +0000 @@ -63,15 +63,15 @@ virtual unsigned int GetNumberOfSplitsInternal(unsigned int dim, const IndexValueType regionIndex[], const SizeValueType regionSize[], - unsigned int requestedNumber) const; + unsigned int requestedNumber) const ITK_OVERRIDE; virtual unsigned int GetSplitInternal(unsigned int dim, unsigned int i, unsigned int numberOfPieces, IndexValueType regionIndex[], - SizeValueType regionSize[]) const; + SizeValueType regionSize[]) const ITK_OVERRIDE; - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: ImageRegionSplitterDirection(const ImageRegionSplitterDirection &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterMultidimensional.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterMultidimensional.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterMultidimensional.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterMultidimensional.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,15 +78,15 @@ virtual unsigned int GetNumberOfSplitsInternal(unsigned int dim, const IndexValueType regionIndex[], const SizeValueType regionSize[], - unsigned int requestedNumber) const; + unsigned int requestedNumber) const ITK_OVERRIDE; virtual unsigned int GetSplitInternal(unsigned int dim, unsigned int i, unsigned int numberOfPieces, IndexValueType regionIndex[], - SizeValueType regionSize[]) const; + SizeValueType regionSize[]) const ITK_OVERRIDE; - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: ImageRegionSplitterMultidimensional(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterSlowDimension.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterSlowDimension.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterSlowDimension.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageRegionSplitterSlowDimension.h 2014-09-03 08:29:34.000000000 +0000 @@ -66,13 +66,13 @@ virtual unsigned int GetNumberOfSplitsInternal( unsigned int dim, const IndexValueType regionIndex[], const SizeValueType regionSize[], - unsigned int requestedNumber ) const; + unsigned int requestedNumber ) const ITK_OVERRIDE; virtual unsigned int GetSplitInternal( unsigned int dim, unsigned int i, unsigned int numberOfPieces, IndexValueType regionIndex[], - SizeValueType regionSize[] ) const; + SizeValueType regionSize[] ) const ITK_OVERRIDE; private: ImageRegionSplitterSlowDimension(const ImageRegionSplitterSlowDimension &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageScanlineConstIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageScanlineConstIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageScanlineConstIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageScanlineConstIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -174,7 +174,7 @@ */ void GoToBeginOfLine(void) { - this->Offset = m_SpanBeginOffset; + this->m_Offset = m_SpanBeginOffset; } /** Go to the past end pixel of the current line. @@ -187,7 +187,7 @@ */ void GoToEndOfLine(void) { - this->Offset = m_SpanEndOffset; + this->m_Offset = m_SpanEndOffset; } /** Test if the index is at the end of line diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageSliceConstIteratorWithIndex.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageSliceConstIteratorWithIndex.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageSliceConstIteratorWithIndex.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageSliceConstIteratorWithIndex.h 2014-09-03 08:29:34.000000000 +0000 @@ -136,10 +136,12 @@ * particular region of that image. */ ImageSliceConstIteratorWithIndex(const ImageType *ptr, const RegionType & region): - ImageConstIteratorWithIndex< TImage >(ptr, region) + ImageConstIteratorWithIndex< TImage >(ptr, region), + m_PixelJump(0), + m_LineJump(0), + m_Direction_A(0), + m_Direction_B(1) { - m_Direction_A = 0; - m_Direction_B = 1; } /** Constructor that can be used to cast from an ImageIterator to an diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.h 2014-09-03 08:29:34.000000000 +0000 @@ -230,7 +230,7 @@ * multiple outputs of different types, then that class must provide * an implementation of MakeOutput(). */ using Superclass::MakeOutput; - virtual ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx); + virtual ProcessObject::DataObjectPointer MakeOutput(ProcessObject::DataObjectPointerArraySizeType idx) ITK_OVERRIDE; protected: ImageSource(); @@ -251,7 +251,7 @@ * instead. * * \sa ThreadedGenerateData() */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** If an imaging filter can be implemented as a multithreaded * algorithm, the filter will provide an implementation of @@ -332,22 +332,22 @@ */ virtual const ImageRegionSplitterBase* GetImageRegionSplitter(void) const; - /** Split the output's RequestedRegion into "num" pieces, returning + /** Split the output's RequestedRegion into "pieces" pieces, returning * region "i" as "splitRegion". This method is called concurrently - * "num" times. The regions must not overlap. The method returns the number of pieces that - * the routine is capable of splitting the output RequestedRegion, - * i.e. return value is less than or equal to "num". + * "pieces" times. The regions must not overlap. The method returns the number + * of pieces that the routine is capable of splitting the output RequestedRegion, + * i.e. return value is less than or equal to "pieces". * * To override the algorithm used split the image this method should - * no longer be overridden. It stead the algorithm should be - * implemented in a ImageRegionSplitter class, and the + * no longer be overridden. Instead, the algorithm should be + * implemented in a ImageRegionSplitterBase class, and the * GetImageRegionSplitter should overridden to return the splitter * object with the desired algorithm. * * \sa GetImageRegionSplitter **/ virtual - unsigned int SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType & splitRegion); + unsigned int SplitRequestedRegion(unsigned int i, unsigned int pieces, OutputImageRegionType & splitRegion); /** Static function used as a "callback" by the MultiThreader. The threading * library will call this routine for each thread, which will delegate the diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageSource.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -103,7 +103,7 @@ TOutputImage *out = dynamic_cast< TOutputImage * > ( this->ProcessObject::GetOutput(idx) ); - if ( out == NULL && this->ProcessObject::GetOutput(idx) != NULL ) + if ( out == ITK_NULLPTR && this->ProcessObject::GetOutput(idx) != ITK_NULLPTR ) { itkWarningMacro (<< "Unable to convert output number " << idx << " to type " << typeid( OutputImageType ).name () ); } @@ -172,7 +172,7 @@ template< typename TOutputImage > unsigned int ImageSource< TOutputImage > -::SplitRequestedRegion(unsigned int i, unsigned int num, OutputImageRegionType & splitRegion) +::SplitRequestedRegion(unsigned int i, unsigned int pieces, OutputImageRegionType & splitRegion) { const ImageRegionSplitterBase * splitter = this->GetImageRegionSplitter(); @@ -180,7 +180,7 @@ OutputImageType *outputPtr = this->GetOutput(); splitRegion = outputPtr->GetRequestedRegion(); - return splitter->GetSplit( i, num, splitRegion ); + return splitter->GetSplit( i, pieces, splitRegion ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageToImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageToImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageToImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageToImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -100,7 +100,7 @@ const TInputImage *in = dynamic_cast< const TInputImage * > ( this->ProcessObject::GetInput(idx) ); - if ( in == NULL && this->ProcessObject::GetInput(idx) != NULL ) + if ( in == ITK_NULLPTR && this->ProcessObject::GetInput(idx) != ITK_NULLPTR ) { itkWarningMacro (<< "Unable to convert input number " << idx << " to type " << typeid( InputImageType ).name () ); } @@ -177,7 +177,7 @@ typedef ImageBase< InputImageDimension > ImageBaseType; - ImageBaseType *inputPtr1 = 0; + ImageBaseType *inputPtr1 = ITK_NULLPTR; InputDataObjectIterator it(this); for(; !it.IsAtEnd(); ++it ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.h 2014-09-03 08:29:34.000000000 +0000 @@ -109,9 +109,9 @@ * an input to a filter. */ virtual void PushBackInput(const InputImageType *image); - virtual void PopBackInput(); + virtual void PopBackInput() ITK_OVERRIDE; virtual void PushFrontInput(const InputImageType *image); - virtual void PopFrontInput(); + virtual void PopFrontInput() ITK_OVERRIDE; protected: ImageTransformer(); @@ -130,7 +130,7 @@ * * \sa ProcessObject::GenerateInputRequestedRegion(), * ImageSource::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; /** A version of GenerateData() specific for image processing * filters. This implementation will split the processing across @@ -147,7 +147,7 @@ * instead. * * \sa ThreadedGenerateData() */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** If an imaging filter can be implemented as a multithreaded * algorithm, the filter will provide an implementation of @@ -228,9 +228,9 @@ * methods from the superclass. * NOTE: The same code resides in ImageToImageFilter */ - void PushBackInput(const DataObject *input) + virtual void PushBackInput(const DataObject *input) ITK_OVERRIDE { Superclass::PushBackInput(input); } - void PushFrontInput(const DataObject *input) + virtual void PushFrontInput(const DataObject *input) ITK_OVERRIDE { Superclass::PushFrontInput(input); } /** Internal structure used for passing image data into the threading library diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageTransformer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -99,7 +99,7 @@ { if ( this->GetNumberOfInputs() < 1 ) { - return 0; + return ITK_NULLPTR; } return itkDynamicCastInDebugMode< TInputImage * > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,22 +32,22 @@ */ /* Can we template of Image type instead, but require that Image be of type - * Image< Vector< TValueType, NVectorDimension >, VImageDimension > ? */ -template< typename TValueType, + * Image< Vector< TValue, NVectorDimension >, VImageDimension > ? */ +template< typename TValue, unsigned int NVectorDimension, unsigned int VImageDimension > class ImageVectorOptimizerParametersHelper - : public OptimizerParametersHelper< TValueType > + : public OptimizerParametersHelper< TValue > { public: /** The element type stored at each location in the Array. */ - typedef TValueType ValueType; - typedef ImageVectorOptimizerParametersHelper Self; - typedef OptimizerParametersHelper< TValueType > Superclass; + typedef TValue ValueType; + typedef ImageVectorOptimizerParametersHelper Self; + typedef OptimizerParametersHelper< TValue > Superclass; /** Image type that this class expects. */ - typedef Image< Vector, + typedef Image< Vector, VImageDimension > ParameterImageType; typedef typename ParameterImageType::Pointer ParameterImagePointer; @@ -61,10 +61,10 @@ /** Set a new data pointer for *both* the Array and parameter image, * pointing both to a different memory block. * The size of the new memroy block must be the same as current size of - * Array and the parameter image's buffer, in elements of TValueType. + * Array and the parameter image's buffer, in elements of TValue. * Memory must be managed by caller afterwards. */ virtual void MoveDataPointer(CommonContainerType* container, - TValueType * pointer ); + TValue * pointer ); /** Set an image that holds the parameter data. \c container is a pointer * of type itkArray to the object to which this helper is assigned. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImageVectorOptimizerParametersHelper.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,29 +24,29 @@ namespace itk { /** Default contstructor */ -template< typename TValueType, +template< typename TValue, unsigned int NVectorDimension, unsigned int VImageDimension > -ImageVectorOptimizerParametersHelper< TValueType, NVectorDimension, VImageDimension > +ImageVectorOptimizerParametersHelper< TValue, NVectorDimension, VImageDimension > ::ImageVectorOptimizerParametersHelper() { - m_ParameterImage = NULL; + m_ParameterImage = ITK_NULLPTR; } /** Move the data pointer */ -template< typename TValueType, +template< typename TValue, unsigned int NVectorDimension, unsigned int VImageDimension > void -ImageVectorOptimizerParametersHelper< TValueType, NVectorDimension, VImageDimension > -::MoveDataPointer( CommonContainerType* container, TValueType * pointer ) +ImageVectorOptimizerParametersHelper< TValue, NVectorDimension, VImageDimension > +::MoveDataPointer( CommonContainerType* container, TValue * pointer ) { if( m_ParameterImage.IsNull() ) { itkGenericExceptionMacro("ImageVectorOptimizerParametersHelper::" "MoveDataPointer: m_ParameterImage must be defined."); } - // The buffer for Image points to Vector type, not TValueType, so + // The buffer for Image points to Vector type, not TValue, so // have to cast. typedef typename ParameterImageType::PixelContainer::Element vectorElement; vectorElement* vectorPointer = reinterpret_cast(pointer); @@ -59,23 +59,23 @@ } /** Set parameter image */ -template< typename TValueType, +template< typename TValue, unsigned int NVectorDimension, unsigned int VImageDimension > void -ImageVectorOptimizerParametersHelper< TValueType, NVectorDimension, VImageDimension > +ImageVectorOptimizerParametersHelper< TValue, NVectorDimension, VImageDimension > ::SetParametersObject(CommonContainerType * container, LightObject * object) { - if( object == NULL ) + if( object == ITK_NULLPTR ) { - m_ParameterImage = NULL; + m_ParameterImage = ITK_NULLPTR; return; } else { ParameterImageType* image = dynamic_cast( object ); - if( image == NULL ) + if( image == ITK_NULLPTR ) { itkGenericExceptionMacro( "ImageVectorOptimizerParametersHelper::SetParametersObject: object is " @@ -84,10 +84,10 @@ } m_ParameterImage = image; //The PixelContainer for Image points to type Vector, so we have - // to determine the number of raw elements of type TValueType in the buffer + // to determine the number of raw elements of type TValue in the buffer // and cast a pointer to it for assignment to the Array data pointer. unsigned int sz = image->GetPixelContainer()->Size() * NVectorDimension; - TValueType* valuePointer = reinterpret_cast + TValue* valuePointer = reinterpret_cast ( image->GetPixelContainer()->GetBufferPointer() ); //Set the Array's pointer to the image data buffer. By default it will // not manage the memory. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.h 2014-09-03 08:29:34.000000000 +0000 @@ -105,8 +105,11 @@ * container. However, in this particular case, Reserve as a Resize * semantics that is kept for backward compatibility reasons. * + * If UseDefaultConstructor is true, then * the default constructor is used + * to initialize each element. POD date types initialize to zero. + * * \sa SetImportPointer() */ - void Reserve(ElementIdentifier num); + void Reserve(ElementIdentifier num, const bool UseDefaultConstructor = false); /** Tell the container to try to minimize its memory usage for * storage of the current number of elements. If new memory is @@ -139,9 +142,14 @@ /** PrintSelf routine. Normally this is a protected internal method. It is * made public here so that Image can call this method. Users should not * call this method but should call Print() instead. */ - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; - virtual TElement * AllocateElements(ElementIdentifier size) const; + /** + * Allocates elements of the array. If UseDefaultConstructor is true, then + * the default constructor is used to initialize each element. POD date types + * initialize to zero. + */ + virtual TElement * AllocateElements(ElementIdentifier size, bool UseDefaultConstructor = false) const; virtual void DeallocateManagedMemory(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageContainer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ ImportImageContainer< TElementIdentifier, TElement > ::ImportImageContainer() { - m_ImportPointer = 0; + m_ImportPointer = ITK_NULLPTR; m_ContainerManageMemory = true; m_Capacity = 0; m_Size = 0; @@ -56,7 +56,7 @@ template< typename TElementIdentifier, typename TElement > void ImportImageContainer< TElementIdentifier, TElement > -::Reserve(ElementIdentifier size) +::Reserve(ElementIdentifier size, const bool UseDefaultConstructor ) { // Reserve has a Resize semantics. We keep it that way for // backwards compatibility . @@ -65,7 +65,7 @@ { if ( size > m_Capacity ) { - TElement *temp = this->AllocateElements(size); + TElement *temp = this->AllocateElements(size, UseDefaultConstructor); // only copy the portion of the data used in the old buffer std::copy(m_ImportPointer, m_ImportPointer+m_Size, @@ -87,7 +87,7 @@ } else { - m_ImportPointer = this->AllocateElements(size); + m_ImportPointer = this->AllocateElements(size, UseDefaultConstructor); m_Capacity = size; m_Size = size; m_ContainerManageMemory = true; @@ -109,7 +109,7 @@ if ( m_Size < m_Capacity ) { const TElementIdentifier size = m_Size; - TElement * temp = this->AllocateElements(size); + TElement * temp = this->AllocateElements(size, false); std::copy(m_ImportPointer, m_ImportPointer+m_Size, temp); @@ -170,7 +170,7 @@ template< typename TElementIdentifier, typename TElement > TElement *ImportImageContainer< TElementIdentifier, TElement > -::AllocateElements(ElementIdentifier size) const +::AllocateElements(ElementIdentifier size, bool UseDefaultConstructor ) const { // Encapsulate all image memory allocation here to throw an // exception when memory allocation fails even when the compiler @@ -179,11 +179,18 @@ try { - data = new TElement[size]; + if ( UseDefaultConstructor ) + { + data = new TElement[size](); //POD types initialized to 0, others use default constructor. + } + else + { + data = new TElement[size]; //Faster but uninitialized + } } catch ( ... ) { - data = 0; + data = ITK_NULLPTR; } if ( !data ) { @@ -205,7 +212,7 @@ { delete[] m_ImportPointer; } - m_ImportPointer = 0; + m_ImportPointer = ITK_NULLPTR; m_Capacity = 0; m_Size = 0; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkImportImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,7 @@ } m_Direction.SetIdentity(); - m_ImportPointer = 0; + m_ImportPointer = ITK_NULLPTR; m_FilterManageMemory = false; m_Size = 0; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkIndex.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkIndex.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkIndex.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkIndex.h 2014-09-03 08:29:34.000000000 +0000 @@ -220,10 +220,24 @@ return !same; } +// false positive warnings with GCC 4.9 +#if defined( __GNUC__ ) +#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 ) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif +#endif /** Access an element of the index. Elements are numbered * 0, ..., VIndexDimension-1. No bounds checking is performed. */ IndexValueType & operator[](unsigned int dim) - { return m_Index[dim]; } + { + return m_Index[dim]; + } +#if defined( __GNUC__ ) +#if ( __GNUC__ == 4 ) && ( __GNUC_MINOR__ == 9 ) +#pragma GCC diagnostic pop +#endif +#endif /** Access an element of the index. Elements are numbered * 0, ..., VIndexDimension-1. This version can only be an rvalue. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkInOrderTreeIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkInOrderTreeIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkInOrderTreeIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkInOrderTreeIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ template< typename TTreeType > bool InOrderTreeIterator< TTreeType >::HasNext() const { - if ( const_cast< TreeNodeType * >( FindNextNode() ) != NULL ) + if ( const_cast< TreeNodeType * >( FindNextNode() ) != ITK_NULLPTR ) { return true; } @@ -104,9 +104,9 @@ const typename InOrderTreeIterator< TTreeType >::TreeNodeType * InOrderTreeIterator< TTreeType >::FindNextNode() const { - if ( this->m_Position == NULL ) + if ( this->m_Position == ITK_NULLPTR ) { - return NULL; + return ITK_NULLPTR; } if ( this->m_Position->HasChildren() ) @@ -116,7 +116,7 @@ if ( !this->m_Position->HasParent() ) { - return NULL; + return ITK_NULLPTR; } TreeNodeType *child = this->m_Position; @@ -128,7 +128,7 @@ while ( childPosition < lastChildPosition ) { TreeNodeType *help = parent->GetChild(childPosition + 1); - if ( help != NULL ) + if ( help != ITK_NULLPTR ) { return help; } @@ -143,7 +143,7 @@ // Subtree if ( parent->ChildPosition(this->m_Root) >= 0 ) { - return NULL; + return ITK_NULLPTR; } childPosition = parent->ChildPosition(child); lastChildPosition = parent->CountChildren() - 1; @@ -151,13 +151,13 @@ while ( childPosition < lastChildPosition ) { TreeNodeType *help = parent->GetChild(childPosition + 1); - if ( help != NULL ) + if ( help != ITK_NULLPTR ) { return help; } } } - return NULL; + return ITK_NULLPTR; } /** Clone function */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkInPlaceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ // additionally the buffered and requested regions of the input and // output must match. bool rMatch = true; - if( inputPtr != NULL && (unsigned int)InputImageDimension == (unsigned int)OutputImageDimension ) + if( inputPtr != ITK_NULLPTR && (unsigned int)InputImageDimension == (unsigned int)OutputImageDimension ) { for( unsigned int i=0; i<(unsigned int)InputImageDimension; i++ ) { @@ -103,7 +103,7 @@ { rMatch = false; } - if ( inputPtr != NULL && + if ( inputPtr != ITK_NULLPTR && this->GetInPlace() && this->CanRunInPlace() && rMatch ) @@ -111,7 +111,7 @@ // Graft this first input to the output. Later, we'll need to // remove the input's hold on the bulk data. // - OutputImagePointer inputAsOutput = NULL; + OutputImagePointer inputAsOutput = ITK_NULLPTR; if ( IsSame() ) { inputAsOutput = reinterpret_cast( const_cast< TInputImage * >( inputPtr ) ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLeafTreeIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLeafTreeIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLeafTreeIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLeafTreeIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -84,7 +84,7 @@ /** Constructor */ template< typename TTreeType > LeafTreeIterator< TTreeType >::LeafTreeIterator(TTreeType *tree): - TreeIteratorBase< TTreeType >(tree, NULL) + TreeIteratorBase< TTreeType >(tree, ITK_NULLPTR) { this->m_Begin = const_cast< TreeNodeType * >( this->FindNextNode() ); // // @@ -115,11 +115,11 @@ template< typename TTreeType > bool LeafTreeIterator< TTreeType >::HasNext() const { - if ( this->m_Position == NULL ) + if ( this->m_Position == ITK_NULLPTR ) { return false; } - if ( const_cast< TreeNodeType * >( FindNextNode() ) != NULL ) + if ( const_cast< TreeNodeType * >( FindNextNode() ) != ITK_NULLPTR ) { return true; } @@ -145,7 +145,7 @@ ++it; // go next if ( it.IsAtEnd() ) { - return NULL; + return ITK_NULLPTR; } if ( !it.HasChild() ) @@ -162,7 +162,7 @@ ++it; } - return NULL; + return ITK_NULLPTR; } /** Clone function */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLevelOrderTreeIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLevelOrderTreeIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLevelOrderTreeIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLevelOrderTreeIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ { m_StartLevel = -1; m_EndLevel = endLevel; - if ( start != NULL ) + if ( start != ITK_NULLPTR ) { m_Queue.push(start); this->m_Position = const_cast< TreeNodeType * >( start ); @@ -54,7 +54,7 @@ { m_StartLevel = startLevel; m_EndLevel = endLevel; - if ( start != NULL ) + if ( start != ITK_NULLPTR ) { m_Queue.push(start); this->m_Position = const_cast< TreeNodeType * >( start ); @@ -125,14 +125,14 @@ do { node = FindNextNodeHelp(); - if ( node == NULL ) + if ( node == ITK_NULLPTR ) { - return NULL; + return ITK_NULLPTR; } level = GetLevel(node); if ( level > m_EndLevel ) { - return NULL; + return ITK_NULLPTR; } } while ( level < m_StartLevel ); @@ -145,7 +145,7 @@ int LevelOrderTreeIterator< TTreeType >::GetLevel() const { - if ( this->m_Position == NULL ) + if ( this->m_Position == ITK_NULLPTR ) { return -1; } @@ -165,7 +165,7 @@ int LevelOrderTreeIterator< TTreeType >::GetLevel(const TreeNodeType *node) const { - if ( node == NULL ) + if ( node == ITK_NULLPTR ) { return -1; } @@ -186,15 +186,15 @@ { if ( m_Queue.empty() ) { - return NULL; + return ITK_NULLPTR; } const TreeNodeType *currentNode = m_Queue.front(); m_Queue.pop(); - if ( currentNode == NULL ) + if ( currentNode == ITK_NULLPTR ) { - return NULL; + return ITK_NULLPTR; } int size = currentNode->CountChildren(); @@ -202,7 +202,7 @@ for ( int i = 0; i < size; i++ ) { TreeNodeType *child = dynamic_cast< TreeNodeType * >( currentNode->GetChild(i) ); - if ( child != NULL ) + if ( child != ITK_NULLPTR ) { m_Queue.push(child); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLightObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLightObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLightObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLightObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -162,6 +162,16 @@ LightObject(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented }; + +/** + * This operator allows all subclasses of LightObject to be printed via <<. + * It in turn invokes the Print method, which in turn will invoke the + * PrintSelf method that all objects should define, if they have anything + * interesting to print out. + */ +std::ostream & +operator<<(std::ostream & os, const LightObject & o); + } // end namespace itk #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLightProcessObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLightProcessObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLightProcessObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLightProcessObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -116,7 +116,7 @@ protected: LightProcessObject(); ~LightProcessObject(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** This method causes the filter to generate its output. */ virtual void GenerateData() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerBase.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -169,7 +169,7 @@ virtual ~LoggerBase(); /** Print contents of a LoggerBase */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerManager.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerManager.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerManager.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerManager.h 2014-09-03 08:29:34.000000000 +0000 @@ -99,7 +99,7 @@ virtual ~LoggerManager() {} /** Print contents of a LoggerManager */ - void PrintSelf(std::ostream & s, Indent indent) const; + virtual void PrintSelf(std::ostream & s, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerOutput.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerOutput.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerOutput.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerOutput.h 2014-09-03 08:29:34.000000000 +0000 @@ -64,27 +64,27 @@ typedef Logger *LoggerType; /** Send a string to display. */ - virtual void DisplayText(const char *t); + virtual void DisplayText(const char *t) ITK_OVERRIDE; /** Send a string as an error message to display. * The default implementation calls DisplayText() but subclasses * could present this message differently. */ - virtual void DisplayErrorText(const char *t); + virtual void DisplayErrorText(const char *t) ITK_OVERRIDE; /** Send a string as a warningmessage to display. * The default implementation calls DisplayText() but subclasses * could present this message differently. */ - virtual void DisplayWarningText(const char *t); + virtual void DisplayWarningText(const char *t) ITK_OVERRIDE; /** Send a string as a message to display. * The default implementation calls DisplayText() but subclasses * could present this message differently. */ - virtual void DisplayGenericOutputText(const char *t); + virtual void DisplayGenericOutputText(const char *t) ITK_OVERRIDE; /** Send a string as a debug message to display. * The default implementation calls DisplayText() but subclasses * could present this message differently. */ - virtual void DisplayDebugText(const char *t); + virtual void DisplayDebugText(const char *t) ITK_OVERRIDE; itkSetMacro(Logger, LoggerType); @@ -96,9 +96,9 @@ } protected: - LoggerOutput():m_Logger(0) {} + LoggerOutput():m_Logger(ITK_NULLPTR) {} virtual ~LoggerOutput() {} - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: Logger *m_Logger; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.h 2014-09-03 08:29:34.000000000 +0000 @@ -61,8 +61,7 @@ SET_PRIORITY_LEVEL, SET_LEVEL_FOR_FLUSHING, ADD_LOG_OUTPUT, - WRITE, - FLUSH + WRITE } OperationType; /** Set the priority level for the current logger. Only messages that have diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkLoggerThreadWrapper.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -139,12 +139,10 @@ this->m_LevelQ.pop(); this->m_MessageQ.pop(); break; - case Self::FLUSH: - this->SimpleLoggerType::Flush(); - break; } this->m_OperationQ.pop(); } + this->SimpleLoggerType::Flush(); this->m_Output->Flush(); this->m_Mutex.Unlock(); } @@ -174,62 +172,54 @@ { struct MultiThreader:: ThreadInfoStruct *pInfo = (struct MultiThreader::ThreadInfoStruct *)pInfoStruct; - if ( pInfo == NULL ) + if ( ( pInfo != ITK_NULLPTR ) && ( pInfo->UserData != ITK_NULLPTR ) ) { - return ITK_THREAD_RETURN_VALUE; - } - if ( pInfo->UserData == NULL ) - { - return ITK_THREAD_RETURN_VALUE; - } - - LoggerThreadWrapper *pLogger = (LoggerThreadWrapper *)pInfo->UserData; - - while ( 1 ) - { + LoggerThreadWrapper *pLogger = (LoggerThreadWrapper *)pInfo->UserData; - pInfo->ActiveFlagLock->Lock(); - int activeFlag = *pInfo->ActiveFlag; - pInfo->ActiveFlagLock->Unlock(); - if ( !activeFlag ) + while ( 1 ) { - break; - } - pLogger->m_Mutex.Lock(); - while ( !pLogger->m_OperationQ.empty() ) - { - switch ( pLogger->m_OperationQ.front() ) + pInfo->ActiveFlagLock->Lock(); + int activeFlag = *pInfo->ActiveFlag; + pInfo->ActiveFlagLock->Unlock(); + if ( !activeFlag ) + { + break; + } + + pLogger->m_Mutex.Lock(); + while ( !pLogger->m_OperationQ.empty() ) { - case Self::SET_PRIORITY_LEVEL: - pLogger->m_PriorityLevel = pLogger->m_LevelQ.front(); - pLogger->m_LevelQ.pop(); - break; - - case Self::SET_LEVEL_FOR_FLUSHING: - pLogger->m_LevelForFlushing = pLogger->m_LevelQ.front(); - pLogger->m_LevelQ.pop(); - break; - - case Self::ADD_LOG_OUTPUT: - pLogger->m_Output->AddLogOutput( pLogger->m_OutputQ.front() ); - pLogger->m_OutputQ.pop(); - break; - - case Self::WRITE: - pLogger->SimpleLoggerType::Write( pLogger->m_LevelQ.front(), pLogger->m_MessageQ.front() ); - pLogger->m_LevelQ.pop(); - pLogger->m_MessageQ.pop(); - break; - case Self::FLUSH: - pLogger->SimpleLoggerType::Flush(); - break; + switch ( pLogger->m_OperationQ.front() ) + { + case Self::SET_PRIORITY_LEVEL: + pLogger->m_PriorityLevel = pLogger->m_LevelQ.front(); + pLogger->m_LevelQ.pop(); + break; + + case Self::SET_LEVEL_FOR_FLUSHING: + pLogger->m_LevelForFlushing = pLogger->m_LevelQ.front(); + pLogger->m_LevelQ.pop(); + break; + + case Self::ADD_LOG_OUTPUT: + pLogger->m_Output->AddLogOutput( pLogger->m_OutputQ.front() ); + pLogger->m_OutputQ.pop(); + break; + + case Self::WRITE: + pLogger->SimpleLoggerType::Write( pLogger->m_LevelQ.front(), pLogger->m_MessageQ.front() ); + pLogger->m_LevelQ.pop(); + pLogger->m_MessageQ.pop(); + break; + } + pLogger->m_OperationQ.pop(); } - pLogger->m_OperationQ.pop(); + pLogger->m_Mutex.Unlock(); + pLogger->SimpleLoggerType::Flush(); + itksys::SystemTools::Delay(pLogger->GetDelay()); } - pLogger->m_Mutex.Unlock(); - itksys::SystemTools::Delay(pLogger->GetDelay()); } return ITK_THREAD_RETURN_VALUE; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMacro.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMacro.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMacro.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMacro.h 2014-09-03 08:29:34.000000000 +0000 @@ -118,6 +118,23 @@ #endif #endif +#if __cplusplus >= 201103L +// In c++11 the override keyword allows you to explicity define that a function +// is intended to override the base-class version. This makes the code more +// managable and fixes a set of common hard-to-find bugs. +#define ITK_OVERRIDE override +// In c++11 there is an explicit nullptr type that introduces a new keyword to +// serve as a distinguished null pointer constant: nullptr. It is of type +// nullptr_t, which is implicitly convertible and comparable to any pointer type +// or pointer-to-member type. It is not implicitly convertible or comparable to +// integral types, except for bool. +#define ITK_NULLPTR nullptr +#else +#define ITK_OVERRIDE +#define ITK_NULLPTR NULL +#endif + + /** Define two object creation methods. The first method, New(), * creates an object from a class, potentially deferring to a factory. * The second method, CreateAnother(), creates an object from an @@ -147,7 +164,7 @@ static Pointer New(void) \ { \ Pointer smartPtr = ::itk::ObjectFactory< x >::Create(); \ - if ( smartPtr.GetPointer() == NULL ) \ + if ( smartPtr.GetPointer() == ITK_NULLPTR ) \ { \ smartPtr = new x; \ } \ @@ -156,7 +173,7 @@ } #define itkCreateAnotherMacro(x) \ - virtual::itk::LightObject::Pointer CreateAnother(void) const \ + virtual::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \ { \ ::itk::LightObject::Pointer smartPtr; \ smartPtr = x::New().GetPointer(); \ @@ -196,7 +213,7 @@ rawPtr->UnRegister(); \ return smartPtr; \ } \ - virtual::itk::LightObject::Pointer CreateAnother(void) const \ + virtual::itk::LightObject::Pointer CreateAnother(void) const ITK_OVERRIDE \ { \ ::itk::LightObject::Pointer smartPtr; \ smartPtr = x::New().GetPointer(); \ @@ -275,7 +292,7 @@ #if defined( ITK_CPP_FUNCTION ) #if defined( _WIN32 ) && !defined( __MINGW32__ ) && !defined( CABLE_CONFIGURATION ) \ - && !defined( CSWIG ) + && !defined( __GCCXML__ ) #define ITK_LOCATION __FUNCSIG__ #elif defined( __GNUC__ ) #define ITK_LOCATION __PRETTY_FUNCTION__ @@ -399,7 +416,7 @@ // itkLegacyMacro(void MyMethod()); #if defined( ITK_LEGACY_REMOVE ) #define itkLegacyMacro(method) /* no ';' */ -#elif defined( ITK_LEGACY_SILENT ) || defined( ITK_LEGACY_TEST ) || defined( CSWIG ) +#elif defined( ITK_LEGACY_SILENT ) || defined( ITK_LEGACY_TEST ) || defined( __GCCXML__ ) // Provide legacy methods with no warnings. #define itkLegacyMacro(method) method #else @@ -539,68 +556,6 @@ #define ITK_FRIEND_TEMPLATE_FUNCTION_ARGUMENT(T) #endif -//============================================================================= -/* Choose a way to prevent template instantiation on this platform. - - ITK_TEMPLATE_DO_NOT_INSTANTIATE = use #pragma do_not_instantiate to - prevent instantiation - - ITK_TEMPLATE_EXTERN = use extern template to prevent instantiation -*/ -#if defined( __INTEL_COMPILER ) && __INTEL_COMPILER >= 700 -#define ITK_TEMPLATE_EXTERN 1 -#elif defined( __GNUC__ ) && __GNUC__ >= 3 -#define ITK_TEMPLATE_EXTERN 1 -#elif defined( _MSC_VER ) -#define ITK_TEMPLATE_EXTERN 1 -#endif -#if !defined( ITK_TEMPLATE_DO_NOT_INSTANTIATE ) -#define ITK_TEMPLATE_DO_NOT_INSTANTIATE 0 -#endif -#if !defined( ITK_TEMPLATE_EXTERN ) -#define ITK_TEMPLATE_EXTERN 0 -#endif - -/* Define a macro to explicitly instantiate a template. - - ITK_TEMPLATE_EXPORT(X) = - Explicitly instantiate X, where X is of the form N(a1[,a2...,aN]). - examples: ITK_TEMPLATE_EXPORT(1(class Foo)) - ITK_TEMPLATE_EXPORT(2(class Bar)) - Use one level of expansion delay to allow user code to have - a macro determining the number of arguments. */ -#define ITK_TEMPLATE_EXPORT(x) ITK_TEMPLATE_EXPORT_DELAY(x) -#define ITK_TEMPLATE_EXPORT_DELAY(x) template ITK_TEMPLATE_##x; - -/* Define a macro to prevent template instantiations. - - ITK_TEMPLATE_IMPORT(X) = - Prevent instantiation of X, where X is of the form N(a1[,a2...,aN]). - examples: ITK_TEMPLATE_IMPORT(1(class Foo)) - ITK_TEMPLATE_IMPORT(2(class Bar)) - Use one level of expansion delay to allow user code to have - a macro determining the number of arguments. -*/ -#if ITK_TEMPLATE_EXTERN -#define ITK_TEMPLATE_IMPORT_DELAY(x) extern template ITK_TEMPLATE_##x; -#elif ITK_TEMPLATE_DO_NOT_INSTANTIATE -#define ITK_TEMPLATE_IMPORT_DELAY(x) \ - ITK_TEMPLATE_IMPORT_IMPL(do_not_instantiate ITK_TEMPLATE_##x) -#define ITK_TEMPLATE_IMPORT_IMPL(x) _Pragma(#x) -#endif -#if defined( ITK_TEMPLATE_IMPORT_DELAY ) -#define ITK_TEMPLATE_IMPORT(x) ITK_TEMPLATE_IMPORT_DELAY(x) -#define ITK_TEMPLATE_IMPORT_WORKS 1 -#else -#define ITK_TEMPLATE_IMPORT(x) -#define ITK_TEMPLATE_IMPORT_WORKS 0 -#endif - -//============================================================================= - -/* Define macros to export and import template instantiations for each - library in ITK. */ -#define ITK_EXPORT_ITKCommon(c, x, n) \ - ITK_EXPORT_TEMPLATE(ITKCommon_EXPORT, c, x, n) -#define ITK_IMPORT_ITKCommon(c, x, n) \ - ITK_IMPORT_TEMPLATE(ITKCommon_EXPORT, c, x, n) - //-------------------------------------------------------------------------------- // Helper macros for Template Meta-Programming techniques of for-loops // unrolling @@ -703,6 +658,7 @@ #else return static_cast(x); #endif +} // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -721,7 +677,7 @@ virtual void Set##name(const type *_arg) \ { \ itkDebugMacro("setting input " #name " to " << _arg); \ - if ( _arg != static_cast< type * >( this->ProcessObject::GetInput(#name) ) ) \ + if ( _arg != itkDynamicCastInDebugMode< type * >( this->ProcessObject::GetInput(#name) ) ) \ { \ this->ProcessObject::SetInput( #name, const_cast< type * >( _arg ) ); \ this->Modified(); \ @@ -732,9 +688,8 @@ #define itkGetInputMacro(name, type) \ virtual const type * Get##name() const \ { \ - itkDebugMacro( "returning input " << #name " of " \ - << static_cast< const type * >( this->ProcessObject::GetInput(#name) ) ); \ - return static_cast< const type * >( this->ProcessObject::GetInput(#name) ); \ + itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \ + return itkDynamicCastInDebugMode< const type * >( this->ProcessObject::GetInput(#name) ); \ } /** Set a decorated input. This defines the Set"name"() and a Set"name"Input() method */ @@ -742,7 +697,7 @@ virtual void Set##name##Input(const SimpleDataObjectDecorator< type > *_arg) \ { \ itkDebugMacro("setting input " #name " to " << _arg); \ - if ( _arg != static_cast< SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \ + if ( _arg != itkDynamicCastInDebugMode< SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \ { \ this->ProcessObject::SetInput( #name, const_cast< SimpleDataObjectDecorator< type > * >( _arg ) ); \ this->Modified(); \ @@ -753,7 +708,7 @@ typedef SimpleDataObjectDecorator< type > DecoratorType; \ itkDebugMacro("setting input " #name " to " << _arg); \ const DecoratorType *oldInput = \ - static_cast< const DecoratorType * >( \ + itkDynamicCastInDebugMode< const DecoratorType * >( \ this->ProcessObject::GetInput(#name) ); \ if ( oldInput && oldInput->Get() == _arg ) \ { \ @@ -768,18 +723,17 @@ #define itkGetDecoratedInputMacro(name, type) \ virtual const SimpleDataObjectDecorator< type > * Get##name##Input() const \ { \ - itkDebugMacro( "returning input " << #name " of " \ - << static_cast< const SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ); \ - return static_cast< const SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \ + itkDebugMacro( "returning input " << #name " of " << this->ProcessObject::GetInput(#name) ); \ + return itkDynamicCastInDebugMode< const SimpleDataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \ } \ virtual const type & Get##name() const \ { \ itkDebugMacro("Getting input " #name); \ typedef SimpleDataObjectDecorator< type > DecoratorType; \ const DecoratorType *input = \ - static_cast< const DecoratorType * >( \ + itkDynamicCastInDebugMode< const DecoratorType * >( \ this->ProcessObject::GetInput(#name) ); \ - if( input == NULL ) \ + if( input == ITK_NULLPTR ) \ { \ itkExceptionMacro(<<"input" #name " is not set"); \ } \ @@ -800,7 +754,7 @@ virtual void Set##name##Input(const DataObjectDecorator< type > *_arg) \ { \ itkDebugMacro("setting input " #name " to " << _arg); \ - if ( _arg != static_cast< DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \ + if ( _arg != itkDynamicCastInDebugMode< DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ) \ { \ this->ProcessObject::SetInput( #name, const_cast< DataObjectDecorator< type > * >( _arg ) ); \ this->Modified(); \ @@ -811,7 +765,7 @@ typedef DataObjectDecorator< type > DecoratorType; \ itkDebugMacro("setting input " #name " to " << _arg); \ const DecoratorType *oldInput = \ - static_cast< const DecoratorType * >( \ + itkDynamicCastInDebugMode< const DecoratorType * >( \ this->ProcessObject::GetInput(#name) ); \ if ( oldInput && oldInput->Get() == _arg ) \ { \ @@ -829,20 +783,19 @@ #define itkGetDecoratedObjectInputMacro(name, type) \ virtual const DataObjectDecorator< type > * Get##name##Input() const \ { \ - itkDebugMacro( "returning input " << #name " of " \ - << static_cast< const DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ) ); \ - return static_cast< const DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \ + itkDebugMacro( "returning input " << #name " of "<< this->ProcessObject::GetInput(#name) ); \ + return itkDynamicCastInDebugMode< const DataObjectDecorator< type > * >( this->ProcessObject::GetInput(#name) ); \ } \ virtual const type * Get##name() const \ { \ itkDebugMacro("Getting input " #name); \ typedef DataObjectDecorator< type > DecoratorType; \ const DecoratorType *input = \ - static_cast< const DecoratorType * >( \ + itkDynamicCastInDebugMode< const DecoratorType * >( \ this->ProcessObject::GetInput(#name) ); \ - if( input == NULL ) \ + if( input == ITK_NULLPTR ) \ { \ - itkExceptionMacro(<<"input" #name " is not set"); \ + return ITK_NULLPTR; \ } \ return input->Get(); \ } @@ -1137,6 +1090,17 @@ return kernel::GetOpenCLSource(); \ } -} +// A useful macro in the PrintSelf method for printing member variables +// which are pointers to object based on the LightObject class. +#define itkPrintSelfObjectMacro(name) \ + if (static_cast(this->m_##name) == ITK_NULLPTR) \ + { \ + os << indent << #name << ": (null)" << std::endl; \ + } \ + else \ + { \ + os << indent << #name << ": " << std::endl; \ + this->m_##name->Print(os,indent.GetNextIndent()); \ + } #endif //end of itkMacro.h diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMath.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMath.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMath.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMath.h 2014-09-03 08:29:34.000000000 +0000 @@ -261,7 +261,7 @@ { // Check if the numbers are really close -- needed // when comparing numbers near zero. - const T absDifference = vcl_abs(x1 - x2); + const T absDifference = std::abs(x1 - x2); if ( absDifference <= maxAbsoluteDifference ) { return true; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryProbe.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryProbe.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryProbe.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryProbe.h 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ typedef double MeanMemoryLoadType; protected: - virtual MemoryLoadType GetInstantValue(void) const; + virtual MemoryLoadType GetInstantValue(void) const ITK_OVERRIDE; private: mutable MemoryUsageObserver m_MemoryObserver; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryUsageObserver.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryUsageObserver.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryUsageObserver.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMemoryUsageObserver.h 2014-09-03 08:29:34.000000000 +0000 @@ -95,7 +95,7 @@ public: /** destructor */ virtual ~MacOSXMemoryUsageObserver(); - virtual MemoryLoadType GetMemoryUsage(); + virtual MemoryLoadType GetMemoryUsage() ITK_OVERRIDE; }; #endif // Mac OS X @@ -115,7 +115,7 @@ public: /** destructor */ virtual ~SysResourceMemoryUsageObserver(); - virtual MemoryLoadType GetMemoryUsage(); + virtual MemoryLoadType GetMemoryUsage() ITK_OVERRIDE; }; #if !defined( __APPLE__ ) && !defined( __SUNPRO_CC ) && !defined ( __sun__ ) && !defined( __FreeBSD__ ) \ && !defined( __OpenBSD__ ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMersenneTwisterRandomVariateGenerator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMersenneTwisterRandomVariateGenerator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMersenneTwisterRandomVariateGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMersenneTwisterRandomVariateGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -22,9 +22,9 @@ #include "itkObjectFactory.h" #include "itkRandomVariateGeneratorBase.h" #include "itkIntTypes.h" -#include "vcl_ctime.h" #include "vnl/vnl_math.h" #include +#include namespace itk { @@ -33,7 +33,9 @@ /** \class MersenneTwisterRandomVariateGenerator * \brief MersenneTwisterRandom random variate generator * - * \warning This class is NOT reentrant. + * \warning This class's instance methods are NOT neither reentrant + * nor thread-safe, but static methods are both. That is to say you + * can use separate objects concurrently. * * This notice was included with the original implementation. * The only changes made were to obfuscate the author's email addresses. @@ -119,16 +121,19 @@ itkTypeMacro(MersenneTwisterRandomVariateGenerator, RandomVariateGeneratorBase); - /** Method for creation through the object factory. - This method allocates a new instance of a Mersenne Twister, - and initializes it with the seed from the global instance. */ + /** \brief Method for creation through the object factory. + * + * This method allocates a new instance of a Mersenne Twister, + * and initializes it with the seed from the global instance. + */ static Pointer New(); /** returns the global Merseene Twister instance - This method returns a Singleton of the Mersenne Twister. - The seed is initialized from the wall clock, but can be - set using SetSeed(). - */ + * + * This method returns a Singleton of the Mersenne Twister. + * The seed is initialized from the wall clock, but can be + * set using SetSeed(). + */ static Pointer GetInstance(); /** Length of state vector */ @@ -137,7 +142,7 @@ /** initialize with a simple IntegerType */ void Initialize(const IntegerType oneSeed); - /* Initialize with vcl_clock time */ + /* Initialize with clock time */ void Initialize(); /** Get a random variate in the range [0, 1] */ @@ -182,16 +187,16 @@ * values together, otherwise the generator state can be learned after * reading 624 consecutive values. */ - virtual double GetVariate(); + virtual double GetVariate() ITK_OVERRIDE; /** Same as GetVariate() */ double operator()(); - // Re-seeding functions with same behavior as initializers + /** Re-seeding functions with same behavior as initializers */ inline void SetSeed(const IntegerType oneSeed); - // inline void SetSeed(IntegerType *bigSeed, const IntegerType seedLength = StateVectorLength); inline void SetSeed(); - // Return the current seed + + /** Return the current seed */ IntegerType GetSeed() { return this->m_Seed; }; /* @@ -203,24 +208,7 @@ protected: inline MersenneTwisterRandomVariateGenerator(); virtual ~MersenneTwisterRandomVariateGenerator() {} - virtual void PrintSelf(std::ostream & os, Indent indent) const - { - Superclass::PrintSelf(os, indent); - - // Print state vector contents - os << indent << "State vector: " << state << std::endl; - os << indent; - register const IntegerType *s = state; - register int i = StateVectorLength; - for (; i--; os << *s++ << "\t" ) {} - os << std::endl; - - //Print next value to be gotten from state - os << indent << "Next value to be gotten from state: " << pNext << std::endl; - - //Number of values left before reload - os << indent << "Values left before next reload: " << left << std::endl; - } + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; // period parameter itkStaticConstMacro (M, unsigned int, 397); @@ -247,42 +235,21 @@ return m ^ ( mixBits(s0, s1) >> 1 ) ^ ( -static_cast(loBit(s1)) & 0x9908b0df ); } - static IntegerType hash(vcl_time_t t, vcl_clock_t c); - - static Pointer m_Instance; -}; // end of class - -// Declare inlined functions.... (must be declared in the header) + static IntegerType hash(time_t t, clock_t c); -inline MersenneTwisterRandomVariateGenerator::IntegerType -MersenneTwisterRandomVariateGenerator::hash(vcl_time_t t, vcl_clock_t c) -{ - // Get a IntegerType from t and c - // Better than IntegerType(x) in case x is floating point in [0,1] - // Based on code by Lawrence Kirby: fred at genesis dot demon dot co dot uk +private: - static IntegerType differ = 0; // guarantee time-based seeds will change + /** Internal method to actually create a new object. */ + static Pointer CreateInstance(); - IntegerType h1 = 0; - unsigned char *p = (unsigned char *)&t; + // Static/Global Variable need to be thread-safely accessed + static Pointer m_StaticInstance; + static SimpleFastMutexLock m_StaticInstanceLock; + static IntegerType m_StaticDiffer; - const unsigned int sizeOfT = static_cast< unsigned int >( sizeof(t) ); - for ( unsigned int i = 0; i < sizeOfT; ++i ) - { - h1 *= UCHAR_MAX + 2U; - h1 += p[i]; - } - IntegerType h2 = 0; - p = (unsigned char *)&c; +}; // end of class - const unsigned int sizeOfC = static_cast< unsigned int >( sizeof(c) ); - for ( unsigned int j = 0; j < sizeOfC; ++j ) - { - h2 *= UCHAR_MAX + 2U; - h2 += p[j]; - } - return ( h1 + differ++ ) ^ h2; -} +// Declare inlined functions.... (must be declared in the header) inline void MersenneTwisterRandomVariateGenerator::Initialize(const IntegerType seed) @@ -292,9 +259,9 @@ // See Knuth TAOCP Vol 2, 3rd Ed, p.106 for multiplier. // In previous versions, most significant bits (MSBs) of the seed affect // only MSBs of the state array. Modified 9 Jan 2002 by Makoto Matsumoto. - register IntegerType *s = state; - register IntegerType *r = state; - register IntegerType i = 1; + IntegerType *s = state; + IntegerType *r = state; + IntegerType i = 1; *s++ = seed & 0xffffffffUL; for ( i = 1; i < MersenneTwisterRandomVariateGenerator::StateVectorLength; ++i ) @@ -312,11 +279,11 @@ // matthew dot bellew at home dot com // get rid of VS warning - register int index = static_cast< int >( + int index = static_cast< int >( M - MersenneTwisterRandomVariateGenerator::StateVectorLength ); - register IntegerType *p = state; - register int i; + IntegerType *p = state; + int i; for ( i = MersenneTwisterRandomVariateGenerator::StateVectorLength - M; i--; ++p ) { @@ -331,58 +298,6 @@ left = MersenneTwisterRandomVariateGenerator::StateVectorLength, pNext = state; } - /* -#define SVL 624 -inline void -MersenneTwisterRandomVariateGenerator::SetSeed( - IntegerType *const bigSeed, const IntegerType seedLength) -{ - // Seed the generator with an array of IntegerType's - // There are 2^19937-1 possible initial states. This function allows - // all of those to be accessed by providing at least 19937 bits (with a - // default seed length of StateVectorLength = 624 IntegerType's). - // Any bits above the lower 32 - // in each element are discarded. - // Just call seed() if you want to get array from /dev/urandom - Initialize(19650218UL); - register IntegerType i = 1; - register IntegerType j = 0; - register int k; - if ( StateVectorLength > seedLength ) - { - k = StateVectorLength; - } - else - { - k = seedLength; - } - for (; k; --k ) - { - state[i] = - state[i] ^ ( ( state[i - 1] ^ ( state[i - 1] >> 30 ) ) * 1664525UL ); - state[i] += ( bigSeed[j] & 0xffffffffUL ) + j; - state[i] &= 0xffffffffUL; - ++i; ++j; - if ( i >= StateVectorLength ) { state[0] = state[StateVectorLength - 1]; i = 1; } - if ( j >= seedLength ) { j = 0; } - } - for ( k = StateVectorLength - 1; k; --k ) - { - state[i] = - state[i] ^ ( ( state[i - 1] ^ ( state[i - 1] >> 30 ) ) * 1566083941UL ); - state[i] -= i; - state[i] &= 0xffffffffUL; - ++i; - if ( i >= SVL ) - { - state[0] = state[StateVectorLength - 1]; i = 1; - } - } - state[0] = 0x80000000UL; // MSB is 1, assuring non-zero initial array - reload(); -} - */ - inline void MersenneTwisterRandomVariateGenerator::Initialize() { @@ -401,7 +316,7 @@ MersenneTwisterRandomVariateGenerator::SetSeed() { // use time() and clock() to generate a unlikely-to-repeat seed. - SetSeed( hash( vcl_time(0), vcl_clock() ) ); + SetSeed( hash( time(ITK_NULLPTR), clock() ) ); } /** Get an integer variate in [0, 2^32-1] */ @@ -411,8 +326,7 @@ if ( left == 0 ) { reload(); } --left; - register IntegerType s1; - s1 = *pNext++; + IntegerType s1 = *pNext++; s1 ^= ( s1 >> 11 ); s1 ^= ( s1 << 7 ) & 0x9d2c5680; s1 ^= ( s1 << 15 ) & 0xefc60000; @@ -507,11 +421,11 @@ { // Return a real number from a normal (Gaussian) distribution with given // mean and variance by Box-Muller method - double r = vcl_sqrt(-2.0 * vcl_log( 1.0 - GetVariateWithOpenRange() ) * variance); + double r = std::sqrt(-2.0 * std::log( 1.0 - GetVariateWithOpenRange() ) * variance); double phi = 2.0 * vnl_math::pi * GetVariateWithOpenUpperRange(); - return mean + r *vcl_cos(phi); + return mean + r *std::cos(phi); } /* Access to a uniform random number distribution */ @@ -537,12 +451,6 @@ return GetVariate(); } -inline -MersenneTwisterRandomVariateGenerator::MersenneTwisterRandomVariateGenerator() -{ - SetSeed (121212); -} - /* Change log from MTRand.h */ // Change log: // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObjectBase.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObjectBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObjectBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObjectBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ * \author Hans J. Johnson * \ingroup ITKCommon */ -class ITKCommon_EXPORT MetaDataObjectBase:public LightObject +class ITKCommon_EXPORT MetaDataObjectBase: public LightObject { public: /** Smart pointer typedef support. */ @@ -60,32 +60,25 @@ * \author Hans J. Johnson * \return A pointer to a const char array containing the unique type name. */ - virtual const char * GetMetaDataObjectTypeName(void) const; + virtual const char * GetMetaDataObjectTypeName() const; /** * \author Hans J. Johnson * \return A constant reference to a std::type_info object */ - virtual const std::type_info & GetMetaDataObjectTypeInfo(void) const; + virtual const std::type_info & GetMetaDataObjectTypeInfo() const; /** * Defines the default behavior for printing out this element * \param os An output stream */ - virtual void Print(std::ostream & os) const; + virtual void Print( std::ostream & os ) const; protected: - /** Method for creation through the object factory. */ - // Should not be able to construct a new MetaDataObjectBase -// static Pointer New(void); -/** - * Default destructor - */ - virtual ~MetaDataObjectBase(); MetaDataObjectBase(); + virtual ~MetaDataObjectBase(); private: - //void * operator new(size_t nothing) {};//purposefully not implemented MetaDataObjectBase(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,8 +30,8 @@ #include "itkMetaDataDictionary.h" #include "itkMacro.h" -#include "itkCommand.h" -#include "itkFastMutexLock.h" +#include "itkArray.h" +#include "itkMatrix.h" #include @@ -86,32 +86,12 @@ itkTypeMacro(MetaDataObject, MetaDataObjectBase); /** - * Default constructor with no initialization. - * \author Hans J. Johnson - */ - MetaDataObject(void); - /** - * Default virtual Destructor - * \author Hans J. Johnson - */ - virtual ~MetaDataObject(void); - /** - * Initializer constructor that sets m_MetaDataObjectValue to InitializerValue - * \author Hans J. Johnson - */ - MetaDataObject(const MetaDataObjectType InitializerValue); - /** - * Copy constructor that sets m_MetaDataObjectValue to TemplateObject.m_MetaDataObjectValue - * \author Hans J. Johnson - */ - MetaDataObject(const MetaDataObject< MetaDataObjectType > & TemplateObject); - /** * The definition of this function is necessary to fulfill * the interface of the MetaDataObjectBase * \author Hans J. Johnson * \return A pointer to a const char array containing the unique type name. */ - virtual const char * GetMetaDataObjectTypeName(void) const; + virtual const char * GetMetaDataObjectTypeName() const ITK_OVERRIDE; /** * The definition of this function is necessary to fulfill @@ -119,32 +99,35 @@ * \author Hans J. Johnson * \return A constant reference to a std::type_info object */ - virtual const std::type_info & GetMetaDataObjectTypeInfo(void) const; + virtual const std::type_info & GetMetaDataObjectTypeInfo() const ITK_OVERRIDE; /** * Function to return the stored value of type MetaDataObjectType. * \author Hans J. Johnson * \return a constant reference to a MetaDataObjectType */ - const MetaDataObjectType & GetMetaDataObjectValue(void) const; + const MetaDataObjectType & GetMetaDataObjectValue() const; /** * Function to set the stored value of type MetaDataObjectType. * \author Hans J. Johnson - * \param NewValue A constant reference to at MetaDataObjectType. + * \param newValue A constant reference to at MetaDataObjectType. */ - void SetMetaDataObjectValue(const MetaDataObjectType & NewValue); + void SetMetaDataObjectValue(const MetaDataObjectType & newValue); /** * Defines the default behavior for printing out this element * \param os An output stream */ - virtual void Print(std::ostream & os) const; + virtual void Print(std::ostream & os) const ITK_OVERRIDE; + +protected: + MetaDataObject(); + virtual ~MetaDataObject(); private: - // This is made private to force the use of the - // MetaDataObject::New() operator! - //void * operator new(SizeValueType nothing) {};//purposefully not implemented + MetaDataObject(const Self &); // purposely not implemented + void operator=(const Self &); // purposely not implemented /** * A variable to store this derived type. @@ -195,47 +178,68 @@ const MetaDataObjectBase::ConstPointer baseObjectSmartPointer = Dictionary[key]; - if ( baseObjectSmartPointer.IsNull() || strcmp( typeid( T ).name(), baseObjectSmartPointer->GetMetaDataObjectTypeName() ) != 0 ) + MetaDataObject< T > const * const TempMetaDataObject = dynamic_cast< MetaDataObject< T > const * >( baseObjectSmartPointer.GetPointer() ); + if ( TempMetaDataObject == ITK_NULLPTR ) { return false; } - { - MetaDataObject< T > const * const TempMetaDataObject = dynamic_cast< MetaDataObject< T > const * >( baseObjectSmartPointer.GetPointer() ); - if ( TempMetaDataObject != NULL ) - { - outval = TempMetaDataObject->GetMetaDataObjectValue(); - } - else - { - return false; - } - } + + outval = TempMetaDataObject->GetMetaDataObjectValue(); return true; } + +#ifndef ITK_TEMPLATE_EXPLICIT_MetaDataObject +// Explicit instantiation is required to ensure correct dynamic_cast +// behavior across shared libraries. +#if defined( ITKCommon_EXPORTS ) +// don't use export +#define ITKCommon_EXPORT_EXPLICIT +#else +// only import/hidden +#define ITKCommon_EXPORT_EXPLICIT ITKCommon_EXPORT +#endif +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< bool >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< unsigned char >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< char >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< signed char >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< unsigned short >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< short >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< unsigned int >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< int >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< unsigned long >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< long >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< float >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< double >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< std::string >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< std::vector >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< std::vector >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< std::vector > >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< std::vector > >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Array >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Array >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Array >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Array >; +extern template class ITKCommon_EXPORT_EXPLICIT MetaDataObject< Matrix >; +#undef ITKCommon_EXPORT_EXPLICIT +#endif + } // end namespace itk /** - * \def NATIVE_TYPE_METADATAPRINT( TYPE_NAME ) + * \def ITK_NATIVE_TYPE_METADATAPRINT( TYPE_NAME ) * \brief An ugly macro to facilitate creating a simple implementation of * the MetaDataObject::Print() function for types that * have operator<< defined. * \param TYPE_NAME the native type parameter type */ -#define NATIVE_TYPE_METADATAPRINT(TYPE_NAME) \ +#define ITK_NATIVE_TYPE_METADATAPRINT(TYPE_NAME) \ template< > \ void \ - itk::MetaDataObject< TYPE_NAME > \ + ::itk::MetaDataObject< TYPE_NAME > \ ::Print(std::ostream & os) const \ { \ os << this->m_MetaDataObjectValue << std::endl; \ } \ - template< > \ - void \ - itk::MetaDataObject< const TYPE_NAME > \ - ::Print(std::ostream & os) const \ - { \ - os << this->m_MetaDataObjectValue << std::endl; \ - } /** * \def ITK_OBJECT_TYPE_METADATAPRINT_1COMMA( TYPE_NAME_PART1, TYPE_NAME_PART2 ) @@ -253,13 +257,6 @@ { \ this->m_MetaDataObjectValue->Print(os); \ } \ - template< > \ - void \ - itk::MetaDataObject< const TYPE_NAME_PART1, TYPE_NAME_PART2 > \ - ::Print(std::ostream & os) const \ - { \ - this->m_MetaDataObjectValue->Print(os); \ - } /** * \def ITK_IMAGE_TYPE_METADATAPRINT( STORAGE_TYPE ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMetaDataObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,40 +32,24 @@ namespace itk { -template< typename MetaDataObjectType > -MetaDataObject< MetaDataObjectType > -::MetaDataObject(void) -{ - //Nothing to do, m_MetaDataObjectValue takes this types default value. -} - -template< typename MetaDataObjectType > -MetaDataObject< MetaDataObjectType > -::~MetaDataObject(void) -{ - //Nothing to do here. -} template< typename MetaDataObjectType > MetaDataObject< MetaDataObjectType > -::MetaDataObject(const MetaDataObjectType InitializerValue): - m_MetaDataObjectValue(InitializerValue) +::MetaDataObject() { - //Nothing to be done here + // m_MetaDataObjectValue takes this types default value. } template< typename MetaDataObjectType > MetaDataObject< MetaDataObjectType > -::MetaDataObject(const MetaDataObject< MetaDataObjectType > & TemplateObject): - Superclass(), m_MetaDataObjectValue(TemplateObject.m_MetaDataObjectValue) +::~MetaDataObject() { - //Nothing to be done here } template< typename MetaDataObjectType > const char * MetaDataObject< MetaDataObjectType > -::GetMetaDataObjectTypeName(void) const +::GetMetaDataObjectTypeName() const { return typeid( MetaDataObjectType ).name(); } @@ -73,7 +57,7 @@ template< typename MetaDataObjectType > const std::type_info & MetaDataObject< MetaDataObjectType > -::GetMetaDataObjectTypeInfo(void) const +::GetMetaDataObjectTypeInfo() const { return typeid( MetaDataObjectType ); } @@ -81,7 +65,7 @@ template< typename MetaDataObjectType > const MetaDataObjectType & MetaDataObject< MetaDataObjectType > -::GetMetaDataObjectValue(void) const +::GetMetaDataObjectValue() const { return m_MetaDataObjectValue; } @@ -89,9 +73,9 @@ template< typename MetaDataObjectType > void MetaDataObject< MetaDataObjectType > -::SetMetaDataObjectValue(const MetaDataObjectType & NewValue) +::SetMetaDataObjectValue(const MetaDataObjectType & newValue) { - m_MetaDataObjectValue = NewValue; + m_MetaDataObjectValue = newValue; } template< typename MetaDataObjectType > @@ -101,6 +85,7 @@ { Superclass::Print(os); } + } // end namespace itk #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -104,7 +104,7 @@ protected: MinimumMaximumImageCalculator(); virtual ~MinimumMaximumImageCalculator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: MinimumMaximumImageCalculator(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMinimumMaximumImageCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -151,8 +151,7 @@ << std::endl; os << indent << "Index of Minimum: " << m_IndexOfMinimum << std::endl; os << indent << "Index of Maximum: " << m_IndexOfMaximum << std::endl; - os << indent << "Image: " << std::endl; - m_Image->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( Image ); os << indent << "Region: " << std::endl; m_Region.Print( os, indent.GetNextIndent() ); os << indent << "Region set by User: " << m_RegionSetByUser << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMultipleLogOutput.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMultipleLogOutput.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMultipleLogOutput.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMultipleLogOutput.h 2014-09-03 08:29:34.000000000 +0000 @@ -59,16 +59,16 @@ void AddLogOutput(OutputType *output); /** Broadcast a flush operation to all the output streams */ - virtual void Flush(); + virtual void Flush() ITK_OVERRIDE; /** Write to multiple outputs */ - virtual void Write(double timestamp); + virtual void Write(double timestamp) ITK_OVERRIDE; /** Write to multiple outputs */ - virtual void Write(const std::string & content); + virtual void Write(const std::string & content) ITK_OVERRIDE; /** Write to a buffer */ - virtual void Write(const std::string & content, double timestamp); + virtual void Write(const std::string & content, double timestamp) ITK_OVERRIDE; protected: /** Constructor */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMultiThreader.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMultiThreader.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMultiThreader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMultiThreader.h 2014-09-03 08:29:34.000000000 +0000 @@ -147,7 +147,7 @@ protected: MultiThreader(); ~MultiThreader(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: MultiThreader(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMutexLock.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMutexLock.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkMutexLock.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkMutexLock.h 2014-09-03 08:29:34.000000000 +0000 @@ -120,7 +120,7 @@ ~MutexLock() {} SimpleMutexLock m_SimpleMutexLock; - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: MutexLock(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodAllocator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodAllocator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodAllocator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodAllocator.h 2014-09-03 08:29:34.000000000 +0000 @@ -18,6 +18,7 @@ #ifndef __itkNeighborhoodAllocator_h #define __itkNeighborhoodAllocator_h #include +#include "itkMacro.h" namespace itk { @@ -51,7 +52,7 @@ typedef const TPixel * const_iterator; /** Default constructor */ - NeighborhoodAllocator():m_ElementCount(0), m_Data(0) {} + NeighborhoodAllocator():m_ElementCount(0), m_Data(ITK_NULLPTR) {} /** Default destructor */ ~NeighborhoodAllocator() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNeighborhoodIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -99,8 +99,8 @@ NeighborhoodIterator< TImage, TBoundaryCondition > ::SetPixel(const unsigned n, const PixelType & v, bool & status) { - register unsigned int i; - OffsetType temp; + unsigned int i; + OffsetType temp; typename OffsetType::OffsetValueType OverlapLow, OverlapHigh; @@ -161,9 +161,9 @@ NeighborhoodIterator< TImage, TBoundaryCondition > ::SetNeighborhood(const NeighborhoodType & N) { - register unsigned int i; - OffsetType OverlapLow, OverlapHigh, temp; - bool flag; + unsigned int i; + OffsetType OverlapLow, OverlapHigh, temp; + bool flag; const Iterator _end = this->End(); Iterator this_it; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.h 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,7 @@ * * \ingroup ITKCommon */ -template< typename TValueType> +template< typename TValue> class NumberToString { public: @@ -47,7 +47,7 @@ m_DoubleToStringConverter(double_conversion::DoubleToStringConverter::EcmaScriptConverter()) { } - std::string operator() (TValueType val); + std::string operator() (TValue val); private: NumberToString & operator=(const NumberToString &); // not defined diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumberToString.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,11 +26,11 @@ namespace itk { -template -std::string NumberToString::operator() (TValueType val) +template +std::string NumberToString::operator() (TValue val) { std::ostringstream output; - output << static_cast::PrintType>(val); + output << static_cast::PrintType>(val); return output.str(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsFixedArrayPixel.h 2014-09-03 08:29:34.000000000 +0000 @@ -184,10 +184,10 @@ // a macro to define and initialize static member variables #define itkStaticNumericTraitsGenericArrayMacro(GENERIC_ARRAY, T, D) \ template< > \ - const GENERIC_ARRAY< T, D > NumericTraits< GENERIC_ARRAY< T, D > >::Zero = GENERIC_ARRAY< T, D >( \ + ITKCommon_EXPORT const GENERIC_ARRAY< T, D > NumericTraits< GENERIC_ARRAY< T, D > >::Zero = GENERIC_ARRAY< T, D >( \ NumericTraits< T >::Zero); \ template< > \ - const GENERIC_ARRAY< T, D > NumericTraits< GENERIC_ARRAY< T, D > >::One = GENERIC_ARRAY< T, D >( \ + ITKCommon_EXPORT const GENERIC_ARRAY< T, D > NumericTraits< GENERIC_ARRAY< T, D > >::One = GENERIC_ARRAY< T, D >( \ NumericTraits< T >::One); // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraits.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraits.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraits.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraits.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,30 +26,30 @@ #define itkNUMERIC_TRAITS_MIN_MAX_MACRO() \ static ValueType min() \ { \ - return vcl_numeric_limits< ValueType >::min(); \ + return std::numeric_limits< ValueType >::min(); \ } \ static ValueType max() \ { \ - return vcl_numeric_limits< ValueType >::max(); \ + return std::numeric_limits< ValueType >::max(); \ } \ static ValueType min(ValueType) \ { \ - return vcl_numeric_limits< ValueType >::min(); \ + return std::numeric_limits< ValueType >::min(); \ } \ static ValueType max(ValueType) \ { \ - return vcl_numeric_limits< ValueType >::max(); \ + return std::numeric_limits< ValueType >::max(); \ } \ -#include "vcl_limits.h" // for vcl_numeric_limits +#include "vcl_limits.h" // for std::numeric_limits #include namespace itk { // forward decare to avoid circular dependencies -template< typename TValueType, unsigned int VLength> class FixedArray; +template< typename TValue, unsigned int VLength> class FixedArray; /** \class NumericTraits * \brief Define additional traits for native types such as int or float. @@ -67,11 +67,11 @@ * \endwiki */ template< typename T > -class NumericTraits:public vcl_numeric_limits< T > +class NumericTraits:public std::numeric_limits< T > { public: /** The type of this limits trait object. */ - typedef vcl_numeric_limits< T > TraitsType; + typedef std::numeric_limits< T > TraitsType; /** Return the type of this native type. */ typedef T ValueType; @@ -79,7 +79,7 @@ /** Return the type that can be printed. */ typedef T PrintType; - /** Return value of vcl_abs(). */ + /** Return value of std::abs(). */ typedef T AbsType; /** Accumulation of addition and multiplication. */ @@ -142,12 +142,13 @@ * VariableLengthVector will provide a different implementation * where a vector of the correct size is built. */ - static void SetLength(T &, const unsigned int s) + static void SetLength(T & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } /** Return the length of the scalar. This API is needed for * VariableLengthVector because @@ -209,7 +210,7 @@ */ template< > -class NumericTraits< bool > :public vcl_numeric_limits< bool > +class NumericTraits< bool > :public std::numeric_limits< bool > { public: typedef bool ValueType; @@ -246,12 +247,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -262,7 +264,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< char > :public vcl_numeric_limits< char > +class NumericTraits< char > :public std::numeric_limits< char > { public: typedef char ValueType; @@ -300,12 +302,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -315,7 +318,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< signed char > :public vcl_numeric_limits< signed char > +class NumericTraits< signed char > :public std::numeric_limits< signed char > { public: typedef signed char ValueType; @@ -352,12 +355,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -367,7 +371,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< unsigned char > :public vcl_numeric_limits< unsigned char > +class NumericTraits< unsigned char > :public std::numeric_limits< unsigned char > { public: typedef unsigned char ValueType; @@ -384,7 +388,7 @@ itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static unsigned char NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static unsigned char NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(unsigned char val) { return val != Zero; } static bool IsNonpositive(unsigned char val) { return val == Zero; } static bool IsNegative(unsigned char val) { return val ? false : false; } @@ -402,12 +406,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -416,7 +421,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< short > :public vcl_numeric_limits< short > +class NumericTraits< short > :public std::numeric_limits< short > { public: typedef short ValueType; @@ -432,7 +437,7 @@ static const short ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static short NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static short NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(short val) { return val > Zero; } static bool IsNonpositive(short val) { return val <= Zero; } static bool IsNegative(short val) { return val < Zero; } @@ -450,12 +455,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -465,7 +471,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< unsigned short > :public vcl_numeric_limits< unsigned short > +class NumericTraits< unsigned short > :public std::numeric_limits< unsigned short > { public: typedef unsigned short ValueType; @@ -481,7 +487,7 @@ static const unsigned short ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static unsigned short NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static unsigned short NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(unsigned short val) { return val != Zero; } static bool IsNonpositive(unsigned short val) { return val == Zero; } static bool IsNegative(unsigned short val) { return val ? false : false; } @@ -499,12 +505,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -513,7 +520,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< int > :public vcl_numeric_limits< int > +class NumericTraits< int > :public std::numeric_limits< int > { public: typedef int ValueType; @@ -529,7 +536,7 @@ static const int ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static int NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static int NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(int val) { return val > Zero; } static bool IsNonpositive(int val) { return val <= Zero; } static bool IsNegative(int val) { return val < Zero; } @@ -547,12 +554,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -562,7 +570,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< unsigned int > :public vcl_numeric_limits< unsigned int > +class NumericTraits< unsigned int > :public std::numeric_limits< unsigned int > { public: typedef unsigned int ValueType; @@ -579,8 +587,8 @@ static unsigned int min(void) { return 0; } static unsigned int max(void) { return static_cast< unsigned int >( -1 ); } - static unsigned int min(unsigned int) { return vcl_numeric_limits< ValueType >::min(); } - static unsigned int max(unsigned int) { return vcl_numeric_limits< ValueType >::max(); } + static unsigned int min(unsigned int) { return std::numeric_limits< ValueType >::min(); } + static unsigned int max(unsigned int) { return std::numeric_limits< ValueType >::max(); } static unsigned int NonpositiveMin() { return 0; } static bool IsPositive(unsigned int val) { return val != Zero; } static bool IsNonpositive(unsigned int val) { return val == Zero; } @@ -599,12 +607,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -614,7 +623,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< long > :public vcl_numeric_limits< long > +class NumericTraits< long > :public std::numeric_limits< long > { public: typedef long ValueType; @@ -630,7 +639,7 @@ static const long ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static long NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static long NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(long val) { return val > Zero; } static bool IsNonpositive(long val) { return val <= Zero; } static bool IsNegative(long val) { return val < Zero; } @@ -648,12 +657,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -663,7 +673,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< unsigned long > :public vcl_numeric_limits< unsigned long > +class NumericTraits< unsigned long > :public std::numeric_limits< unsigned long > { public: typedef unsigned long ValueType; @@ -679,7 +689,7 @@ static const unsigned long ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static unsigned long NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static unsigned long NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(unsigned long val) { return val != Zero; } static bool IsNonpositive(unsigned long val) { return val == Zero; } static bool IsNegative(unsigned long) { return false; } @@ -697,12 +707,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -712,7 +723,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< float > :public vcl_numeric_limits< float > +class NumericTraits< float > :public std::numeric_limits< float > { public: typedef float ValueType; @@ -728,7 +739,7 @@ static const float ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static float NonpositiveMin() { return -vcl_numeric_limits< ValueType >::max(); } + static float NonpositiveMin() { return -std::numeric_limits< ValueType >::max(); } static bool IsPositive(float val) { return val > Zero; } static bool IsNonpositive(float val) { return val <= Zero; } static bool IsNegative(float val) { return val < Zero; } @@ -746,12 +757,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -761,7 +773,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< double > :public vcl_numeric_limits< double > +class NumericTraits< double > :public std::numeric_limits< double > { public: typedef double ValueType; @@ -777,7 +789,7 @@ static const double ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static double NonpositiveMin() { return -vcl_numeric_limits< ValueType >::max(); } + static double NonpositiveMin() { return -std::numeric_limits< ValueType >::max(); } static bool IsPositive(double val) { return val > Zero; } static bool IsNonpositive(double val) { return val <= Zero; } static bool IsNegative(double val) { return val < Zero; } @@ -795,12 +807,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -810,7 +823,7 @@ * \ingroup ITKCommon */ template< > -class NumericTraits< long double > :public vcl_numeric_limits< long double > +class NumericTraits< long double > :public std::numeric_limits< long double > { public: typedef long double ValueType; @@ -834,7 +847,7 @@ static const long double ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static long double NonpositiveMin() { return -vcl_numeric_limits< ValueType >::max(); } + static long double NonpositiveMin() { return -std::numeric_limits< ValueType >::max(); } static bool IsPositive(long double val) { return val > Zero; } static bool IsNonpositive(long double val) { return val <= Zero; } static bool IsNegative(long double val) { return val < Zero; } @@ -852,12 +865,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -885,8 +899,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -911,12 +925,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -944,8 +959,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -970,12 +985,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1003,8 +1019,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1029,12 +1045,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1062,8 +1079,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1088,12 +1105,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1121,8 +1139,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1147,12 +1165,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1180,8 +1199,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1206,12 +1225,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1239,8 +1259,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1265,12 +1285,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1298,8 +1319,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1324,12 +1345,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1357,8 +1379,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< Self >::min(); } - static Self max() { return vcl_numeric_limits< Self >::max(); } + static Self min() { return std::numeric_limits< Self >::min(); } + static Self max() { return std::numeric_limits< Self >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1383,12 +1405,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1416,8 +1439,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< ValueType >::min(); } - static Self max() { return vcl_numeric_limits< ValueType >::max(); } + static Self min() { return std::numeric_limits< ValueType >::min(); } + static Self max() { return std::numeric_limits< ValueType >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1442,12 +1465,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1475,8 +1499,8 @@ static const Self ITKCommon_EXPORT Zero; static const Self ITKCommon_EXPORT One; - static Self min() { return vcl_numeric_limits< ValueType >::min(); } - static Self max() { return vcl_numeric_limits< ValueType >::max(); } + static Self min() { return std::numeric_limits< ValueType >::min(); } + static Self max() { return std::numeric_limits< ValueType >::max(); } static Self min(Self) { return min(); } static Self max(Self) { return max(); } static Self NonpositiveMin() @@ -1501,12 +1525,13 @@ mv[0] = v.real(); mv[1] = v.imag(); } - static void SetLength(Self &, const unsigned int s) + static void SetLength(Self & m, const unsigned int s) { if ( s != 2 ) { itkGenericExceptionMacro(<< "Cannot set the size of a complex to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1517,7 +1542,7 @@ */ template< > class NumericTraits< long long > : - public vcl_numeric_limits< long long > + public std::numeric_limits< long long > { public: typedef long long ValueType; @@ -1533,7 +1558,7 @@ static const ValueType ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static ValueType NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static ValueType NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(ValueType val) { return val > Zero; } static bool IsNonpositive(ValueType val) { return val <= Zero; } static bool IsNegative(ValueType val) { return val < Zero; } @@ -1551,12 +1576,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; @@ -1567,7 +1593,7 @@ */ template< > class NumericTraits< unsigned long long > : - public vcl_numeric_limits< unsigned long long > + public std::numeric_limits< unsigned long long > { public: typedef unsigned long long ValueType; @@ -1583,7 +1609,7 @@ static const ValueType ITKCommon_EXPORT One; itkNUMERIC_TRAITS_MIN_MAX_MACRO(); - static ValueType NonpositiveMin() { return vcl_numeric_limits< ValueType >::min(); } + static ValueType NonpositiveMin() { return std::numeric_limits< ValueType >::min(); } static bool IsPositive(ValueType val) { return val != Zero; } static bool IsNonpositive(ValueType val) { return val == Zero; } static bool IsNegative(ValueType) { return false; } @@ -1601,12 +1627,13 @@ { mv[0] = v; } - static void SetLength(ValueType &, const unsigned int s) + static void SetLength(ValueType & m, const unsigned int s) { if ( s != 1 ) { itkGenericExceptionMacro(<< "Cannot set the size of a scalar to " << s); } + m = NumericTraits< ValueType >::Zero; } }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsStdVector.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsStdVector.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsStdVector.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkNumericTraitsStdVector.h 2014-09-03 08:29:34.000000000 +0000 @@ -130,6 +130,9 @@ /** Resize the input vector to the specified size */ static void SetLength(std::vector< T > & m, const unsigned int s) { + // since std::vector often holds types that have no NumericTraits::Zero, + // allow resize() to call the type's default constructor + m.clear(); m.resize(s); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkObjectFactoryBase.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkObjectFactoryBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkObjectFactoryBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkObjectFactoryBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -195,7 +195,7 @@ }; protected: - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Register object creation information with the factory. */ void RegisterOverride(const char *classOverride, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -71,7 +71,7 @@ * object that is exactly the same type as the referring object. * This is useful in cases where an object has been cast back to a * base class. */ - virtual LightObject::Pointer CreateAnother() const; + virtual LightObject::Pointer CreateAnother() const ITK_OVERRIDE; /** Standard part of all itk objects. */ itkTypeMacro(Object, LightObject); @@ -99,13 +99,13 @@ virtual void Modified() const; /** Increase the reference count (mark as used by another object). */ - virtual void Register() const; + virtual void Register() const ITK_OVERRIDE; /** Decrease the reference count (release by another object). */ - virtual void UnRegister() const; + virtual void UnRegister() const ITK_OVERRIDE; /** Sets the reference count (use with care) */ - virtual void SetReferenceCount(int); + virtual void SetReferenceCount(int) ITK_OVERRIDE; /** This is a global flag that controls whether any debug, warning * or error messages are displayed. */ @@ -187,7 +187,7 @@ * including superclasses. Typically not called by the user (use Print() * instead) but used in the hierarchical print process to combine the * output of several classes. */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; bool PrintObservers(std::ostream & os, Indent indent) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkObjectStore.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkObjectStore.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkObjectStore.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkObjectStore.h 2014-09-03 08:29:34.000000000 +0000 @@ -127,7 +127,7 @@ protected: ObjectStore(); ~ObjectStore(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Returns a new size to grow. */ SizeValueType GetGrowthSize(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOctree.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOctree.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOctree.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOctree.h 2014-09-03 08:29:34.000000000 +0000 @@ -128,7 +128,7 @@ ImageTypePointer GetImage(); - virtual void BuildFromBuffer(const void *buffer, const unsigned int xsize, const unsigned int ysize, const unsigned int zsize); + virtual void BuildFromBuffer(const void *buffer, const unsigned int xsize, const unsigned int ysize, const unsigned int zsize) ITK_OVERRIDE; void BuildFromImage(Image< TPixel, 3 > *fromImage); @@ -142,19 +142,19 @@ int GetValue(const unsigned int Dim0, const unsigned int Dim1, const unsigned int Dim2); - virtual void SetWidth(unsigned int width); + virtual void SetWidth(unsigned int width) ITK_OVERRIDE; - virtual void SetDepth(unsigned int depth); + virtual void SetDepth(unsigned int depth) ITK_OVERRIDE; - virtual unsigned int GetWidth(); + virtual unsigned int GetWidth() ITK_OVERRIDE; - virtual unsigned int GetDepth(); + virtual unsigned int GetDepth() ITK_OVERRIDE; - virtual OctreeNode * GetTree(); + virtual OctreeNode * GetTree() ITK_OVERRIDE; - virtual const char * GetColorTable() const; + virtual const char * GetColorTable() const ITK_OVERRIDE; - virtual int GetColorTableSize() const; + virtual int GetColorTableSize() const ITK_OVERRIDE; private: Octree(const Self &); // purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,22 +30,22 @@ * \ingroup ITKCommon */ -template< typename TValueType > -class OptimizerParameters : public Array< TValueType > +template< typename TValue > +class OptimizerParameters : public Array< TValue > { public: /** The element type stored at each location in the Array. */ - typedef TValueType ValueType; - typedef OptimizerParameters Self; - typedef Array< TValueType > Superclass; - typedef Superclass ArrayType; - typedef typename Superclass::VnlVectorType VnlVectorType; - typedef typename Superclass::SizeValueType SizeValueType; + typedef TValue ValueType; + typedef OptimizerParameters Self; + typedef Array< TValue > Superclass; + typedef Superclass ArrayType; + typedef typename Superclass::VnlVectorType VnlVectorType; + typedef typename Superclass::SizeValueType SizeValueType; /** Helper class for managing different types of parameter * data. */ - typedef OptimizerParametersHelper< TValueType > OptimizerParametersHelperType; + typedef OptimizerParametersHelper< TValue > OptimizerParametersHelperType; /** Default constructor. It is created with an empty array * it has to be allocated later by assignment */ @@ -69,10 +69,10 @@ /** Set a new data pointer for the parameter data, pointing it to a different * memory block. The size of the new memory block must equal the current - * size, in elements of TValueType. + * size, in elements of TValue. * This call is passed to the assigned OptimizerParametersHelper. * \warning Memory must be managed by caller after this call. */ - virtual void MoveDataPointer( TValueType * pointer ); + virtual void MoveDataPointer( TValue * pointer ); /** Set an object that holds the parameters. Used by the helper of * derived classes that use an object other than itkArray to hold parameter diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParametersHelper.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParametersHelper.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParametersHelper.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParametersHelper.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,24 +30,24 @@ * \ingroup ITKCommon */ -template< typename TValueType > +template< typename TValue > class OptimizerParametersHelper { public: /** The element type stored at each location in the Array. */ - typedef TValueType ValueType; - typedef OptimizerParametersHelper Self; + typedef TValue ValueType; + typedef OptimizerParametersHelper Self; /** Type of common data object used by OptimizerParameters. */ - typedef Array< TValueType > CommonContainerType; + typedef Array< TValue > CommonContainerType; /** Default constructor. Nothing to do. */ OptimizerParametersHelper(){} /** Set a new data pointer for the parameter data, pointing it to a different * memory block. The size of the new memory block must equal the current - * size, in elements of TValueType. + * size, in elements of TValue. * This call is passed to the assigned OptimizerParametersHelper. * \warning Memory must be managed by caller after this call. * \c container is the OptimizerParameters object to which this helper @@ -56,7 +56,7 @@ * which this helper is assigned. */ virtual void MoveDataPointer(CommonContainerType* container, - TValueType * pointer ) + TValue * pointer ) { container->SetData( pointer, container->GetSize(), false /*LetArrayManageMemory*/); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOptimizerParameters.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,18 +24,18 @@ namespace itk { /** Default contstructor */ -template< typename TValueType > -OptimizerParameters< TValueType > -::OptimizerParameters() : Array< TValueType >() +template< typename TValue > +OptimizerParameters< TValue > +::OptimizerParameters() : Array< TValue >() { this->Initialize(); } /** Copy constructor */ -template< typename TValueType > -OptimizerParameters< TValueType > +template< typename TValue > +OptimizerParameters< TValue > ::OptimizerParameters(const OptimizerParameters& rhs) - : Array< TValueType >(rhs) + : Array< TValue >(rhs) { //Note: don't copy the OptimizerParametersHelper. //The Array copy constructor will allocate new memory @@ -46,29 +46,29 @@ } /** Constructor with size */ -template< typename TValueType > -OptimizerParameters< TValueType > +template< typename TValue > +OptimizerParameters< TValue > ::OptimizerParameters(SizeValueType dimension) - : Array< TValueType >(dimension) + : Array< TValue >(dimension) { this->Initialize(); } /** Constructor with Array assignment */ -template< typename TValueType > -OptimizerParameters< TValueType > +template< typename TValue > +OptimizerParameters< TValue > ::OptimizerParameters(const ArrayType& array) - : Array< TValueType >(array) + : Array< TValue >(array) { this->Initialize(); } -template< typename TValueType > +template< typename TValue > void -OptimizerParameters< TValueType > +OptimizerParameters< TValue > ::Initialize() { - this->m_Helper = NULL; + this->m_Helper = ITK_NULLPTR; // Set the default OptimizerParametersHelper OptimizerParametersHelperType* helper = new OptimizerParametersHelperType; // OptimizerParameters will manage this memory. @@ -76,16 +76,16 @@ } /** Destructor */ -template< typename TValueType > -OptimizerParameters< TValueType > +template< typename TValue > +OptimizerParameters< TValue > ::~OptimizerParameters() { delete this->m_Helper; } -template< typename TValueType > +template< typename TValue > void -OptimizerParameters< TValueType > +OptimizerParameters< TValue > ::SetHelper( OptimizerParametersHelperType* helper ) { delete this->m_Helper; @@ -93,10 +93,10 @@ } /** Copy operator for self */ -template< typename TValueType > -const typename OptimizerParameters< TValueType > +template< typename TValue > +const typename OptimizerParameters< TValue > ::Self & -OptimizerParameters< TValueType > +OptimizerParameters< TValue > ::operator=(const Self & rhs) { //Note: there's no need to copy the OptimizerParametersHelper. @@ -105,10 +105,10 @@ return *this; } -template< typename TValueType > -const typename OptimizerParameters< TValueType > +template< typename TValue > +const typename OptimizerParameters< TValue > ::Self & -OptimizerParameters< TValueType > +OptimizerParameters< TValue > ::operator=(const ArrayType & rhs) { // Call the superclass implementation @@ -116,10 +116,10 @@ return *this; } -template< typename TValueType > -const typename OptimizerParameters< TValueType > +template< typename TValue > +const typename OptimizerParameters< TValue > ::Self & -OptimizerParameters< TValueType > +OptimizerParameters< TValue > ::operator=(const VnlVectorType & rhs) { // Call the superclass implementation @@ -127,12 +127,12 @@ return *this; } -template< typename TValueType > +template< typename TValue > void -OptimizerParameters< TValueType > -::MoveDataPointer( TValueType * pointer ) +OptimizerParameters< TValue > +::MoveDataPointer( TValue * pointer ) { - if( m_Helper == NULL ) + if( m_Helper == ITK_NULLPTR ) { itkGenericExceptionMacro("OptimizerParameters::MoveDataPointer: " "m_Helper must be set."); @@ -140,12 +140,12 @@ this->m_Helper->MoveDataPointer( this, pointer ); } -template< typename TValueType > +template< typename TValue > void -OptimizerParameters< TValueType > +OptimizerParameters< TValue > ::SetParametersObject( LightObject * object ) { - if( m_Helper == NULL ) + if( m_Helper == ITK_NULLPTR ) { itkGenericExceptionMacro("OptimizerParameters::SetParameterObject: " "m_Helper must be set."); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOutputWindow.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOutputWindow.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkOutputWindow.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkOutputWindow.h 2014-09-03 08:29:34.000000000 +0000 @@ -100,7 +100,7 @@ protected: OutputWindow(); virtual ~OutputWindow(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: OutputWindow(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPhasedArray3DSpecialCoordinatesImage.h 2014-09-03 08:29:34.000000000 +0000 @@ -55,13 +55,13 @@ * * azimuth = arctan(x/y) * elevation = arctan(y/z) - * radius = vcl_sqrt(x^2 + y^2 + z^2) + * radius = std::sqrt(x^2 + y^2 + z^2) * * The reversed transforms are: * - * z = radius / vcl_sqrt(1 + (tan(azimuth))^2 + (tan(elevation))^2 ); - * x = z * vcl_tan(azimuth) - * y = z * vcl_tan(elevation) + * z = radius / std::sqrt(1 + (tan(azimuth))^2 + (tan(elevation))^2 ); + * x = z * std::tan(azimuth) + * y = z * std::tan(elevation) * * PhasedArray3DSpecialCoordinatesImages are templated over a pixel * type and follow the SpecialCoordinatesImage interface. The data in @@ -188,9 +188,9 @@ double maxElevation = region.GetSize(1) - 1; // Convert Cartesian coordinates into angular coordinates - TCoordRep azimuth = vcl_atan(point[0] / point[2]); - TCoordRep elevation = vcl_atan(point[1] / point[2]); - TCoordRep radius = vcl_sqrt(point[0] * point[0] + TCoordRep azimuth = std::atan(point[0] / point[2]); + TCoordRep elevation = std::atan(point[1] / point[2]); + TCoordRep radius = std::sqrt(point[0] * point[0] + point[1] * point[1] + point[2] * point[2]); @@ -222,9 +222,9 @@ double maxElevation = region.GetSize(1) - 1; // Convert Cartesian coordinates into angular coordinates - TCoordRep azimuth = vcl_atan(point[0] / point[2]); - TCoordRep elevation = vcl_atan(point[1] / point[2]); - TCoordRep radius = vcl_sqrt(point[0] * point[0] + TCoordRep azimuth = std::atan(point[0] / point[2]); + TCoordRep elevation = std::atan(point[1] / point[2]); + TCoordRep radius = std::sqrt(point[0] * point[0] + point[1] * point[1] + point[2] * point[2]); @@ -266,11 +266,11 @@ TCoordRep radius = ( index[2] * m_RadiusSampleSize ) + m_FirstSampleDistance; // Convert the angular coordinates into Cartesian coordinates - TCoordRep tanOfAzimuth = vcl_tan(azimuth); - TCoordRep tanOfElevation = vcl_tan(elevation); + TCoordRep tanOfAzimuth = std::tan(azimuth); + TCoordRep tanOfElevation = std::tan(elevation); point[2] = static_cast< TCoordRep >( radius - / vcl_sqrt(1 + / std::sqrt(1 + tanOfAzimuth * tanOfAzimuth + tanOfElevation * tanOfElevation) ); point[1] = static_cast< TCoordRep >( point[2] * tanOfElevation ); @@ -303,11 +303,11 @@ + m_FirstSampleDistance; // Convert the angular coordinates into Cartesian coordinates - TCoordRep tanOfAzimuth = vcl_tan(azimuth); - TCoordRep tanOfElevation = vcl_tan(elevation); + TCoordRep tanOfAzimuth = std::tan(azimuth); + TCoordRep tanOfElevation = std::tan(elevation); point[2] = static_cast< TCoordRep >( - radius / vcl_sqrt( + radius / std::sqrt( 1.0 + tanOfAzimuth * tanOfAzimuth + tanOfElevation * tanOfElevation) ); point[1] = static_cast< TCoordRep >( point[2] * tanOfElevation ); point[0] = static_cast< TCoordRep >( point[2] * tanOfAzimuth ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPixelTraits.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPixelTraits.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPixelTraits.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPixelTraits.h 2014-09-03 08:29:34.000000000 +0000 @@ -191,11 +191,11 @@ * of the JoinTraits are specializations of the base template. * \ingroup ITKCommon */ -template< typename TValueType1, typename TValueType2 > +template< typename TValue1, typename TValue2 > class JoinTraits { public: - typedef TValueType1 ValueType; + typedef TValue1 ValueType; }; /** \cond HIDE_SPECIALIZATION_DOCUMENTATION */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPoint.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPoint.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPoint.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPoint.h 2014-09-03 08:29:34.000000000 +0000 @@ -257,7 +257,7 @@ template< typename TCoordRepB > RealType EuclideanDistanceTo(const Point< TCoordRepB, NPointDimension > & pa) const { - const double distance = vcl_sqrt( + const double distance = std::sqrt( static_cast< double >( this->SquaredEuclideanDistanceTo(pa) ) ); return static_cast< RealType >( distance ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.h 2014-09-03 08:29:34.000000000 +0000 @@ -144,7 +144,7 @@ /** PointSet-level operation interface. */ void PassStructure(Self *inputPointSet); - virtual void Initialize(void); + virtual void Initialize(void) ITK_OVERRIDE; PointIdentifier GetNumberOfPoints(void) const; @@ -175,23 +175,23 @@ bool GetPointData(PointIdentifier, PixelType *) const; /** Methods to manage streaming. */ - virtual void UpdateOutputInformation(); + virtual void UpdateOutputInformation() ITK_OVERRIDE; - virtual void SetRequestedRegionToLargestPossibleRegion(); + virtual void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE; - virtual void CopyInformation(const DataObject *data); + virtual void CopyInformation(const DataObject *data) ITK_OVERRIDE; - virtual void Graft(const DataObject *data); + virtual void Graft(const DataObject *data) ITK_OVERRIDE; - virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); + virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE; - virtual bool VerifyRequestedRegion(); + virtual bool VerifyRequestedRegion() ITK_OVERRIDE; /** Set the requested region from this data object to match the requested * region of the data object passed in as a parameter. This method * implements the API from DataObject. The data object parameter must be * castable to a PointSet. */ - virtual void SetRequestedRegion(const DataObject *data); + virtual void SetRequestedRegion(const DataObject *data) ITK_OVERRIDE; /** Set/Get the Requested region */ virtual void SetRequestedRegion(const RegionType & region); @@ -207,7 +207,7 @@ /** Constructor for use by New() method. */ PointSet(); ~PointSet() {} - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; // If the RegionType is ITK_UNSTRUCTURED_REGION, then the following // variables represent the maximum number of region that the data diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPointSet.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,7 +50,7 @@ os << indent << "Maximum Number Of Regions: " << m_MaximumNumberOfRegions << std::endl; os << indent << "Point Data Container pointer: " - << ( ( this->m_PointDataContainer ) ? this->m_PointDataContainer.GetPointer() : 0 ) << std::endl; + << ( ( this->m_PointDataContainer ) ? this->m_PointDataContainer.GetPointer() : ITK_NULLPTR ) << std::endl; os << indent << "Size of Point Data Container: " << ( ( this->m_PointDataContainer ) ? this->m_PointDataContainer->Size() : 0 ) << std::endl; } @@ -308,8 +308,8 @@ { Superclass::Initialize(); - m_PointsContainer = 0; - m_PointDataContainer = 0; + m_PointsContainer = ITK_NULLPTR; + m_PointDataContainer = ITK_NULLPTR; } /****************************************************************************** @@ -323,8 +323,8 @@ template< typename TPixelType, unsigned int VDimension, typename TMeshTraits > PointSet< TPixelType, VDimension, TMeshTraits > ::PointSet(): - m_PointsContainer(0), - m_PointDataContainer(0) + m_PointsContainer(ITK_NULLPTR), + m_PointDataContainer(ITK_NULLPTR) { // If we used unstructured regions instead of structured regions, then @@ -374,19 +374,7 @@ PointSet< TPixelType, VDimension, TMeshTraits > ::CopyInformation(const DataObject *data) { - const PointSet *pointSet = NULL; - - try - { - pointSet = dynamic_cast< const PointSet * >( data ); - } - catch ( ... ) - { - // pointer could not be cast back down - itkExceptionMacro( << "itk::PointSet::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( PointSet * ).name() ); - } + const PointSet *pointSet = dynamic_cast< const PointSet * >( data ); if ( !pointSet ) { @@ -413,19 +401,7 @@ // Copy Meta Data this->CopyInformation(data); - const Self *pointSet = NULL; - - try - { - pointSet = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // pointer could not be cast back down - itkExceptionMacro( << "itk::PointSet::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *pointSet = dynamic_cast< const Self * >( data ); if ( !pointSet ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPolygonCell.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPolygonCell.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPolygonCell.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPolygonCell.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -298,7 +298,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } @@ -318,7 +318,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } @@ -337,7 +337,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } @@ -357,7 +357,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPostOrderTreeIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPostOrderTreeIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPostOrderTreeIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPostOrderTreeIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -63,16 +63,16 @@ /** Constructor */ template< typename TTreeType > PostOrderTreeIterator< TTreeType >::PostOrderTreeIterator(TTreeType *tree): - TreeIteratorBase< TTreeType >(tree, NULL) + TreeIteratorBase< TTreeType >(tree, ITK_NULLPTR) { - if ( tree->GetRoot() == 0 ) + if ( tree->GetRoot() == ITK_NULLPTR ) { - this->m_Begin = 0; + this->m_Begin = ITK_NULLPTR; } else { const TreeNodeType *root = dynamic_cast(tree->GetRoot()); - if(root == 0) + if(root == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Can't downcast root node to TreeNodeType *"); } @@ -95,7 +95,7 @@ bool PostOrderTreeIterator< TTreeType >::HasNext() const { - if ( const_cast< TreeNodeType * >( FindNextNode() ) != NULL ) + if ( const_cast< TreeNodeType * >( FindNextNode() ) != ITK_NULLPTR ) { return true; } @@ -116,22 +116,22 @@ const typename PostOrderTreeIterator< TTreeType >::TreeNodeType * PostOrderTreeIterator< TTreeType >::FindNextNode() const { - if ( this->m_Position == NULL || this->m_Position == this->m_Root ) + if ( this->m_Position == ITK_NULLPTR || this->m_Position == this->m_Root ) { - return NULL; + return ITK_NULLPTR; } TreeNodeType *sister = const_cast< TreeNodeType * >( FindSister(this->m_Position) ); - if ( sister != NULL ) + if ( sister != ITK_NULLPTR ) { return FindMostRightLeaf(sister); } - if(this->m_Position->GetParent() == 0) + if(this->m_Position->GetParent() == ITK_NULLPTR) { - return 0; + return ITK_NULLPTR; } TreeNodeType *rval = dynamic_cast(this->m_Position->GetParent()); - if(rval == 0) + if(rval == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Can't downcast to TreeNodeType *"); } @@ -145,11 +145,11 @@ { if ( !node->HasParent() ) { - return NULL; + return ITK_NULLPTR; } TreeNodeType *parent = dynamic_cast(node->GetParent()); - if(parent == 0) + if(parent == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Can't downcast to TreeNodeType *"); } @@ -159,21 +159,21 @@ while ( childPosition < lastChildPosition ) { - if(parent->GetChild(childPosition + 1) == 0) + if(parent->GetChild(childPosition + 1) == ITK_NULLPTR) { childPosition++; } else { TreeNodeType *sister = dynamic_cast(parent->GetChild(childPosition + 1)); - if ( sister == 0) + if ( sister == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Can't downcast to TreeNodeType *"); } return sister; } } - return NULL; + return ITK_NULLPTR; } /** Find the most right leaf */ @@ -189,23 +189,23 @@ do { - if(node->GetChild(i) == 0) + if(node->GetChild(i) == ITK_NULLPTR) { - helpNode = 0; + helpNode = ITK_NULLPTR; } else { helpNode = dynamic_cast(node->GetChild(i)); - if(helpNode == 0) + if(helpNode == ITK_NULLPTR) { itkGenericExceptionMacro(<< "Can't downcast to TreeNodeType *"); } } i++; } - while ( helpNode == NULL && i < childCount ); + while ( helpNode == ITK_NULLPTR && i < childCount ); - if ( helpNode == NULL ) + if ( helpNode == ITK_NULLPTR ) { return node; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPreOrderTreeIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPreOrderTreeIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPreOrderTreeIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPreOrderTreeIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ bool PreOrderTreeIterator< TTreeType >::HasNext() const { - if ( const_cast< TreeNodeType * >( FindNextNode() ) != NULL ) + if ( const_cast< TreeNodeType * >( FindNextNode() ) != ITK_NULLPTR ) { return true; } @@ -104,9 +104,9 @@ const typename PreOrderTreeIterator< TTreeType >::TreeNodeType * PreOrderTreeIterator< TTreeType >::FindNextNode() const { - if ( this->m_Position == NULL ) + if ( this->m_Position == ITK_NULLPTR ) { - return NULL; + return ITK_NULLPTR; } if ( this->m_Position->HasChildren() ) { @@ -115,7 +115,7 @@ if ( !this->m_Position->HasParent() ) { - return NULL; + return ITK_NULLPTR; } TreeNodeType *child = this->m_Position; @@ -124,7 +124,7 @@ // Are we a subtree? Then we are done. if ( parent && parent->ChildPosition(this->m_Root) >= 0 ) { - return NULL; + return ITK_NULLPTR; } int childPosition = parent->ChildPosition(child); @@ -134,7 +134,7 @@ { TreeNodeType *help = dynamic_cast< TreeNodeType * >( parent->GetChild(childPosition + 1) ); - if ( help != NULL ) + if ( help != ITK_NULLPTR ) { return help; } @@ -149,7 +149,7 @@ // Subtree if ( parent->ChildPosition(this->m_Root) >= 0 ) { - return NULL; + return ITK_NULLPTR; } childPosition = parent->ChildPosition(child); @@ -159,13 +159,13 @@ { TreeNodeType *help = dynamic_cast< TreeNodeType * >( parent->GetChild(childPosition + 1) ); - if ( help != NULL ) + if ( help != ITK_NULLPTR ) { return help; } } } - return NULL; + return ITK_NULLPTR; } /** Clone function */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPriorityQueueContainer.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPriorityQueueContainer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkPriorityQueueContainer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkPriorityQueueContainer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,10 @@ // MinPriorityQueueElementWrapper // ----------------------------------------------------------------------------- template< typename TElement, typename TElementPriority, typename TElementIdentifier > MinPriorityQueueElementWrapper< TElement, TElementPriority, TElementIdentifier >:: -MinPriorityQueueElementWrapper() : m_Priority(0), m_Location( Superclass::m_ElementNotFound ) +MinPriorityQueueElementWrapper() : + m_Element(0), + m_Priority(0), + m_Location( Superclass::m_ElementNotFound ) {} // ----------------------------------------------------------------------------- diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkProcessObject.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkProcessObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkProcessObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkProcessObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -436,7 +436,7 @@ void operator=( const Self & ); // purposely not implemented }; - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; // // Input Methods @@ -449,9 +449,9 @@ /** Method used internally for getting an indexed input. */ DataObject * GetInput(DataObjectPointerArraySizeType idx) - { return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second : NULL; } + { return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second : ITK_NULLPTR; } const DataObject * GetInput(DataObjectPointerArraySizeType idx) const - { return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second : NULL; } + { return idx < m_IndexedInputs.size() ? m_IndexedInputs[idx]->second : ITK_NULLPTR; } /** Set an input */ virtual void SetInput(const DataObjectIdentifierType & key, DataObject *input); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkProgressAccumulator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkProgressAccumulator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkProgressAccumulator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkProgressAccumulator.h 2014-09-03 08:29:34.000000000 +0000 @@ -114,7 +114,7 @@ protected: ProgressAccumulator(); virtual ~ProgressAccumulator(); - void PrintSelf(std::ostream & s, Indent indent) const; + virtual void PrintSelf(std::ostream & s, Indent indent) const ITK_OVERRIDE; private: /** Command for observing progress of pipeline filters */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkQuadrilateralCell.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkQuadrilateralCell.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkQuadrilateralCell.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkQuadrilateralCell.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -360,7 +360,7 @@ d = vnl_determinant(mat); //d=vtkMath::Determinant2x2(rcol,scol); - if ( vcl_abs(d) < 1.e-20 ) + if ( std::abs(d) < 1.e-20 ) { return false; } @@ -389,15 +389,15 @@ } // check for convergence - if ( ( ( vcl_abs(pcoords[0] - params[0]) ) < ITK_QUAD_CONVERGED ) - && ( ( vcl_abs(pcoords[1] - params[1]) ) < ITK_QUAD_CONVERGED ) ) + if ( ( ( std::abs(pcoords[0] - params[0]) ) < ITK_QUAD_CONVERGED ) + && ( ( std::abs(pcoords[1] - params[1]) ) < ITK_QUAD_CONVERGED ) ) { converged = 1; } // Test for bad divergence (S.Hirschberg 11.12.2001) - else if ( ( vcl_abs(pcoords[0]) > ITK_DIVERGED ) - || ( vcl_abs(pcoords[1]) > ITK_DIVERGED ) ) + else if ( ( std::abs(pcoords[0]) > ITK_DIVERGED ) + || ( std::abs(pcoords[1]) > ITK_DIVERGED ) ) { return -1; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRealTimeClock.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRealTimeClock.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRealTimeClock.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRealTimeClock.h 2014-09-03 08:29:34.000000000 +0000 @@ -74,7 +74,7 @@ virtual ~RealTimeClock(); /** Print the object information in a stream. */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: FrequencyType m_Frequency; @@ -84,7 +84,7 @@ // We hide this method in the private section, because it returns the // modified time of the itk::Object. That modified time is ambiguous with // the role of the RealTimeStamp. - virtual const TimeStamp & GetTimeStamp() const; + virtual const TimeStamp & GetTimeStamp() const ITK_OVERRIDE; }; } // end of namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.h 2014-09-03 08:29:34.000000000 +0000 @@ -61,7 +61,11 @@ /** Start counting the change of value */ void Start(void); - /** Stop counting the change of value */ + /** Stop counting the change of value. + * + * If a matching Start() has not been called before, there is no + * effect. + **/ void Stop(void); /** Returns the number of times that the probe has been started */ @@ -83,6 +87,9 @@ */ MeanType GetMean(void) const; + /** Reset the probe */ + void Reset(void); + private: ValueType m_StartValue; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkResourceProbe.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,10 +39,7 @@ ::ResourceProbe(const std::string & type, const std::string & unit): m_TypeString(type), m_UnitString(unit) { - this->m_TotalValue = NumericTraits< ValueType >::ZeroValue(); - this->m_StartValue = NumericTraits< ValueType >::ZeroValue(); - this->m_NumberOfStarts = NumericTraits< CountType >::ZeroValue(); - this->m_NumberOfStops = NumericTraits< CountType >::ZeroValue(); + this->Reset(); } /** Destructor */ @@ -51,6 +48,18 @@ ::~ResourceProbe() {} +/** Reset */ +template< typename ValueType, typename MeanType > +void +ResourceProbe< ValueType, MeanType > +::Reset(void) +{ + this->m_TotalValue = NumericTraits< ValueType >::ZeroValue(); + this->m_StartValue = NumericTraits< ValueType >::ZeroValue(); + this->m_NumberOfStarts = NumericTraits< CountType >::ZeroValue(); + this->m_NumberOfStops = NumericTraits< CountType >::ZeroValue(); +} + /** Returns the type probed value */ template< typename ValueType, typename MeanType > std::string @@ -87,7 +96,7 @@ { if ( this->m_NumberOfStops == this->m_NumberOfStarts ) { - itkGenericExceptionMacro(<< "Can't stop a probe that has not been started."); + return; } this->m_TotalValue += this->GetInstantValue() - this->m_StartValue; this->m_NumberOfStops++; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRGBAPixel.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRGBAPixel.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRGBAPixel.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRGBAPixel.h 2014-09-03 08:29:34.000000000 +0000 @@ -112,7 +112,7 @@ /** Return the value for the Nth component. */ ComponentType GetScalarValue() const { - return static_cast< ComponentType >( vcl_sqrt( + return static_cast< ComponentType >( std::sqrt( static_cast< double >( this->operator[](0) ) * static_cast< double >( this->operator[](0) ) + static_cast< double >( this->operator[](1) ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRGBPixel.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRGBPixel.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRGBPixel.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRGBPixel.h 2014-09-03 08:29:34.000000000 +0000 @@ -119,7 +119,7 @@ /** Return the value for the Nth component. */ ComponentType GetScalarValue() const { - return static_cast< ComponentType >( vcl_sqrt( + return static_cast< ComponentType >( std::sqrt( static_cast< double >( this->operator[](0) ) * static_cast< double >( this->operator[](0) ) + static_cast< double >( this->operator[](1) ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRootTreeIterator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRootTreeIterator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkRootTreeIterator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkRootTreeIterator.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ bool RootTreeIterator< TTreeType >::HasNext() const { - if ( const_cast< TreeNodeType * >( FindNextNode() ) != NULL ) + if ( const_cast< TreeNodeType * >( FindNextNode() ) != ITK_NULLPTR ) { return true; } @@ -104,13 +104,13 @@ const typename RootTreeIterator< TTreeType >::TreeNodeType * RootTreeIterator< TTreeType >::FindNextNode() const { - if ( this->m_Position == NULL ) + if ( this->m_Position == ITK_NULLPTR ) { - return NULL; + return ITK_NULLPTR; } if ( this->m_Position == this->m_Root ) { - return NULL; + return ITK_NULLPTR; } return this->m_Position->GetParent(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkShapedFloodFilledFunctionConditionalConstIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -96,8 +96,7 @@ m_TempPtr->SetLargestPossibleRegion(tempRegion); m_TempPtr->SetBufferedRegion(tempRegion); m_TempPtr->SetRequestedRegion(tempRegion); - m_TempPtr->Allocate(); - m_TempPtr->FillBuffer(NumericTraits< typename TTempImage::PixelType >::Zero); + m_TempPtr->Allocate(true); // initialize buffer to zero // Initialize the queue by adding the start index assuming one of // the m_Seeds is "inside" This might not be true, in which diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSimpleDataObjectDecorator.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSimpleDataObjectDecorator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSimpleDataObjectDecorator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSimpleDataObjectDecorator.h 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,7 @@ protected: SimpleDataObjectDecorator(); ~SimpleDataObjectDecorator(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSinRegularizedHeavisideStepFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -54,7 +54,7 @@ const RealType angleFactor = 0.5 * vnl_math::pi * this->GetOneOverEpsilon(); const RealType angle = input * angleFactor; - return static_cast< OutputType >( 0.5 * ( 1.0 + vcl_sin( angle ) ) ); + return static_cast< OutputType >( 0.5 * ( 1.0 + std::sin( angle ) ) ); } } } @@ -73,7 +73,7 @@ const RealType angleFactor = 0.5 * vnl_math::pi * this->GetOneOverEpsilon(); const RealType angle = input * angleFactor; - return static_cast< OutputType >( 0.5 * angleFactor * vcl_cos(angle) ); + return static_cast< OutputType >( 0.5 * angleFactor * std::cos(angle) ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.h 2014-09-03 08:29:34.000000000 +0000 @@ -169,10 +169,10 @@ virtual ~SmapsData_2_6(); /** Returns the heap usage in kB of the process */ - virtual MemoryLoadType GetHeapUsage(); + virtual MemoryLoadType GetHeapUsage() ITK_OVERRIDE; /** Returns the stack usage in kB of the process */ - virtual MemoryLoadType GetStackUsage(); + virtual MemoryLoadType GetStackUsage() ITK_OVERRIDE; /** fill the smaps data */ friend ITKCommon_EXPORT std::istream & operator>>(std::istream & smapsStream, @@ -198,10 +198,10 @@ virtual ~VMMapData_10_2(); /** Returns the heap usage in kB of the process */ - virtual MemoryLoadType GetHeapUsage(); + virtual MemoryLoadType GetHeapUsage() ITK_OVERRIDE; /** Returns the stack usage in kB of the process */ - virtual MemoryLoadType GetStackUsage(); + virtual MemoryLoadType GetStackUsage() ITK_OVERRIDE; /** fill the smaps data */ friend ITKCommon_EXPORT std::istream & operator>>(std::istream & stream, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmapsFileParser.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -178,8 +178,8 @@ std::stringstream vmmapCommand; vmmapCommand << "vmmap " << getpid(); - FILE *vmmapCommandOutput = NULL; - if ( ( vmmapCommandOutput = popen(vmmapCommand.str().c_str(), "r") ) == NULL ) + FILE *vmmapCommandOutput = ITK_NULLPTR; + if ( ( vmmapCommandOutput = popen(vmmapCommand.str().c_str(), "r") ) == ITK_NULLPTR ) { itkGenericExceptionMacro(<< "Error using pmap. Can execute pmap command"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointerForwardReference.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointerForwardReference.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointerForwardReference.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointerForwardReference.h 2014-09-03 08:29:34.000000000 +0000 @@ -50,7 +50,7 @@ public: /** Constructor */ SmartPointerForwardReference () - { m_Pointer = 0; } + { m_Pointer = ITK_NULLPTR; } /** Const constructor */ SmartPointerForwardReference (const SmartPointerForwardReference< T > & p); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSmartPointer.h 2014-09-03 08:29:34.000000000 +0000 @@ -39,6 +39,16 @@ * \ingroup DataAccess * \ingroup ITKCommon */ +#if __cplusplus >= 201103L +// In c++11 there is an explicit nullptr type that introduces a new keyword to +// serve as a distinguished null pointer constant: nullptr. It is of type +// nullptr_t, which is implicitly convertible and comparable to any pointer type +// or pointer-to-member type. It is not implicitly convertible or comparable to +// integral types, except for bool. +#define SP_ITK_NULLPTR nullptr +#else +#define SP_ITK_NULLPTR NULL +#endif template< typename TObjectType > class SmartPointer { @@ -47,7 +57,7 @@ /** Constructor */ SmartPointer () - { m_Pointer = 0; } + { m_Pointer = SP_ITK_NULLPTR; } /** Copy constructor */ SmartPointer (const SmartPointer< ObjectType > & p): @@ -63,7 +73,7 @@ ~SmartPointer () { this->UnRegister(); - m_Pointer = 0; + m_Pointer = SP_ITK_NULLPTR; } /** Overload operator -> */ @@ -76,9 +86,9 @@ /** Test if the pointer has been initialized */ bool IsNotNull() const - { return m_Pointer != 0; } + { return m_Pointer != SP_ITK_NULLPTR; } bool IsNull() const - { return m_Pointer == 0; } + { return m_Pointer == SP_ITK_NULLPTR; } /** Template comparison operators. */ template< typename TR > @@ -117,14 +127,9 @@ /** Overload operator assignment. */ SmartPointer & operator=(ObjectType *r) { - if ( m_Pointer != r ) - { - ObjectType *tmp = m_Pointer; //avoid recursive unregisters by retaining - // temporarily - m_Pointer = r; - this->Register(); - if ( tmp ) { tmp->UnRegister(); } - } + SmartPointer temp(r); + temp.swap(*this); + return *this; } @@ -143,6 +148,13 @@ return m_Pointer; } + void swap(SmartPointer &other) + { + ObjectType *tmp = this->m_Pointer; + this->m_Pointer = other.m_Pointer; + other.m_Pointer = tmp; + } + private: /** The pointer to the object referred to by this smart pointer. */ ObjectType *m_Pointer; @@ -164,6 +176,13 @@ p.Print(os); return os; } + +template +inline void swap( SmartPointer &a, SmartPointer &b ) +{ + a.swap(b); +} + } // end namespace itk #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.h 2014-09-03 08:29:34.000000000 +0000 @@ -70,7 +70,7 @@ } ConstSparseFieldLayerIterator() - { m_Pointer = 0; } + { m_Pointer = ITK_NULLPTR; } ConstSparseFieldLayerIterator(TNodeType *p) { m_Pointer = p; } @@ -257,7 +257,7 @@ protected: SparseFieldLayer(); ~SparseFieldLayer(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: SparseFieldLayer(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSparseFieldLayer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,6 @@ #define __itkSparseFieldLayer_hxx #include "itkSparseFieldLayer.h" #include -#include "vcl_cmath.h" namespace itk { @@ -68,7 +67,7 @@ unsigned int size, regionsize; size = Size(); regionsize = static_cast< unsigned int >( - vcl_ceil( static_cast< float >( size ) / static_cast< float >( num ) ) ); + std::ceil( static_cast< float >( size ) / static_cast< float >( num ) ) ); ConstIterator position = Begin(); ConstIterator last = End(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSpatialOrientationAdapter.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSpatialOrientationAdapter.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSpatialOrientationAdapter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSpatialOrientationAdapter.h 2014-09-03 08:29:34.000000000 +0000 @@ -95,10 +95,10 @@ SpatialOrientationAdapter() {} /** convert from direction cosines. */ - virtual OrientationType FromDirectionCosines(const DirectionType & Dir); + virtual OrientationType FromDirectionCosines(const DirectionType & Dir) ITK_OVERRIDE; /** convert to direction cosines. */ - virtual DirectionType ToDirectionCosines(const OrientationType & Or); + virtual DirectionType ToDirectionCosines(const OrientationType & Or) ITK_OVERRIDE; }; } // namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.h 2014-09-03 08:29:34.000000000 +0000 @@ -170,7 +170,7 @@ /** Allocate the image memory. The size of the image must * already be set, e.g. by calling SetRegions(). */ - void Allocate(); + virtual void Allocate(bool initialize=false) ITK_OVERRIDE; /** Restore the data object to its initial state. This means releasing * memory. */ @@ -226,7 +226,7 @@ /** Return a pointer to the beginning of the buffer. This is used by * the image iterator class. */ TPixel * GetBufferPointer() { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; } - const TPixel * GetBufferPointer() const { return m_Buffer ? m_Buffer->GetBufferPointer() : 0; } + const TPixel * GetBufferPointer() const { return m_Buffer ? m_Buffer->GetBufferPointer() : ITK_NULLPTR; } /** Return a pointer to the container. */ PixelContainer * GetPixelContainer() { return m_Buffer.GetPointer(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSpecialCoordinatesImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,14 +43,14 @@ template< typename TPixel, unsigned int VImageDimension > void SpecialCoordinatesImage< TPixel, VImageDimension > -::Allocate() +::Allocate(bool initialize) { SizeValueType num; this->ComputeOffsetTable(); num = static_cast(this->GetOffsetTable()[VImageDimension]); - m_Buffer->Reserve(num); + m_Buffer->Reserve(num,initialize); } template< typename TPixel, unsigned int VImageDimension > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamLogOutput.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamLogOutput.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamLogOutput.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamLogOutput.h 2014-09-03 08:29:34.000000000 +0000 @@ -62,16 +62,16 @@ void SetStream(StreamType & Stream); /** flush a buffer */ - virtual void Flush(); + virtual void Flush() ITK_OVERRIDE; /** Write to multiple outputs */ - virtual void Write(double timestamp); + virtual void Write(double timestamp) ITK_OVERRIDE; /** Write to a buffer */ - virtual void Write(std::string const & content); + virtual void Write(std::string const & content) ITK_OVERRIDE; /** Write to a buffer */ - virtual void Write(std::string const & content, double timestamp); + virtual void Write(std::string const & content, double timestamp) ITK_OVERRIDE; protected: /** Constructor */ @@ -80,7 +80,7 @@ /** Destructor */ virtual ~StdStreamLogOutput(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamStateSave.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamStateSave.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamStateSave.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkStdStreamStateSave.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,69 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkStdStreamStateSave_h +#define __itkStdStreamStateSave_h + +#include +#include + +namespace itk +{ +/** \class StdStreamStateSave + * + * \brief Save a stream's format state and restore it upon destruction + * + * An RAII class to provide an exception safe mechanism to restore the + * format state of a stream. The class holds a resource (the stream's + * format state) and resets the resource to a default state upon destruction. + * + * Typical usage: + \code{.cpp} + itk::StdStreamStateSave coutState(std::cout); + std::cout.precision(20); + std::cout.hex(); + ... + return; + \endcode + * + * \ingroup ITKCommon + */ + +class StdStreamStateSave +{ +public: + explicit StdStreamStateSave(std::ios& stream) : + m_Ios(stream), + m_State(NULL) + { + m_State.copyfmt(stream); + } + ~StdStreamStateSave() + { + m_Ios.copyfmt(m_State); + } + +private: + StdStreamStateSave(const StdStreamStateSave &); //purposely not implemented + void operator=(const StdStreamStateSave &); //purposely not implemented + + std::ios& m_Ios; + std::ios m_State; +}; +} + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkStreamingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkStreamingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkStreamingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkStreamingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -143,15 +143,19 @@ << " inputs are required but only " << ninputs << " are specified."); return; } - this->SetAbortGenerateData(0); - this->UpdateProgress(0.0); - this->m_Updating = true; /** - * Tell all Observers that the filter is starting + * Tell all Observers that the filter is starting, before emiting + * the 0.0 Progress event */ this->InvokeEvent( StartEvent() ); + + this->SetAbortGenerateData(0); + this->UpdateProgress(0.0); + this->m_Updating = true; + + /** * Allocate the output buffer. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEigenAnalysis.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -147,7 +147,7 @@ e2[i] = scale * scale * h; f = d[l]; - d__1 = vcl_sqrt(h); + d__1 = std::sqrt(h); g = ( -1.0 ) * vnl_math_sgn0(f) * vnl_math_abs(d__1); e[i] = scale * g; h -= f * g; @@ -267,7 +267,7 @@ } f = d[l]; - d__1 = vcl_sqrt(h); + d__1 = std::sqrt(h); g = ( -1.0 ) * vnl_math_sgn0(f) * vnl_math_abs(d__1); e[i] = scale * g; h -= f * g; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEllipsoidInteriorExteriorSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEllipsoidInteriorExteriorSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEllipsoidInteriorExteriorSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkSymmetricEllipsoidInteriorExteriorSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,12 +25,13 @@ { template< unsigned int VDimension, typename TInput > SymmetricEllipsoidInteriorExteriorSpatialFunction< VDimension, TInput > -::SymmetricEllipsoidInteriorExteriorSpatialFunction() +::SymmetricEllipsoidInteriorExteriorSpatialFunction() : + m_UniqueAxis(10), // Length of unique axis + m_SymmetricAxes(5), // Length of symmetric axes + m_VectorRatio(0.0) // Vector ratio { m_Center.Fill(0.0); // Origin of ellipsoid m_Orientation.Fill(1.0); // Orientation of unique axis - m_UniqueAxis = 10; // Length of unique axis - m_SymmetricAxes = 5; // Length of symmetric axes } template< unsigned int VDimension, typename TInput > @@ -56,10 +57,10 @@ pointVector[i] = position[i] - m_Center[i]; } - uniqueTerm = vcl_pow( static_cast< double >( ( ( pointVector * m_Orientation ) / ( .5 * m_UniqueAxis ) ) ), + uniqueTerm = std::pow( static_cast< double >( ( ( pointVector * m_Orientation ) / ( .5 * m_UniqueAxis ) ) ), static_cast< double >( 2 ) ); symmetricVector = pointVector - ( m_Orientation * ( pointVector * m_Orientation ) ); - symmetricTerm = vcl_pow( + symmetricTerm = std::pow( static_cast< double >( ( ( symmetricVector.GetNorm() ) / ( .5 * m_SymmetricAxes ) ) ), static_cast< double >( 2 ) ); if ( ( uniqueTerm + symmetricTerm ) >= 0 && ( uniqueTerm + symmetricTerm ) <= 1 ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTetrahedronCell.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTetrahedronCell.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTetrahedronCell.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTetrahedronCell.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -208,7 +208,7 @@ for ( i = 0; i < 4; i++ ) { this->GetFace (i, triangle); - triangle->EvaluatePosition(x, points, closest, pc, &dist2, NULL); + triangle->EvaluatePosition(x, points, closest, pc, &dist2, ITK_NULLPTR); if ( dist2 < *minDist2 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTextOutput.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTextOutput.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTextOutput.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTextOutput.h 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ /** New macro for creation of through a Smart Pointer */ itkNewMacro(TextOutput); - virtual void DisplayText(const char *s) + virtual void DisplayText(const char *s) ITK_OVERRIDE { std::cout << s << std::endl; } protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIndexedContainerPartitioner.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIndexedContainerPartitioner.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIndexedContainerPartitioner.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIndexedContainerPartitioner.h 2014-09-03 08:29:34.000000000 +0000 @@ -79,7 +79,7 @@ ThreadIdType PartitionDomain(const ThreadIdType threadId, const ThreadIdType requestedTotal, const DomainType& completeIndexRange, - DomainType& subIndexRange) const; + DomainType& subIndexRange) const ITK_OVERRIDE; protected: ThreadedIndexedContainerPartitioner(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIteratorRangePartitioner.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIteratorRangePartitioner.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIteratorRangePartitioner.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkThreadedIteratorRangePartitioner.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,6 +22,8 @@ #include "itkThreadedIteratorRangePartitioner.h" #include "itkMath.h" +#include + namespace itk { @@ -48,12 +50,8 @@ // overallIndexRange is expected to be inclusive // determine the actual number of pieces that will be generated - typename DomainType::IteratorType it; - ThreadIdType count = NumericTraits< ThreadIdType >::Zero; - for( it = completeDomain.Begin(); it != completeDomain.End(); ++it ) - { - ++count; - } + ThreadIdType count = std::distance( completeDomain.Begin(), completeDomain.End() ); + ThreadIdType valuesPerThread = Math::Ceil( static_cast< double >( count ) / static_cast< double >( requestedTotal )); ThreadIdType maxThreadIdUsed = @@ -66,22 +64,14 @@ return maxThreadIdUsed + 1; } - // Split the domain range - it = completeDomain.Begin(); const ThreadIdType startIndexCount = threadId * valuesPerThread; - for( ThreadIdType ii = 0; ii < startIndexCount; ++ii ) - { - ++it; - } - subDomain.m_Begin = it; + subDomain.m_Begin = completeDomain.Begin(); + std::advance(subDomain.m_Begin, startIndexCount ); + if (threadId < maxThreadIdUsed) { - const ThreadIdType endIndexCount = valuesPerThread; - for( ThreadIdType ii = 0; ii < endIndexCount; ++ii ) - { - ++it; - } - subDomain.m_End = it; + subDomain.m_End = subDomain.m_Begin; + std::advance(subDomain.m_End, valuesPerThread ); } if (threadId == maxThreadIdUsed) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkThreadLogger.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkThreadLogger.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkThreadLogger.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkThreadLogger.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,16 +72,16 @@ /** Set the priority level for the current logger. Only messages that have * priorities equal or greater than the one set here will be posted to the * current outputs. */ - virtual void SetPriorityLevel(PriorityLevelType level); + virtual void SetPriorityLevel(PriorityLevelType level) ITK_OVERRIDE; /** Get the priority level for the current logger. Only messages that have * priorities equal or greater than the one set here will be posted to the * current outputs. */ - virtual PriorityLevelType GetPriorityLevel() const; + virtual PriorityLevelType GetPriorityLevel() const ITK_OVERRIDE; - virtual void SetLevelForFlushing(PriorityLevelType level); + virtual void SetLevelForFlushing(PriorityLevelType level) ITK_OVERRIDE; - virtual PriorityLevelType GetLevelForFlushing() const; + virtual PriorityLevelType GetLevelForFlushing() const ITK_OVERRIDE; /** Set the delay in milliseconds between checks to see if there are any * low priority messages to be processed. @@ -94,11 +94,11 @@ virtual DelayType GetDelay() const; /** Registers another output stream with the multiple output. */ - virtual void AddLogOutput(OutputType *output); + virtual void AddLogOutput(OutputType *output) ITK_OVERRIDE; - virtual void Write(PriorityLevelType level, std::string const & content); + virtual void Write(PriorityLevelType level, std::string const & content) ITK_OVERRIDE; - virtual void Flush(); + virtual void Flush() ITK_OVERRIDE; protected: @@ -109,7 +109,7 @@ virtual ~ThreadLogger(); /** Print contents of a ThreadLogger */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; static ITK_THREAD_RETURN_TYPE ThreadFunction(void *); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTimeProbe.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTimeProbe.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTimeProbe.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTimeProbe.h 2014-09-03 08:29:34.000000000 +0000 @@ -65,7 +65,7 @@ /** Get the current time. * Warning: the returned value is not the elapsed time since the last Start() call. */ - virtual RealTimeClock::TimeStampType GetInstantValue(void) const; + virtual TimeStampType GetInstantValue(void) const ITK_OVERRIDE; /** Returns the average times passed between the starts and stops of the * probe. See the RealTimeClock for details on the precision and units of @@ -75,6 +75,9 @@ */ itkLegacyMacro(TimeStampType GetMeanTime(void) const); + /** Get a handle to m_RealTimeClock. */ + itkGetConstObjectMacro( RealTimeClock, RealTimeClock ); + private: RealTimeClock::Pointer m_RealTimeClock; }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTorusInteriorExteriorSpatialFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTorusInteriorExteriorSpatialFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTorusInteriorExteriorSpatialFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTorusInteriorExteriorSpatialFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,7 @@ double y = position[1] - m_Origin[1]; double z = position[2] - m_Origin[2]; - double k = vcl_pow(m_MajorRadius - vcl_sqrt(x * x + y * y), 2.0) + z * z; + double k = std::pow(m_MajorRadius - std::sqrt(x * x + y * y), 2.0) + z * z; if ( k <= ( m_MinorRadius * m_MinorRadius ) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeChangeEvent.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeChangeEvent.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeChangeEvent.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeChangeEvent.h 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ /** Constructor */ TreeChangeEvent(): - m_ChangePosition( NULL ) + m_ChangePosition( ITK_NULLPTR ) {} /** Copy constructor */ @@ -50,13 +50,13 @@ virtual ~TreeChangeEvent() {} /** Get the event name */ - virtual const char * GetEventName() const { return "TreeChangeEvent"; } + virtual const char * GetEventName() const ITK_OVERRIDE { return "TreeChangeEvent"; } /** Check the event */ - virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); } + virtual bool CheckEvent(const::itk::EventObject *e) const ITK_OVERRIDE { return (dynamic_cast< const Self * >( e ) != ITK_NULLPTR); } /** Make the event object */ - virtual::itk::EventObject * MakeObject() const { return new Self(*m_ChangePosition); } + virtual::itk::EventObject * MakeObject() const ITK_OVERRIDE { return new Self(*m_ChangePosition); } /** Get the change position */ const TreeIteratorBase< TTreeType > & GetChangePosition() const { return *m_ChangePosition; } @@ -125,7 +125,7 @@ virtual const char * GetEventName() const { return "TreeAddEvent"; } /** Check event function */ - virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); } + virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != ITK_NULLPTR); } /** Make the event object */ virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); } @@ -160,7 +160,7 @@ virtual const char * GetEventName() const { return "TreeRemoveEvent"; } /** Check the event */ - virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); } + virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != ITK_NULLPTR); } /** Make the event object */ virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); } @@ -190,7 +190,7 @@ virtual const char * GetEventName() const { return "TreePruneEvent"; } - virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != NULL); } + virtual bool CheckEvent(const::itk::EventObject *e) const { return (dynamic_cast< const Self * >( e ) != ITK_NULLPTR); } virtual::itk::EventObject * MakeObject() const { return new Self(*this->m_ChangePosition); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainerBase.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainerBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainerBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainerBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ * \ingroup DataRepresentation * \ingroup ITKCommon */ -template< typename TValueType > +template< typename TValue > class TreeContainerBase:public Object { public: @@ -40,35 +40,35 @@ typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; - typedef TValueType ValueType; + typedef TValue ValueType; /** Run-time type information (and related methods). */ itkTypeMacro(TreeContainerBase, Object); /** Set the root element. * A new node is created and the element is added to the node */ - virtual bool SetRoot(const TValueType element) = 0; + virtual bool SetRoot(const TValue element) = 0; /** Set the root has a node */ - virtual bool SetRoot(TreeNode< TValueType > *node) = 0; + virtual bool SetRoot(TreeNode< TValue > *node) = 0; /** Return true if the tree contains the element */ - virtual bool Contains(const TValueType element) = 0; + virtual bool Contains(const TValue element) = 0; /** Return the number of nodes in the tree */ virtual int Count() const = 0; /** Return if the element is a leaf */ - virtual bool IsLeaf(const TValueType element) = 0; + virtual bool IsLeaf(const TValue element) = 0; /** Return if the element is root */ - virtual bool IsRoot(const TValueType element) = 0; + virtual bool IsRoot(const TValue element) = 0; /** Clear the tree */ virtual bool Clear() = 0; /** Get the root as a node */ - virtual const TreeNode< TValueType > * GetRoot() const = 0; + virtual const TreeNode< TValue > * GetRoot() const = 0; /** Set if the tree is a subtree */ void SetSubtree(bool val) { m_SubTree = val; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,23 +29,23 @@ * This class derives from the TreeContainerBase class. * The class is templated over the type of the elements. * - * \tparam TValueType Element type stored at each location in the Tree. + * \tparam TValue Element type stored at each location in the Tree. * * \ingroup DataRepresentation * \ingroup ITKCommon */ -template< typename TValueType > -class TreeContainer:public TreeContainerBase< TValueType > +template< typename TValue > +class TreeContainer:public TreeContainerBase< TValue > { public: /** Standard typedefs */ - typedef TreeContainerBase< TValueType > Superclass; - typedef TreeContainer< TValueType > Self; - typedef SmartPointer< Self > Pointer; - typedef SmartPointer< const Self > ConstPointer; - typedef TValueType ValueType; - typedef TreeNode< ValueType > TreeNodeType; + typedef TreeContainerBase< TValue > Superclass; + typedef TreeContainer< TValue > Self; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + typedef TValue ValueType; + typedef TreeNode< ValueType > TreeNodeType; /** Iterators typedef */ typedef TreeIteratorBase< Self > IteratorType; @@ -61,34 +61,34 @@ TreeContainer(int defaultChildrenCount); /** Constructor */ - TreeContainer(TreeContainer< TValueType > & tree); + TreeContainer(TreeContainer< TValue > & tree); /** Set the root as an element */ - virtual bool SetRoot(const TValueType element); + virtual bool SetRoot(const TValue element); /** The the root as an iterator position */ bool SetRoot(IteratorType & pos); /** Set the root as a tree node */ - virtual bool SetRoot(TreeNode< TValueType > *node); + virtual bool SetRoot(TreeNode< TValue > *node); /** Return true if the element is in the tree */ - bool Contains(const TValueType element); + bool Contains(const TValue element); /** Return the number of elements in the tree */ int Count() const; /** Return true if the element is a leaf */ - bool IsLeaf(const TValueType element); + bool IsLeaf(const TValue element); /** Return true if the element is a root */ - bool IsRoot(const TValueType element); + bool IsRoot(const TValue element); /** Clear the tree */ bool Clear(); /** operator equal */ - bool operator==(TreeContainer< TValueType > & tree); + bool operator==(TreeContainer< TValue > & tree); /** Swap the iterators */ bool Swap(IteratorType & v, IteratorType & w); @@ -97,10 +97,10 @@ const TreeNodeType * GetRoot() const { return m_Root.GetPointer(); } /** Add a child to a given parent using values */ - bool Add(const TValueType child, const TValueType parent); + bool Add(const TValue child, const TValue parent); /** Get node given a value */ - const TreeNodeType * GetNode(TValueType val) const; + const TreeNodeType * GetNode(TValue val) const; protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeContainer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,17 +23,17 @@ namespace itk { /** Constructor */ -template< typename TValueType > -TreeContainer< TValueType >::TreeContainer() +template< typename TValue > +TreeContainer< TValue >::TreeContainer() { - m_Root = NULL; + m_Root = ITK_NULLPTR; this->SetSubtree(false); m_DefaultChildrenCount = 2; } /** Constructor with default children count */ -template< typename TValueType > -TreeContainer< TValueType >::TreeContainer(int dcc) +template< typename TValue > +TreeContainer< TValue >::TreeContainer(int dcc) { m_Root = NULL; this->SetSubtree(false); @@ -41,8 +41,8 @@ } /** Constructor by adding a tree */ -template< typename TValueType > -TreeContainer< TValueType >::TreeContainer(TreeContainer< TValueType > & ) +template< typename TValue > +TreeContainer< TValue >::TreeContainer(TreeContainer< TValue > & ) { m_Root = NULL; this->SetSubtree(false); @@ -50,34 +50,34 @@ } /** Destructor */ -template< typename TValueType > -TreeContainer< TValueType >::~TreeContainer() +template< typename TValue > +TreeContainer< TValue >::~TreeContainer() {} /** Set the root of the tree */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::SetRoot(const TValueType element) +TreeContainer< TValue >::SetRoot(const TValue element) { m_Root = TreeNodeType::New(); m_Root->Set(element); - m_Root->SetParent(NULL); + m_Root->SetParent(ITK_NULLPTR); return true; } /** Set the root of the tree */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::SetRoot(TreeNode< TValueType > *node) +TreeContainer< TValue >::SetRoot(TreeNode< TValue > *node) { m_Root = node; return true; } /** Count the number of nodes in the tree */ -template< typename TValueType > +template< typename TValue > int -TreeContainer< TValueType >::Count() const +TreeContainer< TValue >::Count() const { if ( !m_Root ) { @@ -95,19 +95,19 @@ } /** Swap the iterators */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::Swap(IteratorType & v, IteratorType & w) +TreeContainer< TValue >::Swap(IteratorType & v, IteratorType & w) { - TreeNode< TValueType > *nv = v.GetNode(); - TreeNode< TValueType > *nw = w.GetNode(); + TreeNode< TValue > *nv = v.GetNode(); + TreeNode< TValue > *nw = w.GetNode(); if ( nv == NULL || nw == NULL ) { return false; } - TreeNode< TValueType > *pv = nv->GetParent(); - TreeNode< TValueType > *pw = nw->GetParent(); + TreeNode< TValue > *pv = nv->GetParent(); + TreeNode< TValue > *pw = nw->GetParent(); if ( pv == NULL && pw == NULL ) { @@ -136,9 +136,9 @@ } /** Return true if the tree contains this element */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::Contains(const TValueType element) +TreeContainer< TValue >::Contains(const TValue element) { PreOrderTreeIterator< Self > it(this, m_Root); it.GoToBegin(); @@ -154,9 +154,9 @@ } /** Equal operator */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::operator==(TreeContainer< TValueType > & tree) +TreeContainer< TValue >::operator==(TreeContainer< TValue > & tree) { PreOrderTreeIterator< Self > it(this, m_Root); it.GoToBegin(); @@ -177,9 +177,9 @@ } /** Return true if the given element is a leaf of the tree */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::IsLeaf(TValueType element) +TreeContainer< TValue >::IsLeaf(TValue element) { PreOrderTreeIterator< Self > it(this, m_Root); it.GoToBegin(); @@ -201,9 +201,9 @@ } /** Return true of the node containing the element is the root */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::IsRoot(TValueType element) +TreeContainer< TValue >::IsRoot(TValue element) { PreOrderTreeIterator< Self > it(this, m_Root); it.GoToBegin(); @@ -226,19 +226,19 @@ } /** Clear the tree */ -template< typename TValueType > -bool TreeContainer< TValueType >::Clear() +template< typename TValue > +bool TreeContainer< TValue >::Clear() { PreOrderTreeIterator< Self > it(this, m_Root); bool success = it.Remove(); - m_Root = NULL; + m_Root = ITK_NULLPTR; return success; } /** Get node given a value */ -template< typename TValueType > -const TreeNode< TValueType > * -TreeContainer< TValueType >::GetNode(TValueType val) const +template< typename TValue > +const TreeNode< TValue > * +TreeContainer< TValue >::GetNode(TValue val) const { PreOrderTreeIterator< Self > it(this, m_Root); it.GoToBegin(); @@ -250,26 +250,26 @@ } ++it; } - return NULL; + return ITK_NULLPTR; } /** Set the root of the tree from the iterator position */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::SetRoot(IteratorType & pos) +TreeContainer< TValue >::SetRoot(IteratorType & pos) { if ( this->m_SubTree ) { return false; } - TreeNode< TValueType > *node = pos.GetNode(); + TreeNode< TValue > *node = pos.GetNode(); if ( node == NULL ) { return false; } - TreeNode< TValueType > *parent = node->GetParent(); - TreeNode< TValueType > *help = NULL; + TreeNode< TValue > *parent = node->GetParent(); + TreeNode< TValue > *help = NULL; if ( parent == NULL ) { @@ -297,13 +297,13 @@ } /** Add a child to a given parent */ -template< typename TValueType > +template< typename TValue > bool -TreeContainer< TValueType >::Add(const TValueType child, const TValueType parent) +TreeContainer< TValue >::Add(const TValue child, const TValue parent) { if ( !m_Root ) { - std::cout << "TreeContainer::Add() : The tree is empty" << std::endl; + std::cout << "TreeContainer::Add() : The tree is empty" << std::endl; return false; } // Find the first node in the tree that has the parent value @@ -322,9 +322,9 @@ } /** Print self */ -template< typename TValueType > +template< typename TValue > void -TreeContainer< TValueType >::PrintSelf(std::ostream & os, Indent indent) const +TreeContainer< TValue >::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "Number of objects = " << this->Count() << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorBase.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,7 +53,7 @@ m_Position = const_cast< TreeNodeType * >( m_Root ); m_Tree = tree; m_Begin = m_Position; - m_End = NULL; + m_End = ITK_NULLPTR; } /** Constructor */ @@ -71,7 +71,7 @@ m_Position = const_cast< TreeNodeType * >( m_Root ); m_Tree = const_cast< TTreeType * >( tree ); m_Begin = m_Position; - m_End = NULL; + m_End = ITK_NULLPTR; } /** Return the current value of the node */ @@ -98,13 +98,9 @@ bool TreeIteratorBase< TTreeType >::Add(ValueType element) { - if ( m_Position == NULL && m_Root == NULL ) + if ( m_Position == ITK_NULLPTR && m_Root == ITK_NULLPTR ) { - bool returnValue = false; - if ( m_Tree ) - { - returnValue = const_cast< TTreeType * >( m_Tree )->SetRoot(element); - } + bool returnValue = const_cast< TTreeType * >( m_Tree )->SetRoot(element); // signal AddEvent for self m_Root = dynamic_cast< const TreeNodeType * >( const_cast< TTreeType * >( m_Tree )->GetRoot() ); m_Position = const_cast< TreeNodeType * >( m_Root ); @@ -112,7 +108,7 @@ m_Tree->InvokeEvent( TreeAddEvent< TTreeType >(*this) ); return returnValue; } - else if ( m_Position == NULL ) + else if ( m_Position == ITK_NULLPTR ) { return false; } @@ -169,7 +165,7 @@ bool TreeIteratorBase< TTreeType >::IsRoot() const { - if ( m_Root == NULL ) + if ( m_Root == ITK_NULLPTR ) { return false; } @@ -196,13 +192,13 @@ return false; } - if ( m_Root == NULL ) + if ( m_Root == ITK_NULLPTR ) { m_Root = static_cast< const TreeNodeType * >( subTree.GetRoot() ); } else { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { return false; } @@ -227,11 +223,11 @@ bool TreeIteratorBase< TTreeType >::HasChild(int number) const { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { return false; } - if ( m_Position->GetChild(number) != NULL ) + if ( m_Position->GetChild(number) != ITK_NULLPTR ) { return true; } @@ -261,7 +257,7 @@ } TreeNodeType *child = dynamic_cast< TreeNodeType * >( m_Position->GetChild(number) ); - if ( child != NULL ) + if ( child != ITK_NULLPTR ) { // signal PruneEvent (node plus all children are removed) TreeIteratorBase< TTreeType > *childIterator = Clone(); @@ -283,7 +279,7 @@ int TreeIteratorBase< TTreeType >::CountChildren() const { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { return -1; } @@ -295,7 +291,7 @@ bool TreeIteratorBase< TTreeType >::HasParent() const { - return ( m_Position != NULL && m_Position->GetParent() != NULL ); + return ( m_Position != ITK_NULLPTR && m_Position->GetParent() != ITK_NULLPTR ); } /** Disconnect the tree */ @@ -303,7 +299,7 @@ bool TreeIteratorBase< TTreeType >::Disconnect() { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { return false; } @@ -331,7 +327,7 @@ m_Tree->InvokeEvent( TreeRemoveEvent< TTreeType >(*this) ); - m_Position = NULL; + m_Position = ITK_NULLPTR; return true; } @@ -343,7 +339,7 @@ itkGenericOutputMacro("Not implemented yet"); ::itk::ExceptionObject e_(__FILE__, __LINE__, "Not implemented yet", ITK_LOCATION); throw e_; /* Explicit naming to work around Intel compiler bug. */ - return 0; + return ITK_NULLPTR; } /** Return the first parent found */ @@ -351,9 +347,9 @@ const typename TreeIteratorBase< TTreeType >::TreeNodeType * TreeIteratorBase< TTreeType >::GetParent() const { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { - return NULL; + return ITK_NULLPTR; } return m_Position->GetParent(); @@ -366,21 +362,21 @@ itkGenericOutputMacro("Not implemented yet"); ::itk::ExceptionObject e_(__FILE__, __LINE__, "Not implemented yet", ITK_LOCATION); throw e_; /* Explicit naming to work around Intel compiler bug. */ - return 0; + return ITK_NULLPTR; } /** Go to a child */ template< typename TTreeType > bool TreeIteratorBase< TTreeType >::GoToChild(ChildIdentifier number) { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { return false; } TreeNodeType *next = dynamic_cast< TreeNodeType * >( m_Position->GetChild(number) ); - if ( next == NULL ) + if ( next == ITK_NULLPTR ) { return false; } @@ -392,7 +388,7 @@ template< typename TTreeType > bool TreeIteratorBase< TTreeType >::GoToParent() { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { return false; } @@ -412,18 +408,18 @@ { if ( !m_Position ) { - return NULL; + return ITK_NULLPTR; } TreeNodeType *child = dynamic_cast< TreeNodeType * >( m_Position->GetChild(number) ); if ( !child ) { - return NULL; + return ITK_NULLPTR; } // return new WalkTreeIterator( child, m_Root, m_Tree, getType() // ); - return NULL; + return ITK_NULLPTR; } /** Count the number of nodes from the beginning */ @@ -481,7 +477,7 @@ bool TreeIteratorBase< TTreeType >::Remove() { - if ( m_Position == NULL ) + if ( m_Position == ITK_NULLPTR ) { return false; } @@ -497,13 +493,13 @@ } else if ( m_Root == m_Position ) { - m_Root = NULL; - m_Tree->SetRoot( (TreeNodeType *)NULL ); + m_Root = ITK_NULLPTR; + m_Tree->SetRoot( (TreeNodeType *)ITK_NULLPTR ); // this won't do anything if root is already != NULL ==> root cannot be // removed } - m_Position->SetParent(NULL); // we don't have a parent anymore + m_Position->SetParent(ITK_NULLPTR); // we don't have a parent anymore m_Tree->InvokeEvent( TreePruneEvent< TTreeType >(*this) ); while ( m_Position->CountChildren() > 0 ) // remove all children { @@ -512,8 +508,8 @@ m_Position->Remove(child); } - position = NULL; - m_Position = NULL; // Smart pointer, deletes *m_Position + position = ITK_NULLPTR; + m_Position = ITK_NULLPTR; // Smart pointer, deletes *m_Position m_Tree->Modified(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorClone.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorClone.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorClone.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeIteratorClone.h 2014-09-03 08:29:34.000000000 +0000 @@ -43,8 +43,8 @@ /** Copy constructor */ TreeIteratorClone (const TreeIteratorClone< ObjectType > & p) { - m_Pointer = 0; - if ( p.m_Pointer != NULL ) + m_Pointer = ITK_NULLPTR; + if ( p.m_Pointer != ITK_NULLPTR ) { m_Pointer = p.m_Pointer->Clone(); } @@ -63,7 +63,7 @@ /** Constructor to reference p */ TreeIteratorClone (const ObjectType & p) { - m_Pointer = 0; + m_Pointer = ITK_NULLPTR; m_Pointer = const_cast< ObjectType * >( &p )->Clone(); } @@ -71,7 +71,7 @@ ~TreeIteratorClone () { delete m_Pointer; - m_Pointer = 0; + m_Pointer = ITK_NULLPTR; } /** Overload operator -> */ @@ -112,8 +112,8 @@ if ( m_Pointer != r ) { delete m_Pointer; - m_Pointer = 0; - if ( r != NULL ) + m_Pointer = ITK_NULLPTR; + if ( r != ITK_NULLPTR ) { m_Pointer = const_cast< ObjectType * >( r )->Clone(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.h 2014-09-03 08:29:34.000000000 +0000 @@ -34,19 +34,19 @@ * * The class is templated over the type of the elements. * - * \tparam TValueType = Element type stored in the node + * \tparam TValue = Element type stored in the node * * \ingroup DataRepresentation * \ingroup ITKCommon */ -template< typename TValueType > +template< typename TValue > class TreeNode:public Object { public: /** Standard typedefs */ typedef Object Superclass; - typedef TreeNode< TValueType > Self; + typedef TreeNode< TValue > Self; typedef SmartPointer< Self > Pointer; typedef SmartPointer< const Self > ConstPointer; typedef std::vector< Pointer > ChildrenListType; @@ -59,10 +59,10 @@ itkTypeMacro(TreeNode, Object); /** Get the value of the node */ - const TValueType & Get() const; + const TValue & Get() const; /** Set the current value of the node */ - TValueType Set(const TValueType data); + TValue Set(const TValue data); /** Get the child node */ Self * GetChild(ChildIdentifier number) const; @@ -86,7 +86,7 @@ bool Remove(Self *n); /** Get the number of children given a name and depth */ - ChildIdentifier GetNumberOfChildren(unsigned int depth = 0, char *name = NULL) const; + ChildIdentifier GetNumberOfChildren(unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Replace a given child by a new one */ bool ReplaceChild(Self *oldChild, Self *newChild); @@ -95,7 +95,7 @@ ChildIdentifier ChildPosition(const Self *node) const; /** Return the child position given a value */ - ChildIdentifier ChildPosition(TValueType node) const; + ChildIdentifier ChildPosition(TValue node) const; /** Add a child to the node */ void AddChild(Self *node); @@ -105,7 +105,7 @@ /** Get the children list */ #if !defined( CABLE_CONFIGURATION ) - virtual ChildrenListType * GetChildren(unsigned int depth = 0, char *name = NULL) const; + virtual ChildrenListType * GetChildren(unsigned int depth = 0, char *name = ITK_NULLPTR) const; #endif @@ -115,13 +115,13 @@ #endif /** Set the data of the node */ - //virtual void SetData(TValueType data) {m_Data = data;} + //virtual void SetData(TValue data) {m_Data = data;} protected: TreeNode(); virtual ~TreeNode(); - TValueType m_Data; + TValue m_Data; Self *m_Parent; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTreeNode.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,20 +18,21 @@ #ifndef __itkTreeNode_hxx #define __itkTreeNode_hxx +#include "itkMacro.h" #include "itkTreeNode.h" #include namespace itk { /** Constructor */ -template< typename TValueType > -TreeNode< TValueType > -::TreeNode():m_Parent(NULL) +template< typename TValue > +TreeNode< TValue > +::TreeNode():m_Parent(ITK_NULLPTR) {} /** Destructor */ -template< typename TValueType > -TreeNode< TValueType > +template< typename TValue > +TreeNode< TValue > ::~TreeNode() { if ( m_Parent ) @@ -43,26 +44,26 @@ for ( ChildIdentifier i = numberOfChildren; i > 0; i-- ) { - m_Children[i - 1]->SetParent(NULL); + m_Children[i - 1]->SetParent(ITK_NULLPTR); } m_Children.clear(); - m_Parent = NULL; + m_Parent = ITK_NULLPTR; m_Data = 0; } /** Return the parent node */ -template< typename TValueType > -TreeNode< TValueType > * -TreeNode< TValueType > +template< typename TValue > +TreeNode< TValue > * +TreeNode< TValue > ::GetParent() const { return m_Parent; } /** Get a child */ -template< typename TValueType > -TreeNode< TValueType > * -TreeNode< TValueType > +template< typename TValue > +TreeNode< TValue > * +TreeNode< TValue > ::GetChild(ChildIdentifier number) const { const ChildIdentifier numberOfChildren = static_cast< ChildIdentifier >( m_Children.size() ); @@ -73,50 +74,50 @@ } else { - return NULL; + return ITK_NULLPTR; } } /** Set the value of a node */ -template< typename TValueType > -TValueType -TreeNode< TValueType > -::Set(const TValueType data) +template< typename TValue > +TValue +TreeNode< TValue > +::Set(const TValue data) { - TValueType help = m_Data; + TValue help = m_Data; m_Data = data; return help; } /** Get the data of node */ -template< typename TValueType > -const TValueType & -TreeNode< TValueType > +template< typename TValue > +const TValue & +TreeNode< TValue > ::Get() const { return m_Data; } /** Return true if has a parent */ -template< typename TValueType > +template< typename TValue > bool -TreeNode< TValueType > +TreeNode< TValue > ::HasParent() const { return ( m_Parent ) ? true : false; } /** Set the parent node */ -template< typename TValueType > +template< typename TValue > void -TreeNode< TValueType > -::SetParent(TreeNode< TValueType > *node) +TreeNode< TValue > +::SetParent(TreeNode< TValue > *node) { //keep ourself alive just a bit longer Pointer ourself = this; - if ( m_Parent != NULL ) + if ( m_Parent != ITK_NULLPTR ) { m_Parent->Remove(this); } @@ -124,27 +125,27 @@ } /** Return true if the node has children */ -template< typename TValueType > +template< typename TValue > bool -TreeNode< TValueType > +TreeNode< TValue > ::HasChildren() const { return ( m_Children.size() > 0 ) ? true : false; } /** Return the number of children */ -template< typename TValueType > -typename TreeNode< TValueType >::ChildIdentifier -TreeNode< TValueType > +template< typename TValue > +typename TreeNode< TValue >::ChildIdentifier +TreeNode< TValue > ::CountChildren() const { return static_cast< ChildIdentifier >( m_Children.size() ); } /** Remove a child node from the current node */ -template< typename TValueType > +template< typename TValue > bool -TreeNode< TValueType > +TreeNode< TValue > ::Remove(Self *n) { typename std::vector< Pointer >::iterator pos; @@ -154,16 +155,16 @@ //keep node alive just a bit longer Pointer position = n; m_Children.erase(pos); - n->SetParent(NULL); + n->SetParent(ITK_NULLPTR); return true; } return false; } /** Replace a child by a new one */ -template< typename TValueType > +template< typename TValue > bool -TreeNode< TValueType > +TreeNode< TValue > ::ReplaceChild(Self *oldChild, Self *newChild) { const ChildIdentifier numberOfChildren = static_cast< ChildIdentifier >( m_Children.size() ); @@ -180,9 +181,9 @@ } /** Return the child position given a node */ -template< typename TValueType > +template< typename TValue > OffsetValueType -TreeNode< TValueType > +TreeNode< TValue > ::ChildPosition(const Self *node) const { const ChildIdentifier numberOfChildren = static_cast< ChildIdentifier >( m_Children.size() ); @@ -198,10 +199,10 @@ } /** Return the child position given an element, the first child found. */ -template< typename TValueType > -typename TreeNode< TValueType >::ChildIdentifier -TreeNode< TValueType > -::ChildPosition(TValueType element) const +template< typename TValue > +typename TreeNode< TValue >::ChildIdentifier +TreeNode< TValue > +::ChildPosition(TValue element) const { const ChildIdentifier numberOfChildren = static_cast< ChildIdentifier >( m_Children.size() ); @@ -216,9 +217,9 @@ } /** Add a child node */ -template< typename TValueType > +template< typename TValue > void -TreeNode< TValueType > +TreeNode< TValue > ::AddChild(Self *node) { Pointer nodeKeepAlive = node; @@ -228,9 +229,9 @@ } /** Add a child at a specific position in the children list */ -template< typename TValueType > +template< typename TValue > void -TreeNode< TValueType > +TreeNode< TValue > ::AddChild(ChildIdentifier number, Self *node) { const ChildIdentifier numberOfChildren = static_cast< ChildIdentifier >( m_Children.size() ); @@ -241,7 +242,7 @@ m_Children.resize(childId); for ( ChildIdentifier i = numberOfChildren; i <= childId; i++ ) { - m_Children[i] = NULL; + m_Children[i] = ITK_NULLPTR; } m_Children[number] = node; return; @@ -251,9 +252,9 @@ } /** Get the number of children given a name and a depth */ -template< typename TValueType > -typename TreeNode< TValueType >::ChildIdentifier -TreeNode< TValueType > +template< typename TValue > +typename TreeNode< TValue >::ChildIdentifier +TreeNode< TValue > ::GetNumberOfChildren(unsigned int depth, char *name) const { typename ChildrenListType::const_iterator it = m_Children.begin(); @@ -262,7 +263,7 @@ ChildIdentifier cnt = 0; while ( it != itEnd ) { - if ( name == NULL || strstr(typeid( **it ).name(), name) ) + if ( name == ITK_NULLPTR || strstr(typeid( **it ).name(), name) ) { ++cnt; } @@ -285,9 +286,9 @@ /** Get children given a name and a depth */ #if !defined( CABLE_CONFIGURATION ) -template< typename TValueType > -typename TreeNode< TValueType >::ChildrenListType * -TreeNode< TValueType > +template< typename TValue > +typename TreeNode< TValue >::ChildrenListType * +TreeNode< TValue > ::GetChildren(unsigned int depth, char *name) const { ChildrenListType *children = new ChildrenListType; @@ -299,7 +300,7 @@ while ( childrenListIt != childrenListEnd ) { - if ( name == NULL || strstr(typeid( **childrenListIt ).name(), name) ) + if ( name == ITK_NULLPTR || strstr(typeid( **childrenListIt ).name(), name) ) { children->push_back(*childrenListIt); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleCell.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleCell.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleCell.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleCell.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -374,7 +374,7 @@ CoordRepType c = p[1].EuclideanDistanceTo(p[0]); CoordRepType s = 0.5 * ( a + b + c ); - return vcl_sqrt( s * ( s - a ) * ( s - b ) * ( s - c ) ); + return std::sqrt( s * ( s - a ) * ( s - b ) * ( s - c ) ); } template< typename TCellInterface > @@ -507,7 +507,6 @@ // u32 is orthogonal to v12 // const double dotproduct = v12 * v32; - typedef typename VectorType::ValueType VectorValueType; VectorType u12 = v12 - v32 * ( dotproduct / v32.GetSquaredNorm() ); VectorType u32 = v32 - v12 * ( dotproduct / v12.GetSquaredNorm() ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleHelper.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleHelper.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleHelper.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkTriangleHelper.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -65,7 +65,7 @@ if ( l2 != 0.0 ) { - w /= vcl_sqrt(l2); + w /= std::sqrt(l2); } return w; @@ -83,14 +83,14 @@ if ( v21_l2 != NumericTraits< CoordRepType >::Zero ) { - v21 /= vcl_sqrt(v21_l2); + v21 /= std::sqrt(v21_l2); } VectorType v23 = iC - iB; CoordRepType v23_l2 = v23.GetSquaredNorm(); if ( v23_l2 != NumericTraits< CoordRepType >::Zero ) { - v23 /= vcl_sqrt(v23_l2); + v23 /= std::sqrt(v23_l2); } CoordRepType bound(0.999999); @@ -98,7 +98,7 @@ CoordRepType cos_theta = vnl_math_max( -bound, vnl_math_min(bound, v21 * v23) ); - return 1.0 / vcl_tan( vcl_acos(cos_theta) ); + return 1.0 / std::tan( std::acos(cos_theta) ); } template< typename TPoint > @@ -146,11 +146,11 @@ if ( v21_l2 != 0.0 ) { - v21 /= vcl_sqrt(v21_l2); + v21 /= std::sqrt(v21_l2); } if ( v23_l2 != 0.0 ) { - v23 /= vcl_sqrt(v23_l2); + v23 /= std::sqrt(v23_l2); } CoordRepType bound(0.999999); @@ -158,7 +158,7 @@ CoordRepType cos_theta = vnl_math_max( -bound, vnl_math_min(bound, v21 * v23) ); - return vcl_acos(cos_theta); + return std::acos(cos_theta); } template< typename TPoint > @@ -233,7 +233,7 @@ CoordRepType s = 0.5 * ( a + b + c ); - return static_cast< CoordRepType >( vcl_sqrt ( s * ( s - a ) * ( s - b ) * ( s - c ) ) ); + return static_cast< CoordRepType >( std::sqrt ( s * ( s - a ) * ( s - b ) * ( s - c ) ) ); } template< typename TPoint > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkValarrayImageContainer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkValarrayImageContainer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkValarrayImageContainer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkValarrayImageContainer.h 2014-09-03 08:29:34.000000000 +0000 @@ -106,7 +106,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,14 +72,14 @@ * \wikiexample{SimpleOperations/VariableLengthVector,Variable length vector} * \endwiki */ -template< typename TValueType > +template< typename TValue > class VariableLengthVector { public: /** The element type stored at each location in the Array. */ - typedef TValueType ValueType; - typedef TValueType ComponentType; + typedef TValue ValueType; + typedef TValue ComponentType; typedef typename NumericTraits< ValueType >::RealType RealValueType; typedef VariableLengthVector Self; @@ -134,14 +134,14 @@ /** Copy constructer.. Override the default non-templated copy constructor * that the compiler provides */ - VariableLengthVector(const VariableLengthVector< TValueType > & v); + VariableLengthVector(const VariableLengthVector< TValue > & v); /** Set the all the elements of the array to the specified value */ - void Fill(TValueType const & v); + void Fill(TValue const & v); /** Assignment operator */ template< typename T > - const VariableLengthVector< TValueType > & operator= + const VariableLengthVector< TValue > & operator= (const VariableLengthVector< T > & v) { if ( m_Data == static_cast< void * >( const_cast< T * > @@ -160,22 +160,22 @@ /** Assignment operators */ const Self & operator=(const Self & v); - const Self & operator=(TValueType const & v); + const Self & operator=(TValue const & v); /** Return the number of elements in the Array */ inline unsigned int Size(void) const { return m_NumElements; } inline unsigned int GetNumberOfElements(void) const { return m_NumElements; } /** Return reference to the element at specified index. No range checking. */ - TValueType & operator[](unsigned int i) { return this->m_Data[i]; } + TValue & operator[](unsigned int i) { return this->m_Data[i]; } /** Return reference to the element at specified index. No range checking. */ - TValueType const & operator[](unsigned int i) const { return this->m_Data[i]; } + TValue const & operator[](unsigned int i) const { return this->m_Data[i]; } /** Get one element */ - inline const TValueType & GetElement(unsigned int i) const { return m_Data[i]; } + inline const TValue & GetElement(unsigned int i) const { return m_Data[i]; } /** Set one element */ - void SetElement(unsigned int i, const TValueType & value) { m_Data[i] = value; } + void SetElement(unsigned int i, const TValue & value) { m_Data[i] = value; } /** Set the size to that given. * @@ -200,7 +200,7 @@ * the responsibility of freeing the memory for this data. If * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. */ - void SetData(TValueType *data, bool LetArrayManageMemory = false); + void SetData(TValue *data, bool LetArrayManageMemory = false); /** Similar to the previous method. In the above method, the size must be * separately set prior to using user-supplied data. This introduces an @@ -211,7 +211,7 @@ * the responsibility of freeing the memory for this data. If * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. */ - void SetData(TValueType *data, unsigned int sz, bool LetArrayManageMemory = false); + void SetData(TValue *data, unsigned int sz, bool LetArrayManageMemory = false); /** This destructor is not virtual for performance reasons. However, this * means that subclasses cannot allocate memory. */ @@ -226,9 +226,9 @@ void Reserve(ElementIdentifier); /** Allocate memory of certain size and return it. */ - TValueType * AllocateElements(ElementIdentifier size) const; + TValue * AllocateElements(ElementIdentifier size) const; - const TValueType * GetDataPointer() const { return m_Data; } + const TValue * GetDataPointer() const { return m_Data; } /** Element-wise vector addition. The vectors do not have to have * the same element type. The input vector elements are cast to the @@ -316,7 +316,7 @@ } /** Add scalar 's' to each element of the vector.*/ - inline Self operator+(TValueType s) const + inline Self operator+(TValue s) const { Self result(m_NumElements); @@ -328,7 +328,7 @@ } /** Subtract scalar 's' from each element of the vector.*/ - inline Self operator-(TValueType s) const + inline Self operator-(TValue s) const { Self result(m_NumElements); @@ -398,7 +398,7 @@ } /** Subtract scalar 's' from each element of the current vector. */ - inline Self & operator-=(TValueType s) + inline Self & operator-=(TValue s) { for ( ElementIdentifier i = 0; i < m_NumElements; i++ ) { @@ -426,7 +426,7 @@ } /** Add scalar 's' to each element of the vector. */ - inline Self & operator+=(TValueType s) + inline Self & operator+=(TValue s) { for ( ElementIdentifier i = 0; i < m_NumElements; i++ ) { @@ -481,23 +481,24 @@ bool m_LetArrayManageMemory; // if true, the array is responsible // for memory of data - TValueType * m_Data; // Array to hold data + TValue * m_Data; // Array to hold data ElementIdentifier m_NumElements; }; /** Premultiply Operator for product of a VariableLengthVector and a scalar. - * VariableLengthVector< TValueType > = T * VariableLengthVector< TValueType > + * VariableLengthVector< TValue > = T * VariableLengthVector< TValue > */ -template< typename TValueType, typename T > +template< typename TValue, typename T > inline -VariableLengthVector< TValueType > -operator*(const T & scalar, const VariableLengthVector< TValueType > & v) +VariableLengthVector< TValue > +operator*(const T & scalar, const VariableLengthVector< TValue > & v) { - return v * scalar; + return v.operator*(scalar); } -template< typename TValueType > -std::ostream & operator<<(std::ostream & os, const VariableLengthVector< TValueType > & arr) + +template< typename TValue > +std::ostream & operator<<(std::ostream & os, const VariableLengthVector< TValue > & arr) { const unsigned int length = arr.Size(); const signed int last = (unsigned int)length - 1; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVariableLengthVector.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,26 +26,26 @@ namespace itk { /** Default constructor */ -template< typename TValueType > -VariableLengthVector< TValueType > +template< typename TValue > +VariableLengthVector< TValue > ::VariableLengthVector():m_LetArrayManageMemory(true), - m_Data(0), + m_Data(ITK_NULLPTR), m_NumElements(0) {} /** Constructor with size */ -template< typename TValueType > -VariableLengthVector< TValueType > +template< typename TValue > +VariableLengthVector< TValue > ::VariableLengthVector(unsigned int length): m_LetArrayManageMemory(true), - m_Data(0) + m_Data(ITK_NULLPTR) { Reserve(length); } /** Constructor with user specified data */ -template< typename TValueType > -VariableLengthVector< TValueType > +template< typename TValue > +VariableLengthVector< TValue > ::VariableLengthVector(ValueType *datain, unsigned int sz, bool LetArrayManageMemory): m_LetArrayManageMemory(LetArrayManageMemory), m_Data(datain), @@ -53,8 +53,8 @@ {} /** Constructor with user specified data */ -template< typename TValueType > -VariableLengthVector< TValueType > +template< typename TValue > +VariableLengthVector< TValue > ::VariableLengthVector(const ValueType *datain, unsigned int sz, bool LetArrayManageMemory): m_LetArrayManageMemory(LetArrayManageMemory) { @@ -64,9 +64,9 @@ /** Copy constructer.. Override the default non-templated copy constructor * that the compiler provides */ -template< typename TValueType > -VariableLengthVector< TValueType > -::VariableLengthVector(const VariableLengthVector< TValueType > & v) +template< typename TValue > +VariableLengthVector< TValue > +::VariableLengthVector(const VariableLengthVector< TValue > & v) { m_NumElements = v.Size(); m_Data = this->AllocateElements(m_NumElements); @@ -78,8 +78,8 @@ } /** Destructor */ -template< typename TValueType > -VariableLengthVector< TValueType > +template< typename TValue > +VariableLengthVector< TValue > ::~VariableLengthVector() { // if data exists and we are responsible for its memory, get rid of it.. @@ -90,15 +90,15 @@ } /** Reserve memory of certain size for m_Data */ -template< typename TValueType > -void VariableLengthVector< TValueType > +template< typename TValue > +void VariableLengthVector< TValue > ::Reserve(ElementIdentifier size) { if ( m_Data ) { if ( size > m_NumElements ) { - TValueType *temp = this->AllocateElements(size); + TValue *temp = this->AllocateElements(size); // only copy the portion of the data used in the old buffer std::copy(m_Data, m_Data+m_NumElements, @@ -121,19 +121,19 @@ } /** Allocate memory of certain size and return it */ -template< typename TValueType > -TValueType *VariableLengthVector< TValueType > +template< typename TValue > +TValue *VariableLengthVector< TValue > ::AllocateElements(ElementIdentifier size) const { - TValueType *data; + TValue *data; try { - data = new TValueType[size]; + data = new TValue[size]; } catch ( ... ) { - data = 0; + data = ITK_NULLPTR; } if ( !data ) { @@ -149,10 +149,10 @@ * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. Note that you need to explicitly * set the number of elements. */ -template< typename TValueType > +template< typename TValue > void -VariableLengthVector< TValueType > -::SetData(TValueType *datain, bool LetArrayManageMemory) +VariableLengthVector< TValue > +::SetData(TValue *datain, bool LetArrayManageMemory) { // Free any existing data if we manage its memory if ( m_LetArrayManageMemory ) @@ -173,10 +173,10 @@ * the responsibility of freeing the memory for this data. If * "LetArrayManageMemory" is true, then this class will free the * memory when this object is destroyed. */ -template< typename TValueType > +template< typename TValue > void -VariableLengthVector< TValueType > -::SetData(TValueType *datain, unsigned int sz, bool LetArrayManageMemory) +VariableLengthVector< TValue > +::SetData(TValue *datain, unsigned int sz, bool LetArrayManageMemory) { // Free any existing data if we manage its memory if ( m_LetArrayManageMemory ) @@ -190,14 +190,14 @@ } -template< typename TValueType > -void VariableLengthVector< TValueType > +template< typename TValue > +void VariableLengthVector< TValue > ::DestroyExistingData() { // Free any existing data if we manage its memory. if ( !m_LetArrayManageMemory ) { - m_Data = 0; + m_Data = ITK_NULLPTR; m_NumElements = 0; return; } @@ -207,14 +207,14 @@ if ( m_NumElements > 0 ) { delete[] m_Data; - m_Data = 0; + m_Data = ITK_NULLPTR; m_NumElements = 0; } } } -template< typename TValueType > -void VariableLengthVector< TValueType > +template< typename TValue > +void VariableLengthVector< TValue > ::SetSize(unsigned int sz, bool destroyExistingData) { if ( destroyExistingData ) @@ -230,7 +230,7 @@ return; } - TValueType *temp = this->AllocateElements(sz); + TValue *temp = this->AllocateElements(sz); if ( sz > m_NumElements ) { @@ -258,9 +258,9 @@ } /** Set the all the elements of the array to the specified value */ -template< typename TValueType > -void VariableLengthVector< TValueType > -::Fill(TValueType const & v) +template< typename TValue > +void VariableLengthVector< TValue > +::Fill(TValue const & v) { for ( ElementIdentifier i = 0; i < m_NumElements; i++ ) { @@ -269,9 +269,9 @@ } /** Assignment operator */ -template< typename TValueType > -const VariableLengthVector< TValueType > & -VariableLengthVector< TValueType > +template< typename TValue > +const VariableLengthVector< TValue > & +VariableLengthVector< TValue > ::operator=(const Self & v) { if ( this != &v ) @@ -286,18 +286,18 @@ } /** Assignment operator */ -template< typename TValueType > -const VariableLengthVector< TValueType > & -VariableLengthVector< TValueType > -::operator=(TValueType const & v) +template< typename TValue > +const VariableLengthVector< TValue > & +VariableLengthVector< TValue > +::operator=(TValue const & v) { this->Fill(v); return *this; } -template< typename TValueType > -VariableLengthVector< TValueType > & -VariableLengthVector< TValueType > +template< typename TValue > +VariableLengthVector< TValue > & +VariableLengthVector< TValue > ::operator-() { for ( ElementIdentifier i = 0; i < m_NumElements; i++ ) @@ -307,9 +307,9 @@ return *this; } -template< typename TValueType > +template< typename TValue > bool -VariableLengthVector< TValueType > +VariableLengthVector< TValue > ::operator==(const Self & v) const { if ( m_NumElements != v.Size() ) @@ -326,9 +326,9 @@ return true; } -template< typename TValueType > +template< typename TValue > bool -VariableLengthVector< TValueType > +VariableLengthVector< TValue > ::operator!=(const Self & v) const { if ( m_NumElements != v.Size() ) @@ -348,20 +348,20 @@ /** * Returns vector's Euclidean Norm */ -template< typename TValueType > -typename VariableLengthVector< TValueType >::RealValueType -VariableLengthVector< TValueType > +template< typename TValue > +typename VariableLengthVector< TValue >::RealValueType +VariableLengthVector< TValue > ::GetNorm(void) const { - return (RealValueType)( vcl_sqrt( double( this->GetSquaredNorm() ) ) ); + return (RealValueType)( std::sqrt( double( this->GetSquaredNorm() ) ) ); } /** * Returns vector's Squared Euclidean Norm */ -template< typename TValueType > -typename VariableLengthVector< TValueType >::RealValueType -VariableLengthVector< TValueType > +template< typename TValue > +typename VariableLengthVector< TValue >::RealValueType +VariableLengthVector< TValue > ::GetSquaredNorm(void) const { RealValueType sum = 0.0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorContainer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorContainer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorContainer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorContainer.h 2014-09-03 08:29:34.000000000 +0000 @@ -200,7 +200,7 @@ class ConstIterator { public: - ConstIterator() {} + ConstIterator():m_Pos(0) {} ConstIterator(size_type d, const VectorConstIterator & i):m_Pos(d), m_Iter(i) {} ConstIterator(const Iterator & r) { m_Pos = r.m_Pos; m_Iter = r.m_Iter; } ConstIterator & operator*() { return *this; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVector.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVector.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVector.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVector.h 2014-09-03 08:29:34.000000000 +0000 @@ -252,7 +252,7 @@ Vector< T, NVectorDimension > operator*(const T & scalar, const Vector< T, NVectorDimension > & v) { - return v * scalar; + return v.operator*( scalar); } /** Print content to an ostream */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVector.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVector.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVector.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVector.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -129,7 +129,7 @@ Vector< T, TVectorDimension > ::GetNorm(void) const { - return RealValueType( vcl_sqrt( double( this->GetSquaredNorm() ) ) ); + return RealValueType( std::sqrt( double( this->GetSquaredNorm() ) ) ); } template< typename T, unsigned int TVectorDimension > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.h 2014-09-03 08:29:34.000000000 +0000 @@ -198,7 +198,7 @@ /** Allocate the image memory. The size of the image must * already be set, e.g. by calling SetRegions(). */ - void Allocate(); + virtual void Allocate(bool UseDefaultConstructor = false) ITK_OVERRIDE; /** Restore the data object to its initial state. This means releasing * memory. */ @@ -276,11 +276,11 @@ * the image iterator class. */ InternalPixelType * GetBufferPointer() { - return m_Buffer ? m_Buffer->GetBufferPointer() : 0; + return m_Buffer ? m_Buffer->GetBufferPointer() : ITK_NULLPTR; } const InternalPixelType * GetBufferPointer() const { - return m_Buffer ? m_Buffer->GetBufferPointer() : 0; + return m_Buffer ? m_Buffer->GetBufferPointer() : ITK_NULLPTR; } /** Return a pointer to the container. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,7 @@ template< typename TPixel, unsigned int VImageDimension > void VectorImage< TPixel, VImageDimension > -::Allocate() +::Allocate(const bool UseDefaultConstructor) { if ( m_VectorLength == 0 ) { @@ -58,7 +58,7 @@ this->ComputeOffsetTable(); num = this->GetOffsetTable()[VImageDimension]; - m_Buffer->Reserve(num * m_VectorLength); + m_Buffer->Reserve(num * m_VectorLength,UseDefaultConstructor); } template< typename TPixel, unsigned int VImageDimension > @@ -117,38 +117,27 @@ VectorImage< TPixel, VImageDimension > ::Graft(const DataObject *data) { + if(data == ITK_NULLPTR) + { + return; + } // call the superclass' implementation Superclass::Graft(data); - if ( data ) - { - // Attempt to cast data to an Image - const Self *imgData; + // Attempt to cast data to an Image + const Self *imgData = dynamic_cast< const Self * >( data ); - try - { - imgData = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - return; - } - - // Copy from VectorImage< TPixel, dim > - if ( imgData ) - { - // Now copy anything remaining that is needed - this->SetPixelContainer( const_cast< PixelContainer * > - ( imgData->GetPixelContainer() ) ); - } - else - { - // pointer could not be cast back down - itkExceptionMacro( << "itk::VectorImage::Graft() cannot cast " - << typeid( data ).name() << " to " - << typeid( const Self * ).name() ); - } + if( imgData == ITK_NULLPTR ) + { + // pointer could not be cast back down + itkExceptionMacro( << "itk::VectorImage::Graft() cannot cast " + << typeid( data ).name() << " to " + << typeid( const Self * ).name() ); } + // Copy from VectorImage< TPixel, dim > + // Now copy anything remaining that is needed + this->SetPixelContainer( const_cast< PixelContainer * > + ( imgData->GetPixelContainer() ) ); } //---------------------------------------------------------------------------- diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImageNeighborhoodAccessorFunctor.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImageNeighborhoodAccessorFunctor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImageNeighborhoodAccessorFunctor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVectorImageNeighborhoodAccessorFunctor.h 2014-09-03 08:29:34.000000000 +0000 @@ -54,9 +54,9 @@ *ImageBoundaryConditionConstPointerType; VectorImageNeighborhoodAccessorFunctor(VectorLengthType length): - m_VectorLength(length), m_OffsetMultiplier(length - 1), m_Begin(NULL) {} + m_VectorLength(length), m_OffsetMultiplier(length - 1), m_Begin(ITK_NULLPTR) {} VectorImageNeighborhoodAccessorFunctor(): - m_VectorLength(0), m_OffsetMultiplier(0), m_Begin(NULL) {} + m_VectorLength(0), m_OffsetMultiplier(0), m_Begin(ITK_NULLPTR) {} /** Set the pointer index to the start of the buffer. * This must be set by the iterators to the starting location of the buffer. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.h 2014-09-03 08:29:34.000000000 +0000 @@ -203,7 +203,7 @@ /** Set the versor using the right part. * the magnitude of the vector given is assumed to - * be equal to vcl_sin(angle/2). + * be equal to std::sin(angle/2). * This method will compute internally the scalar * part that preserve the Versor as a unit quaternion. */ void Set(const VectorType & axis); @@ -271,7 +271,7 @@ } static inline ValueType Epsilon() { - return Epsilon((ValueType *)0); + return Epsilon((ValueType *)ITK_NULLPTR); } /** Component parallel to x axis. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkVersor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -174,7 +174,7 @@ const double epsilon = 1e-300; - if ( vcl_fabs(1.0f - square) < epsilon ) + if ( std::fabs(1.0f - square) < epsilon ) { return true; } @@ -222,7 +222,7 @@ { const ValueType tensor = static_cast< ValueType >( - vcl_sqrt(m_X * m_X + m_Y * m_Y + m_Z * m_Z + m_W * m_W) ); + std::sqrt(m_X * m_X + m_Y * m_Y + m_Z * m_Z + m_W * m_W) ); return tensor; } @@ -235,7 +235,7 @@ { const ValueType tensor = this->GetTensor(); - if ( vcl_fabs(tensor) < 1e-20 ) + if ( std::fabs(tensor) < 1e-20 ) { ExceptionObject except; except.SetDescription("Attempt to normalize a \ @@ -261,7 +261,7 @@ const RealType ay = static_cast< RealType >( m_Y ); const RealType az = static_cast< RealType >( m_Z ); - const RealType vectorNorm = vcl_sqrt(ax * ax + ay * ay + az * az); + const RealType vectorNorm = std::sqrt(ax * ax + ay * ay + az * az); if ( vectorNorm == NumericTraits< RealType >::Zero ) { @@ -313,9 +313,9 @@ const RealType ay = static_cast< RealType >( m_Y ); const RealType az = static_cast< RealType >( m_Z ); - const RealType vectorNorm = vcl_sqrt(ax * ax + ay * ay + az * az); + const RealType vectorNorm = std::sqrt(ax * ax + ay * ay + az * az); - const ValueType angle = 2.0 * vcl_atan2( vectorNorm, static_cast< RealType >( m_W ) ); + const ValueType angle = 2.0 * std::atan2( vectorNorm, static_cast< RealType >( m_W ) ); return angle; } @@ -326,8 +326,8 @@ Versor< T > ::SquareRoot(void) const { - const ValueType newScalar = vcl_sqrt( static_cast< double >( 1.0 + m_W ) ); - const double sqrtOfTwo = vcl_sqrt(2.0f); + const ValueType newScalar = std::sqrt( static_cast< double >( 1.0 + m_W ) ); + const double sqrtOfTwo = std::sqrt(2.0f); const double factor = 1.0f / ( newScalar * sqrtOfTwo ); @@ -363,8 +363,8 @@ { const RealType vectorNorm = axis.GetNorm(); - const RealType cosangle2 = vcl_cos(angle / 2.0); - const RealType sinangle2 = vcl_sin(angle / 2.0); + const RealType cosangle2 = std::cos(angle / 2.0); + const RealType sinangle2 = std::sin(angle / 2.0); const RealType factor = sinangle2 / vectorNorm; @@ -385,30 +385,30 @@ //Keep the epsilon value large enough so that the alternate routes of //computing the quaternion are used to within floating point precision of the //math to be used. Using 1e-30 results in degenerate matries for rotations - //near vnl_math::pi due to imprecision of the math. 0.5/vcl_sqrt(trace) is + //near vnl_math::pi due to imprecision of the math. 0.5/std::sqrt(trace) is //not accurate to 1e-30, so the resulting matrices would have very large //errors. By decreasing this epsilon value to a higher tolerance, the //alternate stable methods for conversion are used. // - //The use of vcl_numeric_limits< T >::epsilon() was not consistent with + //The use of std::numeric_limits< T >::epsilon() was not consistent with //the rest of the ITK toolkit with respect to epsilon values for //determining rotational orthogonality, and it occasionally //prevented the conversion between different rigid transform types. - const T epsilon = Self::Epsilon(); // vnl_sqrt( vcl_numeric_limits< T >::epsilon() ); + const T epsilon = Self::Epsilon(); // vnl_sqrt( std::numeric_limits< T >::epsilon() ); // Use a slightly less epsilon for detecting difference - const T epsilonDiff = Self::Epsilon(); //vcl_numeric_limits< T >::epsilon() * 10.0; + const T epsilonDiff = Self::Epsilon(); //std::numeric_limits< T >::epsilon() * 10.0; const vnl_matrix< T > m( mat.GetVnlMatrix() ); //check for orthonormality and that it isn't a reflection const vnl_matrix_fixed< T, 3, 3 > & I = m*m.transpose(); - if( vcl_abs( I[0][1] ) > epsilon || vcl_abs( I[0][2] ) > epsilon || - vcl_abs( I[1][0] ) > epsilon || vcl_abs( I[1][2] ) > epsilon || - vcl_abs( I[2][0] ) > epsilon || vcl_abs( I[2][1] ) > epsilon || - vcl_abs( I[0][0] - itk::NumericTraits::One ) > epsilonDiff || - vcl_abs( I[1][1] - itk::NumericTraits::One ) > epsilonDiff || - vcl_abs( I[2][2] - itk::NumericTraits::One ) > epsilonDiff || + if( std::abs( I[0][1] ) > epsilon || std::abs( I[0][2] ) > epsilon || + std::abs( I[1][0] ) > epsilon || std::abs( I[1][2] ) > epsilon || + std::abs( I[2][0] ) > epsilon || std::abs( I[2][1] ) > epsilon || + std::abs( I[0][0] - itk::NumericTraits::One ) > epsilonDiff || + std::abs( I[1][1] - itk::NumericTraits::One ) > epsilonDiff || + std::abs( I[2][2] - itk::NumericTraits::One ) > epsilonDiff || vnl_det( I ) < 0 ) { itkGenericExceptionMacro(<< "The following matrix does not represent rotation to within an epsion of " @@ -423,7 +423,7 @@ if ( trace > epsilon ) { - const double s = 0.5 / vcl_sqrt(trace); + const double s = 0.5 / std::sqrt(trace); m_W = 0.25 / s; m_X = ( m(2, 1) - m(1, 2) ) * s; m_Y = ( m(0, 2) - m(2, 0) ) * s; @@ -433,7 +433,7 @@ { if ( m(0, 0) > m(1, 1) && m(0, 0) > m(2, 2) ) { - const double s = 2.0 * vcl_sqrt( 1.0 + m(0, 0) - m(1, 1) - m(2, 2) ); + const double s = 2.0 * std::sqrt( 1.0 + m(0, 0) - m(1, 1) - m(2, 2) ); m_X = 0.25 * s; m_Y = ( m(0, 1) + m(1, 0) ) / s; m_Z = ( m(0, 2) + m(2, 0) ) / s; @@ -443,7 +443,7 @@ { if ( m(1, 1) > m(2, 2) ) { - const double s = 2.0 * vcl_sqrt( 1.0 + m(1, 1) - m(0, 0) - m(2, 2) ); + const double s = 2.0 * std::sqrt( 1.0 + m(1, 1) - m(0, 0) - m(2, 2) ); m_X = ( m(0, 1) + m(1, 0) ) / s; m_Y = 0.25 * s; m_Z = ( m(1, 2) + m(2, 1) ) / s; @@ -451,7 +451,7 @@ } else { - const double s = 2.0 * vcl_sqrt( 1.0 + m(2, 2) - m(0, 0) - m(1, 1) ); + const double s = 2.0 * std::sqrt( 1.0 + m(2, 2) - m(0, 0) - m(1, 1) ); m_X = ( m(0, 2) + m(2, 0) ) / s; m_Y = ( m(1, 2) + m(2, 1) ) / s; m_Z = 0.25 * s; @@ -468,7 +468,6 @@ Versor< T > ::Set(const VectorType & axis) { - typedef typename VectorType::RealValueType VectorRealValueType; const ValueType sinangle2 = axis.GetNorm(); if ( sinangle2 > NumericTraits< ValueType >::One ) { @@ -479,7 +478,7 @@ throw exception; } - const ValueType cosangle2 = vcl_sqrt(NumericTraits< double >::One - sinangle2 * sinangle2); + const ValueType cosangle2 = std::sqrt(NumericTraits< double >::One - sinangle2 * sinangle2); m_X = axis[0]; m_Y = axis[1]; @@ -541,8 +540,8 @@ Versor< T > ::SetRotationAroundX(ValueType angle) { - const ValueType sinangle2 = vcl_sin(angle / 2.0); - const ValueType cosangle2 = vcl_cos(angle / 2.0); + const ValueType sinangle2 = std::sin(angle / 2.0); + const ValueType cosangle2 = std::cos(angle / 2.0); m_X = sinangle2; m_Y = NumericTraits< T >::Zero; @@ -556,8 +555,8 @@ Versor< T > ::SetRotationAroundY(ValueType angle) { - const ValueType sinangle2 = vcl_sin(angle / 2.0); - const ValueType cosangle2 = vcl_cos(angle / 2.0); + const ValueType sinangle2 = std::sin(angle / 2.0); + const ValueType cosangle2 = std::cos(angle / 2.0); m_X = NumericTraits< T >::Zero; m_Y = sinangle2; @@ -571,8 +570,8 @@ Versor< T > ::SetRotationAroundZ(ValueType angle) { - const ValueType sinangle2 = vcl_sin(angle / 2.0); - const ValueType cosangle2 = vcl_cos(angle / 2.0); + const ValueType sinangle2 = std::sin(angle / 2.0); + const ValueType cosangle2 = std::cos(angle / 2.0); m_X = NumericTraits< T >::Zero; m_Y = NumericTraits< T >::Zero; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkWeakPointer.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkWeakPointer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkWeakPointer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkWeakPointer.h 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ /** Constructor. */ WeakPointer () - { m_Pointer = 0; } + { m_Pointer = ITK_NULLPTR; } /** Copy constructor. */ WeakPointer (const WeakPointer< ObjectType > & p):m_Pointer(p.m_Pointer) {} @@ -59,7 +59,7 @@ /** Destructor. */ ~WeakPointer () - { m_Pointer = 0; } + { m_Pointer = ITK_NULLPTR; } /** Overload operator ->. */ ObjectType * operator->() const diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkWin32Header.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkWin32Header.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkWin32Header.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkWin32Header.h 2014-09-03 08:29:34.000000000 +0000 @@ -68,6 +68,9 @@ // 'identifier' : identifier was truncated to 'number' characters in the debug information #pragma warning ( disable : 4786 ) + +// nonstandard extension used : 'extern' before template explicit instantiation +#pragma warning ( disable : 4231 ) #endif // _MSC_VER #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkXMLFileOutputWindow.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkXMLFileOutputWindow.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/itkXMLFileOutputWindow.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/itkXMLFileOutputWindow.h 2014-09-03 08:29:34.000000000 +0000 @@ -62,19 +62,19 @@ itkTypeMacro(XMLFileOutputWindow, FileOutputWindow); /** Send a string to the XML file. */ - virtual void DisplayText(const char *); + virtual void DisplayText(const char *) ITK_OVERRIDE; /** Send an error string to the XML file. */ - virtual void DisplayErrorText(const char *); + virtual void DisplayErrorText(const char *) ITK_OVERRIDE; /** Send a warning string to the XML file. */ - virtual void DisplayWarningText(const char *); + virtual void DisplayWarningText(const char *) ITK_OVERRIDE; /** Send a generic output string to the XML file. */ - virtual void DisplayGenericOutputText(const char *); + virtual void DisplayGenericOutputText(const char *) ITK_OVERRIDE; /** Send a debug string to the XML file. */ - virtual void DisplayDebugText(const char *); + virtual void DisplayDebugText(const char *) ITK_OVERRIDE; /** Put the text into the log file without processing it. */ virtual void DisplayTag(const char *); @@ -82,7 +82,7 @@ protected: XMLFileOutputWindow(); virtual ~XMLFileOutputWindow(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void Initialize(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/VNLSparseLUSolverTraits.h otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/VNLSparseLUSolverTraits.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/include/VNLSparseLUSolverTraits.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/include/VNLSparseLUSolverTraits.h 2014-09-03 08:29:34.000000000 +0000 @@ -87,7 +87,7 @@ static bool Solve(const MatrixType & iA, const VectorType & iB, VectorType & oX) { SolverType solver( iA ); - oX = solver.solve( iB ); + Solve( solver, iB, oX ); return true; } @@ -98,9 +98,7 @@ VectorType & oX, VectorType & oY, VectorType & oZ ) { SolverType solver( iA ); - oX = solver.solve( iBx ); - oY = solver.solve( iBy ); - oZ = solver.solve( iBz ); + Solve( solver, iBx, iBy, iBz, oX, oY, oZ ); return true; } @@ -111,12 +109,35 @@ VectorType & oX, VectorType & oY) { SolverType solver( iA ); - oX = solver.solve( iBx ); - oY = solver.solve( iBy ); + Solve( solver, iBx, iBy, oX, oY ); return true; } + /** \brief Solve the linear system \f$ iA \cdot oX = iB \f$ factoring the internal matrix if needed */ + static void Solve( SolverType & solver, const VectorType & iB, VectorType & oX ) + { + oX = solver.solve( iB ); + } + + /** \brief Solve the linear systems: \f$ iA \cdot oX = iBx \f$, \f$ iA \cdot oY = iBy \f$, \f$ iA \cdot oZ = iBz \f$ factoring the internal matrix if needed */ + static void Solve( SolverType & solver, + const VectorType & iBx, const VectorType & iBy, const VectorType & iBz, + VectorType & oX, VectorType & oY, VectorType & oZ ) + { + oX = solver.solve( iBx ); + oY = solver.solve( iBy ); + oZ = solver.solve( iBz ); + } + + /** \brief Solve the linear systems: \f$ iA \cdot oX = iBx \f$, \f$ iA \cdot oY = iBy \f$ factoring the internal matrix if needed */ + static void Solve( SolverType & solver, + const VectorType & iBx, const VectorType & iBy, + VectorType & oX, VectorType & oY ) + { + oX = solver.solve( iBx ); + oY = solver.solve( iBy ); + } }; #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -25,6 +25,7 @@ itkOctreeNode.cxx itkNumericTraitsFixedArrayPixel.cxx itkMultiThreader.cxx +itkMetaDataObject.cxx itkMetaDataDictionary.cxx itkDataObject.cxx itkThreadLogger.cxx @@ -78,10 +79,11 @@ itkCompensatedSummation.cxx itkArrayOutputSpecialization.cxx itkNumberToString.cxx +itkSmartPointerForwardReferenceProcessObject.cxx ) if(WIN32) - set(ITKCommon_SRCS ${ITKCommon_SRCS};itkWin32OutputWindow.cxx;itkSmartPointerForwardReferenceProcessObject.cxx) + set(ITKCommon_SRCS ${ITKCommon_SRCS};itkWin32OutputWindow.cxx) endif() # Prevent optimization from affecting the floating point calculation. @@ -104,6 +106,11 @@ set_source_files_properties( itkCompensatedSummation.cxx PROPERTIES COMPILE_FLAGS -fp:precise ) endif() +if( CMAKE_CXX_COMPILER_ID MATCHES Clang AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.0" ) + # this file contains explicitly instantiated template classes which are not correcly exported with the hidden visibility flag + set_source_files_properties( itkSmartPointerForwardReferenceProcessObject.cxx PROPERTIES COMPILE_FLAGS -fvisibility=default ) +endif() + ### generating libraries add_library( ITKCommon ${ITK_LIBRARY_BUILD_TYPE} ${ITKCommon_SRCS}) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkConditionVariablePThreads.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkConditionVariablePThreads.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkConditionVariablePThreads.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkConditionVariablePThreads.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,7 @@ { ConditionVariable::ConditionVariable() { - pthread_cond_init(&m_ConditionVariable.m_ConditionVariable, NULL); + pthread_cond_init(&m_ConditionVariable.m_ConditionVariable, ITK_NULLPTR); } ConditionVariable::~ConditionVariable() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkDataObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkDataObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkDataObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkDataObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,24 +26,6 @@ * *=========================================================================*/ #include "itkProcessObject.h" -/** The inclusion of itkSmartPointerForwardReference.hxx is needed here - * because this is one of the very few cases where - * itkSmartPointerForwardReference.h does not include - * itkSmartPointerForwardReference.hxx - * - * Ensure that the implicitly instantiated methods and operators are - * exported for the linker. - */ -#if __GNUC__ >= 4 -#pragma GCC visibility push(default) -#endif -#include "itkSmartPointerForwardReference.hxx" -#if __GNUC__ >= 4 -#pragma GCC visibility pop -#endif - -// Manual instantiation is necessary to prevent link errors -template class ITKCommon_EXPORT itk::SmartPointerForwardReference< itk::ProcessObject >; namespace itk { @@ -52,17 +34,17 @@ DataObjectError ::DataObjectError(): - ExceptionObject(), m_DataObject(0) + ExceptionObject(), m_DataObject(ITK_NULLPTR) {} DataObjectError ::DataObjectError(const char *file, unsigned int lineNumber): - ExceptionObject(file, lineNumber), m_DataObject(0) + ExceptionObject(file, lineNumber), m_DataObject(ITK_NULLPTR) {} DataObjectError ::DataObjectError(const std::string & file, unsigned int lineNumber): - ExceptionObject(file, lineNumber), m_DataObject(0) + ExceptionObject(file, lineNumber), m_DataObject(ITK_NULLPTR) {} DataObjectError @@ -151,7 +133,7 @@ //---------------------------------------------------------------------------- DataObject::DataObject():m_UpdateMTime() { - m_Source = 0; + m_Source = ITK_NULLPTR; m_SourceOutputName = ""; m_ReleaseDataFlag = false; @@ -226,7 +208,7 @@ // disconnect ourselves from the current process object if ( m_Source ) { - m_Source->SetOutput(m_SourceOutputName, NULL); + m_Source->SetOutput(m_SourceOutputName, ITK_NULLPTR); } // set our release data flag to off by default (purposely done after @@ -249,7 +231,7 @@ itkDebugMacro("disconnecting source " << arg << ", source output name " << name); - m_Source = 0; + m_Source = ITK_NULLPTR; m_SourceOutputName = ""; this->Modified(); return true; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkExceptionObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkExceptionObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkExceptionObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkExceptionObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -94,14 +94,14 @@ /** Increase the reference count (mark as used by another object). * Delegates the counting to its LightObject superclass */ - virtual void Register() const + virtual void Register() const ITK_OVERRIDE { this->LightObject::Register(); } /** Decrease the reference count (release by another object). * Delegates the counting to its LightObject superclass */ - virtual void UnRegister() const + virtual void UnRegister() const ITK_OVERRIDE { this->LightObject::UnRegister(); } @@ -135,8 +135,8 @@ unsigned int lineNumber, const char *desc, const char *loc): - m_ExceptionData( ReferenceCountedExceptionData::ConstNew(file == 0 ? "":file, lineNumber, desc == 0 ? "":desc, loc == - 0 ? "":loc) ) + m_ExceptionData( ReferenceCountedExceptionData::ConstNew(file == ITK_NULLPTR ? "":file, lineNumber, desc == ITK_NULLPTR ? "":desc, loc == + ITK_NULLPTR ? "":loc) ) {} ExceptionObject::ExceptionObject( @@ -213,7 +213,7 @@ } else { - return ( thisData != 0 ) && ( origData != 0 ) + return ( thisData != ITK_NULLPTR ) && ( origData != ITK_NULLPTR ) && thisData->m_Location == origData->m_Location && thisData->m_Description == origData->m_Description && thisData->m_File == origData->m_File @@ -343,4 +343,30 @@ // Print trailer os << indent << std::endl; } + +MemoryAllocationError::~MemoryAllocationError() + throw( ) +{ +} + +RangeError::~RangeError() + throw( ) +{ +} + +InvalidArgumentError::~InvalidArgumentError() + throw( ) +{ +} + +IncompatibleOperandsError::~IncompatibleOperandsError() + throw( ) +{ +} + +ProcessAborted::~ProcessAborted() throw( ) +{ +} + + } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkFileOutputWindow.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkFileOutputWindow.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkFileOutputWindow.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkFileOutputWindow.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ { m_Flush = false; m_Append = false; - m_Stream = 0; + m_Stream = ITK_NULLPTR; m_FileName = ""; } @@ -35,7 +35,7 @@ ::~FileOutputWindow() { delete m_Stream; - m_Stream = 0; + m_Stream = ITK_NULLPTR; } void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkFloatingPointExceptions.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkFloatingPointExceptions.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkFloatingPointExceptions.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkFloatingPointExceptions.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -498,7 +498,7 @@ act.sa_sigaction = fhdl; sigemptyset(&act.sa_mask); act.sa_flags = SA_SIGINFO; - sigaction(SIGFPE,&act,0); + sigaction(SIGFPE,&act,ITK_NULLPTR); FloatingPointExceptions::m_Enabled = true; } void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkLightObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkLightObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkLightObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkLightObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -58,7 +58,7 @@ Pointer smartPtr; LightObject *rawPtr = ::itk::ObjectFactory< LightObject >::Create(); - if ( rawPtr == NULL ) + if ( rawPtr == ITK_NULLPTR ) { rawPtr = new LightObject; } @@ -286,7 +286,7 @@ #ifdef GCC_USEDEMANGLE char const *mangledName = typeid( *this ).name(); int status; - char * unmangled = abi::__cxa_demangle(mangledName, 0, 0, &status); + char * unmangled = abi::__cxa_demangle(mangledName, ITK_NULLPTR, ITK_NULLPTR, &status); os << indent << "RTTI typeinfo: "; @@ -325,12 +325,6 @@ ::PrintTrailer( std::ostream & itkNotUsed(os), Indent itkNotUsed(indent) ) const {} -/** - * This operator allows all subclasses of LightObject to be printed via <<. - * It in turn invokes the Print method, which in turn will invoke the - * PrintSelf method that all objects should define, if they have anything - * interesting to print out. - */ std::ostream & operator<<(std::ostream & os, const LightObject & o) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkLoggerManager.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkLoggerManager.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkLoggerManager.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkLoggerManager.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -61,7 +61,7 @@ if ( loggerItr == this->m_LoggerSet.end() ) { - return NULL; + return ITK_NULLPTR; } return loggerItr->second.GetPointer(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMersenneTwisterRandomVariateGenerator.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMersenneTwisterRandomVariateGenerator.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMersenneTwisterRandomVariateGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMersenneTwisterRandomVariateGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -16,15 +16,23 @@ * *=========================================================================*/ #include "itkMersenneTwisterRandomVariateGenerator.h" +#include "itkSimpleFastMutexLock.h" +#include "itkMutexLockHolder.h" + namespace itk { namespace Statistics { -MersenneTwisterRandomVariateGenerator::Pointer MersenneTwisterRandomVariateGenerator:: m_Instance = 0; + +// Static/Global variables +MersenneTwisterRandomVariateGenerator::Pointer MersenneTwisterRandomVariateGenerator::m_StaticInstance = ITK_NULLPTR; +SimpleFastMutexLock MersenneTwisterRandomVariateGenerator::m_StaticInstanceLock; +MersenneTwisterRandomVariateGenerator::IntegerType MersenneTwisterRandomVariateGenerator::m_StaticDiffer = 0; MersenneTwisterRandomVariateGenerator::Pointer -MersenneTwisterRandomVariateGenerator::New() +MersenneTwisterRandomVariateGenerator +::CreateInstance() { // Try the factory first MersenneTwisterRandomVariateGenerator::Pointer obj = ObjectFactory< Self >::Create(); @@ -34,11 +42,20 @@ obj = new MersenneTwisterRandomVariateGenerator; // Remove extra reference from construction. obj->UnRegister(); - obj->SetSeed ( GetInstance()->GetSeed() ); } return obj; } + +MersenneTwisterRandomVariateGenerator::Pointer +MersenneTwisterRandomVariateGenerator +::New() +{ + MersenneTwisterRandomVariateGenerator::Pointer obj = MersenneTwisterRandomVariateGenerator::CreateInstance(); + obj->SetSeed ( GetInstance()->GetSeed() ); + return obj; +} + /** * Return the single instance of the MersenneTwisterRandomVariateGenerator */ @@ -46,22 +63,73 @@ MersenneTwisterRandomVariateGenerator ::GetInstance() { - if ( !MersenneTwisterRandomVariateGenerator::m_Instance ) + MutexLockHolder mutexHolder(m_StaticInstanceLock); + + if ( !m_StaticInstance ) { - // Try the factory first - MersenneTwisterRandomVariateGenerator::m_Instance = ObjectFactory< Self >::Create(); - // if the factory did not provide one, then create it here - if ( !MersenneTwisterRandomVariateGenerator::m_Instance ) - { - MersenneTwisterRandomVariateGenerator::m_Instance = new MersenneTwisterRandomVariateGenerator; - // Remove extra reference from construction. - MersenneTwisterRandomVariateGenerator::m_Instance->UnRegister(); - } + m_StaticInstance = MersenneTwisterRandomVariateGenerator::CreateInstance(); } /** * return the instance */ - return MersenneTwisterRandomVariateGenerator::m_Instance; + return m_StaticInstance; } + +MersenneTwisterRandomVariateGenerator +::MersenneTwisterRandomVariateGenerator() +{ + SetSeed (121212); +} + +MersenneTwisterRandomVariateGenerator::IntegerType +MersenneTwisterRandomVariateGenerator +::hash(time_t t, clock_t c) +{ + // Get a IntegerType from t and c + // Better than IntegerType(x) in case x is floating point in [0,1] + // Based on code by Lawrence Kirby: fred at genesis dot demon dot co dot uk + + IntegerType h1 = 0; + unsigned char *p = (unsigned char *)&t; + + const unsigned int sizeOfT = static_cast< unsigned int >( sizeof(t) ); + for ( unsigned int i = 0; i < sizeOfT; ++i ) + { + h1 *= UCHAR_MAX + 2U; + h1 += p[i]; + } + IntegerType h2 = 0; + p = (unsigned char *)&c; + + const unsigned int sizeOfC = static_cast< unsigned int >( sizeof(c) ); + for ( unsigned int j = 0; j < sizeOfC; ++j ) + { + h2 *= UCHAR_MAX + 2U; + h2 += p[j]; + } + return ( h1 + m_StaticDiffer++ ) ^ h2; +} + +void +MersenneTwisterRandomVariateGenerator +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + // Print state vector contents + os << indent << "State vector: " << state << std::endl; + os << indent; + const IntegerType *s = state; + int i = StateVectorLength; + for (; i--; os << *s++ << "\t" ) {} + os << std::endl; + + //Print next value to be gotten from state + os << indent << "Next value to be gotten from state: " << pNext << std::endl; + + //Number of values left before reload + os << indent << "Values left before next reload: " << left << std::endl; +} + } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataDictionary.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataDictionary.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataDictionary.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataDictionary.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ ::~MetaDataDictionary() { delete m_Dictionary; - m_Dictionary = 0; + m_Dictionary = ITK_NULLPTR; } MetaDataDictionary diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObjectBase.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObjectBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObjectBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObjectBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -15,39 +15,44 @@ * limitations under the License. * *=========================================================================*/ -#include "itkFastMutexLock.h" +#include "itkMetaDataObjectBase.h" -void -itk::MetaDataObjectBase -::Print(std::ostream & os) const +namespace itk +{ + +MetaDataObjectBase +::MetaDataObjectBase() +{ +} + + +MetaDataObjectBase +::~MetaDataObjectBase() { - os << "[UNKNOWN_PRINT_CHARACTERISTICS]" << std::endl; } + const char * -itk::MetaDataObjectBase -::GetMetaDataObjectTypeName(void) const +MetaDataObjectBase +::GetMetaDataObjectTypeName() const { return typeid( itk::MetaDataObjectBase ).name(); } + const std::type_info & -itk::MetaDataObjectBase -::GetMetaDataObjectTypeInfo(void) const +MetaDataObjectBase +::GetMetaDataObjectTypeInfo() const { return typeid( itk::MetaDataObjectBase ); } -itk::MetaDataObjectBase -::MetaDataObjectBase() -{ - //Nothing to do here -} -itk::MetaDataObjectBase -::~MetaDataObjectBase() +void +MetaDataObjectBase +::Print( std::ostream & os ) const { - //std::cout << " MetaDataObjectBase Deleteing: " << this << - // std::endl; - //Nothing to do here + os << "[UNKNOWN_PRINT_CHARACTERISTICS]" << std::endl; } + +} // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObject.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMetaDataObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,47 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#define ITK_TEMPLATE_EXPLICIT_MetaDataObject +#include "itkMetaDataObject.h" + +namespace itk +{ + +template class ITKCommon_EXPORT MetaDataObject< bool >; +template class ITKCommon_EXPORT MetaDataObject< unsigned char >; +template class ITKCommon_EXPORT MetaDataObject< char >; +template class ITKCommon_EXPORT MetaDataObject< signed char >; +template class ITKCommon_EXPORT MetaDataObject< unsigned short >; +template class ITKCommon_EXPORT MetaDataObject< short >; +template class ITKCommon_EXPORT MetaDataObject< unsigned int >; +template class ITKCommon_EXPORT MetaDataObject< int >; +template class ITKCommon_EXPORT MetaDataObject< unsigned long >; +template class ITKCommon_EXPORT MetaDataObject< long >; +template class ITKCommon_EXPORT MetaDataObject< float >; +template class ITKCommon_EXPORT MetaDataObject< double >; +template class ITKCommon_EXPORT MetaDataObject< std::string >; +template class ITKCommon_EXPORT MetaDataObject< Array >; +template class ITKCommon_EXPORT MetaDataObject< Array >; +template class ITKCommon_EXPORT MetaDataObject< Array >; +template class ITKCommon_EXPORT MetaDataObject< Array >; +template class ITKCommon_EXPORT MetaDataObject< Matrix >; +template class ITKCommon_EXPORT MetaDataObject< std::vector >; +template class ITKCommon_EXPORT MetaDataObject< std::vector >; +template class ITKCommon_EXPORT MetaDataObject< std::vector > >; +template class ITKCommon_EXPORT MetaDataObject< std::vector > >; + +} // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreader.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreader.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreader.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreader.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -187,19 +187,19 @@ for ( ThreadIdType i = 0; i < ITK_MAX_THREADS; i++ ) { m_ThreadInfoArray[i].ThreadID = i; - m_ThreadInfoArray[i].ActiveFlag = 0; - m_ThreadInfoArray[i].ActiveFlagLock = 0; + m_ThreadInfoArray[i].ActiveFlag = ITK_NULLPTR; + m_ThreadInfoArray[i].ActiveFlagLock = ITK_NULLPTR; - m_MultipleMethod[i] = 0; - m_MultipleData[i] = 0; + m_MultipleMethod[i] = ITK_NULLPTR; + m_MultipleData[i] = ITK_NULLPTR; m_SpawnedThreadActiveFlag[i] = 0; - m_SpawnedThreadActiveFlagLock[i] = 0; + m_SpawnedThreadActiveFlagLock[i] = ITK_NULLPTR; m_SpawnedThreadInfoArray[i].ThreadID = i; } - m_SingleMethod = 0; - m_SingleData = 0; + m_SingleMethod = ITK_NULLPTR; + m_SingleData = ITK_NULLPTR; m_NumberOfThreads = this->GetGlobalDefaultNumberOfThreads(); } @@ -241,7 +241,6 @@ if ( !m_SingleMethod ) { itkExceptionMacro(<< "No single method set!"); - return; } // obey the global maximum number of threads limit @@ -292,7 +291,7 @@ m_ThreadInfoArray[0].NumberOfThreads = m_NumberOfThreads; m_SingleMethod( (void *)( &m_ThreadInfoArray[0] ) ); } - catch ( ProcessAborted & excp ) + catch ( ProcessAborted & ) { // Need cleanup and rethrow ProcessAborted // close down other threads @@ -306,7 +305,7 @@ {} } // rethrow - throw &excp; + throw; } catch ( std::exception & e ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreaderPThreads.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreaderPThreads.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreaderPThreads.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMultiThreaderPThreads.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -65,7 +65,7 @@ // hw.logicalcpu takes into account cores/CPUs that are // disabled because of power management. size_t dataLen = sizeof( int ); // 'num' is an 'int' - int result = sysctlbyname ("hw.logicalcpu", &num, &dataLen, NULL, 0); + int result = sysctlbyname ("hw.logicalcpu", &num, &dataLen, ITK_NULLPTR, 0); if ( result == -1 ) { num = 1; @@ -88,7 +88,7 @@ for ( thread_loop = 0; thread_loop < m_NumberOfThreads; thread_loop++ ) { - if ( m_MultipleMethod[thread_loop] == (ThreadFunctionType)0 ) + if ( m_MultipleMethod[thread_loop] == (ThreadFunctionType)ITK_NULLPTR ) { itkExceptionMacro(<< "No multiple method set for: " << thread_loop); return; @@ -138,7 +138,7 @@ // waits for each of the other processes to exit for ( thread_loop = 1; thread_loop < m_NumberOfThreads; thread_loop++ ) { - pthread_join(process_id[thread_loop], 0); + pthread_join(process_id[thread_loop], ITK_NULLPTR); } } @@ -206,10 +206,10 @@ m_SpawnedThreadActiveFlag[ThreadID] = 0; m_SpawnedThreadActiveFlagLock[ThreadID]->Unlock(); - pthread_join(m_SpawnedThreadProcessID[ThreadID], 0); + pthread_join(m_SpawnedThreadProcessID[ThreadID], ITK_NULLPTR); - m_SpawnedThreadActiveFlagLock[ThreadID] = 0; - m_SpawnedThreadActiveFlagLock[ThreadID] = 0; + m_SpawnedThreadActiveFlagLock[ThreadID] = ITK_NULLPTR; + m_SpawnedThreadActiveFlagLock[ThreadID] = ITK_NULLPTR; } void @@ -217,7 +217,7 @@ ::WaitForSingleMethodThread(ThreadProcessIDType threadHandle) { // Using POSIX threads - if ( pthread_join(threadHandle, 0) ) + if ( pthread_join(threadHandle, ITK_NULLPTR) ) { itkExceptionMacro(<< "Unable to join thread."); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMutexLockPThreads.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMutexLockPThreads.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkMutexLockPThreads.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkMutexLockPThreads.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ // Construct a new MutexLock SimpleMutexLock::SimpleMutexLock() { - pthread_mutex_init(&m_MutexLock, NULL); + pthread_mutex_init(&m_MutexLock, ITK_NULLPTR); } // Destruct the MutexVariable diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsDiffusionTensor3DPixel.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsDiffusionTensor3DPixel.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsDiffusionTensor3DPixel.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsDiffusionTensor3DPixel.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,10 +28,10 @@ #define DIFFUSIONTENSOR3DPIXELSTATICTRAITSMACRO(T) \ template< > \ - const DiffusionTensor3D< T > NumericTraits< DiffusionTensor3D< T > >::Zero = DiffusionTensor3D< T >( \ + ITKCommon_EXPORT const DiffusionTensor3D< T > NumericTraits< DiffusionTensor3D< T > >::Zero = DiffusionTensor3D< T >( \ NumericTraits< T >::Zero); \ template< > \ - const DiffusionTensor3D< T > NumericTraits< DiffusionTensor3D< T > >::One = DiffusionTensor3D< T >( \ + ITKCommon_EXPORT const DiffusionTensor3D< T > NumericTraits< DiffusionTensor3D< T > >::One = DiffusionTensor3D< T >( \ NumericTraits< T >::One); // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBAPixel.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBAPixel.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBAPixel.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBAPixel.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,9 +29,9 @@ // #define RGBAPIXELSTATICTRAITSMACRO(T) \ template< > \ - const RGBAPixel< T > NumericTraits< RGBAPixel< T > >::Zero = RGBAPixel< T >(NumericTraits< T >::Zero); \ + ITKCommon_EXPORT const RGBAPixel< T > NumericTraits< RGBAPixel< T > >::Zero = RGBAPixel< T >(NumericTraits< T >::Zero); \ template< > \ - const RGBAPixel< T > NumericTraits< RGBAPixel< T > >::One = RGBAPixel< T >(NumericTraits< T >::One); + ITKCommon_EXPORT const RGBAPixel< T > NumericTraits< RGBAPixel< T > >::One = RGBAPixel< T >(NumericTraits< T >::One); // // List here the specializations of the Traits: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBPixel.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBPixel.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBPixel.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkNumericTraitsRGBPixel.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,9 +29,9 @@ // #define RGBPIXELSTATICTRAITSMACRO(T) \ template< > \ - const RGBPixel< T > NumericTraits< RGBPixel< T > >::Zero = RGBPixel< T >(NumericTraits< T >::Zero); \ + ITKCommon_EXPORT const RGBPixel< T > NumericTraits< RGBPixel< T > >::Zero = RGBPixel< T >(NumericTraits< T >::Zero); \ template< > \ - const RGBPixel< T > NumericTraits< RGBPixel< T > >::One = RGBPixel< T >(NumericTraits< T >::One); + ITKCommon_EXPORT const RGBPixel< T > NumericTraits< RGBPixel< T > >::One = RGBPixel< T >(NumericTraits< T >::One); // // List here the specializations of the Traits: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,6 +26,7 @@ * *=========================================================================*/ #include "itkCommand.h" +#include namespace itk { @@ -34,7 +35,7 @@ */ bool Object:: m_GlobalWarningDisplay = true; -class Observer +class ITKCommon_HIDDEN Observer { public: Observer(Command *c, @@ -50,11 +51,12 @@ unsigned long m_Tag; }; -class SubjectImplementation +class ITKCommon_HIDDEN SubjectImplementation { public: - SubjectImplementation() { m_Count = 0; } + SubjectImplementation() : m_ListModified(false) { m_Count = 0; } ~SubjectImplementation(); + unsigned long AddObserver(const EventObject & event, Command *cmd); unsigned long AddObserver(const EventObject & event, Command *cmd) const; @@ -73,6 +75,35 @@ bool PrintObservers(std::ostream & os, Indent indent) const; + bool m_ListModified; + +protected: + + // RAII of ListModified state to ensure exception safety + struct SaveRestoreListModified + { + // save the list modified flag, and reset to false + SaveRestoreListModified(SubjectImplementation *s) + : m_Subject(s), m_Save(s->m_ListModified) + { + m_Subject->m_ListModified = false; + } + + // restore modify flag, and propagate if modified + ~SaveRestoreListModified() + { + m_Subject->m_ListModified = m_Save||m_Subject->m_ListModified; + } + + SubjectImplementation *m_Subject; + bool m_Save; + }; + + template + void InvokeEventRecursion(const EventObject & event, + TObject *self, + std::list< Observer * >::reverse_iterator &i); + private: std::list< Observer * > m_Observers; unsigned long m_Count; @@ -121,6 +152,7 @@ { delete ( *i ); m_Observers.erase(i); + m_ListModified = true; return; } } @@ -135,36 +167,73 @@ delete ( *i ); } m_Observers.clear(); + m_ListModified = true; } void SubjectImplementation::InvokeEvent(const EventObject & event, Object *self) { - for ( std::list< Observer * >::iterator i = m_Observers.begin(); - i != m_Observers.end(); ++i ) - { - const EventObject *e = ( *i )->m_Event; - if ( e->CheckEvent(&event) ) - { - ( *i )->m_Command->Execute(self, event); - } - } + // While an event is being invoked, it's possible to remove + // observers, or another event to be invoked. All methods which + // remove observers mark the list as modified with the + // m_ListModified flag. The modified flag is save to the stack and + // marked false before recursively saving the current list. + + SaveRestoreListModified save(this); + + std::list< Observer * >::reverse_iterator i = m_Observers.rbegin(); + InvokeEventRecursion( event, self, i ); } void SubjectImplementation::InvokeEvent(const EventObject & event, const Object *self) { - for ( std::list< Observer * >::iterator i = m_Observers.begin(); - i != m_Observers.end(); ++i ) + SaveRestoreListModified save(this); + + std::list< Observer * >::reverse_iterator i = m_Observers.rbegin(); + InvokeEventRecursion( event, self, i ); +} + +template +void +SubjectImplementation::InvokeEventRecursion( const EventObject & event, + TObject *self, + std::list< Observer * >::reverse_iterator &i) +{ + // This method recursively visits the list of observers in reverse + // order so that on the last recursion the first observer can be + // executed. Each iteration saves the list element on the + // stack. Each observer's execution could potentially modify the + // observer list, by placing the entire list on the stack we save the + // list when the event is first invoked. If observers are removed + // during execution, then the current list is search for the current + // observer save on the stack. + + while (i != m_Observers.rend()) { - const EventObject *e = ( *i )->m_Event; - if ( e->CheckEvent(&event) ) + + // save observer + const Observer *o = *i; + + if ( o->m_Event->CheckEvent(&event) ) { - ( *i )->m_Command->Execute(self, event); + InvokeEventRecursion( event, self, ++i ); + + if ( !m_ListModified || + std::find(m_Observers.begin(), m_Observers.end(), o) != m_Observers.end() ) + { + o->m_Command->Execute(self, event); + } + + return; } + + ++i; } + + return; } Command * @@ -178,7 +247,7 @@ return ( *i )->m_Command; } } - return 0; + return ITK_NULLPTR; } bool @@ -209,7 +278,12 @@ { const EventObject *e = ( *i )->m_Event; const Command * c = ( *i )->m_Command; - os << indent << e->GetEventName() << "(" << c->GetNameOfClass() << ")\n"; + os << indent << e->GetEventName() << "(" << c->GetNameOfClass(); + if (!c->GetObjectName().empty()) + { + os << " \"" << c->GetObjectName() << "\""; + } + os << ")\n"; } return true; } @@ -220,7 +294,7 @@ Pointer smartPtr; Object *rawPtr = ::itk::ObjectFactory< Object >::Create(); - if ( rawPtr == NULL ) + if ( rawPtr == ITK_NULLPTR ) { rawPtr = new Object; } @@ -345,7 +419,14 @@ /** * If there is a delete method, invoke it. */ - this->InvokeEvent( DeleteEvent() ); + try + { + this->InvokeEvent( DeleteEvent() ); + } + catch(...) + { + itkWarningMacro("Exception occurred in DeleteEvent Observer!"); + } } Superclass::UnRegister(); @@ -367,7 +448,14 @@ /** * If there is a delete method, invoke it. */ - this->InvokeEvent( DeleteEvent() ); + try + { + this->InvokeEvent( DeleteEvent() ); + } + catch(...) + { + itkWarningMacro("Exception occurred in DeleteEvent Observer!"); + } } Superclass::SetReferenceCount(ref); @@ -424,7 +512,7 @@ { return this->m_SubjectImplementation->GetCommand(tag); } - return NULL; + return ITK_NULLPTR; } void @@ -497,8 +585,8 @@ ::Object(): LightObject(), m_Debug(false), - m_SubjectImplementation(NULL), - m_MetaDataDictionary(NULL), + m_SubjectImplementation(ITK_NULLPTR), + m_MetaDataDictionary(ITK_NULLPTR), m_ObjectName() { this->Modified(); @@ -536,7 +624,7 @@ Object ::GetMetaDataDictionary(void) { - if ( m_MetaDataDictionary == NULL ) + if ( m_MetaDataDictionary == ITK_NULLPTR ) { m_MetaDataDictionary = new MetaDataDictionary; } @@ -547,7 +635,7 @@ Object ::GetMetaDataDictionary(void) const { - if ( m_MetaDataDictionary == NULL ) + if ( m_MetaDataDictionary == ITK_NULLPTR ) { m_MetaDataDictionary = new MetaDataDictionary; } @@ -558,7 +646,7 @@ Object ::SetMetaDataDictionary(const MetaDataDictionary & rhs) { - if ( m_MetaDataDictionary == NULL ) + if ( m_MetaDataDictionary == ITK_NULLPTR ) { m_MetaDataDictionary = new MetaDataDictionary; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkObjectFactoryBase.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkObjectFactoryBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkObjectFactoryBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkObjectFactoryBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -134,7 +134,7 @@ /** - * Create an instance of a named itk object using the loaded + * Create an instance of a named ITK object using the loaded * factories */ LightObject::Pointer @@ -154,7 +154,7 @@ return newobject; } } - return 0; + return ITK_NULLPTR; } std::list< LightObject::Pointer > @@ -222,9 +222,9 @@ ObjectFactoryBase ::RegisterInternal() { - // Guaranee that no internal factories have already been registered. - itkAssertOrThrowMacro( ObjectFactoryBasePrivate::m_RegisteredFactories->empty(), - "Factories unexpectedlly already registered!" ); + // Guarantee that no internal factories have already been registered. + itkAssertInDebugAndIgnoreInReleaseMacro( ObjectFactoryBasePrivate::m_RegisteredFactories->empty() ); + ObjectFactoryBasePrivate::m_RegisteredFactories->clear(); // Register all factories registered by the // "RegisterFactoryInternal" method @@ -413,6 +413,15 @@ newfactory->m_LibraryHandle = (void *)lib; newfactory->m_LibraryPath = fullpath; newfactory->m_LibraryDate = 0; // unused for now... + + // ObjectFactoryBase::RegisterFactory may raise an exception if + // a user enables StrictVersionChecking and a library in "path" + // is a conflicting version; this exception should be propagated + // to the user and not caught by ITK + // + // Do not edit the next comment line! It is intended to be parsed + // by the Coverity analyzer. + // coverity[fun_call_w_exception] if (!ObjectFactoryBase::RegisterFactory(newfactory)) { DynamicLoader::CloseLibrary(lib); @@ -446,7 +455,7 @@ */ ObjectFactoryBase::ObjectFactoryBase() { - m_LibraryHandle = 0; + m_LibraryHandle = ITK_NULLPTR; m_LibraryDate = 0; m_OverrideMap = new OverRideMap; } @@ -470,7 +479,7 @@ ObjectFactoryBase ::RegisterFactoryInternal(ObjectFactoryBase *factory) { - if ( factory->m_LibraryHandle != NULL ) + if ( factory->m_LibraryHandle != ITK_NULLPTR ) { itkGenericExceptionMacro( "A dynamic factory tried to be loaded internally!" ); } @@ -497,7 +506,7 @@ ObjectFactoryBase ::RegisterFactory(ObjectFactoryBase *factory, InsertionPositionType where, size_t position) { - if ( factory->m_LibraryHandle == 0 ) + if ( factory->m_LibraryHandle == ITK_NULLPTR ) { const char nonDynamicName[] = "Non-Dynamicaly loaded factory"; factory->m_LibraryPath = nonDynamicName; @@ -692,7 +701,7 @@ } } delete ObjectFactoryBasePrivate::m_RegisteredFactories; - ObjectFactoryBasePrivate::m_RegisteredFactories = 0; + ObjectFactoryBasePrivate::m_RegisteredFactories = ITK_NULLPTR; ObjectFactoryBasePrivate::m_Initialized = false; } } @@ -733,7 +742,7 @@ return ( *i ).second.m_CreateObject->CreateObject(); } } - return 0; + return ITK_NULLPTR; } std::list< LightObject::Pointer > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkOctreeNode.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkOctreeNode.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkOctreeNode.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkOctreeNode.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,8 +27,8 @@ */ OctreeNode::OctreeNode(void) { - m_Parent = 0; - m_Branch = 0; + m_Parent = ITK_NULLPTR; + m_Branch = ITK_NULLPTR; } OctreeNode::~OctreeNode(void) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkOutputWindow.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkOutputWindow.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkOutputWindow.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkOutputWindow.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ namespace itk { -OutputWindow::Pointer OutputWindow:: m_Instance = 0; +OutputWindow::Pointer OutputWindow:: m_Instance = ITK_NULLPTR; /** * Prompting off by default diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkProcessObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkProcessObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkProcessObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkProcessObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -129,7 +129,7 @@ // let the output know we no longer want to associate with the object it->second->DisconnectSource(this, it->first); // let go of our reference to the data object - it->second = 0; + it->second = ITK_NULLPTR; } } } @@ -159,7 +159,7 @@ if (num < 1 ) { - m_IndexedInputs[0]->second = NULL; + m_IndexedInputs[0]->second = ITK_NULLPTR; } } else @@ -224,7 +224,7 @@ // if primary or required set to null if ( key == m_IndexedInputs[0]->first || this->IsRequiredInputName(key) ) { - this->SetInput(key, NULL); + this->SetInput(key, ITK_NULLPTR); return; } @@ -233,7 +233,7 @@ { if ( m_IndexedInputs[i]->first == key ) { - this->SetNthInput(i, NULL); + this->SetNthInput(i, ITK_NULLPTR); if ( i == m_IndexedInputs.size() - 1 ) { // remove the last indexed input @@ -385,7 +385,7 @@ // if primary or required set to null if ( key == m_IndexedOutputs[0]->first ) { - this->SetOutput( key, NULL ); + this->SetOutput( key, ITK_NULLPTR ); return; } @@ -394,7 +394,7 @@ { if ( m_IndexedOutputs[i]->first == key ) { - this->SetNthOutput(i, NULL); + this->SetNthOutput(i, ITK_NULLPTR); if ( i == m_IndexedOutputs.size() - 1 ) { // remove the last indexed input @@ -560,7 +560,7 @@ if (num < 1 ) { - m_IndexedOutputs[0]->second = NULL; + m_IndexedOutputs[0]->second = ITK_NULLPTR; } } else @@ -588,7 +588,7 @@ DataObjectPointerMap::iterator it = m_Outputs.find(key); if ( it == m_Outputs.end() ) { - return NULL; + return ITK_NULLPTR; } return it->second.GetPointer(); } @@ -600,7 +600,7 @@ DataObjectPointerMap::const_iterator it = m_Outputs.find(key); if ( it == m_Outputs.end() ) { - return NULL; + return ITK_NULLPTR; } return it->second.GetPointer(); } @@ -734,7 +734,7 @@ { return m_IndexedOutputs.size(); } - return this->GetPrimaryOutput() != NULL; + return this->GetPrimaryOutput() != ITK_NULLPTR; } // ProcessObject::ConstDataObjectPointerArray @@ -771,7 +771,7 @@ DataObjectPointerMap::iterator it = m_Inputs.find(key); if ( it == m_Inputs.end() ) { - return NULL; + return ITK_NULLPTR; } return it->second.GetPointer(); } @@ -783,7 +783,7 @@ DataObjectPointerMap::const_iterator it = m_Inputs.find(key); if ( it == m_Inputs.end() ) { - return NULL; + return ITK_NULLPTR; } return it->second.GetPointer(); } @@ -1006,7 +1006,7 @@ { return m_IndexedInputs.size(); } - return this->GetPrimaryInput() != NULL; + return this->GetPrimaryInput() != ITK_NULLPTR; } // ProcessObject::ConstDataObjectPointerArray @@ -1365,7 +1365,7 @@ */ for( NameSet::const_iterator it = this->m_RequiredInputNames.begin(); it != this->m_RequiredInputNames.end(); ++it ) { - if ( this->GetInput( *it ) == NULL ) + if ( this->GetInput( *it ) == ITK_NULLPTR ) { itkExceptionMacro(<< "Input " << *it << " is required but not set."); } @@ -1377,7 +1377,7 @@ NameSet::const_iterator i = m_RequiredInputNames.begin(); while (i != m_RequiredInputNames.end()) { - if ( this->GetInput(*i) == NULL ) + if ( this->GetInput(*i) == ITK_NULLPTR ) { itkExceptionMacro( << "Required Input " << *i << "is not specified!" << " The required inputs are expected to be the first inputs."); @@ -1732,12 +1732,12 @@ { this->GenerateData(); } - catch ( ProcessAborted & excp ) + catch ( ProcessAborted & ) { this->InvokeEvent( AbortEvent() ); this->ResetPipeline(); this->RestoreInputReleaseDataFlags(); - throw &excp; + throw; } catch (...) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkProgressAccumulator.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkProgressAccumulator.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkProgressAccumulator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkProgressAccumulator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,7 @@ ProgressAccumulator ::ProgressAccumulator() { - m_MiniPipelineFilter = 0; + m_MiniPipelineFilter = ITK_NULLPTR; // Initialize the progress values m_AccumulatedProgress = 0.0f; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkRealTimeClock.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkRealTimeClock.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkRealTimeClock.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkRealTimeClock.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -81,6 +81,8 @@ this->m_Origin -= this->m_Difference; #else this->m_Frequency = 1e6; + this->m_Difference = 0.0; + this->m_Origin = 0.0; #endif // defined(WIN32) || defined(_WIN32) } @@ -100,7 +102,7 @@ return value; #else struct timeval tval; - ::gettimeofday(&tval, 0); + ::gettimeofday(&tval, ITK_NULLPTR); TimeStampType value = static_cast< TimeStampType >( tval.tv_sec ) + static_cast< TimeStampType >( tval.tv_usec ) / this->m_Frequency; @@ -129,14 +131,14 @@ typedef RealTimeStamp::SecondsCounterType SecondsCounterType; typedef RealTimeStamp::MicroSecondsCounterType MicroSecondsCounterType; - SecondsCounterType iseconds = vcl_floor( seconds ); - MicroSecondsCounterType useconds = vcl_floor( ( seconds - iseconds ) * 1e6 ); + SecondsCounterType iseconds = std::floor( seconds ); + MicroSecondsCounterType useconds = std::floor( ( seconds - iseconds ) * 1e6 ); RealTimeStamp value( iseconds, useconds ); return value; #else struct timeval tval; - ::gettimeofday(&tval, 0); + ::gettimeofday(&tval, ITK_NULLPTR); RealTimeStamp value( static_cast(tval.tv_sec), static_cast(tval.tv_usec) ); return value; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFastMutexLockPThreads.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFastMutexLockPThreads.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFastMutexLockPThreads.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFastMutexLockPThreads.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,10 @@ // Construct a new SimpleMutexLock SimpleFastMutexLock::SimpleFastMutexLock() { - pthread_mutex_init(&( m_FastMutexLock ), NULL); + pthread_mutexattr_t mta; + pthread_mutexattr_init(&mta); + pthread_mutexattr_settype(&mta, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init(&( m_FastMutexLock ), &mta); } // Destruct the SimpleMutexVariable diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFilterWatcher.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFilterWatcher.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFilterWatcher.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSimpleFilterWatcher.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -75,20 +75,23 @@ } SimpleFilterWatcher -::SimpleFilterWatcher() -{ - // Initialize state - m_Steps = 0; - m_Comment = "Not watching an object"; - m_TestAbort = false; - m_Iterations = 0; +::SimpleFilterWatcher() : + m_Steps(0), + m_Iterations(0), #if defined( _COMPILER_VERSION ) && ( _COMPILER_VERSION == 730 ) - m_Quiet = true; + m_Quiet(true), #else - m_Quiet = false; + m_Quiet(false), #endif - - m_Process = 0; + m_TestAbort(false), + m_Comment("Not watching an object"), + m_Process(ITK_NULLPTR), + m_StartTag(0), + m_EndTag(0), + m_ProgressTag(0), + m_IterationTag(0), + m_AbortTag(0) +{ } SimpleFilterWatcher diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSmapsFileParser.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSmapsFileParser.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSmapsFileParser.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSmapsFileParser.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -370,7 +370,7 @@ std::istream & operator>>(std::istream & smapsStream, SmapsData_2_6 & data) { - SmapsRecord *record = NULL; + SmapsRecord *record = ITK_NULLPTR; // reset the records from a previous parsing data.Reset(); @@ -428,7 +428,7 @@ std::istream & operator>>(std::istream & stream, VMMapData_10_2 & data) { - MapRecord *record = NULL; + MapRecord *record = ITK_NULLPTR; // reset the records from a previous parsing data.Reset(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSmartPointerForwardReferenceProcessObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSmartPointerForwardReferenceProcessObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkSmartPointerForwardReferenceProcessObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkSmartPointerForwardReferenceProcessObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -16,7 +16,24 @@ * *=========================================================================*/ #include "itkSmartPointerForwardReference.h" +/** The inclusion of itkSmartPointerForwardReference.hxx is needed here + * because this is one of the very few cases where + * itkSmartPointerForwardReference.h does not include + * itkSmartPointerForwardReference.hxx + * + * Ensure that the implicitly instantiated methods and operators are + * exported for the linker. + */ +#if __GNUC__ >= 4 +#pragma GCC visibility push(default) +#endif #include "itkSmartPointerForwardReference.hxx" +#if __GNUC__ >= 4 +#pragma GCC visibility pop +#endif + + #include "itkProcessObject.h" +// Manual instantiation is necessary to prevent link errors template class ITKCommon_EXPORT itk::SmartPointerForwardReference< itk::ProcessObject >; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkStdStreamLogOutput.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkStdStreamLogOutput.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkStdStreamLogOutput.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkStdStreamLogOutput.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ /** Constructor */ StdStreamLogOutput::StdStreamLogOutput() { - this->m_Stream = 0; + this->m_Stream = ITK_NULLPTR; } /** Destructor */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkThreadLogger.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkThreadLogger.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/src/itkThreadLogger.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/src/itkThreadLogger.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -180,12 +180,12 @@ { struct MultiThreader:: ThreadInfoStruct *pInfo = (struct MultiThreader::ThreadInfoStruct *)pInfoStruct; - if ( pInfo == NULL ) + if ( pInfo == ITK_NULLPTR ) { return ITK_THREAD_RETURN_VALUE; } - if ( pInfo->UserData == NULL ) + if ( pInfo->UserData == ITK_NULLPTR ) { return ITK_THREAD_RETURN_VALUE; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkArray2D.wrap otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkArray2D.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkArray2D.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkArray2D.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,4 @@ itk_wrap_class("itk::Array2D") - itk_wrap_template("${ITKM_D}" "${ITKT_D}") UNIQUE(types "D;${WRAP_ITK_REAL}") foreach(t ${types}) itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/ITKCommonBase.wrap otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/ITKCommonBase.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/ITKCommonBase.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/ITKCommonBase.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -31,6 +31,7 @@ itk_wrap_simple_class("itk::ObjectFactoryBase" POINTER) itk_wrap_simple_class("itk::OutputWindow" POINTER) itk_wrap_simple_class("itk::Version" POINTER) +itk_wrap_simple_class("itk::RealTimeClock" POINTER) itk_wrap_simple_class("itk::RealTimeInterval") itk_wrap_simple_class("itk::RealTimeStamp") itk_wrap_simple_class("itk::TimeStamp") diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkDiffusionTensor3D.wrap otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkDiffusionTensor3D.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkDiffusionTensor3D.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkDiffusionTensor3D.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,7 +1,8 @@ -itk_wrap_class("itk::DiffusionTensor3D") - itk_wrap_filter_dims(d 3) - if(d) +itk_wrap_filter_dims(has_d_3 3) + +if(has_d_3) + itk_wrap_class("itk::DiffusionTensor3D") itk_wrap_template("${ITKM_F}" "${ITKT_F}") itk_wrap_template("${ITKM_D}" "${ITKT_D}") - endif(d) -itk_end_wrap_class() + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkNumericTraits.wrap otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkNumericTraits.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkNumericTraits.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkNumericTraits.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -16,7 +16,7 @@ endif(WIN32) # the superclass -itk_wrap_class(vcl_numeric_limits EXPLICIT_SPECIALIZATION) +itk_wrap_class(std::numeric_limits EXPLICIT_SPECIALIZATION) # the basic types foreach(t UC US UI UL SC SS SI SL F D LD B) itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkVectorContainer.wrap otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkVectorContainer.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/Common/wrapping/itkVectorContainer.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Common/wrapping/itkVectorContainer.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,15 +1,14 @@ itk_wrap_include("set") -# double is always needed by KernelTransform -UNIQUE(real_types "${WRAP_ITK_REAL};D") itk_wrap_class("itk::VectorContainer" POINTER) + # double is always needed by KernelTransform + UNIQUE(real_types "${WRAP_ITK_REAL};D") foreach(t ${real_types}) itk_wrap_template("${ITKM_UL}${ITKM_${t}}" "${ITKT_UL},${ITKT_${t}}") itk_wrap_template("${ITKM_UC}${ITKM_${t}}" "${ITKT_UC},${ITKT_${t}}") endforeach(t) foreach(d ${ITK_WRAP_DIMS}) foreach(t ${real_types}) - itk_wrap_template("${ITKM_UL}${ITKM_${t}}" "${ITKT_UL},${ITKT_${t}}") itk_wrap_template("${ITKM_UL}${ITKM_V${t}${d}}" "${ITKT_UL},${ITKT_V${t}${d}}") itk_wrap_template("${ITKM_UL}${ITKM_P${t}${d}}" "${ITKT_UL},${ITKT_P${t}${d}}") itk_wrap_template("${ITKM_UL}M${ITKM_${t}}${d}${d}" "${ITKT_UL}, itk::Matrix< ${ITKT_${t}}, ${d}, ${d} >") @@ -19,10 +18,6 @@ itk_wrap_template("${ITKM_UC}${ITKM_O${d}}" "${ITKT_UC},${ITKT_O${d}}") itk_wrap_template("${ITKM_UI}${ITKM_CID${d}}" "${ITKT_UI},${ITKT_CID${d}}") endforeach(d) - foreach(t ${WRAP_ITK_REAL}) - itk_wrap_template("${ITKM_UL}${ITKM_${t}}" "${ITKT_UL},${ITKT_${t}}") - itk_wrap_template("${ITKM_UC}${ITKM_${t}}" "${ITKT_UC},${ITKT_${t}}") - endforeach(t) itk_wrap_template("${ITKM_UC}${ITKM_SS}" "${ITKT_UC},${ITKT_SS}") # used in FastMarchingExtensionImageFilter itk_wrap_template("${ITKM_UI}${ITKM_VUC1}" "${ITKT_UI},${ITKT_VUC1}") diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkDenseFiniteDifferenceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -230,9 +230,7 @@ DenseFiniteDifferenceImageFilter< TInputImage, TOutputImage > ::ThreadedCalculateChange(const ThreadRegionType & regionToProcess, ThreadIdType) { - typedef typename OutputImageType::RegionType RegionType; typedef typename OutputImageType::SizeType SizeType; - typedef typename OutputImageType::IndexType IndexType; typedef typename FiniteDifferenceFunctionType::NeighborhoodType NeighborhoodIteratorType; typedef ImageRegionIterator< UpdateBufferType > UpdateIteratorType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -186,7 +186,7 @@ FiniteDifferenceFunction(); ~FiniteDifferenceFunction() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; RadiusType m_Radius; PixelRealType m_ScaleCoefficients[ImageDimension]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -86,7 +86,6 @@ NeighborhoodScalesType neighborhoodScales; neighborhoodScales.Fill(0.0); - typedef typename NeighborhoodScalesType::ComponentType NeighborhoodScaleType; for ( unsigned int i = 0; i < ImageDimension; i++ ) { if ( this->m_Radius[i] > 0 ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ { m_UseImageSpacing = true; m_ElapsedIterations = 0; - m_DifferenceFunction = 0; + m_DifferenceFunction = ITK_NULLPTR; m_NumberOfIterations = NumericTraits< IdentifierType >::max(); m_MaximumRMSError = 0.0; m_RMSChange = 0.0; @@ -264,7 +264,7 @@ if ( this->m_UseImageSpacing ) { const TOutputImage *outputImage = this->GetOutput(); - if ( outputImage == NULL ) + if ( outputImage == ITK_NULLPTR ) { itkExceptionMacro("Output image is NULL"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ FiniteDifferenceSparseImageFilter< TInputImageType, TSparseOutputImageType > ::FiniteDifferenceSparseImageFilter() { - m_SparseFunction = 0; + m_SparseFunction = ITK_NULLPTR; m_PrecomputeFlag = false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/FiniteDifference/include/itkFiniteDifferenceSparseImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ void *, const FloatOffsetType &) { - return static_cast< PixelType >( 0 ); + return static_cast< PixelType >( ITK_NULLPTR ); } /** The update called from the FiniteDifferenceSparseImageFilter. This diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.h otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.h --- otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.h 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,7 @@ // // Allocate CPU and GPU memory space // - void Allocate(); + virtual void Allocate(bool initialize=false) ITK_OVERRIDE; virtual void Initialize(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.hxx otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,10 +36,10 @@ } template -void GPUImage< TPixel, VImageDimension >::Allocate() +void GPUImage< TPixel, VImageDimension >::Allocate(bool initialize) { // allocate CPU memory - calling Allocate() in superclass - Superclass::Allocate(); + Superclass::Allocate(initialize); // allocate GPU memory this->ComputeOffsetTable(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUInPlaceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUInPlaceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUInPlaceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUInPlaceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -74,7 +74,7 @@ // Graft this first input to the output. Later, we'll need to // remove the input's hold on the bulk data. // - OutputImagePointer inputAsOutput = + OutputImagePointer inputAsOutput = dynamic_cast< TOutputImage * >( const_cast< TInputImage * >( this->GetInput() ) ); if ( inputAsOutput ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUReduction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUReduction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUReduction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/include/itkGPUReduction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,6 +36,12 @@ m_GPUKernelManager = GPUKernelManager::New(); m_GPUDataManager = NULL; + m_ReduceGPUKernelHandle = 0; + m_TestGPUKernelHandle = 0; + + m_Size = 0; + m_SmallBlock = false; + } template< typename TElement > GPUReduction< TElement > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/src/itkGPUDataManager.cxx otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/src/itkGPUDataManager.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/GPUCommon/src/itkGPUDataManager.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/GPUCommon/src/itkGPUDataManager.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -147,7 +147,6 @@ if( m_IsGPUBufferDirty && m_IsCPUBufferDirty ) { itkExceptionMacro("Cannot make up-to-date buffer because both CPU and GPU buffers are dirty"); - return false; } this->UpdateGPUBuffer(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAbsImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ namespace Accessor { /** \class AbsPixelAccessor - * \brief Give access to the vcl_abs() function of a value + * \brief Give access to the std::abs() function of a value * * AbsPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -62,7 +62,7 @@ } // end namespace Accessor /** \class AbsImageAdaptor - * \brief Presents an image as being composed of the vcl_abs() of its pixels + * \brief Presents an image as being composed of the std::abs() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAcosImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAcosImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAcosImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAcosImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class AcosPixelAccessor - * \brief Give access to the vcl_acos() function of a value + * \brief Give access to the std::acos() function of a value * * AcosPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -51,15 +51,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_acos( (double)input ); } + { output = (TInternalType)std::acos( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_acos( (double)input ); } + { return (TExternalType)std::acos( (double)input ); } }; } // end namespace Accessor /** \class AcosImageAdaptor - * \brief Presents an image as being composed of the vcl_acos() of its pixels + * \brief Presents an image as being composed of the std::acos() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAsinImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAsinImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAsinImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAsinImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ { /** * \class AsinPixelAccessor - * \brief Give access to the vcl_asin() function of a value + * \brief Give access to the std::asin() function of a value * * AsinPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -51,16 +51,16 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_asin( (double)input ); } + { output = (TInternalType)std::asin( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_asin( (double)input ); } + { return (TExternalType)std::asin( (double)input ); } }; } // end namespace Accessor /** * \class AsinImageAdaptor - * \brief Presents an image as being composed of the vcl_asin() of its pixels + * \brief Presents an image as being composed of the std::asin() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAtanImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAtanImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAtanImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkAtanImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,7 @@ { /** * \class AtanPixelAccessor - * \brief Give access to the vcl_atan() function of a value + * \brief Give access to the std::atan() function of a value * * AtanPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -52,16 +52,16 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_atan( (double)input ); } + { output = (TInternalType)std::atan( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_atan( (double)input ); } + { return (TExternalType)std::atan( (double)input ); } }; } // end namespace Accessor /** * \class AtanImageAdaptor - * \brief Presents an image as being composed of the vcl_atan() of its pixels + * \brief Presents an image as being composed of the std::atan() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToModulusImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToModulusImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToModulusImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToModulusImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -54,14 +54,14 @@ static inline TExternalType Get(const TInternalType & input) { - return (TExternalType)( vcl_sqrt( input.real() * input.real() + return (TExternalType)( std::sqrt( input.real() * input.real() + input.imag() * input.imag() ) ); } }; } // end namespace Accessor /** \class ComplexToModulusImageAdaptor - * \brief Presents a complex image as being composed of vcl_abs() part + * \brief Presents a complex image as being composed of std::abs() part * of its pixels. * * Additional casting is performed according to the input and output image diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToPhaseImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToPhaseImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToPhaseImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkComplexToPhaseImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -53,7 +53,7 @@ { output = (TInternalType)( input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)( vcl_atan2( input.imag(), input.real() ) ); } + { return (TExternalType)( std::atan2( input.imag(), input.real() ) ); } }; } // end namespace Accessor diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkCosImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkCosImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkCosImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkCosImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class CosPixelAccessor - * \brief Give access to the vcl_cos() function of a value + * \brief Give access to the std::cos() function of a value * * CosPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -49,15 +49,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_cos( (double)input ); } + { output = (TInternalType)std::cos( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_cos( (double)input ); } + { return (TExternalType)std::cos( (double)input ); } }; } // end namespace Accessor /** \class CosImageAdaptor - * \brief Presents an image as being composed of the vcl_cos() of its pixels + * \brief Presents an image as being composed of the std::cos() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class ExpPixelAccessor - * \brief Give access to the vcl_exp() function of a value + * \brief Give access to the std::exp() function of a value * * ExpPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -49,15 +49,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_exp( (double)input ); } + { output = (TInternalType)std::exp( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_exp( (double)input ); } + { return (TExternalType)std::exp( (double)input ); } }; } // end namespace Accessor /** \class ExpImageAdaptor - * \brief Presents an image as being composed of the vcl_exp() of its pixels + * \brief Presents an image as being composed of the std::exp() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpNegativeImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpNegativeImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpNegativeImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkExpNegativeImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class ExpNegativePixelAccessor - * \brief Give access to the vcl_exp() function of a value + * \brief Give access to the std::exp() function of a value * * ExpNegativePixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -49,15 +49,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = static_cast< TInternalType >( vcl_exp( -static_cast< double >( input ) ) ); } + { output = static_cast< TInternalType >( std::exp( -static_cast< double >( input ) ) ); } static inline TExternalType Get(const TInternalType & input) - { return static_cast< TExternalType >( vcl_exp( -static_cast< double >( input ) ) ); } + { return static_cast< TExternalType >( std::exp( -static_cast< double >( input ) ) ); } }; } // end namespace Accessor /** \class ExpNegativeImageAdaptor - * \brief Presents an image as being composed of the vcl_exp() of its pixels + * \brief Presents an image as being composed of the std::exp() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -187,10 +187,7 @@ virtual const RegionType & GetBufferedRegion() const; /** Allocate the image memory. Dimension and Size must be set a priori. */ - inline void Allocate() - { - m_Image->Allocate(); - } + virtual void Allocate(bool initialize = false) ITK_OVERRIDE; /** Restore the data object to its initial state. This means releasing * memory. */ @@ -316,8 +313,7 @@ virtual void SetRequestedRegionToLargestPossibleRegion(); - virtual void PropagateRequestedRegion() - throw ( InvalidRequestedRegionError ); + virtual void PropagateRequestedRegion(); virtual void UpdateOutputData(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkImageAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,6 +45,13 @@ ::~ImageAdaptor() {} +template< typename TImage, typename TAccessor > +void +ImageAdaptor< TImage, TAccessor > +::Allocate(bool initialize) +{ + m_Image->Allocate(initialize); +} //---------------------------------------------------------------------------- template< typename TImage, typename TAccessor > void @@ -185,7 +192,6 @@ void ImageAdaptor< TImage, TAccessor > ::PropagateRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' method first, then delegate Superclass::PropagateRequestedRegion(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLog10ImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLog10ImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLog10ImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLog10ImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class Log10PixelAccessor - * \brief Give access to the vcl_log10() function of a value + * \brief Give access to the std::log10() function of a value * * Log10PixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -50,15 +50,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_log10( (double)input ); } + { output = (TInternalType)std::log10( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_log10( (double)input ); } + { return (TExternalType)std::log10( (double)input ); } }; } // end namespace Accessor /** \class Log10ImageAdaptor - * \brief Presents an image as being composed of the vcl_log10() of its pixels + * \brief Presents an image as being composed of the std::log10() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLogImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLogImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLogImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkLogImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class LogPixelAccessor - * \brief Give access to the vcl_log() function of a value + * \brief Give access to the std::log() function of a value * * LogPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -50,15 +50,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_log( (double)input ); } + { output = (TInternalType)std::log( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_log( (double)input ); } + { return (TExternalType)std::log( (double)input ); } }; } // end namespace Accessor /** \class LogImageAdaptor - * \brief Presents an image as being composed of the vcl_log() of its pixels + * \brief Presents an image as being composed of the std::log() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSinImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSinImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSinImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSinImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class SinPixelAccessor - * \brief Give access to the vcl_sin() function of a value + * \brief Give access to the std::sin() function of a value * * SinPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -49,15 +49,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_sin( (double)input ); } + { output = (TInternalType)std::sin( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_sin( (double)input ); } + { return (TExternalType)std::sin( (double)input ); } }; } // end namespace Accessor /** \class SinImageAdaptor - * \brief Presents an image as being composed of the vcl_sin() of its pixels + * \brief Presents an image as being composed of the std::sin() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSqrtImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSqrtImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSqrtImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkSqrtImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class SqrtPixelAccessor - * \brief Give access to the vcl_sqrt() function of a value + * \brief Give access to the std::sqrt() function of a value * * SqrtPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -49,15 +49,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_sqrt( (double)input ); } + { output = (TInternalType)std::sqrt( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_sqrt( (double)input ); } + { return (TExternalType)std::sqrt( (double)input ); } }; } // end namespace Accessor /** \class SqrtImageAdaptor - * \brief Presents an image as being composed of the vcl_sqrt() of its pixels + * \brief Presents an image as being composed of the std::sqrt() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkTanImageAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkTanImageAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkTanImageAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageAdaptors/include/itkTanImageAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ namespace Accessor { /** \class TanPixelAccessor - * \brief Give access to the vcl_tan() function of a value + * \brief Give access to the std::tan() function of a value * * TanPixelAccessor is templated over an internal type and an * external type representation. This class cast the input @@ -49,15 +49,15 @@ typedef TInternalType InternalType; static inline void Set(TInternalType & output, const TExternalType & input) - { output = (TInternalType)vcl_tan( (double)input ); } + { output = (TInternalType)std::tan( (double)input ); } static inline TExternalType Get(const TInternalType & input) - { return (TExternalType)vcl_tan( (double)input ); } + { return (TExternalType)std::tan( (double)input ); } }; } // end namespace Accessor /** \class TanImageAdaptor - * \brief Presents an image as being composed of the vcl_tan() of its pixels + * \brief Presents an image as being composed of the std::tan() of its pixels * * Additional casting is performed according to the input and output image * types following C++ default casting rules. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineDecompositionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -140,7 +140,7 @@ { case 3: m_NumberOfPoles = 1; - m_SplinePoles[0] = vcl_sqrt(3.0) - 2.0; + m_SplinePoles[0] = std::sqrt(3.0) - 2.0; break; case 0: m_NumberOfPoles = 0; @@ -150,18 +150,18 @@ break; case 2: m_NumberOfPoles = 1; - m_SplinePoles[0] = vcl_sqrt(8.0) - 3.0; + m_SplinePoles[0] = std::sqrt(8.0) - 3.0; break; case 4: m_NumberOfPoles = 2; - m_SplinePoles[0] = vcl_sqrt( 664.0 - vcl_sqrt(438976.0) ) + vcl_sqrt(304.0) - 19.0; - m_SplinePoles[1] = vcl_sqrt( 664.0 + vcl_sqrt(438976.0) ) - vcl_sqrt(304.0) - 19.0; + m_SplinePoles[0] = std::sqrt( 664.0 - std::sqrt(438976.0) ) + std::sqrt(304.0) - 19.0; + m_SplinePoles[1] = std::sqrt( 664.0 + std::sqrt(438976.0) ) - std::sqrt(304.0) - 19.0; break; case 5: m_NumberOfPoles = 2; - m_SplinePoles[0] = vcl_sqrt( 135.0 / 2.0 - vcl_sqrt(17745.0 / 4.0) ) + vcl_sqrt(105.0 / 4.0) + m_SplinePoles[0] = std::sqrt( 135.0 / 2.0 - std::sqrt(17745.0 / 4.0) ) + std::sqrt(105.0 / 4.0) - 13.0 / 2.0; - m_SplinePoles[1] = vcl_sqrt( 135.0 / 2.0 + vcl_sqrt(17745.0 / 4.0) ) - vcl_sqrt(105.0 / 4.0) + m_SplinePoles[1] = std::sqrt( 135.0 / 2.0 + std::sqrt(17745.0 / 4.0) ) - std::sqrt(105.0 / 4.0) - 13.0 / 2.0; break; default: @@ -191,7 +191,7 @@ if ( m_Tolerance > 0.0 ) { horizon = (typename TInputImage::SizeValueType) - vcl_ceil( vcl_log(m_Tolerance) / vcl_log( vcl_fabs(z) ) ); + std::ceil( std::log(m_Tolerance) / std::log( std::fabs(z) ) ); } if ( horizon < m_DataLength[m_IteratorDirection] ) { @@ -208,7 +208,7 @@ { /* full loop */ iz = 1.0 / z; - z2n = vcl_pow( z, (double)( m_DataLength[m_IteratorDirection] - 1L ) ); + z2n = std::pow( z, (double)( m_DataLength[m_IteratorDirection] - 1L ) ); sum = m_Scratch[0] + z2n * m_Scratch[m_DataLength[m_IteratorDirection] - 1L]; z2n *= z2n * iz; for ( unsigned int n = 1; n <= ( m_DataLength[m_IteratorDirection] - 2 ); n++ ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -152,13 +152,13 @@ } virtual OutputType Evaluate(const PointType & point, - ThreadIdType threadID) const + ThreadIdType threadId) const { ContinuousIndexType index; this->GetInputImage()->TransformPhysicalPointToContinuousIndex(point, index); - return ( this->EvaluateAtContinuousIndex(index, threadID) ); + return ( this->EvaluateAtContinuousIndex(index, threadId) ); } virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & @@ -178,7 +178,7 @@ virtual OutputType EvaluateAtContinuousIndex(const ContinuousIndexType & index, - ThreadIdType threadID) const; + ThreadIdType threadId) const; CovariantVectorType EvaluateDerivative(const PointType & point) const { @@ -191,13 +191,13 @@ } CovariantVectorType EvaluateDerivative(const PointType & point, - ThreadIdType threadID) const + ThreadIdType threadId) const { ContinuousIndexType index; this->GetInputImage()->TransformPhysicalPointToContinuousIndex(point, index); - return ( this->EvaluateDerivativeAtContinuousIndex(index, threadID) ); + return ( this->EvaluateDerivativeAtContinuousIndex(index, threadId) ); } CovariantVectorType EvaluateDerivativeAtContinuousIndex( @@ -222,7 +222,7 @@ CovariantVectorType EvaluateDerivativeAtContinuousIndex( const ContinuousIndexType & x, - ThreadIdType threadID) const; + ThreadIdType threadId) const; void EvaluateValueAndDerivative(const PointType & point, OutputType & value, @@ -242,7 +242,7 @@ void EvaluateValueAndDerivative(const PointType & point, OutputType & value, CovariantVectorType & deriv, - ThreadIdType threadID) const + ThreadIdType threadId) const { ContinuousIndexType index; @@ -251,7 +251,7 @@ this->EvaluateValueAndDerivativeAtContinuousIndex(index, value, deriv, - threadID); + threadId); } void EvaluateValueAndDerivativeAtContinuousIndex( @@ -283,7 +283,7 @@ const ContinuousIndexType & x, OutputType & value, CovariantVectorType & deriv, - ThreadIdType threadID) const; + ThreadIdType threadId) const; /** Get/Sets the Spline Order, supports 0th - 5th order splines. The default * is a 3rd order spline. */ @@ -315,19 +315,19 @@ protected: /** The following methods take working space (evaluateIndex, weights, weightsDerivative) - * that is managed by the caller. If threadID is known, the working variables are looked - * up in the thread indexed arrays. If threadID is not known, working variables are made + * that is managed by the caller. If threadId is known, the working variables are looked + * up in the thread indexed arrays. If threadId is not known, working variables are made * on the stack and passed to these methods. The stack allocation should be ok since * these methods do not store the working variables, i.e. they are not expected to * be available beyond the scope of the function call. * * This was done to allow for two types of re-entrancy. The first is when a threaded * filter, e.g. InterpolateImagePointsFilter calls EvaluateAtContinuousIndex from multiple - * threads without passing a threadID. So, EvaluateAtContinuousIndex must be thread safe. + * threads without passing a threadId. So, EvaluateAtContinuousIndex must be thread safe. * This is handled with the stack-based allocation of the working space. * * The second form of re-entrancy involves methods that call EvaluateAtContinuousIndex - * from multiple threads, but pass a threadID. In this case, we can gain a little efficiency + * from multiple threads, but pass a threadId. In this case, we can gain a little efficiency * (hopefully) by looking up pre-allocated working space in arrays that are indexed by thread. * The efficiency gain is likely dependent on the size of the working variables, which are * in-turn dependent on the dimensionality of the image and the order of the spline. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkBSplineInterpolateImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,9 +47,9 @@ ::BSplineInterpolateImageFunction() { m_NumberOfThreads = 1; - m_ThreadedEvaluateIndex = NULL; - m_ThreadedWeights = NULL; - m_ThreadedWeightsDerivative = NULL; + m_ThreadedEvaluateIndex = ITK_NULLPTR; + m_ThreadedWeights = ITK_NULLPTR; + m_ThreadedWeightsDerivative = ITK_NULLPTR; m_CoefficientFilter = CoefficientFilter::New(); m_Coefficients = CoefficientImageType::New(); @@ -65,13 +65,13 @@ ::~BSplineInterpolateImageFunction() { delete[] m_ThreadedEvaluateIndex; - m_ThreadedEvaluateIndex = NULL; + m_ThreadedEvaluateIndex = ITK_NULLPTR; delete[] m_ThreadedWeights; - m_ThreadedWeights = NULL; + m_ThreadedWeights = ITK_NULLPTR; delete[] m_ThreadedWeightsDerivative; - m_ThreadedWeightsDerivative = NULL; + m_ThreadedWeightsDerivative = ITK_NULLPTR; } /** @@ -111,7 +111,7 @@ } else { - m_Coefficients = NULL; + m_Coefficients = ITK_NULLPTR; } } @@ -151,12 +151,12 @@ ::OutputType BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType > ::EvaluateAtContinuousIndex(const ContinuousIndexType & x, - ThreadIdType threadID) const + ThreadIdType threadId) const { // FIXME -- Review this "fix" and ensure it works. #if 1 - vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadID] ); - vnl_matrix< double > *weights = &( m_ThreadedWeights[threadID] ); + vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadId] ); + vnl_matrix< double > *weights = &( m_ThreadedWeights[threadId] ); // Pass evaluateIndex, weights by reference. Different threadIDs get // different instances. return this->EvaluateAtContinuousIndexInternal(x, *evaluateIndex, *weights); @@ -164,14 +164,14 @@ // FIXME - Should copy matrices to the stack for thread safety. // This method is being called by multiple threads through // EvaluateAtContinuousIndex( const ContinuousIndexType & x). - // When that method delegates here, it passes threadID = 0. + // When that method delegates here, it passes threadId = 0. // This causes problems because multiple threads end up writing // on the same matrices. // Other methods will probably be affected by the same issue. For // example EvaluateDerivativeAtContinuousIndex and // EvaluateValueAndDerivativeAtContinuousIndex. - vnl_matrix< long > evaluateIndex = ( m_ThreadedEvaluateIndex[threadID] ); - vnl_matrix< double > weights = ( m_ThreadedWeights[threadID] ); + vnl_matrix< long > evaluateIndex = ( m_ThreadedEvaluateIndex[threadId] ); + vnl_matrix< double > weights = ( m_ThreadedWeights[threadId] ); // compute the interpolation indexes this->DetermineRegionOfSupport( ( evaluateIndex ), x, m_SplineOrder ); @@ -208,14 +208,14 @@ ::CovariantVectorType BSplineInterpolateImageFunction< TImageType, TCoordRep, TCoefficientType > ::EvaluateDerivativeAtContinuousIndex(const ContinuousIndexType & x, - ThreadIdType threadID) const + ThreadIdType threadId) const { // FIXME -- Review this "fix" and ensure it works. #if 1 - vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadID] ); - vnl_matrix< double > *weights = &( m_ThreadedWeights[threadID] ); + vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadId] ); + vnl_matrix< double > *weights = &( m_ThreadedWeights[threadId] ); vnl_matrix< double > *weightsDerivative = - &( m_ThreadedWeightsDerivative[threadID] ); + &( m_ThreadedWeightsDerivative[threadId] ); return this->EvaluateDerivativeAtContinuousIndexInternal(x, *evaluateIndex, @@ -223,10 +223,10 @@ *weightsDerivative); #else - vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadID] ); - vnl_matrix< double > *weights = &( m_ThreadedWeights[threadID] ); + vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadId] ); + vnl_matrix< double > *weights = &( m_ThreadedWeights[threadId] ); vnl_matrix< double > *weightsDerivative = - &( m_ThreadedWeightsDerivative[threadID] ); + &( m_ThreadedWeightsDerivative[threadId] ); this->DetermineRegionOfSupport( ( *evaluateIndex ), x, m_SplineOrder ); @@ -290,14 +290,14 @@ ::EvaluateValueAndDerivativeAtContinuousIndex(const ContinuousIndexType & x, OutputType & value, CovariantVectorType & derivativeValue, - ThreadIdType threadID) const + ThreadIdType threadId) const { // FIXME -- Review this "fix" and ensure it works. #if 1 - vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadID] ); - vnl_matrix< double > *weights = &( m_ThreadedWeights[threadID] ); + vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadId] ); + vnl_matrix< double > *weights = &( m_ThreadedWeights[threadId] ); vnl_matrix< double > *weightsDerivative = - &( m_ThreadedWeightsDerivative[threadID] ); + &( m_ThreadedWeightsDerivative[threadId] ); this->EvaluateValueAndDerivativeAtContinuousIndexInternal(x, value, @@ -306,10 +306,10 @@ *weights, *weightsDerivative); #else - vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadID] ); - vnl_matrix< double > *weights = &( m_ThreadedWeights[threadID] ); + vnl_matrix< long > * evaluateIndex = &( m_ThreadedEvaluateIndex[threadId] ); + vnl_matrix< double > *weights = &( m_ThreadedWeights[threadId] ); vnl_matrix< double > *weightsDerivative = - &( m_ThreadedWeightsDerivative[threadID] ); + &( m_ThreadedWeightsDerivative[threadId] ); this->DetermineRegionOfSupport( ( *evaluateIndex ), x, m_SplineOrder ); @@ -667,7 +667,7 @@ const float halfOffset = splineOrder & 1 ? 0.0 : 0.5; for ( unsigned int n = 0; n < ImageDimension; n++ ) { - long indx = (long)vcl_floor( (float)x[n] + halfOffset ) - splineOrder / 2; + long indx = (long)std::floor( (float)x[n] + halfOffset ) - splineOrder / 2; for ( unsigned int k = 0; k <= splineOrder; k++ ) { evaluateIndex[n][k] = indx++; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkCentralDifferenceImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -54,7 +54,7 @@ // Verify the output vector is the right size. // OutputType of VariablelengthVector will have size 0 until allocated, so this // case can't be tested. - if( inputData != NULL ) + if( inputData != ITK_NULLPTR ) { SizeValueType nComponents = OutputConvertType::GetNumberOfComponents(); if( nComponents > 0 ) @@ -81,7 +81,7 @@ if ( interpolator != this->m_Interpolator ) { this->m_Interpolator = interpolator; - if( this->GetInputImage() != NULL ) + if( this->GetInputImage() != ITK_NULLPTR ) { this->m_Interpolator->SetInputImage( this->GetInputImage() ); } @@ -286,7 +286,6 @@ { typedef typename PointType::ValueType PointValueType; typedef typename OutputType::ValueType DerivativeValueType; - typedef typename ContinuousIndexType::ValueType ContinuousIndexValueType; PointType neighPoint1 = point; PointType neighPoint2 = point; @@ -354,8 +353,6 @@ ::EvaluateSpecialized(const PointType & point, OutputType & derivative, OutputTypeSpecializationStructType) const { typedef typename PointType::ValueType PointValueType; - typedef typename OutputType::ValueType DerivativeValueType; - typedef typename ContinuousIndexType::ValueType ContinuousIndexValueType; const InputImageType *inputImage = this->GetInputImage(); const unsigned int numberComponents = inputImage->GetNumberOfComponentsPerPixel(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianBlurImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianBlurImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianBlurImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianBlurImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -222,8 +222,7 @@ typename InternalImageType::RegionType region; region.SetSize(size); m_InternalImage->SetRegions(region); - m_InternalImage->Allocate(); - m_InternalImage->FillBuffer(0); + m_InternalImage->Allocate(true); // initialize buffer to zero } /** Evaluate the function at the specifed point */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianDerivativeImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianDerivativeImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianDerivativeImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianDerivativeImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -284,7 +284,8 @@ for ( unsigned int ii = 0; ii < itkGetStaticConstMacro(ImageDimension2); ++ii ) { // Apply each gaussian kernel to a subset of the image - InputPixelType value = static_cast< double >( this->GetInputImage()->GetPixel(index) ); + typedef typename OutputType::RealValueType OutputRealValueType; + OutputRealValueType value = static_cast< OutputRealValueType >( this->GetInputImage()->GetPixel(index) ); // gaussian blurring first for ( unsigned int direction = 0; direction < itkGetStaticConstMacro(ImageDimension2); ++direction ) @@ -308,7 +309,7 @@ m_OperatorImageFunction->SetOperator(m_OperatorArray[idx]); value = m_OperatorImageFunction->EvaluateAtIndex(index) + centerval * value; - gradient[ii] = value; + gradient[ii] = static_cast< typename OutputType::ComponentType >( value ); } return gradient; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -150,7 +150,7 @@ virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & cindex ) const { - return this->EvaluateAtContinuousIndex( cindex, NULL ); + return this->EvaluateAtContinuousIndex( cindex, ITK_NULLPTR ); } protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -111,9 +111,9 @@ { int boundingBoxSize = static_cast( this->m_BoundingBoxEnd[d] - this->m_BoundingBoxStart[d] + 0.5 ); - int begin = vnl_math_max( 0, static_cast( vcl_floor( cindex[d] - + int begin = vnl_math_max( 0, static_cast( std::floor( cindex[d] - this->m_BoundingBoxStart[d] - this->m_CutoffDistance[d] ) ) ); - int end = vnl_math_min( boundingBoxSize, static_cast( vcl_ceil( + int end = vnl_math_min( boundingBoxSize, static_cast( std::ceil( cindex[d] - this->m_BoundingBoxStart[d] + this->m_CutoffDistance[d] ) ) ); region.SetIndex( d, begin ); region.SetSize( d, end - begin ); @@ -189,10 +189,10 @@ int boundingBoxSize = static_cast( this->m_BoundingBoxEnd[dimension] - this->m_BoundingBoxStart[dimension] + 0.5 ); - int begin = vnl_math_max( 0, static_cast( vcl_floor( cindex - + int begin = vnl_math_max( 0, static_cast( std::floor( cindex - this->m_BoundingBoxStart[dimension] - this->m_CutoffDistance[dimension] ) ) ); - int end = vnl_math_min( boundingBoxSize, static_cast( vcl_ceil( cindex - + int end = vnl_math_min( boundingBoxSize, static_cast( std::ceil( cindex - this->m_BoundingBoxStart[dimension] + this->m_CutoffDistance[dimension] ) ) ); @@ -206,7 +206,7 @@ RealType g_last = 0.0; if( evaluateGradient ) { - g_last = vnl_math::two_over_sqrtpi * vcl_exp( -vnl_math_sqr( t ) ); + g_last = vnl_math::two_over_sqrtpi * std::exp( -vnl_math_sqr( t ) ); } for( int i = begin; i < end; i++ ) @@ -216,7 +216,7 @@ erfArray[i] = e_now - e_last; if( evaluateGradient ) { - RealType g_now = vnl_math::two_over_sqrtpi * vcl_exp( -vnl_math_sqr( t ) ); + RealType g_now = vnl_math::two_over_sqrtpi * std::exp( -vnl_math_sqr( t ) ); gerfArray[i] = g_now - g_last; g_last = g_now; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ ImageFunction< TInputImage, TOutput, TCoordRep > ::ImageFunction() { - m_Image = NULL; + m_Image = ITK_NULLPTR; m_StartIndex.Fill(0); m_EndIndex.Fill(0); m_StartContinuousIndex.Fill(0.0f); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -104,7 +104,7 @@ virtual OutputType EvaluateAtContinuousIndex( const ContinuousIndexType & cindex ) const { - return this->EvaluateAtContinuousIndex( cindex, NULL ); + return this->EvaluateAtContinuousIndex( cindex, ITK_NULLPTR ); } protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLabelImageGaussianInterpolateImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -57,9 +57,9 @@ { const int boundingBoxSize = static_cast( this->m_BoundingBoxEnd[d] - this->m_BoundingBoxStart[d] + 0.5 ); - const int begin = vnl_math_max( 0, static_cast( vcl_floor( cindex[d] - + const int begin = vnl_math_max( 0, static_cast( std::floor( cindex[d] - this->m_BoundingBoxStart[d] - this->m_CutoffDistance[d] ) ) ); - const int end = vnl_math_min( boundingBoxSize, static_cast( vcl_ceil( + const int end = vnl_math_min( boundingBoxSize, static_cast( std::ceil( cindex[d] - this->m_BoundingBoxStart[d] + this->m_CutoffDistance[d] ) ) ); region.SetIndex( d, begin ); region.SetSize( d, end - begin ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -19,6 +19,7 @@ #define __itkLinearInterpolateImageFunction_h #include "itkInterpolateImageFunction.h" +#include "itkVariableLengthVector.h" namespace itk { @@ -495,6 +496,32 @@ virtual inline OutputType EvaluateUnoptimized( const ContinuousIndexType & index) const; + + /** \brief A method to generically set all components to zero + */ + template + void + MakeZeroInitializer(const TInputImage * const inputImagePtr, + VariableLengthVector & tempZeros) const + { + // Variable length vector version to get the size of the pixel correct. + typename TInputImage::IndexType idx; + idx.Fill(0); + const typename TInputImage::PixelType & tempPixel = inputImagePtr->GetPixel(idx); + const unsigned int sizeOfVarLengthVector = tempPixel.GetSize(); + tempZeros.SetSize(sizeOfVarLengthVector); + tempZeros.Fill(NumericTraits< RealTypeScalarRealType >::ZeroValue()); + } + + template + void + MakeZeroInitializer(const TInputImage * const itkNotUsed( inputImagePtr ), + RealTypeScalarRealType & tempZeros) const + { + // All other cases + tempZeros = NumericTraits< RealTypeScalarRealType >::ZeroValue(); + } + }; } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkLinearInterpolateImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,6 +18,7 @@ #ifndef __itkLinearInterpolateImageFunction_hxx #define __itkLinearInterpolateImageFunction_hxx +#include "itkConceptChecking.h" #include "itkLinearInterpolateImageFunction.h" #include "vnl/vnl_math.h" @@ -56,6 +57,7 @@ this->Superclass::PrintSelf(os, indent); } + /** * Evaluate at image index position */ @@ -65,16 +67,16 @@ LinearInterpolateImageFunction< TInputImage, TCoordRep > ::EvaluateUnoptimized(const ContinuousIndexType & index) const { - unsigned int dim; // index over dimension - + // Avoid the smartpointer de-reference in the loop for + // "return m_InputImage.GetPointer()" + const TInputImage * const inputImagePtr = this->GetInputImage(); /** * Compute base index = closet index below point * Compute distance from point to base index */ IndexType baseIndex; InternalComputationType distance[ImageDimension]; - - for ( dim = 0; dim < ImageDimension; dim++ ) + for ( unsigned int dim = 0; dim < ImageDimension; ++dim ) { baseIndex[dim] = Math::Floor< IndexValueType >(index[dim]); distance[dim] = index[dim] - static_cast< InternalComputationType >( baseIndex[dim] ); @@ -87,26 +89,28 @@ */ // When RealType is VariableLengthVector, 'value' will be resized properly // below when it's assigned again. - typedef typename NumericTraits< RealType >::ScalarRealType RealTypeScalarRealType; + Concept::Detail::UniqueType< typename NumericTraits< RealType >::ScalarRealType >(); + RealType value; - value = NumericTraits< RealTypeScalarRealType >::Zero; + // Initialize variable "value" with overloaded function so that + // in the case of variable length vectors the "value" is initialized + // to all zeros of length equal to the InputImagePtr first pixel length. + this->MakeZeroInitializer( inputImagePtr, value ); - typedef typename NumericTraits< InputPixelType >::ScalarRealType InputPixelScalarRealType; - InputPixelScalarRealType totalOverlap = NumericTraits< InputPixelScalarRealType >::Zero; - bool firstOverlap = true; + Concept::Detail::UniqueType< typename NumericTraits< InputPixelType >::ScalarRealType >(); for ( unsigned int counter = 0; counter < m_Neighbors; ++counter ) { - InternalComputationType overlap = 1.0; // fraction overlap + InternalComputationType overlap = 1.0; // fraction overlap unsigned int upper = counter; // each bit indicates upper/lower neighbour - IndexType neighIndex; + IndexType neighIndex( baseIndex ); // get neighbor index and overlap fraction - for ( dim = 0; dim < ImageDimension; dim++ ) + for ( unsigned int dim = 0; dim < ImageDimension; ++dim ) { if ( upper & 1 ) { - neighIndex[dim] = baseIndex[dim] + 1; + ++(neighIndex[dim]); // Take care of the case where the pixel is just // in the outer upper boundary of the image grid. if ( neighIndex[dim] > this->m_EndIndex[dim] ) @@ -117,7 +121,6 @@ } else { - neighIndex[dim] = baseIndex[dim]; // Take care of the case where the pixel is just // in the outer lower boundary of the image grid. if ( neighIndex[dim] < this->m_StartIndex[dim] ) @@ -129,32 +132,7 @@ upper >>= 1; } - - // Update output value only if overlap is not zero. - // Overlap can be 0 when one or more index dims is an integer. - // There will always be at least one iteration of 'counter' loop - // that has overlap > 0, even if index is out of bounds. - if ( overlap ) - { - if( firstOverlap ) - { - // Performing the first assignment of value like this allows - // VariableLengthVector type to be resized properly. - value = static_cast< RealType >( this->GetInputImage()->GetPixel(neighIndex) ) * overlap; - firstOverlap = false; - } - else - { - value += static_cast< RealType >( this->GetInputImage()->GetPixel(neighIndex) ) * overlap; - } - totalOverlap += overlap; - } - - if ( totalOverlap == 1.0 ) - { - // finished - break; - } + value += static_cast< RealType >( inputImagePtr->GetPixel(neighIndex) ) * overlap; } return ( static_cast< OutputType >( value ) ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkMahalanobisDistanceThresholdImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkMahalanobisDistanceThresholdImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkMahalanobisDistanceThresholdImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkMahalanobisDistanceThresholdImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -143,14 +143,14 @@ // Deal with cases that are barely negative. // In theory they should never appear, but // they may happen and would produce NaNs - // in the vcl_sqrt + // in the std::sqrt if ( mahalanobisDistanceSquared < 0.0 ) { mahalanobisDistance = 0.0; } else { - mahalanobisDistance = vcl_sqrt(mahalanobisDistanceSquared); + mahalanobisDistance = std::sqrt(mahalanobisDistanceSquared); } return mahalanobisDistance; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkRayCastInterpolateImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -107,7 +107,7 @@ if ( m_ValidRay ) { - return vcl_sqrt(m_VoxelIncrement[0] * spacing[0] * m_VoxelIncrement[0] * spacing[0] + return std::sqrt(m_VoxelIncrement[0] * spacing[0] * m_VoxelIncrement[0] * spacing[0] + m_VoxelIncrement[1] * spacing[1] * m_VoxelIncrement[1] * spacing[1] + m_VoxelIncrement[2] * spacing[2] * m_VoxelIncrement[2] * spacing[2]); } @@ -432,10 +432,10 @@ + C * m_BoundingCorner[c1][2] ); // initialise plane value and normalise - m_BoundingPlane[j][0] = A / vcl_sqrt(A * A + B * B + C * C); - m_BoundingPlane[j][1] = B / vcl_sqrt(A * A + B * B + C * C); - m_BoundingPlane[j][2] = C / vcl_sqrt(A * A + B * B + C * C); - m_BoundingPlane[j][3] = D / vcl_sqrt(A * A + B * B + C * C); + m_BoundingPlane[j][0] = A / std::sqrt(A * A + B * B + C * C); + m_BoundingPlane[j][1] = B / std::sqrt(A * A + B * B + C * C); + m_BoundingPlane[j][2] = C / std::sqrt(A * A + B * B + C * C); + m_BoundingPlane[j][3] = D / std::sqrt(A * A + B * B + C * C); if ( ( A * A + B * B + C * C ) == 0 ) { @@ -765,9 +765,9 @@ // Calculate the number of voxels in each direction - xNum = vcl_fabs(m_RayVoxelStartPosition[0] - m_RayVoxelEndPosition[0]); - yNum = vcl_fabs(m_RayVoxelStartPosition[1] - m_RayVoxelEndPosition[1]); - zNum = vcl_fabs(m_RayVoxelStartPosition[2] - m_RayVoxelEndPosition[2]); + xNum = std::fabs(m_RayVoxelStartPosition[0] - m_RayVoxelEndPosition[0]); + yNum = std::fabs(m_RayVoxelStartPosition[1] - m_RayVoxelEndPosition[1]); + zNum = std::fabs(m_RayVoxelStartPosition[2] - m_RayVoxelEndPosition[2]); // The direction iterated in is that with the greatest number of voxels // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -972,9 +972,9 @@ startOK = false; endOK = false; - Istart[0] = (int)vcl_floor(m_RayVoxelStartPosition[0]); - Istart[1] = (int)vcl_floor(m_RayVoxelStartPosition[1]); - Istart[2] = (int)vcl_floor(m_RayVoxelStartPosition[2]); + Istart[0] = (int)std::floor(m_RayVoxelStartPosition[0]); + Istart[1] = (int)std::floor(m_RayVoxelStartPosition[1]); + Istart[2] = (int)std::floor(m_RayVoxelStartPosition[2]); if ( ( Istart[0] >= 0 ) && ( Istart[0] + Idirn[0] < m_NumberOfVoxelsInX ) && ( Istart[1] >= 0 ) && ( Istart[1] + Idirn[1] < m_NumberOfVoxelsInY ) @@ -991,13 +991,13 @@ m_TotalRayVoxelPlanes--; } - Istart[0] = (int)vcl_floor(m_RayVoxelStartPosition[0] + Istart[0] = (int)std::floor(m_RayVoxelStartPosition[0] + m_TotalRayVoxelPlanes * m_VoxelIncrement[0]); - Istart[1] = (int)vcl_floor(m_RayVoxelStartPosition[1] + Istart[1] = (int)std::floor(m_RayVoxelStartPosition[1] + m_TotalRayVoxelPlanes * m_VoxelIncrement[1]); - Istart[2] = (int)vcl_floor(m_RayVoxelStartPosition[2] + Istart[2] = (int)std::floor(m_RayVoxelStartPosition[2] + m_TotalRayVoxelPlanes * m_VoxelIncrement[2]); if ( ( Istart[0] >= 0 ) && ( Istart[0] + Idirn[0] < m_NumberOfVoxelsInX ) @@ -1062,7 +1062,7 @@ for ( i = 0; i < 4; i++ ) { - m_RayIntersectionVoxels[i] = 0; + m_RayIntersectionVoxels[i] = ITK_NULLPTR; } for ( i = 0; i < 3; i++ ) { @@ -1121,7 +1121,7 @@ m_RayIntersectionVoxels[0] = m_RayIntersectionVoxels[1] = m_RayIntersectionVoxels[2] = - m_RayIntersectionVoxels[3] = NULL; + m_RayIntersectionVoxels[3] = ITK_NULLPTR; } break; } @@ -1153,7 +1153,7 @@ m_RayIntersectionVoxels[0] = m_RayIntersectionVoxels[1] = m_RayIntersectionVoxels[2] = - m_RayIntersectionVoxels[3] = NULL; + m_RayIntersectionVoxels[3] = ITK_NULLPTR; } break; } @@ -1185,7 +1185,7 @@ m_RayIntersectionVoxels[0] = m_RayIntersectionVoxels[1] = m_RayIntersectionVoxels[2] = - m_RayIntersectionVoxels[3] = NULL; + m_RayIntersectionVoxels[3] = ITK_NULLPTR; } break; } @@ -1261,20 +1261,20 @@ { case TRANSVERSE_IN_X: { - y = m_Position3Dvox[1].GetSum() - vcl_floor(m_Position3Dvox[1].GetSum()); - z = m_Position3Dvox[2].GetSum() - vcl_floor(m_Position3Dvox[2].GetSum()); + y = m_Position3Dvox[1].GetSum() - std::floor(m_Position3Dvox[1].GetSum()); + z = m_Position3Dvox[2].GetSum() - std::floor(m_Position3Dvox[2].GetSum()); break; } case TRANSVERSE_IN_Y: { - y = m_Position3Dvox[0].GetSum() - vcl_floor(m_Position3Dvox[0].GetSum()); - z = m_Position3Dvox[2].GetSum() - vcl_floor(m_Position3Dvox[2].GetSum()); + y = m_Position3Dvox[0].GetSum() - std::floor(m_Position3Dvox[0].GetSum()); + z = m_Position3Dvox[2].GetSum() - std::floor(m_Position3Dvox[2].GetSum()); break; } case TRANSVERSE_IN_Z: { - y = m_Position3Dvox[0].GetSum() - vcl_floor(m_Position3Dvox[0].GetSum()); - z = m_Position3Dvox[1].GetSum() - vcl_floor(m_Position3Dvox[1].GetSum()); + y = m_Position3Dvox[0].GetSum() - std::floor(m_Position3Dvox[0].GetSum()); + z = m_Position3Dvox[1].GetSum() - std::floor(m_Position3Dvox[1].GetSum()); break; } default: @@ -1284,7 +1284,6 @@ err.SetDescription("The ray traversal direction is unset " "- GetCurrentIntensity()."); throw err; - return 0; } } @@ -1386,7 +1385,7 @@ for ( i = 0; i < 4; i++ ) { - m_RayIntersectionVoxels[i] = 0; + m_RayIntersectionVoxels[i] = ITK_NULLPTR; } for ( i = 0; i < 3; i++ ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,7 @@ { public: inline TOutput operator()(const TInput & A) const - { return (TOutput)vcl_cos(A * m_Factor); } + { return (TOutput)std::cos(A * m_Factor); } private: /** Equal to \f$ \frac{\pi}{2 m} \f$ */ @@ -59,7 +59,7 @@ { public: inline TOutput operator()(const TInput & A) const - { return (TOutput)0.54 + 0.46 * vcl_cos(A * m_Factor); } + { return (TOutput)0.54 + 0.46 * std::cos(A * m_Factor); } private: /** Equal to \f$ \frac{\pi}{m} \f$ */ @@ -104,7 +104,7 @@ { if ( A == 0.0 ) { return (TOutput)1.0; } double z = m_Factor * A; - return (TOutput)( vcl_sin(z) / z ); + return (TOutput)( std::sin(z) / z ); } private: @@ -127,7 +127,7 @@ inline TOutput operator()(const TInput & A) const { return (TOutput) - ( 0.42 + 0.5 * vcl_cos(A * m_Factor1) + 0.08 * vcl_cos(A * m_Factor2) ); + ( 0.42 + 0.5 * std::cos(A * m_Factor1) + 0.08 * std::cos(A * m_Factor2) ); } private: @@ -341,7 +341,7 @@ { double px = vnl_math::pi * x; - return ( x == 0.0 ) ? 1.0 : vcl_sin(px) / px; + return ( x == 0.0 ) ? 1.0 : std::sin(px) / px; } }; } // namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -123,7 +123,7 @@ // Call the parent implementation Superclass::SetInputImage(image); - if ( image == NULL ) + if ( image == ITK_NULLPTR ) { return; } @@ -239,7 +239,7 @@ { // Increment the offset, taking it through the range // (dist + rad - 1, ..., dist - rad), i.e. all x - // such that vcl_abs(x) <= rad + // such that std::abs(x) <= rad x -= 1.0; // Compute the weight for this m diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,40 +26,45 @@ { template< typename TInputImage, typename TOutputMesh > BinaryMask3DMeshSource< TInputImage, TOutputMesh > -::BinaryMask3DMeshSource() +::BinaryMask3DMeshSource() : + m_RegionOfInterestProvidedByUser(false), + m_LastRow(ITK_NULLPTR), + m_LastFrame(ITK_NULLPTR), + m_CurrentRow(ITK_NULLPTR), + m_CurrentFrame(ITK_NULLPTR), + m_CurrentRowIndex(0), + m_CurrentFrameIndex(0), + m_LastRowNum(0), + m_LastFrameNum(0), + m_CurrentRowNum(200), + m_CurrentFrameNum(2000), + m_NumberOfNodes(0), + m_NumberOfCells(0), + m_NodeLimit(2000), + m_CellLimit(4000), + m_ImageWidth(0), + m_ImageHeight(0), + m_ImageDepth(0), + m_ColFlag(0), + m_RowFlag(0), + m_FrameFlag(0), + m_LastRowIndex(0), + m_LastVoxelIndex(0), + m_LastFrameIndex(0), + m_PointFound(0), + m_ObjectValue(NumericTraits< InputPixelType >::One), + m_OutputMesh(ITK_NULLPTR), + m_InputImage(ITK_NULLPTR) { // Modify superclass default values, can be overridden by subclasses this->SetNumberOfRequiredInputs(1); - m_RegionOfInterestProvidedByUser = false; - SizeType size; size.Fill( 0 ); m_RegionOfInterest.SetSize(size); - m_NumberOfCells = 0; - m_NumberOfNodes = 0; - - m_NodeLimit = 2000; - m_CellLimit = 4000; - m_LastRowIndex = 0; - m_LastVoxelIndex = 0; - m_LastFrameIndex = 0; - m_CurrentRowIndex = 0; - m_CurrentFrameIndex = 0; - m_CurrentFrame = 0; - m_CurrentRow = 0; - m_LastRow = 0; - m_LastRowNum = 0; - m_LastFrameNum = 0; - m_LastFrame = 0; - m_CurrentRowNum = 200; - m_CurrentFrameNum = 2000; this->GetOutput()->GetPoints()->Reserve(m_NodeLimit); this->GetOutput()->GetCells()->Reserve(m_CellLimit); - m_OutputMesh = 0; - m_InputImage = 0; - m_ObjectValue = NumericTraits< InputPixelType >::One; } template< typename TInputImage, typename TOutputMesh > @@ -1055,12 +1060,12 @@ m_LastFrameIndex = 0; m_CurrentRowIndex = 0; m_CurrentFrameIndex = 0; - m_CurrentFrame = 0; - m_CurrentRow = 0; - m_LastRow = 0; + m_CurrentFrame = ITK_NULLPTR; + m_CurrentRow = ITK_NULLPTR; + m_LastRow = ITK_NULLPTR; m_LastRowNum = 0; m_LastFrameNum = 0; - m_LastFrame = 0; + m_LastFrame = ITK_NULLPTR; m_CurrentRowNum = 200; m_CurrentFrameNum = 2000; m_OutputMesh = this->GetOutput(); @@ -1294,7 +1299,7 @@ free (m_LastRow[i]); } free (m_LastRow); - m_LastRow = NULL; + m_LastRow = ITK_NULLPTR; } m_LastRowNum = 0; } @@ -1341,7 +1346,7 @@ free (m_LastFrame[i]); } free (m_LastFrame); - m_LastFrame = 0; + m_LastFrame = ITK_NULLPTR; } } @@ -2578,7 +2583,7 @@ if ( ( end - start ) > 1 ) { - mid = static_cast< int >( vcl_floor( static_cast< float >( ( start + end ) / 2 ) ) ); + mid = static_cast< int >( std::floor( static_cast< float >( ( start + end ) / 2 ) ) ); if ( lindex == m_LastRow[mid][0] ) { m_PointFound = 1; @@ -2623,7 +2628,7 @@ if ( ( end - start ) > 1 ) { - mid = static_cast< int >( vcl_floor( static_cast< float >( ( start + end ) / 2 ) ) ); + mid = static_cast< int >( std::floor( static_cast< float >( ( start + end ) / 2 ) ) ); if ( lindex == m_LastFrame[mid][0] ) { m_PointFound = 1; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkConnectedRegionsMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,9 +41,13 @@ */ template< typename TInputMesh, typename TOutputMesh > ConnectedRegionsMeshFilter< TInputMesh, TOutputMesh > -::ConnectedRegionsMeshFilter() +::ConnectedRegionsMeshFilter() : + m_ExtractionMode(Self::LargestRegion), + m_NumberOfCellsInRegion(NumericTraits< SizeValueType >::Zero), + m_RegionNumber(NumericTraits< IdentifierType >::Zero), + m_Wave(ITK_NULLPTR), + m_Wave2(ITK_NULLPTR) { - m_ExtractionMode = Self::LargestRegion; m_ClosestPoint.Fill(0); } @@ -287,7 +291,7 @@ delete m_Wave; delete m_Wave2; - m_Wave = m_Wave2 = 0; + m_Wave = m_Wave2 = ITK_NULLPTR; itkDebugMacro (<< "Extracted " << m_RegionNumber << " region(s)"); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkInteriorExteriorMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkInteriorExteriorMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkInteriorExteriorMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkInteriorExteriorMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,16 +59,12 @@ ::GenerateData(void) { typedef typename TInputMesh::PointsContainer InputPointsContainer; - typedef typename TOutputMesh::PointsContainer OutputPointsContainer; typedef typename TInputMesh::PointsContainerConstPointer InputPointsContainerConstPointer; - typedef typename TOutputMesh::PointsContainerPointer OutputPointsContainerPointer; typedef typename TInputMesh::PointDataContainer InputPointDataContainer; - typedef typename TOutputMesh::PointDataContainer OutputPointDataContainer; typedef typename TInputMesh::PointDataContainerConstPointer InputPointDataContainerConstPointer; - typedef typename TOutputMesh::PointDataContainerPointer OutputPointDataContainerPointer; const InputMeshType *inputMesh = this->GetInput(); OutputMeshPointer outputMesh = this->GetOutput(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkMesh.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkMesh.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkMesh.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkMesh.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ os << indent << "Number Of Cells: " << ( ( m_CellsContainer ) ? m_CellsContainer->Size() : 0 ) << std::endl; os << indent << "Cell Data Container pointer: " - << ( ( m_CellDataContainer ) ? m_CellDataContainer.GetPointer() : 0 ) << std::endl; + << ( ( m_CellDataContainer ) ? m_CellDataContainer.GetPointer() : ITK_NULLPTR ) << std::endl; os << indent << "Size of Cell Data Container: " << ( ( m_CellDataContainer ) ? m_CellDataContainer->Size() : 0 ) << std::endl; os << indent << "Number of explicit cell boundary assignments: " @@ -280,7 +280,7 @@ /** * Ask the container if the cell identifier exists. */ - CellType * cellptr = 0; + CellType * cellptr = ITK_NULLPTR; const bool found = m_CellsContainer->GetElementIfIndexExists(cellId, &cellptr); if ( found ) { @@ -514,9 +514,9 @@ this->ReleaseCellsMemory(); - m_CellsContainer = 0; - m_CellDataContainer = 0; - m_CellLinksContainer = 0; + m_CellsContainer = ITK_NULLPTR; + m_CellDataContainer = ITK_NULLPTR; + m_CellLinksContainer = ITK_NULLPTR; } /** @@ -613,7 +613,7 @@ * and put them in the output set except for the cell through which the * request was made. First we empty the output set. */ - if ( cellSet != 0 ) + if ( cellSet != ITK_NULLPTR ) { cellSet->erase( cellSet->begin(), cellSet->end() ); @@ -720,7 +720,7 @@ */ currentCells->erase(cellId); CellIdentifier numberOfNeighboringCells = currentCells->size(); - if ( cellSet != 0 ) + if ( cellSet != ITK_NULLPTR ) { *cellSet = *currentCells; } @@ -783,7 +783,7 @@ * Loop through UsingCells and put them in the output set. First * we empty the output set. */ - if ( cellSet != 0 ) + if ( cellSet != ITK_NULLPTR ) { cellSet->erase( cellSet->begin(), cellSet->end() ); @@ -869,7 +869,7 @@ * this set to the output cell set. */ CellIdentifier numberOfNeighboringCells = currentCells->size(); - if ( cellSet != 0 ) + if ( cellSet != ITK_NULLPTR ) { *cellSet = *currentCells; } @@ -911,7 +911,7 @@ if ( m_BoundaryAssignmentsContainers[dimension]-> GetElementIfIndexExists(assignId, &boundaryId) ) { - CellType * boundaryptr = 0; + CellType * boundaryptr = ITK_NULLPTR; const bool found = m_CellsContainer-> GetElementIfIndexExists(boundaryId, &boundaryptr); if ( found ) @@ -1138,19 +1138,7 @@ { this->Superclass::CopyInformation(data); - const Self *mesh = NULL; - - try - { - mesh = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // mesh could not be cast back down - itkExceptionMacro( << "itk::Mesh::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *mesh = dynamic_cast< const Self * >( data ); if ( !mesh ) { @@ -1170,19 +1158,7 @@ { this->Superclass::Graft(data); - const Self *mesh = NULL; - - try - { - mesh = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // mesh could not be cast back down - itkExceptionMacro( << "itk::Mesh::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *mesh = dynamic_cast< const Self * >( data ); if ( !mesh ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshRegion.h otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshRegion.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshRegion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshRegion.h 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ virtual ~MeshRegion(); /** Return the region type. Meshes are described with unstructured regions. */ - virtual RegionType GetRegionType() const + virtual RegionType GetRegionType() const ITK_OVERRIDE { return Superclass::ITK_UNSTRUCTURED_REGION; } /** Get the number of regions. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshSource.h otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshSource.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshSource.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkMeshSource.h 2014-09-03 08:29:34.000000000 +0000 @@ -139,17 +139,17 @@ * an implementation of MakeOutput(). */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; protected: MeshSource(); virtual ~MeshSource() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Requested region of Mesh is specified as i of N unstructured regions. * Since all DataObjects should be able to set the requested region in * unstructured form, just copy output->RequestedRegion all inputs. */ - void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; private: MeshSource(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkParametricSpaceToImageSpaceMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkParametricSpaceToImageSpaceMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkParametricSpaceToImageSpaceMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkParametricSpaceToImageSpaceMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,13 +56,11 @@ typedef typename TInputMesh::PointsContainer InputPointsContainer; typedef typename TOutputMesh::PointsContainer OutputPointsContainer; - typedef typename TInputMesh::PointsContainerPointer InputPointsContainerPointer; typedef typename TOutputMesh::PointsContainerPointer OutputPointsContainerPointer; typedef typename TInputMesh::PointDataContainer InputPointDataContainer; typedef typename TOutputMesh::PointDataContainer OutputPointDataContainer; - typedef typename TInputMesh::PointDataContainerPointer InputPointDataContainerPointer; typedef typename TOutputMesh::PointDataContainerPointer OutputPointDataContainerPointer; const InputMeshType *inputMesh = this->GetInput(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkRegularSphereMeshSource.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkRegularSphereMeshSource.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkRegularSphereMeshSource.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkRegularSphereMeshSource.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -299,7 +299,7 @@ // set output outputMesh->Graft(result); - result->SetCells(NULL); + result->SetCells(ITK_NULLPTR); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.h otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -134,11 +134,11 @@ double meanCurvature = 0; PointIdentifier refPoint = *it; double val = mesh->GetMeanCurvature(*it++); - meanCurvature += vcl_abs(val); + meanCurvature += std::abs(val); PointIdentifier id1 = *it; val = mesh->GetMeanCurvature(*it++); - meanCurvature += vcl_abs(val); + meanCurvature += std::abs(val); PointIdentifier id2; @@ -152,7 +152,7 @@ area += ComputeArea(refPoint, id1, id2); id1 = id2; val = mesh->GetMeanCurvature(*it); - meanCurvature += vcl_abs(val); + meanCurvature += std::abs(val); cnt++; it++; } @@ -181,7 +181,7 @@ mesh->GetPoint(p1, &v1); mesh->GetPoint(p2, &v2); mesh->GetPoint(p3, &v3); - return vcl_abs (itk_cross_3d( ( v2 - v1 ).GetVnlVector(), ( v3 - v1 ).GetVnlVector() ).two_norm() / 2.0); + return std::abs (itk_cross_3d( ( v2 - v1 ).GetVnlVector(), ( v3 - v1 ).GetVnlVector() ).two_norm() / 2.0); } typename DoubleValueMapType::Pointer GetAreaMap() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshAdaptTopologyFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,14 +33,15 @@ namespace itk { template< typename TInputMesh, typename TOutputMesh > -SimplexMeshAdaptTopologyFilter< TInputMesh, TOutputMesh >::SimplexMeshAdaptTopologyFilter() +SimplexMeshAdaptTopologyFilter< TInputMesh, TOutputMesh >::SimplexMeshAdaptTopologyFilter() : + m_IdOffset(0), + m_Threshold(0.5), + m_SelectionMethod(0), + m_ModifiedCount(0), + m_Output(TOutputMesh::New()) { - m_Output = TOutputMesh::New(); this->ProcessObject::SetNumberOfRequiredOutputs(1); this->ProcessObject::SetNthOutput( 0, m_Output.GetPointer() ); - m_ModifiedCount = 0; - m_SelectionMethod = 0; - m_Threshold = 0.5; } template< typename TInputMesh, typename TOutputMesh > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.h otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.h 2014-09-03 08:29:34.000000000 +0000 @@ -170,7 +170,7 @@ /** * Get all neighbor points with a specified radius */ - NeighborListType * GetNeighbors(PointIdentifier pointId, unsigned int radius, NeighborListType *list = NULL) const; + NeighborListType * GetNeighbors(PointIdentifier pointId, unsigned int radius, NeighborListType *list = ITK_NULLPTR) const; /** * Add a neighbor to a point. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMesh.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -80,17 +80,15 @@ mesh = dynamic_cast< const Superclass * >( data ); - if ( mesh ) - { - this->m_MaximumNumberOfRegions = mesh->GetMaximumNumberOfRegions(); - } - else + if ( mesh == ITK_NULLPTR ) { // pointer could not be cast back down itkExceptionMacro( << "itk::Mesh::CopyInformation() cannot cast " << typeid( data ).name() << " to " << typeid( Superclass * ).name() ); } + + this->m_MaximumNumberOfRegions = mesh->GetMaximumNumberOfRegions(); } template< typename TPixelType, unsigned int VDimension, typename TMeshTraits > @@ -288,7 +286,7 @@ SimplexMesh< TPixelType, VDimension, TMeshTraits > ::GetNeighbors(PointIdentifier idx, unsigned int radius, NeighborListType *list) const { - if ( list == NULL ) + if ( list == ITK_NULLPTR ) { list = new NeighborListType(); IndexArray neighborArray = GetNeighbors(idx); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.h otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -176,7 +176,7 @@ protected: SimplexMeshVolumeCalculator(); virtual ~SimplexMeshVolumeCalculator(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: SimplexMeshVolumeCalculator(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSimplexMeshVolumeCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,12 +27,24 @@ */ template< typename TInputMesh > SimplexMeshVolumeCalculator< TInputMesh > -::SimplexMeshVolumeCalculator() +::SimplexMeshVolumeCalculator() : + m_Volume(0.0), + m_VolumeX(0.0), + m_VolumeY(0.0), + m_VolumeZ(0.0), + m_Area(0.0), + m_Kx(0.0), + m_Ky(0.0), + m_Kz(0.0), + m_Wxyz(0.0), + m_Wxy(0.0), + m_Wxz(0.0), + m_Wyz(0.0), + m_Muncx(0), + m_Muncy(0), + m_Muncz(0), + m_NumberOfTriangles(0) { - m_Volume = m_VolumeX = m_VolumeY = m_VolumeZ = 0.0; - m_Area = 0.0; - m_Kx = m_Ky = m_Kz = 0.0; - m_NumberOfTriangles = 0; } template< typename TInputMesh > @@ -75,7 +87,7 @@ m_Volume = ( m_Kx * m_VolumeX + m_Ky * m_VolumeY + m_Kz * m_VolumeZ ); - m_Volume = vcl_fabs(m_Volume); + m_Volume = std::fabs(m_Volume); } template< typename TInputMesh > @@ -139,7 +151,7 @@ // Normalize normal // - length = vcl_sqrt(u[0] * u[0] + u[1] * u[1] + u[2] * u[2]); + length = std::sqrt(u[0] * u[0] + u[1] * u[1] + u[2] * u[2]); if ( length != 0.0 ) { u[0] /= length; @@ -153,7 +165,7 @@ // Determine max unit normal component... // - absu[0] = vcl_fabs(u[0]); absu[1] = vcl_fabs(u[1]); absu[2] = vcl_fabs(u[2]); + absu[0] = std::fabs(u[0]); absu[1] = std::fabs(u[1]); absu[2] = std::fabs(u[2]); if ( ( absu[0] > absu[1] ) && ( absu[0] > absu[2] ) ) { m_Muncx++; @@ -196,11 +208,11 @@ // Area of a triangle using Heron's formula... // - a = vcl_sqrt(ii[1] + jj[1] + kk[1]); - b = vcl_sqrt(ii[0] + jj[0] + kk[0]); - c = vcl_sqrt(ii[2] + jj[2] + kk[2]); + a = std::sqrt(ii[1] + jj[1] + kk[1]); + b = std::sqrt(ii[0] + jj[0] + kk[0]); + c = std::sqrt(ii[2] + jj[2] + kk[2]); s = 0.5 * ( a + b + c ); - area = vcl_sqrt( vcl_fabs( s * ( s - a ) * ( s - b ) * ( s - c ) ) ); + area = std::sqrt( std::fabs( s * ( s - a ) * ( s - b ) * ( s - c ) ) ); // Volume elements ... // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSphereMeshSource.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSphereMeshSource.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkSphereMeshSource.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkSphereMeshSource.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -90,7 +90,7 @@ { for ( v = vbeg, j = 0; j < m_ResolutionY; v += vstep, j++ ) { - if ( vcl_cos(u) > 0 ) + if ( std::cos(u) > 0 ) { signu = 1; } @@ -98,7 +98,7 @@ { signu = -1; } - if ( vcl_cos(v) > 0 ) + if ( std::cos(v) > 0 ) { signv = 1; } @@ -107,10 +107,10 @@ signv = -1; } - p1[0] = m_Scale[0] * signu * ( vcl_pow( (float)( vcl_fabs( vcl_cos(u) ) ), (float)m_Squareness1 ) ) * signv - * ( vcl_pow( (float)( vcl_fabs( vcl_cos(v) ) ), (float)m_Squareness2 ) ) + m_Center[0]; + p1[0] = m_Scale[0] * signu * ( std::pow( (float)( std::fabs( std::cos(u) ) ), (float)m_Squareness1 ) ) * signv + * ( std::pow( (float)( std::fabs( std::cos(v) ) ), (float)m_Squareness2 ) ) + m_Center[0]; - if ( vcl_sin(v) > 0 ) + if ( std::sin(v) > 0 ) { signv = 1; } @@ -119,10 +119,10 @@ signv = -1; } - p1[1] = m_Scale[1] * signu * ( vcl_pow( (float)( vcl_fabs( vcl_cos(u) ) ), (float)m_Squareness1 ) ) * signv - * ( vcl_pow( (float)( vcl_fabs( vcl_sin(v) ) ), (float)m_Squareness2 ) ) + m_Center[1]; + p1[1] = m_Scale[1] * signu * ( std::pow( (float)( std::fabs( std::cos(u) ) ), (float)m_Squareness1 ) ) * signv + * ( std::pow( (float)( std::fabs( std::sin(v) ) ), (float)m_Squareness2 ) ) + m_Center[1]; - if ( vcl_sin(u) > 0 ) + if ( std::sin(u) > 0 ) { signu = 1; } @@ -131,7 +131,7 @@ signu = -1; } - p1[2] = m_Scale[2] * signu * ( vcl_pow( (float)( vcl_fabs( vcl_sin(u) ) ), (float)m_Squareness1 ) ) + p1[2] = m_Scale[2] * signu * ( std::pow( (float)( std::fabs( std::sin(u) ) ), (float)m_Squareness1 ) ) + m_Center[2]; point.Value() = p1; @@ -140,21 +140,21 @@ } // calculate the south pole node - p1[0] = ( m_Scale[0] * ( vcl_pow( (float)( vcl_fabs( vcl_cos(-vnl_math::pi / 2) ) ), 1.0f ) ) - * ( vcl_pow( (float)( vcl_fabs( vcl_cos(0.0) ) ), 1.0f ) ) + m_Center[0] ); - p1[1] = ( m_Scale[1] * ( vcl_pow( (float)( vcl_fabs( vcl_cos(-vnl_math::pi / 2) ) ), 1.0f ) ) - * ( vcl_pow( (float)( vcl_fabs( vcl_sin(0.0) ) ), 1.0f ) ) + m_Center[1] ); - p1[2] = ( m_Scale[2] * -1 * ( vcl_pow( (float)( vcl_fabs( vcl_sin(-vnl_math::pi / 2) ) ), 1.0f ) ) + p1[0] = ( m_Scale[0] * ( std::pow( (float)( std::fabs( std::cos(-vnl_math::pi / 2) ) ), 1.0f ) ) + * ( std::pow( (float)( std::fabs( std::cos(0.0) ) ), 1.0f ) ) + m_Center[0] ); + p1[1] = ( m_Scale[1] * ( std::pow( (float)( std::fabs( std::cos(-vnl_math::pi / 2) ) ), 1.0f ) ) + * ( std::pow( (float)( std::fabs( std::sin(0.0) ) ), 1.0f ) ) + m_Center[1] ); + p1[2] = ( m_Scale[2] * -1 * ( std::pow( (float)( std::fabs( std::sin(-vnl_math::pi / 2) ) ), 1.0f ) ) + m_Center[2] ); point.Value() = p1; ++point; // calculate the north pole node - p1[0] = ( m_Scale[0] * ( vcl_pow( (float)( vcl_fabs( vcl_cos(vnl_math::pi / 2) ) ), 1.0f ) ) - * ( vcl_pow(vcl_fabs( vcl_cos(0.0) ), 1.0) ) + m_Center[0] ); - p1[1] = ( m_Scale[1] * ( vcl_pow( (float)( vcl_fabs( vcl_cos(vnl_math::pi / 2) ) ), 1.0f ) ) - * ( vcl_pow(vcl_fabs( vcl_sin(0.0) ), 1.0) ) + m_Center[1] ); - p1[2] = ( m_Scale[2] * ( vcl_pow( (float)( vcl_fabs( vcl_sin(vnl_math::pi / 2) ) ), 1.0f ) ) + p1[0] = ( m_Scale[0] * ( std::pow( (float)( std::fabs( std::cos(vnl_math::pi / 2) ) ), 1.0f ) ) + * ( std::pow(std::fabs( std::cos(0.0) ), 1.0) ) + m_Center[0] ); + p1[1] = ( m_Scale[1] * ( std::pow( (float)( std::fabs( std::cos(vnl_math::pi / 2) ) ), 1.0f ) ) + * ( std::pow(std::fabs( std::sin(0.0) ), 1.0) ) + m_Center[1] ); + p1[2] = ( m_Scale[2] * ( std::pow( (float)( std::fabs( std::sin(vnl_math::pi / 2) ) ), 1.0f ) ) + m_Center[2] ); point.Value() = p1; ++point; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkTransformMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkTransformMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkTransformMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkTransformMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ TransformMeshFilter< TInputMesh, TOutputMesh, TTransform > ::TransformMeshFilter() { - m_Transform = 0; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToBinaryImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ m_Direction.GetVnlMatrix().set_identity(); m_Tolerance = 1e-5; - m_InfoImage = NULL; + m_InfoImage = ITK_NULLPTR; } /** Destructor */ @@ -167,7 +167,7 @@ // Get the input and output pointers OutputImagePointer OutputImage = this->GetOutput(); - if ( m_InfoImage == NULL ) + if ( m_InfoImage == ITK_NULLPTR ) { if ( m_Size[0] == 0 || m_Size[1] == 0 || m_Size[2] == 0 ) { @@ -292,8 +292,8 @@ std::swap(p1, p2); } - int zmin = (int)( vcl_ceil(p1[2]) ); - int zmax = (int)( vcl_ceil(p2[2]) ); + int zmin = (int)( std::ceil(p1[2]) ); + int zmax = (int)( std::ceil(p2[2]) ); if ( zmin > extent[5] || zmax < extent[4] ) { @@ -370,8 +370,8 @@ continue; } double temp = 1.0 / ( Y2 - Y1 ); - int ymin = (int)( vcl_ceil(Y1) ); - int ymax = (int)( vcl_ceil(Y2) ); + int ymin = (int)( std::ceil(Y1) ); + int ymax = (int)( std::ceil(Y2) ); for ( int y = ymin; y < ymax; y++ ) { double r = ( Y2 - y ) * temp; @@ -545,8 +545,8 @@ for ( int i = 0; i < n; i++ ) { - int x1 = (int)( vcl_ceil(nlist[2 * i]) ); - int x2 = (int)( vcl_floor(nlist[2 * i + 1]) ); + int x1 = (int)( std::ceil(nlist[2 * i]) ); + int x2 = (int)( std::floor(nlist[2 * i + 1]) ); if ( x2 < extent[0] || x1 > ( extent[1] ) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToSimplexMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToSimplexMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToSimplexMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkTriangleMeshToSimplexMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,14 +23,21 @@ { template< typename TInputMesh, typename TOutputMesh > TriangleMeshToSimplexMeshFilter< TInputMesh, TOutputMesh > -::TriangleMeshToSimplexMeshFilter() +::TriangleMeshToSimplexMeshFilter() : + m_FaceSet(ITK_NULLPTR), + m_Edges(ITK_NULLPTR), + m_EdgeNeighborList(ITK_NULLPTR), + m_VertexNeighborList(ITK_NULLPTR), + m_LineCellIndices(ITK_NULLPTR), + m_CellIdxOffset(0), + m_IdOffset(0), + m_EdgeCellId(0), + m_HandledEdgeIds(IdVectorType::New()) { OutputMeshPointer output = TOutputMesh::New(); this->ProcessObject::SetNumberOfRequiredOutputs(1); this->ProcessObject::SetNthOutput( 0, output.GetPointer() ); - m_HandledEdgeIds = IdVectorType::New(); - m_FaceSet = NULL; } template< typename TInputMesh, typename TOutputMesh > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataReader.h otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataReader.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataReader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataReader.h 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,13 @@ * Use vtkTriangleFilter to convert your mesh to a triangle mesh. * Caviet2: itkVTKPolyDataReader can only read vtk legacy files. * Caveat3: itkVTKPolyDataReader cannot read binary vtk files. + * + * This class may be deprecated in the future. The MeshFileReader is + * preferred. + * * \ingroup ITKMesh + * + * \sa MeshFileReader */ template< typename TOutputMesh > class VTKPolyDataReader:public MeshSource< TOutputMesh > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.h otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,13 @@ * * Caveat: The input to itkVTKPolyDataWriter must be a triangle mesh. * Use vtkTriangleFilter to convert your mesh to a triangle mesh. + * + * This class may be deprecated in the future. The MeshFileWriter is + * preferred. + * * \ingroup ITKMesh + * + * \sa MeshFileWriter */ template< typename TInputMesh > class VTKPolyDataWriter:public Object @@ -95,7 +101,7 @@ InputMeshPointer m_Input; - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: VTKPolyDataWriter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkVTKPolyDataWriter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ VTKPolyDataWriter< TInputMesh > ::VTKPolyDataWriter() { - this->m_Input = NULL; + this->m_Input = ITK_NULLPTR; this->m_FileName = ""; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkWarpMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkWarpMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/include/itkWarpMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/include/itkWarpMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,6 @@ typedef typename TInputMesh::PointsContainer InputPointsContainer; typedef typename TOutputMesh::PointsContainer OutputPointsContainer; - typedef typename TInputMesh::PointsContainerPointer InputPointsContainerPointer; typedef typename TOutputMesh::PointsContainerPointer OutputPointsContainerPointer; const InputMeshType * inputMesh = this->GetInput(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/src/itkSimplexMeshGeometry.cxx otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/src/itkSimplexMeshGeometry.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/src/itkSimplexMeshGeometry.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/src/itkSimplexMeshGeometry.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,24 +40,28 @@ normal.Fill(0); externalForce.Fill(0); internalForce.Fill(0); + closestAttractor.Fill(0); circleRadius = 0; circleCenter.Fill(0); sphereRadius = 0; distance = 0; phi = 0; + multiplier = 0.0; + forceIndex = 0; neighborIndices.Fill( NumericTraits< IdentifierType >::max() ); neighbors.Fill(p); meanCurvature = c; - neighborSet = NULL; + neighborSet = ITK_NULLPTR; + closestAttractorIndex = 0; } SimplexMeshGeometry ::~SimplexMeshGeometry() { delete this->neighborSet; - this->neighborSet = NULL; + this->neighborSet = ITK_NULLPTR; } void @@ -157,7 +161,7 @@ } else { - this->neighborSet = NULL; + this->neighborSet = ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/wrapping/itkImageToMeshFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/wrapping/itkImageToMeshFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/Mesh/wrapping/itkImageToMeshFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Mesh/wrapping/itkImageToMeshFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -7,7 +7,10 @@ endforeach(t) endforeach(d) # For BinaryMask3DMeshSource - foreach(t ${WRAP_ITK_INT}) - itk_wrap_template("${ITKM_I${t}3}M${ITKM_D}3ST${ITKM_D}33${ITKM_D}${ITKM_D}" "${ITKT_I${t}3}, itk::Mesh< ${ITKT_D},3,itk::DefaultStaticMeshTraits< ${ITKT_D},3,3,${ITKT_D},${ITKT_D} > >") - endforeach(t) + itk_wrap_filter_dims(has_d_3 3) + if(has_d_3) + foreach(t ${WRAP_ITK_INT}) + itk_wrap_template("${ITKM_I${t}3}M${ITKM_D}3ST${ITKM_D}33${ITKM_D}${ITKM_D}" "${ITKT_I${t}3}, itk::Mesh< ${ITKT_D},3,itk::DefaultStaticMeshTraits< ${ITKT_D},3,3,${ITKT_D},${ITKT_D} > >") + endforeach(t) + endif(has_d_3) itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkGeometricalQuadEdge.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkGeometricalQuadEdge.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkGeometricalQuadEdge.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkGeometricalQuadEdge.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ const typename GeometricalQuadEdge< TVRef, TFRef, TPrimalData, TDualData, PrimalDual >::OriginRefType GeometricalQuadEdge< TVRef, TFRef, TPrimalData, TDualData, PrimalDual >::m_NoPoint = - vcl_numeric_limits< OriginRefType >::max(); + std::numeric_limits< OriginRefType >::max(); /** * Constructor @@ -38,10 +38,12 @@ template< typename TVRef, typename TFRef, typename TPrimalData, typename TDualData, bool PrimalDual > GeometricalQuadEdge< TVRef, TFRef, TPrimalData, TDualData, PrimalDual > -::GeometricalQuadEdge() +::GeometricalQuadEdge() : + m_Origin(m_NoPoint), + m_Data(), + m_DataSet(false), + m_LineCellIdent(0) { - this->m_Origin = m_NoPoint; - this->m_DataSet = false; } /** @@ -304,7 +306,7 @@ if ( this->IsOriginInternal() ) { itkQEDebugMacro("Internal point."); - return ( 0 ); + return ( ITK_NULLPTR ); } // Update reference @@ -331,7 +333,7 @@ // No border edge found itkQEDebugMacro("Unfound border edge."); - return ( 0 ); + return ( ITK_NULLPTR ); } /** @@ -665,7 +667,7 @@ { const Self *p1 = this->GetSym(); - if ( p1 == NULL ) + if ( p1 == ITK_NULLPTR ) { return false; // FIXME: Is this the right answer ? } @@ -682,7 +684,7 @@ { const DualType *p1 = this->GetRot(); - if ( p1 == NULL ) + if ( p1 == ITK_NULLPTR ) { return false; // FIXME: Is this the right answer ? } @@ -699,7 +701,7 @@ { const DualType *p1 = this->GetInvRot(); - if ( p1 == NULL ) + if ( p1 == ITK_NULLPTR ) { return false; // FIXME: Is this the right answer ? } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdge.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdge.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdge.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdge.h 2014-09-03 08:29:34.000000000 +0000 @@ -403,7 +403,7 @@ inline const Self * GetInvDnext() const { return this->GetDprev(); } /** Queries. */ - inline bool IsHalfEdge() const { return ( ( m_Onext == this ) || ( m_Rot == NULL ) ); } + inline bool IsHalfEdge() const { return ( ( m_Onext == this ) || ( m_Rot == ITK_NULLPTR ) ); } inline bool IsIsolated() const { return ( this == this->GetOnext() ); } bool IsEdgeInOnextRing(Self *testEdge) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBoundaryEdgesMeshFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBoundaryEdgesMeshFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBoundaryEdgesMeshFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshBoundaryEdgesMeshFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ { itkWarningMacro("Entry edge has not face adjacency."); delete ResultList; - return ( (OutputType)0 ); + return ( (OutputType)ITK_NULLPTR ); } // Store this edge as representative of it's Lnext() ring i.e. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -63,7 +63,7 @@ } protected: - QuadEdgeMeshEulerOperatorDeleteCenterVertexFunction(){} + QuadEdgeMeshEulerOperatorDeleteCenterVertexFunction() : m_OldPointID(0) {} ~QuadEdgeMeshEulerOperatorDeleteCenterVertexFunction(){} private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorDeleteCenterVertexFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,19 +29,19 @@ if ( !g ) { itkDebugMacro("Input is not an edge."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( !this->m_Mesh ) { itkDebugMacro("No mesh present."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( !g->IsInternal() ) { itkDebugMacro("The edge is either border or wire."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } // None of the incident facets of g->GetDestination() is a hole. @@ -58,7 +58,7 @@ if ( !one_edge->IsInternal() ) { itkDebugMacro("DeleteVertex requires a full one-ring, i.e. no holes."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } pList.push_back( one_edge->GetDestination() ); } @@ -91,7 +91,7 @@ itkDebugMacro( "DeleteVertex requires at least two distinct \ facets incident to the facets that are incident to g->GetDestination()." ); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } // let's do the job now. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorFlipEdgeFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorFlipEdgeFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorFlipEdgeFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorFlipEdgeFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -98,7 +98,7 @@ } if ( this->m_Mesh->FindEdge( h->GetOnext()->GetDestination(), - h->GetSym()->GetOnext()->GetDestination() ) != 0 ) + h->GetSym()->GetOnext()->GetDestination() ) != ITK_NULLPTR ) { m_EdgeStatus = EXISTING_OPPOSITE_EDGE; return; @@ -134,22 +134,22 @@ return Process(h); case EDGE_NULL: itkDebugMacro("No Edge to flip."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); case MESH_NULL: itkDebugMacro("No mesh present."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); case NON_INTERNAL_EDGE: itkDebugMacro("Can only flip internal edge."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); case NON_TRIANGULAR_LEFT_FACE: itkDebugMacro("Can only flip edge for triangles."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); case NON_TRIANGULAR_RIGHT_FACE: itkDebugMacro("Can only flip edge for triangles."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); case EXISTING_OPPOSITE_EDGE: itkDebugMacro("The opposite edge already exists."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinFacetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinFacetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinFacetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinFacetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ if ( !e->IsInternal() ) { itkDebugMacro("The edge is either border or wire."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } // Initial state Final state // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinVertexFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinVertexFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinVertexFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorJoinVertexFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -120,9 +120,9 @@ case SAMOSA_CONFIG: // Eye case case EYE_CONFIG: - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); case EDGE_JOINING_DIFFERENT_BORDERS: - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } } @@ -197,7 +197,7 @@ if ( QEType::m_NoPoint != zip->Evaluate(leftZip) ) { itkDebugMacro("Zip must return NoPoint (left)."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } } else @@ -217,7 +217,7 @@ if ( QEType::m_NoPoint != zip->Evaluate(riteZip) ) { itkDebugMacro("Zip must return NoPoint (right)."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } } else @@ -283,7 +283,7 @@ // it now retuns one edge from NewDest or NewOrg if there are any // else NULL QEType *temp = this->m_Mesh->FindEdge(dest); - if ( temp != 0 ) + if ( temp != ITK_NULLPTR ) { return temp; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitEdgeFunction.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitEdgeFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitEdgeFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitEdgeFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -61,13 +61,13 @@ if ( !e ) { itkDebugMacro("Input is not an edge."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( !this->m_Mesh ) { itkDebugMacro("No mesh present."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } m_SplitVertex->SetInput(this->m_Mesh); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitFacetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitFacetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitFacetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitFacetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,32 +45,32 @@ if ( !h || !g ) { itkDebugMacro("At least one of the Input is not an edge."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( !this->m_Mesh ) { itkDebugMacro("No mesh present."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( h == g ) { itkDebugMacro("Provided edges should be different."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( h->GetLeft() != g->GetLeft() ) { itkDebugMacro("The edges are not around the same face."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( ( h->GetLnext() == g ) || ( g->GetLnext() == h ) ) { itkDebugMacro("Provided edges should NOT be consecutive."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } typedef typename MeshType::VertexRefType VertexRefType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitVertexFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitVertexFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitVertexFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshEulerOperatorSplitVertexFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,25 +29,25 @@ if ( !this->m_Mesh ) { itkDebugMacro("No mesh present."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } - if ( ( h == (QEType *)( 0 ) ) || ( g == (QEType *)( 0 ) ) ) + if ( ( h == (QEType *)ITK_NULLPTR ) || ( g == (QEType *)ITK_NULLPTR ) ) { itkDebugMacro("One or more argument(s) is(are) null."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( h == g ) { itkDebugMacro("The two half-edges are the same. No antenna allowed."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } if ( h->GetDestination() != g->GetDestination() ) { itkDebugMacro("The two half-edges must be incident to the same vertex."); - return ( (QEType *)0 ); + return ( (QEType *)ITK_NULLPTR ); } // delete the faces diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFrontIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,10 +24,13 @@ { // --------------------------------------------------------------------- template< typename TMesh, typename TQE > -QuadEdgeMeshFrontBaseIterator< TMesh, TQE >::QuadEdgeMeshFrontBaseIterator(MeshType *mesh, - bool start, - QEType *seed): - m_Mesh(mesh), m_Seed(seed), m_Start(start) +QuadEdgeMeshFrontBaseIterator< TMesh, TQE >:: +QuadEdgeMeshFrontBaseIterator(MeshType *mesh, bool start, QEType *seed) : + m_Mesh(mesh), + m_Seed(seed), + m_Start(start), + m_Front(ITK_NULLPTR), + m_CurrentEdge(ITK_NULLPTR) { if ( !mesh ) { @@ -122,7 +125,7 @@ // All the edge->Origin() neighbours were already visited. Remove // the edge from the front, and move to next edge... m_Front->pop_front(); - m_CurrentEdge = (QEType *)0; + m_CurrentEdge = (QEType *)ITK_NULLPTR; return ( this->operator++() ); } @@ -143,7 +146,7 @@ { return edge->GetRot(); } - return (QEType *)0; + return (QEType *)ITK_NULLPTR; } } #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFunctionBase.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFunctionBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFunctionBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshFunctionBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -86,7 +86,7 @@ protected: QuadEdgeMeshFunctionBase() { - m_Mesh = (MeshType *)0; + m_Mesh = (MeshType *)ITK_NULLPTR; } ~QuadEdgeMeshFunctionBase(){} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.h 2014-09-03 08:29:34.000000000 +0000 @@ -304,7 +304,7 @@ int dimension) const { (void)dimension; - return ( (BoundaryAssignmentsContainerPointer)0 ); + return ( (BoundaryAssignmentsContainerPointer)ITK_NULLPTR ); } #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMesh.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,12 +26,12 @@ template< typename TPixel, unsigned int VDimension, typename TTraits > const typename QuadEdgeMesh< TPixel, VDimension, TTraits >::PointIdentifier QuadEdgeMesh< TPixel, VDimension, TTraits >::m_NoPoint = - vcl_numeric_limits< PointIdentifier >::max(); + std::numeric_limits< PointIdentifier >::max(); template< typename TPixel, unsigned int VDimension, typename TTraits > const typename QuadEdgeMesh< TPixel, VDimension, TTraits >::CellIdentifier QuadEdgeMesh< TPixel, VDimension, TTraits >::m_NoFace = - vcl_numeric_limits< CellIdentifier >::max(); + std::numeric_limits< CellIdentifier >::max(); /** * Restore the mesh to its initial state. Useful for data pipeline updates @@ -82,19 +82,7 @@ ::Graft(const DataObject *data) { this->Superclass::Graft(data); - const Self *mesh = 0; - - try - { - mesh = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // mesh could not be cast back down - itkExceptionMacro( << "itk::QuadEdgeMesh::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *mesh = dynamic_cast< const Self * >( data ); if ( !mesh ) { @@ -331,7 +319,7 @@ /////////////////////////////////////////////////////////////// // Back to dealing with the geometrical references. First // make sure the oldOrigin's edge entry won't be used any more: - oldOrigin.SetEdge( (QEPrimal *)0 ); + oldOrigin.SetEdge( (QEPrimal *)ITK_NULLPTR ); this->SetPoint(oldOriginId, oldOrigin); // We need to inform the edges ranging from a->Onext() to b that @@ -671,7 +659,7 @@ if ( orgPid == destPid ) { itkDebugMacro("Creating an edge between the same point."); - return ( (QEPrimal *)0 ); + return ( (QEPrimal *)ITK_NULLPTR ); } // Make sure the points are already in the QuadEdgeMesh container: @@ -679,12 +667,12 @@ || !( this->GetPoints()->IndexExists(destPid) ) ) { itkDebugMacro("One of the points not in the PointSet."); - return ( (QEPrimal *)0 ); + return ( (QEPrimal *)ITK_NULLPTR ); } // Make sure the edge is not already in the container QEPrimal *e = this->FindEdge(orgPid, destPid); - if ( e != (QEPrimal *)0 ) + if ( e != (QEPrimal *)ITK_NULLPTR ) { itkDebugMacro("Edge already in QuadEdgeMesh."); return e; @@ -698,7 +686,7 @@ if ( eOrigin->IsOriginInternal() ) { itkDebugMacro("No room for a new edge in the Origin() ring."); - return ( (QEPrimal *)0 ); + return ( (QEPrimal *)ITK_NULLPTR ); } } @@ -709,7 +697,7 @@ if ( eDestination->IsOriginInternal() ) { itkDebugMacro("No room for a new edge in the Destination() ring."); - return ( (QEPrimal *)0 ); + return ( (QEPrimal *)ITK_NULLPTR ); } } @@ -793,7 +781,7 @@ // Check if the edge exists QEPrimal *e = this->FindEdge(orgPid, destPid); - if ( e == (QEPrimal *)0 ) + if ( e == (QEPrimal *)ITK_NULLPTR ) { itkDebugMacro("Edge missing in mesh."); return; @@ -825,7 +813,7 @@ } else { - pOrigin.SetEdge( (QEPrimal *)0 ); + pOrigin.SetEdge( (QEPrimal *)ITK_NULLPTR ); } } @@ -840,7 +828,7 @@ } else { - pDestination.SetEdge( (QEPrimal *)0 ); + pDestination.SetEdge( (QEPrimal *)ITK_NULLPTR ); } } @@ -860,7 +848,7 @@ { PolygonCellType *pcell = dynamic_cast< PolygonCellType * >( cit.Value() ); bool toDelete = false; - if ( pcell != (PolygonCellType *)0 ) + if ( pcell != (PolygonCellType *)ITK_NULLPTR ) { QEPrimal *edge = pcell->GetEdgeRingEntry(); typename QEPrimal::IteratorGeom it = edge->BeginGeomLnext(); @@ -976,7 +964,7 @@ } else { - pOrigin.SetEdge( (QEPrimal *)0 ); + pOrigin.SetEdge( (QEPrimal *)ITK_NULLPTR ); } } @@ -991,7 +979,7 @@ } else { - pDestination.SetEdge( (QEPrimal *)0 ); + pDestination.SetEdge( (QEPrimal *)ITK_NULLPTR ); } } // ------------------------------------------------------------------ @@ -1125,7 +1113,7 @@ { if ( this->GetEdgeCells()->size() == 0 ) { - return ( (QEPrimal *)0 ); + return ( (QEPrimal *)ITK_NULLPTR ); } const CellsContainer* edgeCells = this->GetEdgeCells(); @@ -1147,7 +1135,7 @@ if( !this->GetEdgeCells()->GetElementIfIndexExists( eid, &c ) ) { itkDebugMacro("No such edge in container"); - return ( (QEPrimal *)0 ); + return ( (QEPrimal *)ITK_NULLPTR ); } EdgeCellType *e = dynamic_cast< EdgeCellType * >( c ); @@ -1188,7 +1176,7 @@ ++it; } } - return ( static_cast< QEPrimal * >( NULL ) ); + return ( static_cast< QEPrimal * >( ITK_NULLPTR ) ); } /** @@ -1198,10 +1186,10 @@ QuadEdgeMesh< TPixel, VDimension, TTraits > ::FindEdgeCell(const PointIdentifier & pid0, const PointIdentifier & pid1) const { - EdgeCellType *result = (EdgeCellType *)0; + EdgeCellType *result = (EdgeCellType *)ITK_NULLPTR; QEPrimal * EdgeGeom = FindEdge(pid0, pid1); - if ( EdgeGeom != (QEPrimal *)0 ) + if ( EdgeGeom != (QEPrimal *)ITK_NULLPTR ) { CellIdentifier LineIdent = EdgeGeom->GetIdent(); if ( LineIdent != m_NoPoint ) @@ -1273,7 +1261,7 @@ { itkDebugMacro("Edge [" << i << " " << ( ( i + 1 ) % N ) << " has a left face."); - return (QEPrimal *)NULL; + return (QEPrimal *)ITK_NULLPTR; } } } @@ -1301,7 +1289,7 @@ const PointIdentifier numberOfPoints = static_cast< PointIdentifier >( points.size() ); typedef std::vector< QEPrimal * > QEList; - QEList FaceQEList( numberOfPoints, NULL ); + QEList FaceQEList( numberOfPoints, ITK_NULLPTR ); // Now create edge list and create missing edges if needed. for ( PointIdentifier i = 0; i < numberOfPoints; i++ ) @@ -1313,7 +1301,7 @@ if ( !edge && CheckEdges ) { QEPrimal *entry = this->AddEdgeWithSecurePointList(pid0, pid1); - if ( entry == (QEPrimal *)0 ) + if ( entry == (QEPrimal *)ITK_NULLPTR ) { return ( entry ); } @@ -1349,7 +1337,7 @@ { // FIXME throw exception here instead itkDebugMacro("entry == NULL"); - return (QEPrimal *)NULL; + return (QEPrimal *)ITK_NULLPTR; } this->AddFace(entry); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPoint.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPoint.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPoint.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPoint.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ QuadEdgeMeshPoint< TCoordRep, VPointDimension, TQuadEdge > ::Initialize() { - m_Edge = static_cast< TQuadEdge * >( NULL ); + m_Edge = static_cast< TQuadEdge * >( ITK_NULLPTR ); } // --------------------------------------------------------------------- diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshPolygonCell.h 2014-09-03 08:29:34.000000000 +0000 @@ -173,7 +173,7 @@ MakePointIds(); if ( m_PointIds.size() == 0 ) { - return ( static_cast< PointIdIterator >( 0 ) ); + return ( static_cast< PointIdIterator >( ITK_NULLPTR ) ); } else { @@ -186,7 +186,7 @@ // NOTE ALEX: should update the array on the fly to make it faster if ( m_PointIds.size() == 0 ) { - return ( static_cast< PointIdIterator >( 0 ) ); + return ( static_cast< PointIdIterator >( ITK_NULLPTR ) ); } else { @@ -200,7 +200,7 @@ MakePointIds(); if ( m_PointIds.size() == 0 ) { - return ( static_cast< PointIdIterator >( 0 ) ); + return ( static_cast< PointIdIterator >( ITK_NULLPTR ) ); } else { @@ -213,7 +213,7 @@ // NOTE ALEX: should update the array on the fly to make it faster if ( m_PointIds.size() == 0 ) { - return ( static_cast< PointIdIterator >( 0 ) ); + return ( static_cast< PointIdIterator >( ITK_NULLPTR ) ); } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.h 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,7 @@ protected: QuadEdgeMeshTopologyChecker(); ~QuadEdgeMeshTopologyChecker(){} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: QuadEdgeMeshTopologyChecker(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshTopologyChecker.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ m_ExpectedNumberOfFaces = NumericTraits< CellIdentifier >::Zero; m_ExpectedNumberOfBoundaries = NumericTraits< CellIdentifier >::Zero; m_ExpectedGenus = NumericTraits< OffsetValueType >::Zero; - m_Mesh = NULL; + m_Mesh = ITK_NULLPTR; } template< typename TMesh > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshToQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshToQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshToQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/include/itkQuadEdgeMeshToQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -182,7 +182,7 @@ const InputPointDataContainer *inputPointData = in->GetPointData(); - if ( inputPointData == NULL ) + if ( inputPointData == ITK_NULLPTR ) { // There is nothing to copy return; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/src/itkQuadEdge.cxx otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/src/itkQuadEdge.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/src/itkQuadEdge.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/src/itkQuadEdge.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,15 +24,15 @@ ::QuadEdge() { this->m_Onext = this; - this->m_Rot = NULL; + this->m_Rot = ITK_NULLPTR; } // --------------------------------------------------------------------- QuadEdge ::~QuadEdge() { - this->m_Onext = NULL; - this->m_Rot = NULL; + this->m_Onext = ITK_NULLPTR; + this->m_Rot = ITK_NULLPTR; } // --------------------------------------------------------------------- @@ -440,7 +440,7 @@ ConstIterator it = this->BeginOnext(); while ( it != this->EndOnext() ) { - if ( it.Value() == NULL ) + if ( it.Value() == ITK_NULLPTR ) { return false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/wrapping/itkMatrixCoefficients.wrap otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/wrapping/itkMatrixCoefficients.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/wrapping/itkMatrixCoefficients.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/QuadEdgeMesh/wrapping/itkMatrixCoefficients.wrap 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) - -itk_wrap_include("itkQuadEdgeMesh.h") -itk_wrap_include("itkQuadEdgeMeshParamMatrixCoefficients.h") - -itk_wrap_class("itk::MatrixCoefficients") - foreach(d ${ITK_WRAP_DIMS}) - itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") - endforeach(d) -itk_end_wrap_class() - -itk_wrap_class("itk::OnesMatrixCoefficients") - foreach(d ${ITK_WRAP_DIMS}) - itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") - endforeach(d) -itk_end_wrap_class() - -itk_wrap_class("itk::InverseEuclideanDistanceMatrixCoefficients") - foreach(d ${ITK_WRAP_DIMS}) - itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") - endforeach(d) -itk_end_wrap_class() - -itk_wrap_class("itk::ConformalMatrixCoefficients") - foreach(d ${ITK_WRAP_DIMS}) - itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") - endforeach(d) -itk_end_wrap_class() - -itk_wrap_class("itk::AuthalicMatrixCoefficients") - foreach(d ${ITK_WRAP_DIMS}) - itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") - endforeach(d) -itk_end_wrap_class() - -itk_wrap_class("itk::IntrinsicMatrixCoefficients") - foreach(d ${ITK_WRAP_DIMS}) - itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") - endforeach(d) -itk_end_wrap_class() - -itk_wrap_class("itk::HarmonicMatrixCoefficients") - foreach(d ${ITK_WRAP_DIMS}) - itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") - endforeach(d) -itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.h 2014-09-03 08:29:34.000000000 +0000 @@ -92,13 +92,13 @@ virtual void Initialize(); /** Clone the geometry frame */ - virtual LightObject::Pointer InternalClone() const; + virtual LightObject::Pointer InternalClone() const ITK_OVERRIDE; protected: AffineGeometryFrame(); virtual ~AffineGeometryFrame(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** used in clone to initialize the newly created geometry */ virtual void InitializeGeometry(Self *newGeometry) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkAffineGeometryFrame.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,14 +27,14 @@ AffineGeometryFrame< TScalar, NDimensions > ::AffineGeometryFrame() { - m_BoundingBox = NULL; + m_BoundingBox = ITK_NULLPTR; m_IndexToObjectTransform = TransformType::New(); m_IndexToObjectTransform->SetIdentity(); m_ObjectToNodeTransform = TransformType::New(); m_ObjectToNodeTransform->SetIdentity(); m_IndexToNodeTransform = TransformType::New(); m_IndexToNodeTransform->SetIdentity(); - m_IndexToWorldTransform = 0; + m_IndexToWorldTransform = ITK_NULLPTR; } /** Destructor */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkArrowSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkArrowSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkArrowSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkArrowSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -104,7 +104,7 @@ { itkDebugMacro("Checking the point [" << point << "] is on the Line"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { @@ -184,7 +184,7 @@ m_Length = m_Direction.GetSquaredNorm(); if ( m_Length != 0.0 ) { - m_Length = vcl_sqrt(m_Length); + m_Length = std::sqrt(m_Length); } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -92,14 +92,14 @@ /** Returns true if the Blob is evaluable at the requested point, * false otherwise. */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the Blob at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy Blobs. */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside the Blob, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBlobSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -164,12 +164,12 @@ typename PointType::VectorType difference = transformedPoint - it->GetPosition(); - if ( vcl_fabs(difference[0]) <= 0.5 - && vcl_fabs(difference[1]) <= 0.5 ) + if ( std::fabs(difference[0]) <= 0.5 + && std::fabs(difference[1]) <= 0.5 ) { if ( TDimension == 3 ) { - if ( vcl_fabs(difference[2]) <= 0.5 ) + if ( std::fabs(difference[2]) <= 0.5 ) { return true; } @@ -193,7 +193,7 @@ ::IsInside(const PointType & point, unsigned int depth, char *name) const { itkDebugMacro("Checking the point [" << point << "] is inside the blob"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -61,13 +61,13 @@ * That's useful for fuzzy objects. */ virtual bool ValueAt(const PointType & point, double & value, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Return true if the object provides a method to evaluate the value * at the specified point, false otherwise. */ virtual bool IsEvaluableAt(const PointType & point, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Test whether a point is inside or outside the object */ virtual bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkBoxSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,7 @@ itkDebugMacro("Checking the point [" << point << "] is inside the AxisAlignedBox"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { @@ -135,22 +135,27 @@ bb->SetMinimum(pntMin); bb->SetMaximum(pntMax); - - const_cast< BoundingBoxType * >( this->GetBounds() )->SetMinimum(pntMin); - const_cast< BoundingBoxType * >( this->GetBounds() )->SetMinimum(pntMax); - bb->ComputeBoundingBox(); + // Next Transform the corners of the bounding box typedef typename BoundingBoxType::PointsContainer PointsContainer; const PointsContainer *corners = bb->GetCorners(); - typename BoundingBoxType::PointsContainer::const_iterator - it = corners->begin(); + typename PointsContainer::Pointer transformedCorners = PointsContainer::New(); + transformedCorners->Reserve(corners->size()); + + typename PointsContainer::const_iterator it = corners->begin(); + typename PointsContainer::iterator itTrans = transformedCorners->begin(); while ( it != corners->end() ) { PointType pnt = this->GetIndexToWorldTransform()->TransformPoint(*it); - const_cast< BoundingBoxType * >( this->GetBounds() )->ConsiderPoint(pnt); + *itTrans = pnt; ++it; + ++itTrans; } + + // refresh the bounding box with the transformed corners + const_cast< BoundingBoxType * >( this->GetBounds() )->SetPoints(transformedCorners); + this->GetBounds()->ComputeBoundingBox(); } return true; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkContourSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkContourSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkContourSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkContourSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -135,14 +135,14 @@ * Note: For this class, this will always return false. -GH */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the Contour at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy Contours. */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside the Contour, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkCylinderSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkCylinderSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkCylinderSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkCylinderSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -64,18 +64,18 @@ * That's useful for fuzzy objects. */ virtual bool ValueAt(const PointType & point, double & value, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const ITK_OVERRIDE; /** Return true if the object provides a method to evaluate the value * at the specified point, false otherwise. */ virtual bool IsEvaluableAt(const PointType & point, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const ITK_OVERRIDE; /** Test whether a point is inside or outside the object */ virtual bool IsInside(const PointType & point, unsigned int depth, - char *) const; + char *) const ITK_OVERRIDE; /** Test whether a point is inside or outside the object * For computational speed purposes, it is faster if the method does not @@ -85,7 +85,7 @@ /** Get the boundaries of a specific object. This function needs to * be called every time one of the object's components is * changed. */ - virtual bool ComputeLocalBoundingBox() const; + virtual bool ComputeLocalBoundingBox() const ITK_OVERRIDE; protected: CylinderSpatialObject(const Self &); //purposely not implemented @@ -98,7 +98,7 @@ double m_Height; /** Print the object informations in a stream. */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; }; } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,13 +73,13 @@ * That's useful for fuzzy objects. */ virtual bool ValueAt(const PointType & point, double & value, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Return true if the object provides a method to evaluate the value * at the specified point, false otherwise. */ virtual bool IsEvaluableAt(const PointType & point, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Test whether a point is inside or outside the object */ virtual bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkEllipseSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -102,7 +102,7 @@ { itkDebugMacro("Checking the point [" << point << "] is inside the Ellipse"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -85,13 +85,13 @@ /** Returns the value of the Gaussian at the given point. */ virtual bool ValueAt(const PointType & point, ScalarType & value, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Return true if the object provides a method to evaluate the value * at the specified point, false otherwise. */ virtual bool IsEvaluableAt(const PointType & point, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Test whether a point is inside or outside the object */ virtual bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkGaussianSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -117,7 +117,7 @@ itkDebugMacro("Checking the point [" << point << "] is inside the GaussianSpatialObject"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { @@ -207,7 +207,7 @@ if ( IsInside(point, 0, name) ) { const double zsq = this->SquaredZScore(point); - value = m_Maximum * (ScalarType)vcl_exp(-zsq / 2.0); + value = m_Maximum * (ScalarType)std::exp(-zsq / 2.0); return true; } else if ( Superclass::IsEvaluableAt(point, depth, name) ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -84,6 +84,11 @@ * volumes. */ RegionType GetAxisAlignedBoundingBoxRegion() const; + /** Get the boundaries of a specific object. This function needs to + * be called every time one of the object's components is + * changed. */ + virtual bool ComputeLocalBoundingBox() const; + protected: ImageMaskSpatialObject(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageMaskSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ ImageMaskSpatialObject< TDimension > ::IsInside(const PointType & point, unsigned int depth, char *name) const { - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { @@ -248,6 +248,70 @@ return region; } +template< unsigned int TDimension > +bool +ImageMaskSpatialObject< TDimension > +::ComputeLocalBoundingBox() const +{ + itkDebugMacro("Computing ImageMaskSpatialObject bounding box"); + + if ( this->GetBoundingBoxChildrenName().empty() + || strstr( typeid( Self ).name(), + this->GetBoundingBoxChildrenName().c_str() ) ) + { + + // First get the region bounding box... + RegionType boundingRegion = GetAxisAlignedBoundingBoxRegion(); + const typename RegionType::IndexType index = boundingRegion.GetIndex(); + const typename RegionType::SizeType size = boundingRegion.GetSize(); + + //Now find the corners (by index) + typedef VectorContainer< unsigned int, typename RegionType::IndexType > + IndexContainerType; + + typename IndexContainerType::Pointer cornerInds = IndexContainerType::New(); + + unsigned int c = 0; + cornerInds->InsertElement(c++, index); + for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i ) + { + unsigned int curSize = cornerInds->Size(); + for ( unsigned int ii = 0; ii < curSize; ++ii) + { + IndexType tmpIndex = cornerInds->ElementAt(ii); + tmpIndex[i] += size[i]; + cornerInds->InsertElement(c++,tmpIndex); + } + } + + // Next Transform the corners of the bounding box + typedef typename BoundingBoxType::PointsContainer PointsContainer; + typename PointsContainer::Pointer transformedCorners = PointsContainer::New(); + transformedCorners->Reserve(cornerInds->size()); + + typename IndexContainerType::const_iterator it = cornerInds->begin(); + typename PointsContainer::iterator itTrans = transformedCorners->begin(); + while ( it != cornerInds->end() ) + { + PointType origPnt; + for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i ) + { + origPnt[i] = static_cast< typename PointType::CoordRepType>( (*it)[i]); + } + PointType pnt = this->GetIndexToWorldTransform()->TransformPoint(origPnt); + *itTrans = pnt; + ++it; + ++itTrans; + } + + // refresh the bounding box with the transformed corners + const_cast< BoundingBoxType * >( this->GetBounds() )->SetPoints(transformedCorners); + this->GetBounds()->ComputeBoundingBox(); + } + return true; +} + + /** Print the object */ template< unsigned int TDimension > void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -79,13 +79,13 @@ /** Return true if the object is evaluable at the requested point, * and else otherwise. */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the image at the requested point. * If the point is not inside the object, then an exception is thrown. * \sa ExceptionObject */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkImageSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ } this->ComputeBoundingBox(); - this->InternalSetPixelType(static_cast(0)); + this->InternalSetPixelType(static_cast(ITK_NULLPTR)); m_Interpolator = NNInterpolatorType::New(); } @@ -123,7 +123,7 @@ ImageSpatialObject< TDimension, PixelType > ::IsInside(const PointType & point, unsigned int depth, char *name) const { - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -84,14 +84,14 @@ /** Returns true if the Landmark is evaluable at the requested point, * false otherwise. */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the Landmark at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy Landmarks. */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside the Landmark, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLandmarkSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -180,7 +180,7 @@ { itkDebugMacro("Checking the point [" << point << "] is inside the blob"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -88,14 +88,14 @@ /** Returns true if the line is evaluable at the requested point, * false otherwise. */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the line at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy Lines. */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside the line, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkLineSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -160,7 +160,7 @@ { itkDebugMacro("Checking the point [" << point << "] is on the Line"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,13 +73,13 @@ /** Return true if the object is evaluable at the requested point, * and else otherwise. */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the Mesh at the requested point. * If the point is not inside the object, then an exception is thrown. * \sa ExceptionObject */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMeshSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ { double minDist = 0.0; const bool pointIsInside = it.Value()->EvaluatePosition( - position, m_Mesh->GetPoints(), NULL, NULL, &minDist, NULL); + position, m_Mesh->GetPoints(), ITK_NULLPTR, ITK_NULLPTR, &minDist, ITK_NULLPTR); if ( pointIsInside && minDist <= this->m_IsInsidePrecision ) { @@ -95,7 +95,7 @@ else { if ( it.Value()->EvaluatePosition(position, m_Mesh->GetPoints(), - NULL, NULL, NULL, NULL) ) + ITK_NULLPTR, ITK_NULLPTR, ITK_NULLPTR, ITK_NULLPTR) ) { return true; } @@ -112,7 +112,7 @@ MeshSpatialObject< TMesh > ::IsInside(const PointType & point, unsigned int depth, char *name) const { - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaArrowConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaArrowConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaArrowConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaArrowConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ ::MetaObjectToSpatialObject( const MetaObjectType *mo ) { const ArrowMetaObjectType *metaArrow = dynamic_cast(mo); - if(metaArrow == 0) + if(metaArrow == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaArrow"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaBlobConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaBlobConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaBlobConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaBlobConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,16 +43,13 @@ ::MetaObjectToSpatialObject(const MetaObjectType *mo) { const BlobMetaObjectType *Blob = dynamic_cast(mo); - if(Blob == 0) + if(Blob == ITK_NULLPTR) { itkExceptionMacro(<< "Can't downcast MetaObject to BlobMetaObject"); } typename BlobSpatialObjectType::Pointer blob = BlobSpatialObjectType::New(); - //typedef BlobSpatialObjectType::VectorType VectorType; - typedef vnl_vector< double > VectorType; - unsigned int ndims = Blob->NDims(); double spacing[NDimensions]; for ( unsigned int ii = 0; ii < ndims; ii++ ) @@ -70,7 +67,6 @@ blob->GetProperty()->SetAlpha(Blob->Color()[3]); typedef itk::SpatialObjectPoint< NDimensions > BlobPointType; - typedef BlobPointType * BlobPointPointer; MetaBlob::PointListType::const_iterator it2 = Blob->GetPoints().begin(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaContourConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaContourConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaContourConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaContourConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ ::MetaObjectToSpatialObject(const MetaObjectType *mo) { const ContourMetaObjectType *contourMO = dynamic_cast(mo); - if(contourMO == 0) + if(contourMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't downcast MetaObject to MetaContour"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaDTITubeConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaDTITubeConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaDTITubeConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaDTITubeConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ ::MetaObjectToSpatialObject(const MetaObjectType *mo) { const MetaDTITube *tube = dynamic_cast(mo); - if(tube == 0) + if(tube == ITK_NULLPTR) { itkExceptionMacro(<< "Can't downcast MetaObject to MetaDTITube"); } @@ -69,7 +69,6 @@ tubeSO->GetProperty()->SetAlpha(tube->Color()[3]); typedef itk::DTITubeSpatialObjectPoint< NDimensions > TubePointType; - typedef TubePointType * TubePointPointer; MetaDTITube::PointListType::const_iterator it2 = tube->GetPoints().begin(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaEllipseConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaEllipseConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaEllipseConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaEllipseConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ ::MetaObjectToSpatialObject(const MetaObjectType *mo) { const EllipseMetaObjectType *ellipseMO = dynamic_cast(mo); - if(ellipseMO == 0) + if(ellipseMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't downcast MetaObject to EllipseMetaObject"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGaussianConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGaussianConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGaussianConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGaussianConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ { const GaussianMetaObjectType *gaussian = dynamic_cast(mo); - if(gaussian == 0) + if(gaussian == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaGaussian" ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGroupConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGroupConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGroupConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaGroupConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ ::MetaObjectToSpatialObject(const MetaObjectType *mo) { const GroupMetaObjectType *group = dynamic_cast(mo); - if(group == 0) + if(group == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaGroup" ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaImageConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,7 +53,6 @@ { typename ImageType::Pointer rval = ImageType::New(); - typedef typename ImageType::Pointer ImagePointer; typedef typename ImageType::SizeType SizeType; typedef typename ImageType::SpacingType SpacingType; typedef typename ImageType::RegionType RegionType; @@ -96,7 +95,7 @@ const ImageMetaObjectType *imageMO = dynamic_cast(mo); - if(imageMO == 0) + if(imageMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaImage" ); } @@ -137,8 +136,6 @@ itkExceptionMacro(<< "Can't downcast SpatialObject to ImageSpatialObject"); } typedef typename ImageType::ConstPointer ImageConstPointer; - typedef typename ImageType::SizeType SizeType; - typedef typename ImageType::RegionType RegionType; ImageConstPointer SOImage = imageSO->GetImage(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLandmarkConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLandmarkConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLandmarkConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLandmarkConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ { const LandmarkMetaObjectType *landmarkMO = dynamic_cast(mo); - if(landmarkMO == 0) + if(landmarkMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaLandmark"); } @@ -52,9 +52,6 @@ LandmarkSpatialObjectPointer landmarkSO = LandmarkSpatialObjectType::New(); - //typedef LandmarkSpatialObjectType::VectorType VectorType; - typedef vnl_vector< double > VectorType; - unsigned int ndims = landmarkMO->NDims(); double spacing[NDimensions]; for ( unsigned int ii = 0; ii < ndims; ii++ ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLineConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLineConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLineConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaLineConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ { const LineMetaObjectType *lineMO = dynamic_cast(mo); - if(lineMO == 0) + if(lineMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaLine" ); } @@ -68,7 +68,6 @@ lineSO->GetProperty()->SetAlpha(lineMO->Color()[3]); typedef itk::LineSpatialObjectPoint< NDimensions > LinePointType; - typedef LinePointType * LinePointPointer; typedef MetaLine::PointListType ListType; ListType::const_iterator it2 = lineMO->GetPoints().begin(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaMeshConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaMeshConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaMeshConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaMeshConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ { const MeshMetaObjectType *_mesh = dynamic_cast(mo); - if(_mesh == 0) + if(_mesh == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaMesh"); } @@ -244,7 +244,7 @@ { std::cout << "MetaMeshConverter : GetMesh() returned a NULL Pointer" << std::endl; - return NULL; + return ITK_NULLPTR; } // fill in the Mesh information diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.h 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ /** write out a Scene SpatialObject */ bool WriteMeta(SceneType *scene, const char *fileName, unsigned int depth = MaximumDepth, - char *spatialObjectTypeName = NULL); + char *spatialObjectTypeName = ITK_NULLPTR); const MetaEvent * GetEvent() const { return m_Event; } void SetEvent(MetaEvent *event) { m_Event = event; } @@ -99,7 +99,7 @@ MetaScene * CreateMetaScene(SceneType *scene, unsigned int depth = MaximumDepth, - char *name = NULL); + char *name = ITK_NULLPTR); ScenePointer CreateSpatialObjectScene(MetaScene *scene); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSceneConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,7 @@ { // default behaviour of scene converter is not to save transform // with each spatial object. - m_Event = NULL; + m_Event = ITK_NULLPTR; m_BinaryPoints = false; m_TransformPrecision = 6; m_WriteImagesInSeparateFile = false; @@ -336,7 +336,6 @@ } else if ( spatialObjectTypeName == "MeshSpatialObject" ) { - typedef itk::Mesh< PixelType, NDimensions, TMeshTraits > MeshType; currentMeta = this->SpatialObjectToMetaObject< MetaMeshConverter< NDimensions, PixelType, TMeshTraits > > ( *it ); } else diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSurfaceConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSurfaceConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSurfaceConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaSurfaceConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ ::MetaObjectToSpatialObject(const MetaObjectType *mo) { const SurfaceMetaObjectType *surfaceMO = dynamic_cast(mo); - if(surfaceMO == 0) + if(surfaceMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaSurface"); } @@ -66,7 +66,6 @@ surfaceSO->GetProperty()->SetAlpha(surfaceMO->Color()[3]); typedef typename SurfaceSpatialObjectType::SurfacePointType SurfacePointType; - typedef SurfacePointType * SurfacePointPointer; typedef SurfaceMetaObjectType::PointListType ListType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaTubeConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaTubeConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaTubeConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaTubeConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ { const TubeMetaObjectType *tubeMO = dynamic_cast(mo); - if(tubeMO == 0) + if(tubeMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaTube" ); } @@ -69,7 +69,6 @@ tubeSO->GetProperty()->SetAlpha(tubeMO->Color()[3]); typedef itk::TubeSpatialObjectPoint< NDimensions > TubePointType; - typedef TubePointType * TubePointPointer; typedef MetaTube::PointListType ListType; ListType::const_iterator it2 = tubeMO->GetPoints().begin(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaVesselTubeConverter.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaVesselTubeConverter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaVesselTubeConverter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkMetaVesselTubeConverter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ { const VesselTubeMetaObjectType *vesselTubeMO = dynamic_cast(mo); - if(vesselTubeMO == 0) + if(vesselTubeMO == ITK_NULLPTR) { itkExceptionMacro(<< "Can't convert MetaObject to MetaVesselTube" ); } @@ -72,7 +72,6 @@ vesselTubeSO->GetProperty()->SetAlpha(vesselTubeMO->Color()[3]); typedef itk::VesselTubeSpatialObjectPoint< NDimensions > VesselTubePointType; - typedef VesselTubePointType * TubePointPointer; typedef VesselTubeMetaObjectType::PointListType ListType; ListType::const_iterator it2 = vesselTubeMO->GetPoints().begin(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -61,12 +61,12 @@ /** Returns a degree of membership to the object. * That's useful for fuzzy objects. */ virtual bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** return ture if the object provides a method to evaluate the value * at the specified point, else otherwise. */ virtual bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Test whether a point is inside or outside the object */ virtual bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPlaneSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -81,7 +81,7 @@ { itkDebugMacro("Checking the point [" << point << "is inside the plane"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPointBasedSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -62,7 +62,7 @@ { itkWarningMacro(<< "PointBasedSpatialObject::GetPoint() is not implemented" << " in the base class" << std::endl); - return 0; + return ITK_NULLPTR; } virtual SpatialObjectPointType * @@ -70,7 +70,7 @@ { itkWarningMacro(<< "PointBasedSpatialObject::GetPoint() is not implemented" << " in the base class" << std::endl); - return 0; + return ITK_NULLPTR; } /** Return the number of points in the list */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -97,7 +97,7 @@ /** Test whether a point is inside or outside the object. */ virtual bool IsInside(const PointType & point, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; protected: PolygonGroupSpatialObject(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonGroupSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -70,7 +70,7 @@ { PolygonSpatialObject< TDimension > *curstrand = dynamic_cast< PolygonSpatialObject< TDimension > * >( ( *it ).GetPointer() ); - if ( curstrand != 0 ) + if ( curstrand != ITK_NULLPTR ) { if ( !curstrand->IsClosed() ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkPolygonSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -138,10 +138,10 @@ ::MeasureArea() const { //To find the area of a planar polygon not in the x-y plane, use: - //2 A(P) = vcl_abs(N . (sum_{i=0}^{n-1} (v_i x v_{i+1}))) + //2 A(P) = std::abs(N . (sum_{i=0}^{n-1} (v_i x v_{i+1}))) //where N is a unit vector normal to the plane. The `.' represents the //dot product operator, the `x' represents the cross product operator, - // and vcl_abs() is the absolute value function. + // and std::abs() is the absolute value function. double area = 0.0; int numpoints = this->NumberOfPoints(); int X, Y; @@ -411,7 +411,7 @@ PolygonSpatialObject< TDimension > ::IsInside(const PointType & point) const { - return this->IsInside(point, 0, NULL); + return this->IsInside(point, 0, ITK_NULLPTR); } template< unsigned int TDimension > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -71,12 +71,12 @@ * \warning This function creates a new list therefore * the user is responsible for the deletion of the list. */ ObjectListType * GetObjects(unsigned int depth = MaximumDepth, - char *name = NULL); + char *name = ITK_NULLPTR); /** Returns the number of children currently assigned to * the SceneSpatialObject object. */ unsigned int GetNumberOfObjects(unsigned int depth = MaximumDepth, - char *name = NULL); + char *name = ITK_NULLPTR); /** Set the list of pointers to children to the list passed as * argument. */ @@ -84,7 +84,7 @@ /** Returns the latest modified time of all the objects contained * in this SceneSpatialObject object. */ - ModifiedTimeType GetMTime(void) const; + virtual ModifiedTimeType GetMTime(void) const ITK_OVERRIDE; /** Get/Set the ParentID */ void SetParentId(int parentid) { m_ParentId = parentid; } @@ -122,7 +122,7 @@ virtual ~SceneSpatialObject(); /** Print the object informations in a stream. */ - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Parent ID : default = -1 */ int m_ParentId; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSceneSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ /** Constructor */ template< unsigned int TSpaceDimension > SceneSpatialObject< TSpaceDimension > -::SceneSpatialObject() +::SceneSpatialObject() : m_ParentId(0) {} /** Destructor */ @@ -106,7 +106,7 @@ while ( it != itEnd ) { - if ( name == NULL || strstr(typeid( **it ).name(), name) ) + if ( name == ITK_NULLPTR || strstr(typeid( **it ).name(), name) ) { newList->push_back(*it); } @@ -155,7 +155,7 @@ unsigned int cnt = 0; while ( it != itEnd ) { - if ( name == NULL || strstr(typeid( **it ).name(), name) ) + if ( name == ITK_NULLPTR || strstr(typeid( **it ).name(), name) ) { cnt++; } @@ -247,7 +247,7 @@ it++; } - return NULL; + return ITK_NULLPTR; } template< unsigned int TSpaceDimension > @@ -268,7 +268,7 @@ SpatialObject< TSpaceDimension > *parentObject = static_cast< SpatialObject< TSpaceDimension > * > ( this->GetObjectById(parentId) ); - if ( parentObject == NULL ) + if ( parentObject == ITK_NULLPTR ) { ret = false; ++it; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.h 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ protected: SpatialObjectDuplicator(); virtual ~SpatialObjectDuplicator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void CopyObject(const InternalSpatialObjectType *source, InternalSpatialObjectType *destination); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectDuplicator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ SpatialObjectDuplicator< TInputSpatialObject > ::SpatialObjectDuplicator() { - m_Input = NULL; - m_Output = NULL; + m_Input = ITK_NULLPTR; + m_Output = ITK_NULLPTR; m_InternalSpatialObjectTime = 0; SpatialObjectFactoryBase::RegisterDefaultSpatialObjects(); } @@ -50,7 +50,7 @@ typedef itk::SpatialObject< TInputSpatialObject::ObjectDimension > SOType; SOType *newSO = dynamic_cast< SOType * >( i.GetPointer() ); - if ( newSO == NULL ) + if ( newSO == ITK_NULLPTR ) { std::cout << "Could not create an instance of " << value << std::endl << "The usual cause of this error is not registering the " diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectFactoryBase.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectFactoryBase.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectFactoryBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectFactoryBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -47,9 +47,9 @@ typedef SmartPointer< const Self > ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char * GetITKSourceVersion(void) const; + virtual const char * GetITKSourceVersion(void) const ITK_OVERRIDE; - virtual const char * GetDescription(void) const; + virtual const char * GetDescription(void) const ITK_OVERRIDE; /** Run-time type information (and related methods). */ itkTypeMacro(SpatialObjectFactoryBase, ObjectFactoryBase); @@ -63,7 +63,7 @@ /** Register this SpatialObject */ static SpatialObjectFactoryBase * GetFactory() { - if ( m_Factory == 0 ) + if ( m_Factory == ITK_NULLPTR ) { // Make and register the factory SpatialObjectFactoryBase::Pointer p = SpatialObjectFactoryBase::New(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -167,7 +167,7 @@ /** Returns the value at a point */ virtual bool ValueAt(const PointType & point, double & value, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Returns true if the object can provide a "meaningful" value at * a point. Often defaults to returning same answer as IsInside, but @@ -177,12 +177,12 @@ */ virtual bool IsEvaluableAt(const PointType & point, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Returns true if a point is inside the object. */ virtual bool IsInside(const PointType & point, unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Returns true if a point is inside the object - provided * to make spatial objects compatible with spatial functions @@ -198,11 +198,11 @@ short unsigned int order, OutputVectorType & value, unsigned int depth = 0, - char *name = NULL); + char *name = ITK_NULLPTR); /** Returns the latest modified time of the spatial object, and * any of its components. */ - ModifiedTimeType GetMTime(void) const; + virtual ModifiedTimeType GetMTime(void) const ITK_OVERRIDE; /** Returns the latest modified time of the spatial object, but not * the modification time of the children */ @@ -249,7 +249,7 @@ * region of the data object passed in as a parameter. This method * implements the API from DataObject. The data object parameter must be * castable to an ImageBase. */ - virtual void SetRequestedRegion(const DataObject *data); + virtual void SetRequestedRegion(const DataObject *data) ITK_OVERRIDE; /** Get the region object that defines the size and starting index * for the region of the image requested (i.e., the region of the @@ -315,7 +315,7 @@ * ImageBase has more meta-data than its DataObject. Thus, it must * provide its own version of CopyInformation() in order to copy the * LargestPossibleRegion from the input parameter. */ - virtual void CopyInformation(const DataObject *data); + virtual void CopyInformation(const DataObject *data) ITK_OVERRIDE; /** Update the information for this DataObject so that it can be used * as an output of a ProcessObject. This method is used the pipeline @@ -324,12 +324,12 @@ * ProcessObject::UpdateOutputInformation() which determines modified * times, LargestPossibleRegions, and any extra meta data like spacing, * origin, etc. */ - virtual void UpdateOutputInformation(); + virtual void UpdateOutputInformation() ITK_OVERRIDE; /** Set the RequestedRegion to the LargestPossibleRegion. This * forces a filter to produce all of the output in one execution * (i.e. not streaming) on the next call to Update(). */ - virtual void SetRequestedRegionToLargestPossibleRegion(); + virtual void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE; /** Determine whether the RequestedRegion is outside of the * BufferedRegion. This method returns true if the RequestedRegion @@ -340,7 +340,7 @@ * inside the BufferedRegion from the previous execution (and the * current filter is up to date), then a given filter does not need * to re-execute */ - virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); + virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE; /** Verify that the RequestedRegion is within the * LargestPossibleRegion. If the RequestedRegion is not within the @@ -350,7 +350,7 @@ * used by PropagateRequestedRegion(). PropagateRequestedRegion() * throws a InvalidRequestedRegionError exception is the requested * region is not within the LargestPossibleRegion. */ - virtual bool VerifyRequestedRegion(); + virtual bool VerifyRequestedRegion() ITK_OVERRIDE; /** Returns a pointer to the property object applied to this class. */ PropertyType * GetProperty(void); @@ -369,7 +369,7 @@ itkGetConstReferenceMacro(ParentId, int); /** Specify that the object has been updated */ - virtual void Update(void); + virtual void Update(void) ITK_OVERRIDE; /** Set the tree container */ itkSetObjectMacro(TreeNode, TreeNodeType) @@ -447,11 +447,11 @@ * \warning User is responsible for freeing the list, but not the elements of * the list. */ virtual ChildrenListType * GetChildren(unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Returns the number of children currently assigned to the object. */ unsigned int GetNumberOfChildren(unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; /** Set the list of pointers to children to the list passed as argument. */ void SetChildren(ChildrenListType & children); @@ -491,8 +491,8 @@ return false; } - /** Get the bounding box of the object. - * This function calls ComputeBoundingBox() */ + /** Get a pointer to the bounding box of the object. + * The extents and the position of the box are not computed. */ virtual BoundingBoxType * GetBoundingBox() const; /** Set/Get the depth at which the bounding box is computed */ @@ -537,7 +537,7 @@ /** Destructor. */ virtual ~SpatialObject(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Calculate the offsets needed to move from one pixel to the next * along a row, column, slice, volume, etc. These offsets are based diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ m_Bounds = BoundingBoxType::New(); m_BoundsMTime = 0; m_Property = PropertyType::New(); - m_TreeNode = NULL; + m_TreeNode = ITK_NULLPTR; m_ObjectToWorldTransform = TransformType::New(); m_ObjectToWorldTransform->SetIdentity(); @@ -593,7 +593,7 @@ { if ( !m_TreeNode ) { - return 0; + return ITK_NULLPTR; } typename TreeNodeType::ChildrenListType * children = @@ -668,7 +668,7 @@ { return m_TreeNode->GetParent()->Get(); } - return NULL; + return ITK_NULLPTR; } /** Get the parent of the spatial object */ @@ -681,7 +681,7 @@ { return m_TreeNode->GetParent()->Get(); } - return NULL; + return ITK_NULLPTR; } /** Set the parent of the spatial object */ @@ -845,17 +845,15 @@ { const SpatialObject *imgData = dynamic_cast< const SpatialObject * >( data ); - if ( imgData ) - { - m_RequestedRegion = imgData->GetRequestedRegion(); - } - else + if ( imgData == ITK_NULLPTR) { // pointer could not be cast back down itkExceptionMacro( << "itk::ImageBase::SetRequestedRegion(const DataObject *) cannot cast " << typeid( data ).name() << " to " << typeid( SpatialObject * ).name() ); } + + m_RequestedRegion = imgData->GetRequestedRegion(); } template< unsigned int TDimension > @@ -979,12 +977,7 @@ imgData = dynamic_cast< const SpatialObject * >( data ); - if ( imgData ) - { - // Copy the meta data for this data type - m_LargestPossibleRegion = imgData->GetLargestPossibleRegion(); - } - else + if ( imgData == ITK_NULLPTR ) { // pointer could not be cast back down itkExceptionMacro( << "itk::SpatialObject::CopyInformation() cannot cast " @@ -992,6 +985,9 @@ << typeid( SpatialObject * ).name() ); } + // Copy the meta data for this data type + m_LargestPossibleRegion = imgData->GetLargestPossibleRegion(); + // check if we are the same type const Self *source = dynamic_cast< const Self * >( data ); if ( !source ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectProperty.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectProperty.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectProperty.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectProperty.h 2014-09-03 08:29:34.000000000 +0000 @@ -81,7 +81,7 @@ protected: - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void Modified(void){ m_MTime++; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -111,7 +111,7 @@ protected: SpatialObjectToImageStatisticsCalculator(); virtual ~SpatialObjectToImageStatisticsCalculator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; bool ComputeStatistics(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,8 +32,8 @@ SpatialObjectToImageStatisticsCalculator< TInputImage, TInputSpatialObject, TSampleDimension > ::SpatialObjectToImageStatisticsCalculator() { - m_Image = NULL; - m_SpatialObject = NULL; + m_Image = ITK_NULLPTR; + m_SpatialObject = ITK_NULLPTR; m_Mean.Fill(0); m_CovarianceMatrix.SetIdentity(); m_SampleDirection = TSampleDimension - 1; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeContainer.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeContainer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeContainer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeContainer.h 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ * * Template parameters for class Array: * - * - TValueType = Element type stored at each location in the array. + * - TValue = Element type stored at each location in the array. * * \ingroup DataRepresentation * \ingroup ITKSpatialObjects diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.h 2014-09-03 08:29:34.000000000 +0000 @@ -69,7 +69,7 @@ /** Return a list of children (the list should be deleted by the user */ #if !defined( CABLE_CONFIGURATION ) virtual ChildrenListType * GetChildren(unsigned int depth = 0, - char *name = NULL) const; + char *name = ITK_NULLPTR) const; #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSpatialObjectTreeNode.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ m_NodeToParentNodeTransform->SetIdentity(); m_NodeToWorldTransform = TransformType::New(); m_NodeToWorldTransform->SetIdentity(); - this->m_Parent = NULL; + this->m_Parent = ITK_NULLPTR; } template< unsigned int TDimension > @@ -88,7 +88,7 @@ while ( childrenListIt != childrenListEnd ) { - if ( name == NULL || strstr(typeid( *( ( *childrenListIt )->Get() ) ).name(), + if ( name == ITK_NULLPTR || strstr(typeid( *( ( *childrenListIt )->Get() ) ).name(), name) ) { children->push_back(*childrenListIt); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -84,14 +84,14 @@ /** Returns true if the Surface is evaluable at the requested point, * false otherwise. */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the Surface at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy Surfaces. */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside the Surface, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkSurfaceSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -176,7 +176,7 @@ { itkDebugMacro("Checking the point [" << point << "is on the surface"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { @@ -369,7 +369,7 @@ + v2[0] * ( v3[1] - v1[1] ) + v3[0] * ( v1[1] - v2[1] ) ); - absvec = -vcl_sqrt ( (double)( ( coa * coa ) + ( cob * cob ) + ( coc * coc ) ) ); + absvec = -std::sqrt ( (double)( ( coa * coa ) + ( cob * cob ) + ( coc * coc ) ) ); if ( absvec == 0 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.h otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.h --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -113,14 +113,14 @@ /** Returns true if the tube is evaluable at the requested point, * false otherwise. */ bool IsEvaluableAt(const PointType & point, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns the value of the tube at that point. * Currently this function returns a binary value, * but it might want to return a degree of membership * in case of fuzzy tubes. */ bool ValueAt(const PointType & point, double & value, - unsigned int depth = 0, char *name = NULL) const; + unsigned int depth = 0, char *name = ITK_NULLPTR) const; /** Returns true if the point is inside the tube, false otherwise. */ bool IsInside(const PointType & point, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/include/itkTubeSpatialObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -240,7 +240,7 @@ double lambda = A / B; if ( ( ( it != m_Points.begin() ) - && ( lambda > -( ( *it ).GetRadius() / ( 2 * vcl_sqrt(B) ) ) ) + && ( lambda > -( ( *it ).GetRadius() / ( 2 * std::sqrt(B) ) ) ) && ( lambda < 0 ) ) || ( ( lambda <= 1.0 ) && ( lambda >= 0.0 ) ) ) @@ -297,7 +297,7 @@ it++; } - double dist = vcl_sqrt(minSquareDist); + double dist = std::sqrt(minSquareDist); if ( dist <= ( ( *min ).GetRadius() ) ) { return true; @@ -314,7 +314,7 @@ { itkDebugMacro("Checking the point [" << point << "] is inside the tube"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { @@ -408,7 +408,7 @@ l = l + t[i] * t[i]; } - l = vcl_sqrt(l); + l = std::sqrt(l); if ( l == 0 ) { std::cerr << "TubeSpatialObject::ComputeTangentAndNormals() : "; @@ -545,7 +545,7 @@ // check if we are the same type const Self *source = dynamic_cast< const Self * >( data ); - if ( !source ) + if ( source == ITK_NULLPTR ) { std::cout << "CopyInformation: objects are not of the same type" << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkArrowSpatialObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkArrowSpatialObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkArrowSpatialObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkArrowSpatialObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ if ( m_Length != 0.0 ) { - m_Length = vcl_sqrt(m_Length); + m_Length = std::sqrt(m_Length); } else { @@ -70,11 +70,11 @@ { if ( m_Direction[0] < 0.0 ) { - anglez = vnl_math::pi + vcl_atan(m_Direction[1] / m_Direction[0]); + anglez = vnl_math::pi + std::atan(m_Direction[1] / m_Direction[0]); } else { - anglez = vcl_atan(m_Direction[1] / m_Direction[0]); + anglez = std::atan(m_Direction[1] / m_Direction[0]); } } const double angley = -asin(m_Direction[2]); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkCylinderSpatialObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -72,7 +72,7 @@ double lambda = A / B; if ( ( - ( lambda > -( m_Radius / ( 2 * vcl_sqrt(B) ) ) ) + ( lambda > -( m_Radius / ( 2 * std::sqrt(B) ) ) ) && ( lambda < 0 ) ) || ( ( lambda <= 1.0 ) && ( lambda >= 0.0 ) ) ) @@ -103,7 +103,7 @@ { itkDebugMacro("Checking the point [" << point << "] is inside the Cylinder"); - if ( name == NULL ) + if ( name == ITK_NULLPTR ) { if ( IsInside(point) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkSpatialObjectFactoryBase.cxx otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkSpatialObjectFactoryBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkSpatialObjectFactoryBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/src/itkSpatialObjectFactoryBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,7 @@ namespace itk { -SpatialObjectFactoryBase *SpatialObjectFactoryBase:: m_Factory = 0; +SpatialObjectFactoryBase *SpatialObjectFactoryBase:: m_Factory = ITK_NULLPTR; SpatialObjectFactoryBase::SpatialObjectFactoryBase() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObjectPoint.wrap otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObjectPoint.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObjectPoint.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObjectPoint.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,12 +1,7 @@ -itk_wrap_class("itk::DTITubeSpatialObjectPoint") -# foreach(d ${ITK_WRAP_DIMS}) -# itk_wrap_template("${d}" "${d}") -# endforeach(d) +itk_wrap_filter_dims(has_d_3 3) - # seems to be usable only with dim=3 - itk_wrap_filter_dims(d 3) - if(d) +if(has_d_3) + itk_wrap_class("itk::DTITubeSpatialObjectPoint") itk_wrap_template(3 3) - endif(d) - -itk_end_wrap_class() + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObject.wrap otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObject.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObject.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/SpatialObjects/wrapping/itkDTITubeSpatialObject.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,12 +1,7 @@ -itk_wrap_class("itk::DTITubeSpatialObject" POINTER_WITH_SUPERCLASS) -# foreach(d ${ITK_WRAP_DIMS}) -# itk_wrap_template(${d} ${d}) -# endforeach(d) +itk_wrap_filter_dims(has_d_3 3) - # seems to be usable only with dim=3 - itk_wrap_filter_dims(d 3) - if(d) +if(has_d_3) + itk_wrap_class("itk::DTITubeSpatialObject" POINTER_WITH_SUPERCLASS) itk_wrap_template(3 3) - endif(d) - -itk_end_wrap_class() + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -179,8 +179,8 @@ * rotation angle is in radians. The axis of rotation goes * through the origin. The transformation is given by * - * y[axis1] = vcl_cos(angle)*x[axis1] + vcl_sin(angle)*x[axis2] - * y[axis2] = -sin(angle)*x[axis1] + vcl_cos(angle)*x[axis2]. + * y[axis1] = std::cos(angle)*x[axis1] + std::sin(angle)*x[axis2] + * y[axis2] = -sin(angle)*x[axis1] + std::cos(angle)*x[axis2]. * * All coordinates other than axis1 and axis2 are unchanged; * a rotation of pi/2 radians will carry +axis1 into +axis2. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAffineTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -152,10 +152,10 @@ } trans[i][i] = 1.0; } - trans[axis1][axis1] = vcl_cos(angle); - trans[axis1][axis2] = vcl_sin(angle); - trans[axis2][axis1] = -vcl_sin(angle); - trans[axis2][axis2] = vcl_cos(angle); + trans[axis1][axis1] = std::cos(angle); + trans[axis1][axis2] = std::sin(angle); + trans[axis2][axis1] = -std::sin(angle); + trans[axis2][axis2] = std::cos(angle); if ( pre ) { this->SetVarMatrix(this->GetMatrix() * trans); @@ -180,10 +180,10 @@ { MatrixType trans; - trans[0][0] = vcl_cos(angle); - trans[0][1] = -vcl_sin(angle); - trans[1][0] = vcl_sin(angle); - trans[1][1] = vcl_cos(angle); + trans[0][0] = std::cos(angle); + trans[0][1] = -std::sin(angle); + trans[1][0] = std::sin(angle); + trans[1][1] = std::cos(angle); if ( pre ) { this->SetVarMatrix(this->GetMatrix() * trans); @@ -211,16 +211,16 @@ ScalarType q0, q1, q2, q3; // Convert the axis to a unit vector - r = vcl_sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); + r = std::sqrt(axis[0] * axis[0] + axis[1] * axis[1] + axis[2] * axis[2]); x1 = axis[0] / r; x2 = axis[1] / r; x3 = axis[2] / r; // Compute quaternion elements - q0 = vcl_cos(angle / 2.0); - q1 = x1 * vcl_sin(angle / 2.0); - q2 = x2 * vcl_sin(angle / 2.0); - q3 = x3 * vcl_sin(angle / 2.0); + q0 = std::cos(angle / 2.0); + q1 = x1 * std::sin(angle / 2.0); + q2 = x2 * std::sin(angle / 2.0); + q3 = x3 * std::sin(angle / 2.0); // Compute elements of the rotation matrix trans[0][0] = q0 * q0 + q1 * q1 - q2 * q2 - q3 * q3; @@ -297,7 +297,7 @@ { Pointer inv = New(); - return this->GetInverse(inv) ? inv.GetPointer() : NULL; + return this->GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } /** Compute a distance between two affine transforms */ @@ -318,7 +318,7 @@ term = this->GetOffset()[i] - other->GetOffset()[i]; result += term * term; } - return vcl_sqrt(result); + return std::sqrt(result); } /** Compute a distance between self and the identity transform */ @@ -347,7 +347,7 @@ result += term * term; } - return vcl_sqrt(result); + return std::sqrt(result); } } // namespace diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -37,15 +37,15 @@ * * The equations form performing the conversion from azimuth-elevation * coordinates to cartesian coordinates are as follows: - * z = vcl_sqrt((r^2*(cos(azimuth))^2)/(1 + (cos(azimuth))^2 * + * z = std::sqrt((r^2*(cos(azimuth))^2)/(1 + (cos(azimuth))^2 * * (tan(elevation))^2); - * x = z * vcl_tan(azimuth) - * y = z * vcl_tan(elevation) + * x = z * std::tan(azimuth) + * y = z * std::tan(elevation) * * The reversed transforms are: * azimuth = arctan(x/y) * elevation = arctan(y/z) - * r = vcl_sqrt(x^2 + y^2 + z^2) + * r = std::sqrt(x^2 + y^2 + z^2) * * In this class, we can also set what a "forward" transform means. If we call * SetForwardAzimuthElevationToCartesian(), a forward transform will return diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkAzimuthElevationToCartesianTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -107,13 +107,13 @@ - ( ( m_MaxElevation - 1 ) / 2.0 ) ); ScalarType r = ( m_FirstSampleDistance + point[2] ) * m_RadiusSampleSize; - ScalarType cosOfAzimuth = vcl_cos(Azimuth); - ScalarType tanOfElevation = vcl_tan(Elevation); + ScalarType cosOfAzimuth = std::cos(Azimuth); + ScalarType tanOfElevation = std::tan(Elevation); - result[2] = vcl_sqrt( ( r * r * cosOfAzimuth * cosOfAzimuth ) + result[2] = std::sqrt( ( r * r * cosOfAzimuth * cosOfAzimuth ) / ( 1 + cosOfAzimuth * cosOfAzimuth * tanOfElevation * tanOfElevation ) ); - result[0] = result[2] * vcl_tan(Azimuth); + result[0] = result[2] * std::tan(Azimuth); result[1] = result[2] * tanOfElevation; return result; } @@ -126,11 +126,11 @@ { InputPointType result; // Converted point - result[0] = ( vcl_atan(point[0] / point[2]) ) * ( 360 / ( 2 * vnl_math::pi ) ) + result[0] = ( std::atan(point[0] / point[2]) ) * ( 360 / ( 2 * vnl_math::pi ) ) + ( ( m_MaxAzimuth - 1 ) / 2.0 ); - result[1] = ( vcl_atan(point[1] / point[2]) ) * ( 360 / ( 2 * vnl_math::pi ) ) + result[1] = ( std::atan(point[1] / point[2]) ) * ( 360 / ( 2 * vnl_math::pi ) ) + ( ( m_MaxElevation - 1 ) / 2.0 ); - result[2] = ( ( vcl_sqrt(point[0] * point[0] + result[2] = ( ( std::sqrt(point[0] * point[0] + point[1] * point[1] + point[2] * point[2]) / m_RadiusSampleSize ) - m_FirstSampleDistance ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineBaseTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineBaseTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineBaseTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineBaseTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -249,7 +249,6 @@ virtual OutputVectorType TransformVector( const InputVectorType & ) const { itkExceptionMacro( << "Method not applicable for deformable transform." ); - return OutputVectorType(); } /** Method to transform a vnl_vector - @@ -257,7 +256,6 @@ virtual OutputVnlVectorType TransformVector( const InputVnlVectorType & ) const { itkExceptionMacro( << "Method not applicable for deformable transform. " ); - return OutputVnlVectorType(); } /** Method to transform a CovariantVector - @@ -267,7 +265,6 @@ const InputCovariantVectorType & ) const { itkExceptionMacro( << "Method not applicable for deformable transfrom. " ); - return OutputCovariantVectorType(); } /** Get Jacobian at a point. A very specialized function just for BSplines */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -507,7 +507,7 @@ } // if no coefficients are set, this isn't a proper BSpline Transform - if( this->m_CoefficientImages[0]->GetBufferPointer() == 0) + if( this->m_CoefficientImages[0]->GetBufferPointer() == ITK_NULLPTR) { itkExceptionMacro( "B-spline coefficients have not been set" ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -218,8 +218,7 @@ } } this->m_CoefficientImages[0]->SetDirection( direction ); - this->m_CoefficientImages[0]->Allocate(); - this->m_CoefficientImages[0]->FillBuffer( 0 ); + this->m_CoefficientImages[0]->Allocate(true); // initializes buffer to zero // Copy the information to the rest of the images for( unsigned int i = 1; i < SpaceDimension; i++ ) @@ -227,8 +226,7 @@ this->m_CoefficientImages[i]->CopyInformation( this->m_CoefficientImages[0] ); this->m_CoefficientImages[i]->SetRegions( this->m_CoefficientImages[0]->GetLargestPossibleRegion() ); - this->m_CoefficientImages[i]->Allocate(); - this->m_CoefficientImages[i]->FillBuffer( 0 ); + this->m_CoefficientImages[i]->Allocate(true); // initialize buffer to zero } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.h 2014-09-03 08:29:34.000000000 +0000 @@ -100,7 +100,7 @@ BSplineTransformInitializer(); ~BSplineTransformInitializer(); - void PrintSelf( std::ostream & os, Indent indent ) const; + virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE; private: BSplineTransformInitializer( const Self & ); //purposely not diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkBSplineTransformInitializer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ template BSplineTransformInitializer ::BSplineTransformInitializer() : - m_Transform( NULL ), + m_Transform( ITK_NULLPTR ), m_SetTransformDomainMeshSizeViaInitializer( false ) { this->m_TransformDomainMeshSize.Fill( 1 ); @@ -123,7 +123,7 @@ // We also store the corners using the point set class which gives us easy // access to the bounding box. - const CoordRepType BSplineTransformDomainEpsilon = vcl_pow( 2.0, -3 ); + const CoordRepType BSplineTransformDomainEpsilon = std::pow( 2.0, -3 ); ContinuousIndexType startIndex; for( unsigned int i = 0; i < SpaceDimension; i++ ) @@ -132,7 +132,7 @@ BSplineTransformDomainEpsilon; } - for( unsigned int d = 0; d < vcl_pow( 2.0, SpaceDimension ); d++ ) + for( unsigned int d = 0; d < std::pow( 2.0, SpaceDimension ); d++ ) { ContinuousIndexType whichIndex; for( unsigned int i = 0; i < SpaceDimension; i++ ) @@ -200,7 +200,7 @@ for( unsigned int i = 0; i < SpaceDimension; i++ ) { PointIdentifier oppositeCornerId = static_cast( - vcl_pow( 2.0, static_cast( i ) ) ) ^ transformDomainOriginId; + std::pow( 2.0, static_cast( i ) ) ) ^ transformDomainOriginId; PointType corner; corner.Fill( 0.0 ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredAffineTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredAffineTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredAffineTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredAffineTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -182,7 +182,7 @@ { Pointer inv = New(); - return this->GetInverse(inv) ? inv.GetPointer() : NULL; + return this->GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } } // namespace diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredEuler3DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredEuler3DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredEuler3DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredEuler3DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -80,7 +80,6 @@ this->SetVarRotation(angleX, angleY, angleZ); CenterType newCenter; - typedef typename CenterType::ValueType CenterValueType; newCenter[0] = parameters[3]; newCenter[1] = parameters[4]; newCenter[2] = parameters[5]; @@ -139,12 +138,12 @@ ::ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & jacobian) const { // need to check if angles are in the right order - const double cx = vcl_cos( this->GetAngleX() ); - const double sx = vcl_sin( this->GetAngleX() ); - const double cy = vcl_cos( this->GetAngleY() ); - const double sy = vcl_sin( this->GetAngleY() ); - const double cz = vcl_cos( this->GetAngleZ() ); - const double sz = vcl_sin( this->GetAngleZ() ); + const double cx = std::cos( this->GetAngleX() ); + const double sx = std::sin( this->GetAngleX() ); + const double cy = std::cos( this->GetAngleY() ); + const double sy = std::sin( this->GetAngleY() ); + const double cz = std::cos( this->GetAngleZ() ); + const double sz = std::sin( this->GetAngleZ() ); jacobian.SetSize( 3, this->GetNumberOfLocalParameters() ); jacobian.Fill(0.0); @@ -217,7 +216,7 @@ { Pointer inv = New(); - return this->GetInverse(inv) ? inv.GetPointer() : NULL; + return this->GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } // Print self diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredRigid2DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredRigid2DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredRigid2DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredRigid2DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -130,8 +130,8 @@ CenteredRigid2DTransform ::ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & jacobian) const { - const double ca = vcl_cos( this->GetAngle() ); - const double sa = vcl_sin( this->GetAngle() ); + const double ca = std::cos( this->GetAngle() ); + const double sa = std::sin( this->GetAngle() ); jacobian.SetSize( 2, this->GetNumberOfLocalParameters() ); jacobian.Fill(0.0); @@ -212,7 +212,7 @@ { Pointer inv = New(); - return GetInverse(inv) ? inv.GetPointer() : NULL; + return GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } // Create and return an clone transformation diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredSimilarity2DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredSimilarity2DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredSimilarity2DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCenteredSimilarity2DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -119,8 +119,8 @@ ::ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & jacobian) const { const double angle = this->GetAngle(); - const double ca = vcl_cos(angle); - const double sa = vcl_sin(angle); + const double ca = std::cos(angle); + const double sa = std::sin(angle); jacobian.SetSize( 2, this->GetNumberOfLocalParameters() ); jacobian.Fill(0.0); @@ -218,7 +218,7 @@ { return inv.GetPointer(); } - return NULL; + return ITK_NULLPTR; } // Create and return a clone of the transformation diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -358,7 +358,18 @@ * Compute the Jacobian with respect to the parameters for the compositie * transform using Jacobian rule. See comments in the implementation. */ - virtual void ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & j) const; + virtual void ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & j) const ITK_OVERRIDE; + + /** + * Expanded interface to Compute the Jacobian with respect to the parameters for the compositie + * transform using Jacobian rule. This version takes in temporary + * variables to avoid excessive constructions. + * NOTE: outJacobian and jacobianWithRespectToPosition MUST be sized + * prior to the call; outJacobian's size should be + * [NDimensions, this->GetNumberOfLocalParameters() ] + * jacobianWithRespectToPosition size == [ NDimensions, NDimensions ] + */ + virtual void ComputeJacobianWithRespectToParametersCachedTemporaries( const InputPointType & p, JacobianType & outJacobian, JacobianType & jacobianWithRespectToPosition ) const ITK_OVERRIDE; protected: CompositeTransform(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkCompositeTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -653,7 +653,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } @@ -661,14 +661,27 @@ void CompositeTransform -::ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & j ) const +::ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & outJacobian ) const { /* Returns a concatenated MxN array, holding the Jacobian of each sub * transform that is selected for optimization. The order is the same * as that in which they're applied, i.e. reverse order. * M rows = dimensionality of the transforms * N cols = total number of parameters in the selected sub transforms. */ - j.SetSize( NDimensions, this->GetNumberOfLocalParameters() ); + outJacobian.SetSize( NDimensions, this->GetNumberOfLocalParameters() ); + JacobianType jacobianWithRespectToPosition(NDimensions, NDimensions); + this->ComputeJacobianWithRespectToParametersCachedTemporaries( p, outJacobian, jacobianWithRespectToPosition ); +} + +template + +void +CompositeTransform +::ComputeJacobianWithRespectToParametersCachedTemporaries( const InputPointType & p, JacobianType & outJacobian, JacobianType & jacobianWithRespectToPosition ) const +{ + //NOTE: This must have been done outside of outJacobian.SetSize( NDimensions, this->GetNumberOfLocalParameters() ); + //NOTE: assert( outJacobian.GetSize == ( NDimensions, this->GetNumberOfLocalParameters() ) ) + //NOTE: assert( jacobianWithRespectToPosition.GetSize == (NDimensions, NDimensions) ) NumberOfParametersType offset = NumericTraits< NumberOfParametersType >::Zero; @@ -715,12 +728,12 @@ * */ for( signed long tind = (signed long) this->GetNumberOfTransforms() - 1; - tind >= 0; tind-- ) + tind >= 0; --tind ) { /* Get a raw pointer for efficiency, avoiding SmartPointer register/unregister */ - const TransformType * transform = this->GetNthTransformConstPointer( tind ); + const TransformType * const transform = this->GetNthTransformConstPointer( tind ); - NumberOfParametersType offsetLast = offset; + const NumberOfParametersType offsetLast = offset; if( this->GetNthTransformToOptimize( tind ) ) { @@ -729,12 +742,11 @@ * better */ // to do: why parameters are listed from N-1 to 1??? - typename TransformType::JacobianType current_jacobian; - NumberOfParametersType numberOfLocalParameters = transform->GetNumberOfLocalParameters(); + const NumberOfParametersType numberOfLocalParameters = transform->GetNumberOfLocalParameters(); - current_jacobian.SetSize( NDimensions, numberOfLocalParameters ); + typename TransformType::JacobianType current_jacobian( NDimensions, numberOfLocalParameters ); transform->ComputeJacobianWithRespectToParameters( transformedPoint, current_jacobian ); - j.update( current_jacobian, 0, offset ); + outJacobian.update( current_jacobian, 0, offset ); offset += numberOfLocalParameters; } @@ -744,28 +756,24 @@ * jacobian by multiplying the current matrix jumping over the * first transform. The matrix here refers to dT/dx at the point. * For example, in the affine transform, this is the affine matrix. - * TODO1: for general transform, there should be something like + * + * TODO: for general transform, there should be something like * GetPartialDerivativeOfPointCoordinates * * Also, noted the multiplication contains all the affine matrix from * all transforms no matter they are going to be optimized or not - * */ // update every old term by left multiplying dTk / dT{k-1} // do this before computing the transformedPoint for the next iteration if( offsetLast > 0 ) { + transform->ComputeJacobianWithRespectToPosition(transformedPoint, jacobianWithRespectToPosition); - JacobianType old_j = j.extract(NDimensions, offsetLast, 0, 0); - - JacobianType j1; - - j1.SetSize(NDimensions, NDimensions); - - transform->ComputeJacobianWithRespectToPosition(transformedPoint, j1); + const JacobianType & old_j = outJacobian.extract(NDimensions, offsetLast, 0, 0); + const JacobianType & update_j = jacobianWithRespectToPosition * old_j; - j.update(j1 * old_j, 0, 0); + outJacobian.update(update_j, 0, 0); // itkExceptionMacro(" To sort out with new ComputeJacobianWithRespectToPosition prototype "); } @@ -1074,8 +1082,13 @@ /* The input values are in a monolithic block, so we have to point * to the subregion corresponding to the individual subtransform. * This simply creates an Array object with data pointer, no - * memory is allocated or copied. */ - DerivativeType subUpdate( &( (update.data_block() )[offset]), + * memory is allocated or copied. + * NOTE: the use of const_cast is used to avoid a deep copy in the underlying vnl_vector + * by using LetArrayManageMemory=false, and being very careful here we can + * ensure that casting away consteness does not result in memory corruption. */ + typename DerivativeType::ValueType * nonConstDataRefForPerformance = + const_cast< typename DerivativeType::ValueType * >( &( (update.data_block() )[offset]) ); + const DerivativeType subUpdate( nonConstDataRefForPerformance, subtransform->GetNumberOfParameters(), false ); /* This call will also call SetParameters, so don't need to call it * expliclity here. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler2DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler2DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler2DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler2DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -69,7 +69,7 @@ { Pointer inv = New(); - return GetInverse(inv) ? inv.GetPointer() : NULL; + return GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } // Create and return an inverse transformation diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler3DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler3DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler3DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkEuler3DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -152,45 +152,45 @@ { if( m_ComputeZYX ) { - m_AngleY = -vcl_asin(this->GetMatrix()[2][0]); - double C = vcl_cos(m_AngleY); - if( vcl_fabs(C) > 0.00005 ) + m_AngleY = -std::asin(this->GetMatrix()[2][0]); + double C = std::cos(m_AngleY); + if( std::fabs(C) > 0.00005 ) { double x = this->GetMatrix()[2][2] / C; double y = this->GetMatrix()[2][1] / C; - m_AngleX = vcl_atan2(y, x); + m_AngleX = std::atan2(y, x); x = this->GetMatrix()[0][0] / C; y = this->GetMatrix()[1][0] / C; - m_AngleZ = vcl_atan2(y, x); + m_AngleZ = std::atan2(y, x); } else { m_AngleX = NumericTraits::Zero; double x = this->GetMatrix()[1][1]; double y = -this->GetMatrix()[0][1]; - m_AngleZ = vcl_atan2(y, x); + m_AngleZ = std::atan2(y, x); } } else { - m_AngleX = vcl_asin(this->GetMatrix()[2][1]); - double A = vcl_cos(m_AngleX); - if( vcl_fabs(A) > 0.00005 ) + m_AngleX = std::asin(this->GetMatrix()[2][1]); + double A = std::cos(m_AngleX); + if( std::fabs(A) > 0.00005 ) { double x = this->GetMatrix()[2][2] / A; double y = -this->GetMatrix()[2][0] / A; - m_AngleY = vcl_atan2(y, x); + m_AngleY = std::atan2(y, x); x = this->GetMatrix()[1][1] / A; y = -this->GetMatrix()[0][1] / A; - m_AngleZ = vcl_atan2(y, x); + m_AngleZ = std::atan2(y, x); } else { m_AngleZ = NumericTraits::Zero; double x = this->GetMatrix()[0][0]; double y = this->GetMatrix()[1][0]; - m_AngleY = vcl_atan2(y, x); + m_AngleY = std::atan2(y, x); } } this->ComputeMatrix(); @@ -203,12 +203,12 @@ ::ComputeMatrix(void) { // need to check if angles are in the right order - const ScalarType cx = vcl_cos(m_AngleX); - const ScalarType sx = vcl_sin(m_AngleX); - const ScalarType cy = vcl_cos(m_AngleY); - const ScalarType sy = vcl_sin(m_AngleY); - const ScalarType cz = vcl_cos(m_AngleZ); - const ScalarType sz = vcl_sin(m_AngleZ); + const ScalarType cx = std::cos(m_AngleX); + const ScalarType sx = std::sin(m_AngleX); + const ScalarType cy = std::cos(m_AngleY); + const ScalarType sy = std::sin(m_AngleY); + const ScalarType cz = std::cos(m_AngleZ); + const ScalarType sz = std::sin(m_AngleZ); const ScalarType one = NumericTraits::One; const ScalarType zero = NumericTraits::Zero; @@ -245,12 +245,12 @@ ::ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & jacobian) const { // need to check if angles are in the right order - const double cx = vcl_cos(m_AngleX); - const double sx = vcl_sin(m_AngleX); - const double cy = vcl_cos(m_AngleY); - const double sy = vcl_sin(m_AngleY); - const double cz = vcl_cos(m_AngleZ); - const double sz = vcl_sin(m_AngleZ); + const double cx = std::cos(m_AngleX); + const double sx = std::sin(m_AngleX); + const double cy = std::cos(m_AngleY); + const double sy = std::sin(m_AngleY); + const double cz = std::cos(m_AngleZ); + const double sz = std::sin(m_AngleZ); jacobian.SetSize( 3, this->GetNumberOfLocalParameters() ); jacobian.Fill(0.0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.h 2014-09-03 08:29:34.000000000 +0000 @@ -147,7 +147,7 @@ LandmarkBasedTransformInitializer(); ~LandmarkBasedTransformInitializer(){} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; // Supported Transform types typedef enum { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkLandmarkBasedTransformInitializer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,7 @@ { AffineTransformType *transform = dynamic_cast(this->m_Transform.GetPointer()); - if ( transform == 0 ) + if ( transform == ITK_NULLPTR ) { itkExceptionMacro( << "AffineTransform Expected but transform is " << this->m_Transform->GetNameOfClass() ); @@ -211,7 +211,7 @@ itkDebugMacro("Internal Initialize VersorRigid3DTransformType"); VersorRigid3DTransformType *transform = dynamic_cast< VersorRigid3DTransformType * >( this->m_Transform.GetPointer() ); - if ( transform == 0 ) + if ( transform == ITK_NULLPTR ) { itkExceptionMacro( << "VersorRigid3DTransformType Expected but transform is " << this->m_Transform->GetNameOfClass() ); @@ -249,7 +249,6 @@ typedef typename VersorRigid3DTransformType::OutputVectorType VectorType; typedef typename VersorRigid3DTransformType::OutputPointType PointType; - typedef typename VersorRigid3DTransformType::CenterType RotationCenterType; // Compute the centroids PointType fixedCentroid; @@ -406,7 +405,7 @@ Rigid2DTransformType *transform = dynamic_cast< Rigid2DTransformType * >(this->m_Transform.GetPointer() ); - if ( transform == 0 ) + if ( transform == ITK_NULLPTR ) { itkExceptionMacro( << "VersorRigid3DTransformType Expected but transform is " << this->m_Transform->GetNameOfClass() ); @@ -425,7 +424,7 @@ return; } - const double PI = 4.0 * vcl_atan(1.0); + const double PI = 4.0 * std::atan(1.0); typedef typename Rigid2DTransformType::OutputVectorType VectorType; typedef typename Rigid2DTransformType::OutputPointType PointType; @@ -510,9 +509,9 @@ } itkDebugMacro(<< "Dot Product of landmarks: " << s_dot << " Cross Product: " << s_cross); - if ( vcl_fabs(s_dot) > 0.00005 ) + if ( std::fabs(s_dot) > 0.00005 ) { - rotationAngle = vcl_atan2(s_cross, s_dot); + rotationAngle = std::atan2(s_cross, s_dot); } else { @@ -554,7 +553,7 @@ itkExceptionMacro("Different number of fixed and moving landmarks"); return; } - this->InternalInitializeTransform(static_cast(0)); + this->InternalInitializeTransform(static_cast(ITK_NULLPTR)); } template< typename TTransform, typename TFixedImage, typename TMovingImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkMatrixOffsetTransformBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -528,7 +528,7 @@ { Pointer inv = New(); - return GetInverse(inv) ? inv.GetPointer() : NULL; + return GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } // Get fixed parameters @@ -540,7 +540,6 @@ { this->m_FixedParameters = fp; InputPointType c; - typedef typename ParametersType::ValueType ParameterValueType; for( unsigned int i = 0; i < NInputDimensions; i++ ) { c[i] = this->m_FixedParameters[i]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkMultiTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkMultiTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkMultiTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkMultiTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -341,8 +341,13 @@ /* The input values are in a monolithic block, so we have to point * to the subregion corresponding to the individual subtransform. * This simply creates an Array object with data pointer, no - * memory is allocated or copied. */ - DerivativeType subUpdate( &( (update.data_block() )[offset]), subtransform->GetNumberOfParameters(), false ); + * memory is allocated or copied. + * NOTE: the use of const_cast is used to avoid a deep copy in the underlying vnl_vector + * by using LetArrayManageMemory=false, and being very careful here we can + * ensure that casting away consteness does not result in memory corruption. */ + typename DerivativeType::ValueType * nonConstDataRefForPerformance = + const_cast< typename DerivativeType::ValueType * >( &( (update.data_block() )[offset]) ); + const DerivativeType subUpdate( nonConstDataRefForPerformance, subtransform->GetNumberOfParameters(), false ); /* This call will also call SetParameters, so don't need to call it * expliclity here. */ subtransform->UpdateTransformParameters( subUpdate, factor ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkQuaternionRigidTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkQuaternionRigidTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkQuaternionRigidTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkQuaternionRigidTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ ::QuaternionRigidTransform() : Superclass(ParametersDimension) { - m_Rotation = VnlQuaternionType(0, 0, 0, 1); // axis * vcl_sin(t/2), - // vcl_cos(t/2) + m_Rotation = VnlQuaternionType(0, 0, 0, 1); // axis * std::sin(t/2), + // std::cos(t/2) } // Constructor with default arguments @@ -37,8 +37,8 @@ QuaternionRigidTransform::QuaternionRigidTransform(unsigned int parametersDimension) : Superclass(parametersDimension) { - m_Rotation = VnlQuaternionType(0, 0, 0, 1); // axis * vcl_sin(t/2), - // vcl_cos(t/2) + m_Rotation = VnlQuaternionType(0, 0, 0, 1); // axis * std::sin(t/2), + // std::cos(t/2) } // Constructor with explicit arguments diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid2DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid2DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid2DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid2DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -100,14 +100,14 @@ vnl_matrix r(2, 2); r = svd.U() * svd.V().transpose(); - m_Angle = vcl_acos(r[0][0]); + m_Angle = std::acos(r[0][0]); if( r[1][0] < 0.0 ) { m_Angle = -m_Angle; } - if( r[1][0] - vcl_sin(m_Angle) > 0.000001 ) + if( r[1][0] - std::sin(m_Angle) > 0.000001 ) { itkWarningMacro( "Bad Rotation Matrix " << this->GetMatrix() ); } @@ -159,7 +159,7 @@ { Pointer inv = New(); - return GetInverse(inv) ? inv.GetPointer() : NULL; + return GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } // Create and return a clone of the transformation @@ -200,7 +200,7 @@ Rigid2DTransform ::SetAngleInDegrees(TScalar angle) { - const TScalar angleInRadians = angle * vcl_atan(1.0) / 45.0; + const TScalar angleInRadians = angle * std::atan(1.0) / 45.0; this->SetAngle(angleInRadians); } @@ -211,8 +211,8 @@ Rigid2DTransform ::ComputeMatrix(void) { - const MatrixValueType ca = vcl_cos(m_Angle); - const MatrixValueType sa = vcl_sin(m_Angle); + const MatrixValueType ca = std::cos(m_Angle); + const MatrixValueType sa = std::sin(m_Angle); MatrixType rotationMatrix; @@ -287,8 +287,8 @@ j.SetSize( OutputSpaceDimension, this->GetNumberOfLocalParameters() ); j.Fill(0.0); - const double ca = vcl_cos( this->GetAngle() ); - const double sa = vcl_sin( this->GetAngle() ); + const double ca = std::cos( this->GetAngle() ); + const double sa = std::sin( this->GetAngle() ); const double cx = this->GetCenter()[0]; const double cy = this->GetCenter()[1]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DPerspectiveTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DPerspectiveTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DPerspectiveTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DPerspectiveTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ axis[2] = parameters[2]; if( norm > NumericTraits::Zero ) { - norm = vcl_sqrt(norm); + norm = std::sqrt(norm); } double epsilon = 1e-10; @@ -150,8 +150,8 @@ void Rigid3DPerspectiveTransform::SetRotation(const Vector & axis, double angle) { - const double sinus = vcl_sin(angle / 2.0); - const double cosinus = vcl_cos(angle / 2.0); + const double sinus = std::sin(angle / 2.0); + const double cosinus = std::cos(angle / 2.0); Vector norm; norm = axis; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkRigid3DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -165,7 +165,7 @@ Rigid3DTransform< TScalar >::GetInverseTransform() const { Pointer inv = New(); - return this->GetInverse(inv) ? inv.GetPointer() : NULL; + return this->GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } template< typename TScalar > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScalableAffineTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScalableAffineTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScalableAffineTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScalableAffineTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -170,7 +170,7 @@ { Pointer inv = New(); - return this->GetInverse(inv) ? inv.GetPointer() : NULL; + return this->GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } /** Set the scale of the transformation */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleLogarithmicTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleLogarithmicTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleLogarithmicTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleLogarithmicTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ for( unsigned int i = 0; i < SpaceDimension; i++ ) { - scales[i] = vcl_exp(parameters[i]); + scales[i] = std::exp(parameters[i]); } // Save parameters. Needed for proper operation of TransformUpdateParameters. if( ¶meters != &(this->m_Parameters) ) @@ -71,7 +71,7 @@ // Transfer the translation part for( unsigned int i = 0; i < SpaceDimension; i++ ) { - this->m_Parameters[i] = vcl_log(scales[i]); + this->m_Parameters[i] = std::log(scales[i]); } itkDebugMacro(<< "After getting parameters " << this->m_Parameters); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleSkewVersor3DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,7 @@ axis[2] = parameters[2]; if( norm > 0 ) { - norm = vcl_sqrt(norm); + norm = std::sqrt(norm); } double epsilon = 1e-10; @@ -137,7 +137,7 @@ // // Parameters are ordered as: // -// p[0:2] = right part of the versor (axis times vcl_sin(t/2)) +// p[0:2] = right part of the versor (axis times std::sin(t/2)) // p[3:5] = translation components // p[6:8] = Scale // p[9:14] = Skew {xy, xz, yx, yz, zx, zy} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,6 @@ ScaleTransform ::SetParameters(const ParametersType & parameters) { - typedef typename ParametersType::ValueType ParameterValueType; for( unsigned int i = 0; i < SpaceDimension; i++ ) { m_Scale[i] = parameters[i]; @@ -199,7 +198,7 @@ { return inv.GetPointer(); } - return NULL; + return ITK_NULLPTR; } // Compute the Jacobian of the transformation diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleVersor3DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleVersor3DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleVersor3DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkScaleVersor3DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,7 @@ axis[2] = parameters[2]; if( norm > 0 ) { - norm = vcl_sqrt(norm); + norm = std::sqrt(norm); } double epsilon = 1e-10; @@ -132,7 +132,7 @@ // // Parameters are ordered as: // -// p[0:2] = right part of the versor (axis times vcl_sin(t/2)) +// p[0:2] = right part of the versor (axis times std::sin(t/2)) // p[3:5] = translation components // p[6:8] = Scale // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity2DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity2DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity2DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity2DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -128,8 +128,8 @@ { const double angle = this->GetAngle(); - const double cc = vcl_cos(angle); - const double ss = vcl_sin(angle); + const double cc = std::cos(angle); + const double ss = std::sin(angle); const MatrixValueType ca = cc * m_Scale; const MatrixValueType sa = ss * m_Scale; @@ -148,17 +148,17 @@ Similarity2DTransform ::ComputeMatrixParameters(void) { - m_Scale = vcl_sqrt( vnl_math_sqr(this->GetMatrix()[0][0]) + m_Scale = std::sqrt( vnl_math_sqr(this->GetMatrix()[0][0]) + vnl_math_sqr(this->GetMatrix()[0][1]) ); - this->SetVarAngle( vcl_acos(this->GetMatrix()[0][0] / m_Scale) ); + this->SetVarAngle( std::acos(this->GetMatrix()[0][0] / m_Scale) ); if( this->GetMatrix()[1][0] < 0.0 ) { this->SetVarAngle( -this->GetAngle() ); } - if( ( this->GetMatrix()[1][0] / m_Scale ) - vcl_sin( this->GetAngle() ) > 0.000001 ) + if( ( this->GetMatrix()[1][0] / m_Scale ) - std::sin( this->GetAngle() ) > 0.000001 ) { std::cout << "Bad Rotation Matrix" << std::endl; } @@ -170,8 +170,8 @@ ::ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & jacobian) const { const double angle = this->GetAngle(); - const double ca = vcl_cos(angle); - const double sa = vcl_sin(angle); + const double ca = std::cos(angle); + const double sa = std::sin(angle); jacobian.SetSize( 2, this->GetNumberOfLocalParameters() ); jacobian.Fill(0.0); @@ -255,7 +255,7 @@ { return inv.GetPointer(); } - return NULL; + return ITK_NULLPTR; } // Create and return a clone of the transformation diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkSimilarity3DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -144,7 +144,7 @@ axis[2] = parameters[2]; if( norm > 0 ) { - norm = vcl_sqrt(norm); + norm = std::sqrt(norm); } double epsilon = 1e-10; @@ -180,7 +180,7 @@ // // Parameters are ordered as: // -// p[0:2] = right part of the versor (axis times vcl_sin(t/2)) +// p[0:2] = right part of the versor (axis times std::sin(t/2)) // p[3:5} = translation components // p[6:6} = scaling factor (isotropic) // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkThinPlateR2LogRSplineKernelTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ gmatrix.fill(NumericTraits< TScalar >::Zero); const TScalar R2logR = - ( r > 1e-8 ) ? r *r *vcl_log(r):NumericTraits< TScalar >::Zero; + ( r > 1e-8 ) ? r *r *std::log(r):NumericTraits< TScalar >::Zero; gmatrix.fill_diagonal(R2logR); } @@ -51,7 +51,7 @@ InputVectorType position = thisPoint - sp->Value(); const TScalar r = position.GetNorm(); const TScalar R2logR = - ( r > 1e-8 ) ? r *r *vcl_log(r):NumericTraits< TScalar >::Zero; + ( r > 1e-8 ) ? r *r *std::log(r):NumericTraits< TScalar >::Zero; for ( unsigned int odim = 0; odim < NDimensions; odim++ ) { result[odim] += R2logR * this->m_DMatrix(odim, lnd); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -192,7 +192,6 @@ { itkExceptionMacro( "TransformVector(const InputVectorType &)" "is unimplemented for " << this->GetNameOfClass() ); - return OutputVectorType(); } /** Method to transform a vector at a given location. @@ -208,7 +207,6 @@ { itkExceptionMacro( "TransformVector( const InputVnlVectorType & ) is " "unimplemented for " << this->GetNameOfClass() ); - return OutputVnlVectorType(); } /** Method to transform a vnl_vector, at a point. @@ -225,7 +223,6 @@ { itkExceptionMacro( "TransformVector( const InputVectorPixelType & ) is " "unimplemented for " << this->GetNameOfClass() ); - return OutputVectorPixelType(); } /** Method to transform a vector stored in a VectorImage, at a point. @@ -241,7 +238,6 @@ { itkExceptionMacro( "TransformCovariantVector( const InputCovariantVectorType & ) is " "unimplemented for " << this->GetNameOfClass() ); - return OutputCovariantVectorType(); } /** Method to transform a CovariantVector, using a point. Global transforms * can ignore the \c point parameter. Local transforms (e.g. deformation @@ -259,7 +255,6 @@ { itkExceptionMacro( "TransformCovariantVector(const InputVectorPixelType &)" "is unimplemented for " << this->GetNameOfClass() ); - return OutputVectorPixelType(); } /** Method to transform a CovariantVector, using a point. Global transforms @@ -279,7 +274,6 @@ itkExceptionMacro( "TransformDiffusionTensor3D( const InputDiffusionTensor3DType & ) is " "unimplemented for " << this->GetNameOfClass() ); - return OutputDiffusionTensor3DType(); } /** Method to transform a diffusion tensor at a point. Global transforms @@ -298,7 +292,6 @@ itkExceptionMacro( "TransformDiffusionTensor( const InputVectorPixelType & ) is " "unimplemented for " << this->GetNameOfClass() ); - return OutputVectorPixelType(); } virtual OutputVectorPixelType TransformDiffusionTensor3D( @@ -321,7 +314,6 @@ itkExceptionMacro( "TransformSymmetricSecondRankTensor( const InputSymmetricSecondRankTensorType & ) is " "unimplemented for " << this->GetNameOfClass() ); - return OutputSymmetricSecondRankTensorType(); } /** Method to transform a ssr tensor stored in a VectorImage */ @@ -331,7 +323,6 @@ itkExceptionMacro( "TransformSymmetricSecondRankTensor( const InputVectorPixelType & ) is " "unimplemented for " << this->GetNameOfClass() ); - return OutputVectorPixelType(); } /** Method to transform a diffusion tensor stored in a VectorImage, at @@ -429,7 +420,7 @@ */ virtual InverseTransformBasePointer GetInverseTransform() const { - return NULL; + return ITK_NULLPTR; } /** Generate a platform independent name */ @@ -505,12 +496,12 @@ * will most likely occur during multi-threading. * To avoid repeatitive memory allocation, pass in 'jacobian' with its size * already set. */ - virtual void ComputeJacobianWithRespectToParameters(const InputPointType & itkNotUsed(p), JacobianType & itkNotUsed(jacobian) ) const + virtual void ComputeJacobianWithRespectToParameters(const InputPointType & itkNotUsed(p), JacobianType & itkNotUsed(jacobian) ) const = 0; + + virtual void ComputeJacobianWithRespectToParametersCachedTemporaries(const InputPointType & p, JacobianType & jacobian, JacobianType & itkNotUsed(jacobianWithRespectToPosition) ) const { - itkExceptionMacro( - "ComputeJacobianWithRespectToParamters( InputPointType, JacobianType" - " is unimplemented for " << this->GetNameOfClass() ); - return; + //NOTE: default implementation is not optimized, and just falls back to original methods. + this->ComputeJacobianWithRespectToParameters(p, jacobian); } @@ -524,7 +515,6 @@ itkExceptionMacro( "ComputeJacobianWithRespectToPosition( InputPointType, JacobianType" " is unimplemented for " << this->GetNameOfClass() ); - return; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -71,7 +71,7 @@ n << GetNameOfClass(); n << "_"; - n << this->GetTransformTypeAsString(static_cast(0) ); + n << this->GetTransformTypeAsString(static_cast(ITK_NULLPTR) ); n << "_" << this->GetInputSpaceDimension() << "_" << this->GetOutputSpaceDimension(); return n.str(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkTranslationTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkTranslationTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkTranslationTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkTranslationTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,6 @@ this->m_Parameters = parameters; } - typedef typename ParametersType::ValueType ParameterValueType; bool modified = false; for( unsigned int i = 0; i < SpaceDimension; i++ ) { @@ -174,7 +173,7 @@ { Pointer inv = New(); - return GetInverse(inv) ? inv.GetPointer() : NULL; + return GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } // Compute the Jacobian in one position diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkv3Rigid3DTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkv3Rigid3DTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkv3Rigid3DTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkv3Rigid3DTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -117,7 +117,7 @@ virtual InverseTransformBasePointer GetInverseTransform() const { Pointer inv = New(); - return this->GetInverse(inv) ? inv.GetPointer() : NULL; + return this->GetInverse(inv) ? inv.GetPointer() : ITK_NULLPTR; } protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -86,6 +86,8 @@ /** Versor type. */ typedef typename Superclass::VersorType VersorType; + typedef typename VersorType::VectorType VectorType; + typedef typename Superclass::AxisType AxisType; typedef typename Superclass::AngleType AngleType; @@ -93,6 +95,8 @@ typedef typename Superclass::TranslationValueType TranslationValueType; typedef typename Superclass::ParameterValueType ParameterValueType; + typedef Array DerivativeType; + /** Set the transformation from a container of parameters * This is typically used by optimizers. * There are 6 parameters. The first three represent the @@ -101,6 +105,15 @@ virtual const ParametersType & GetParameters(void) const; + /** Update the transform's parameters by the values in \c update. + * \param update must be of the same length as returned by + * GetNumberOfParameters(). Throw an exception otherwise. + * \param factor is a scalar multiplier for each value in \c update. + * SetParameters is called at the end of this method, to allow the transform + * to perform any required operations on the updated parameters - typically + * a conversion to member variables for use in TransformPoint. */ + virtual void UpdateTransformParameters( const DerivativeType & update, TScalar factor = 1.0 ); + /** This method computes the Jacobian matrix of the transformation. * given point or vector, returning the transformed point or * vector. The rank of the Jacobian will also indicate if the diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorRigid3DTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -71,7 +71,7 @@ axis[2] = parameters[2]; if( norm > 0 ) { - norm = vcl_sqrt(norm); + norm = std::sqrt(norm); } double epsilon = 1e-10; @@ -106,7 +106,7 @@ // // Parameters are ordered as: // -// p[0:2] = right part of the versor (axis times vcl_sin(t/2)) +// p[0:2] = right part of the versor (axis times std::sin(t/2)) // p[3:5} = translation components // @@ -133,6 +133,92 @@ template void +VersorRigid3DTransform +::UpdateTransformParameters( const DerivativeType & update, TScalar factor ) +{ + SizeValueType numberOfParameters = this->GetNumberOfParameters(); + + if( update.Size() != numberOfParameters ) + { + itkExceptionMacro("Parameter update size, " << update.Size() << ", must " + " be same as transform parameter size, " + << numberOfParameters << std::endl); + } + + /* Make sure m_Parameters is updated to reflect the current values in + * the transform's other parameter-related variables. This is effective for + * managing the parallel variables used for storing parameter data, + * but inefficient. However for small global transforms, shouldn't be + * too bad. Dense-field transform will want to make sure m_Parameters + * is always updated whenever the transform is changed, so GetParameters + * can be skipped in their implementations of UpdateTransformParameters. + */ + this->GetParameters(); + + VectorType rightPart; + + for ( unsigned int i = 0; i < 3; i++ ) + { + rightPart[i] = this->m_Parameters[i]; + } + + VersorType currentRotation; + currentRotation.Set(rightPart); + + // The gradient indicate the contribution of each one + // of the axis to the direction of highest change in + // the function + VectorType axis; + axis[0] = update[0]; + axis[1] = update[1]; + axis[2] = update[2]; + + // gradientRotation is a rotation along the + // versor direction which maximize the + // variation of the cost function in question. + // An additional Exponentiation produce a jump + // of a particular length along the versor gradient + // direction. + + VersorType gradientRotation; + gradientRotation.Set( axis, factor * axis.GetNorm() ); + + // + // Composing the currentRotation with the gradientRotation + // produces the new Rotation versor + // + VersorType newRotation = currentRotation * gradientRotation; + + ParametersType newParameters( numberOfParameters ); + + newParameters[0] = newRotation.GetX(); + newParameters[1] = newRotation.GetY(); + newParameters[2] = newRotation.GetZ(); + + // Optimize the non-versor parameters as the + // RegularStepGradientDescentOptimizer + for ( unsigned int k = 3; k < numberOfParameters; k++ ) + { + newParameters[k] = this->m_Parameters[k] + update[k] * factor; + } + + /* Call SetParameters with the updated parameters. + * SetParameters in most transforms is used to assign the input params + * to member variables, possibly with some processing. The member variables + * are then used in TransformPoint. + * In the case of dense-field transforms that are updated in blocks from + * a threaded implementation, SetParameters doesn't do this, and is + * optimized to not copy the input parameters when == m_Parameters. + */ + this->SetParameters( newParameters ); + + /* Call Modified, following behavior of other transform when their + * parameters change, e.g. MatrixOffsetTransformBase */ + this->Modified(); +} + +template +void VersorRigid3DTransform ::ComputeJacobianWithRespectToParameters(const InputPointType & p, JacobianType & jacobian) const { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorTransform.h otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/include/itkVersorTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -100,7 +100,7 @@ * There are 3 parameters. They represent the components * of the right part of the versor. This can be seen * as the components of the vector parallel to the rotation - * axis and multiplied by vcl_sin( angle / 2 ). */ + * axis and multiplied by std::sin( angle / 2 ). */ void SetParameters(const ParametersType & parameters); /** Get the Transformation Parameters. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Core/Transform/wrapping/itkVersorTransform.wrap otb-4.2.0/Utilities/ITK/Modules/Core/Transform/wrapping/itkVersorTransform.wrap --- otb-4.0.0/Utilities/ITK/Modules/Core/Transform/wrapping/itkVersorTransform.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Core/Transform/wrapping/itkVersorTransform.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,6 +1,7 @@ -itk_wrap_class("itk::VersorTransform" POINTER) - itk_wrap_filter_dims(d3 3) - if(d3) +itk_wrap_filter_dims(has_d_3 3) + +if(has_d_3) + itk_wrap_class("itk::VersorTransform" POINTER) itk_wrap_template("${ITKM_D}" "${ITKT_D}") - endif(d3) -itk_end_wrap_class() + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionFunction.h otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -214,7 +214,7 @@ * so it's safe to return a null value. */ virtual void * GetGlobalDataPointer() const { - return 0; + return ITK_NULLPTR; } /** Does nothing. No global data is used in this class of equations. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkAnisotropicDiffusionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ m_ConductanceParameter = 1.0; m_ConductanceScalingParameter = 1.0; m_ConductanceScalingUpdateInterval = 1; - m_TimeStep = 0.5 / vcl_pow( 2.0, static_cast< double >( ImageDimension ) ); + m_TimeStep = 0.5 / std::pow( 2.0, static_cast< double >( ImageDimension ) ); m_FixedAverageGradientMagnitude = 1.0; m_GradientMagnitudeIsFixed = false; } @@ -72,14 +72,14 @@ { minSpacing = 1.0; } - if ( m_TimeStep > ( minSpacing / vcl_pow(2.0, static_cast< double >( ImageDimension ) + 1) ) ) + if ( m_TimeStep > ( minSpacing / std::pow(2.0, static_cast< double >( ImageDimension ) + 1) ) ) { - // f->SetTimeStep(1.0 / vcl_pow(2.0, + // f->SetTimeStep(1.0 / std::pow(2.0, // static_cast(ImageDimension))); itkWarningMacro( << "Anisotropic diffusion unstable time step: " << m_TimeStep << std::endl << "Stable time step for this image must be smaller than " - << minSpacing / vcl_pow( 2.0, static_cast< double >( ImageDimension + 1 ) ) ); + << minSpacing / std::pow( 2.0, static_cast< double >( ImageDimension + 1 ) ) ); } if ( m_GradientMagnitudeIsFixed == false ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureAnisotropicDiffusionImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureAnisotropicDiffusionImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureAnisotropicDiffusionImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureAnisotropicDiffusionImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -100,7 +100,7 @@ virtual void InitializeIteration() { Superclass::InitializeIteration(); - if ( this->GetTimeStep() > 0.5 / vcl_pow( 2.0, static_cast< double >( ImageDimension ) ) ) + if ( this->GetTimeStep() > 0.5 / std::pow( 2.0, static_cast< double >( ImageDimension ) ) ) { itkWarningMacro( << "Anisotropic diffusion is using a time step which may introduce instability into the solution."); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureNDAnisotropicDiffusionFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureNDAnisotropicDiffusionFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureNDAnisotropicDiffusionFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkCurvatureNDAnisotropicDiffusionFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,8 @@ template< typename TImage > CurvatureNDAnisotropicDiffusionFunction< TImage > -::CurvatureNDAnisotropicDiffusionFunction() +::CurvatureNDAnisotropicDiffusionFunction() : + m_K(0.0) { unsigned int i, j; RadiusType r; @@ -123,8 +124,8 @@ grad_mag_sq_d += 0.25f * ( dx[j] + dx_dim ) * ( dx[j] + dx_dim ); } } - grad_mag = vcl_sqrt(m_MIN_NORM + grad_mag_sq); - grad_mag_d = vcl_sqrt(m_MIN_NORM + grad_mag_sq_d); + grad_mag = std::sqrt(m_MIN_NORM + grad_mag_sq); + grad_mag_d = std::sqrt(m_MIN_NORM + grad_mag_sq_d); // Conductance Terms if ( m_K == 0.0 ) @@ -134,8 +135,8 @@ } else { - Cx = vcl_exp(grad_mag_sq / m_K); - Cxd = vcl_exp(grad_mag_sq_d / m_K); + Cx = std::exp(grad_mag_sq / m_K); + Cxd = std::exp(grad_mag_sq_d / m_K); } // First order normalized finite-difference conductance products dx_forward_Cn = ( dx_forward[i] / grad_mag ) * Cx; @@ -164,7 +165,7 @@ + vnl_math_sqr( vnl_math_min(dx_forward[i], 0.0) ); } } - return static_cast< PixelType >( vcl_sqrt(propagation_gradient) * speed ); + return static_cast< PixelType >( std::sqrt(propagation_gradient) * speed ); } } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkGradientNDAnisotropicDiffusionFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,8 @@ template< typename TImage > GradientNDAnisotropicDiffusionFunction< TImage > -::GradientNDAnisotropicDiffusionFunction() +::GradientNDAnisotropicDiffusionFunction() : + m_K(0.0) { unsigned int i, j; RadiusType r; @@ -144,8 +145,8 @@ } else { - Cx = vcl_exp( ( vnl_math_sqr(dx_forward) + accum ) / m_K ); - Cxd = vcl_exp( ( vnl_math_sqr(dx_backward) + accum_d ) / m_K ); + Cx = std::exp( ( vnl_math_sqr(dx_forward) + accum ) / m_K ); + Cxd = std::exp( ( vnl_math_sqr(dx_backward) + accum_d ) / m_K ); } // Conductance modified first order derivatives. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureAnisotropicDiffusionImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureAnisotropicDiffusionImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureAnisotropicDiffusionImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureAnisotropicDiffusionImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -107,7 +107,7 @@ virtual void InitializeIteration() { Superclass::InitializeIteration(); - if ( this->GetTimeStep() > 0.5 / vcl_pow( 2.0, static_cast< double >( ImageDimension ) ) ) + if ( this->GetTimeStep() > 0.5 / std::pow( 2.0, static_cast< double >( ImageDimension ) ) ) { itkWarningMacro( << "Anisotropic diffusion has attempted to use a time step which may introduce instability into the solution."); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureNDAnisotropicDiffusionFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureNDAnisotropicDiffusionFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureNDAnisotropicDiffusionFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorCurvatureNDAnisotropicDiffusionFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -143,8 +143,8 @@ } } - grad_mag[k] = vcl_sqrt(m_MIN_NORM + grad_mag_sq[k]); - grad_mag_d[k] = vcl_sqrt(m_MIN_NORM + grad_mag_sq_d[k]); + grad_mag[k] = std::sqrt(m_MIN_NORM + grad_mag_sq[k]); + grad_mag_d[k] = std::sqrt(m_MIN_NORM + grad_mag_sq_d[k]); // this grad mag should depend only on the current k for ( i = 0; i < ImageDimension; i++ ) { @@ -174,8 +174,8 @@ } else { - Cx[i] = vcl_exp(grad_mag_sq_tmp / m_K); - Cxd[i] = vcl_exp(grad_mag_sq_d_tmp / m_K); + Cx[i] = std::exp(grad_mag_sq_tmp / m_K); + Cxd[i] = std::exp(grad_mag_sq_d_tmp / m_K); } } @@ -213,7 +213,7 @@ } } - ans[k] = vcl_sqrt(propagation_gradient) * speed; + ans[k] = std::sqrt(propagation_gradient) * speed; } return ans; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AnisotropicSmoothing/include/itkVectorGradientNDAnisotropicDiffusionFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -147,8 +147,8 @@ } else { - Cx[i] = vcl_exp(GradMag / m_K); - Cxd[i] = vcl_exp(GradMag_d / m_K); + Cx[i] = std::exp(GradMag / m_K); + Cxd[i] = std::exp(GradMag_d / m_K); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/AntiAlias/include/itkAntiAliasBinaryImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,7 @@ AntiAliasBinaryImageFilter< TInputImage, TOutputImage > ::AntiAliasBinaryImageFilter() { - m_InputImage = NULL; + m_InputImage = ITK_NULLPTR; m_CurvatureFunction = CurvatureFunctionType::New(); this->SetDifferenceFunction(m_CurvatureFunction); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkCompositeValleyFunction.h otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkCompositeValleyFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkCompositeValleyFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkCompositeValleyFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -136,7 +136,7 @@ } /** Evalaute the function at point x. */ - inline MeasureType Evaluate(MeasureType x) + virtual inline MeasureType Evaluate(MeasureType x) ITK_OVERRIDE { MeasureType res = 1; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.h otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.h 2014-09-03 08:29:34.000000000 +0000 @@ -124,7 +124,7 @@ protected: MRASlabIdentifier(); virtual ~MRASlabIdentifier() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: MRASlabIdentifier(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ MRASlabIdentifier< TInputImage > ::MRASlabIdentifier() { - m_Image = 0; + m_Image = ITK_NULLPTR; m_NumberOfSamples = 10; m_BackgroundMinimumThreshold = NumericTraits< ImagePixelType >::min(); m_Tolerance = 0.0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -122,12 +122,12 @@ /** Gets the total energy value of an image or a slice using the * given parameters. */ - MeasureType GetValue(const ParametersType & parameters) const; + virtual MeasureType GetValue(const ParametersType & parameters) const ITK_OVERRIDE; /** Dummy implementation to confirm to the SingleValuedCostFunction * interfaces. It is pure virtual in the superclass */ void GetDerivative( const ParametersType & itkNotUsed(parameters), - DerivativeType & itkNotUsed(derivative) ) const + DerivativeType & itkNotUsed(derivative) ) const ITK_OVERRIDE {} /** Set Mean and Sigma for the normal distributions @@ -137,7 +137,7 @@ void InitializeDistributions(Array< double > classMeans, Array< double > classSigmas); - unsigned int GetNumberOfParameters(void) const; + virtual unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE; protected: /** Constructor: */ @@ -470,13 +470,13 @@ bool CheckMaskImage(ImageMaskType *mask); protected: - /** Converts image data from source to target applying vcl_log(pixel + 1) + /** Converts image data from source to target applying std::log(pixel + 1) * to all pixels. If the source pixel has negative value, it sets * the value of the corresponding pixel in the targe image as zero. */ void Log1PImage(InternalImageType *source, InternalImageType *target); - /** Converts image data from source to target applying vcl_exp(pixel) - 1 + /** Converts image data from source to target applying std::exp(pixel) - 1 * to all pixels. */ void ExpImage(InternalImageType *source, InternalImageType *target); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,13 +28,13 @@ MRIBiasEnergyFunction< TImage, TImageMask, TBiasField > ::MRIBiasEnergyFunction() { - m_BiasField = 0; + m_BiasField = ITK_NULLPTR; for ( unsigned int i = 0; i < SpaceDimension; i++ ) { m_SamplingFactor[i] = 1; } - m_Mask = NULL; - m_Image = NULL; + m_Mask = ITK_NULLPTR; + m_Image = ITK_NULLPTR; } template< typename TImage, typename TImageMask, typename TBiasField > @@ -52,7 +52,7 @@ ::~MRIBiasEnergyFunction() { delete m_InternalEnergyFunction; - m_InternalEnergyFunction = 0; + m_InternalEnergyFunction = ITK_NULLPTR; } template< typename TImage, typename TImageMask, typename TBiasField > @@ -60,7 +60,7 @@ MRIBiasEnergyFunction< TImage, TImageMask, TBiasField > ::GetNumberOfParameters(void) const { - if ( m_BiasField == 0 ) + if ( m_BiasField == ITK_NULLPTR ) { return 0; } @@ -82,7 +82,7 @@ itkExceptionMacro(<< "EnergyFunction is null"); } - if ( m_BiasField == 0 ) + if ( m_BiasField == ITK_NULLPTR ) { itkExceptionMacro(<< "BiasField is null"); } @@ -211,8 +211,8 @@ MRIBiasFieldCorrectionFilter< TInputImage, TOutputImage, TMaskImage > ::MRIBiasFieldCorrectionFilter() { - m_InputMask = 0; - m_OutputMask = 0; + m_InputMask = ITK_NULLPTR; + m_OutputMask = ITK_NULLPTR; m_BiasMultiplicative = true; m_BiasFieldDegree = 3; @@ -220,12 +220,12 @@ m_VolumeCorrectionMaximumIteration = 2000; m_InterSliceCorrectionMaximumIteration = 4000; m_OptimizerGrowthFactor = 1.05; - m_OptimizerShrinkFactor = vcl_pow(m_OptimizerGrowthFactor, -0.25); + m_OptimizerShrinkFactor = std::pow(m_OptimizerGrowthFactor, -0.25); - m_EnergyFunction = 0; + m_EnergyFunction = ITK_NULLPTR; m_NormalVariateGenerator = NormalVariateGeneratorType::New(); //m_NormalVariateGenerator->Initialize(3024); - m_NormalVariateGenerator->Initialize( time(NULL) ); + m_NormalVariateGenerator->Initialize( time(ITK_NULLPTR) ); if ( ImageDimension == 3 ) { @@ -578,12 +578,12 @@ const unsigned int size = m_TissueClassMeans.Size(); for ( unsigned int i = 0; i < size; i++ ) { - m_TissueClassSigmas[i] = vcl_log( 1.0 + m_TissueClassSigmas[i] + m_TissueClassSigmas[i] = std::log( 1.0 + m_TissueClassSigmas[i] / ( m_TissueClassMeans[i] + 1.0 ) ); - m_TissueClassMeans[i] = vcl_log(m_TissueClassMeans[i] + 1.0); + m_TissueClassMeans[i] = std::log(m_TissueClassMeans[i] + 1.0); } - m_OptimizerInitialRadius = vcl_log(1.0 + m_OptimizerInitialRadius); + m_OptimizerInitialRadius = std::log(1.0 + m_OptimizerInitialRadius); this->Log1PImage( m_InternalInput.GetPointer(), m_InternalInput.GetPointer() ); @@ -932,12 +932,12 @@ const unsigned int size = m_TissueClassMeans.Size(); for ( unsigned int i = 0; i < size; i++ ) { - m_TissueClassMeans[i] = vcl_exp(m_TissueClassMeans[i]) - 1.0; - m_TissueClassSigmas[i] = vcl_exp(m_TissueClassSigmas[i]) + m_TissueClassMeans[i] = std::exp(m_TissueClassMeans[i]) - 1.0; + m_TissueClassSigmas[i] = std::exp(m_TissueClassSigmas[i]) * ( 1.0 + m_TissueClassMeans[i] ) - m_TissueClassMeans[i]; } - m_OptimizerInitialRadius = vcl_exp(m_OptimizerInitialRadius) - 1.0; + m_OptimizerInitialRadius = std::exp(m_OptimizerInitialRadius) - 1.0; } if ( m_GeneratingOutput ) @@ -1034,7 +1034,7 @@ } else { - t_iter.Set( vcl_log(pixel + 1) ); + t_iter.Set( std::log(pixel + 1) ); } ++s_iter; @@ -1063,7 +1063,7 @@ { temp = s_iter.Get(); //t_iter.Set( m_EnergyFunction->GetEnergy0(temp)); - temp = vcl_exp(temp) - 1; + temp = std::exp(temp) - 1; t_iter.Set( (InternalImagePixelType)temp ); ++s_iter; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/include/itkN4BiasFieldCorrectionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ { this->SetNumberOfRequiredInputs( 1 ); - this->m_LogBiasFieldControlPointLattice = NULL; + this->m_LogBiasFieldControlPointLattice = ITK_NULLPTR; this->m_NumberOfFittingLevels.Fill( 1 ); this->m_NumberOfControlPoints.Fill( 4 ); @@ -105,7 +105,7 @@ { if( It.Get() > NumericTraits::Zero ) { - It.Set( vcl_log( static_cast< RealType >( It.Get() ) ) ); + It.Set( std::log( static_cast< RealType >( It.Get() ) ) ); } } } @@ -124,9 +124,7 @@ RealImagePointer logBiasField = RealImageType::New(); logBiasField->CopyInformation( inputImage ); logBiasField->SetRegions( inputImage->GetLargestPossibleRegion() ); - logBiasField->Allocate(); - logBiasField->FillBuffer( 0.0 ); - + logBiasField->Allocate(true); // initialize buffer to zero // Iterate until convergence or iterative exhaustion. unsigned int maximumNumberOfLevels = 1; @@ -305,10 +303,10 @@ // histogram to a power of 2. RealType exponent = - vcl_ceil( vcl_log( static_cast( this->m_NumberOfHistogramBins ) ) / - vcl_log( 2.0 ) ) + 1; + std::ceil( std::log( static_cast( this->m_NumberOfHistogramBins ) ) / + std::log( 2.0 ) ) + 1; unsigned int paddedHistogramSize = static_cast( - vcl_pow( static_cast( 2.0 ), exponent ) + 0.5 ); + std::pow( static_cast( 2.0 ), exponent ) + 0.5 ); unsigned int histogramOffset = static_cast( 0.5 * ( paddedHistogramSize - this->m_NumberOfHistogramBins ) ); @@ -331,8 +329,8 @@ // Create the Gaussian filter. RealType scaledFWHM = this->m_BiasFieldFullWidthAtHalfMaximum / histogramSlope; - RealType expFactor = 4.0 * vcl_log( 2.0 ) / vnl_math_sqr( scaledFWHM ); - RealType scaleFactor = 2.0 * vcl_sqrt( vcl_log( 2.0 ) + RealType expFactor = 4.0 * std::log( 2.0 ) / vnl_math_sqr( scaledFWHM ); + RealType scaleFactor = 2.0 * std::sqrt( std::log( 2.0 ) / vnl_math::pi ) / scaledFWHM; vnl_vector< vcl_complex > F( paddedHistogramSize, @@ -344,11 +342,11 @@ for( unsigned int n = 1; n <= halfSize; n++ ) { F[n] = F[paddedHistogramSize - n] = vcl_complex( scaleFactor * - vcl_exp( -vnl_math_sqr( static_cast( n ) ) * expFactor ), 0.0 ); + std::exp( -vnl_math_sqr( static_cast( n ) ) * expFactor ), 0.0 ); } if( paddedHistogramSize % 2 == 0 ) { - F[halfSize] = vcl_complex( scaleFactor * vcl_exp( 0.25 * + F[halfSize] = vcl_complex( scaleFactor * std::exp( 0.25 * -vnl_math_sqr( static_cast( paddedHistogramSize ) ) * expFactor ), 0.0 ); } @@ -434,8 +432,7 @@ RealImagePointer sharpenedImage = RealImageType::New(); sharpenedImage->CopyInformation( inputImage ); sharpenedImage->SetRegions( inputImage->GetLargestPossibleRegion() ); - sharpenedImage->Allocate(); - sharpenedImage->FillBuffer( 0.0 ); + sharpenedImage->Allocate(true); // initialize buffer to zero ImageRegionIterator ItC( sharpenedImage, sharpenedImage->GetLargestPossibleRegion() ); @@ -661,7 +658,7 @@ && ( !confidenceImage || confidenceImage->GetPixel( It.GetIndex() ) > 0.0 ) ) { - RealType pixel = vcl_exp( It.Get() ); + RealType pixel = std::exp( It.Get() ); N += 1.0; if( N > 1.0 ) @@ -671,7 +668,7 @@ mu = mu * ( 1.0 - 1.0 / N ) + pixel / N; } } - sigma = vcl_sqrt( sigma / ( N - 1.0 ) ); + sigma = std::sqrt( sigma / ( N - 1.0 ) ); return ( sigma / mu ); } @@ -704,15 +701,7 @@ os << indent << "CurrentLevel: " << this->m_CurrentLevel << std::endl; os << indent << "ElapsedIterations: " << this->m_ElapsedIterations << std::endl; - if ( this->m_LogBiasFieldControlPointLattice ) - { - os << indent << "LogBiasFieldControlPointLattice:" << std::endl; - this->m_LogBiasFieldControlPointLattice->Print( os, indent.GetNextIndent() ); - } - else - { - os << indent << "LogBiasFieldControlPointLattice: " << "(null)" << std::endl; - } + itkPrintSelfObjectMacro( LogBiasFieldControlPointLattice ); } } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/src/itkCacheableScalarFunction.cxx otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/src/itkCacheableScalarFunction.cxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BiasCorrection/src/itkCacheableScalarFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BiasCorrection/src/itkCacheableScalarFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,9 +20,14 @@ namespace itk { CacheableScalarFunction -::CacheableScalarFunction() +::CacheableScalarFunction() : + m_NumberOfSamples(0), + m_CacheTable(0), + m_CacheUpperBound(0.0), + m_CacheLowerBound(0.0), + m_TableInc(0.0), + m_CacheAvailable(false) { - m_CacheAvailable = false; } void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryClosingByReconstructionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,6 @@ #include "itkConstantPadImageFilter.h" #include "itkConstNeighborhoodIterator.h" #include "itkNeighborhoodIterator.h" -#include "itkProgressReporter.h" namespace itk { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryThinningImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -201,16 +201,16 @@ // First find the total number of transitions, and then // divide by 2. const PixelType transitions = ( - vcl_abs( static_cast< int >( p3 + std::abs( static_cast< int >( p3 - p2 ) ) - + vcl_abs( static_cast< int >( p4 + + std::abs( static_cast< int >( p4 - p3 ) ) - + vcl_abs( static_cast< int >( p5 - p4 ) ) + vcl_abs( static_cast< int >( p6 - p5 ) ) - + vcl_abs( static_cast< int >( p7 + + std::abs( static_cast< int >( p5 - p4 ) ) + std::abs( static_cast< int >( p6 - p5 ) ) + + std::abs( static_cast< int >( p7 - p6 ) ) - + vcl_abs( static_cast< int >( p8 + + std::abs( static_cast< int >( p8 - p7 ) ) - + vcl_abs( static_cast< int >( p9 - p8 ) ) + vcl_abs( static_cast< int >( p2 - p9 ) ) + + std::abs( static_cast< int >( p9 - p8 ) ) + std::abs( static_cast< int >( p2 - p9 ) ) ) / 2; if ( transitions == 1 ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -189,7 +189,7 @@ ::IsObjectPixelOnBoundary(const InputNeighborhoodIteratorType & iNIter) { static const unsigned int s = - (unsigned int)vcl_pow( (double)3.0, + (unsigned int)std::pow( (double)3.0, (double)( ImageDimension ) ); PixelType tf; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Colormap/include/itkColormapFunction.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Colormap/include/itkColormapFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Colormap/include/itkColormapFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Colormap/include/itkColormapFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -123,7 +123,7 @@ return rescaled; } - void PrintSelf(std::ostream & os, Indent indent) const + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -77,8 +77,8 @@ const KernelImageType* kernelImage = this->GetKernelImage(); - InternalComplexImagePointerType input = NULL; - InternalComplexImagePointerType kernel = NULL; + InternalComplexImagePointerType input = ITK_NULLPTR; + InternalComplexImagePointerType kernel = ITK_NULLPTR; this->PrepareInputs( localInput, kernelImage, input, kernel, progress, 0.7f ); typedef MultiplyImageFilter< InternalComplexImageType, @@ -91,8 +91,8 @@ progress->RegisterInternalFilter( multiplyFilter, 0.1 ); // Free up the memory for the prepared inputs - input = NULL; - kernel = NULL; + input = ITK_NULLPTR; + kernel = ITK_NULLPTR; this->ProduceOutput( multiplyFilter->GetOutput(), progress, 0.2 ); } @@ -193,8 +193,8 @@ transformedInput = imageFFTFilter->GetOutput(); transformedInput->DisconnectPipeline(); - imageFFTFilter->SetInput( NULL ); - imageFFTFilter = NULL; + imageFFTFilter->SetInput( ITK_NULLPTR ); + imageFFTFilter = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > @@ -214,7 +214,7 @@ kernelUpperBound[i] = padSize[i] - kernelSize[i]; } - InternalImagePointerType paddedKernelImage = NULL; + InternalImagePointerType paddedKernelImage = ITK_NULLPTR; float paddingWeight = 0.2f; if ( this->GetNormalize() ) @@ -331,7 +331,6 @@ typedef ExtractImageFilter< InternalImageType, OutputImageType > ExtractFilterType; typename ExtractFilterType::Pointer extractFilter = ExtractFilterType::New(); - extractFilter->SetDirectionCollapseToIdentity(); extractFilter->InPlaceOn(); extractFilter->GraftOutput( this->GetOutput() ); @@ -353,9 +352,16 @@ progress->RegisterInternalFilter( extractFilter, progressWeight ); extractFilter->Update(); - // Graft the output of the crop filter back onto this - // filter's output. - this->GraftOutput( extractFilter->GetOutput() ); + OutputImageType *extractedImage = extractFilter->GetOutput(); + OutputImageType *output = this->GetOutput(); + + // Only manually copy the buffer via the pixel container. + // The output meta-data of the extract filter is not correct and + // different that the GenerateOutputInformation method. So just copy + // the buffer. + output->SetBufferedRegion(extractedImage->GetBufferedRegion()); + output->SetPixelContainer(extractedImage->GetPixelContainer()); + } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkMaskedFFTNormalizedCorrelationImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkMaskedFFTNormalizedCorrelationImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkMaskedFFTNormalizedCorrelationImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkMaskedFFTNormalizedCorrelationImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -119,14 +119,14 @@ InputImagePointer movingImage = InputImageType::New(); movingImage->Graft( this->GetMovingImage() ); - MaskImagePointer fixedMask = NULL; + MaskImagePointer fixedMask = ITK_NULLPTR; if( this->GetFixedImageMask() ) { fixedMask = MaskImageType::New(); fixedMask->Graft( this->GetFixedImageMask() ); } - MaskImagePointer movingMask = NULL; + MaskImagePointer movingMask = ITK_NULLPTR; if( this->GetMovingImageMask() ) { movingMask = MaskImageType::New(); @@ -146,9 +146,9 @@ movingImage = this->PreProcessImage( movingImage,movingMask ); InputImagePointer rotatedMovingImage = this->RotateImage( movingImage ); - movingImage = NULL; + movingImage = ITK_NULLPTR; MaskImagePointer rotatedMovingMask = this->RotateImage( movingMask); - movingMask = NULL; + movingMask = ITK_NULLPTR; // The combinedImageSize is the size resulting from the correlation of the two images. RealSizeType combinedImageSize; @@ -168,10 +168,10 @@ // separation. FFTImagePointer fixedFFT = this->CalculateForwardFFT( fixedImage, FFTImageSize ); FFTImagePointer fixedMaskFFT = this->CalculateForwardFFT( fixedMask, FFTImageSize ); - fixedMask = NULL; + fixedMask = ITK_NULLPTR; FFTImagePointer rotatedMovingFFT = this->CalculateForwardFFT( rotatedMovingImage, FFTImageSize ); FFTImagePointer rotatedMovingMaskFFT = this->CalculateForwardFFT( rotatedMovingMask, FFTImageSize ); - rotatedMovingMask = NULL; + rotatedMovingMask = ITK_NULLPTR; // Only 6 IFFTs are needed. // Compute and save some of these rather than computing them multiple times. @@ -188,31 +188,31 @@ RealImagePointer numerator = this->ElementSubtraction( this->CalculateInverseFFT(this->ElementProduct(fixedFFT,rotatedMovingFFT),combinedImageSize), this->ElementQuotient(this->ElementProduct(fixedCumulativeSumImage,rotatedMovingCumulativeSumImage),numberOfOverlapPixels)); - fixedFFT = NULL; // No longer needed - rotatedMovingFFT = NULL; // No longer needed + fixedFFT = ITK_NULLPTR; // No longer needed + rotatedMovingFFT = ITK_NULLPTR; // No longer needed // Calculate the fixed part of the masked FFT NCC denominator. FFTImagePointer fixedSquaredFFT = this->CalculateForwardFFT( this->ElementProduct(fixedImage,fixedImage), FFTImageSize ); - fixedImage = NULL; // No longer needed + fixedImage = ITK_NULLPTR; // No longer needed RealImagePointer fixedDenom = this->ElementSubtraction( this->CalculateInverseFFT(this->ElementProduct(fixedSquaredFFT,rotatedMovingMaskFFT),combinedImageSize), this->ElementQuotient(this->ElementProduct(fixedCumulativeSumImage,fixedCumulativeSumImage),numberOfOverlapPixels)); - fixedSquaredFFT = NULL; // No longer needed - rotatedMovingMaskFFT = NULL; // No longer needed - fixedCumulativeSumImage = NULL; // No longer needed + fixedSquaredFFT = ITK_NULLPTR; // No longer needed + rotatedMovingMaskFFT = ITK_NULLPTR; // No longer needed + fixedCumulativeSumImage = ITK_NULLPTR; // No longer needed // Ensure that the result is positive. fixedDenom = this->ElementPositive(fixedDenom); // Calculate the moving part of the masked FFT NCC denominator. FFTImagePointer rotatedMovingSquaredFFT = this->CalculateForwardFFT( this->ElementProduct(rotatedMovingImage,rotatedMovingImage), FFTImageSize ); - rotatedMovingImage = NULL; // No longer needed + rotatedMovingImage = ITK_NULLPTR; // No longer needed RealImagePointer rotatedMovingDenom = this->ElementSubtraction( this->CalculateInverseFFT(this->ElementProduct(fixedMaskFFT,rotatedMovingSquaredFFT),combinedImageSize), this->ElementQuotient(this->ElementProduct(rotatedMovingCumulativeSumImage,rotatedMovingCumulativeSumImage),numberOfOverlapPixels)); - rotatedMovingSquaredFFT = NULL; // No longer needed - fixedMaskFFT = NULL; // No longer needed - rotatedMovingCumulativeSumImage = NULL; // No longer needed + rotatedMovingSquaredFFT = ITK_NULLPTR; // No longer needed + fixedMaskFFT = ITK_NULLPTR; // No longer needed + rotatedMovingCumulativeSumImage = ITK_NULLPTR; // No longer needed // Ensure that the result is positive. rotatedMovingDenom = this->ElementPositive(rotatedMovingDenom); @@ -221,14 +221,14 @@ sqrtFilter->SetInput( this->ElementProduct(fixedDenom,rotatedMovingDenom) ); sqrtFilter->Update(); RealImagePointer denominator = sqrtFilter->GetOutput(); - fixedDenom = NULL; // No longer needed - rotatedMovingDenom = NULL; // No longer needed + fixedDenom = ITK_NULLPTR; // No longer needed + rotatedMovingDenom = ITK_NULLPTR; // No longer needed // Determine a tolerance on the precision of the denominator values. const double precisionTolerance = CalculatePrecisionTolerance( denominator ); RealImagePointer NCC = this->ElementQuotient(numerator,denominator); - numerator = NULL; // No longer needed + numerator = ITK_NULLPTR; // No longer needed // Given the numberOfOverlapPixels, we can check that the m_RequiredNumberOfOverlappingPixels is not set higher than // the actual maximum overlap voxels. If it is, we set m_RequiredNumberOfOverlappingPixels to be this maximum. @@ -236,7 +236,7 @@ typename CalculatorType::Pointer calculator = CalculatorType::New(); calculator->SetImage(numberOfOverlapPixels); calculator->ComputeMaximum(); - m_MaximumNumberOfOverlappingPixels = calculator->GetMaximum(); + m_MaximumNumberOfOverlappingPixels = static_cast< SizeValueType >( calculator->GetMaximum() ); if( m_RequiredNumberOfOverlappingPixels > m_MaximumNumberOfOverlappingPixels ) { m_RequiredNumberOfOverlappingPixels = (SizeValueType)m_MaximumNumberOfOverlappingPixels; @@ -562,11 +562,11 @@ double precisionTolerance=0.0F; if( typeid(inputImage->GetPixel(index)) == typeid(double) ) { - precisionTolerance = 1000.0 * vcl_pow(2.0,-52) * vcl_pow(2,vcl_floor(vcl_log(calculator->GetMaximum())/vcl_log(2.0))); + precisionTolerance = 1000.0 * std::pow(2.0,-52) * std::pow(2,std::floor(std::log(calculator->GetMaximum())/std::log(2.0))); } else if( typeid(inputImage->GetPixel(index)) == typeid(float) ) { - precisionTolerance = 1000.0 * vcl_pow(2.0,-23) * vcl_pow(2,vcl_floor(vcl_log(calculator->GetMaximum())/vcl_log(2.0))); + precisionTolerance = 1000.0 * std::pow(2.0,-23) * std::pow(2,std::floor(std::log(calculator->GetMaximum())/std::log(2.0))); } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -142,8 +142,7 @@ * region is expanded by the radius of the template. If the request * extends past the LargestPossibleRegion for the input, the request * is cropped by the LargestPossibleRegion. */ - void GenerateInputRequestedRegion() - throw ( InvalidRequestedRegionError ); + void GenerateInputRequestedRegion(); /** NormalizedCorrelationImageFilter can be implemented as a * multithreaded filter. Therefore, this implementation provides a diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,6 @@ void NormalizedCorrelationImageFilter< TInputImage, TMaskImage, TOutputImage, TOperatorValueType > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); @@ -121,13 +120,13 @@ static_cast< OutputPixelRealType >( this->GetOperator().Size() ); OutputPixelRealType mean = sum / num; OutputPixelRealType var = ( sumOfSquares - ( sum * sum / num ) ) / ( num - 1.0 ); - OutputPixelRealType std = vcl_sqrt(var); + OutputPixelRealType std = std::sqrt(var); // convert std to a scaling factor k such that // // || (coeff - mean) / k || = 1.0 // - double k = std * vcl_sqrt(num - 1.0); + double k = std * std::sqrt(num - 1.0); // normalize the template for ( ntIt = normalizedTemplate.Begin(), tIt = this->GetOperator().Begin(); @@ -208,7 +207,7 @@ sum += value; sumOfSquares += ( value * value ); } - denominator = vcl_sqrt( sumOfSquares - ( sum * sum / realTemplateSize ) ); + denominator = std::sqrt( sumOfSquares - ( sum * sum / realTemplateSize ) ); it.Value() = numerator / denominator; @@ -244,7 +243,7 @@ sum += value; sumOfSquares += ( value * value ); } - denominator = vcl_sqrt( sumOfSquares - ( sum * sum / realTemplateSize ) ); + denominator = std::sqrt( sumOfSquares - ( sum * sum / realTemplateSize ) ); it.Value() = numerator / denominator; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/CurvatureFlow/include/itkMinMaxCurvatureFlowFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -116,10 +116,13 @@ } // normalize the operator so that it sums to one - for ( opIter = m_StencilOperator.Begin(); opIter < opEnd; ++opIter ) + if (numPixelsInSphere != 0) { - *opIter = static_cast< PixelType >( (double)*opIter - / (double)numPixelsInSphere ); + for ( opIter = m_StencilOperator.Begin(); opIter < opEnd; ++opIter ) + { + *opIter = static_cast< PixelType >( (double)*opIter + / (double)numPixelsInSphere ); + } } } @@ -157,7 +160,7 @@ if ( gradMagnitude == 0.0 ) { return threshold; } - gradMagnitude = vcl_sqrt( (double)gradMagnitude ); + gradMagnitude = std::sqrt( (double)gradMagnitude ); // Search for all position in the neighborhood perpendicular to // the gradient and at a distance of StencilRadius from center. @@ -190,7 +193,7 @@ vectorMagnitude += static_cast< PixelType >( vnl_math_sqr(diff) ); } - vectorMagnitude = vcl_sqrt( (double)vectorMagnitude ); + vectorMagnitude = std::sqrt( (double)vectorMagnitude ); if ( vectorMagnitude != 0.0 ) { @@ -264,7 +267,7 @@ if ( gradMagnitude == 0.0 ) { return threshold; } - gradMagnitude = vcl_sqrt( (double)gradMagnitude ) + gradMagnitude = std::sqrt( (double)gradMagnitude ) / static_cast< PixelType >( m_StencilRadius ); for ( j = 0; j < imageDimension; j++ ) @@ -335,7 +338,7 @@ if ( gradMagnitude == 0.0 ) { return threshold; } - gradMagnitude = vcl_sqrt( (double)gradMagnitude ) + gradMagnitude = std::sqrt( (double)gradMagnitude ) / static_cast< PixelType >( m_StencilRadius ); for ( j = 0; j < imageDimension; j++ ) @@ -352,7 +355,7 @@ { gradient[2] = -1.0; } - theta = vcl_acos( (double)gradient[2] ); + theta = std::acos( (double)gradient[2] ); if ( gradient[0] == 0 ) { @@ -360,13 +363,13 @@ } else { - phi = vcl_atan( (double)gradient[1] / (double)gradient[0] ); + phi = std::atan( (double)gradient[1] / (double)gradient[0] ); } - double cosTheta = vcl_cos(theta); - double sinTheta = vcl_sin(theta); - double cosPhi = vcl_cos(phi); - double sinPhi = vcl_sin(phi); + double cosTheta = std::cos(theta); + double sinTheta = std::sin(theta); + double cosPhi = std::cos(phi); + double sinPhi = std::sin(phi); double rSinTheta = m_StencilRadius * sinTheta; double rCosThetaCosPhi = m_StencilRadius * cosTheta * cosPhi; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkInverseDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkInverseDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkInverseDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkInverseDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,8 +47,8 @@ const KernelImageType* kernelImage = this->GetKernelImage(); - InternalComplexImagePointerType input = NULL; - InternalComplexImagePointerType kernel = NULL; + InternalComplexImagePointerType input = ITK_NULLPTR; + InternalComplexImagePointerType kernel = ITK_NULLPTR; this->PrepareInputs( localInput, kernelImage, input, kernel, progress, 0.7 ); @@ -68,8 +68,8 @@ progress->RegisterInternalFilter( inverseFilter, 0.1 ); // Free up the memory for the prepared inputs - input = NULL; - kernel = NULL; + input = ITK_NULLPTR; + kernel = ITK_NULLPTR; this->ProduceOutput( inverseFilter->GetOutput(), progress, 0.2 ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkIterativeDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,8 +31,8 @@ m_NumberOfIterations = 1; m_Iteration = 0; m_StopIteration = false; - m_TransferFunction = NULL; - m_CurrentEstimate = NULL; + m_TransferFunction = ITK_NULLPTR; + m_CurrentEstimate = ITK_NULLPTR; m_InputMTime = 0L; m_KernelMTime = 0L; } @@ -41,8 +41,8 @@ IterativeDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > ::~IterativeDeconvolutionImageFilter() { - m_TransferFunction = NULL; - m_CurrentEstimate = NULL; + m_TransferFunction = ITK_NULLPTR; + m_CurrentEstimate = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > @@ -82,8 +82,8 @@ { this->CropOutput( m_CurrentEstimate, progress, progressWeight ); - m_CurrentEstimate = NULL; - m_TransferFunction = NULL; + m_CurrentEstimate = ITK_NULLPTR; + m_TransferFunction = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkLandweberDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkLandweberDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkLandweberDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkLandweberDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,14 +28,14 @@ ::LandweberDeconvolutionImageFilter() { m_Alpha = 0.1; - m_TransformedInput = NULL; + m_TransformedInput = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > LandweberDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > ::~LandweberDeconvolutionImageFilter() { - m_TransformedInput = NULL; + m_TransformedInput = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > @@ -99,8 +99,8 @@ { this->Superclass::Finish( progress, progressWeight ); - m_LandweberFilter = NULL; - m_IFFTFilter = NULL; + m_LandweberFilter = ITK_NULLPTR; + m_IFFTFilter = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkParametricBlindLeastSquaresDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkParametricBlindLeastSquaresDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkParametricBlindLeastSquaresDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkParametricBlindLeastSquaresDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -103,7 +103,7 @@ { // Compute the new padded, shifted, and transformed kernel m_KernelSource->UpdateLargestPossibleRegion(); - InternalComplexImagePointerType preparedKernel = NULL; + InternalComplexImagePointerType preparedKernel = ITK_NULLPTR; this->PrepareKernel( m_KernelSource->GetOutput(), preparedKernel, progress, 0.0 ); m_DifferenceFilter->SetInput1( m_TransformedCurrentEstimate ); @@ -266,10 +266,10 @@ this->Superclass::Finish( progress, progressWeight ); - m_TransformedInput = NULL; - m_TransformedCurrentEstimate = NULL; - m_DifferenceFilter = NULL; - m_ImageUpdateFilter = NULL; + m_TransformedInput = ITK_NULLPTR; + m_TransformedCurrentEstimate = ITK_NULLPTR; + m_DifferenceFilter = ITK_NULLPTR; + m_ImageUpdateFilter = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkProjectedIterativeDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkProjectedIterativeDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkProjectedIterativeDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkProjectedIterativeDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,14 +27,14 @@ ProjectedIterativeDeconvolutionImageFilter< TSuperclass > ::ProjectedIterativeDeconvolutionImageFilter() { - m_ProjectionFilter = NULL; + m_ProjectionFilter = ITK_NULLPTR; } template< typename TSuperclass > ProjectedIterativeDeconvolutionImageFilter< TSuperclass > ::~ProjectedIterativeDeconvolutionImageFilter() { - m_ProjectionFilter = NULL; + m_ProjectionFilter = ITK_NULLPTR; } template< typename TSuperclass > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkRichardsonLucyDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkRichardsonLucyDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkRichardsonLucyDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkRichardsonLucyDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,14 +27,14 @@ RichardsonLucyDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > ::RichardsonLucyDeconvolutionImageFilter() { - m_PaddedInput = NULL; + m_PaddedInput = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > RichardsonLucyDeconvolutionImageFilter< TInputImage, TKernelImage, TOutputImage, TInternalPrecision > ::~RichardsonLucyDeconvolutionImageFilter() { - m_PaddedInput = NULL; + m_PaddedInput = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > @@ -142,14 +142,14 @@ { this->Superclass::Finish( progress, progressWeight ); - m_ComplexMultiplyFilter1 = NULL; - m_IFFTFilter1 = NULL; - m_DivideFilter = NULL; - m_FFTFilter = NULL; - m_ConjugateAdaptor = NULL; - m_ComplexMultiplyFilter2 = NULL; - m_IFFTFilter2 = NULL; - m_MultiplyFilter = NULL; + m_ComplexMultiplyFilter1 = ITK_NULLPTR; + m_IFFTFilter1 = ITK_NULLPTR; + m_DivideFilter = ITK_NULLPTR; + m_FFTFilter = ITK_NULLPTR; + m_ConjugateAdaptor = ITK_NULLPTR; + m_ComplexMultiplyFilter2 = ITK_NULLPTR; + m_IFFTFilter2 = ITK_NULLPTR; + m_MultiplyFilter = ITK_NULLPTR; } template< typename TInputImage, typename TKernelImage, typename TOutputImage, typename TInternalPrecision > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkTikhonovDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkTikhonovDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkTikhonovDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkTikhonovDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,8 +47,8 @@ const KernelImageType* kernelImage = this->GetKernelImage(); - InternalComplexImagePointerType input = NULL; - InternalComplexImagePointerType kernel = NULL; + InternalComplexImagePointerType input = ITK_NULLPTR; + InternalComplexImagePointerType kernel = ITK_NULLPTR; this->PrepareInputs( localInput, kernelImage, input, kernel, progress, 0.7 ); @@ -69,8 +69,8 @@ progress->RegisterInternalFilter( tikhonovFilter, 0.1 ); // Free up the memory for the prepared inputs - input = NULL; - kernel = NULL; + input = ITK_NULLPTR; + kernel = ITK_NULLPTR; this->ProduceOutput( tikhonovFilter->GetOutput(), progress, 0.2 ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkWienerDeconvolutionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkWienerDeconvolutionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkWienerDeconvolutionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Deconvolution/include/itkWienerDeconvolutionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,8 +47,8 @@ const KernelImageType* kernelImage = this->GetKernelImage(); - InternalComplexImagePointerType input = NULL; - InternalComplexImagePointerType kernel = NULL; + InternalComplexImagePointerType input = ITK_NULLPTR; + InternalComplexImagePointerType kernel = ITK_NULLPTR; this->PrepareInputs( localInput, kernelImage, input, kernel, progress, 0.7 ); @@ -68,8 +68,8 @@ progress->RegisterInternalFilter( wienerFilter, 0.1 ); // Free up the memory for the prepared inputs - input = NULL; - kernel = NULL; + input = ITK_NULLPTR; + kernel = ITK_NULLPTR; this->ProduceOutput( wienerFilter->GetOutput(), progress, 0.2 ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingBaseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingBaseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingBaseImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingBaseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -54,8 +54,8 @@ m_ManualReinitialization = false; m_State = UNINITIALIZED; - m_InputImage = 0; - m_OutputImage = 0; + m_InputImage = ITK_NULLPTR; + m_OutputImage = ITK_NULLPTR; } template @@ -249,7 +249,7 @@ { const typename Self::Pointer thisPtr = const_cast< Self* >(this); // cache input image, if it has not yet been set. - if(thisPtr->m_InputImage == 0) + if(thisPtr->m_InputImage == ITK_NULLPTR) { thisPtr->m_InputImage = this->GetInput(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,44 +35,31 @@ template PatchBasedDenoisingImageFilter -::PatchBasedDenoisingImageFilter() +::PatchBasedDenoisingImageFilter() : + m_UpdateBuffer(OutputImageType::New()), + m_NumPixelComponents(0), // not valid until Initialize() + m_NumIndependentComponents(0), // not valid until Initialize() + m_TotalNumberPixels(0), // not valid until an image is provided + m_UseSmoothDiscPatchWeights(true), + m_UseFastTensorComputations(true), + m_KernelBandwidthSigmaIsSet(false), + m_ZeroPixel(), // not valid until Initialize() + m_KernelBandwidthFractionPixelsForEstimation(0.20), + m_ComputeConditionalDerivatives(false), + m_MinSigma(NumericTraits::min() * 100), // to avoid divide by zero + m_MinProbability(NumericTraits::min() * 100), // to avoid divide by zero + m_SigmaUpdateDecimationFactor(static_cast + (Math::Round(1.0 / m_KernelBandwidthFractionPixelsForEstimation))), + m_SigmaUpdateConvergenceTolerance(0.01), // desired accuracy of Newton-Raphson sigma estimation + m_KernelBandwidthMultiplicationFactor(1.0), + m_NoiseSigma(0.0), + m_NoiseSigmaSquared(0.0), + m_NoiseSigmaIsSet(false), + m_Sampler(ITK_NULLPTR), // not valid until a sampler is provided + m_SearchSpaceList(ListAdaptorType::New()) { - m_SearchSpaceList = ListAdaptorType::New(); - m_UpdateBuffer = OutputImageType::New(); - - // patch weights - m_UseSmoothDiscPatchWeights = true; - - // - m_UseFastTensorComputations = true; - // by default, turn off automatic kernel bandwidth sigma estimation this->KernelBandwidthEstimationOff(); - // minimum probability, used to avoid divide by zero - m_MinProbability = NumericTraits::min() * 100; - // minimum sigma allowed, used to avoid divide by zero - m_MinSigma = NumericTraits::min() * 100; - - m_ComputeConditionalDerivatives = false; - m_KernelBandwidthFractionPixelsForEstimation = 0.20; - m_SigmaUpdateDecimationFactor = static_cast - (Math::Round(1.0 / m_KernelBandwidthFractionPixelsForEstimation) ); - // desired accuracy of Newton-Raphson sigma estimation - m_SigmaUpdateConvergenceTolerance = 0.01; - m_KernelBandwidthMultiplicationFactor = 1.0; - - m_NoiseSigmaIsSet = false; - m_KernelBandwidthSigmaIsSet = false; - - m_TotalNumberPixels = 0; // won't be valid until an image is provided - m_Sampler = 0; // won't be valid until a sampler is provided - m_NumPixelComponents = 0; // won't be valid until Initialize() gets - // called - m_NumIndependentComponents = 0; // won't be valid until Initialize() gets - // called - // m_IntensityRescaleInvFactor won't be allocated until Initialize() gets - // called - // because we need the input image first. } template @@ -354,7 +341,7 @@ newStruct.minNorm[ic] = 0; newStruct.maxNorm[ic] = 0; } - newStruct.sampler = NULL; + newStruct.sampler = ITK_NULLPTR; m_ThreadData.push_back(newStruct); } @@ -845,8 +832,8 @@ if (foundMinMax) { threadData.validNorms[0] = 1; - threadData.minNorm[0] = vcl_sqrt(minNorm[0]); - threadData.maxNorm[0] = vcl_sqrt(maxNorm[0]); + threadData.minNorm[0] = std::sqrt(minNorm[0]); + threadData.maxNorm[0] = std::sqrt(maxNorm[0]); itkDebugMacro( <<"threadData minNorm: " << minNorm[0] << ", maxNorm: " << maxNorm[0] ); @@ -972,7 +959,7 @@ RealTensorValueT n, sqrtn, s; n = I1div3 * I1div3 - I2/3; s = I1div3 * I1div3 * I1div3 - I1*I2/6 + I3/2; - sqrtn = vcl_sqrt(n); + sqrtn = std::sqrt(n); // now check for some degenerate cases // if these occur, default to the standard eigen analysis @@ -993,7 +980,7 @@ // Compute phi = (acos((s/n) * sqrt(1/n)) / 3) RealTensorValueT phi; - phi = vcl_acos( (s/n) * 1/sqrtn) / 3; + phi = std::acos( (s/n) * 1/sqrtn) / 3; // Now compute the eigenvalues // lambda1 = I1/3 + 2*sqrt(n)*cos(phi) @@ -1003,8 +990,8 @@ // lambda3 also = I1 - lambda1 - lambda2 RealTensorValueT lambda1, lambda2, lambda3; - lambda1 = I1div3 + 2 * sqrtn * vcl_cos(phi); - lambda2 = I1div3 - 2*sqrtn * vcl_cos(vnl_math::pi/3 + phi); + lambda1 = I1div3 + 2 * sqrtn * std::cos(phi); + lambda2 = I1div3 - 2*sqrtn * std::cos(vnl_math::pi/3 + phi); lambda3 = I1 - lambda1 - lambda2; eigenVals[0] = lambda1; @@ -1052,7 +1039,7 @@ // eigenVec = e / sqrt(e'e) RealTensorValueT norm, sqrtnorm; norm = ex * ex + ey * ey + ez * ez; - sqrtnorm = vcl_sqrt(norm); + sqrtnorm = std::sqrt(norm); eigenVecs(i,0) = ex / sqrtnorm; eigenVecs(i,1) = ey / sqrtnorm; eigenVecs(i,2) = ez / sqrtnorm; @@ -1077,10 +1064,8 @@ EigenVectorsCacheType& eigenVecsCache, RealType& symMatrixLogMap, RealArrayType& geodesicDist) { - typedef typename PixelType::MatrixType MatrixType; typedef typename RealType::EigenValuesArrayType RealEigenValuesArrayType; typedef typename RealType::EigenVectorsMatrixType RealEigenVectorsMatrixType; - typedef typename RealType::MatrixType RealMatrixType; EigenValuesArrayType eigenVals; EigenVectorsMatrixType eigenVecs; RealEigenValuesArrayType YEigenVals; @@ -1109,8 +1094,8 @@ if (cacheIndex >= eigenValsCache.size() ) { - eigenValsCache.resize(cacheIndex+1, 0); - eigenVecsCache.resize(cacheIndex+1, 0); + eigenValsCache.resize(cacheIndex+1, ITK_NULLPTR); + eigenVecsCache.resize(cacheIndex+1, ITK_NULLPTR); } delete eigenValsCache[cacheIndex]; @@ -1143,9 +1128,9 @@ factor2 = spdMatrixB[2] * eigenVecs(0,0) + spdMatrixB[4] * eigenVecs(0,1) + spdMatrixB[5] * eigenVecs(0,2); Y[0] = ( eigenVecs(0,0) * factor0 + eigenVecs(0,1) * factor1 + eigenVecs(0,2) * factor2 ) / eigenVals[0]; - Y[1] = ( eigenVecs(1,0) * factor0 + eigenVecs(1,1) * factor1 + eigenVecs(1,2) * factor2 ) / vcl_sqrt( + Y[1] = ( eigenVecs(1,0) * factor0 + eigenVecs(1,1) * factor1 + eigenVecs(1,2) * factor2 ) / std::sqrt( eigenVals[0] * eigenVals[1]); - Y[2] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / vcl_sqrt( + Y[2] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / std::sqrt( eigenVals[0] * eigenVals[2]); factor0 = spdMatrixB[0] * eigenVecs(1,0) + spdMatrixB[1] * eigenVecs(1,1) + spdMatrixB[2] * eigenVecs(1,2); @@ -1153,7 +1138,7 @@ factor2 = spdMatrixB[2] * eigenVecs(1,0) + spdMatrixB[4] * eigenVecs(1,1) + spdMatrixB[5] * eigenVecs(1,2); Y[3] = ( eigenVecs(1,0) * factor0 + eigenVecs(1,1) * factor1 + eigenVecs(1,2) * factor2 ) / eigenVals[1]; - Y[4] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / vcl_sqrt( + Y[4] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / std::sqrt( eigenVals[1] * eigenVals[2]); factor0 = spdMatrixB[0] * eigenVecs(2,0) + spdMatrixB[1] * eigenVecs(2,1) + spdMatrixB[2] * eigenVecs(2,2); @@ -1187,11 +1172,11 @@ // these calculations can be optimized as follows. for (unsigned int ii = 0; ii < 3; ++ii) { - YEigenVals[ii] = vcl_log(vnl_math_max(RealValueType(1e-15),YEigenVals[ii]) ); + YEigenVals[ii] = std::log(vnl_math_max(RealValueType(1e-15),YEigenVals[ii]) ); } - const RealValueType eigVal0 = vcl_sqrt(eigenVals[0]); - const RealValueType eigVal1 = vcl_sqrt(eigenVals[1]); - const RealValueType eigVal2 = vcl_sqrt(eigenVals[2]); + const RealValueType eigVal0 = std::sqrt(eigenVals[0]); + const RealValueType eigVal1 = std::sqrt(eigenVals[1]); + const RealValueType eigVal2 = std::sqrt(eigenVals[2]); const RealValueType YEigVal0 = YEigenVals[0]; const RealValueType YEigVal1 = YEigenVals[1]; const RealValueType YEigVal2 = YEigenVals[2]; @@ -1263,7 +1248,6 @@ { typedef typename RealType::EigenValuesArrayType RealEigenValuesArrayType; typedef typename RealType::EigenVectorsMatrixType RealEigenVectorsMatrixType; - typedef typename RealType::MatrixType RealMatrixType; RealEigenValuesArrayType eigenVals; RealEigenVectorsMatrixType eigenVecs; RealEigenValuesArrayType YEigenVals; @@ -1308,9 +1292,9 @@ factor2 = symMatrix[2] * eigenVecs(0,0) + symMatrix[4] * eigenVecs(0,1) + symMatrix[5] * eigenVecs(0,2); Y[0] = ( eigenVecs(0,0) * factor0 + eigenVecs(0,1) * factor1 + eigenVecs(0,2) * factor2 ) / eigenVals[0]; - Y[1] = ( eigenVecs(1,0) * factor0 + eigenVecs(1,1) * factor1 + eigenVecs(1,2) * factor2 ) / vcl_sqrt( + Y[1] = ( eigenVecs(1,0) * factor0 + eigenVecs(1,1) * factor1 + eigenVecs(1,2) * factor2 ) / std::sqrt( eigenVals[0] * eigenVals[1]); - Y[2] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / vcl_sqrt( + Y[2] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / std::sqrt( eigenVals[0] * eigenVals[2]); factor0 = symMatrix[0] * eigenVecs(1,0) + symMatrix[1] * eigenVecs(1,1) + symMatrix[2] * eigenVecs(1,2); @@ -1318,7 +1302,7 @@ factor2 = symMatrix[2] * eigenVecs(1,0) + symMatrix[4] * eigenVecs(1,1) + symMatrix[5] * eigenVecs(1,2); Y[3] = ( eigenVecs(1,0) * factor0 + eigenVecs(1,1) * factor1 + eigenVecs(1,2) * factor2 ) / eigenVals[1]; - Y[4] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / vcl_sqrt( + Y[4] = ( eigenVecs(2,0) * factor0 + eigenVecs(2,1) * factor1 + eigenVecs(2,2) * factor2 ) / std::sqrt( eigenVals[1] * eigenVals[2]); factor0 = symMatrix[0] * eigenVecs(2,0) + symMatrix[1] * eigenVecs(2,1) + symMatrix[2] * eigenVecs(2,2); @@ -1350,11 +1334,11 @@ for (unsigned int ii = 0; ii < 3; ++ii) { - YEigenVals[ii] = vcl_exp(YEigenVals[ii]); + YEigenVals[ii] = std::exp(YEigenVals[ii]); } - const RealValueType eigVal0 = vcl_sqrt(eigenVals[0]); - const RealValueType eigVal1 = vcl_sqrt(eigenVals[1]); - const RealValueType eigVal2 = vcl_sqrt(eigenVals[2]); + const RealValueType eigVal0 = std::sqrt(eigenVals[0]); + const RealValueType eigVal1 = std::sqrt(eigenVals[1]); + const RealValueType eigVal2 = std::sqrt(eigenVals[2]); const RealValueType YEigVal0 = YEigenVals[0]; const RealValueType YEigVal1 = YEigenVals[1]; const RealValueType YEigVal2 = YEigenVals[2]; @@ -1858,7 +1842,7 @@ squaredNorm[ic] += centerPatchSquaredNorm[ic]; const RealValueType sigmaKernel = m_KernelBandwidthSigma[ic]; - const RealValueType distanceJointEntropy = vcl_sqrt(squaredNorm[ic]); + const RealValueType distanceJointEntropy = std::sqrt(squaredNorm[ic]); const RealValueType gaussianJointEntropy = exp(-vnl_math_sqr(distanceJointEntropy / sigmaKernel) / 2.0); @@ -1875,7 +1859,7 @@ if (m_ComputeConditionalDerivatives) { const RealValueType distancePatchEntropySquared = squaredNorm[ic] - centerPatchSquaredNorm[ic]; - const RealValueType distancePatchEntropy = vcl_sqrt(distancePatchEntropySquared); + const RealValueType distancePatchEntropy = std::sqrt(distancePatchEntropySquared); const RealValueType gaussianPatchEntropy = exp(-vnl_math_sqr(distancePatchEntropy / sigmaKernel) / 2.0); probPatchEntropy[ic] += gaussianPatchEntropy; @@ -2573,26 +2557,9 @@ os << indent << "KernelBandwidthMultiplicationFactor: " << m_KernelBandwidthMultiplicationFactor << std::endl; - if (m_Sampler) - { - os << indent << "Sampler: " << std::endl; - m_Sampler->Print(os,indent.GetNextIndent() ); - } - else - { - os << indent << "Sampler: " << "(None)" << std::endl; - } + itkPrintSelfObjectMacro( Sampler ); + itkPrintSelfObjectMacro( UpdateBuffer ); - if (m_UpdateBuffer) - { - os << indent << "Update buffer:\n"; - m_UpdateBuffer->Print(os, indent.GetNextIndent() ); - os << std::endl; - } - else - { - os << indent << "Update buffer is NULL" << std::endl; - } os << std::endl; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,6 +24,7 @@ #include "itkArray.h" #include "itkImageMaskSpatialObject.h" #include "vnl/vnl_vector.h" +#include "itkProgressReporter.h" namespace itk { @@ -43,7 +44,7 @@ m_NumberOfBaselineImages = 1; m_Threshold = NumericTraits< ReferencePixelType >::min(); m_GradientImageTypeEnumeration = Else; - m_GradientDirectionContainer = NULL; + m_GradientDirectionContainer = ITK_NULLPTR; m_TensorBasis.set_identity(); m_BValue = 1.0; m_MaskImagePresent = false; @@ -181,7 +182,7 @@ TTensorPixelType, TMaskImageType > ::ThreadedGenerateData(const OutputImageRegionType & outputRegionForThread, - ThreadIdType) + ThreadIdType threadId) { typename OutputImageType::Pointer outputImage = static_cast< OutputImageType * >( this->ProcessObject::GetOutput(0) ); @@ -242,6 +243,8 @@ // "A Dual Tensor Basis Solution to the Stejskal-Tanner Equations for // DT-MRI" + ProgressReporter progress( this, threadId, outputRegionForThread.GetNumberOfPixels() ); + while ( !it.IsAtEnd() ) { @@ -275,7 +278,7 @@ } else { - B[i] = -vcl_log( static_cast< double >( b ) / static_cast< double >( b0 ) ) / this->m_BValue; + B[i] = -std::log( static_cast< double >( b ) / static_cast< double >( b0 ) ) / this->m_BValue; } ++( *gradientItContainer[i] ); @@ -309,6 +312,7 @@ oit.Set(tensor); ++oit; ++it; + progress.CompletedPixel(); } for ( unsigned int i = 0; i < gradientItContainer.size(); i++ ) @@ -323,7 +327,7 @@ GradientIteratorType; typedef typename GradientImagesType::PixelType GradientVectorType; - typename GradientImagesType::Pointer gradientImagePointer = NULL; + typename GradientImagesType::Pointer gradientImagePointer = ITK_NULLPTR; // Would have liked a dynamic_cast here, but seems SGI doesn't like it // The enum will ensure that an inappropriate cast is not done @@ -353,6 +357,8 @@ } } + ProgressReporter progress( this, threadId, outputRegionForThread.GetNumberOfPixels() ); + while ( !git.IsAtEnd() ) { GradientVectorType b = git.Get(); @@ -395,7 +401,7 @@ else { B[i] = - -vcl_log( static_cast< double >( b[gradientind[i]] ) / static_cast< double >( b0 ) ) / this->m_BValue; + -std::log( static_cast< double >( b[gradientind[i]] ) / static_cast< double >( b0 ) ) / this->m_BValue; } } @@ -420,6 +426,7 @@ oit.Set(tensor); ++oit; // Output (reconstructed tensor image) iterator ++git; // Gradient image iterator + progress.CompletedPixel(); } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkComposeDisplacementFieldsImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkComposeDisplacementFieldsImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkComposeDisplacementFieldsImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkComposeDisplacementFieldsImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -129,10 +129,8 @@ ComposeDisplacementFieldsImageFilter ::PrintSelf( std::ostream& os, Indent indent ) const { - os << "Interpolator:" << std::endl; - this->m_Interpolator->Print( os, indent ); - Superclass::PrintSelf( os, indent ); + itkPrintSelfObjectMacro( Interpolator ); } } //end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkConstantVelocityFieldTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkConstantVelocityFieldTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkConstantVelocityFieldTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkConstantVelocityFieldTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ template ConstantVelocityFieldTransform ::ConstantVelocityFieldTransform() : - m_ConstantVelocityField( NULL ), + m_ConstantVelocityField( ITK_NULLPTR ), m_CalculateNumberOfIntegrationStepsAutomatically( false ), m_ConstantVelocityFieldSetTime( 0 ) { @@ -118,7 +118,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -171,8 +171,7 @@ * pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** Set the derivative weights according to the spacing of the input image (1/spacing). Use this option if you want to calculate the Jacobian diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -92,7 +92,6 @@ void DisplacementFieldJacobianDeterminantFilter< TInputImage, TRealType, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldToBSplineImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ this->m_NumberOfFittingLevels.Fill( 1 ); this->m_NumberOfControlPoints.Fill( 4 ); - this->m_DisplacementFieldControlPointLattice = NULL; + this->m_DisplacementFieldControlPointLattice = ITK_NULLPTR; } template @@ -84,9 +84,6 @@ typename PointSetType::Pointer fieldPoints = PointSetType::New(); fieldPoints->Initialize(); - typedef typename ImporterType::OutputImageType ImporterOutputImageType; - typedef typename ImporterOutputImageType::RegionType ImporterRegionType; - typedef typename InputFieldType::PointType InputFieldPointType; typedef ContinuousIndex ContinuousIndexType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkDisplacementFieldTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,8 +35,8 @@ DisplacementFieldTransform::DisplacementFieldTransform() : Superclass( 0 ) { - this->m_DisplacementField = NULL; - this->m_InverseDisplacementField = NULL; + this->m_DisplacementField = ITK_NULLPTR; + this->m_InverseDisplacementField = ITK_NULLPTR; this->m_FixedParameters.SetSize( NDimensions * ( NDimensions + 3 ) ); this->m_FixedParameters.Fill( 0.0 ); @@ -151,7 +151,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } @@ -377,7 +377,7 @@ if( !this->m_InverseDisplacementField.IsNull() ) { - this->m_InverseDisplacementField = NULL; + this->m_InverseDisplacementField = ITK_NULLPTR; } this->Modified(); /* Store this separately for use in smoothing because we only want diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkExponentialDisplacementFieldImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkExponentialDisplacementFieldImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkExponentialDisplacementFieldImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkExponentialDisplacementFieldImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -113,7 +113,7 @@ maxnorm2 /= vnl_math_sqr(minpixelspacing); InputPixelRealValueType numiterfloat = 2.0 - + 0.5 * vcl_log(maxnorm2) / vnl_math::ln2; + + 0.5 * std::log(maxnorm2) / vnl_math::ln2; if ( numiterfloat >= 0.0 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.h otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ TimeVaryingVelocityFieldTransform ); /** New macro for creation of through a Smart Pointer */ - itkSimpleNewMacro( Self ); + itkNewMacro( Self ); /** Dimension of the time varying velocity field. */ itkStaticConstMacro( TimeVaryingVelocityFieldDimension, unsigned int, NDimensions+1 ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,12 +33,13 @@ template GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform -::GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform() +::GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform() : + m_GaussianSmoothingTempFieldModifiedTime(0), + m_GaussianSpatialSmoothingVarianceForTheUpdateField(3.0), + m_GaussianSpatialSmoothingVarianceForTheTotalField(0.5), + m_GaussianTemporalSmoothingVarianceForTheUpdateField(0.25), + m_GaussianTemporalSmoothingVarianceForTheTotalField(0.0) { - this->m_GaussianSpatialSmoothingVarianceForTheUpdateField = 3.0; - this->m_GaussianSpatialSmoothingVarianceForTheTotalField = 0.5; - this->m_GaussianTemporalSmoothingVarianceForTheUpdateField = 0.25; - this->m_GaussianTemporalSmoothingVarianceForTheTotalField = 0.0; } template diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInverseDisplacementFieldImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInverseDisplacementFieldImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInverseDisplacementFieldImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInverseDisplacementFieldImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -134,7 +134,6 @@ typedef typename InputImageType::RegionType InputRegionType; typedef typename InputImageType::SizeType InputSizeType; - typedef typename InputImageType::IndexType InputIndexType; InputRegionType region; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -20,6 +20,8 @@ #include "itkImageToImageFilter.h" #include "itkVectorInterpolateImageFunction.h" +#include "itkVectorLinearInterpolateImageFunction.h" +#include "itkSimpleFastMutexLock.h" namespace itk { @@ -73,6 +75,8 @@ typedef typename VectorType::ComponentType RealType; typedef Image RealImageType; typedef VectorInterpolateImageFunction InterpolatorType; + typedef VectorLinearInterpolateImageFunction + DefaultInterpolatorType; /** Get the interpolator. */ itkGetModifiableObjectMacro( Interpolator, InterpolatorType ); @@ -169,6 +173,7 @@ SpacingType m_DisplacementFieldSpacing; bool m_DoThreadedEstimateInverse; bool m_EnforceBoundaryCondition; + SimpleFastMutexLock m_Mutex; }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,7 @@ #include "itkComposeDisplacementFieldsImageFilter.h" #include "itkImageDuplicator.h" #include "itkImageRegionIterator.h" -#include "itkVectorLinearInterpolateImageFunction.h" +#include "itkMutexLockHolder.h" namespace itk { @@ -34,19 +34,20 @@ template InvertDisplacementFieldImageFilter ::InvertDisplacementFieldImageFilter() : - m_MaximumNumberOfIterations( 20 ), - m_MaxErrorToleranceThreshold( 0.1 ), - m_MeanErrorToleranceThreshold( 0.001 ) + m_Interpolator(DefaultInterpolatorType::New()), + m_MaximumNumberOfIterations(20), + m_MaxErrorToleranceThreshold(0.1), + m_MeanErrorToleranceThreshold(0.001), + + m_ComposedField(DisplacementFieldType::New()), + m_ScaledNormImage(RealImageType::New()), + m_MaxErrorNorm(0.0), + m_MeanErrorNorm(0.0), + m_Epsilon(0.0), + m_DoThreadedEstimateInverse(false), + m_EnforceBoundaryCondition(true) { this->SetNumberOfRequiredInputs( 1 ); - - typedef VectorLinearInterpolateImageFunction DefaultInterpolatorType; - typename DefaultInterpolatorType::Pointer interpolator = DefaultInterpolatorType::New(); - this->m_Interpolator = interpolator; - - this->m_ComposedField = DisplacementFieldType::New(); - this->m_ScaledNormImage = RealImageType::New(); - this->m_EnforceBoundaryCondition = true; } template @@ -109,8 +110,9 @@ this->m_ScaledNormImage->CopyInformation( displacementField ); this->m_ScaledNormImage->SetRegions( displacementField->GetRequestedRegion() ); - this->m_ScaledNormImage->Allocate(); - this->m_ScaledNormImage->FillBuffer( 0.0 ); + this->m_ScaledNormImage->Allocate(true); // initialize + // buffer + // to zero SizeValueType numberOfPixelsInRegion = ( displacementField->GetRequestedRegion() ).GetNumberOfPixels(); this->m_MaxErrorNorm = NumericTraits::max(); @@ -211,6 +213,8 @@ else { VectorType inverseSpacing; + RealType localMean = NumericTraits::Zero; + RealType localMax = NumericTraits::Zero; for( unsigned int d = 0; d < ImageDimension; ++d ) { inverseSpacing[d]=1.0/this->m_DisplacementFieldSpacing[d]; @@ -223,17 +227,25 @@ { scaledNorm += vnl_math_sqr( displacement[d] * inverseSpacing[d] ); } - scaledNorm = vcl_sqrt( scaledNorm ); + scaledNorm = std::sqrt( scaledNorm ); - this->m_MeanErrorNorm += scaledNorm; - if( this->m_MaxErrorNorm < scaledNorm ) + localMean += scaledNorm; + if( localMax < scaledNorm ) { - this->m_MaxErrorNorm = scaledNorm; + localMax = scaledNorm; } ItS.Set( scaledNorm ); ItE.Set( -displacement ); } + { + MutexLockHolder holder(m_Mutex); + this->m_MeanErrorNorm += localMean; + if( this->m_MaxErrorNorm < localMax ) + { + this->m_MaxErrorNorm = localMax; + } + } } } @@ -244,8 +256,7 @@ { Superclass::PrintSelf( os, indent ); - os << "Interpolator:" << std::endl; - this->m_Interpolator->Print( os, indent ); + itkPrintSelfObjectMacro( Interpolator ); os << "Maximum number of iterations: " << this->m_MaximumNumberOfIterations << std::endl; os << "Max error tolerance threshold: " << this->m_MaxErrorToleranceThreshold << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkIterativeInverseDisplacementFieldImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkIterativeInverseDisplacementFieldImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkIterativeInverseDisplacementFieldImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkIterativeInverseDisplacementFieldImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -146,9 +146,9 @@ smallestError = 0; for ( unsigned int j = 0; j < ImageDimension; j++ ) { - smallestError += vcl_pow(mappedPoint[j] + forwardVector[j] - originalPoint[j], 2); + smallestError += std::pow(mappedPoint[j] + forwardVector[j] - originalPoint[j], 2); } - smallestError = vcl_sqrt(smallestError); + smallestError = std::sqrt(smallestError); } // iteration loop @@ -170,9 +170,9 @@ tmp = 0; for ( unsigned int l = 0; l < ImageDimension; l++ ) { - tmp += vcl_pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); + tmp += std::pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); } - tmp = vcl_sqrt(tmp); + tmp = std::sqrt(tmp); if ( tmp < smallestError ) { smallestError = tmp; @@ -190,9 +190,9 @@ tmp = 0; for ( unsigned int l = 0; l < ImageDimension; l++ ) { - tmp += vcl_pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); + tmp += std::pow(mappedPoint[l] + forwardVector[l] - originalPoint[l], 2); } - tmp = vcl_sqrt(tmp); + tmp = std::sqrt(tmp); if ( tmp < smallestError ) { smallestError = tmp; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.h otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.h 2014-09-03 08:29:34.000000000 +0000 @@ -79,7 +79,7 @@ itkTypeMacro( TimeVaryingBSplineVelocityFieldTransform, VelocityFieldTransform ); /** New macro for creation of through a Smart Pointer */ - itkSimpleNewMacro( Self ); + itkNewMacro( Self ); /** InverseTransform type. */ typedef typename Superclass::InverseTransformBasePointer InverseTransformBasePointer; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingBSplineVelocityFieldTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -109,6 +109,7 @@ inverseIntegrator->SetInput( bspliner->GetOutput() ); inverseIntegrator->SetLowerTimeBound( this->GetUpperTimeBound() ); inverseIntegrator->SetUpperTimeBound( this->GetLowerTimeBound() ); + if( this->GetVelocityFieldInterpolator() ) { inverseIntegrator->SetVelocityFieldInterpolator( this->GetModifiableVelocityFieldInterpolator() ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -93,7 +93,6 @@ typedef typename DisplacementFieldType::SpacingType SpacingType; typedef typename DisplacementFieldType::PointType OriginType; typedef typename DisplacementFieldType::DirectionType DirectionType; - typedef typename DisplacementFieldType::RegionType RegionType; SizeType size; SpacingType spacing; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,201 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkTransformToDisplacementFieldFilter_h +#define __itkTransformToDisplacementFieldFilter_h + +#include "itkDataObjectDecorator.h" +#include "itkTransform.h" +#include "itkImageSource.h" + +namespace itk +{ +/** \class TransformToDisplacementFieldFilter + * \brief Generate a displacement field from a coordinate transform + * + * Output information (spacing, size and direction) for the output + * image should be set. This information has the normal defaults of + * unit spacing, zero origin and identity direction. Optionally, the + * output information can be obtained from a reference image. If the + * reference image is provided and UseReferenceImage is On, then the + * spacing, origin and direction of the reference image will be used. + * + * Since this filter produces an image which is a different size than + * its input, it needs to override several of the methods defined + * in ProcessObject in order to properly manage the pipeline execution model. + * In particular, this filter overrides + * ProcessObject::GenerateOutputInformation(). + * + * This filter is implemented as a multithreaded filter. It provides a + * ThreadedGenerateData() method for its implementation. + * + * \author Marius Staring, Leiden University Medical Center, The Netherlands. + * + * This class was taken from the Insight Journal paper: + * http://hdl.handle.net/1926/1387 + * + * \ingroup GeometricTransform + * \ingroup ITKDisplacementField + */ +template< typename TOutputImage, + typename TScalar = double > +class TransformToDisplacementFieldFilter: + public ImageSource< TOutputImage > +{ +public: + /** Standard class typedefs. */ + typedef TransformToDisplacementFieldFilter Self; + typedef ImageSource< TOutputImage > Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + typedef TOutputImage OutputImageType; + typedef typename OutputImageType::RegionType OutputImageRegionType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(TransformToDisplacementFieldFilter, ImageSource); + + /** Number of dimensions. */ + itkStaticConstMacro(ImageDimension, unsigned int, TOutputImage::ImageDimension); + + /** Typedefs for transform. */ + typedef Transform< TScalar, ImageDimension, ImageDimension > TransformType; + typedef DataObjectDecorator< TransformType > TransformInputType; + + /** Typedefs for output image. */ + typedef typename OutputImageType::PixelType PixelType; + typedef typename PixelType::ValueType PixelValueType; + typedef typename OutputImageType::RegionType RegionType; + typedef typename RegionType::SizeType SizeType; + typedef typename OutputImageType::IndexType IndexType; + typedef typename OutputImageType::PointType PointType; + typedef typename OutputImageType::SpacingType SpacingType; + typedef typename OutputImageType::PointType OriginType; + typedef typename OutputImageType::DirectionType DirectionType; + + /** Typedef the reference image ImageBase. */ + typedef ImageBase< ImageDimension > ReferenceImageBaseType; + + /** Get/Set the coordinate transformation. + * Set the coordinate transform to use for resampling. Note that this must + * be in physical coordinates and it is the output-to-input transform, NOT + * the input-to-output transform that you might naively expect. */ + using Superclass::SetInput; + virtual void SetInput( const TransformInputType * transform ); + const TransformInputType * GetInput() const; + itkSetGetDecoratedObjectInputMacro(Transform, TransformType); + + /** Set/Get the start index of the output largest possible region. + * The default is an index of all zeros. */ + itkSetMacro(OutputStartIndex, IndexType); + itkGetConstReferenceMacro(OutputStartIndex, IndexType); + + /** Set/Get the size of the output image. */ + itkSetMacro(Size, SizeType); + itkGetConstReferenceMacro(Size, SizeType); + + /** Set the output image spacing. */ + itkSetMacro(OutputSpacing, SpacingType); + virtual void SetOutputSpacing(const SpacePrecisionType *values); + + /** Get the output image spacing. */ + itkGetConstReferenceMacro(OutputSpacing, SpacingType); + + /** Set the output image origin. */ + itkSetMacro(OutputOrigin, OriginType); + virtual void SetOutputOrigin(const SpacePrecisionType *values); + + /** Get the output image origin. */ + itkGetConstReferenceMacro(OutputOrigin, OriginType); + + /** Set the output direction cosine matrix. */ + itkSetMacro(OutputDirection, DirectionType); + itkGetConstReferenceMacro(OutputDirection, DirectionType); + + /** Set a reference image to use to define the output information. + * By default, output information is specificed through the + * SetOutputSpacing, Origin, and Direction methods. Alternatively, + * this method can be used to specify an image from which to + * copy the information. UseReferenceImageOn must be set to utilize the + * reference image. */ + itkSetInputMacro(ReferenceImage, ReferenceImageBaseType); + + /** Get the reference image that is defining the output information. */ + itkGetInputMacro(ReferenceImage, ReferenceImageBaseType); + + /** Turn on/off whether a specified reference image should be used to define + * the output information. */ + itkSetMacro(UseReferenceImage, bool); + itkBooleanMacro(UseReferenceImage); + itkGetConstMacro(UseReferenceImage, bool); + +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkStaticConstMacro(PixelDimension, unsigned int, + PixelType::Dimension); + itkConceptMacro( SameDimensionCheck, + ( Concept::SameDimension< ImageDimension, PixelDimension > ) ); + // End concept checking +#endif + +protected: + TransformToDisplacementFieldFilter(); + virtual ~TransformToDisplacementFieldFilter() {} + + /** Produces a Vector Image. */ + virtual void GenerateOutputInformation(); + + /** TransformToDisplacementFieldFilter can be implemented as a multithreaded + * filter. + */ + virtual void ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId ); + + /** Default implementation for resampling that works for any + * transformation type. + */ + void NonlinearThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId ); + + /** Faster implementation for resampling that works for with linear + * transformation types. + */ + void LinearThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId ); + + virtual void PrintSelf(std::ostream & os, Indent indent) const; + +private: + TransformToDisplacementFieldFilter( const Self & ); //purposely not implemented + void operator=( const Self & ); //purposely not implemented + + /** Member variables. */ + SizeType m_Size; // size of the output region + IndexType m_OutputStartIndex; // start index of the output region + SpacingType m_OutputSpacing; // output image spacing + OriginType m_OutputOrigin; // output image origin + DirectionType m_OutputDirection; // output image direction cosines + bool m_UseReferenceImage; + +}; +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkTransformToDisplacementFieldFilter.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkTransformToDisplacementFieldFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,300 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkTransformToDisplacementFieldFilter_hxx +#define __itkTransformToDisplacementFieldFilter_hxx + +#include "itkTransformToDisplacementFieldFilter.h" + +#include "itkIdentityTransform.h" +#include "itkProgressReporter.h" +#include "itkImageRegionIteratorWithIndex.h" +#include "itkImageLinearIteratorWithIndex.h" + +namespace itk +{ + +template< typename TOutputImage, typename TScalarType > +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::TransformToDisplacementFieldFilter(): + m_UseReferenceImage( false ) +{ + this->m_OutputSpacing.Fill(1.0); + this->m_OutputOrigin.Fill(0.0); + this->m_OutputDirection.SetIdentity(); + + this->m_Size.Fill(0); + this->m_OutputStartIndex.Fill(0); + + this->SetNumberOfRequiredInputs( 1 ); + this->SetPrimaryInputName( "Transform" ); + + // #1 "ReferenceImage" optional + Self::AddRequiredInputName("ReferenceImage",1); + Self::RemoveRequiredInputName("ReferenceImage"); +} + + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "Size: " << this->m_Size << std::endl; + os << indent << "OutputStartIndex: " << this->m_OutputStartIndex << std::endl; + os << indent << "OutputSpacing: " << this->m_OutputSpacing << std::endl; + os << indent << "OutputOrigin: " << this->m_OutputOrigin << std::endl; + os << indent << "OutputDirection: " << this->m_OutputDirection << std::endl; + os << indent << "UseReferenceImage: "; + if( this->m_UseReferenceImage ) + { + os << "On" << std::endl; + } + else + { + os << "Off" << std::endl; + } +} + + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::SetOutputSpacing(const SpacePrecisionType *spacing) +{ + SpacingType ss(spacing); + this->SetOutputSpacing(ss); +} + + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::SetOutputOrigin(const SpacePrecisionType *origin) +{ + OriginType pp(origin); + this->SetOutputOrigin(pp); +} + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::SetInput( const TransformInputType * input ) +{ + if( input != itkDynamicCastInDebugMode< TransformInputType * >( this->ProcessObject::GetPrimaryInput() ) ) + { + // Process object is not const-correct so the const_cast is required here + this->ProcessObject::SetNthInput( 0, const_cast< TransformInputType * >( input ) ); + this->Modified(); + } +} + +template< typename TOutputImage, typename TScalarType > +const typename TransformToDisplacementFieldFilter< TOutputImage, TScalarType >::TransformInputType * +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::GetInput() const +{ + return itkDynamicCastInDebugMode< const TransformInputType * >( this->GetPrimaryInput() ); +} + + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::GenerateOutputInformation(void) +{ + OutputImageType * output = this->GetOutput(); + if ( !output ) + { + return; + } + + const ReferenceImageBaseType *referenceImage = this->GetReferenceImage(); + + // Set the size of the output region + if ( m_UseReferenceImage && referenceImage ) + { + output->SetLargestPossibleRegion( + referenceImage->GetLargestPossibleRegion() ); + } + else + { + typename TOutputImage::RegionType outputLargestPossibleRegion; + outputLargestPossibleRegion.SetSize(m_Size); + outputLargestPossibleRegion.SetIndex(m_OutputStartIndex); + output->SetLargestPossibleRegion(outputLargestPossibleRegion); + } + + // Set spacing and origin + if ( m_UseReferenceImage && referenceImage ) + { + output->SetSpacing( referenceImage->GetSpacing() ); + output->SetOrigin( referenceImage->GetOrigin() ); + output->SetDirection( referenceImage->GetDirection() ); + } + else + { + output->SetSpacing(m_OutputSpacing); + output->SetOrigin(m_OutputOrigin); + output->SetDirection(m_OutputDirection); + } +} + + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId ) +{ + const TransformType * transform = this->GetInput()->Get(); + // Check whether we can use a fast path for resampling. Fast path + // can be used if the transformation is linear. Transform respond + // to the IsLinear() call. + if ( transform->IsLinear() ) + { + this->LinearThreadedGenerateData(outputRegionForThread, threadId); + return; + } + + // Otherwise, we use the normal method where the transform is called + // for computing the transformation of every point. + this->NonlinearThreadedGenerateData(outputRegionForThread, threadId); +} + + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::NonlinearThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId ) +{ + // Get the output pointer + OutputImageType * output = this->GetOutput(); + const TransformType * transform = this->GetInput()->Get(); + + // Create an iterator that will walk the output region for this thread. + typedef ImageRegionIteratorWithIndex< TOutputImage > OutputIteratorType; + OutputIteratorType outIt( output, outputRegionForThread ); + + // Define a few variables that will be used to translate from an input pixel + // to an output pixel + PointType outputPoint; // Coordinates of output pixel + PointType transformedPoint; // Coordinates of transformed pixel + PixelType displacement; // the difference + + // Support for progress methods/callbacks + ProgressReporter progress( this, threadId, outputRegionForThread.GetNumberOfPixels() ); + + // Walk the output region + outIt.GoToBegin(); + while ( !outIt.IsAtEnd() ) + { + // Determine the index of the current output pixel + output->TransformIndexToPhysicalPoint( outIt.GetIndex(), outputPoint ); + + // Compute corresponding input pixel position + transformedPoint = transform->TransformPoint( outputPoint ); + + displacement = transformedPoint - outputPoint; + + // Set it + outIt.Set( displacement ); + + // Update progress and iterator + progress.CompletedPixel(); + ++outIt; + } +} + + +template< typename TOutputImage, typename TScalarType > +void +TransformToDisplacementFieldFilter< TOutputImage, TScalarType > +::LinearThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, ThreadIdType threadId ) +{ + // Get the output pointer + OutputImageType * output = this->GetOutput(); + const TransformType * transform = this->GetInput()->Get(); + + // Create an iterator that will walk the output region for this thread. + typedef ImageLinearIteratorWithIndex< TOutputImage > OutputIteratorType; + OutputIteratorType outIt( output, outputRegionForThread ); + + outIt.SetDirection(0); + + // Define a few indices that will be used to translate from an input pixel + // to an output pixel + PointType outputPoint; // Coordinates of current output pixel + PointType transformedPoint; // Coordinates of transformed pixel + PixelType displacement; // the difference + + IndexType index; + + // Support for progress methods/callbacks + ProgressReporter progress( this, threadId, outputRegionForThread.GetNumberOfPixels() ); + + // Determine the position of the first pixel in the scanline + outIt.GoToBegin(); + index = outIt.GetIndex(); + output->TransformIndexToPhysicalPoint( index, outputPoint ); + + // Compute corresponding transformed pixel position + transformedPoint = transform->TransformPoint( outputPoint ); + + // Compare with the ResampleImageFilter + + // Compute delta + PointType outputPointNeighbour; + PointType transformedPointNeighbour; + typedef typename PointType::VectorType VectorType; + VectorType delta; + ++index[0]; + output->TransformIndexToPhysicalPoint( index, outputPointNeighbour ); + transformedPointNeighbour = transform->TransformPoint( outputPointNeighbour ); + delta = transformedPointNeighbour - transformedPoint - ( outputPointNeighbour - outputPoint ); + + // loop over the vector image + while ( !outIt.IsAtEnd() ) + { + // Get current point + index = outIt.GetIndex(); + output->TransformIndexToPhysicalPoint( index, outputPoint ); + + // Compute transformed point + transformedPoint = transform->TransformPoint( outputPoint ); + + while ( !outIt.IsAtEndOfLine() ) + { + displacement = transformedPoint - outputPoint; + + // Set it + outIt.Set( displacement ); + + // Update stuff + progress.CompletedPixel(); + ++outIt; + transformedPoint += delta; + } + + outIt.NextLine(); + } +} + +} // end namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkVelocityFieldTransform.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkVelocityFieldTransform.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkVelocityFieldTransform.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DisplacementField/include/itkVelocityFieldTransform.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -116,7 +116,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkApproximateSignedDistanceMapImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkApproximateSignedDistanceMapImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkApproximateSignedDistanceMapImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkApproximateSignedDistanceMapImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,6 @@ #include "itkNumericTraits.h" #include "itkImageScanlineIterator.h" #include "itkProgressAccumulator.h" -#include "vcl_cmath.h" namespace itk { @@ -70,7 +69,7 @@ // double, // which is the general SizeValueType. maximumDistance = - static_cast< OutputSizeValueType >( vcl_sqrt( static_cast< double >( maximumDistance ) ) ); + static_cast< OutputSizeValueType >( std::sqrt( static_cast< double >( maximumDistance ) ) ); // Allocate the output this->AllocateOutputs(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ this->SetNumberOfRequiredInputs(2); m_UseImageSpacing = true; - m_DistanceMap = NULL; + m_DistanceMap = ITK_NULLPTR; m_ContourDirectedMeanDistance = NumericTraits< RealType >::Zero; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDanielssonDistanceMapImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDanielssonDistanceMapImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDanielssonDistanceMapImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDanielssonDistanceMapImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -296,7 +296,7 @@ } else { - dt.Set( static_cast< OutputPixelType >( vcl_sqrt(distance) ) ); + dt.Set( static_cast< OutputPixelType >( std::sqrt(distance) ) ); } ++ot; ++ct; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkDirectedHausdorffDistanceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ // this filter requires two input images this->SetNumberOfRequiredInputs(2); - m_DistanceMap = NULL; + m_DistanceMap = ITK_NULLPTR; m_DirectedHausdorffDistance = NumericTraits< RealType >::Zero; m_AverageHausdorffDistance = NumericTraits< RealType >::Zero; m_UseImageSpacing = true; @@ -182,7 +182,7 @@ } // clean up - m_DistanceMap = NULL; + m_DistanceMap = ITK_NULLPTR; } template< typename TInputImage1, typename TInputImage2 > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkFastChamferDistanceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkFastChamferDistanceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkFastChamferDistanceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkFastChamferDistanceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,12 +46,12 @@ itkWarningMacro(<< "Dimension " << ImageDimension << " with Default weights "); for ( unsigned int i = 1; i <= ImageDimension; i++ ) { - m_Weights[i - 1] = vcl_sqrt( static_cast< float >( i ) ); + m_Weights[i - 1] = std::sqrt( static_cast< float >( i ) ); } } m_MaximumDistance = 10.0; - m_NarrowBand = 0; + m_NarrowBand = ITK_NULLPTR; } template< typename TInputImage, typename TOutputImage > @@ -214,7 +214,7 @@ // Update the narrow band if ( m_NarrowBand.IsNotNull() ) { - if ( vcl_fabs( (float)center_value ) <= m_NarrowBand->GetTotalRadius() ) + if ( std::fabs( (float)center_value ) <= m_NarrowBand->GetTotalRadius() ) { node.m_Index = it.GetIndex(); //Check node state. @@ -223,7 +223,7 @@ { node.m_NodeState += SIGN_MASK; } - if ( vcl_fabs( (float)center_value ) < m_NarrowBand->GetInnerRadius() ) + if ( std::fabs( (float)center_value ) < m_NarrowBand->GetInnerRadius() ) { node.m_NodeState += INNER_MASK; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkIsoContourDistanceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ m_FarValue = 10 * NumericTraits< PixelType >::One; m_NarrowBanding = false; - m_NarrowBand = NULL; + m_NarrowBand = ITK_NULLPTR; m_Barrier = Barrier::New(); } @@ -263,8 +263,6 @@ //3. Computation over the narrowband ConstBandIterator bandIt = m_NarrowBandRegion[threadId].Begin; ConstBandIterator bandEnd = m_NarrowBandRegion[threadId].End; - typedef ImageRegionConstIterator< InputImageType > ConstIteratorType; - typedef ImageRegionIterator< OutputImageType > IteratorType; unsigned int n; @@ -371,20 +369,20 @@ grad[ng] = ( grad0[ng] * alpha0 + grad1[ng] * alpha1 ) / ( 2. * static_cast< PixelRealType >( m_Spacing[ng] ) ); norm += grad[ng] * grad[ng]; } - norm = vcl_sqrt( norm ); + norm = std::sqrt( norm ); if ( norm > NumericTraits< PixelRealType >::min() ) { - PixelRealType val = vcl_fabs( grad[n] ) * m_Spacing[n] / norm / diff; + PixelRealType val = std::fabs( grad[n] ) * m_Spacing[n] / norm / diff; PixelRealType valNew0 = val0 * val; PixelRealType valNew1 = val1 * val; - if ( vcl_fabs( static_cast< double >( valNew0 ) ) < vcl_fabs( static_cast< double >( outNeigIt.GetNext(n, 0) ) ) ) + if ( std::fabs( static_cast< double >( valNew0 ) ) < std::fabs( static_cast< double >( outNeigIt.GetNext(n, 0) ) ) ) { outNeigIt.SetNext( n, 0, static_cast< PixelType >( valNew0 ) ); } - if ( vcl_fabs( static_cast< double >( valNew1 ) ) < vcl_fabs( static_cast< double >( outNeigIt.GetNext(n, 1) ) ) ) + if ( std::fabs( static_cast< double >( valNew1 ) ) < std::fabs( static_cast< double >( outNeigIt.GetNext(n, 1) ) ) ) { outNeigIt.SetNext( n, 1, static_cast< PixelType >( valNew1 ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkReflectiveImageRegionConstIterator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkReflectiveImageRegionConstIterator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkReflectiveImageRegionConstIterator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkReflectiveImageRegionConstIterator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,7 @@ ReflectiveImageRegionConstIterator< TImage > ::ReflectiveImageRegionConstIterator(const Self & it) { - this->Operator = ( it ); + this->operator= ( it ); this->GoToBegin(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,9 +34,11 @@ ::SignedMaurerDistanceMapImageFilter(): m_BackgroundValue( NumericTraits< InputPixelType >::Zero ), m_Spacing(0.0), + m_CurrentDimension(0), m_InsideIsPositive(false), m_UseImageSpacing(true), - m_SquaredDistance(false) + m_SquaredDistance(false), + m_InputCache(ITK_NULLPTR) {} template< typename TInputImage, typename TOutputImage > @@ -79,9 +81,9 @@ double range = static_cast< double >( requestedRegionSize[splitAxis] ); unsigned int valuesPerThread = - static_cast< unsigned int >( vcl_ceil( range / static_cast< double >( num ) ) ); + static_cast< unsigned int >( std::ceil( range / static_cast< double >( num ) ) ); unsigned int maxThreadIdUsed = - static_cast< unsigned int >( vcl_ceil( range / static_cast< double >( valuesPerThread ) ) ) - 1; + static_cast< unsigned int >( std::ceil( range / static_cast< double >( valuesPerThread ) ) ) - 1; // Split the region if ( i < maxThreadIdUsed ) @@ -286,7 +288,7 @@ // cast to a real type is required on some platforms const OutputPixelType outputValue = static_cast< OutputPixelType >( - vcl_sqrt( static_cast< OutputRealType >( vnl_math_abs( Ot.Get() ) ) ) ); + std::sqrt( static_cast< OutputRealType >( vnl_math_abs( Ot.Get() ) ) ) ); if ( It.Get() != this->m_BackgroundValue ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,10 +33,10 @@ { this->ProcessObject::SetNumberOfRequiredInputs(0); - m_TrialPoints = NULL; - m_AlivePoints = NULL; - m_ProcessedPoints = NULL; - m_ForbiddenPoints = NULL; + m_TrialPoints = ITK_NULLPTR; + m_AlivePoints = ITK_NULLPTR; + m_ProcessedPoints = ITK_NULLPTR; + m_ForbiddenPoints = ITK_NULLPTR; //m_Heap = PriorityQueueType::New(); m_SpeedConstant = 1.; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilterBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ FastMarchingExtensionImageFilterBase< TInput, TOutput, TAuxValue, VAuxDimension > ::FastMarchingExtensionImageFilterBase() { - m_AuxiliaryAliveValues = NULL; - m_AuxiliaryTrialValues = NULL; + m_AuxiliaryAliveValues = ITK_NULLPTR; + m_AuxiliaryTrialValues = ITK_NULLPTR; this->ProcessObject::SetNumberOfRequiredOutputs(1 + AuxDimension); @@ -38,7 +38,7 @@ { ptr = AuxImageType::New(); this->ProcessObject::SetNthOutput( k + 1, ptr.GetPointer() ); - this->m_AuxImages[k] = 0; + this->m_AuxImages[k] = ITK_NULLPTR; } } @@ -67,7 +67,7 @@ { if ( idx >= AuxDimension || this->GetNumberOfIndexedOutputs() < idx + 2 ) { - return NULL; + return ITK_NULLPTR; } return static_cast< AuxImageType * >( this->ProcessObject::GetOutput(idx + 1) ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingExtensionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,8 +27,8 @@ FastMarchingExtensionImageFilter< TLevelSet, TAuxValue, VAuxDimension, TSpeedImage > ::FastMarchingExtensionImageFilter() { - m_AuxAliveValues = NULL; - m_AuxTrialValues = NULL; + m_AuxAliveValues = ITK_NULLPTR; + m_AuxTrialValues = ITK_NULLPTR; this->ProcessObject::SetNumberOfRequiredOutputs(1 + AuxDimension); @@ -66,7 +66,7 @@ { if ( idx >= AuxDimension || this->GetNumberOfIndexedOutputs() < idx + 2 ) { - return NULL; + return ITK_NULLPTR; } return this->m_AuxImages[idx]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ m_OutputDirection.SetIdentity(); m_OverrideOutputInformation = false; - m_InputCache = NULL; + m_InputCache = ITK_NULLPTR; m_LabelImage = LabelImageType::New(); } // ----------------------------------------------------------------------------- @@ -373,7 +373,7 @@ <<"Discriminant of quadratic equation is negative" ); } - oSolution = ( vcl_sqrt(discrim) + bb ) / aa; + oSolution = ( std::sqrt(discrim) + bb ) / aa; } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -136,6 +136,7 @@ class AxisNodeType:public NodeType { public: + AxisNodeType() : m_Axis(0) {} int GetAxis() const { return m_Axis; } void SetAxis(int axis) { m_Axis = axis; } const AxisNodeType & operator=(const NodeType & node) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,10 +46,10 @@ m_OutputDirection.SetIdentity(); m_OverrideOutputInformation = false; - m_AlivePoints = NULL; - m_OutsidePoints = NULL; - m_TrialPoints = NULL; - m_ProcessedPoints = NULL; + m_AlivePoints = ITK_NULLPTR; + m_OutsidePoints = ITK_NULLPTR; + m_TrialPoints = ITK_NULLPTR; + m_ProcessedPoints = ITK_NULLPTR; m_SpeedConstant = 1.0; m_InverseSpeed = -1.0; @@ -94,7 +94,7 @@ Superclass::GenerateOutputInformation(); // use user-specified output information - if ( this->GetInput() == NULL || m_OverrideOutputInformation ) + if ( this->GetInput() == ITK_NULLPTR || m_OverrideOutputInformation ) { LevelSetPointer output = this->GetOutput(); output->SetLargestPossibleRegion(m_OutputRegion); @@ -499,7 +499,7 @@ throw err; } - solution = ( vcl_sqrt(discrim) + bb ) / aa; + solution = ( std::sqrt(discrim) + bb ) / aa; } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingImageToNodePairContainerAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ template< typename TInput, typename TOutput, typename TImage > FastMarchingImageToNodePairContainerAdaptor< TInput, TOutput, TImage > ::FastMarchingImageToNodePairContainerAdaptor() : - m_AliveImage( NULL ), m_TrialImage( NULL ), m_ForbiddenImage( NULL ), - m_AlivePoints( NULL ), m_TrialPoints( NULL ), m_ForbiddenPoints( NULL ), + m_AliveImage( ITK_NULLPTR ), m_TrialImage( ITK_NULLPTR ), m_ForbiddenImage( ITK_NULLPTR ), + m_AlivePoints( ITK_NULLPTR ), m_TrialPoints( ITK_NULLPTR ), m_ForbiddenPoints( ITK_NULLPTR ), m_AliveValue( NumericTraits< OutputPixelType >::Zero ), m_TrialValue( NumericTraits< OutputPixelType >::Zero ), m_IsForbiddenImageBinaryMask( false ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingQuadEdgeMeshFilterBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ FastMarchingQuadEdgeMeshFilterBase< TInput, TOutput > ::FastMarchingQuadEdgeMeshFilterBase() : Superclass() { - this->m_InputMesh = 0; + this->m_InputMesh = ITK_NULLPTR; } template< typename TInput, typename TOutput > @@ -270,7 +270,7 @@ if( sq_norm1 > epsilon ) { - norm1 = vcl_sqrt( sq_norm1 ); + norm1 = std::sqrt( sq_norm1 ); OutputVectorRealType inv_norm1 = 1. / norm1; Edge1 *= inv_norm1; @@ -281,7 +281,7 @@ if( sq_norm2 > epsilon ) { - norm2 = vcl_sqrt( sq_norm2 ); + norm2 = std::sqrt( sq_norm2 ); OutputVectorRealType inv_norm2 = 1. / norm2; Edge2 *= inv_norm2; @@ -364,7 +364,7 @@ OutputVectorRealType t = large_value; OutputVectorRealType CosAngle = iDot; - OutputVectorRealType SinAngle = vcl_sqrt( 1. - iDot * iDot ); + OutputVectorRealType SinAngle = std::sqrt( 1. - iDot * iDot ); OutputVectorRealType u = iVal2 - iVal1; @@ -382,14 +382,14 @@ { if( vnl_math_abs( f2 ) > epsilon ) { - t = ( -f1 - vcl_sqrt( delta ) ) / f2; + t = ( -f1 - std::sqrt( delta ) ) / f2; // test if we must must choose the other solution if( ( t < u ) || ( iNorm2 * ( t - u ) / t < iNorm1 * CosAngle ) || ( iNorm1 / CosAngle < iNorm2 * ( t - u ) / t ) ) { - t = ( -f1 + vcl_sqrt( delta ) ) / f2; + t = ( -f1 + std::sqrt( delta ) ) / f2; } } else @@ -466,7 +466,7 @@ Vector2DType v1; v1[0] = dot; - v1[1] = vcl_sqrt( 1. - dot * dot ); + v1[1] = std::sqrt( 1. - dot * dot ); Vector2DType v2; v2[0] = 1.; @@ -534,7 +534,7 @@ Matrix2DType rotation; rotation[0][0] = dot; - rotation[0][1] = vcl_sqrt( 1. - dot * dot ); + rotation[0][1] = std::sqrt( 1. - dot * dot ); rotation[1][0] = - rotation[0][1]; rotation[1][1] = dot; @@ -578,7 +578,7 @@ if( oSqNorm > epsilon ) { - oNorm = vcl_sqrt( oSqNorm ); + oNorm = std::sqrt( oSqNorm ); OutputVectorRealType temp_norm = x_start1.GetNorm(); if( temp_norm > epsilon ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingReachedTargetNodesStoppingCriterion.h 2014-09-03 08:29:34.000000000 +0000 @@ -147,13 +147,15 @@ protected: /** Constructor */ - FastMarchingReachedTargetNodesStoppingCriterion() : Superclass() + FastMarchingReachedTargetNodesStoppingCriterion() : + Superclass(), + m_TargetCondition(AllTargets), + m_NumberOfTargetsToBeReached(0), + m_TargetOffset(NumericTraits< OutputPixelType >::Zero), + m_StoppingValue(NumericTraits< OutputPixelType >::Zero), + m_Satisfied(false), + m_Initialized(false) { - m_TargetCondition = AllTargets; - m_TargetOffset = NumericTraits< OutputPixelType >::Zero; - m_StoppingValue = NumericTraits< OutputPixelType >::Zero; - m_Satisfied = false; - m_Initialized = false; } /** Destructor */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingStoppingCriterionBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -70,7 +70,7 @@ protected: /** Constructor */ - FastMarchingStoppingCriterionBase() : Superclass(), m_Domain( NULL ) + FastMarchingStoppingCriterionBase() : Superclass(), m_Domain( ITK_NULLPTR ) { m_CurrentValue = NumericTraits< OutputPixelType >::Zero; m_PreviousValue = NumericTraits< OutputPixelType >::Zero; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FastMarching/include/itkFastMarchingUpwindGradientImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,8 +33,8 @@ FastMarchingUpwindGradientImageFilter< TLevelSet, TSpeedImage > ::FastMarchingUpwindGradientImageFilter() { - m_TargetPoints = NULL; - m_ReachedTargetPoints = NULL; + m_TargetPoints = ITK_NULLPTR; + m_ReachedTargetPoints = ITK_NULLPTR; m_GradientImage = GradientImageType::New(); m_GenerateGradientImage = false; m_TargetOffset = 1.0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWCommon.h otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWCommon.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWCommon.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWCommon.h 2014-09-03 08:29:34.000000000 +0000 @@ -130,7 +130,7 @@ roflags = flags | FFTW_WISDOM_ONLY; } PlanType plan = fftwf_plan_dft_c2r(rank,n,in,out,roflags); - if( plan == NULL ) + if( plan == ITK_NULLPTR ) { // no wisdom available for that plan if( canDestroyInput ) @@ -222,7 +222,7 @@ roflags = flags | FFTW_WISDOM_ONLY; } PlanType plan = fftwf_plan_dft_r2c(rank,n,in,out,roflags); - if( plan == NULL ) + if( plan == ITK_NULLPTR ) { // no wisdom available for that plan if( canDestroyInput ) @@ -316,7 +316,7 @@ roflags = flags | FFTW_WISDOM_ONLY; } PlanType plan = fftwf_plan_dft(rank,n,in,out,sign,roflags); - if( plan == NULL ) + if( plan == ITK_NULLPTR ) { // no wisdom available for that plan if( canDestroyInput ) @@ -431,7 +431,7 @@ roflags = flags | FFTW_WISDOM_ONLY; } PlanType plan = fftw_plan_dft_c2r(rank,n,in,out,roflags); - if( plan == NULL ) + if( plan == ITK_NULLPTR ) { // no wisdom available for that plan if( canDestroyInput ) @@ -522,7 +522,7 @@ roflags = flags | FFTW_WISDOM_ONLY; } PlanType plan = fftw_plan_dft_r2c(rank,n,in,out,roflags); - if( plan == NULL ) + if( plan == ITK_NULLPTR ) { // no wisdom available for that plan if( canDestroyInput ) @@ -616,7 +616,7 @@ roflags = flags | FFTW_WISDOM_ONLY; } PlanType plan = fftw_plan_dft(rank,n,in,out,sign,roflags); - if( plan == NULL ) + if( plan == ITK_NULLPTR ) { // no wisdom available for that plan if( canDestroyInput ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWGlobalConfiguration.h otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWGlobalConfiguration.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWGlobalConfiguration.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/include/itkFFTWGlobalConfiguration.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ { this->m_WisdomFilename=wfn; } - virtual std::string GenerateWisdomFilename(const std::string itkNotUsed(baseCacheDirectory) ) const + virtual std::string GenerateWisdomFilename(const std::string itkNotUsed(baseCacheDirectory) ) const ITK_OVERRIDE { return this->m_WisdomFilename; } @@ -94,7 +94,7 @@ class SimpleWisdomFilenameGenerator: public WisdomFilenameGeneratorBase { public: - virtual std::string GenerateWisdomFilename(const std::string baseCacheDirectory) const + virtual std::string GenerateWisdomFilename(const std::string baseCacheDirectory) const ITK_OVERRIDE { return baseCacheDirectory+FFTWPathSep+".itksimple.wisdom"; } @@ -103,7 +103,7 @@ class HostnameWisdomFilenameGenerator: public WisdomFilenameGeneratorBase { public: - virtual std::string GenerateWisdomFilename(const std::string baseCacheDirectory) const + virtual std::string GenerateWisdomFilename(const std::string baseCacheDirectory) const ITK_OVERRIDE { itksys::SystemInformation hostInfo; @@ -130,7 +130,7 @@ m_UseSteppingCode(true) {} - virtual std::string GenerateWisdomFilename(const std::string baseCacheDirectory) const + virtual std::string GenerateWisdomFilename(const std::string baseCacheDirectory) const ITK_OVERRIDE { //Now build the hardware string by system interogation itksys::SystemInformation hardwareInfo; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/src/itkFFTWGlobalConfiguration.cxx otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/src/itkFFTWGlobalConfiguration.cxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/src/itkFFTWGlobalConfiguration.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/src/itkFFTWGlobalConfiguration.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,7 @@ } itk::SimpleFastMutexLock itk::FFTWGlobalConfiguration::m_CreationLock; -itk::FFTWGlobalConfiguration::Pointer itk::FFTWGlobalConfiguration::m_Instance=NULL; +itk::FFTWGlobalConfiguration::Pointer itk::FFTWGlobalConfiguration::m_Instance=ITK_NULLPTR; FFTWGlobalConfiguration::Pointer FFTWGlobalConfiguration diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkFFTWGlobalConfiguration.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkFFTWGlobalConfiguration.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkFFTWGlobalConfiguration.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkFFTWGlobalConfiguration.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -7,4 +7,5 @@ itk_wrap_simple_class("itk::SimpleWisdomFilenameGenerator") itk_wrap_simple_class("itk::HostnameWisdomFilenameGenerator") itk_wrap_simple_class("itk::HardwareWisdomFilenameGenerator") + itk_wrap_simple_class("itk::SimpleFastMutexLock") endif() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkMagnitudeAndPhaseToComplexImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkMagnitudeAndPhaseToComplexImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkMagnitudeAndPhaseToComplexImageFilter.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/FFT/wrapping/itkMagnitudeAndPhaseToComplexImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,9 @@ +itk_wrap_class("itk::MagnitudeAndPhaseToComplexImageFilter" POINTER_WITH_SUPERCLASS) + foreach(d ${ITK_WRAP_DIMS}) + foreach(t ${WRAP_ITK_REAL}) + foreach(c ${WRAP_ITK_COMPLEX_REAL}) + itk_wrap_template("${ITKM_I${t}${d}}${ITKM_I${t}${d}}${ITKM_I${c}${d}}" "${ITKT_I${t}${d}},${ITKT_I${t}${d}},${ITKT_I${c}${d}}") + endforeach(c) + endforeach(t) + endforeach(d) +itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUAnisotropicSmoothing/include/itkGPUAnisotropicDiffusionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUAnisotropicSmoothing/include/itkGPUAnisotropicDiffusionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUAnisotropicSmoothing/include/itkGPUAnisotropicDiffusionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUAnisotropicSmoothing/include/itkGPUAnisotropicDiffusionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,14 +59,14 @@ { minSpacing = 1.0; } - if ( this->GetTimeStep() > ( minSpacing / vcl_pow(2.0, static_cast< double >( ImageDimension ) + 1) ) ) + if ( this->GetTimeStep() > ( minSpacing / std::pow(2.0, static_cast< double >( ImageDimension ) + 1) ) ) { - // f->SetTimeStep(1.0 / vcl_pow(2.0, + // f->SetTimeStep(1.0 / std::pow(2.0, // static_cast(ImageDimension))); itkWarningMacro( << "Anisotropic diffusion unstable time step: " << this->GetTimeStep() << std::endl << "Stable time step for this image must be smaller than " - << minSpacing / vcl_pow( 2.0, static_cast< double >( ImageDimension + 1 ) ) ); + << minSpacing / std::pow( 2.0, static_cast< double >( ImageDimension + 1 ) ) ); } if ( this->m_GradientMagnitudeIsFixed == false ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -131,8 +131,7 @@ * execution model. * * \sa ProcessObject::GenerateInputRequestedRegion() - virtual void GenerateInputRequestedRegion() - throw ( InvalidRequestedRegionError );*/ + virtual void GenerateInputRequestedRegion();*/ #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUImageFilterBase/include/itkGPUNeighborhoodOperatorImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,6 @@ void GPUNeighborhoodOperatorImageFilter< TInputImage, TOutputImage, TOperatorValueType > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -96,8 +96,7 @@ typedef GPUNeighborhoodOperatorImageFilter< InputImageType, OutputImageType, RealOutputPixelValueType > SingleFilterType; - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); protected: GPUDiscreteGaussianImageFilter(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/GPUSmoothing/include/itkGPUDiscreteGaussianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,6 @@ void GPUDiscreteGaussianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageCompose/include/itkComposeImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,6 +20,7 @@ #include "itkComposeImageFilter.h" #include "itkImageRegionIterator.h" +#include "itkProgressReporter.h" namespace itk { @@ -114,8 +115,10 @@ void ComposeImageFilter< TInputImage, TOutputImage > ::ThreadedGenerateData(const RegionType & outputRegionForThread, - ThreadIdType) + ThreadIdType threadId) { + ProgressReporter progress( this, threadId, outputRegionForThread.GetNumberOfPixels() ); + typename OutputImageType::Pointer outputImage = static_cast< OutputImageType * >( this->ProcessObject::GetOutput(0) ); @@ -140,6 +143,7 @@ ComputeOutputPixel( pix, inputItContainer ); oit.Set(pix); ++oit; + progress.CompletedPixel(); } } } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageCompose/wrapping/itkJoinSeriesImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageCompose/wrapping/itkJoinSeriesImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageCompose/wrapping/itkJoinSeriesImageFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageCompose/wrapping/itkJoinSeriesImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,13 +1,24 @@ -itk_wrap_class("itk::JoinSeriesImageFilter" POINTER) - foreach(d1 ${ITK_WRAP_DIMS}) - foreach(d2 ${ITK_WRAP_DIMS}) - if("${d1}" LESS "${d2}") - foreach(t ${WRAP_ITK_SCALAR}) - itk_wrap_template("${ITKM_I${t}${d1}}${ITKM_I${t}${d2}}" - "${ITKT_I${t}${d1}},${ITKT_I${t}${d2}}") - endforeach(t) - endif("${d1}" LESS "${d2}") - endforeach(d2) - endforeach(d1) +# Check if we have the right dimensions before wrapping +foreach(d1 ${ITK_WRAP_DIMS}) + foreach(d2 ${ITK_WRAP_DIMS}) + if("${d1}" LESS "${d2}") + set(wrappable true) + endif("${d1}" LESS "${d2}") + endforeach(d2) +endforeach(d1) -itk_end_wrap_class() +# Wrap if allowed +if(wrappable) + itk_wrap_class("itk::JoinSeriesImageFilter" POINTER) + foreach(d1 ${ITK_WRAP_DIMS}) + foreach(d2 ${ITK_WRAP_DIMS}) + if("${d1}" LESS "${d2}") + foreach(t ${WRAP_ITK_SCALAR}) + itk_wrap_template("${ITKM_I${t}${d1}}${ITKM_I${t}${d2}}" + "${ITKT_I${t}${d1}},${ITKT_I${t}${d2}}") + endforeach(t) + endif("${d1}" LESS "${d2}") + endforeach(d2) + endforeach(d1) + itk_end_wrap_class() +endif(wrappable) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -200,8 +200,7 @@ * an implementation for GenerateInputRequestedRegion() in order to * inform the pipeline execution model. * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); private: BilateralImageFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -57,7 +57,6 @@ void BilateralImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region @@ -82,7 +81,7 @@ { radius[i] = ( typename TInputImage::SizeType::SizeValueType ) - vcl_ceil(m_DomainMu * m_DomainSigma[i] / this->GetInput()->GetSpacing()[i]); + std::ceil(m_DomainMu * m_DomainSigma[i] / this->GetInput()->GetSpacing()[i]); } } else @@ -131,8 +130,8 @@ { // Build a small image of the N-dimensional Gaussian used for domain filter // - // Gaussian image size will be (2*vcl_ceil(2.5*sigma)+1) x - // (2*vcl_ceil(2.5*sigma)+1) + // Gaussian image size will be (2*std::ceil(2.5*sigma)+1) x + // (2*std::ceil(2.5*sigma)+1) unsigned int i; typename InputImageType::SizeType radius; @@ -149,7 +148,7 @@ { radius[i] = ( typename TInputImage::SizeType::SizeValueType ) - vcl_ceil(m_DomainMu * m_DomainSigma[i] / inputSpacing[i]); + std::ceil(m_DomainMu * m_DomainSigma[i] / inputSpacing[i]); domainKernelSize[i] = 2 * radius[i] + 1; } } @@ -223,7 +222,7 @@ // denominator (normalization factor) for Gaussian used for range double rangeGaussianDenom; - rangeGaussianDenom = m_RangeSigma * vcl_sqrt(2.0 * vnl_math::pi); + rangeGaussianDenom = m_RangeSigma * std::sqrt(2.0 * vnl_math::pi); // Maximum delta for the dynamic range double tableDelta; @@ -242,7 +241,7 @@ for ( i = 0, v = 0.0; i < m_NumberOfRangeGaussianSamples; ++i, v += tableDelta ) { - m_RangeGaussianTable[i] = vcl_exp(-0.5 * v * v / rangeVariance) / rangeGaussianDenom; + m_RangeGaussianTable[i] = std::exp(-0.5 * v * v / rangeVariance) / rangeGaussianDenom; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -28,11 +28,11 @@ namespace itk { -template< typename TValueType > +template< typename TValue > class ListNode { public: - TValueType m_Value; + TValue m_Value; ListNode *Next; ListNode *Previous; @@ -40,7 +40,9 @@ /** \class CannyEdgeDetectionImageFilter * \brief This filter is an implementation of a Canny edge detector for - * scalar-valued images. Based on John Canny's paper "A Computational Approach + * scalar-valued images. + * + * Based on John Canny's paper "A Computational Approach * to Edge Detection"(IEEE Transactions on Pattern Analysis and Machine * Intelligence, Vol. PAMI-8, No.6, November 1986), there are four major steps * used in the edge-detection scheme: @@ -174,7 +176,9 @@ } } - /** TODO: Document in the ITKv4 migration guide that + /** \brief Set the Threshold value for detected edges. + * + * TODO: Document in the ITKv4 migration guide that * the SetThreshold member function was removed from * the CannyEdgeDetectionImageFilter, and that both * UpperThreshold and LowerThreshold need to be set. @@ -182,8 +186,6 @@ * change "myfilter->SetThrehsold" to "myfilter->SetUpperThreshold", * and add "myfilter->SetLowerThreshold(GetUpperThreshold()/2.0)" */ - - ///* Set the Threshold value for detected edges. */ itkSetMacro(UpperThreshold, OutputImagePixelType); itkGetConstMacro(UpperThreshold, OutputImagePixelType); @@ -202,8 +204,7 @@ * pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -78,8 +78,8 @@ m_NodeStore = ListNodeStorageType::New(); m_NodeList = ListType::New(); - m_InputImage = 0; - m_OutputImage = 0; + m_InputImage = ITK_NULLPTR; + m_OutputImage = ITK_NULLPTR; } template< typename TInputImage, typename TOutputImage > @@ -101,7 +101,6 @@ void CannyEdgeDetectionImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); @@ -117,7 +116,7 @@ ImageRegionIterator< TOutputImage > it; - void *globalData = 0; + void *globalData = ITK_NULLPTR; // Here input is the result from the gaussian filter // output is the update buffer. @@ -505,7 +504,7 @@ m_ComputeCannyEdge1stDerivativeOper); } - gradMag = vcl_sqrt( (double)gradMag ); + gradMag = std::sqrt( (double)gradMag ); derivPos = zero; for ( unsigned int i = 0; i < ImageDimension; i++ ) { @@ -593,12 +592,9 @@ << m_Center << std::endl; os << "Stride: " << m_Stride << std::endl; - os << "Gaussian Filter: " << std::endl; - m_GaussianFilter->Print( os, indent.GetNextIndent() ); - os << "Multiply image Filter: " << std::endl; - m_MultiplyImageFilter->Print( os, indent.GetNextIndent() ); - os << "UpdateBuffer1: " << std::endl; - m_UpdateBuffer1->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( GaussianFilter ); + itkPrintSelfObjectMacro( MultiplyImageFilter ); + itkPrintSelfObjectMacro( UpdateBuffer1 ); } } //end of itk namespace #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -113,8 +113,7 @@ * inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); protected: DerivativeImageFilter() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkDerivativeImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,6 @@ void DerivativeImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -86,12 +86,12 @@ if ( eigenValue[2] <= 0 ) { lineMeasure = - vcl_exp( -0.5 * vnl_math_sqr( eigenValue[2] / ( m_Alpha1 * normalizeValue ) ) ); + std::exp( -0.5 * vnl_math_sqr( eigenValue[2] / ( m_Alpha1 * normalizeValue ) ) ); } else { lineMeasure = - vcl_exp( -0.5 * vnl_math_sqr( eigenValue[2] / ( m_Alpha2 * normalizeValue ) ) ); + std::exp( -0.5 * vnl_math_sqr( eigenValue[2] / ( m_Alpha2 * normalizeValue ) ) ); } lineMeasure *= normalizeValue; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -140,8 +140,7 @@ * an implementation for GenerateInputRequestedRegion in order to inform * the pipeline execution model. * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHessianRecursiveGaussianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -139,7 +139,6 @@ void HessianRecursiveGaussianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DCirclesImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DCirclesImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DCirclesImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DCirclesImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -98,8 +98,8 @@ m_RadiusImage->SetOrigin( inputImage->GetOrigin() ); m_RadiusImage->SetSpacing( inputImage->GetSpacing() ); m_RadiusImage->SetDirection( inputImage->GetDirection() ); - m_RadiusImage->Allocate(); - m_RadiusImage->FillBuffer(0); + m_RadiusImage->Allocate(true); // initialize + // buffer to zero ImageRegionConstIteratorWithIndex< InputImageType > image_it( inputImage, inputImage->GetRequestedRegion() ); image_it.GoToBegin(); @@ -119,9 +119,9 @@ double Vy = grad[1]; // if the gradient is not flat - if ( ( vcl_fabs(Vx) > 1 ) || ( vcl_fabs(Vy) > 1 ) ) + if ( ( std::fabs(Vx) > 1 ) || ( std::fabs(Vy) > 1 ) ) { - double norm = vcl_sqrt(Vx * Vx + Vy * Vy); + double norm = std::sqrt(Vx * Vx + Vy * Vy); Vx /= norm; Vy /= norm; @@ -132,10 +132,10 @@ do { - index[0] = (IndexValueType)( point[0] - i * ( Vx * vcl_cos(angle) + Vy * vcl_sin(angle) ) ); - index[1] = (IndexValueType)( point[1] - i * ( Vx * vcl_sin(angle) + Vy * vcl_cos(angle) ) ); + index[0] = (IndexValueType)( point[0] - i * ( Vx * std::cos(angle) + Vy * std::sin(angle) ) ); + index[1] = (IndexValueType)( point[1] - i * ( Vx * std::sin(angle) + Vy * std::cos(angle) ) ); - distance = vcl_sqrt( ( index[1] - point[1] ) * ( index[1] - point[1] ) + distance = std::sqrt( ( index[1] - point[1] ) * ( index[1] - point[1] ) + ( index[0] - point[0] ) * ( index[0] - point[0] ) ); if ( outputImage->GetRequestedRegion().IsInside(index) ) @@ -192,8 +192,8 @@ outputImage->SetOrigin( this->GetOutput(0)->GetOrigin() ); outputImage->SetSpacing( this->GetOutput(0)->GetSpacing() ); outputImage->SetDirection( this->GetOutput(0)->GetDirection() ); - outputImage->Allocate(); - outputImage->FillBuffer(0); + outputImage->Allocate(true); // initialize + // buffer to zero ImageRegionConstIteratorWithIndex< OutputImageType > image_it( this->GetOutput(0), this->GetOutput( 0)->GetRequestedRegion() ); @@ -228,7 +228,7 @@ CirclesListSizeType circles = 0; bool found; - const double nPI = 4.0 * vcl_atan(1.0); + const double nPI = 4.0 * std::atan(1.0); // Find maxima do @@ -260,8 +260,8 @@ { for ( double length = 0; length < m_DiscRadiusRatio * Circle->GetRadius()[0]; length += 1 ) { - index[0] = (IndexValueType)( it_input.GetIndex()[0] + length * vcl_cos(angle) ); - index[1] = (IndexValueType)( it_input.GetIndex()[1] + length * vcl_sin(angle) ); + index[0] = (IndexValueType)( it_input.GetIndex()[0] + length * std::cos(angle) ); + index[1] = (IndexValueType)( it_input.GetIndex()[1] + length * std::sin(angle) ); if ( postProcessImage->GetLargestPossibleRegion().IsInside(index) ) { postProcessImage->SetPixel(index, 0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -34,9 +34,11 @@ * to be extracted. The output is the image of the accumulator. * GetLines() returns a list of LinesSpatialObjects. * - * Lines are parameterized in the form: R = x*vcl_cos(Teta)+y*vcl_sin(Teta) - * where R is the perpendicular distance from the origin and Teta - * the angle with the normal. + * Lines are parameterized in the form: + * + * \f$ R = x \cos(\theta) + y \sin(\theta) \f$ + * where \f$R\f$ is the perpendicular distance from the origin and + * \f$\theta\f$ the angle with the normal. * * The output is the accumulator array: * -The first dimension (X) represents the distance R from the corner diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkHoughTransform2DLinesImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ m_Variance = 5; m_OldModifiedTime = 0; m_OldNumberOfLines = 0; - m_SimplifyAccumulator = NULL; + m_SimplifyAccumulator = ITK_NULLPTR; } template< typename TInputPixelType, typename TOutputPixelType > @@ -74,7 +74,7 @@ Size< 2 > size; size[0] = - (SizeValueType)( vcl_sqrt(m_AngleResolution * m_AngleResolution + (SizeValueType)( std::sqrt(m_AngleResolution * m_AngleResolution + input->GetLargestPossibleRegion().GetSize()[0] * input->GetLargestPossibleRegion().GetSize()[0]) ); size[1] = (SizeValueType)m_AngleResolution; @@ -114,7 +114,7 @@ this->AllocateOutputs(); outputImage->FillBuffer(0); - const double nPI = 4.0 * vcl_atan(1.0); + const double nPI = 4.0 * std::atan(1.0); ImageRegionConstIteratorWithIndex< InputImageType > image_it( inputImage, inputImage->GetRequestedRegion() ); image_it.GoToBegin(); @@ -129,7 +129,7 @@ { index[0] = // m_R - (IndexValueType)( image_it.GetIndex()[0] * vcl_cos(angle) + image_it.GetIndex()[1] * vcl_sin(angle) ); + (IndexValueType)( image_it.GetIndex()[0] * std::cos(angle) + image_it.GetIndex()[1] * std::sin(angle) ); // m_Theta index[1] = (IndexValueType)( ( m_AngleResolution / 2 ) + m_AngleResolution * angle / ( 2 * nPI ) ); @@ -170,8 +170,9 @@ m_SimplifyAccumulator->SetOrigin( inputImage->GetOrigin() ); m_SimplifyAccumulator->SetSpacing( inputImage->GetSpacing() ); m_SimplifyAccumulator->SetDirection( inputImage->GetDirection() ); - m_SimplifyAccumulator->Allocate(); - m_SimplifyAccumulator->FillBuffer(0); + m_SimplifyAccumulator->Allocate(true); // initialize + // buffer + // to zero Index< 2 > index; Index< 2 > maxIndex; @@ -182,7 +183,7 @@ ImageRegionConstIteratorWithIndex< InputImageType > image_it( inputImage, inputImage->GetRequestedRegion() ); image_it.GoToBegin(); - const double nPI = 4.0 * vcl_atan(1.0); + const double nPI = 4.0 * std::atan(1.0); while ( !image_it.IsAtEnd() ) { @@ -195,7 +196,7 @@ for ( double angle = -nPI; angle < nPI; angle += nPI / m_AngleResolution ) { // m_R - index[0] = (IndexValueType)( image_it.GetIndex()[0] * vcl_cos(angle) + image_it.GetIndex()[1] * vcl_sin(angle) ); + index[0] = (IndexValueType)( image_it.GetIndex()[0] * std::cos(angle) + image_it.GetIndex()[1] * std::sin(angle) ); // m_Theta index[1] = (IndexValueType)( ( m_AngleResolution / 2 ) + m_AngleResolution * angle / ( 2 * nPI ) ); @@ -277,7 +278,7 @@ itk::ImageRegionIterator< InternalImageType > it_input( postProcessImage, postProcessImage->GetLargestPossibleRegion() ); - const double nPI = 4.0 * vcl_atan(1.0); + const double nPI = 4.0 * std::atan(1.0); itk::Index< 2 > index; @@ -301,9 +302,9 @@ double radius = it_input.GetIndex()[0]; double teta = ( ( it_input.GetIndex()[1] ) * 2 * nPI / this->GetAngleResolution() ) - nPI; - double Vx = radius * vcl_cos(teta); - double Vy = radius * vcl_sin(teta); - double norm = vcl_sqrt(Vx * Vx + Vy * Vy); + double Vx = radius * std::cos(teta); + double Vy = radius * std::sin(teta); + double norm = std::sqrt(Vx * Vx + Vy * Vy); double VxNorm = Vx / norm; double VyNorm = Vy / norm; @@ -343,8 +344,8 @@ { for ( double length = 0; length < m_DiscRadius; length += 1 ) { - index[0] = (IndexValueType)( it_input.GetIndex()[0] + length * vcl_cos(angle) ); - index[1] = (IndexValueType)( it_input.GetIndex()[1] + length * vcl_sin(angle) ); + index[0] = (IndexValueType)( it_input.GetIndex()[0] + length * std::cos(angle) ); + index[1] = (IndexValueType)( it_input.GetIndex()[1] + length * std::sin(angle) ); if ( postProcessImage->GetBufferedRegion().IsInside(index) ) { postProcessImage->SetPixel(index, 0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -100,8 +100,7 @@ * inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** Enable/Disable using the image spacing information in * calculations. Use this option if you want derivatives in diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,6 @@ void LaplacianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -91,8 +91,7 @@ * execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** Enable/Disable using the image spacing information in * calculations. Use this option if you want derivatives in diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkLaplacianSharpeningImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,6 @@ void LaplacianSharpeningImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. This should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -149,7 +149,7 @@ const TMask * mask = this->GetMaskImage(); - if ( mask == NULL ) + if ( mask == ITK_NULLPTR ) { // create all 1s selectionMap selectionMap->FillBuffer( NumericTraits< MapPixelType >::One ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -102,8 +102,7 @@ * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkSobelEdgeDetectionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,6 @@ void SobelEdgeDetectionImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -103,8 +103,7 @@ * pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** Set/Get the label value for zero-crossing pixels. */ itkSetMacro(ForegroundValue, OutputImagePixelType); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,6 @@ void ZeroCrossingImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkHessian3DToVesselnessMeasureImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkHessian3DToVesselnessMeasureImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkHessian3DToVesselnessMeasureImageFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkHessian3DToVesselnessMeasureImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,8 +1,9 @@ -itk_wrap_class("itk::Hessian3DToVesselnessMeasureImageFilter" POINTER) - itk_wrap_filter_dims(d3 3) - if(d3) +itk_wrap_filter_dims(has_d_3 3) + +if(has_d_3) + itk_wrap_class("itk::Hessian3DToVesselnessMeasureImageFilter" POINTER) foreach(t ${WRAP_ITK_SCALAR}) itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") endforeach(t) - endif(d3) -itk_end_wrap_class() + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkMaskFeaturePointSelectionFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkMaskFeaturePointSelectionFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkMaskFeaturePointSelectionFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFeature/wrapping/itkMaskFeaturePointSelectionFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,7 @@ -itk_wrap_class("itk::MaskFeaturePointSelectionFilter" POINTER_WITH_2_SUPERCLASSES) - itk_wrap_image_filter("${WRAP_ITK_REAL}" 1 3) -itk_end_wrap_class() +itk_wrap_filter_dims(has_d_3 3) + +if(has_d_3) + itk_wrap_class("itk::MaskFeaturePointSelectionFilter" POINTER_WITH_2_SUPERCLASSES) + itk_wrap_image_filter("${WRAP_ITK_REAL}" 1 3) + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBinaryFunctorImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBinaryFunctorImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBinaryFunctorImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBinaryFunctorImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -90,7 +90,7 @@ itkDebugMacro("Getting constant 1"); const DecoratedInput1ImagePixelType *input = dynamic_cast< const DecoratedInput1ImagePixelType * >( this->ProcessObject::GetInput(0) ); - if( input == NULL ) + if( input == ITK_NULLPTR ) { itkExceptionMacro(<<"Constant 1 is not set"); } @@ -151,7 +151,7 @@ itkDebugMacro("Getting constant 2"); const DecoratedInput2ImagePixelType *input = dynamic_cast< const DecoratedInput2ImagePixelType * >( this->ProcessObject::GetInput(1) ); - if( input == NULL ) + if( input == ITK_NULLPTR ) { itkExceptionMacro(<<"Constant 2 is not set"); } @@ -165,7 +165,7 @@ BinaryFunctorImageFilter< TInputImage1, TInputImage2, TOutputImage, TFunction > ::GenerateOutputInformation() { - const DataObject * input = NULL; + const DataObject * input = ITK_NULLPTR; Input1ImagePointer inputPtr1 = dynamic_cast< const TInputImage1 * >( ProcessObject::GetInput(0) ); Input2ImagePointer inputPtr2 = diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBoxImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBoxImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBoxImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkBoxImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -79,13 +79,13 @@ itkGetConstReferenceMacro(Radius, RadiusType); - void GenerateInputRequestedRegion(); - protected: BoxImageFilter(); ~BoxImageFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void GenerateInputRequestedRegion(); + + virtual void PrintSelf(std::ostream & os, Indent indent) const; private: BoxImageFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -161,8 +161,7 @@ * region is expanded by the radius of the template. If the request * extends past the LargestPossibleRegion for the input, the request * is cropped by the LargestPossibleRegion. */ - void GenerateInputRequestedRegion() - throw ( InvalidRequestedRegionError ); + void GenerateInputRequestedRegion(); /** MaskNeighborhoodOperatorImageFilter can be implemented as a * multithreaded filter. Therefore, this implementation provides a diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,6 @@ void MaskNeighborhoodOperatorImageFilter< TInputImage, TMaskImage, TOutputImage, TOperatorValueType > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -133,8 +133,7 @@ * execution model. * * \sa ProcessObject::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw ( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,6 @@ void NeighborhoodOperatorImageFilter< TInputImage, TOutputImage, TOperatorValueType > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -92,7 +92,7 @@ // calculate the standard deviation value var = ( sumOfSquares - ( sum * sum / num ) ) / ( num - 1.0 ); - it.Set( static_cast< OutputPixelType >( vcl_sqrt(var) ) ); + it.Set( static_cast< OutputPixelType >( std::sqrt(var) ) ); ++bit; ++it; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkNullImageToImageFilterDriver.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ { public: NullImageToImageFilterDriver(): - m_Filter( NULL ) + m_Filter( ITK_NULLPTR ) {}; typedef typename TInputImage::SizeType ImageSizeType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkRecursiveSeparableImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkRecursiveSeparableImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkRecursiveSeparableImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkRecursiveSeparableImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,14 +33,29 @@ m_N1( 1.0 ), m_N2( 1.0 ), m_N3( 1.0 ), - m_Direction( 0 ) + m_D1( 0.0 ), + m_D2( 0.0 ), + m_D3( 0.0 ), + m_D4( 0.0 ), + m_M1( 0.0 ), + m_M2( 0.0 ), + m_M3( 0.0 ), + m_M4( 0.0 ), + m_BN1( 0.0 ), + m_BN2( 0.0 ), + m_BN3( 0.0 ), + m_BN4( 0.0 ), + m_BM1( 0.0 ), + m_BM2( 0.0 ), + m_BM3( 0.0 ), + m_BM4( 0.0 ), + m_Direction( 0 ), + m_ImageRegionSplitter(ImageRegionSplitterDirection::New()) { this->SetNumberOfRequiredOutputs(1); this->SetNumberOfRequiredInputs(1); this->InPlaceOff(); - - this->m_ImageRegionSplitter = ImageRegionSplitterDirection::New(); } /** @@ -263,9 +278,9 @@ const unsigned int ln = region.GetSize()[this->m_Direction]; - RealType *inps = 0; - RealType *outs = 0; - RealType *scratch = 0; + RealType *inps = ITK_NULLPTR; + RealType *outs = ITK_NULLPTR; + RealType *scratch = ITK_NULLPTR; try { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -120,8 +120,7 @@ * execution model. * * \sa ProcessObject::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw ( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking @@ -133,7 +132,10 @@ #endif protected: - VectorNeighborhoodOperatorImageFilter() {} + VectorNeighborhoodOperatorImageFilter() : + m_BoundsCondition(ITK_NULLPTR) + {} + virtual ~VectorNeighborhoodOperatorImageFilter() {} /** VectorNeighborhoodOperatorImageFilter can be implemented as a diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,6 @@ void VectorNeighborhoodOperatorImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -174,6 +174,20 @@ itkSetMacro( SliceDimension, int ); itkGetConstReferenceMacro( SliceDimension, int ); + /** Set/Get the overlay functor - defaults to a reasonable set of colors. + * This can be used to apply a different colormap. + */ + virtual void SetFunctor(const FunctorType & functor) + { + if ( m_Functor != functor ) + { + m_Functor = functor; + this->Modified(); + } + } + FunctorType & GetFunctor() { return m_Functor; } + const FunctorType & GetFunctor() const { return m_Functor; } + protected: LabelMapContourOverlayImageFilter(); ~LabelMapContourOverlayImageFilter() {}; @@ -212,6 +226,7 @@ SizeType m_ContourThickness; SizeType m_DilationRadius; int m_SliceDimension; + FunctorType m_Functor; LabelMapPointer m_TempImage; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -129,10 +129,9 @@ typedef typename SliceKernelType::RadiusType RadiusType; RadiusType srad; srad.Fill(NumericTraits::Zero); - int j=0; - for( int i=0; i( m_SliceDimension ) ) { srad[j] = m_ContourThickness[i]; j++; @@ -215,7 +214,7 @@ LabelMapType * input = const_cast(this->GetInput()); const FeatureImageType * input2 = this->GetFeatureImage(); - FunctorType function; + FunctorType function( m_Functor ); function.SetBackgroundValue( input->GetBackgroundValue() ); function.SetOpacity( m_Opacity ); @@ -252,7 +251,7 @@ LabelMapType * input = const_cast(this->GetInput()); const FeatureImageType * input2 = this->GetFeatureImage(); - FunctorType function; + FunctorType function( m_Functor ); function.SetBackgroundValue( input->GetBackgroundValue() ); function.SetOpacity( m_Opacity ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -132,6 +132,20 @@ itkSetMacro( Opacity, double ); itkGetConstReferenceMacro( Opacity, double ); + /** Set/Get the overlay functor - defaults to a reasonable set of colors. + * This can be used to apply a different colormap. + */ + virtual void SetFunctor(const FunctorType& functor) + { + if ( m_Functor != functor ) + { + m_Functor = functor; + this->Modified(); + } + } + FunctorType & GetFunctor() { return m_Functor; } + const FunctorType & GetFunctor() const { return m_Functor; } + protected: LabelMapOverlayImageFilter(); ~LabelMapOverlayImageFilter() {}; @@ -160,6 +174,7 @@ double m_Opacity; typename Barrier::Pointer m_Barrier; + FunctorType m_Functor; }; // end of class diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapOverlayImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,7 @@ LabelMapType * input = const_cast(this->GetInput()); const FeatureImageType * input2 = this->GetFeatureImage(); - FunctorType function; + FunctorType function( m_Functor ); function.SetBackgroundValue( input->GetBackgroundValue() ); function.SetOpacity( m_Opacity ); @@ -127,7 +127,7 @@ LabelMapType * input = const_cast(this->GetInput()); const FeatureImageType * input2 = this->GetFeatureImage(); - FunctorType function; + FunctorType function( m_Functor ); function.SetBackgroundValue( input->GetBackgroundValue() ); function.SetOpacity( m_Opacity ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapToRGBImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapToRGBImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapToRGBImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelMapToRGBImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,8 +56,6 @@ { const typename LabelObjectType::LabelType & label = labelObject->GetLabel(); - typedef typename LabelObjectType::LengthType LengthType; - FunctorType function; function.SetBackgroundValue( this->GetInput()->GetBackgroundValue() ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelOverlayFunctor.h 2014-09-03 08:29:34.000000000 +0000 @@ -52,6 +52,7 @@ // provide some default value for external use (outside // LabelOverlayFunctorImageFilter) Inside LabelOverlayFunctorImageFilter, // the values are always initialized + m_Opacity = 1.0; m_BackgroundValue = NumericTraits< TLabel >::Zero; } @@ -87,10 +88,15 @@ bool operator!=(const LabelOverlayFunctor & l) const { - bool value = l.m_Opacity != m_Opacity - || m_BackgroundValue != l.m_BackgroundValue; + bool areDifferent = l.m_Opacity != m_Opacity + || l.m_BackgroundValue != m_BackgroundValue + || l.m_RGBFunctor != m_RGBFunctor; + return areDifferent; + } - return value; + bool operator==(const LabelOverlayFunctor & l) const + { + return !(*this != l); } ~LabelOverlayFunctor() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/include/itkLabelToRGBFunctor.h 2014-09-03 08:29:34.000000000 +0000 @@ -55,8 +55,6 @@ LabelToRGBFunctor() { - TRGBPixel rgbPixel; - typedef typename TRGBPixel::ValueType ValueType; // the following colors are from "R", and named: @@ -152,10 +150,22 @@ bool operator!=(const Self & l) const { - const bool areDifferent = m_BackgroundColor != l.m_BackgroundColor - || m_BackgroundValue != l.m_BackgroundValue; + if ( m_BackgroundColor != l.m_BackgroundColor + || m_BackgroundValue != l.m_BackgroundValue + || m_Colors.size() != l.m_Colors.size() ) + { + return true; + } - return areDifferent; + // We need to check each color to see if it's different + for ( typename std::vector< TRGBPixel >::size_type i = 0; i < m_Colors.size(); ++i ) + { + if ( m_Colors[i] != l.m_Colors[i] ) + { + return true; + } + } + return false; } bool operator==(const Self & other) const diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/wrapping/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/wrapping/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageFusion/wrapping/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageFusion/wrapping/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,14 @@ itk_wrap_module(ITKImageFusion) + +# Save default includes so they can be reseted afterwards +set(tmp_default_includes ${WRAPPER_DEFAULT_INCLUDE}) + +# Add itkStatisticsLabelObject.h, it is not automatically detected +# (but it maybe should) +set(WRAPPER_DEFAULT_INCLUDE ${WRAPPER_DEFAULT_INCLUDE} "itkStatisticsLabelObject.h") + itk_auto_load_submodules() itk_end_wrap_module() + +# Reset the WRAPPER_DEFAULT_INCLUDE to original value +set(WRAPPER_DEFAULT_INCLUDE ${tmp_default_includes}) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -103,8 +103,7 @@ * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** Use the image spacing information in calculations. Use this option if you * want derivatives in physical space. Default is UseImageSpacingOn. */ @@ -170,8 +169,8 @@ // An overloaded method which may transform the gradient to a // physical vector and converts to the correct output pixel type. - template - void SetOutputPixel( ImageRegionIterator< VectorImage > &it, CovariantVectorType &gradient ) + template + void SetOutputPixel( ImageRegionIterator< VectorImage > &it, CovariantVectorType &gradient ) { if ( this->m_UseImageDirection ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -52,7 +52,6 @@ void GradientImageFilter< TInputImage, TOperatorValueType, TOutputValueType, TOutputImageType > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -82,8 +82,7 @@ * pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** Use the image spacing information in calculations. Use this option if you * want derivatives in physical space. Default is UseImageSpacingOn. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,6 @@ void GradientMagnitudeImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); @@ -185,7 +184,7 @@ const RealType g = SIP(x_slice[i], bit, op[i]); a += g * g; } - it.Value() = static_cast< OutputPixelType >( vcl_sqrt(a) ); + it.Value() = static_cast< OutputPixelType >( std::sqrt(a) ); ++bit; ++it; progress.CompletedPixel(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -154,8 +154,7 @@ * implementation for GenerateInputRequestedRegion in order to * inform the pipeline execution model. \sa * ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** GradientMagnitudeRecursiveGaussianImageFilter produces all of * the output. Therefore, it needs to provide an implementation of diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientMagnitudeRecursiveGaussianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -149,7 +149,6 @@ void GradientMagnitudeRecursiveGaussianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -148,8 +148,7 @@ * an implementation for GenerateInputRequestedRegion in order to inform * the pipeline execution model. * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** The UseImageDirection flag determines whether the gradients are * computed with respect to the image grid or with respect to the physical @@ -187,8 +186,8 @@ private: - template - void TransformOutputPixel( ImageRegionIterator< VectorImage > &it ) + template + void TransformOutputPixel( ImageRegionIterator< VectorImage > &it ) { // To transform Variable length vector we need to convert to and // fro the CovariantVectorType @@ -220,8 +219,8 @@ DefaultConvertPixelTraits::SetNthComponent( nc*ImageDimension+dim, correctedGradient, correctedComponentGradient[dim] ); } - it.Set(correctedGradient); } + it.Set(correctedGradient); } template class P, class T, unsigned int N> diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkGradientRecursiveGaussianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -131,7 +131,6 @@ void GradientRecursiveGaussianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -194,8 +194,7 @@ * pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); /** Set the derivative weights according to the spacing of the input image (1/spacing). Use this option if you want to calculate the gradient in the @@ -309,7 +308,7 @@ } accum += sum; } - return vcl_sqrt(accum); + return std::sqrt(accum); } TRealType EvaluateAtNeighborhood3D(const ConstNeighborhoodIteratorType & it) const diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -107,7 +107,6 @@ void VectorGradientMagnitudeImageFilter< TInputImage, TRealType, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); @@ -167,7 +166,7 @@ { itkExceptionMacro(<< "Component weights must be positive numbers"); } - m_SqrtComponentWeights[i] = vcl_sqrt(m_ComponentWeights[i]); + m_SqrtComponentWeights[i] = std::sqrt(m_ComponentWeights[i]); } // Set the weights on the derivatives. @@ -308,12 +307,12 @@ if ( D < -epsilon ) // D < 0, three real solutions, by far the common case. { - double phi = 1.0 / 3.0 * vcl_acos( -q / vcl_sqrt(-cb_p) ); - double t = 2.0 * vcl_sqrt(-p); + double phi = 1.0 / 3.0 * std::acos( -q / std::sqrt(-cb_p) ); + double t = 2.0 * std::sqrt(-p); - s[0] = t * vcl_cos(phi); - s[1] = -t *vcl_cos(phi + dpi / 3); - s[2] = -t *vcl_cos(phi - dpi / 3); + s[0] = t * std::cos(phi); + s[1] = -t *std::cos(phi + dpi / 3); + s[2] = -t *std::cos(phi - dpi / 3); num = 3; } @@ -335,7 +334,7 @@ else // Only one real solution. This case misses a double root on rare // occasions with very large char eqn coefficients. { - double sqrt_D = vcl_sqrt(D); + double sqrt_D = std::sqrt(D); double u = vnl_math_cuberoot(sqrt_D - q); double v = -vnl_math_cuberoot(sqrt_D + q); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ * * The output image size in each dimension is given by: * - * outputSize[j] = max( vcl_floor(inputSize[j]/shrinkFactor[j]), 1 ); + * outputSize[j] = max( std::floor(inputSize[j]/shrinkFactor[j]), 1 ); * * The algorithm implemented can be describe with the following * equation for 2D: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBinShrinkImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -142,7 +142,7 @@ // allocate acumulate line const size_t ln = outputRegionForThread.GetSize(0); - AccumulatePixelType *accBuffer = 0; + AccumulatePixelType *accBuffer = ITK_NULLPTR; accBuffer = new AccumulatePixelType[ln]; try diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineCenteredResampleImageFilterBase.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineCenteredResampleImageFilterBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineCenteredResampleImageFilterBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineCenteredResampleImageFilterBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -349,7 +349,7 @@ outVal2 = 0; for ( IndexValueType k = -k0; k < this->m_HSize; k += 2L ) { - IndexValueType kk = vcl_abs( static_cast< int >( k ) ); + IndexValueType kk = std::abs( static_cast< int >( k ) ); i1 = inK + ( k + 1L ) / 2L; if ( i1 < 0L ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,7 +67,7 @@ this->m_NumberOfLevels.Fill( 1 ); this->m_CloseDimension.Fill( 0 ); - this->m_BSplineEpsilon = vcl_numeric_limits::epsilon(); + this->m_BSplineEpsilon = std::numeric_limits::epsilon(); } template @@ -158,7 +158,7 @@ } for( unsigned int j = 0; j < C.cols(); j++ ) { - RealType c = vcl_pow( static_cast( 2.0 ), + RealType c = std::pow( static_cast( 2.0 ), static_cast( C.cols()-j-1 ) ); for( unsigned int k = 0; k < C.rows(); k++) { @@ -206,7 +206,7 @@ maximumNumberOfSpans = numberOfSpans; } } - this->m_BSplineEpsilon = 100 * vcl_numeric_limits::epsilon(); + this->m_BSplineEpsilon = 100 * std::numeric_limits::epsilon(); while( static_cast( maximumNumberOfSpans ) == static_cast( maximumNumberOfSpans ) - this->m_BSplineEpsilon ) { @@ -397,9 +397,9 @@ // determine the actual number of pieces that will be generated typename SizeType::SizeValueType range = requestedRegionSize[splitAxis]; - unsigned int valuesPerThread = static_cast( vcl_ceil( + unsigned int valuesPerThread = static_cast( std::ceil( range / static_cast( num ) ) ); - unsigned int maxThreadIdUsed = static_cast( vcl_ceil( + unsigned int maxThreadIdUsed = static_cast( std::ceil( range / static_cast( valuesPerThread ) ) - 1 ); // Split the region @@ -638,7 +638,7 @@ Superclass::PrintSelf( os, indent ); for( unsigned int i = 0; i < ImageDimension; i++ ) { - this->m_Kernel[i]->Print( os, indent ); + this->m_Kernel[i]->Print( os, indent.GetNextIndent() ); } os << indent << "Spline order: " << this->m_SplineOrder << std::endl; os << indent << "Close dimension: " << this->m_CloseDimension << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,9 +47,9 @@ this->m_CloseDimension.Fill( 0 ); - this->m_NeighborhoodWeightImage = NULL; + this->m_NeighborhoodWeightImage = ITK_NULLPTR; - this->m_BSplineEpsilon = vcl_numeric_limits::epsilon(); + this->m_BSplineEpsilon = std::numeric_limits::epsilon(); } template @@ -114,7 +114,7 @@ maximumNumberOfSpans = numberOfSpans; } } - this->m_BSplineEpsilon = 100 * vcl_numeric_limits::epsilon(); + this->m_BSplineEpsilon = 100 * std::numeric_limits::epsilon(); while( static_cast( maximumNumberOfSpans ) == static_cast( maximumNumberOfSpans ) - this->m_BSplineEpsilon ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineDownsampleImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -152,8 +152,8 @@ //TODO: Verify this is being rounded correctly. outputSpacing[i] = inputSpacing[i] * (double)2; //TODO: Verify this is being rounded correctly. - outputSize[i] = (unsigned int)vcl_floor( (double)( inputSize[i] / 2.0 ) ); - outputStartIndex[i] = (int)vcl_ceil( (double)inputStartIndex[i] / 2.0 ); + outputSize[i] = (unsigned int)std::floor( (double)( inputSize[i] / 2.0 ) ); + outputStartIndex[i] = (int)std::ceil( (double)inputStartIndex[i] / 2.0 ); } outputPtr->SetSpacing(outputSpacing); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineResampleImageFilterBase.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineResampleImageFilterBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineResampleImageFilterBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineResampleImageFilterBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -250,7 +250,10 @@ } if ( i2 > (int)inModK ) { - i2 = i2 % inModK; + if (inModK) + { + i2 = i2 % inModK; + } // Removed because i1 can never be greater than inModK, right? //if (i2 > inModK) //i2=inModK-i2; //TODO: I don't think this is correct. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -66,7 +66,7 @@ this->m_NumberOfLevels.Fill( 1 ); this->m_MaximumNumberOfLevels = 1; - this->m_PhiLattice = NULL; + this->m_PhiLattice = ITK_NULLPTR; this->m_PsiLattice = PointDataImageType::New(); this->m_InputPointData = PointDataContainerType::New(); this->m_OutputPointData = PointDataContainerType::New(); @@ -74,9 +74,10 @@ this->m_PointWeights = WeightsContainerType::New(); this->m_UsePointWeights = false; - this->m_BSplineEpsilon = vcl_numeric_limits::epsilon(); + this->m_BSplineEpsilon = std::numeric_limits::epsilon(); this->m_IsFittingComplete = false; + this->m_CurrentLevel = 0; } template @@ -130,7 +131,7 @@ } for( unsigned int j = 0; j < C.cols(); j++ ) { - RealType c = vcl_pow( static_cast( 2.0 ), + RealType c = std::pow( static_cast( 2.0 ), static_cast( C.cols() ) - j - 1 ); for( unsigned int k = 0; k < C.rows(); k++ ) @@ -268,7 +269,7 @@ maximumNumberOfSpans = numberOfSpans; } } - this->m_BSplineEpsilon = 100 * vcl_numeric_limits::epsilon(); + this->m_BSplineEpsilon = 100 * std::numeric_limits::epsilon(); while( static_cast( maximumNumberOfSpans ) == static_cast( maximumNumberOfSpans ) - this->m_BSplineEpsilon ) { @@ -511,9 +512,9 @@ // determine the actual number of pieces that will be generated typename SizeType::SizeValueType range = requestedRegionSize[splitAxis]; - unsigned int valuesPerThread = static_cast( vcl_ceil( + unsigned int valuesPerThread = static_cast( std::ceil( range / static_cast( num ) ) ); - unsigned int maxThreadIdUsed = static_cast( vcl_ceil( + unsigned int maxThreadIdUsed = static_cast( std::ceil( range / static_cast( valuesPerThread ) ) - 1 ); // Split the region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkBSplineUpsampleImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -164,8 +164,8 @@ //TODO: Verify this is being rounded correctly. outputSpacing[i] = inputSpacing[i] / (double)2; //TODO: Verify this is being rounded correctly. - outputSize[i] = (unsigned int)vcl_floor( (double)( inputSize[i] * 2.0 ) ); - outputStartIndex[i] = (int)vcl_ceil( (double)inputStartIndex[i] * 2.0 ); + outputSize[i] = (unsigned int)std::floor( (double)( inputSize[i] * 2.0 ) ); + outputStartIndex[i] = (int)std::ceil( (double)inputStartIndex[i] * 2.0 ); } outputPtr->SetSpacing(outputSpacing); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkChangeInformationImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkChangeInformationImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkChangeInformationImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkChangeInformationImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ ChangeInformationImageFilter< TInputImage > ::ChangeInformationImageFilter() { - m_ReferenceImage = 0; + m_ReferenceImage = ITK_NULLPTR; m_ChangeSpacing = false; m_ChangeOrigin = false; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkConstantPadImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ ConstantPadImageFilter< TInputImage, TOutputImage > ::ConstantPadImageFilter() { - m_InternalBoundaryCondition.SetConstant( NumericTraits< OutputImagePixelType >::Zero ); + m_InternalBoundaryCondition.SetConstant( NumericTraits< OutputImagePixelType >::ZeroValue() ); this->InternalSetBoundaryCondition( &m_InternalBoundaryCondition ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkExpandImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkExpandImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkExpandImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkExpandImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -221,11 +221,11 @@ for ( i = 0; i < TInputImage::ImageDimension; i++ ) { inputRequestedRegionSize[i] = - (SizeValueType)vcl_ceil( (double)outputRequestedRegionSize[i] + (SizeValueType)std::ceil( (double)outputRequestedRegionSize[i] / (double)m_ExpandFactors[i] ) + 1; inputRequestedRegionStartIndex[i] = - (SizeValueType)vcl_floor( (double)outputRequestedRegionStartIndex[i] + (SizeValueType)std::floor( (double)outputRequestedRegionStartIndex[i] / (double)m_ExpandFactors[i] ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkInterpolateImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkInterpolateImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkInterpolateImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkInterpolateImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,7 @@ // Set default distance to 0,5 m_Distance = 0.5; - m_IntermediateImage = NULL; + m_IntermediateImage = ITK_NULLPTR; } /** @@ -164,7 +164,7 @@ ::AfterThreadedGenerateData() { // Clean up intermediate memory usage - m_IntermediateImage = NULL; + m_IntermediateImage = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkPadImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkPadImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkPadImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkPadImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,7 @@ m_PadUpperBound[j] = 0; } - m_BoundaryCondition = NULL; + m_BoundaryCondition = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,6 +26,8 @@ #include "itkLinearInterpolateImageFunction.h" #include "itkSize.h" #include "itkDefaultConvertPixelTraits.h" +#include "itkDataObjectDecorator.h" + namespace itk { @@ -121,8 +123,11 @@ */ typedef Transform< TTransformPrecisionType, itkGetStaticConstMacro(ImageDimension), - itkGetStaticConstMacro(ImageDimension) > TransformType; - typedef typename TransformType::ConstPointer TransformPointerType; + itkGetStaticConstMacro(ImageDimension) > TransformType; + typedef typename TransformType::ConstPointer TransformPointerType; + typedef DataObjectDecorator DecoratedTransformType; + typedef typename DecoratedTransformType::Pointer DecoratedTransformPointer; + /** Interpolator typedef. */ typedef InterpolateImageFunction< InputImageType, @@ -185,8 +190,7 @@ * the filter uses an Identity transform. You must provide a different * transform here, before attempting to run the filter, if you do not want to * use the default Identity transform. */ - itkSetConstObjectMacro(Transform, TransformType); - itkGetConstObjectMacro(Transform, TransformType); + itkSetGetDecoratedObjectInputMacro(Transform, TransformType); /** Get/Set the interpolator function. The default is * LinearInterpolateImageFunction::New(); + // Pipeline input configuration + + // implicit: + // #0 "Primary" required + + // #1 "ReferenceImage" optional + Self::AddRequiredInputName("ReferenceImage",1); + Self::RemoveRequiredInputName("ReferenceImage"); + + // "Transform" required ( not numbered ) + Self::AddRequiredInputName("Transform"); + Self::SetTransform(IdentityTransform< TTransformPrecisionType, ImageDimension >::New()); m_Interpolator = dynamic_cast< InterpolatorType * > ( LinearInterpolatorType::New().GetPointer() ); - m_Extrapolator = NULL; + m_Extrapolator = ITK_NULLPTR; m_DefaultPixelValue = NumericTraits::ZeroValue( m_DefaultPixelValue ); @@ -84,7 +94,7 @@ os << indent << "OutputSpacing: " << m_OutputSpacing << std::endl; os << indent << "OutputOrigin: " << m_OutputOrigin << std::endl; os << indent << "OutputDirection: " << m_OutputDirection << std::endl; - os << indent << "Transform: " << m_Transform.GetPointer() << std::endl; + os << indent << "Transform: " << this->GetTransform() << std::endl; os << indent << "Interpolator: " << m_Interpolator.GetPointer() << std::endl; os << indent << "Extrapolator: " << m_Extrapolator.GetPointer() << std::endl; os << indent << "UseReferenceImage: " << ( m_UseReferenceImage ? "On" : "Off" ) @@ -155,10 +165,6 @@ ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType > ::BeforeThreadedGenerateData() { - if ( !m_Transform ) - { - itkExceptionMacro(<< "Transform not set"); - } if ( !m_Interpolator ) { @@ -204,11 +210,11 @@ ::AfterThreadedGenerateData() { // Disconnect input image from the interpolator - m_Interpolator->SetInputImage(NULL); + m_Interpolator->SetInputImage(ITK_NULLPTR); if( !m_Extrapolator.IsNull() ) { // Disconnect input image from the extrapolator - m_Extrapolator->SetInputImage(NULL); + m_Extrapolator->SetInputImage(ITK_NULLPTR); } } @@ -243,7 +249,7 @@ // Check whether we can use a fast path for resampling. Fast path // can be used if the transformation is linear. Transform respond // to the IsLinear() call. - if ( this->m_Transform->GetTransformCategory() == TransformType::Linear ) + if ( this->GetTransform()->GetTransformCategory() == TransformType::Linear ) { this->LinearThreadedGenerateData(outputRegionForThread, threadId); return; @@ -309,10 +315,14 @@ ThreadIdType threadId) { // Get the output pointers - OutputImagePointer outputPtr = this->GetOutput(); + OutputImageType *outputPtr = this->GetOutput(); // Get this input pointers - InputImageConstPointer inputPtr = this->GetInput(); + const InputImageType *inputPtr = this->GetInput(); + + // Get the input transform + const TransformType *transformPtr = this->GetTransform(); + // Create an iterator that will walk the output region for this thread. typedef ImageRegionIteratorWithIndex< TOutputImage > OutputIterator; @@ -348,7 +358,7 @@ outputPtr->TransformIndexToPhysicalPoint(outIt.GetIndex(), outputPoint); // Compute corresponding input pixel position - inputPoint = this->m_Transform->TransformPoint(outputPoint); + inputPoint = transformPtr->TransformPoint(outputPoint); inputPtr->TransformPhysicalPointToContinuousIndex(inputPoint, inputIndex); PixelType pixval; @@ -393,10 +403,13 @@ ThreadIdType threadId) { // Get the output pointers - OutputImagePointer outputPtr = this->GetOutput(); + OutputImageType *outputPtr = this->GetOutput(); // Get this input pointers - InputImageConstPointer inputPtr = this->GetInput(); + const InputImageType *inputPtr = this->GetInput(); + + // Get the input transform + const TransformType *transformPtr = this->GetTransform(); // Create an iterator that will walk the output region for this thread. typedef ImageLinearIteratorWithIndex< TOutputImage > OutputIterator; @@ -443,7 +456,7 @@ outputPtr->TransformIndexToPhysicalPoint(index, outputPoint); // Compute corresponding input pixel position - inputPoint = this->m_Transform->TransformPoint(outputPoint); + inputPoint = transformPtr->TransformPoint(outputPoint); inputPtr->TransformPhysicalPointToContinuousIndex(inputPoint, inputIndex); // As we walk across a scan line in the output image, we trace @@ -464,7 +477,7 @@ // ++index[0]; outputPtr->TransformIndexToPhysicalPoint(index, tmpOutputPoint); - tmpInputPoint = this->m_Transform->TransformPoint(tmpOutputPoint); + tmpInputPoint = transformPtr->TransformPoint(tmpOutputPoint); inputPtr->TransformPhysicalPointToContinuousIndex(tmpInputPoint, tmpInputIndex); delta = tmpInputIndex - inputIndex; @@ -481,7 +494,7 @@ // Compute corresponding input pixel continuous index, this index // will incremented in the scanline loop - inputPoint = this->m_Transform->TransformPoint(outputPoint); + inputPoint = transformPtr->TransformPoint(outputPoint); inputPtr->TransformPhysicalPointToContinuousIndex(inputPoint, inputIndex); while ( !outIt.IsAtEndOfLine() ) @@ -549,47 +562,6 @@ } /** - * Get the reference image that will provide the grid parameters for the output image. - */ -template< typename TInputImage, - typename TOutputImage, - typename TInterpolatorPrecisionType, - typename TTransformPrecisionType > -const typename ResampleImageFilter< TInputImage, - TOutputImage, - TInterpolatorPrecisionType, - TTransformPrecisionType > -::ReferenceImageBaseType * -ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType > -::GetReferenceImage() const -{ - Self * surrogate = const_cast< Self * >( this ); - const ReferenceImageBaseType *referenceImage = - static_cast< const ReferenceImageBaseType * >( surrogate->ProcessObject::GetInput(1) ); - - return referenceImage; -} - -/** - * Set the reference image that will provide the grid parameters for the output image. - */ -template< typename TInputImage, - typename TOutputImage, - typename TInterpolatorPrecisionType, - typename TTransformPrecisionType > -void -ResampleImageFilter< TInputImage, TOutputImage, TInterpolatorPrecisionType, TTransformPrecisionType > -::SetReferenceImage(const ReferenceImageBaseType *image) -{ - itkDebugMacro("setting input ReferenceImage to " << image); - if ( image != static_cast< const ReferenceImageBaseType * >( this->ProcessObject::GetInput(1) ) ) - { - this->ProcessObject::SetNthInput( 1, const_cast< ReferenceImageBaseType * >( image ) ); - this->Modified(); - } -} - -/** * Inform pipeline of required output region */ template< typename TInputImage, @@ -604,7 +576,7 @@ Superclass::GenerateOutputInformation(); // get pointers to the input and output - OutputImagePointer outputPtr = this->GetOutput(); + OutputImageType *outputPtr = this->GetOutput(); if ( !outputPtr ) { return; @@ -654,14 +626,6 @@ { ModifiedTimeType latestTime = Object::GetMTime(); - if ( m_Transform ) - { - if ( latestTime < m_Transform->GetMTime() ) - { - latestTime = m_Transform->GetMTime(); - } - } - if ( m_Interpolator ) { if ( latestTime < m_Interpolator->GetMTime() ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ * in each dimension. The algorithm implemented is a simple subsample. * The output image size in each dimension is given by: * - * outputSize[j] = max( vcl_floor(inputSize[j]/shrinkFactor[j]), 1 ); + * outputSize[j] = max( std::floor(inputSize[j]/shrinkFactor[j]), 1 ); * * NOTE: The physical centers of the input and output will be the * same. Because of this, the Origin of the output may not be the same diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkShrinkImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -311,7 +311,7 @@ // Round down so that all output pixels fit input input region outputSize[i] = static_cast( - vcl_floor( (double)inputSize[i] / (double)m_ShrinkFactors[i] ) ); + std::floor( (double)inputSize[i] / (double)m_ShrinkFactors[i] ) ); if ( outputSize[i] < 1 ) { @@ -321,7 +321,7 @@ // Because of the later origin shift this starting index is not // critical outputStartIndex[i] = static_cast( - vcl_ceil( (double)inputStartIndex[i] / (double)m_ShrinkFactors[i] ) ); + std::ceil( (double)inputStartIndex[i] / (double)m_ShrinkFactors[i] ) ); } outputPtr->SetSpacing(outputSpacing); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,8 +30,8 @@ TInternalOutputImageType > ::SliceBySliceImageFilter() { - m_InputFilter = NULL; - m_OutputFilter = NULL; + m_InputFilter = ITK_NULLPTR; + m_OutputFilter = ITK_NULLPTR; this->m_Dimension = ImageDimension - 1; m_SliceIndex = 0; } @@ -113,7 +113,7 @@ { OutputFilterType *outputFilter = dynamic_cast< OutputFilterType * >( filter ); - if ( outputFilter == NULL && filter != NULL ) + if ( outputFilter == ITK_NULLPTR && filter != ITK_NULLPTR ) { // TODO: can it be replaced by a concept check ? itkExceptionMacro( @@ -130,6 +130,11 @@ TInternalOutputImageType > ::SetInputFilter(InputFilterType *filter) { + if ( !filter ) + { + itkExceptionMacro("InputFilter cannot be NULL."); + } + if ( m_InputFilter.GetPointer() != filter ) { this->Modified(); @@ -146,6 +151,11 @@ TInternalOutputImageType > ::SetOutputFilter(OutputFilterType *filter) { + if ( !filter ) + { + itkExceptionMacro("OutputFilter cannot be NULL."); + } + if ( m_OutputFilter.GetPointer() != filter ) { this->Modified(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,6 +26,7 @@ #include "itkPasteImageFilter.h" #include "itkImportImageContainer.h" #include "itkNumericTraitsRGBPixel.h" +#include "itkProgressAccumulator.h" namespace itk { @@ -42,6 +43,9 @@ TileImageFilter< TInputImage, TOutputImage > ::GenerateData() { + ProgressAccumulator::Pointer progress = ProgressAccumulator::New(); + progress->SetMiniPipelineFilter(this); + typename TOutputImage::Pointer output = this->GetOutput(); @@ -53,6 +57,19 @@ ImageRegionIterator< TileImageType > it( m_TileImage, m_TileImage->GetBufferedRegion() ); it.GoToBegin(); + + SizeValueType numPastes = 0; + while ( !it.IsAtEnd() ) + { + if ( it.Get().m_ImageNumber >= 0 ) + { + ++numPastes; + } + ++it; + } + const float progressContrib = 1.0f/numPastes; + + it.GoToBegin(); while ( !it.IsAtEnd() ) { if ( it.Get().m_ImageNumber >= 0 ) @@ -62,6 +79,8 @@ paste->SetDestinationImage(output); paste->InPlaceOn(); + progress->RegisterInternalFilter(paste, progressContrib); + // Create a temporary image that has the same dimensions as the // output image. The additional dimensions are set to 1. The // temporary image will use the same container as the input diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkVectorResampleImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkVectorResampleImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkVectorResampleImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkVectorResampleImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,7 @@ ::AfterThreadedGenerateData() { // Disconnect input image from the interpolator - m_Interpolator->SetInputImage(NULL); + m_Interpolator->SetInputImage(ITK_NULLPTR); } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/include/itkWarpImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -50,6 +50,8 @@ m_Interpolator = static_cast< InterpolatorType * >( interp.GetPointer() ); + + m_DefFieldSizeSame = false; } /** @@ -203,7 +205,7 @@ ::AfterThreadedGenerateData() { // Disconnect input image from interpolator - m_Interpolator->SetInputImage(NULL); + m_Interpolator->SetInputImage(ITK_NULLPTR); } template< typename TInputImage, typename TOutputImage, typename TDisplacementField > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkBinShrinkImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkBinShrinkImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkBinShrinkImageFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkBinShrinkImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,4 @@ itk_wrap_class("itk::BinShrinkImageFilter" POINTER) - itk_wrap_image_filter("${WRAP_ITK_SCALAR}" 2) itk_wrap_image_filter("${WRAP_ITK_RGB}" 2) itk_wrap_image_filter("${WRAP_ITK_RGBA}" 2) # VS9 (2008) does not correctly implicitly cast itk::Vector for operator += diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkOrientImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkOrientImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkOrientImageFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkOrientImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,7 @@ -itk_wrap_class("itk::OrientImageFilter" POINTER) - itk_wrap_image_filter("${WRAP_ITK_ALL_TYPES}" 2 3) -itk_end_wrap_class() +itk_wrap_filter_dims(has_d_3 3) + +if(has_d_3) + itk_wrap_class("itk::OrientImageFilter" POINTER) + itk_wrap_image_filter("${WRAP_ITK_ALL_TYPES}" 2 3) + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkSliceBySliceImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkSliceBySliceImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkSliceBySliceImageFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageGrid/wrapping/itkSliceBySliceImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,13 +1,22 @@ -itk_wrap_class("itk::SliceBySliceImageFilter" POINTER) - foreach(d ${ITK_WRAP_DIMS}) - math(EXPR d_1 "${d} - 1") - itk_wrap_filter_dims(has_d_1 ${d_1}) - if(has_d_1) - # avoid the vector and covariant vector types: the type - # Image< Vector< T, N >, N-1 > is not wrapped - itk_wrap_image_filter("${WRAP_ITK_SCALAR}" 2 ${d}) - itk_wrap_image_filter("${WRAP_ITK_RGB}" 2 ${d}) - itk_wrap_image_filter("${WRAP_ITK_COMPLEX_REAL}" 2 ${d}) - endif(has_d_1) - endforeach(d) -itk_end_wrap_class() +# Check if we have the right dimensions before wrapping +foreach(d ${ITK_WRAP_DIMS}) + math(EXPR d_1 "${d} - 1") +endforeach(d) +itk_wrap_filter_dims(has_d_1 ${d_1}) + +# Wrap if allowed +if(has_d_1) + itk_wrap_class("itk::SliceBySliceImageFilter" POINTER) + foreach(d ${ITK_WRAP_DIMS}) + math(EXPR d_1 "${d} - 1") + itk_wrap_filter_dims(has_d_1 ${d_1}) + if(has_d_1) + # avoid the vector and covariant vector types: the type + # Image< Vector< T, N >, N-1 > is not wrapped + itk_wrap_image_filter("${WRAP_ITK_SCALAR}" 2 ${d}) + itk_wrap_image_filter("${WRAP_ITK_RGB}" 2 ${d}) + itk_wrap_image_filter("${WRAP_ITK_COMPLEX_REAL}" 2 ${d}) + endif(has_d_1) + endforeach(d) + itk_end_wrap_class() +endif(has_d_1) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAcosImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAcosImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAcosImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAcosImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ inline TOutput operator()(const TInput & A) const { - return static_cast< TOutput >( vcl_acos( static_cast< double >( A ) ) ); + return static_cast< TOutput >( std::acos( static_cast< double >( A ) ) ); } }; } @@ -63,8 +63,8 @@ * each pixel does do the following: * * \li cast the pixel value to \c double, - * \li apply the \c vcl_acos() function to the \c double value - * \li cast the \c double value resulting from \c vcl_acos() to the pixel type + * \li apply the \c std::acos() function to the \c double value + * \li cast the \c double value resulting from \c std::acos() to the pixel type * of the output image * \li store the casted value into the output image. * diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAdaptImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAdaptImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAdaptImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAdaptImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -100,7 +100,7 @@ * (i.e. short to float) or can extract a subcomponent of a pixel * (i.e. extract the green component of an RGB pixel. * AdaptImageFilter could also be used for performing simple - * arithmetic operations at a pixel (i.e. taking the vcl_sqrt() or vcl_sin() + * arithmetic operations at a pixel (i.e. taking the std::sqrt() or std::sin() * of a pixel); however, these types of operations could also be * accomplished using the itk::UnaryImageFilter. * diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAsinImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAsinImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAsinImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAsinImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ inline TOutput operator()(const TInput & A) const { return static_cast< TOutput >( - vcl_asin( + std::asin( static_cast< double >( A ) ) ); @@ -66,8 +66,8 @@ * each pixel does the following: * * \li cast the pixel value to \c double, - * \li apply the \c vcl_asin() function to the \c double value, - * \li cast the \c double value resulting from \c vcl_asin() to the + * \li apply the \c std::asin() function to the \c double value, + * \li cast the \c double value resulting from \c std::asin() to the * pixel type of the output image, * \li store the casted value into the output image. * diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtan2ImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtan2ImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtan2ImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtan2ImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ inline TOutput operator()(const TInput1 & A, const TInput2 & B) const { return static_cast< TOutput >( - vcl_atan2( + std::atan2( static_cast< double >( A ), static_cast< double >( B ) ) ); @@ -69,7 +69,7 @@ * Numeric conversions (castings) are done by the C++ defaults. * * Both pixel input types are cast to \c double in order to be - * used as parameters of \c vcl_atan2(). The resulting \c double value + * used as parameters of \c std::atan2(). The resulting \c double value * is cast to the output pixel type. * * \ingroup IntensityImageFilters diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtanImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtanImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtanImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkAtanImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ inline TOutput operator()(const TInput & A) const { - return static_cast< TOutput >( vcl_atan( static_cast< double >( A ) ) ); + return static_cast< TOutput >( std::atan( static_cast< double >( A ) ) ); } }; } @@ -62,8 +62,8 @@ * each pixel does the following: * * \li cast the pixel value to \c double, - * \li apply the \c vcl_atan() function to the \c double value, - * \li cast the \c double value resulting from \c vcl_atan() to the pixel + * \li apply the \c std::atan() function to the \c double value, + * \li cast the \c double value resulting from \c std::atan() to the pixel * type of the output image, * \li store the cast value into the output image. * diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkBinaryMagnitudeImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkBinaryMagnitudeImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkBinaryMagnitudeImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkBinaryMagnitudeImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ const double dA = static_cast< double >( A ); const double dB = static_cast< double >( B ); - return static_cast< TOutput >( vcl_sqrt(dA * dA + dB * dB) ); + return static_cast< TOutput >( std::sqrt(dA * dA + dB * dB) ); } }; } @@ -70,7 +70,7 @@ * \li cast the input 2 pixel value to \c double * \li compute the sum of squares of the two pixel values * \li compute the square root of the sum - * \li cast the \c double value resulting from \c vcl_sqrt() to the pixel type of the output image + * \li cast the \c double value resulting from \c std::sqrt() to the pixel type of the output image * \li store the cast value into the output image. * * The filter expects all images to have the same dimension diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToModulusImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToModulusImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToModulusImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToModulusImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ inline TOutput operator()(const TInput & A) const { - return (TOutput)( vcl_sqrt( A.real() * A.real() + return (TOutput)( std::sqrt( A.real() * A.real() + A.imag() * A.imag() ) ); } }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToPhaseImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToPhaseImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToPhaseImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkComplexToPhaseImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ inline TOutput operator()(const TInput & A) const { - return (TOutput)( vcl_atan2( A.imag(), A.real() ) ); + return (TOutput)( std::atan2( A.imag(), A.real() ) ); } }; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkCosImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkCosImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkCosImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkCosImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ inline TOutput operator()(const TInput & A) const { - return static_cast< TOutput >( vcl_cos( static_cast< double >( A ) ) ); + return static_cast< TOutput >( std::cos( static_cast< double >( A ) ) ); } }; } @@ -62,8 +62,8 @@ * each pixel does the following: * * \li cast the pixel value to \c double, - * \li apply the \c vcl_cos() function to the \c double value, - * \li cast the \c double value resulting from \c vcl_cos() to the pixel type of the output image, + * \li apply the \c std::cos() function to the \c double value, + * \li cast the \c double value resulting from \c std::cos() to the pixel type of the output image, * \li store the cast value into the output image. * * The filter expects both images to have the same dimension (e.g. both diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkDivideImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -136,7 +136,7 @@ const typename Superclass::DecoratedInput2ImagePixelType *input = dynamic_cast< const typename Superclass::DecoratedInput2ImagePixelType * >( this->ProcessObject::GetInput(1) ); - if( input != NULL && input->Get() == itk::NumericTraits< typename TInputImage2::PixelType >::Zero ) + if( input != ITK_NULLPTR && input->Get() == itk::NumericTraits< typename TInputImage2::PixelType >::Zero ) { itkGenericExceptionMacro(<<"The constant value used as denominator should not be set to zero"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkEdgePotentialImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkEdgePotentialImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkEdgePotentialImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkEdgePotentialImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -54,7 +54,7 @@ inline TOutput operator()(const TInput & A) const { - return static_cast< TOutput >( vcl_exp( -1.0 * A.GetNorm() ) ); + return static_cast< TOutput >( std::exp( -1.0 * A.GetNorm() ) ); } }; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,14 +48,14 @@ inline TOutput operator()(const TInput & A) const { - return (TOutput)vcl_exp( (double)A ); + return (TOutput)std::exp( (double)A ); } }; } /** \class ExpImageFilter * \brief Computes the exponential function of each pixel. * - * The computation is performed using vcl_exp(x). + * The computation is performed using std::exp(x). * * \ingroup IntensityImageFilters * \ingroup MultiThreaded diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpNegativeImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpNegativeImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpNegativeImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkExpNegativeImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -53,7 +53,7 @@ inline TOutput operator()(const TInput & A) const { - return static_cast< TOutput >( vcl_exp( -m_Factor * static_cast< double >( A ) ) ); + return static_cast< TOutput >( std::exp( -m_Factor * static_cast< double >( A ) ) ); } /** Sets the value 'K' used in the function evaluation exp(-K.x). */ @@ -74,7 +74,7 @@ /** \class ExpNegativeImageFilter * \brief Computes the function exp(-K.x) for each input pixel. * - * Every output pixel is equal to vcl_exp(-K.x ). where x is the + * Every output pixel is equal to std::exp(-K.x ). where x is the * intensity of the homologous input pixel, and K is a user-provided * constant. * diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,28 +30,34 @@ */ template< typename TInputImage, typename TOutputImage, typename THistogramMeasurement > HistogramMatchingImageFilter< TInputImage, TOutputImage, THistogramMeasurement > -::HistogramMatchingImageFilter() +::HistogramMatchingImageFilter() : + m_NumberOfHistogramLevels(256), + m_NumberOfMatchPoints(1), + m_ThresholdAtMeanIntensity(true), + m_SourceIntensityThreshold(NumericTraits::Zero), + m_ReferenceIntensityThreshold(NumericTraits::Zero), + m_OutputIntensityThreshold(NumericTraits::Zero), + m_SourceMinValue(NumericTraits::Zero), + m_SourceMaxValue(NumericTraits::Zero), + m_SourceMeanValue(NumericTraits::Zero), + m_ReferenceMinValue(NumericTraits::Zero), + m_ReferenceMaxValue(NumericTraits::Zero), + m_ReferenceMeanValue(NumericTraits::Zero), + m_OutputMinValue(NumericTraits::Zero), + m_OutputMaxValue(NumericTraits::Zero), + m_OutputMeanValue(NumericTraits::Zero), + m_SourceHistogram(HistogramType::New()), + m_ReferenceHistogram(HistogramType::New()), + m_OutputHistogram(HistogramType::New()), + m_LowerGradient(0.0), + m_UpperGradient(0.0) { this->SetNumberOfRequiredInputs(2); - m_NumberOfHistogramLevels = 256; - m_NumberOfMatchPoints = 1; - m_QuantileTable.set_size(3, m_NumberOfMatchPoints + 2); m_QuantileTable.fill(0); m_Gradients.set_size(m_NumberOfMatchPoints + 1); m_Gradients.fill(0); - - m_ThresholdAtMeanIntensity = true; - m_SourceIntensityThreshold = 0; - m_ReferenceIntensityThreshold = 0; - m_LowerGradient = 0.0; - m_UpperGradient = 0.0; - - // Create histograms. - m_SourceHistogram = HistogramType::New(); - m_ReferenceHistogram = HistogramType::New(); - m_OutputHistogram = HistogramType::New(); } /* @@ -398,7 +404,7 @@ const THistogramMeasurement minValue, const THistogramMeasurement maxValue) { - { + { // allocate memory for the histogram typename HistogramType::SizeType size; typename HistogramType::MeasurementVectorType lowerBound; @@ -416,15 +422,15 @@ //Initialize with equally spaced bins. histogram->Initialize(size, lowerBound, upperBound); histogram->SetToZero(); - } - - typename HistogramType::MeasurementVectorType measurement; - measurement.SetSize(1); + } + typename HistogramType::IndexType index(1); + typename HistogramType::MeasurementVectorType measurement(1); typedef typename HistogramType::MeasurementType MeasurementType; measurement[0] = NumericTraits< MeasurementType >::Zero; { + // put each image pixel into the histogram typedef ImageRegionConstIterator< InputImageType > ConstIterator; ConstIterator iter( image, image->GetBufferedRegion() ); @@ -439,7 +445,8 @@ { // add sample to histogram measurement[0] = value; - histogram->IncreaseFrequencyOfMeasurement(measurement, 1); + histogram->GetIndex( measurement, index ); + histogram->IncreaseFrequencyOfIndex( index, 1 ); } ++iter; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkIntensityWindowingImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkIntensityWindowingImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkIntensityWindowingImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkIntensityWindowingImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,13 @@ { public: typedef typename NumericTraits< TInput >::RealType RealType; - IntensityWindowingTransform() {} + IntensityWindowingTransform() : + m_Factor(0.0), + m_Offset(0.0), + m_OutputMaximum(0), + m_OutputMinimum(0), + m_WindowMaximum(0), + m_WindowMinimum(0) {} ~IntensityWindowingTransform() {} bool operator!=(const IntensityWindowingTransform & other) const { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLog10ImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLog10ImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLog10ImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLog10ImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,14 +48,14 @@ inline TOutput operator()(const TInput & A) const { - return static_cast< TOutput >( vcl_log10( static_cast< double >( A ) ) ); + return static_cast< TOutput >( std::log10( static_cast< double >( A ) ) ); } }; } /** \class Log10ImageFilter * \brief Computes the log10 of each pixel. * - * The computation is performed using vcl_log10(x). + * The computation is performed using std::log10(x). * * \ingroup IntensityImageFilters * \ingroup MultiThreaded diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLogImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLogImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLogImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkLogImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ inline TOutput operator()(const TInput & A) const { - return static_cast< TOutput >( vcl_log( static_cast< double >( A ) ) ); + return static_cast< TOutput >( std::log( static_cast< double >( A ) ) ); } }; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMagnitudeAndPhaseToComplexImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMagnitudeAndPhaseToComplexImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMagnitudeAndPhaseToComplexImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMagnitudeAndPhaseToComplexImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,142 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkMagnitudeAndPhaseToComplexImageFilter_h +#define __itkMagnitudeAndPhaseToComplexImageFilter_h + +#include "itkBinaryFunctorImageFilter.h" + +namespace itk +{ +/** \class MagnitudeAndPhaseToComplexImageFilter + * + * \brief Implements pixel-wise conversion of magnitude and phase data into + * complex voxels. + * + * This filter is parametrized over the types of the two + * input images and the type of the output image. + * + * The filter expect all images to have the same dimension + * (e.g. all 2D, or all 3D, or all ND) + * + * \ingroup IntensityImageFilters MultiThreaded + * + * \weakgroup FourierTransform + * + * \author Simon K. Warfield simon.warfield@childrens.harvard.edu + * + * \note Attribution Notice. This research work was made possible by Grant + * Number R01 RR021885 (PI Simon K. Warfield, Ph.D.) from the National Center + * for Research Resources (NCRR), a component of the National Institutes of + * Health (NIH). Its contents are solely the responsibility of the authors + * and do not necessarily represent the official view of NCRR or NIH. + * + * This class was taken from the Insight Journal paper: + * http://hdl.handle.net/1926/326 + * + * \sa ComposeImageFilter + * + * \ingroup ITKImageIntensity + */ +namespace Functor +{ +template< typename TInput1, typename TInput2, typename TOutput > +class MagnitudeAndPhaseToComplex +{ +public: + MagnitudeAndPhaseToComplex() {} + ~MagnitudeAndPhaseToComplex() {} + bool operator!=(const MagnitudeAndPhaseToComplex &) const + { + return false; + } + + bool operator==(const MagnitudeAndPhaseToComplex & other) const + { + return !( *this != other ); + } + + inline std::complex< TOutput > operator()(const TInput1 & A, const TInput2 & B) const + { + return std::complex< TOutput >( std::polar( static_cast< TOutput >( A ), static_cast< TOutput >( B ) ) ); + } +}; +} + +template< typename TInputImage1, + typename TInputImage2 = TInputImage1, + typename TOutputImage = itk::Image< std::complex< typename TInputImage1::PixelType >, + TInputImage1::ImageDimension > > +class MagnitudeAndPhaseToComplexImageFilter: + public BinaryFunctorImageFilter< + TInputImage1, + TInputImage2, + TOutputImage, + Functor::MagnitudeAndPhaseToComplex< + typename TInputImage1::PixelType, + typename TInputImage2::PixelType, + typename TOutputImage::PixelType::value_type > > + +{ +public: + /** Standard class typedefs. */ + typedef MagnitudeAndPhaseToComplexImageFilter Self; + + typedef BinaryFunctorImageFilter< + TInputImage1, + TInputImage2, + TOutputImage, + Functor::MagnitudeAndPhaseToComplex< + typename TInputImage1::PixelType, + typename TInputImage2::PixelType, + typename TOutputImage::PixelType::value_type > > Superclass; + + typedef typename TInputImage1::PixelType InputPixel1Type; + typedef typename TInputImage2::PixelType InputPixel2Type; + typedef typename TOutputImage::PixelType OutputPixelType; + + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(MagnitudeAndPhaseToComplexImageFilter, BinaryFunctorImageFilter); + +#ifdef ITK_USE_CONCEPT_CHECKING + // Begin concept checking + itkConceptMacro( Input1ConvertibleToDoubleCheck, + ( Concept::Convertible< InputPixel1Type, double > ) ); + itkConceptMacro( Input2ConvertibleToDoubleCheck, + ( Concept::Convertible< InputPixel2Type, double > ) ); + itkConceptMacro( DoubleConvertibleToOutputCheck, + ( Concept::Convertible< double, OutputPixelType > ) ); + // End concept checking +#endif + +protected: + MagnitudeAndPhaseToComplexImageFilter() {} + virtual ~MagnitudeAndPhaseToComplexImageFilter() {} + +private: + MagnitudeAndPhaseToComplexImageFilter(const Self &); //purposely not implemented + void operator=(const Self &); //purposely not implemented +}; +} // end namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ MaskInput() { m_MaskingValue = NumericTraits< TMask >::ZeroValue(); - InitializeOutsideValue( static_cast( NULL ) ); + InitializeOutsideValue( static_cast( ITK_NULLPTR ) ); } ~MaskInput() {} bool operator!=(const MaskInput &) const @@ -93,14 +93,14 @@ template < typename TPixelType > void InitializeOutsideValue( TPixelType * ) { - this->m_OutsideValue = NumericTraits< TPixelType >::Zero; + this->m_OutsideValue = NumericTraits< TPixelType >::ZeroValue(); } - template < typename TValueType > - void InitializeOutsideValue( VariableLengthVector * ) + template < typename TValue > + void InitializeOutsideValue( VariableLengthVector * ) { // set the outside value to be of zero length - this->m_OutsideValue = VariableLengthVector< TValueType >(0); + this->m_OutsideValue = VariableLengthVector< TValue >(0); } TOutput m_OutsideValue; @@ -221,7 +221,7 @@ void BeforeThreadedGenerateData() { typedef typename TOutputImage::PixelType PixelType; - this->CheckOutsideValue( static_cast(NULL) ); + this->CheckOutsideValue( static_cast(ITK_NULLPTR) ); } #ifdef ITK_USE_CONCEPT_CHECKING @@ -262,12 +262,12 @@ VariableLengthVector< TValue > currentValue = this->GetFunctor().GetOutsideValue(); VariableLengthVector< TValue > zeroVector( currentValue.GetSize() ); - zeroVector.Fill( NumericTraits< TValue >::Zero ); + zeroVector.Fill( NumericTraits< TValue >::ZeroValue() ); if ( currentValue == zeroVector ) { zeroVector.SetSize( this->GetOutput()->GetVectorLength() ); - zeroVector.Fill( NumericTraits< TValue >::Zero ); + zeroVector.Fill( NumericTraits< TValue >::ZeroValue() ); this->GetFunctor().SetOutsideValue( zeroVector ); } else if ( this->GetFunctor().GetOutsideValue().GetSize() != diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkMaskNegatedImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType; MaskNegatedInput() - : m_OutsideValue(NumericTraits< TOutput >::Zero) + : m_OutsideValue(NumericTraits< TOutput >::ZeroValue()) , m_MaskingValue(NumericTraits< TMask >::ZeroValue()) { } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkNormalizeImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkNormalizeImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkNormalizeImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkNormalizeImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ NormalizeImageFilter< TInputImage, TOutputImage > ::NormalizeImageFilter() { - m_StatisticsFilter = 0; + m_StatisticsFilter = ITK_NULLPTR; m_StatisticsFilter = StatisticsImageFilter< TInputImage >::New(); m_ShiftScaleFilter = ShiftScaleImageFilter< TInputImage, TOutputImage >::New(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMask2DImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMask2DImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMask2DImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMask2DImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,6 @@ typedef typename TOutputImage::PixelType PixelType; typedef ImageRegionIterator< TOutputImage > OutputImageIteratorType; - typedef typename TPolyline::Pointer PolylinePointer; typedef typename TPolyline::VertexType VertexType; typedef typename TPolyline::VertexListType VertexListType; @@ -105,7 +104,6 @@ outputImagePtr->SetLargestPossibleRegion( inputImagePtr->GetLargestPossibleRegion() ); outputImagePtr->Allocate(); - typedef typename VertexListType::Pointer VertexListPointer; const VertexListType *container = polylinePtr->GetVertexList(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMaskImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMaskImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMaskImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPolylineMaskImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -188,14 +188,11 @@ typedef typename TInputImage::SpacingType InputImageSpacingType; typedef ImageRegionConstIterator< TInputImage > InputImageConstIteratorType; - typedef typename TOutputImage::IndexType ImageIndexType; typedef typename TOutputImage::PixelType PixelType; typedef ImageRegionIterator< TOutputImage > OutputImageIteratorType; - typedef typename TPolyline::Pointer PolylinePointer; typedef typename TPolyline::VertexType VertexType; typedef typename TPolyline::VertexListType VertexListType; - typedef typename TPolyline::IndexType PolylineIndexType; typedef Point< double, 3 > OriginType; @@ -219,14 +216,13 @@ outputImagePtr->SetRequestedRegion( inputImagePtr->GetRequestedRegion() ); outputImagePtr->SetBufferedRegion( inputImagePtr->GetBufferedRegion() ); outputImagePtr->SetLargestPossibleRegion( inputImagePtr->GetLargestPossibleRegion() ); - outputImagePtr->Allocate(); - outputImagePtr->FillBuffer(0); + outputImagePtr->Allocate(true); // initialize + // buffer to zero InputImageConstIteratorType inputIt( inputImagePtr, inputImagePtr->GetLargestPossibleRegion() ); OutputImageIteratorType outputIt( outputImagePtr, outputImagePtr->GetLargestPossibleRegion() ); typedef NearestNeighborInterpolateImageFunction< TInputImage, double > InterpolatorType; - typedef typename InterpolatorType::OutputType OutputType; typedef typename InterpolatorType::PointType InterpolatorPointType; /* Generate the transformation matrix */ @@ -394,16 +390,15 @@ projectionImagePtr->SetRequestedRegion(projectionRegion); projectionImagePtr->SetBufferedRegion(projectionRegion); projectionImagePtr->SetLargestPossibleRegion(projectionRegion); - projectionImagePtr->Allocate(); - projectionImagePtr->FillBuffer(0); + projectionImagePtr->Allocate(true); // initialize + // buffer + // to zero typedef ImageRegionIterator< ProjectionImageType > ProjectionImageIteratorType; ProjectionImageIteratorType projectionIt( projectionImagePtr, projectionImagePtr->GetLargestPossibleRegion() ); itkDebugMacro(<< "Rotation matrix" << m_RotationMatrix); - typedef typename VertexListType::Pointer VertexListPointer; - const VertexListType *container = polylinePtr->GetVertexList(); typename VertexListType::ConstIterator piter = container->Begin(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPowImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPowImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPowImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkPowImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ { typedef typename NumericTraits< TInput1 >::RealType RealType; - return static_cast< TOutput >( vcl_pow(static_cast(A),static_cast(B)) ); + return static_cast< TOutput >( std::pow(static_cast(A),static_cast(B)) ); } }; } @@ -67,7 +67,7 @@ * * The total operation over one pixel will be * \code - * output_pixel = static_cast< TOutput >( vcl_pow(static_cast(A),static_cast(B)) ); + * output_pixel = static_cast< TOutput >( std::pow(static_cast(A),static_cast(B)) ); * \endcode * * The pow function can be applied to two images with the following: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkShiftScaleImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkShiftScaleImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkShiftScaleImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkShiftScaleImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,8 +35,8 @@ m_OverflowCount = 0; m_ThreadUnderflow.SetSize(1); m_ThreadOverflow.SetSize(1); - m_InputImage = 0; - m_OutputImage = 0; + m_InputImage = ITK_NULLPTR; + m_OutputImage = ITK_NULLPTR; } template< typename TInputImage, typename TOutputImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSigmoidImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSigmoidImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSigmoidImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSigmoidImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -79,7 +79,7 @@ inline TOutput operator()(const TInput & A) const { const double x = ( static_cast< double >( A ) - m_Beta ) / m_Alpha; - const double e = 1.0 / ( 1.0 + vcl_exp(-x) ); + const double e = 1.0 / ( 1.0 + std::exp(-x) ); const double v = ( m_OutputMaximum - m_OutputMinimum ) * e + m_OutputMinimum; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSinImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSinImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSinImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSinImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -47,13 +47,13 @@ } inline TOutput operator()(const TInput & A) const - { return (TOutput)vcl_sin( (double)A ); } + { return (TOutput)std::sin( (double)A ); } }; } /** \class SinImageFilter * \brief Computes the sine of each pixel. * - * The computations are performed using vcl_sin(x). + * The computations are performed using std::sin(x). * * \ingroup IntensityImageFilters * \ingroup MultiThreaded diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSqrtImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSqrtImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSqrtImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkSqrtImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,14 +48,14 @@ inline TOutput operator()(const TInput & A) const { - return (TOutput)vcl_sqrt( (double)A ); + return (TOutput)std::sqrt( (double)A ); } }; } /** \class SqrtImageFilter * \brief Computes the square root of each pixel. * - * The computations are performed using vcl_sqrt(x). + * The computations are performed using std::sqrt(x). * * \ingroup IntensityImageFilters * \ingroup MultiThreaded diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTanImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTanImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTanImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTanImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -47,13 +47,13 @@ } inline TOutput operator()(const TInput & A) const - { return (TOutput)vcl_tan( (double)A ); } + { return (TOutput)std::tan( (double)A ); } }; } /** \class TanImageFilter * \brief Computes the tangent of each input pixel. * - * The computations are performed using vcl_tan(x). + * The computations are performed using std::tan(x). * * \ingroup IntensityImageFilters * \ingroup MultiThreaded diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTernaryMagnitudeImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTernaryMagnitudeImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTernaryMagnitudeImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkTernaryMagnitudeImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -48,7 +48,7 @@ inline TOutput operator()(const TInput1 & A, const TInput2 & B, const TInput3 & C) const - { return (TOutput)vcl_sqrt( (double)( A * A + B * B + C * C ) ); } + { return (TOutput)std::sqrt( (double)( A * A + B * B + C * C ) ); } }; } /** \class TernaryMagnitudeImageFilter diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorExpandImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorExpandImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorExpandImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorExpandImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -259,11 +259,11 @@ for ( i = 0; i < TInputImage::ImageDimension; i++ ) { inputRequestedRegionSize[i] = - (SizeValueType)vcl_ceil( (double)outputRequestedRegionSize[i] + (SizeValueType)std::ceil( (double)outputRequestedRegionSize[i] / (double)m_ExpandFactors[i] ) + 1; inputRequestedRegionStartIndex[i] = - (IndexValueType)vcl_floor( (double)outputRequestedRegionStartIndex[i] + (IndexValueType)std::floor( (double)outputRequestedRegionStartIndex[i] / (double)m_ExpandFactors[i] ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ { public: typedef typename NumericTraits< typename TInput::ValueType >::RealType RealType; - VectorMagnitudeLinearTransform() {} + VectorMagnitudeLinearTransform() : m_Factor(0.0) {} ~VectorMagnitudeLinearTransform() {} void SetFactor(RealType a) { m_Factor = a; } itkStaticConstMacro(VectorDimension, unsigned int, TInput::Dimension); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkVectorRescaleIntensityImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,12 +38,12 @@ */ template< typename TInputImage, typename TOutputImage > VectorRescaleIntensityImageFilter< TInputImage, TOutputImage > -::VectorRescaleIntensityImageFilter() +::VectorRescaleIntensityImageFilter() : + m_Scale(1.0), + m_Shift(1.0), + m_InputMaximumMagnitude(NumericTraits< InputRealType >::Zero), + m_OutputMaximumMagnitude(NumericTraits< OutputRealType >::Zero) { - m_OutputMaximumMagnitude = NumericTraits< OutputRealType >::Zero; - m_InputMaximumMagnitude = NumericTraits< InputRealType >::Zero; - - m_Scale = 1.0; } /** @@ -101,7 +101,7 @@ ++it; } - m_InputMaximumMagnitude = vcl_sqrt(maximumSquaredMagnitude); + m_InputMaximumMagnitude = std::sqrt(maximumSquaredMagnitude); m_Scale = static_cast< InputRealType >( m_OutputMaximumMagnitude ) / static_cast< InputRealType >( m_InputMaximumMagnitude ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkWeightedAddImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkWeightedAddImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkWeightedAddImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageIntensity/include/itkWeightedAddImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ public: typedef typename NumericTraits< TInput1 >::AccumulateType AccumulatorType; typedef typename NumericTraits< TInput1 >::RealType RealType; - WeightedAdd2() {} + WeightedAdd2() : m_Alpha(0.0), m_Beta(0.0) {} ~WeightedAdd2() {} bool operator!=(const WeightedAdd2 & other) const { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageLabel/include/itkBinaryContourImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageLabel/include/itkBinaryContourImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageLabel/include/itkBinaryContourImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageLabel/include/itkBinaryContourImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -289,7 +289,7 @@ BinaryContourImageFilter< TInputImage, TOutputImage > ::AfterThreadedGenerateData() { - m_Barrier = NULL; + m_Barrier = ITK_NULLPTR; m_ForegroundLineMap.clear(); m_BackgroundLineMap.clear(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,2 @@ +project(ITKImageNoise) +itk_module_impl() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,105 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkAdditiveGaussianNoiseImageFilter_h +#define __itkAdditiveGaussianNoiseImageFilter_h + +#include "itkNoiseBaseImageFilter.h" + +namespace itk +{ + +/** \class AdditiveGaussianNoiseImageFilter + * + * \brief Alter an image with additive gaussian white noise. + * + * \author Gaetan Lehmann + * + * This code was contributed in the Insight Journal paper "Noise + * Simulation". http://hdl.handle.net/10380/3158 + * + * \ingroup ITKImageNoise + */ +template +class AdditiveGaussianNoiseImageFilter : + public NoiseBaseImageFilter +{ +public: + /** Standard class typedefs. */ + typedef AdditiveGaussianNoiseImageFilter Self; + typedef NoiseBaseImageFilter< TInputImage,TOutputImage > Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(AdditiveGaussianNoiseImageFilter, NoiseBaseImageFilter); + + /** Superclass typedefs. */ + typedef typename Superclass::OutputImageType OutputImageType; + typedef typename Superclass::OutputImagePointer OutputImagePointer; + typedef typename Superclass::OutputImageRegionType OutputImageRegionType; + typedef typename Superclass::OutputImagePixelType OutputImagePixelType; + + /** Some convenient typedefs. */ + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef typename InputImageType::ConstPointer InputImageConstPointer; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename InputImageType::PixelType InputImagePixelType; + + itkGetConstMacro(Mean, double); + itkSetMacro(Mean, double); + + itkGetConstMacro(StandardDeviation, double); + itkSetMacro(StandardDeviation, double); + +#ifdef ITK_USE_CONCEPT_CHECKING + /** Begin concept checking */ + itkConceptMacro(InputConvertibleToOutputCheck, + (Concept::Convertible) ); + /** End concept checking */ +#endif + +protected: + AdditiveGaussianNoiseImageFilter(); + virtual ~AdditiveGaussianNoiseImageFilter() { + } + + void PrintSelf(std::ostream &os, Indent indent) const; + + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId ); + +private: + AdditiveGaussianNoiseImageFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + double m_Mean; + double m_StandardDeviation; + +}; + +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkAdditiveGaussianNoiseImageFilter.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkAdditiveGaussianNoiseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,100 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkAdditiveGaussianNoiseImageFilter_hxx +#define __itkAdditiveGaussianNoiseImageFilter_hxx + +#include "itkAdditiveGaussianNoiseImageFilter.h" +#include "itkImageScanlineIterator.h" +#include "itkProgressReporter.h" +#include "itkNormalVariateGenerator.h" + +namespace itk +{ + +template +AdditiveGaussianNoiseImageFilter +::AdditiveGaussianNoiseImageFilter() +{ + m_Mean = 0.0; + m_StandardDeviation = 1.0; +} + +template +void +AdditiveGaussianNoiseImageFilter +::ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread, + ThreadIdType threadId) +{ + const InputImageType* inputPtr = this->GetInput(); + OutputImageType* outputPtr = this->GetOutput(0); + + // create a random generator per thread + typename Statistics::NormalVariateGenerator::Pointer randn = Statistics::NormalVariateGenerator::New(); + const uint32_t seed = Self::Hash(this->GetSeed(),threadId); + // convert the seed bit for bit to int32 + randn->Initialize(*static_cast( (void*)&seed) ); + + // Define the portion of the input to walk for this thread, using + // the CallCopyOutputRegionToInputRegion method allows for the input + // and output images to be different dimensions + InputImageRegionType inputRegionForThread; + this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread); + + // Define the iterators + ImageScanlineConstIterator inputIt(inputPtr, inputRegionForThread); + ImageScanlineIterator outputIt(outputPtr, outputRegionForThread); + + ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels() ); + + inputIt.GoToBegin(); + outputIt.GoToBegin(); + + while ( !inputIt.IsAtEnd() ) + { + while ( !inputIt.IsAtEndOfLine() ) + { + const double out = inputIt.Get() + m_Mean + m_StandardDeviation * randn->GetVariate(); + outputIt.Set( Self::ClampCast(out) ); + ++inputIt; + ++outputIt; + } + inputIt.NextLine(); + outputIt.NextLine(); + progress.CompletedPixel(); // potential exception thrown here + } +} + +template +void +AdditiveGaussianNoiseImageFilter +::PrintSelf(std::ostream& os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "Mean: " + << static_cast::PrintType>(m_Mean) + << std::endl; + os << indent << "StandardDeviation: " + << static_cast::PrintType>(m_StandardDeviation) + << std::endl; +} + +} /* namespace itk */ + +#endif // __itkAdditiveGaussianNoiseImageFilter_hxx diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,91 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkNoiseBaseImageFilter_h +#define __itkNoiseBaseImageFilter_h + +#include "itkInPlaceImageFilter.h" +#include + +namespace itk +{ + +/** \class NoiseBaseImageFilter + * + * \brief An Abstract Base class for Noise image filters + * + * This class add common methods for setting a seed for the random + * generators used to generate the noise. + * + * \sa InPlaceImageFilter + * \ingroup ITKImageNoise + */ +template +class NoiseBaseImageFilter : + public InPlaceImageFilter +{ +public: + /** Standard class typedefs. */ + typedef NoiseBaseImageFilter Self; + typedef InPlaceImageFilter Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + typedef typename Superclass::OutputImagePixelType OutputImagePixelType; + + /** Run-time type information (and related methods). */ + itkTypeMacro(NoiseBaseImageFilter, InPlaceImageFilter); + + /** Seed for random initialization */ + itkGetConstMacro(Seed, uint32_t); + itkSetMacro(Seed, uint32_t); + + /** Set the seed to a value initialized with the current time and + * process clock. */ + virtual void SetSeed(); + +protected: + NoiseBaseImageFilter(); + + virtual ~NoiseBaseImageFilter() = 0; + + void PrintSelf(std::ostream &os, Indent indent) const; + + inline static uint32_t Hash(uint32_t a, uint32_t b) + { + // Knuth's Multiplicative Method for hashing + return (a+b)*2654435761u; + } + + // Clamp and round the input value to the output + static OutputImagePixelType ClampCast(const double &value); + +private: + NoiseBaseImageFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + uint32_t m_Seed; + +}; + +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkNoiseBaseImageFilter.hxx" +#endif + +#endif // __itkNoiseBaseImageFilter_h diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkNoiseBaseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,89 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkNoiseBaseImageFilter_hxx +#define __itkNoiseBaseImageFilter_hxx + +#include "itkNoiseBaseImageFilter.h" +#include + +namespace itk +{ + +template +NoiseBaseImageFilter +::NoiseBaseImageFilter() + : m_Seed(0) +{ + Self::SetSeed(); + + this->InPlaceOff(); +} + +template +NoiseBaseImageFilter +::~NoiseBaseImageFilter() +{ +} + +template +void +NoiseBaseImageFilter +::SetSeed() +{ + time_t t; + + time(&t); + this->SetSeed(Hash(t,clock() ) ); +} + +template +typename NoiseBaseImageFilter::OutputImagePixelType +NoiseBaseImageFilter +::ClampCast(const double &value) +{ + if (value >= (double)NumericTraits::max() ) + { + return NumericTraits::max(); + } + else if(value <= (double)NumericTraits::NonpositiveMin() ) + { + return NumericTraits::NonpositiveMin(); + } + else if (NumericTraits::is_integer) + { + return Math::Round(value); + } + else + { + return static_cast(value); + } +} + +template +void +NoiseBaseImageFilter +::PrintSelf(std::ostream &os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "Seed: " << static_cast::PrintType>(m_Seed) << std::endl; +} + +} + +#endif // __itkNoiseBaseImageFilter_hxx diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,106 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#ifndef __itkSaltAndPepperNoiseImageFilter_h +#define __itkSaltAndPepperNoiseImageFilter_h + +#include "itkNoiseBaseImageFilter.h" + +namespace itk +{ + +/** \class SaltAndPepperNoiseImageFilter + * + * \brief Alter an image with fixed value impulse noise, often called salt and pepper noise. + * + * Pixel alteration occurs at a user defined probability. + * Salt and pepper pixel are equally distributed. + * + * \author Gaetan Lehmann + * + * This code was contributed in the Insight Journal paper "Noise + * Simulation". http://hdl.handle.net/10380/3158 + * + * \ingroup ITKImageNoise + */ +template +class SaltAndPepperNoiseImageFilter : + public NoiseBaseImageFilter +{ +public: + /** Standard class typedefs. */ + typedef SaltAndPepperNoiseImageFilter Self; + typedef NoiseBaseImageFilter< TInputImage,TOutputImage > Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(SaltAndPepperNoiseImageFilter, NoiseBaseImageFilter); + + /** Superclass typedefs. */ + typedef typename Superclass::OutputImageType OutputImageType; + typedef typename Superclass::OutputImagePointer OutputImagePointer; + typedef typename Superclass::OutputImageRegionType OutputImageRegionType; + typedef typename Superclass::OutputImagePixelType OutputImagePixelType; + + /** Some convenient typedefs. */ + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef typename InputImageType::ConstPointer InputImageConstPointer; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename InputImageType::PixelType InputImagePixelType; + + itkGetConstMacro(Probability, double); + itkSetMacro(Probability, double); + +#ifdef ITK_USE_CONCEPT_CHECKING + /** Begin concept checking */ + itkConceptMacro(InputConvertibleToOutputCheck, + (Concept::Convertible) ); + /** End concept checking */ +#endif + +protected: + SaltAndPepperNoiseImageFilter(); + virtual ~SaltAndPepperNoiseImageFilter() { + } + + void PrintSelf(std::ostream &os, Indent indent) const; + + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, + ThreadIdType threadId ); + +private: + SaltAndPepperNoiseImageFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + double m_Probability; + +}; + +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkSaltAndPepperNoiseImageFilter.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSaltAndPepperNoiseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,111 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkSaltAndPepperNoiseImageFilter_hxx +#define __itkSaltAndPepperNoiseImageFilter_hxx + +#include "itkSaltAndPepperNoiseImageFilter.h" +#include "itkMersenneTwisterRandomVariateGenerator.h" +#include "itkImageScanlineIterator.h" +#include "itkProgressReporter.h" + +namespace itk +{ + +template +SaltAndPepperNoiseImageFilter +::SaltAndPepperNoiseImageFilter() +{ + m_Probability = 0.01; +} + +template +void +SaltAndPepperNoiseImageFilter +::ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) +{ + const InputImageType* inputPtr = this->GetInput(); + OutputImageType* outputPtr = this->GetOutput(0); + + // create a random generator per thread + typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer rand = + Statistics::MersenneTwisterRandomVariateGenerator::New(); + const uint32_t seed = Self::Hash(this->GetSeed(),threadId); + rand->Initialize(seed); + + // Define the portion of the input to walk for this thread, using + // the CallCopyOutputRegionToInputRegion method allows for the input + // and output images to be different dimensions + InputImageRegionType inputRegionForThread; + this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread); + + // Define the iterators + ImageScanlineConstIterator inputIt(inputPtr, inputRegionForThread); + ImageScanlineIterator outputIt(outputPtr, outputRegionForThread); + + ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels() ); + + inputIt.GoToBegin(); + outputIt.GoToBegin(); + + while ( !inputIt.IsAtEnd() ) + { + while ( !inputIt.IsAtEndOfLine() ) + { + if( rand->GetVariate() < m_Probability ) + { + if( rand->GetVariate() < 0.5 ) + { + // salt + outputIt.Set( NumericTraits::max() ); + } + else + { + // pepper + outputIt.Set( NumericTraits::NonpositiveMin() ); + } + } + else + { + // keep the data unchanged + outputIt.Set( (OutputImagePixelType) inputIt.Get() ); + } + ++inputIt; + ++outputIt; + } + inputIt.NextLine(); + outputIt.NextLine(); + progress.CompletedPixel(); // potential exception thrown here + } +} + +template +void +SaltAndPepperNoiseImageFilter +::PrintSelf(std::ostream& os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "Probability: " + << static_cast::PrintType>(this->GetProbability() ) + << std::endl; +} + +} /* namespace itk */ + +#endif // __itkSaltAndPepperNoiseImageFilter_hxx diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,109 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkShotNoiseImageFilter_h +#define __itkShotNoiseImageFilter_h + +#include "itkNoiseBaseImageFilter.h" + +namespace itk +{ + +/** \class ShotNoiseImageFilter + * + * \brief Alter an image with shot noise. + * + * The shot noise follows a Poisson distribution. + * + * \author Gaetan Lehmann + * + * This code was contributed in the Insight Journal paper "Noise + * Simulation". http://hdl.handle.net/10380/3158 + * + * \ingroup ITKImageNoise + */ +template +class ShotNoiseImageFilter : + public NoiseBaseImageFilter +{ +public: + /** Standard class typedefs. */ + typedef ShotNoiseImageFilter Self; + typedef NoiseBaseImageFilter< TInputImage,TOutputImage > Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(ShotNoiseImageFilter, NoiseBaseImageFilter); + + /** Superclass typedefs. */ + typedef typename Superclass::OutputImageType OutputImageType; + typedef typename Superclass::OutputImagePointer OutputImagePointer; + typedef typename Superclass::OutputImageRegionType OutputImageRegionType; + typedef typename Superclass::OutputImagePixelType OutputImagePixelType; + + /** Some convenient typedefs. */ + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef typename InputImageType::ConstPointer InputImageConstPointer; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename InputImageType::PixelType InputImagePixelType; + + /** \brief a value to map the pixel value to the actual number of photon. + * + * This value defaults to 1.0. The scaling can be seen as the + * inverse of the gain used during the acquisition. The noisy signal + * is then scaled back to its input intensity range. + */ + itkGetConstMacro(Scale, double); + itkSetMacro(Scale, double); + +#ifdef ITK_USE_CONCEPT_CHECKING + /** Begin concept checking */ + itkConceptMacro(InputConvertibleToOutputCheck, + (Concept::Convertible) ); + /** End concept checking */ +#endif + +protected: + ShotNoiseImageFilter(); + virtual ~ShotNoiseImageFilter() { + } + + void PrintSelf(std::ostream &os, Indent indent) const; + + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId ); + +private: + ShotNoiseImageFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + double m_Scale; + +}; + +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkShotNoiseImageFilter.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkShotNoiseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,123 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkShotNoiseImageFilter_hxx +#define __itkShotNoiseImageFilter_hxx + +#include "itkShotNoiseImageFilter.h" +#include "itkMersenneTwisterRandomVariateGenerator.h" +#include "itkImageScanlineIterator.h" +#include "itkProgressReporter.h" +#include "itkNormalVariateGenerator.h" + +namespace itk +{ + +template +ShotNoiseImageFilter +::ShotNoiseImageFilter() + : m_Scale(1.0) +{ +} + +template +void +ShotNoiseImageFilter +::ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) +{ + const InputImageType* inputPtr = this->GetInput(); + OutputImageType* outputPtr = this->GetOutput(0); + + // create a random generator per thread + typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer rand = + Statistics::MersenneTwisterRandomVariateGenerator::New(); + const uint32_t seed = Self::Hash(this->GetSeed(),threadId); + rand->Initialize(seed); + typename Statistics::NormalVariateGenerator::Pointer randn = Statistics::NormalVariateGenerator::New(); + randn->Initialize(*static_cast( (void*)&seed) ); + + // Define the portion of the input to walk for this thread, using + // the CallCopyOutputRegionToInputRegion method allows for the input + // and output images to be different dimensions + InputImageRegionType inputRegionForThread; + this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread); + + // Define the iterators + ImageScanlineConstIterator inputIt(inputPtr, inputRegionForThread); + ImageScanlineIterator outputIt(outputPtr, outputRegionForThread); + + ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels() ); + + inputIt.GoToBegin(); + outputIt.GoToBegin(); + + while ( !inputIt.IsAtEnd() ) + { + while ( !inputIt.IsAtEndOfLine() ) + { + const double in = m_Scale * inputIt.Get(); + + // The value of >=50, is the lambda value in a Poisson + // distribution where a Gaussian distribution make a "good" + // approximation of the Poisson. This could be considered to be + // exposed as an advance parameter in the future. + if( in < 50 ) + { + const double L = std::exp( -in ); + long k = 0; + double p = 1.0; + + do + { + k += 1; + p *= rand->GetVariate(); + } + while( p > L ); + + // clip the output to the actual supported range + outputIt.Set( Self::ClampCast( (k-1)/m_Scale ) ); + } + else + { + const double out = in + std::sqrt( in ) * randn->GetVariate(); + outputIt.Set( Self::ClampCast( out/m_Scale ) ); + } + ++inputIt; + ++outputIt; + } + inputIt.NextLine(); + outputIt.NextLine(); + progress.CompletedPixel(); // potential exception thrown here + } +} + +template +void +ShotNoiseImageFilter +::PrintSelf(std::ostream& os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "Scale: " + << static_cast::PrintType>(this->GetScale() ) + << std::endl; +} + +} /* namespace itk */ + +#endif // __itkShotNoiseImageFilter_hxx diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,105 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#ifndef __itkSpeckleNoiseImageFilter_h +#define __itkSpeckleNoiseImageFilter_h + +#include "itkNoiseBaseImageFilter.h" + +namespace itk +{ + +/** \class SpeckleNoiseImageFilter + * + * \brief Alter an image with speckle (multiplicative) noise. + * + * The speckle noise follows a Gamma distribution of mean 1 and standard deviation + * provided by the user. The noise is proportional to the pixel intensity. + * + * \author Gaetan Lehmann + * + * This code was contributed in the Insight Journal paper "Noise + * Simulation". http://hdl.handle.net/10380/3158 + * + * \ingroup ITKImageNoise + */ +template +class SpeckleNoiseImageFilter : + public NoiseBaseImageFilter +{ +public: + /** Standard class typedefs. */ + typedef SpeckleNoiseImageFilter Self; + typedef NoiseBaseImageFilter< TInputImage,TOutputImage > Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(SpeckleNoiseImageFilter, NoiseBaseImageFilter); + + /** Superclass typedefs. */ + typedef typename Superclass::OutputImageType OutputImageType; + typedef typename Superclass::OutputImagePointer OutputImagePointer; + typedef typename Superclass::OutputImageRegionType OutputImageRegionType; + typedef typename Superclass::OutputImagePixelType OutputImagePixelType; + + /** Some convenient typedefs. */ + typedef TInputImage InputImageType; + typedef typename InputImageType::Pointer InputImagePointer; + typedef typename InputImageType::ConstPointer InputImageConstPointer; + typedef typename InputImageType::RegionType InputImageRegionType; + typedef typename InputImageType::PixelType InputImagePixelType; + + itkGetConstMacro(StandardDeviation, double); + itkSetMacro(StandardDeviation, double); + +#ifdef ITK_USE_CONCEPT_CHECKING + /** Begin concept checking */ + itkConceptMacro(InputConvertibleToOutputCheck, + (Concept::Convertible) ); + /** End concept checking */ +#endif + +protected: + SpeckleNoiseImageFilter(); + virtual ~SpeckleNoiseImageFilter() { + } + + void PrintSelf(std::ostream &os, Indent indent) const; + + void ThreadedGenerateData(const OutputImageRegionType& outputRegionForThread, ThreadIdType threadId ); + +private: + SpeckleNoiseImageFilter(const Self&); //purposely not implemented + void operator=(const Self&); //purposely not implemented + + double m_StandardDeviation; + +}; + +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkSpeckleNoiseImageFilter.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/include/itkSpeckleNoiseImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,134 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#ifndef __itkSpeckleNoiseImageFilter_hxx +#define __itkSpeckleNoiseImageFilter_hxx + +#include "itkSpeckleNoiseImageFilter.h" +#include "itkMersenneTwisterRandomVariateGenerator.h" +#include "itkImageScanlineIterator.h" +#include "itkProgressReporter.h" + +namespace itk +{ + +template +SpeckleNoiseImageFilter +::SpeckleNoiseImageFilter() +{ + m_StandardDeviation = 1.0; +} + +template +void +SpeckleNoiseImageFilter +::ThreadedGenerateData( const OutputImageRegionType &outputRegionForThread, ThreadIdType threadId) +{ + const InputImageType* inputPtr = this->GetInput(); + OutputImageType* outputPtr = this->GetOutput(0); + + // create a random generator per thread + typename Statistics::MersenneTwisterRandomVariateGenerator::Pointer rand = + Statistics::MersenneTwisterRandomVariateGenerator::New(); + const uint32_t seed = Self::Hash(this->GetSeed(),threadId); + rand->Initialize(seed); + + // Define the portion of the input to walk for this thread, using + // the CallCopyOutputRegionToInputRegion method allows for the input + // and output images to be different dimensions + InputImageRegionType inputRegionForThread; + this->CallCopyOutputRegionToInputRegion(inputRegionForThread, outputRegionForThread); + + // Define the iterators + ImageScanlineConstIterator inputIt(inputPtr, inputRegionForThread); + ImageScanlineIterator outputIt(outputPtr, outputRegionForThread); + + ProgressReporter progress(this, threadId, outputRegionForThread.GetNumberOfPixels() ); + + inputIt.GoToBegin(); + outputIt.GoToBegin(); + + // choose the value of the gamma distribution so that the mean is 1 and the + // variance depend + // on m_StandardDeviation + const double theta = m_StandardDeviation * m_StandardDeviation; + const double k = 1 / theta; + + const double floork = Math::Floor( k ); + const double delta = k - floork; + const double v0 = Math::e / ( Math::e + delta ); + + while ( !inputIt.IsAtEnd() ) + { + while ( !inputIt.IsAtEndOfLine() ) + { + // first generate the gamma distributed random variable + // ref http://en.wikipedia.org/wiki/Gamma_distribution#Generating_gamma-distributed_random_variables + double xi; + double nu; + do + { + const double v1 = 1.0 - rand->GetVariateWithOpenUpperRange(); // open *lower* range -- (0,1] + const double v2 = 1.0 - rand->GetVariateWithOpenUpperRange(); + const double v3 = 1.0 - rand->GetVariateWithOpenUpperRange(); + if( v1 <= v0 ) + { + xi = std::pow( v2, 1 / delta ); + nu = v3 * std::pow( xi, delta - 1.0 ); + } + else + { + xi = 1.0 - std::log( v2 ); + nu = v3 * std::exp( -xi ); + } + } + while( nu > std::exp( -xi ) * std::pow( xi, delta - 1.0 ) ); + double gamma = xi; + for( int i=0; iGetVariateWithOpenUpperRange() ); + } + gamma *= theta; + // ok, so now apply multiplicative noise + const double out = gamma * inputIt.Get(); + outputIt.Set( Self::ClampCast( out ) ); + ++inputIt; + ++outputIt; + } + inputIt.NextLine(); + outputIt.NextLine(); + progress.CompletedPixel(); // potential exception thrown here + } +} + +template +void +SpeckleNoiseImageFilter +::PrintSelf(std::ostream& os, + Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "StandardDeviation: " + << static_cast::PrintType>(this->GetStandardDeviation() ) + << std::endl; +} + +} /* namespace itk */ + +#endif // __itkSpeckleNoiseImageFilter_hxx diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/itk-module.cmake otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/itk-module.cmake --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/itk-module.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/itk-module.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,13 @@ +set(DOCUMENTATION "This module con stains classes to simulate and +evaluate noise. The classes were originally contributed via the +Insight Journal (http://hdl.handle.net/10380/3158).") + +itk_module(ITKImageNoise + DEPENDS + ITKImageFilterBase + ITKStatistics + TEST_DEPENDS + ITKTestKernel + DESCRIPTION + "${DOCUMENTATION}" +) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkAdditiveGaussianNoiseImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkAdditiveGaussianNoiseImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkAdditiveGaussianNoiseImageFilter.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkAdditiveGaussianNoiseImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,3 @@ +wrap_class("itk::AdditiveGaussianNoiseImageFilter" POINTER) + wrap_image_filter_scalar(2) +end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkPeakSignalToNoiseRatioCalculator.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkPeakSignalToNoiseRatioCalculator.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkPeakSignalToNoiseRatioCalculator.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkPeakSignalToNoiseRatioCalculator.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,3 @@ +wrap_class("itk::PeakSignalToNoiseRatioCalculator" POINTER) + wrap_image_filter_scalar(1) +end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSaltAndPepperNoiseImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSaltAndPepperNoiseImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSaltAndPepperNoiseImageFilter.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSaltAndPepperNoiseImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,3 @@ +wrap_class("itk::SaltAndPepperNoiseImageFilter" POINTER) + wrap_image_filter_scalar(2) +end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkShotNoiseImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkShotNoiseImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkShotNoiseImageFilter.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkShotNoiseImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,3 @@ +wrap_class("itk::ShotNoiseImageFilter" POINTER) + wrap_image_filter_scalar(2) +end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSpeckleNoiseImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSpeckleNoiseImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSpeckleNoiseImageFilter.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageNoise/wrapping/itkSpeckleNoiseImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,3 @@ +wrap_class("itk::SpeckleNoiseImageFilter" POINTER) + wrap_image_filter_scalar(2) +end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborImageSource.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborImageSource.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborImageSource.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborImageSource.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -80,7 +80,7 @@ { sum += vnl_math_sqr( ( evalPoint[i] - this->m_Mean[i] ) / this->m_Sigma[i] ); } - double value = vcl_exp(-0.5 * sum) * gabor->Evaluate(evalPoint[0] - this->m_Mean[0]); + double value = std::exp(-0.5 * sum) * gabor->Evaluate(evalPoint[0] - this->m_Mean[0]); // Set the pixel value to the function value outIt.Set( static_cast< PixelType >( value ) ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborKernelFunction.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborKernelFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborKernelFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaborKernelFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -65,17 +65,17 @@ inline TRealValueType Evaluate(const TRealValueType & u) const { TRealValueType parameter = vnl_math_sqr(u / this->m_Sigma); - TRealValueType envelope = vcl_exp(static_cast< TRealValueType >(-0.5) * parameter); + TRealValueType envelope = std::exp(static_cast< TRealValueType >(-0.5) * parameter); TRealValueType phase = static_cast< TRealValueType >(2.0 * vnl_math::pi) * this->m_Frequency * u + this->m_PhaseOffset; if ( this->m_CalculateImaginaryPart ) { - return envelope * vcl_sin(phase); + return envelope * std::sin(phase); } else { - return envelope * vcl_cos(phase); + return envelope * std::cos(phase); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaussianImageSource.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaussianImageSource.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaussianImageSource.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageSources/include/itkGaussianImageSource.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,6 @@ // Create and initialize a new gaussian function typedef itk::GaussianSpatialFunction< double, NDimensions > FunctionType; - typedef typename FunctionType::InputType FunctionPositionType; typename FunctionType::Pointer pGaussian = FunctionType::New(); pGaussian->SetSigma(m_Sigma); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkAdaptiveHistogramEqualizationImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkAdaptiveHistogramEqualizationImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkAdaptiveHistogramEqualizationImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkAdaptiveHistogramEqualizationImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -42,7 +42,7 @@ s = vnl_math_sgn(u - v); ad = vnl_math_abs( 2.0 * ( u - v ) ); - return 0.5 *s *vcl_pow(ad, m_Alpha) - m_Beta * 0.5 * s * ad + m_Beta * u; + return 0.5 *s *std::pow(ad, m_Alpha) - m_Beta * 0.5 * s * ad + m_Beta * u; } template< typename TImageType > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ protected: HistogramAlgorithmBase(); virtual ~HistogramAlgorithmBase() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; virtual void Compute() = 0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkHistogramAlgorithmBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ HistogramAlgorithmBase< TInputHistogram > ::HistogramAlgorithmBase() { - m_InputHistogram = 0; + m_InputHistogram = ITK_NULLPTR; } template< typename TInputHistogram > @@ -36,15 +36,8 @@ { Superclass::PrintSelf(os, indent); - os << indent << "Input Histogram: "; - if ( m_InputHistogram.IsNotNull() ) - { - os << m_InputHistogram << std::endl; - } - else - { - os << "not set." << std::endl; - } + itkPrintSelfObjectMacro(InputHistogram); + } } // end of namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -202,7 +202,7 @@ protected: ImageMomentsCalculator(); virtual ~ImageMomentsCalculator(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: ImageMomentsCalculator(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImageMomentsCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -53,8 +53,8 @@ ImageMomentsCalculator< TImage >::ImageMomentsCalculator(void) { m_Valid = false; - m_Image = NULL; - m_SpatialObjectMask = NULL; + m_Image = ITK_NULLPTR; + m_SpatialObjectMask = ITK_NULLPTR; m_M0 = NumericTraits< ScalarType >::Zero; m_M1.Fill(NumericTraits< typename VectorType::ValueType >::Zero); m_M2.Fill(NumericTraits< typename MatrixType::ValueType >::Zero); @@ -183,7 +183,7 @@ vnl_diag_matrix< double > pm = eigen.D; for ( unsigned int i = 0; i < ImageDimension; i++ ) { - m_Pm[i] = pm(i, i) * m_M0; + m_Pm[i] = pm(i) * m_M0; } m_Pa = eigen.V.transpose(); @@ -195,7 +195,7 @@ for ( unsigned int i = 0; i < ImageDimension; i++ ) { - det *= eigenval(i, i); + det *= eigenval(i); } for ( unsigned int i = 0; i < ImageDimension; i++ ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -129,7 +129,7 @@ protected: ImagePCADecompositionCalculator(); virtual ~ImagePCADecompositionCalculator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void CalculateBasisMatrix(void); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkImagePCADecompositionCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,8 +30,8 @@ ImagePCADecompositionCalculator< TInputImage, TBasisImage > ::ImagePCADecompositionCalculator() { - m_Image = NULL; - m_MeanImage = NULL; + m_Image = ITK_NULLPTR; + m_MeanImage = ITK_NULLPTR; m_BasisMatrixCalculated = false; m_NumPixels = 0; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -196,9 +196,6 @@ /** Multi-thread version GenerateData. */ void ThreadedGenerateData( const RegionType&, ThreadIdType ); - // Override since the filter needs all the data for the algorithm - void GenerateInputRequestedRegion(); - // Override since the filter produces all of its output void EnlargeOutputRequestedRegion( DataObject *data ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelOverlapMeasuresImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,26 +36,6 @@ template void LabelOverlapMeasuresImageFilter -::GenerateInputRequestedRegion() -{ - Superclass::GenerateInputRequestedRegion(); - if( this->GetSourceImage() ) - { - LabelImagePointer source = const_cast - ( this->GetSourceImage() ); - source->SetRequestedRegionToLargestPossibleRegion(); - } - if( this->GetTargetImage() ) - { - LabelImagePointer target = const_cast - ( this->GetTargetImage() ); - target->SetRequestedRegionToLargestPossibleRegion(); - } -} - -template -void -LabelOverlapMeasuresImageFilter ::EnlargeOutputRequestedRegion( DataObject *data ) { Superclass::EnlargeOutputRequestedRegion( data ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -140,7 +140,7 @@ m_BoundingBox[i] = NumericTraits< IndexValueType >::max(); m_BoundingBox[i + 1] = NumericTraits< IndexValueType >::NonpositiveMin(); } - m_Histogram = 0; + m_Histogram = ITK_NULLPTR; } // constructor with histogram enabled @@ -346,9 +346,6 @@ outputRegionForThread, ThreadIdType threadId); - // Override since the filter needs all the data for the algorithm - void GenerateInputRequestedRegion(); - // Override since the filter produces all of its output void EnlargeOutputRequestedRegion(DataObject *data); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkLabelStatisticsImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -19,8 +19,8 @@ #define __itkLabelStatisticsImageFilter_hxx #include "itkLabelStatisticsImageFilter.h" -#include "itkImageRegionIterator.h" -#include "itkImageRegionConstIteratorWithIndex.h" +#include "itkImageLinearConstIteratorWithIndex.h" +#include "itkImageScanlineConstIterator.h" #include "itkProgressReporter.h" namespace itk @@ -41,29 +41,6 @@ template< typename TInputImage, typename TLabelImage > void LabelStatisticsImageFilter< TInputImage, TLabelImage > -::GenerateInputRequestedRegion() -{ - Superclass::GenerateInputRequestedRegion(); - if ( this->GetInput() ) - { - InputImagePointer image = - const_cast< typename Superclass::InputImageType * >( this->GetInput() ); - if ( image ) - { - image->SetRequestedRegionToLargestPossibleRegion(); - } - } - if ( this->GetLabelInput() ) - { - LabelImagePointer label = - const_cast< TLabelImage * >( this->GetLabelInput() ); - label->SetRequestedRegionToLargestPossibleRegion(); - } -} - -template< typename TInputImage, typename TLabelImage > -void -LabelStatisticsImageFilter< TInputImage, TLabelImage > ::EnlargeOutputRequestedRegion(DataObject *data) { Superclass::EnlargeOutputRequestedRegion(data); @@ -153,31 +130,34 @@ } } + + typename MapType::mapped_type &labelStats = ( *mapIt ).second; + // accumulate the information from this thread - ( *mapIt ).second.m_Count += ( *threadIt ).second.m_Count; - ( *mapIt ).second.m_Sum += ( *threadIt ).second.m_Sum; - ( *mapIt ).second.m_SumOfSquares += ( *threadIt ).second.m_SumOfSquares; + labelStats.m_Count += ( *threadIt ).second.m_Count; + labelStats.m_Sum += ( *threadIt ).second.m_Sum; + labelStats.m_SumOfSquares += ( *threadIt ).second.m_SumOfSquares; - if ( ( *mapIt ).second.m_Minimum > ( *threadIt ).second.m_Minimum ) + if ( labelStats.m_Minimum > ( *threadIt ).second.m_Minimum ) { - ( *mapIt ).second.m_Minimum = ( *threadIt ).second.m_Minimum; + labelStats.m_Minimum = ( *threadIt ).second.m_Minimum; } - if ( ( *mapIt ).second.m_Maximum < ( *threadIt ).second.m_Maximum ) + if ( labelStats.m_Maximum < ( *threadIt ).second.m_Maximum ) { - ( *mapIt ).second.m_Maximum = ( *threadIt ).second.m_Maximum; + labelStats.m_Maximum = ( *threadIt ).second.m_Maximum; } //bounding box is min,max pairs - int dimension = ( *mapIt ).second.m_BoundingBox.size() / 2; + int dimension = labelStats.m_BoundingBox.size() / 2; for ( int ii = 0; ii < ( dimension * 2 ); ii += 2 ) { - if ( ( *mapIt ).second.m_BoundingBox[ii] > ( *threadIt ).second.m_BoundingBox[ii] ) + if ( labelStats.m_BoundingBox[ii] > ( *threadIt ).second.m_BoundingBox[ii] ) { - ( *mapIt ).second.m_BoundingBox[ii] = ( *threadIt ).second.m_BoundingBox[ii]; + labelStats.m_BoundingBox[ii] = ( *threadIt ).second.m_BoundingBox[ii]; } - if ( ( *mapIt ).second.m_BoundingBox[ii + 1] < ( *threadIt ).second.m_BoundingBox[ii + 1] ) + if ( labelStats.m_BoundingBox[ii + 1] < ( *threadIt ).second.m_BoundingBox[ii + 1] ) { - ( *mapIt ).second.m_BoundingBox[ii + 1] = ( *threadIt ).second.m_BoundingBox[ii + 1]; + labelStats.m_BoundingBox[ii + 1] = ( *threadIt ).second.m_BoundingBox[ii + 1]; } } @@ -189,7 +169,7 @@ for ( unsigned int bin = 0; bin < m_NumBins[0]; bin++ ) { index[0] = bin; - ( *mapIt ).second.m_Histogram->IncreaseFrequency( bin, ( *threadIt ).second.m_Histogram->GetFrequency(bin) ); + labelStats.m_Histogram->IncreaseFrequency( bin, ( *threadIt ).second.m_Histogram->GetFrequency(bin) ); } } } // end of thread map iterator loop @@ -200,12 +180,14 @@ mapIt != m_LabelStatistics.end(); ++mapIt ) { + typename MapType::mapped_type &labelStats = ( *mapIt ).second; + // mean - ( *mapIt ).second.m_Mean = ( *mapIt ).second.m_Sum - / static_cast< RealType >( ( *mapIt ).second.m_Count ); + labelStats.m_Mean = labelStats.m_Sum + / static_cast< RealType >( labelStats.m_Count ); // variance - if ( ( *mapIt ).second.m_Count > 1 ) + if ( labelStats.m_Count > 1 ) { // unbiased estimate of variance LabelStatistics & ls = mapIt->second; @@ -216,11 +198,11 @@ } else { - ( *mapIt ).second.m_Variance = NumericTraits< RealType >::Zero; + labelStats.m_Variance = NumericTraits< RealType >::Zero; } // sigma - ( *mapIt ).second.m_Sigma = vcl_sqrt( ( *mapIt ).second.m_Variance ); + labelStats.m_Sigma = std::sqrt( labelStats.m_Variance ); } { @@ -242,85 +224,103 @@ ::ThreadedGenerateData(const RegionType & outputRegionForThread, ThreadIdType threadId) { - RealType value; - LabelPixelType label; - ImageRegionConstIteratorWithIndex< TInputImage > it (this->GetInput(), + typename HistogramType::IndexType histogramIndex(1); + typename HistogramType::MeasurementVectorType histogramMeasurement(1); + + const SizeValueType size0 = outputRegionForThread.GetSize(0); + if( size0 == 0) + { + return; + } + + ImageLinearConstIteratorWithIndex< TInputImage > it (this->GetInput(), outputRegionForThread); - ImageRegionConstIterator< TLabelImage > labelIt (this->GetLabelInput(), - outputRegionForThread); + + ImageScanlineConstIterator< TLabelImage > labelIt (this->GetLabelInput(), + outputRegionForThread); + MapIterator mapIt; // support progress methods/callbacks - ProgressReporter progress( this, threadId, - outputRegionForThread.GetNumberOfPixels() ); + const size_t numberOfLinesToProcess = outputRegionForThread.GetNumberOfPixels() / size0; + ProgressReporter progress( this, threadId, numberOfLinesToProcess ); // do the work while ( !it.IsAtEnd() ) { - value = static_cast< RealType >( it.Get() ); - label = labelIt.Get(); - - // is the label already in this thread? - mapIt = m_LabelStatisticsPerThread[threadId].find(label); - if ( mapIt == m_LabelStatisticsPerThread[threadId].end() ) + while ( !it.IsAtEndOfLine() ) { - // create a new statistics object - typedef typename MapType::value_type MapValueType; - if ( m_UseHistograms ) + const RealType & value = static_cast< RealType >( it.Get() ); + + const LabelPixelType & label = labelIt.Get(); + + // is the label already in this thread? + mapIt = m_LabelStatisticsPerThread[threadId].find(label); + if ( mapIt == m_LabelStatisticsPerThread[threadId].end() ) + { + // create a new statistics object + typedef typename MapType::value_type MapValueType; + if ( m_UseHistograms ) + { + mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label, + LabelStatistics(m_NumBins[0], m_LowerBound, + m_UpperBound) ) ).first; + } + else + { + mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label, + LabelStatistics() ) ).first; + } + } + + typename MapType::mapped_type &labelStats = ( *mapIt ).second; + + // update the values for this label and this thread + if ( value < labelStats.m_Minimum ) { - mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label, - LabelStatistics(m_NumBins[0], m_LowerBound, - m_UpperBound) ) ).first; + labelStats.m_Minimum = value; } - else + if ( value > labelStats.m_Maximum ) { - mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label, - LabelStatistics() ) ).first; + labelStats.m_Maximum = value; } - } - - // update the values for this label and this thread - if ( value < ( *mapIt ).second.m_Minimum ) - { - ( *mapIt ).second.m_Minimum = value; - } - if ( value > ( *mapIt ).second.m_Maximum ) - { - ( *mapIt ).second.m_Maximum = value; - } - // bounding box is min,max pairs - for ( unsigned int i = 0; i < ( 2 * it.GetImageDimension() ); i += 2 ) - { - typename ImageRegionConstIteratorWithIndex< TInputImage >::IndexType index = it.GetIndex(); - if ( ( *mapIt ).second.m_BoundingBox[i] > index[i / 2] ) + // bounding box is min,max pairs + for ( unsigned int i = 0; i < ( 2 * TInputImage::ImageDimension ); i += 2 ) { - ( *mapIt ).second.m_BoundingBox[i] = index[i / 2]; + const IndexType & index = it.GetIndex(); + if ( labelStats.m_BoundingBox[i] > index[i / 2] ) + { + labelStats.m_BoundingBox[i] = index[i / 2]; + } + if ( labelStats.m_BoundingBox[i + 1] < index[i / 2] ) + { + labelStats.m_BoundingBox[i + 1] = index[i / 2]; + } } - if ( ( *mapIt ).second.m_BoundingBox[i + 1] < index[i / 2] ) + + labelStats.m_Sum += value; + labelStats.m_SumOfSquares += ( value * value ); + labelStats.m_Count++; + + // if enabled, update the histogram for this label + if ( m_UseHistograms ) { - ( *mapIt ).second.m_BoundingBox[i + 1] = index[i / 2]; + histogramMeasurement[0] = value; + labelStats.m_Histogram->GetIndex(histogramMeasurement, histogramIndex); + labelStats.m_Histogram->IncreaseFrequencyOfIndex(histogramIndex, 1); } - } - ( *mapIt ).second.m_Sum += value; - ( *mapIt ).second.m_SumOfSquares += ( value * value ); - ( *mapIt ).second.m_Count++; - // if enabled, update the histogram for this label - if ( m_UseHistograms ) - { - typename HistogramType::MeasurementVectorType meas; - meas.SetSize(1); - meas[0] = value; - ( *mapIt ).second.m_Histogram->IncreaseFrequencyOfMeasurement(meas, 1); + ++labelIt; + ++it; } - - ++it; - ++labelIt; + labelIt.NextLine(); + it.NextLine(); progress.CompletedPixel(); } + } template< typename TInputImage, typename TLabelImage > @@ -563,7 +563,7 @@ if ( mapIt == m_LabelStatistics.end() ) { // label does not exist, return a default value - return 0; + return ITK_NULLPTR; } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStandardDeviationProjectionImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,7 @@ { squaredSum += vnl_math_sqr(*it - mean); } - return vcl_sqrt( squaredSum / ( m_Size - 1 ) ); + return std::sqrt( squaredSum / ( m_Size - 1 ) ); } TAccumulate m_Sum; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/ImageStatistics/include/itkStatisticsImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -287,7 +287,7 @@ // unbiased estimate variance = ( sumOfSquares - ( sum * sum / static_cast< RealType >( count ) ) ) / ( static_cast< RealType >( count ) - 1 ); - sigma = vcl_sqrt(variance); + sigma = std::sqrt(variance); // Set the outputs this->GetMinimumOutput()->Set(minimum); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkAttributeLabelObject.h otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkAttributeLabelObject.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkAttributeLabelObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkAttributeLabelObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -120,7 +120,7 @@ // copy the data of the current type if possible const Self * src = dynamic_cast( lo ); - if( src == NULL ) + if( src == ITK_NULLPTR ) { return; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryGrindPeakImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -81,7 +81,7 @@ labelizer->SetOutputBackgroundValue( m_BackgroundValue ); labelizer->SetFullyConnected( m_FullyConnected ); labelizer->SetNumberOfThreads( this->GetNumberOfThreads() ); - progress->RegisterInternalFilter(labelizer, .6f); + progress->RegisterInternalFilter(labelizer, .65f); typedef typename LabelizerType::OutputImageType LabelMapType; typedef typename itk::ShapeOpeningLabelMapFilter< LabelMapType > OpeningType; @@ -99,7 +99,7 @@ binarizer->SetBackgroundValue( m_BackgroundValue ); binarizer->SetBackgroundImage( this->GetInput() ); binarizer->SetNumberOfThreads( this->GetNumberOfThreads() ); - progress->RegisterInternalFilter(binarizer, .2f); + progress->RegisterInternalFilter(binarizer, .25f); binarizer->GraftOutput( this->GetOutput() ); binarizer->Update(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryImageToLabelMapFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryImageToLabelMapFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryImageToLabelMapFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryImageToLabelMapFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -368,7 +368,7 @@ } this->m_NumberOfLabels.clear(); - this->m_Barrier = NULL; + this->m_Barrier = ITK_NULLPTR; m_LineMap.clear(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryShapeKeepNObjectsImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryShapeKeepNObjectsImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryShapeKeepNObjectsImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryShapeKeepNObjectsImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,13 +25,14 @@ { template< typename TInputImage > BinaryShapeKeepNObjectsImageFilter< TInputImage > -::BinaryShapeKeepNObjectsImageFilter() +::BinaryShapeKeepNObjectsImageFilter() : + m_FullyConnected(false), + m_BackgroundValue(NumericTraits< OutputImagePixelType >::NonpositiveMin()), + m_ForegroundValue(NumericTraits< OutputImagePixelType >::max()), + m_NumberOfObjects(0), + m_ReverseOrdering(false), + m_Attribute(LabelObjectType::NUMBER_OF_PIXELS) { - m_BackgroundValue = NumericTraits< OutputImagePixelType >::NonpositiveMin(); - m_ForegroundValue = NumericTraits< OutputImagePixelType >::max(); - m_FullyConnected = false; - m_ReverseOrdering = false; - m_Attribute = LabelObjectType::NUMBER_OF_PIXELS; } template< typename TInputImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryStatisticsKeepNObjectsImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryStatisticsKeepNObjectsImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryStatisticsKeepNObjectsImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkBinaryStatisticsKeepNObjectsImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,13 +25,14 @@ { template< typename TInputImage, typename TFeatureImage > BinaryStatisticsKeepNObjectsImageFilter< TInputImage, TFeatureImage > -::BinaryStatisticsKeepNObjectsImageFilter() +::BinaryStatisticsKeepNObjectsImageFilter() : + m_FullyConnected(false), + m_BackgroundValue(NumericTraits< OutputImagePixelType >::NonpositiveMin()), + m_ForegroundValue(NumericTraits< OutputImagePixelType >::max()), + m_NumberOfObjects(0), + m_ReverseOrdering(false), + m_Attribute(LabelObjectType::MEAN) { - m_BackgroundValue = NumericTraits< OutputImagePixelType >::NonpositiveMin(); - m_ForegroundValue = NumericTraits< OutputImagePixelType >::max(); - m_FullyConnected = false; - m_ReverseOrdering = false; - m_Attribute = LabelObjectType::MEAN; this->SetNumberOfRequiredInputs(2); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.h otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.h 2014-09-03 08:29:34.000000000 +0000 @@ -136,7 +136,7 @@ virtual void Initialize(); /** */ - virtual void Allocate(); + virtual void Allocate(bool initialize = false) ITK_OVERRIDE; virtual void Graft(const DataObject *data); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMap.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,7 @@ template< typename TLabelObject > void LabelMap< TLabelObject > -::Allocate() +::Allocate(bool) { this->Initialize(); } @@ -86,37 +86,27 @@ LabelMap< TLabelObject > ::Graft(const DataObject *data) { + if(data == ITK_NULLPTR) + { + return; // nothing to do + } // call the superclass' implementation Superclass::Graft(data); - if ( data ) - { - // Attempt to cast data to an Image - const Self *imgData; - - try - { - imgData = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - return; - } + // Attempt to cast data to an Image + const Self *imgData = dynamic_cast< const Self * >( data ); - if ( imgData ) - { - // Now copy anything remaining that is needed - m_LabelObjectContainer = imgData->m_LabelObjectContainer; - m_BackgroundValue = imgData->m_BackgroundValue; - } - else - { - // pointer could not be cast back down - itkExceptionMacro( << "itk::Image::Graft() cannot cast " - << typeid( data ).name() << " to " - << typeid( const Self * ).name() ); - } + if ( imgData == ITK_NULLPTR ) + { + // pointer could not be cast back down + itkExceptionMacro( << "itk::Image::Graft() cannot cast " + << typeid( data ).name() << " to " + << typeid( const Self * ).name() ); } + + // Now copy anything remaining that is needed + m_LabelObjectContainer = imgData->m_LabelObjectContainer; + m_BackgroundValue = imgData->m_BackgroundValue; } template< typename TLabelObject > @@ -412,7 +402,7 @@ LabelMap< TLabelObject > ::AddLabelObject(LabelObjectType *labelObject) { - itkAssertOrThrowMacro( ( labelObject != NULL ), "Input LabelObject can't be Null" ); + itkAssertOrThrowMacro( ( labelObject != ITK_NULLPTR ), "Input LabelObject can't be Null" ); m_LabelObjectContainer[labelObject->GetLabel()] = labelObject; this->Modified(); @@ -423,7 +413,7 @@ LabelMap< TLabelObject > ::PushLabelObject(LabelObjectType *labelObject) { - itkAssertOrThrowMacro( ( labelObject != NULL ), "Input LabelObject can't be Null" ); + itkAssertOrThrowMacro( ( labelObject != ITK_NULLPTR ), "Input LabelObject can't be Null" ); if ( m_LabelObjectContainer.empty() ) { @@ -488,7 +478,7 @@ LabelMap< TLabelObject > ::RemoveLabelObject(LabelObjectType *labelObject) { - itkAssertOrThrowMacro( ( labelObject != NULL ), "Input LabelObject can't be Null" ); + itkAssertOrThrowMacro( ( labelObject != ITK_NULLPTR ), "Input LabelObject can't be Null" ); // modified is called in RemoveLabel() this->RemoveLabel( labelObject->GetLabel() ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMapToLabelImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMapToLabelImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMapToLabelImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelMapToLabelImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ LabelMapToLabelImageFilter< TInputImage, TOutputImage > ::LabelMapToLabelImageFilter() { - m_OutputImage = 0; + m_OutputImage = ITK_NULLPTR; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.h otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -362,7 +362,7 @@ protected: LabelObject(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: LabelObject(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObject.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -270,7 +270,7 @@ void LabelObject< TLabel, VImageDimension >::CopyAttributesFrom(const Self *src) { - itkAssertOrThrowMacro ( ( src != NULL ), "Null Pointer" ); + itkAssertOrThrowMacro ( ( src != ITK_NULLPTR ), "Null Pointer" ); m_Label = src->m_Label; } @@ -279,7 +279,7 @@ void LabelObject< TLabel, VImageDimension >::CopyAllFrom(const Self *src) { - itkAssertOrThrowMacro ( ( src != NULL ), "Null Pointer" ); + itkAssertOrThrowMacro ( ( src != ITK_NULLPTR ), "Null Pointer" ); m_LineContainer = src->m_LineContainer; // also copy the attributes this->CopyAttributesFrom(src); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.h otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.h 2014-09-03 08:29:34.000000000 +0000 @@ -47,9 +47,9 @@ typedef Index< VImageDimension > IndexType; typedef SizeValueType LengthType; - LabelObjectLine() {} - virtual ~LabelObjectLine() {} + LabelObjectLine(); LabelObjectLine(const IndexType & idx, const LengthType & length); + virtual ~LabelObjectLine() {} /** * Set/Get Index diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkLabelObjectLine.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,13 +23,19 @@ namespace itk { template< unsigned int VImageDimension > -LabelObjectLine< VImageDimension >::LabelObjectLine(const IndexType & idx, const LengthType & length) +LabelObjectLine< VImageDimension >::LabelObjectLine() : + m_Length( NumericTraits< SizeValueType >::Zero ) { - this->SetIndex(idx); - this->SetLength(length); + m_Index.Fill( NumericTraits< IndexValueType >::Zero ); } template< unsigned int VImageDimension > +LabelObjectLine< VImageDimension >::LabelObjectLine(const IndexType & idx, const LengthType & length) : + m_Index( idx ), + m_Length( length ) +{} + +template< unsigned int VImageDimension > void LabelObjectLine< VImageDimension >::SetIndex(const IndexType & idx) { m_Index = idx; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkObjectByObjectLabelMapFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -42,8 +42,8 @@ m_KeepLabels = true; m_InternalForegroundValue = itk::NumericTraits< InternalOutputPixelType >::max(); - m_InputFilter = NULL; - m_OutputFilter = NULL; + m_InputFilter = ITK_NULLPTR; + m_OutputFilter = ITK_NULLPTR; m_Select = SelectType::New(); @@ -80,7 +80,7 @@ ::SetFilter( InputFilterType * filter ) { OutputFilterType * outputFilter = dynamic_cast< OutputFilterType * >( filter ); - if( outputFilter == NULL && filter != NULL ) + if( outputFilter == ITK_NULLPTR && filter != ITK_NULLPTR ) { // TODO: can it be replaced by a concept check ? itkExceptionMacro("Wrong output filter type. Use SetOutputFilter() and SetInputFilter() instead of SetFilter() when input and output filter types are different."); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -299,7 +299,7 @@ vnl_diag_matrix< double > pm = eigen.D; for ( unsigned int i = 0; i < ImageDimension; i++ ) { - principalMoments[i] = pm(i, i); + principalMoments[i] = pm(i); } MatrixType principalAxes = eigen.V.transpose(); @@ -311,7 +311,7 @@ for ( unsigned int i = 0; i < ImageDimension; i++ ) { - det *= eigenval(i, i); + det *= eigenval(i); } for ( unsigned int i = 0; i < ImageDimension; i++ ) @@ -328,8 +328,8 @@ } else if ( principalMoments[0] != 0 ) { - elongation = vcl_sqrt(principalMoments[ImageDimension - 1] / principalMoments[ImageDimension - 2]); - flatness = vcl_sqrt(principalMoments[1] / principalMoments[0]); + elongation = std::sqrt(principalMoments[ImageDimension - 1] / principalMoments[ImageDimension - 2]); + flatness = std::sqrt(principalMoments[1] / principalMoments[0]); } double physicalSize = nbOfPixels * sizePerPixel; @@ -343,12 +343,12 @@ { edet *= principalMoments[i]; } - edet = vcl_pow(edet, 1.0 / ImageDimension); + edet = std::pow(edet, 1.0 / ImageDimension); for ( unsigned int i = 0; i < ImageDimension; i++ ) { if ( edet != 0.0 ) { - ellipsoidDiameter[i] = 2.0 *equivalentRadius *vcl_sqrt(principalMoments[i] / edet); + ellipsoidDiameter[i] = 2.0 *equivalentRadius *std::sqrt(principalMoments[i] / edet); } else { @@ -392,8 +392,6 @@ typedef typename std::deque< IndexType > IndexListType; IndexListType idxList; - typedef typename LabelObjectType::LengthType LengthType; - typedef typename itk::ConstNeighborhoodIterator< LabelImageType > NeighborIteratorType; SizeType neighborHoodRadius; neighborHoodRadius.Fill(1); @@ -443,7 +441,7 @@ for ( unsigned int i = 0; i < ImageDimension; i++ ) { const OffsetValueType indexDifference = ( iIt1->operator[](i) - iIt2->operator[](i) ); - length += vcl_pow(indexDifference * spacing[i], 2); + length += std::pow(indexDifference * spacing[i], 2); } if ( feretDiameter < length ) { @@ -452,7 +450,7 @@ } } // Final computation - feretDiameter = vcl_sqrt(feretDiameter); + feretDiameter = std::sqrt(feretDiameter); // Finally put the values in the label object labelObject->SetFeretDiameter(feretDiameter); @@ -506,7 +504,7 @@ // a data structure to store the number of intercepts on each direction typedef typename std::map MapInterceptType; MapInterceptType intercepts; - // int nbOfDirections = (int)vcl_pow( 2.0, (int)ImageDimension ) - 1; + // int nbOfDirections = (int)std::pow( 2.0, (int)ImageDimension ) - 1; // intecepts.resize(nbOfDirections + 1); // code begins at position 1 // now iterate over the vectors of lines @@ -693,10 +691,10 @@ double dx = spacing[0]; double dy = spacing[1]; double dz = spacing[2]; - double dxy = vcl_sqrt( spacing[0]*spacing[0] + spacing[1]*spacing[1] ); - double dxz = vcl_sqrt( spacing[0]*spacing[0] + spacing[2]*spacing[2] ); - double dyz = vcl_sqrt( spacing[1]*spacing[1] + spacing[2]*spacing[2] ); - double dxyz = vcl_sqrt( spacing[0]*spacing[0] + spacing[1]*spacing[1] + spacing[2]*spacing[2] ); + double dxy = std::sqrt( spacing[0]*spacing[0] + spacing[1]*spacing[1] ); + double dxz = std::sqrt( spacing[0]*spacing[0] + spacing[2]*spacing[2] ); + double dyz = std::sqrt( spacing[1]*spacing[1] + spacing[2]*spacing[2] ); + double dxyz = std::sqrt( spacing[0]*spacing[0] + spacing[1]*spacing[1] + spacing[2]*spacing[2] ); double vol = spacing[0]*spacing[1]*spacing[2]; // 'magical numbers', corresponding to area of voronoi partition on the @@ -748,7 +746,7 @@ Superclass::AfterThreadedGenerateData(); // Release the label image - m_LabelImage = NULL; + m_LabelImage = ITK_NULLPTR; } template< typename TImage, typename TLabelImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelObject.h otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelObject.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkShapeLabelObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -521,7 +521,7 @@ // copy the data of the current type if possible const Self *src = dynamic_cast< const Self * >( lo ); - if ( src == NULL ) + if ( src == ITK_NULLPTR ) { return; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelMapFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -67,16 +67,15 @@ typedef typename LabelObjectType::HistogramType HistogramType; - typename HistogramType::SizeType histogramSize; - histogramSize.SetSize(1); + typename HistogramType::IndexType histogramIndex(1); + typename HistogramType::MeasurementVectorType mv(1); + typename HistogramType::SizeType histogramSize(1); histogramSize.Fill(m_NumberOfBins); - typename HistogramType::MeasurementVectorType featureImageMin; - featureImageMin.SetSize(1); + typename HistogramType::MeasurementVectorType featureImageMin(1); featureImageMin.Fill(m_Minimum); - typename HistogramType::MeasurementVectorType featureImageMax; - featureImageMax.SetSize(1); + typename HistogramType::MeasurementVectorType featureImageMax(1); featureImageMax.Fill(m_Maximum); typename HistogramType::Pointer histogram = HistogramType::New(); @@ -103,8 +102,7 @@ VectorType principalMoments; principalMoments.Fill(0); - typename HistogramType::MeasurementVectorType mv; - mv.SetSize(1); + // iterate over all the indexes typename LabelObjectType::ConstIndexIterator it( labelObject ); while( ! it.IsAtEnd() ) @@ -112,7 +110,8 @@ const IndexType & idx = it.GetIndex(); const FeatureImagePixelType & v = featureImage->GetPixel(idx); mv[0] = v; - histogram->IncreaseFrequencyOfMeasurement(mv, 1); + histogram->GetIndex(mv, histogramIndex); + histogram->IncreaseFrequencyOfIndex(histogramIndex, 1); // update min and max if ( v <= min ) @@ -128,9 +127,9 @@ //increase the sums sum += v; - sum2 += vcl_pow( (double)v, 2 ); - sum3 += vcl_pow( (double)v, 3 ); - sum4 += vcl_pow( (double)v, 4 ); + sum2 += std::pow( (double)v, 2 ); + sum3 += std::pow( (double)v, 3 ); + sum4 += std::pow( (double)v, 4 ); // moments PointType physicalPosition; @@ -152,11 +151,11 @@ // final computations const typename HistogramType::AbsoluteFrequencyType & totalFreq = histogram->GetTotalFrequency(); const double mean = sum / totalFreq; - const double variance = ( sum2 - ( vcl_pow(sum, 2) / totalFreq ) ) / ( totalFreq - 1 ); - const double sigma = vcl_sqrt(variance); + const double variance = ( sum2 - ( std::pow(sum, 2) / totalFreq ) ) / ( totalFreq - 1 ); + const double sigma = std::sqrt(variance); const double mean2 = mean * mean; double skewness; - if(vcl_abs(variance * sigma) > itk::NumericTraits::min()) + if(std::abs(variance * sigma) > itk::NumericTraits::min()) { skewness = ( ( sum3 - 3.0 * mean * sum2 ) / totalFreq + 2.0 * mean * mean2 ) / ( variance * sigma ); } @@ -165,7 +164,7 @@ skewness = 0.0; } double kurtosis; - if(vcl_abs(variance) > itk::NumericTraits::min()) + if(std::abs(variance) > itk::NumericTraits::min()) { kurtosis = ( ( sum4 - 4.0 * mean * sum3 + 6.0 * mean2 * sum2 ) / totalFreq - 3.0 * mean2 * mean2 ) / @@ -224,8 +223,8 @@ vnl_diag_matrix< double > pm = eigen.D; for ( unsigned int i = 0; i < ImageDimension; i++ ) { - // principalMoments[i] = 4 * vcl_sqrt( pm(i,i) ); - principalMoments[i] = pm(i, i); + // principalMoments[i] = 4 * std::sqrt( pm(i,i) ); + principalMoments[i] = pm(i); } principalAxes = eigen.V.transpose(); @@ -237,7 +236,7 @@ for ( unsigned int i = 0; i < ImageDimension; i++ ) { - det *= eigenval(i, i); + det *= eigenval(i); } for ( unsigned int i = 0; i < ImageDimension; i++ ) @@ -254,8 +253,8 @@ { // elongation = principalMoments[ImageDimension-1] / // principalMoments[0]; - elongation = vcl_sqrt(principalMoments[ImageDimension - 1] / principalMoments[ImageDimension - 2]); - flatness = vcl_sqrt(principalMoments[1] / principalMoments[0]); + elongation = std::sqrt(principalMoments[ImageDimension - 1] / principalMoments[ImageDimension - 2]); + flatness = std::sqrt(principalMoments[1] / principalMoments[0]); } } else diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelObject.h otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelObject.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/include/itkStatisticsLabelObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -248,7 +248,7 @@ // copy the data of the current type if possible const Self *src = dynamic_cast< const Self * >( lo ); - if ( src == NULL ) + if ( src == ITK_NULLPTR ) { return; } @@ -528,7 +528,7 @@ m_Kurtosis = 0; m_Skewness = 0; m_WeightedElongation = 0; - m_Histogram = NULL; + m_Histogram = ITK_NULLPTR; m_WeightedFlatness = 0; } @@ -553,15 +553,7 @@ // os << indent << "CentralMoments: " << std::endl << m_CentralMoments; os << indent << "WeightedPrincipalMoments: " << m_WeightedPrincipalMoments << std::endl; os << indent << "WeightedPrincipalAxes: " << std::endl << m_WeightedPrincipalAxes; - os << indent << "Histogram: "; - if ( m_Histogram.IsNull() ) - { - os << "NULL" << std::endl; - } - else - { - m_Histogram->Print(os, indent); - } + itkPrintSelfObjectMacro( Histogram ); } private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/src/itkGeometryUtilities.cxx otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/src/itkGeometryUtilities.cxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/src/itkGeometryUtilities.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/src/itkGeometryUtilities.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,7 +55,7 @@ } else { - return vcl_sqrt(vnl_math::pi) * DoubleFactorial(n) / vcl_pow(2, ( n + 1 ) / 2.0); + return std::sqrt(vnl_math::pi) * DoubleFactorial(n) / std::pow(2, ( n + 1 ) / 2.0); } } @@ -65,7 +65,7 @@ { const double dbldim = static_cast< double >( dim ); - return vcl_pow(vnl_math::pi, dbldim * 0.5) * vcl_pow(radius, dbldim) / GammaN2p1(dim); + return std::pow(vnl_math::pi, dbldim * 0.5) * std::pow(radius, dbldim) / GammaN2p1(dim); } double @@ -79,7 +79,7 @@ GeometryUtilities ::HyperSphereRadiusFromVolume(const int dim, const double volume) { - return vcl_pow(volume * GammaN2p1(dim) / vcl_pow(vnl_math::pi, dim * 0.5), 1.0 / dim); + return std::pow(volume * GammaN2p1(dim) / std::pow(vnl_math::pi, dim * 0.5), 1.0 / dim); } } // end of itk namespace diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/wrapping/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/wrapping/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/Filtering/LabelMap/wrapping/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/LabelMap/wrapping/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -10,5 +10,16 @@ itkInPlaceLabelMapFilter itkChangeRegionLabelMapFilter ) + +# Save default includes so they can be reseted afterwards +set(tmp_default_includes ${WRAPPER_DEFAULT_INCLUDE}) + +# Add itkStatisticsLabelObject.h, it is not automatically detected +# (but it maybe should) +set(WRAPPER_DEFAULT_INCLUDE ${WRAPPER_DEFAULT_INCLUDE} "itkStatisticsLabelObject.h") + itk_auto_load_submodules() itk_end_wrap_module() + +# Reset the WRAPPER_DEFAULT_INCLUDE to original value +set(WRAPPER_DEFAULT_INCLUDE ${tmp_default_includes}) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkClosingByReconstructionImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkClosingByReconstructionImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkClosingByReconstructionImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkClosingByReconstructionImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -80,6 +80,8 @@ dilate->SetInput( this->GetInput() ); dilate->SetKernel(this->m_Kernel); + progress->RegisterInternalFilter(dilate, .5); + // Delegate to a dilate filter. typename ReconstructionByErosionImageFilter< TInputImage, TInputImage >::Pointer erode = ReconstructionByErosionImageFilter< TInputImage, TInputImage >::New(); @@ -90,6 +92,7 @@ if ( m_PreserveIntensities ) { + progress->RegisterInternalFilter(erode, .25); erode->Update(); typename TInputImage::Pointer tempImage = TInputImage::New(); tempImage->SetRegions ( dilate->GetOutput()->GetBufferedRegion() ); @@ -133,6 +136,7 @@ } else { + progress->RegisterInternalFilter(erode, .5); erode->GraftOutput( this->GetOutput() ); erode->Update(); this->GraftOutput( erode->GetOutput() ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkFlatStructuringElement.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkFlatStructuringElement.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkFlatStructuringElement.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkFlatStructuringElement.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -102,15 +102,15 @@ while ( theta <= M_PI / 2.0 + 0.0001 ) { LType2 O; - O[0] = k1 * vcl_cos(theta); - O[1] = k2 * vcl_sin(theta); + O[0] = k1 * std::cos(theta); + O[1] = k2 * std::sin(theta); if ( !res.CheckParallel(O) ) { //std::cout << O << std::endl; res.AddLine(O); } - O[0] = k1 * vcl_cos(-theta); - O[1] = k2 * vcl_sin(-theta); + O[0] = k1 * std::cos(-theta); + O[1] = k2 * std::sin(-theta); if ( !res.CheckParallel(O) ) { //std::cout << O << std::endl; @@ -123,9 +123,9 @@ res.ComputeBufferFromLines(); } -// O[0] = k1 * vcl_cos(phi) * vcl_cos(theta); -// O[1] = k2 * vcl_cos(phi) * vcl_sin(theta); -// O[2] = k3 * vcl_sin(theta); +// O[0] = k1 * std::cos(phi) * std::cos(theta); +// O[1] = k2 * std::cos(phi) * std::sin(theta); +// O[2] = k3 * std::sin(theta); template< unsigned int VDimension > void @@ -148,7 +148,7 @@ case 12: { // dodecahedron - float phi = ( 1.0 + vcl_sqrt(5.0) ) / 2.0; + float phi = ( 1.0 + std::sqrt(5.0) ) / 2.0; float b = 1.0 / phi; float c = 2.0 - phi; unsigned facets = 12; @@ -317,7 +317,7 @@ case 20: { // Icosahedron - float phi = ( 1.0 + vcl_sqrt(5.0) ) / 2.0; + float phi = ( 1.0 + std::sqrt(5.0) ) / 2.0; float a = 0.5; float b = 1.0 / ( 2.0 * phi ); unsigned facets = 20; @@ -518,8 +518,8 @@ // create triangular facet approximation to a sphere - begin with // unit sphere // total number of facets is 8 * (4^iterations) - unsigned int facets = 8 * (int)vcl_pow( (double)4, iterations ); - float sqrt2 = vcl_sqrt(2.0); + unsigned int facets = 8 * (int)std::pow( (double)4, iterations ); + float sqrt2 = std::sqrt(2.0); // std::cout << facets << " facets" << std::endl; typedef std::vector< FacetType3 > FacetArrayType; FacetArrayType FacetArray; @@ -926,7 +926,7 @@ LType LL = m_Lines[i]; LL.Normalize(); float L = NN * LL; - if ( ( 1.0 - vcl_fabs(L) ) < 0.000001 ) { return ( true ); } + if ( ( 1.0 - std::fabs(L) ) < 0.000001 ) { return ( true ); } } return ( false ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleDilateImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleDilateImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleDilateImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleDilateImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,16 +55,9 @@ GrayscaleDilateImageFilter< TInputImage, TOutputImage, TKernel > ::SetKernel(const KernelType & kernel) { - const FlatKernelType *flatKernel = NULL; + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - } - catch ( ... ) - {} - - if ( flatKernel != NULL && flatKernel->GetDecomposable() ) + if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() ) { m_AnchorFilter->SetKernel(*flatKernel); m_Algorithm = ANCHOR; @@ -119,14 +112,7 @@ GrayscaleDilateImageFilter< TInputImage, TOutputImage, TKernel > ::SetAlgorithm(int algo) { - const FlatKernelType *flatKernel = NULL; - - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); - } - catch ( ... ) - {} + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); if ( m_Algorithm != algo ) { @@ -138,11 +124,11 @@ { m_HistogramFilter->SetKernel( this->GetKernel() ); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == ANCHOR ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == ANCHOR ) { m_AnchorFilter->SetKernel(*flatKernel); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == VHGW ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == VHGW ) { m_VHGWFilter->SetKernel(*flatKernel); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleErodeImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleErodeImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleErodeImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleErodeImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,16 +55,9 @@ GrayscaleErodeImageFilter< TInputImage, TOutputImage, TKernel > ::SetKernel(const KernelType & kernel) { - const FlatKernelType *flatKernel = NULL; + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - } - catch ( ... ) - {} - - if ( flatKernel != NULL && flatKernel->GetDecomposable() ) + if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() ) { m_AnchorFilter->SetKernel(*flatKernel); m_Algorithm = ANCHOR; @@ -119,14 +112,7 @@ GrayscaleErodeImageFilter< TInputImage, TOutputImage, TKernel > ::SetAlgorithm(int algo) { - const FlatKernelType *flatKernel = NULL; - - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); - } - catch ( ... ) - {} + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); if ( m_Algorithm != algo ) { @@ -138,11 +124,11 @@ { m_HistogramFilter->SetKernel( this->GetKernel() ); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == ANCHOR ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == ANCHOR ) { m_AnchorFilter->SetKernel(*flatKernel); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == VHGW ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == VHGW ) { m_VHGWFilter->SetKernel(*flatKernel); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalClosingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalClosingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalClosingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalClosingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,16 +47,9 @@ GrayscaleMorphologicalClosingImageFilter< TInputImage, TOutputImage, TKernel > ::SetKernel(const KernelType & kernel) { - const FlatKernelType *flatKernel = NULL; + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - } - catch ( ... ) - {} - - if ( flatKernel != NULL && flatKernel->GetDecomposable() ) + if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() ) { m_AnchorFilter->SetKernel(*flatKernel); m_Algorithm = ANCHOR; @@ -100,14 +93,7 @@ GrayscaleMorphologicalClosingImageFilter< TInputImage, TOutputImage, TKernel > ::SetAlgorithm(int algo) { - const FlatKernelType *flatKernel = NULL; - - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); - } - catch ( ... ) - {} + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); if ( m_Algorithm != algo ) { @@ -121,11 +107,11 @@ m_HistogramErodeFilter->SetKernel( this->GetKernel() ); m_HistogramDilateFilter->SetKernel( this->GetKernel() ); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == ANCHOR ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == ANCHOR ) { m_AnchorFilter->SetKernel(*flatKernel); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == VHGW ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == VHGW ) { m_VanHerkGilWermanDilateFilter->SetKernel(*flatKernel); m_VanHerkGilWermanErodeFilter->SetKernel(*flatKernel); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -115,12 +115,12 @@ virtual void Modified() const; /** define values used to determine which algorithm to use */ - enum { + enum AlgorithmType { BASIC = 0, HISTO = 1, ANCHOR = 2, VHGW = 3 - } AlgorithmChoice; + }; /** A safe border is added to input image to avoid borders effects * and remove it once the closing is done */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkGrayscaleMorphologicalOpeningImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,17 +29,17 @@ { template< typename TInputImage, typename TOutputImage, typename TKernel > GrayscaleMorphologicalOpeningImageFilter< TInputImage, TOutputImage, TKernel > -::GrayscaleMorphologicalOpeningImageFilter() +::GrayscaleMorphologicalOpeningImageFilter() : + m_HistogramDilateFilter(HistogramDilateFilterType::New()), + m_HistogramErodeFilter(HistogramErodeFilterType::New()), + m_BasicDilateFilter(BasicDilateFilterType::New()), + m_BasicErodeFilter(BasicErodeFilterType::New()), + m_VanHerkGilWermanDilateFilter(VanHerkGilWermanDilateFilterType::New()), + m_VanHerkGilWermanErodeFilter(VanHerkGilWermanErodeFilterType::New()), + m_AnchorFilter(AnchorFilterType::New()), + m_Algorithm(HISTO), + m_SafeBorder(true) { - m_BasicDilateFilter = BasicDilateFilterType::New(); - m_BasicErodeFilter = BasicErodeFilterType::New(); - m_HistogramDilateFilter = HistogramDilateFilterType::New(); - m_HistogramErodeFilter = HistogramErodeFilterType::New(); - m_VanHerkGilWermanDilateFilter = VanHerkGilWermanDilateFilterType::New(); - m_VanHerkGilWermanErodeFilter = VanHerkGilWermanErodeFilterType::New(); - m_AnchorFilter = AnchorFilterType::New(); - m_Algorithm = HISTO; - m_SafeBorder = true; } template< typename TInputImage, typename TOutputImage, typename TKernel > @@ -47,16 +47,9 @@ GrayscaleMorphologicalOpeningImageFilter< TInputImage, TOutputImage, TKernel > ::SetKernel(const KernelType & kernel) { - const FlatKernelType *flatKernel = NULL; + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - } - catch ( ... ) - {} - - if ( flatKernel != NULL && flatKernel->GetDecomposable() ) + if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() ) { m_AnchorFilter->SetKernel(*flatKernel); m_Algorithm = ANCHOR; @@ -100,14 +93,7 @@ GrayscaleMorphologicalOpeningImageFilter< TInputImage, TOutputImage, TKernel > ::SetAlgorithm(int algo) { - const FlatKernelType *flatKernel = NULL; - - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); - } - catch ( ... ) - {} + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); if ( m_Algorithm != algo ) { @@ -121,11 +107,11 @@ m_HistogramDilateFilter->SetKernel( this->GetKernel() ); m_HistogramErodeFilter->SetKernel( this->GetKernel() ); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == ANCHOR ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == ANCHOR ) { m_AnchorFilter->SetKernel(*flatKernel); } - else if ( flatKernel != NULL && flatKernel->GetDecomposable() && algo == VHGW ) + else if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() && algo == VHGW ) { m_VanHerkGilWermanDilateFilter->SetKernel(*flatKernel); m_VanHerkGilWermanErodeFilter->SetKernel(*flatKernel); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkKernelImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkKernelImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkKernelImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkKernelImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -29,8 +29,6 @@ * * This filter provides the code to store the radius information about the * neighborhood used in the subclasses. - * It also conveniently reimplement the GenerateInputRequestedRegion() so - * that region is well defined for the porvided radius. * * \author Gaetan Lehmann * \ingroup ITKMathematicalMorphology diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMorphologicalGradientImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMorphologicalGradientImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMorphologicalGradientImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMorphologicalGradientImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,16 +44,9 @@ MorphologicalGradientImageFilter< TInputImage, TOutputImage, TKernel > ::SetKernel(const KernelType & kernel) { - const FlatKernelType *flatKernel = NULL; + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &kernel ); - } - catch ( ... ) - {} - - if ( flatKernel != NULL && flatKernel->GetDecomposable() ) + if ( flatKernel != ITK_NULLPTR && flatKernel->GetDecomposable() ) { m_AnchorDilateFilter->SetKernel(*flatKernel); m_AnchorErodeFilter->SetKernel(*flatKernel); @@ -96,14 +89,7 @@ MorphologicalGradientImageFilter< TInputImage, TOutputImage, TKernel > ::SetAlgorithm(int algo) { - const FlatKernelType *flatKernel = NULL; - - try - { - flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); - } - catch ( ... ) - {} + const FlatKernelType *flatKernel = dynamic_cast< const FlatKernelType * >( &this->GetKernel() ); if ( m_Algorithm != algo ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkMovingHistogramImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -96,8 +96,6 @@ InputLineIteratorType InLineIt(inputImage, outputRegionForThread); InLineIt.SetDirection(BestDirection); - typedef ImageRegionIterator< OutputImageType > OutputIteratorType; - //OutputIteratorType oit(outputImage, outputRegionForThread); InLineIt.GoToBegin(); IndexType LineStart; //PrevLineStart = InLineIt.GetIndex(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -94,12 +94,12 @@ unsigned perpdir = 0; for ( unsigned i = 0; i < TImage::RegionType::ImageDimension; i++ ) { - if ( vcl_fabs(line[i]) > domdir ) + if ( std::fabs(line[i]) > domdir ) { - domdir = vcl_fabs(line[i]); + domdir = std::fabs(line[i]); perpdir = i; } - if ( vcl_fabs(line[i]) > tol ) + if ( std::fabs(line[i]) > tol ) { int P1 = ImStart[i] - StartIndex[i]; int P2 = ImStart[i] + ImSize[i] - 1 - StartIndex[i]; @@ -132,8 +132,8 @@ } } } - sPos = (int)( Tnear * vcl_fabs(line[perpdir]) + 0.5 ); - ePos = (int)( Tfar * vcl_fabs(line[perpdir]) + 0.5 ); + sPos = (int)( Tnear * std::fabs(line[perpdir]) + 0.5 ); + ePos = (int)( Tfar * std::fabs(line[perpdir]) + 0.5 ); //std::cout << Tnear << " " << Tfar << std::endl; if ( Tfar < Tnear ) // seems to need some margin @@ -304,9 +304,9 @@ // figure out the dominant direction of the line for ( unsigned i = 0; i < TInputImage::RegionType::ImageDimension; i++ ) { - if ( vcl_fabs(line[i]) > MaxComp ) + if ( std::fabs(line[i]) > MaxComp ) { - MaxComp = vcl_fabs(line[i]); + MaxComp = std::fabs(line[i]); DomDir = i; } } @@ -358,7 +358,7 @@ { if ( i != NonFaceDim ) { - int Pad = Math::Ceil< int >( (float)( NonFaceLen ) * line[i] / vcl_fabs(line[NonFaceDim]) ); + int Pad = Math::Ceil< int >( (float)( NonFaceLen ) * line[i] / std::fabs(line[NonFaceDim]) ); if ( Pad < 0 ) { // just increase the size - no need to change the start @@ -415,7 +415,7 @@ for ( unsigned int i = 0; i < TLine::Dimension; i++ ) { - float tt = vcl_fabs(line[i] / N); + float tt = std::fabs(line[i] / N); if ( tt > correction ) { correction = tt; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodePath2D.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodePath2D.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodePath2D.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodePath2D.h 2014-09-03 08:29:34.000000000 +0000 @@ -82,16 +82,16 @@ // Functions inherited from Path /** Evaluate the chaincode for the offset at the specified path-position. */ - virtual OutputType Evaluate(const InputType & input) const; + virtual OutputType Evaluate(const InputType & input) const ITK_OVERRIDE; /** Like Evaluate(), but returns the index at the specified path-position. */ - virtual IndexType EvaluateToIndex(const InputType & input) const; + virtual IndexType EvaluateToIndex(const InputType & input) const ITK_OVERRIDE; /** Increment the input variable passed by reference and return the offset * stored at the previous path-position. If the chaincode is unable to be * incremented, input is not changed and an offset of zero is returned, which * may be used to check for the end of the chain code. */ - virtual OffsetType IncrementInput(InputType & input) const; + virtual OffsetType IncrementInput(InputType & input) const ITK_OVERRIDE; // Functions specific to ChainCodePath and its descendents @@ -99,7 +99,7 @@ itkNewMacro(Self); /** How many steps in the chaincode? */ - inline ChainCodeSizeType NumberOfSteps() const { return m_Chain2D.size(); } + virtual inline ChainCodeSizeType NumberOfSteps() const ITK_OVERRIDE { return m_Chain2D.size(); } /** Insert a new step into the chaincode at a specified position */ inline void InsertStep(InputType position, int encodedStep) @@ -108,7 +108,7 @@ this->Modified(); } - inline void InsertStep(InputType position, OffsetType step) + virtual inline void InsertStep(InputType position, OffsetType step) ITK_OVERRIDE { m_Chain2D.insert( m_Chain2D.begin() + position, EncodeOffset(step) ); this->Modified(); @@ -121,14 +121,14 @@ this->Modified(); } - inline void ChangeStep(InputType position, OffsetType step) + virtual inline void ChangeStep(InputType position, OffsetType step) ITK_OVERRIDE { m_Chain2D[position] = EncodeOffset(step); this->Modified(); } /** Remove all steps from the chain code */ - virtual inline void Clear() + virtual inline void Clear() ITK_OVERRIDE { m_Chain2D.clear(); this->Modified(); @@ -139,7 +139,7 @@ protected: ChainCodePath2D(); ~ChainCodePath2D(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Encode and Decode between an offset and a Freeman code */ inline int EncodeOffset(OffsetType step) const diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodeToFourierSeriesPathFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodeToFourierSeriesPathFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodeToFourierSeriesPathFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkChainCodeToFourierSeriesPathFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -63,7 +63,7 @@ numSteps = inputPtr->NumberOfSteps(); outputPtr->Clear(); - const double nPI = 4.0 * vcl_atan(1.0); + const double nPI = 4.0 * std::atan(1.0); // Adjust our private copy of numHarmonics if necessary if ( numHarmonics <= 1 ) @@ -92,8 +92,8 @@ indexVector[d] = index[d]; } - cosCoefficient += indexVector * ( vcl_cos(theta) / numSteps ); - sinCoefficient += indexVector * ( vcl_sin(theta) / numSteps ); + cosCoefficient += indexVector * ( std::cos(theta) / numSteps ); + sinCoefficient += indexVector * ( std::sin(theta) / numSteps ); } outputPtr->AddHarmonic(cosCoefficient, sinCoefficient); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkFourierSeriesPath.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkFourierSeriesPath.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkFourierSeriesPath.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkFourierSeriesPath.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -35,7 +35,7 @@ numHarmonics = m_CosCoefficients->Size(); output.Fill(0); - const double PI = 4.0 * vcl_atan(1.0); + const double PI = 4.0 * std::atan(1.0); if ( numHarmonics > 0 ) { output += m_CosCoefficients->ElementAt(0); } @@ -43,8 +43,8 @@ { // input defined over [0,1] maps to theta defined over [0,2pi * n] theta = PI * 2.0 * n * input; - output += ( m_CosCoefficients->ElementAt(n) * vcl_cos(theta) - + m_SinCoefficients->ElementAt(n) * vcl_sin(theta) ) * 2.0; + output += ( m_CosCoefficients->ElementAt(n) * std::cos(theta) + + m_SinCoefficients->ElementAt(n) * std::sin(theta) ) * 2.0; } return output; @@ -62,14 +62,14 @@ numHarmonics = m_CosCoefficients->Size(); output.Fill(0); - const double PI = 4.0 * vcl_atan(1.0); + const double PI = 4.0 * std::atan(1.0); for ( int n = 1; n < numHarmonics; n++ ) { // input defined over [0,1] maps to theta defined over [0,2pi * n] theta = PI * 2.0 * n * input; - output += ( m_SinCoefficients->ElementAt(n) * vcl_cos(theta) - - m_CosCoefficients->ElementAt(n) * vcl_sin(theta) ) * ( 2.0 * n ); + output += ( m_SinCoefficients->ElementAt(n) * std::cos(theta) + - m_CosCoefficients->ElementAt(n) * std::sin(theta) ) * ( 2.0 * n ); } return output; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkHilbertPath.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkHilbertPath.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkHilbertPath.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkHilbertPath.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -179,7 +179,7 @@ return x; } - PathIndexType m = static_cast( vcl_ceil( vcl_log( static_cast(x) ) / vcl_log( 2.0 ) ) ) + 1; + PathIndexType m = static_cast( std::ceil( std::log( static_cast(x) ) / std::log( 2.0 ) ) ) + 1; PathIndexType i = x; PathIndexType j = 1; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkImageAndPathToImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkImageAndPathToImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkImageAndPathToImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkImageAndPathToImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -62,7 +62,7 @@ ::GetNonConstImageInput(void) { TInputImage * temp_return=dynamic_cast< TInputImage * >( this->ProcessObject::GetInput(0) ); - if(temp_return == NULL) + if(temp_return == ITK_NULLPTR) { itkExceptionMacro("Invalid type conversion in GetNonConstImageInput()") } @@ -94,7 +94,7 @@ ::GetNonConstPathInput(void) { TInputPath * temp_return = dynamic_cast< TInputPath * >( this->ProcessObject::GetInput(1) ); - if(temp_return == NULL) + if(temp_return == ITK_NULLPTR) { itkExceptionMacro("Invalid type conversion in GetNonConstPathInput()") } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonallyCorrected2DParametricPath.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonallyCorrected2DParametricPath.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonallyCorrected2DParametricPath.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonallyCorrected2DParametricPath.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ typedef OrthogonalCorrectionTableType::ElementIdentifier OrthogonalCorrectionTableSizeType; /** Return the location of the parametric path at the specified location. */ - virtual OutputType Evaluate(const InputType & input) const; + virtual OutputType Evaluate(const InputType & input) const ITK_OVERRIDE; /** Set pointer to the original path. The path MUST be continuous in its * first derivative to prevent discontinuities in the corrected path. The @@ -90,19 +90,19 @@ itkNewMacro(Self); /** Needed for Pipelining */ - virtual void Initialize(void) + virtual void Initialize(void) ITK_OVERRIDE { - this->m_OriginalPath = NULL; - this->m_OrthogonalCorrectionTable = NULL; + this->m_OriginalPath = ITK_NULLPTR; + this->m_OrthogonalCorrectionTable = ITK_NULLPTR; } /** These are determined by the original path */ - virtual inline InputType StartOfInput() const + virtual inline InputType StartOfInput() const ITK_OVERRIDE { return m_OriginalPath->StartOfInput(); } - virtual inline InputType EndOfInput() const + virtual inline InputType EndOfInput() const ITK_OVERRIDE { return m_OriginalPath->EndOfInput(); } @@ -110,7 +110,7 @@ protected: OrthogonallyCorrected2DParametricPath(); ~OrthogonallyCorrected2DParametricPath(){} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: OrthogonallyCorrected2DParametricPath(const Self &); //purposely not diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonalSwath2DPathFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonalSwath2DPathFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonalSwath2DPathFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkOrthogonalSwath2DPathFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,9 +37,9 @@ size[0] = 0; size[1] = 0; m_SwathSize = size; - m_StepValues = NULL; - m_MeritValues = NULL; - m_OptimumStepsValues = NULL; + m_StepValues = ITK_NULLPTR; + m_MeritValues = ITK_NULLPTR; + m_OptimumStepsValues = ITK_NULLPTR; m_FinalOffsetValues = OrthogonalCorrectionTableType::New(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathFunctions.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathFunctions.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathFunctions.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathFunctions.h 2014-09-03 08:29:34.000000000 +0000 @@ -35,9 +35,7 @@ { typedef typename TChainCodePath::OffsetType OffsetType; typedef typename TChainCodePath::InputType ChainInputType; - typedef typename TChainCodePath::OutputType ChainOutputType; typedef typename TPathInput::InputType InPathInputType; - typedef typename TPathInput::OutputType InPathOutputType; OffsetType offset, tempOffset, zeroOffset; InPathInputType inPathInput; @@ -86,9 +84,7 @@ typedef typename TFourierSeriesPath::VectorType VectorType; typedef typename TFourierSeriesPath::InputType FSInputType; - typedef typename TFourierSeriesPath::OutputType FSOutputType; typedef typename TChainCodePath::InputType ChainInputType; - typedef typename TChainCodePath::OutputType ChainOutputType; IndexType index; VectorType indexVector; @@ -98,7 +94,7 @@ int dimension = OffsetType::GetOffsetDimension(); unsigned numSteps = chainPath.NumberOfSteps(); - const double PI = 4.0 * vcl_atan(1.0); + const double PI = 4.0 * std::atan(1.0); FSPath.Clear(); @@ -128,8 +124,8 @@ { indexVector[d] = index[d]; } - cosCoefficient += indexVector * ( vcl_cos(theta) / numSteps ); - sinCoefficient += indexVector * ( vcl_sin(theta) / numSteps ); + cosCoefficient += indexVector * ( std::cos(theta) / numSteps ); + sinCoefficient += indexVector * ( std::sin(theta) / numSteps ); } FSPath.AddHarmonic(cosCoefficient, sinCoefficient); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPath.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPath.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPath.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPath.h 2014-09-03 08:29:34.000000000 +0000 @@ -111,7 +111,7 @@ Path(); ~Path(){} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; itkGetConstMacro(ZeroOffset, OffsetType); itkGetConstMacro(ZeroIndex, IndexType); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathSource.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathSource.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathSource.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPathSource.h 2014-09-03 08:29:34.000000000 +0000 @@ -168,12 +168,12 @@ * an implementation of MakeOutput(). */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; protected: PathSource(); virtual ~PathSource() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; // Inherit the empty ProcessObject::GenerateData() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPolyLineParametricPath.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPolyLineParametricPath.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/include/itkPolyLineParametricPath.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/include/itkPolyLineParametricPath.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -84,7 +84,7 @@ ::IncrementInput(InputType & input) const { //Save this input index since we will use it to calculate the offset - const OutputType originalIndex = this->EvaluateToIndex(input); + const IndexType originalIndex = this->EvaluateToIndex(input); InputType potentialTimestep = itk::NumericTraits< InputType >::ZeroValue(); bool timeStepSmallEnough = false; @@ -92,7 +92,7 @@ { if (input == this->EndOfInput()) { - const OutputType finalIndex = this->EvaluateToIndex(this->EndOfInput()); + const IndexType finalIndex = this->EvaluateToIndex(this->EndOfInput()); OffsetType finalOffset; for (unsigned int i = 0; i < VDimension; ++i) { @@ -102,7 +102,7 @@ } //Check to make sure we aren't already at a place with an offset of 1 pixel - const OutputType potentialIndex = this->EvaluateToIndex(input); + const IndexType potentialIndex = this->EvaluateToIndex(input); //For some reason, there's no way to convert OutputType to OffsetType OffsetType offset; for (unsigned int i = 0; i < VDimension; ++i) @@ -146,7 +146,7 @@ const InputType timestep = potentialTimestep; //Get the index at the next timestep so we can calculate the offset - const OutputType nextIndex = this->EvaluateToIndex(input + timestep); + const IndexType nextIndex = this->EvaluateToIndex(input + timestep); //For some reason, there's no way to convert OutputType to OffsetType OffsetType offset; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/src/itkOrthogonallyCorrected2DParametricPath.cxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/src/itkOrthogonallyCorrected2DParametricPath.cxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Path/src/itkOrthogonallyCorrected2DParametricPath.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Path/src/itkOrthogonallyCorrected2DParametricPath.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,7 @@ OrthogonallyCorrected2DParametricPath ::OrthogonallyCorrected2DParametricPath() { - m_OriginalPath = NULL; + m_OriginalPath = ITK_NULLPTR; m_OrthogonalCorrectionTable = OrthogonalCorrectionTableType::New(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkBorderQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkBorderQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkBorderQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkBorderQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,7 +56,7 @@ BorderQuadEdgeMeshFilter< TInputMesh, TOutputMesh > ::ComputeBoundary() { - InputQEType *bdryEdge = NULL; + InputQEType *bdryEdge = ITK_NULLPTR; switch( m_BorderPick ) { @@ -215,7 +215,7 @@ std::vector< InputCoordRepType > tetas(NbBoundaryPt, 0.0); tetas[0] = static_cast< InputCoordRepType >( - vcl_acos( ( two_r - dist ) * inv_two_r ) ); + std::acos( ( two_r - dist ) * inv_two_r ) ); MapPointIdentifierIterator BoundaryPtIterator = this->m_BoundaryPtMap.begin(); @@ -232,7 +232,7 @@ dist = pt1.SquaredEuclideanDistanceTo(pt2); - tetas[j] = tetas[j - 1] + vcl_acos( ( two_r - dist ) * inv_two_r ); + tetas[j] = tetas[j - 1] + std::acos( ( two_r - dist ) * inv_two_r ); ++j; ++BoundaryPtIterator; @@ -242,7 +242,7 @@ if ( this->m_Radius == 0.0 ) { - this->m_Radius = vcl_pow(vcl_sqrt(r), a); + this->m_Radius = std::pow(std::sqrt(r), a); } for ( MapPointIdentifierIterator @@ -253,8 +253,8 @@ id = BoundaryPtMapIterator->first; j = BoundaryPtMapIterator->second; - pt1[0] = this->m_Radius * static_cast< InputCoordRepType >( vcl_cos(a * tetas[j]) ); - pt1[1] = this->m_Radius * static_cast< InputCoordRepType >( vcl_sin(a * tetas[j]) ); + pt1[0] = this->m_Radius * static_cast< InputCoordRepType >( std::cos(a * tetas[j]) ); + pt1[1] = this->m_Radius * static_cast< InputCoordRepType >( std::sin(a * tetas[j]) ); pt1[2] = 0.0; this->m_Border[j] = pt1; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkCleanQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -141,7 +141,7 @@ while ( p_it != p_end ) { id = p_it->Index(); - if ( output->FindEdge(id) == 0 ) + if ( output->FindEdge(id) == ITK_NULLPTR ) { output->DeletePoint(id); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDecimationQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDecimationQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDecimationQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDecimationQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,7 @@ DecimationQuadEdgeMeshFilter() { this->m_Iteration = 0; - this->m_OutputMesh = 0; + this->m_OutputMesh = ITK_NULLPTR; } ~DecimationQuadEdgeMeshFilter() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -22,7 +22,6 @@ #include "itkPriorityQueueContainer.h" #include "itkQuadEdgeMeshToQuadEdgeMeshFilter.h" #include "itkQuadEdgeMeshEulerOperatorFlipEdgeFunction.h" -#include "vcl_cmath.h" #include "vnl/vnl_math.h" namespace itk @@ -171,7 +170,7 @@ if ( den != 0. ) { - dotA /= vcl_sqrt(den); + dotA /= std::sqrt(den); } if ( dotA > 1. ) @@ -188,7 +187,7 @@ if ( den != 0. ) { - dotB /= vcl_sqrt(den); + dotB /= std::sqrt(den); } if ( dotB > 1. ) @@ -201,7 +200,7 @@ dotB = -1.; } - return ( vcl_acos(dotA) + vcl_acos(dotB) - vnl_math::pi ); + return ( std::acos(dotA) + std::acos(dotB) - vnl_math::pi ); } private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDelaunayConformingQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,7 +55,7 @@ { OutputMeshType *output = this->GetOutput(); - OutputEdgeCellType *edge = 0; + OutputEdgeCellType *edge = ITK_NULLPTR; CriterionValueType value = 0.; @@ -140,7 +140,7 @@ m_QueueMapper.erase(edge); qe = m_FlipEdge->Evaluate(qe); - if ( qe != 0 ) + if ( qe != ITK_NULLPTR ) { ++this->m_NumberOfEdgeFlips; list_qe[4] = qe; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteCurvatureQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteCurvatureQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteCurvatureQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteCurvatureQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -69,7 +69,7 @@ #endif protected: - DiscreteCurvatureQuadEdgeMeshFilter() : m_OutputMesh(0) {} + DiscreteCurvatureQuadEdgeMeshFilter() : m_OutputMesh(ITK_NULLPTR) {} virtual ~DiscreteCurvatureQuadEdgeMeshFilter() {} virtual OutputCurvatureType EstimateCurvature(const OutputPointType & iP) = 0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteGaussianCurvatureQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ OutputQEType *qe = iP.GetEdge(); - if ( qe != 0 ) + if ( qe != ITK_NULLPTR ) { OutputQEType *qe_it = qe; OutputQEType *qe_it2; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMaximumCurvatureQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMaximumCurvatureQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMaximumCurvatureQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMaximumCurvatureQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ virtual OutputCurvatureType EstimateCurvature(const OutputPointType & iP) { this->ComputeMeanAndGaussianCurvatures(iP); - return this->m_Mean + vcl_sqrt( this->ComputeDelta() ); + return this->m_Mean + std::sqrt( this->ComputeDelta() ); } private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMeanCurvatureQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMeanCurvatureQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMeanCurvatureQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMeanCurvatureQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -95,7 +95,7 @@ OutputVectorType normal; normal.Fill(0.); - if ( qe != 0 ) + if ( qe != ITK_NULLPTR ) { if ( qe != qe->GetOnext() ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMinimumCurvatureQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMinimumCurvatureQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMinimumCurvatureQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteMinimumCurvatureQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ virtual OutputCurvatureType EstimateCurvature(const OutputPointType & iP) { this->ComputeMeanAndGaussianCurvatures(iP); - return this->m_Mean - vcl_sqrt( this->ComputeDelta() ); + return this->m_Mean - std::sqrt( this->ComputeDelta() ); } private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscretePrincipalCurvaturesQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -87,7 +87,7 @@ m_Mean = 0.; m_Gaussian = 0.; - if ( qe != 0 ) + if ( qe != ITK_NULLPTR ) { OutputVectorType Laplace; Laplace.Fill(0.); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkEdgeDecimationQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,9 +23,13 @@ namespace itk { template< typename TInput, typename TOutput, typename TCriterion > -EdgeDecimationQuadEdgeMeshFilter< TInput, TOutput, - TCriterion >::EdgeDecimationQuadEdgeMeshFilter():Superclass(), - m_Relocate(true), m_CheckOrientation(false) +EdgeDecimationQuadEdgeMeshFilter< TInput, TOutput,TCriterion >:: +EdgeDecimationQuadEdgeMeshFilter() : + Superclass(), + m_Relocate(true), + m_CheckOrientation(false), + m_Element(ITK_NULLPTR) + { m_JoinVertexFunction = OperatorType::New(); m_PriorityQueue = PriorityQueueType::New(); @@ -103,7 +107,7 @@ #endif { #ifdef NDEBUG - if ( iEdge == 0 ) + if ( iEdge == ITK_NULLPTR ) { itkDebugMacro("iEdge == 0, at iteration: " << this->m_Iteration); return false; @@ -118,13 +122,13 @@ } OutputMeshPointer output = this->GetOutput(); - if ( output->FindEdge(id_org) == 0 ) + if ( output->FindEdge(id_org) == ITK_NULLPTR ) { itkDebugMacro("output->FindEdge( id_org ) == 0, at iteration: " << this->m_Iteration); return false; } - if ( iEdge->GetSym() == 0 ) + if ( iEdge->GetSym() == ITK_NULLPTR ) { itkDebugMacro("iEdge->GetSym() == 0, at iteration: " << this->m_Iteration); @@ -138,13 +142,13 @@ << this->m_Iteration); return false; } - if ( output->FindEdge(id_dest) == 0 ) + if ( output->FindEdge(id_dest) == ITK_NULLPTR ) { itkDebugMacro("output->FindEdge( id_dest ) == 0, at iteration: " << this->m_Iteration); return false; } - if ( output->FindEdge(id_org, id_dest) == 0 ) + if ( output->FindEdge(id_org, id_dest) == ITK_NULLPTR ) { itkDebugMacro("output->FindEdge( id_org, id_dest ) == 0, at iteration: " << this->m_Iteration); @@ -372,7 +376,7 @@ DeletePoint(old_id, new_id); OutputQEType *edge = this->m_OutputMesh->FindEdge(new_id); - if ( edge == 0 ) + if ( edge == ITK_NULLPTR ) { itkDebugMacro("edge == 0, at iteration " << this->m_Iteration); return false; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkNormalQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkNormalQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkNormalQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkNormalQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ { poly = dynamic_cast< OutputPolygonType * >( cell_it.Value() ); - if ( poly != 0 ) + if ( poly != ITK_NULLPTR ) { if ( poly->GetNumberOfPoints() == 3 ) { @@ -146,7 +146,7 @@ OutputPolygonType *poly = dynamic_cast< OutputPolygonType * >( outputMesh->GetCells()->GetElement(iCId) ); - if ( poly != 0 ) // this test should be removed... + if ( poly != ITK_NULLPTR ) // this test should be removed... { // this test should be removed... if ( poly->GetNumberOfPoints() == 3 ) @@ -209,7 +209,7 @@ v *= norm_v; } return static_cast< OutputVertexNormalComponentType >( - vcl_acos(u * v) ); + std::acos(u * v) ); } case AREA: { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkParameterizationQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkParameterizationQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkParameterizationQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkParameterizationQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,8 +27,8 @@ ParameterizationQuadEdgeMeshFilter< TInputMesh, TOutputMesh, TSolverTraits > ::ParameterizationQuadEdgeMeshFilter() { - this->m_CoefficientsMethod = 0; - this->m_BorderTransform = 0; + this->m_CoefficientsMethod = ITK_NULLPTR; + this->m_BorderTransform = ITK_NULLPTR; } // --------------------------------------------------------------------- diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadEdgeMeshDecimationCriteria.h 2014-09-03 08:29:34.000000000 +0000 @@ -80,7 +80,7 @@ } ~QuadEdgeMeshDecimationCriterion() {} - void PrintSelf(std::ostream & os, Indent indent) const + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "TopologicalChange: " diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadricDecimationQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadricDecimationQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadricDecimationQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkQuadricDecimationQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ p_id = it->Index(); qe = output->FindEdge(p_id); - if ( qe != 0 ) + if ( qe != ITK_NULLPTR ) { qe_it = qe; do diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSmoothingQuadEdgeMeshFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSmoothingQuadEdgeMeshFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSmoothingQuadEdgeMeshFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSmoothingQuadEdgeMeshFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ SmoothingQuadEdgeMeshFilter< TInputMesh, TOutputMesh > ::SmoothingQuadEdgeMeshFilter() { - this->m_CoefficientsMethod = 0; + this->m_CoefficientsMethod = ITK_NULLPTR; this->m_DelaunayConforming = false; this->m_NumberOfIterations = 1; this->m_RelaxationFactor = static_cast< OutputCoordType >( 1.0 ); @@ -98,7 +98,7 @@ { p = it.Value(); qe = p.GetEdge(); - if ( qe != 0 ) + if ( qe != ITK_NULLPTR ) { r = p; v.Fill(0.0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/include/itkSquaredEdgeLengthDecimationQuadEdgeMeshFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,8 +73,9 @@ SquaredEdgeLengthDecimationQuadEdgeMeshFilter(); virtual ~SquaredEdgeLengthDecimationQuadEdgeMeshFilter(); - /** - * Compute the measure value for iEdge. + // keep the start of this documentation text on very first comment line, + // it prevents a Doxygen bug + /** Compute the measure value for iEdge. * * \param[in] iEdge * \return measure value, here the squared edge length @@ -90,8 +91,9 @@ return static_cast< MeasureType >( org.SquaredEuclideanDistanceTo(dest) ); } - /** - * Calculate the position of the remaining vertex from collapsing iEdge. + // keep the start of this documentation text on very first comment line, + // it prevents a Doxygen bug + /** Calculate the position of the remaining vertex from collapsing iEdge. * * \param[in] iEdge * \return the optimal point location diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/wrapping/itkMatrixCoefficients.wrap otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/wrapping/itkMatrixCoefficients.wrap --- otb-4.0.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/wrapping/itkMatrixCoefficients.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/QuadEdgeMeshFiltering/wrapping/itkMatrixCoefficients.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,46 @@ +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) + +itk_wrap_include("itkQuadEdgeMesh.h") +itk_wrap_include("itkQuadEdgeMeshParamMatrixCoefficients.h") + +itk_wrap_class("itk::MatrixCoefficients") + foreach(d ${ITK_WRAP_DIMS}) + itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") + endforeach(d) +itk_end_wrap_class() + +itk_wrap_class("itk::OnesMatrixCoefficients") + foreach(d ${ITK_WRAP_DIMS}) + itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") + endforeach(d) +itk_end_wrap_class() + +itk_wrap_class("itk::InverseEuclideanDistanceMatrixCoefficients") + foreach(d ${ITK_WRAP_DIMS}) + itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") + endforeach(d) +itk_end_wrap_class() + +itk_wrap_class("itk::ConformalMatrixCoefficients") + foreach(d ${ITK_WRAP_DIMS}) + itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") + endforeach(d) +itk_end_wrap_class() + +itk_wrap_class("itk::AuthalicMatrixCoefficients") + foreach(d ${ITK_WRAP_DIMS}) + itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") + endforeach(d) +itk_end_wrap_class() + +itk_wrap_class("itk::IntrinsicMatrixCoefficients") + foreach(d ${ITK_WRAP_DIMS}) + itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") + endforeach(d) +itk_end_wrap_class() + +itk_wrap_class("itk::HarmonicMatrixCoefficients") + foreach(d ${ITK_WRAP_DIMS}) + itk_wrap_template("QEM${ITKM_D}${d}" "itk::QuadEdgeMesh< ${ITKT_D},${d} >") + endforeach(d) +itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -218,8 +218,7 @@ * provide an implementation for GenerateInputRequestedRegion() in * order to inform the pipeline execution model. * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkDiscreteGaussianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,6 @@ void DiscreteGaussianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkRecursiveGaussianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkRecursiveGaussianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkRecursiveGaussianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkRecursiveGaussianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -241,12 +241,12 @@ ScalarRealType & N0, ScalarRealType & N1, ScalarRealType & N2, ScalarRealType & N3, ScalarRealType & SN, ScalarRealType & DN, ScalarRealType & EN) { - ScalarRealType Sin1 = vcl_sin(W1 / sigmad); - ScalarRealType Sin2 = vcl_sin(W2 / sigmad); - ScalarRealType Cos1 = vcl_cos(W1 / sigmad); - ScalarRealType Cos2 = vcl_cos(W2 / sigmad); - ScalarRealType Exp1 = vcl_exp(L1 / sigmad); - ScalarRealType Exp2 = vcl_exp(L2 / sigmad); + ScalarRealType Sin1 = std::sin(W1 / sigmad); + ScalarRealType Sin2 = std::sin(W2 / sigmad); + ScalarRealType Cos1 = std::cos(W1 / sigmad); + ScalarRealType Cos2 = std::cos(W2 / sigmad); + ScalarRealType Exp1 = std::exp(L1 / sigmad); + ScalarRealType Exp2 = std::exp(L2 / sigmad); N0 = A1 + A2; N1 = Exp2 * ( B2 * Sin2 - ( A2 + 2 * A1 ) * Cos2 ); @@ -273,12 +273,12 @@ ScalarRealType W1, ScalarRealType L1, ScalarRealType W2, ScalarRealType L2, ScalarRealType & SD, ScalarRealType & DD, ScalarRealType & ED) { - // const ScalarRealType Sin1 = vcl_sin(W1 / sigmad); - // const ScalarRealType Sin2 = vcl_sin(W2 / sigmad); - const ScalarRealType Cos1 = vcl_cos(W1 / sigmad); - const ScalarRealType Cos2 = vcl_cos(W2 / sigmad); - const ScalarRealType Exp1 = vcl_exp(L1 / sigmad); - const ScalarRealType Exp2 = vcl_exp(L2 / sigmad); + // const ScalarRealType Sin1 = std::sin(W1 / sigmad); + // const ScalarRealType Sin2 = std::sin(W2 / sigmad); + const ScalarRealType Cos1 = std::cos(W1 / sigmad); + const ScalarRealType Cos2 = std::cos(W2 / sigmad); + const ScalarRealType Exp1 = std::exp(L1 / sigmad); + const ScalarRealType Exp2 = std::exp(L2 / sigmad); this->m_D4 = Exp1 * Exp1 * Exp2 * Exp2; this->m_D3 = -2 * Cos1 * Exp1 * Exp2 * Exp2; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -163,8 +163,7 @@ * an implementation for GenerateInputRequestedRegion in order to inform * the pipeline execution model. * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); // Override since the filter produces the entire dataset void EnlargeOutputRequestedRegion(DataObject *output); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Smoothing/include/itkSmoothingRecursiveGaussianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -184,7 +184,6 @@ void SmoothingRecursiveGaussianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // Call the superclass' implementation of this method. This should // copy the output requested region to the input requested region. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/SpatialFunction/include/itkSpatialFunctionImageEvaluatorFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/SpatialFunction/include/itkSpatialFunctionImageEvaluatorFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/SpatialFunction/include/itkSpatialFunctionImageEvaluatorFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/SpatialFunction/include/itkSpatialFunctionImageEvaluatorFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ itkDebugMacro(<< "SpatialFunctionImageEvaluatorFilter::SpatialFunctionImageEvaluatorFilter() called"); // Set the internal function to null - this->m_PixelFunction = 0; + this->m_PixelFunction = ITK_NULLPTR; } template< typename TSpatialFunction, typename TInputImage, typename TOutputImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdCalculator.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -75,7 +75,7 @@ { if ( this->GetNumberOfInputs() < 1 ) { - return 0; + return ITK_NULLPTR; } return static_cast< const HistogramType * >( this->ProcessObject::GetInput(0) ); } @@ -84,13 +84,13 @@ { if ( this->GetNumberOfOutputs() < 1 ) { - return 0; + return ITK_NULLPTR; } return static_cast< DecoratedOutputType * >( this->ProcessObject::GetOutput(0) ); } using Superclass::MakeOutput; - virtual typename DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType) + virtual typename DataObject::Pointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE { return DecoratedOutputType::New().GetPointer(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -163,7 +163,7 @@ itkGetConstMacro(NumberOfHistogramBins, unsigned int); /** Does histogram generator compute min and max from data? - * Default is false for all but char types */ + * Default is true for all but char types */ itkSetMacro(AutoMinimumMaximum, bool); itkGetConstMacro(AutoMinimumMaximum, bool); itkBooleanMacro(AutoMinimumMaximum); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHistogramThresholdImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,10 +38,12 @@ m_InsideValue = NumericTraits::max(); m_Threshold = NumericTraits::Zero; m_MaskValue = NumericTraits::max(); - m_Calculator = NULL; + m_Calculator = ITK_NULLPTR; m_MaskOutput = true; - if( typeid(ValueType) == typeid(signed char) || typeid(ValueType) == typeid(unsigned char) ) + if( typeid(ValueType) == typeid(signed char) + || typeid(ValueType) == typeid(unsigned char) + || typeid(ValueType) == typeid(char)) { m_AutoMinimumMaximum = false; } @@ -132,7 +134,7 @@ this->GraftOutput( thresholder->GetOutput() ); } m_Threshold = m_Calculator->GetThreshold(); - m_Calculator->SetInput( NULL ); + m_Calculator->SetInput( ITK_NULLPTR ); } template @@ -158,12 +160,15 @@ << static_cast::PrintType>(m_OutsideValue) << std::endl; os << indent << "InsideValue: " << static_cast::PrintType>(m_InsideValue) << std::endl; - os << indent << "Calculator: "; - m_Calculator->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( Calculator ); + os << indent << "AutoMinimumMaximim: " << m_AutoMinimumMaximum << std::endl; os << indent << "Threshold (computed): " << static_cast::PrintType>(m_Threshold) << std::endl; os << indent << "Mask image in use: " << (bool)(this->GetMaskImage() ) << std::endl; os << indent << "Masking of output: " << this->GetMaskOutput() << std::endl; + os << indent << "MaskValue: " << static_cast::PrintType>(m_MaskValue) << std::endl; + + itkPrintSelfObjectMacro(Calculator); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkHuangThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -87,7 +87,7 @@ for( size_t i = 1; i < Smu.size(); i++) { double mu = 1. / ( 1. + static_cast< double >( i ) / C ); - Smu[i] = -mu * vcl_log( mu ) - (1. - mu) * vcl_log( 1. - mu ); + Smu[i] = -mu * std::log( mu ) - (1. - mu) * std::log( 1. - mu ); } // calculate the threshold diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkKittlerIllingworthThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkKittlerIllingworthThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkKittlerIllingworthThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkKittlerIllingworthThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -180,7 +180,7 @@ //The terms of the quadratic equation to be solved. double w0 = 1.0/sigma2-1.0/tau2; double w1 = mu/sigma2-nu/tau2; - double w2 = (mu*mu)/sigma2 - (nu*nu)/tau2 + vcl_log10((sigma2*(q*q))/(tau2*p*p)); + double w2 = (mu*mu)/sigma2 - (nu*nu)/tau2 + std::log10((sigma2*(q*q))/(tau2*p*p)); //If the next threshold would be imaginary, return with the current one. double sqterm = (w1*w1)-w0*w2; @@ -212,7 +212,7 @@ { //The updated threshold is the integer part of the solution of the quadratic equation. Tprev = threshold; - double temp = (w1+vcl_sqrt(sqterm))/w0; + double temp = (w1+std::sqrt(sqterm))/w0; // not sure if this condition is really useful if (vnl_math_isnan(temp)) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkLiThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkLiThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkLiThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkLiThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -111,7 +111,7 @@ // //#define IS_NEG( x ) ( ( x ) < -DBL_EPSILON ) //DBL_EPSILON = 2.220446049250313E-16 - temp = ( mean_back - mean_obj ) / ( vcl_log ( mean_back ) - vcl_log ( mean_obj ) ); + temp = ( mean_back - mean_obj ) / ( std::log ( mean_back ) - std::log ( mean_obj ) ); if (temp < -2.220446049250313E-16) new_thresh = (int) (temp - 0.5); @@ -120,7 +120,7 @@ /* Stop the iterations when the difference between the new and old threshold values is less than the tolerance */ } - while ( vcl_abs ( new_thresh - old_thresh ) > tolerance ); + while ( std::abs ( new_thresh - old_thresh ) > tolerance ); this->GetOutput()->Set( static_cast( histogram->GetMeasurement( histthresh, 0 ) ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMaximumEntropyThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMaximumEntropyThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMaximumEntropyThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMaximumEntropyThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -82,7 +82,7 @@ first_bin=0; for (ih = 0; (unsigned)ih < size; ih++ ) { - if ( !(vcl_abs(P1[ih])= first_bin; ih-- ) { - if ( !(vcl_abs(P2[ih])GetFrequency(ih, 0) != 0 ) { - ent_back -= ( norm_histo[ih] / P1[it] ) * vcl_log ( norm_histo[ih] / P1[it] ); + ent_back -= ( norm_histo[ih] / P1[it] ) * std::log ( norm_histo[ih] / P1[it] ); } } @@ -122,7 +122,7 @@ { if (histogram->GetFrequency(ih, 0) != 0) { - ent_obj -= ( norm_histo[ih] / P2[it] ) * vcl_log ( norm_histo[ih] / P2[it] ); + ent_obj -= ( norm_histo[ih] / P2[it] ) * std::log ( norm_histo[ih] / P2[it] ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMomentsThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMomentsThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMomentsThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkMomentsThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -74,8 +74,8 @@ cd = m0 * m2 - m1 * m1; c0 = ( -m2 * m2 + m1 * m3 ) / cd; c1 = ( m0 * -m3 + m2 * m1 ) / cd; - z0 = 0.5 * ( -c1 - vcl_sqrt ( c1 * c1 - 4.0 * c0 ) ); - z1 = 0.5 * ( -c1 + vcl_sqrt ( c1 * c1 - 4.0 * c0 ) ); + z0 = 0.5 * ( -c1 - std::sqrt ( c1 * c1 - 4.0 * c0 ) ); + z1 = 0.5 * ( -c1 + std::sqrt ( c1 * c1 - 4.0 * c0 ) ); p0 = ( z1 - m1 ) / ( z1 - z0 ); /* Fraction of the object pixels in the target binary image */ // The threshold is the gray-level closest diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuMultipleThresholdsCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,6 +18,7 @@ #ifndef __itkOtsuMultipleThresholdsCalculator_hxx #define __itkOtsuMultipleThresholdsCalculator_hxx +#include "itkMath.h" #include "itkOtsuMultipleThresholdsCalculator.h" namespace itk @@ -53,11 +54,8 @@ { typename TInputHistogram::ConstPointer histogram = this->GetInputHistogram(); - SizeValueType numberOfHistogramBins = histogram->Size(); - SizeValueType numberOfClasses = classMean.size(); - - MeanType meanOld; - FrequencyType freqOld; + const SizeValueType numberOfHistogramBins = histogram->Size(); + const SizeValueType numberOfClasses = classMean.size(); unsigned int k; int j; @@ -73,8 +71,8 @@ // threshold ++thresholdIndexes[j]; - meanOld = classMean[j]; - freqOld = classFrequency[j]; + const MeanType meanOld = classMean[j]; + const FrequencyType freqOld = classFrequency[j]; classFrequency[j] += histogram->GetFrequency(thresholdIndexes[j]); @@ -165,7 +163,7 @@ typename TInputHistogram::ConstIterator end = histogram->End(); MeanType globalMean = NumericTraits< MeanType >::Zero; - FrequencyType globalFrequency = histogram->GetTotalFrequency(); + const FrequencyType globalFrequency = histogram->GetTotalFrequency(); while ( iter != end ) { globalMean += static_cast< MeanType >( iter.GetMeasurementVector()[0] ) @@ -232,12 +230,29 @@ classMean[numberOfClasses - 1] = NumericTraits< MeanType >::Zero; } + // + // The "volatile" modifier is used here for preventing the variable from + // being kept in 80 bit FPU registers when using 32-bit x86 processors with + // SSE instructions disabled. A case that arised in the Debian 32-bits + // distribution. + // +#ifndef ITK_COMPILER_SUPPORTS_SSE2_32 + volatile VarianceType maxVarBetween = NumericTraits< VarianceType >::Zero; +#else VarianceType maxVarBetween = NumericTraits< VarianceType >::Zero; +#endif + // + // The introduction of the "volatile" modifier forces the compiler to keep + // the variable in memory and therefore store it in the IEEE float/double + // format. In this way making numerical results consistent across platforms. + // + for ( j = 0; j < numberOfClasses; j++ ) { - maxVarBetween += (static_cast< VarianceType >( classFrequency[j] ) / static_cast< VarianceType >( globalFrequency )) + maxVarBetween += (static_cast< VarianceType >( classFrequency[j] )) * static_cast< VarianceType >( ( classMean[j] ) * ( classMean[j] ) ); } + maxVarBetween /= static_cast< VarianceType >( globalFrequency ); // Sum the relevant weights for valley emphasis WeightType valleyEmphasisFactor = NumericTraits< WeightType >::Zero; @@ -255,7 +270,24 @@ // yields maximum between-class variance while ( Self::IncrementThresholds(thresholdIndexes, globalMean, classMean, classFrequency) ) { + + // + // The "volatile" modifier is used here for preventing the variable from + // being kept in 80 bit FPU registers when using 32-bit x86 processors with + // SSE instructions disabled. A case that arised in the Debian 32-bits + // distribution. + // +#ifndef ITK_COMPILER_SUPPORTS_SSE2_32 + volatile VarianceType varBetween = NumericTraits< VarianceType >::Zero; +#else VarianceType varBetween = NumericTraits< VarianceType >::Zero; +#endif + // + // The introduction of the "volatile" modifier forces the compiler to keep + // the variable in memory and therefore store it in the IEEE float/double + // format. In this way making numerical results consistent across platforms. + // + for ( j = 0; j < numberOfClasses; j++ ) { // The true between-class variance \sigma_B^2 for any number of classes is defined as: @@ -270,9 +302,10 @@ // Since we are looking for the argmax, the second term can be ignored because it is a constant, leading to the simpler // (\sum_{k=1}^{M} \omega_k \mu_k^2), which is what is implemented here. // Although this is no longer truly a "between class variance", we keep that name since it is only different by a constant. - varBetween += (static_cast< VarianceType >( classFrequency[j] ) / static_cast< VarianceType >( globalFrequency )) + varBetween += (static_cast< VarianceType >( classFrequency[j] )) * static_cast< VarianceType >( ( classMean[j] ) * ( classMean[j] ) ); } + varBetween /= static_cast< VarianceType >( globalFrequency ); if (m_ValleyEmphasis) { @@ -286,7 +319,9 @@ varBetween = varBetween * valleyEmphasisFactor; } - if ( varBetween > maxVarBetween ) + const unsigned int maxUlps = 1; + if ( varBetween > maxVarBetween && + !Math::FloatAlmostEqual( maxVarBetween, varBetween, maxUlps) ) { maxVarBetween = varBetween; maxVarThresholdIndexes = thresholdIndexes; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.h otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.h --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,6 +72,7 @@ m_OtsuMultipleThresholdsCalculator = OtsuMultipleThresholdsCalculator::New(); } virtual ~OtsuThresholdCalculator() {}; + void PrintSelf(std::ostream & os, Indent indent) const; void GenerateData(void); private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkOtsuThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,6 +36,18 @@ this->GetOutput()->Set( static_cast( m_OtsuMultipleThresholdsCalculator->GetOutput()[0] ) ); this->UpdateProgress(1.0); } + + +template< typename THistogram, typename TOutput > +void +OtsuThresholdCalculator< THistogram, TOutput > +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + itkPrintSelfObjectMacro(OtsuMultipleThresholdsCalculator); +} + } // end namespace itk #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkRenyiEntropyThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ m_FirstBin=0; for(ih = 0; ih < m_Size; ih++ ) { - if( !( vcl_abs( P1[ih] ) < tolerance ) ) + if( !( std::abs( P1[ih] ) < tolerance ) ) { m_FirstBin = ih; break; @@ -84,7 +84,7 @@ m_LastBin = static_cast< InstanceIdentifier >( m_Size - 1 ); for(ih = m_Size - 1; ih >= m_FirstBin; ih-- ) { - if( !( vcl_abs( P2[ih] ) < tolerance ) ) + if( !( std::abs( P2[ih] ) < tolerance ) ) { m_LastBin = ih; break; @@ -123,9 +123,9 @@ // Adjust beta values // note t_star1, t_star2, t_star3 are unsigned - if( vcl_abs( static_cast< double >( t_star1 ) - static_cast< double >( t_star2 ) ) <= 5. ) + if( std::abs( static_cast< double >( t_star1 ) - static_cast< double >( t_star2 ) ) <= 5. ) { - if( vcl_abs( static_cast< double >( t_star2 ) - static_cast< double >( t_star3 ) ) <= 5. ) + if( std::abs( static_cast< double >( t_star2 ) - static_cast< double >( t_star3 ) ) <= 5. ) { beta1 = 1.; beta2 = 2.; @@ -140,7 +140,7 @@ } else { - if( vcl_abs( static_cast< double >( t_star2 ) - static_cast< double >( t_star3 ) ) <= 5. ) + if( std::abs( static_cast< double >( t_star2 ) - static_cast< double >( t_star3 ) ) <= 5. ) { beta1 = 3.; beta2 = 1.; @@ -194,7 +194,7 @@ if( histogram->GetFrequency(ih, 0) != NumericTraits< AbsoluteFrequencyType >::Zero ) { double x = ( normHisto[ih] / P1[it] ); - ent_back -= x * vcl_log ( x ); + ent_back -= x * std::log ( x ); } } @@ -205,7 +205,7 @@ if( histogram->GetFrequency(ih, 0) != NumericTraits< AbsoluteFrequencyType >::Zero ) { double x = ( normHisto[ih] / P2[it] ); - ent_obj -= x * vcl_log( x ); + ent_obj -= x * std::log( x ); } } @@ -243,14 +243,14 @@ double ent_back = 0.0; for( InstanceIdentifier ih = 0; ih <= it; ih++ ) { - ent_back += vcl_sqrt( normHisto[ih] / P1[it] ); + ent_back += std::sqrt( normHisto[ih] / P1[it] ); } /* Entropy of the object pixels */ double ent_obj = 0.0; for( InstanceIdentifier ih = it + 1; ih < m_Size; ih++ ) { - ent_obj += vcl_sqrt( normHisto[ih] / P2[it] ); + ent_obj += std::sqrt( normHisto[ih] / P2[it] ); } /* Total entropy */ @@ -259,7 +259,7 @@ if( product > 0.0 ) { - tot_ent = term * vcl_log( ent_back * ent_obj ); + tot_ent = term * std::log( ent_back * ent_obj ); } if( tot_ent > max_ent ) @@ -307,7 +307,7 @@ double product = ent_back * ent_obj; if( product > 0.0 ) { - tot_ent = term * vcl_log( product ); + tot_ent = term * std::log( product ); } if( tot_ent > max_ent ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkShanbhagThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkShanbhagThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkShanbhagThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkShanbhagThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ first_bin=0; for (ih = 0; (unsigned)ih < size; ih++ ) { - if ( !(vcl_abs(P1[ih])= first_bin; ih-- ) { - if ( !(vcl_abs(P2[ih])= and <=. * * \ingroup IntensityImageFilters MultiThreaded diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkThresholdImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -71,7 +71,7 @@ } /** - * The values greater than or equal to the value are set to OutsideValue + * The values greater than the threshold value are set to OutsideValue */ template< typename TImage > void @@ -88,7 +88,7 @@ } /** - * The values less than or equal to the value are set to OutsideValue + * The values less than the threshold value are set to OutsideValue */ template< typename TImage > void @@ -104,7 +104,7 @@ } /** - * The values outside the range are set to OutsideValue + * The values outside the threshold range (less than lower or greater than upper) are set to OutsideValue */ template< typename TImage > void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkYenThresholdCalculator.hxx otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkYenThresholdCalculator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkYenThresholdCalculator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Filtering/Thresholding/include/itkYenThresholdCalculator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -86,7 +86,7 @@ max_crit = itk::NumericTraits::NonpositiveMin(); for ( it = 0; (unsigned)it < size; it++ ) { - crit = -1.0 * (( P1_sq[it] * P2_sq[it] )> 0.0? vcl_log( P1_sq[it] * P2_sq[it]):0.0) + 2 * ( ( P1[it] * ( 1.0 - P1[it] ) )>0.0? vcl_log( P1[it] * ( 1.0 - P1[it] ) ): 0.0); + crit = -1.0 * (( P1_sq[it] * P2_sq[it] )> 0.0? std::log( P1_sq[it] * P2_sq[it]):0.0) + 2 * ( ( P1[it] * ( 1.0 - P1[it] ) )>0.0? std::log( P1[it] * ( 1.0 - P1[it] ) ): 0.0); if ( crit > max_crit ) { max_crit = crit; diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkArchetypeSeriesFileNames.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkArchetypeSeriesFileNames.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkArchetypeSeriesFileNames.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkArchetypeSeriesFileNames.h 2014-09-03 08:29:34.000000000 +0000 @@ -104,7 +104,7 @@ protected: ArchetypeSeriesFileNames(); ~ArchetypeSeriesFileNames() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Method that actually does the archetype matching/grouping */ void Scan(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileReader.hxx otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileReader.hxx --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileReader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileReader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ ImageFileReader< TOutputImage, ConvertPixelTraits > ::ImageFileReader() { - m_ImageIO = 0; + m_ImageIO = ITK_NULLPTR; this->SetFileName(""); m_UserSpecifiedImageIO = false; m_UseStreaming = true; @@ -51,15 +51,7 @@ { Superclass::PrintSelf(os, indent); - if ( m_ImageIO ) - { - os << indent << "ImageIO: \n"; - m_ImageIO->Print( os, indent.GetNextIndent() ); - } - else - { - os << indent << "ImageIO: (null)" << "\n"; - } + itkPrintSelfObjectMacro( ImageIO ); os << indent << "UserSpecifiedImageIO flag: " << m_UserSpecifiedImageIO << "\n"; os << indent << "m_UseStreaming: " << m_UseStreaming << "\n"; @@ -120,7 +112,7 @@ if ( m_ImageIO.IsNull() ) { std::ostringstream msg; - msg << " Could not create IO object for file " + msg << " Could not create IO object for reading file " << this->GetFileName().c_str() << std::endl; if ( m_ExceptionMessage.size() ) { @@ -128,17 +120,25 @@ } else { - msg << " Tried to create one of the following:" << std::endl; std::list< LightObject::Pointer > allobjects = ObjectFactoryBase::CreateAllInstance("itkImageIOBase"); - for ( std::list< LightObject::Pointer >::iterator i = allobjects.begin(); - i != allobjects.end(); ++i ) + if (allobjects.size() > 0) + { + msg << " Tried to create one of the following:" << std::endl; + for ( std::list< LightObject::Pointer >::iterator i = allobjects.begin(); + i != allobjects.end(); ++i ) + { + ImageIOBase *io = dynamic_cast< ImageIOBase * >( i->GetPointer() ); + msg << " " << io->GetNameOfClass() << std::endl; + } + msg << " You probably failed to set a file suffix, or" << std::endl; + msg << " set the suffix to an unsupported type." << std::endl; + } + else { - ImageIOBase *io = dynamic_cast< ImageIOBase * >( i->GetPointer() ); - msg << " " << io->GetNameOfClass() << std::endl; + msg << " There are no registered IO factories." << std::endl; + msg << " Please visit http://www.itk.org/Wiki/ITK/FAQ#NoFactoryException to diagnose the problem." << std::endl; } - msg << " You probably failed to set a file suffix, or" << std::endl; - msg << " set the suffix to an unsupported type." << std::endl; } ImageFileReaderException e(__FILE__, __LINE__, msg.str().c_str(), ITK_LOCATION); throw e; @@ -382,7 +382,7 @@ itkDebugMacro (<< "Setting imageIO IORegion to: " << m_ActualIORegion); m_ImageIO->SetIORegion(m_ActualIORegion); - char *loadBuffer = 0; + char *loadBuffer = ITK_NULLPTR; // the size of the buffer is computed based on the actual number of // pixels to be read and the actual size of the pixels to be read // (as opposed to the sizes of the output) @@ -452,7 +452,7 @@ // clean up delete[] loadBuffer; - loadBuffer = 0; + loadBuffer = ITK_NULLPTR; // then rethrow throw; @@ -460,7 +460,7 @@ // clean up delete[] loadBuffer; - loadBuffer = 0; + loadBuffer = ITK_NULLPTR; } template< typename TOutputImage, typename ConvertPixelTraits > diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.h 2014-09-03 08:29:34.000000000 +0000 @@ -161,7 +161,7 @@ /** Aliased to the Write() method to be consistent with the rest of the * pipeline. */ - virtual void Update() + virtual void Update() ITK_OVERRIDE { this->Write(); } @@ -171,7 +171,7 @@ * Updates the pipeline, streaming it the NumberOfStreamDivisions times. * Existing PasteIORegion is reset. */ - virtual void UpdateLargestPossibleRegion() + virtual void UpdateLargestPossibleRegion() ITK_OVERRIDE { m_PasteIORegion = ImageIORegion(TInputImage::ImageDimension); m_UserSpecifiedIORegion = false; @@ -196,10 +196,10 @@ protected: ImageFileWriter(); ~ImageFileWriter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Does the real work. */ - void GenerateData(void); + virtual void GenerateData(void) ITK_OVERRIDE; private: ImageFileWriter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.hxx otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.hxx --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageFileWriter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -111,7 +111,7 @@ itkDebugMacro(<< "Writing an image file"); // Make sure input is available - if ( input == 0 ) + if ( input == ITK_NULLPTR ) { itkExceptionMacro(<< "No input to writer!"); } @@ -150,21 +150,27 @@ { ImageFileWriterException e(__FILE__, __LINE__); std::ostringstream msg; - msg << " Could not create IO object for file " + std::list< LightObject::Pointer > allobjects = + ObjectFactoryBase::CreateAllInstance("itkImageIOBase"); + msg << " Could not create IO object for writing file " << m_FileName.c_str() << std::endl; - msg << " Tried to create one of the following:" << std::endl; + if (allobjects.size() > 0) { - std::list< LightObject::Pointer > allobjects = - ObjectFactoryBase::CreateAllInstance("itkImageIOBase"); + msg << " Tried to create one of the following:" << std::endl; for ( std::list< LightObject::Pointer >::iterator i = allobjects.begin(); i != allobjects.end(); ++i ) { ImageIOBase *io = dynamic_cast< ImageIOBase * >( i->GetPointer() ); msg << " " << io->GetNameOfClass() << std::endl; } + msg << " You probably failed to set a file suffix, or" << std::endl; + msg << " set the suffix to an unsupported type." << std::endl; + } + else + { + msg << " There are no registered IO factories." << std::endl; + msg << " Please visit http://www.itk.org/Wiki/ITK/FAQ#NoFactoryException to diagnose the problem." << std::endl; } - msg << " You probably failed to set a file suffix, or" << std::endl; - msg << " set the suffix to an unsupported type." << std::endl; e.SetDescription( msg.str().c_str() ); e.SetLocation(ITK_LOCATION); throw e; @@ -237,14 +243,14 @@ if ( strcmp(input->GetNameOfClass(), "VectorImage") == 0 ) { typedef typename InputImageType::InternalPixelType VectorImageScalarType; - m_ImageIO->SetPixelTypeInfo(static_cast(0)); + m_ImageIO->SetPixelTypeInfo(static_cast(ITK_NULLPTR)); typedef typename InputImageType::AccessorFunctorType AccessorFunctorType; m_ImageIO->SetNumberOfComponents( AccessorFunctorType::GetVectorLength(input) ); } else { // Set the pixel and component type; the number of components. - m_ImageIO->SetPixelTypeInfo(static_cast(0)); + m_ImageIO->SetPixelTypeInfo(static_cast(ITK_NULLPTR)); } // Setup the image IO for writing. diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageIOBase.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageIOBase.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageIOBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageIOBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,9 @@ #include "itkImageRegionSplitterBase.h" #include "vnl/vnl_vector.h" +#include "vcl_compiler.h" +#include #include namespace itk @@ -523,7 +525,7 @@ protected: ImageIOBase(); ~ImageIOBase(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; virtual const ImageRegionSplitterBase* GetImageRegionSplitter(void) const; @@ -613,6 +615,38 @@ * next slice. Returns m_Strides[3]. */ SizeType GetSliceStride() const; + /** \brief Opens a file for reading and random access + * + * \param[out] inputStream is an istream presumed to be opened for reading + * \param[in] filename is the name of the file + * \param[in] ascii optional (default is false); + * if true than the file will be opened in ASCII mode, + * which generally only applies to Windows + * + * The stream is closed if it's already opened. If an error is + * encountered than an exception will be thrown. + */ + virtual void OpenFileForReading(std::ifstream & inputStream, const std::string & filename, + bool ascii = false); + + /** \brief Opens a file for writing and random access + * + * \param[out] outputStream is an ostream presumed to be opened for writing + * \param[in] filename is the name of the file + * \param[in] truncate optional (default is true); + * if true than the file's existing content is truncated, + * if false than the file is opened for reading and + * writing with existing content intact + * \param[in] ascii optional (default is false); + * if true than the file will be opened in ASCII mode, + * which generally only applies to Windows + * + * The stream is closed if it's already opened. If an error is + * encountered than an exception will be thrown. + */ + virtual void OpenFileForWriting(std::ofstream & outputStream, const std::string & filename, + bool truncate = true, bool ascii = false); + /** Convenient method to write a buffer as ASCII text. */ virtual void WriteBufferAsASCII(std::ostream & os, const void *buffer, IOComponentType ctype, @@ -657,6 +691,10 @@ static const IOComponentType CType = ctype; \ } +// the following typemaps are not platform independent +#if VCL_CHAR_IS_SIGNED +IMAGEIOBASE_TYPEMAP(signed char, CHAR); +#endif // VCL_CHAR_IS_SIGNED IMAGEIOBASE_TYPEMAP(char, CHAR); IMAGEIOBASE_TYPEMAP(unsigned char, UCHAR); IMAGEIOBASE_TYPEMAP(short, SHORT); diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.h 2014-09-03 08:29:34.000000000 +0000 @@ -155,8 +155,13 @@ itkBooleanMacro(UseStreaming); protected: - ImageSeriesReader():m_ImageIO(0), m_ReverseOrder(false), - m_UseStreaming(true), m_MetaDataDictionaryArrayUpdate(true) {} + ImageSeriesReader() : + m_ImageIO(ITK_NULLPTR), + m_ReverseOrder(false), + m_NumberOfDimensionsInImage(0), + m_UseStreaming(true), + m_MetaDataDictionaryArrayUpdate(true) + {} ~ImageSeriesReader(); void PrintSelf(std::ostream & os, Indent indent) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.hxx otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.hxx --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesReader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,15 +55,7 @@ os << indent << "ReverseOrder: " << m_ReverseOrder << std::endl; os << indent << "UseStreaming: " << m_UseStreaming << std::endl; - if ( m_ImageIO ) - { - os << indent << "ImageIO: \n"; - m_ImageIO->Print( os, indent.GetNextIndent() ); - } - else - { - os << indent << "ImageIO: (null)" << "\n"; - } + itkPrintSelfObjectMacro( ImageIO ); os << indent << "MetaDataDictionaryArrayMTime: " << m_MetaDataDictionaryArrayMTime << std::endl; os << indent << "MetaDataDictionaryArrayUpdate: " << m_MetaDataDictionaryArrayUpdate << std::endl; @@ -231,7 +223,7 @@ { interSliceSpacing += vnl_math_sqr(position2[j] - position1[j]); } - interSliceSpacing = static_cast< float >( vcl_sqrt(interSliceSpacing) ); + interSliceSpacing = static_cast< float >( std::sqrt(interSliceSpacing) ); if ( interSliceSpacing == 0.0f ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.h 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,7 @@ /** Aliased to the Write() method to be consistent with the rest of the * pipeline. */ - virtual void Update() + virtual void Update() ITK_OVERRIDE { this->Write(); } @@ -200,10 +200,10 @@ protected: ImageSeriesWriter(); ~ImageSeriesWriter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Does the real work. */ - void GenerateData(void); + virtual void GenerateData(void) ITK_OVERRIDE; /** Transition method used for DEPRECATING old functionality. * This method should be removed after release ITK 1.8 */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkImageSeriesWriter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,9 +34,9 @@ template< typename TInputImage, typename TOutputImage > ImageSeriesWriter< TInputImage, TOutputImage > ::ImageSeriesWriter(): - m_ImageIO(0), m_UserSpecifiedImageIO(false), + m_ImageIO(ITK_NULLPTR), m_UserSpecifiedImageIO(false), m_SeriesFormat("%d"), - m_StartIndex(1), m_IncrementIndex(1), m_MetaDataDictionaryArray(NULL) + m_StartIndex(1), m_IncrementIndex(1), m_MetaDataDictionaryArray(ITK_NULLPTR) { m_UseCompression = false; } @@ -87,7 +87,7 @@ itkDebugMacro(<< "Writing an image file"); // Make sure input is available - if ( inputImage == 0 ) + if ( inputImage == ITK_NULLPTR ) { itkExceptionMacro(<< "No input to writer!"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkNumericSeriesFileNames.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkNumericSeriesFileNames.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkNumericSeriesFileNames.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkNumericSeriesFileNames.h 2014-09-03 08:29:34.000000000 +0000 @@ -96,7 +96,7 @@ protected: NumericSeriesFileNames(); ~NumericSeriesFileNames() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: NumericSeriesFileNames(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkRegularExpressionSeriesFileNames.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkRegularExpressionSeriesFileNames.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkRegularExpressionSeriesFileNames.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkRegularExpressionSeriesFileNames.h 2014-09-03 08:29:34.000000000 +0000 @@ -115,7 +115,7 @@ m_RegularExpression(".*\\.([0-9]+)") {} ~RegularExpressionSeriesFileNames() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: RegularExpressionSeriesFileNames(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkStreamingImageIOBase.h otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkStreamingImageIOBase.h --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/include/itkStreamingImageIOBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/include/itkStreamingImageIOBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -63,18 +63,18 @@ // see super class for documentation // // overidden to return true - virtual bool CanStreamWrite(void); + virtual bool CanStreamWrite(void) ITK_OVERRIDE; // see super class for documentation // // overidden to return true - virtual bool CanStreamRead(void); + virtual bool CanStreamRead(void) ITK_OVERRIDE; // see super class for documentation // // If UseStreamedReading is true, then returned region is the // requested region parameter. - virtual ImageIORegion GenerateStreamableReadRegionFromRequestedRegion(const ImageIORegion & requested) const; + virtual ImageIORegion GenerateStreamableReadRegionFromRequestedRegion(const ImageIORegion & requested) const ITK_OVERRIDE; // see super class for documentation // @@ -82,12 +82,12 @@ // GetActualNumberOfSplitsForWritingCanStreamWrite virtual unsigned int GetActualNumberOfSplitsForWriting(unsigned int numberOfRequestedSplits, const ImageIORegion & pasteRegion, - const ImageIORegion & largestPossibleRegion); + const ImageIORegion & largestPossibleRegion) ITK_OVERRIDE; protected: StreamingImageIOBase(); // virtual ~StreamingImageIOBase(); not needed - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** \brief Returns true if GetIORegion is not the same size as the * largest region give by GetNumberOfDimensions. @@ -152,24 +152,6 @@ */ virtual SizeType GetDataPosition(void) const { return this->GetHeaderSize(); } - /** \brief Opens a file for reading and random access - * - * The stream is closed if it's already opened. If an error is - * encountered then an exception will be thrown. - */ - virtual void OpenFileForReading(std::ifstream & os, const char *filename); - - /** \brief Opens a file for writing and random access - * - * \param os is an ostream presumed to be opened for writing - * \param filename is the name of the file - * \param truncate if true then the file is truncated - * - * The stream is closed if it's already opened. If an error is - * encountered then an exception will be thrown. - */ - virtual void OpenFileForWriting(std::ofstream & os, const char *filename, bool truncate); - private: StreamingImageIOBase(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOBase.cxx otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,6 +21,8 @@ #include "itkSimpleFastMutexLock.h" #include "itkMutexLockHolder.h" +#include "itksys/SystemTools.hxx" + namespace itk { ImageIOBase::ImageIOBase(): @@ -78,7 +80,7 @@ const unsigned int *dimensions) { m_NumberOfDimensions = numDimensions; - if ( dimensions != NULL ) + if ( dimensions != ITK_NULLPTR ) { for ( unsigned int i = 0; i < m_NumberOfDimensions; i++ ) { @@ -162,7 +164,8 @@ this->Modified(); std::vector< double > v; v.resize( m_Direction.size() ); - for ( unsigned int j = 0; j < v.size(); j++ ) + // Note: direction.size() <= v.size(). + for ( unsigned int j = 0; j < direction.size(); j++ ) { v[j] = direction[j]; } @@ -197,7 +200,6 @@ default: itkExceptionMacro ("Unknown component type: " << m_ComponentType); } - return typeid( ImageIOBase::UnknownType ); } void ImageIOBase::ComputeStrides() @@ -331,7 +333,6 @@ { itkExceptionMacro ("Unknown pixel or component type: (" << m_PixelType << ", " << m_ComponentType << ")"); - return 0; } return this->GetComponentSize() * this->GetNumberOfComponents(); @@ -365,8 +366,6 @@ default: itkExceptionMacro ("Unknown component type: " << m_ComponentType); } - - return 0; } std::string ImageIOBase::GetFileTypeAsString(FileType t) const @@ -556,6 +555,94 @@ } } +void ImageIOBase::OpenFileForReading(std::ifstream & inputStream, const std::string & filename, + bool ascii) +{ + // Make sure that we have a file to + if ( filename.empty() ) + { + itkExceptionMacro( << "A FileName must be specified." ); + } + + // Close file from any previous image + if ( inputStream.is_open() ) + { + inputStream.close(); + } + + // Open the new file for reading + itkDebugMacro( << "Opening file for reading: " << filename ); + + std::ios::openmode mode = std::ios::in; + if ( !ascii ) + { + mode |= std::ios::binary; + } + + inputStream.open( filename.c_str(), mode ); + + if ( !inputStream.is_open() || inputStream.fail() ) + { + itkExceptionMacro( << "Could not open file: " + << filename << " for reading." + << std::endl + << "Reason: " + << itksys::SystemTools::GetLastSystemError() ); + } +} + +void ImageIOBase::OpenFileForWriting(std::ofstream & outputStream, const std::string & filename, + bool truncate, bool ascii) +{ + // Make sure that we have a file to + if ( filename.empty() ) + { + itkExceptionMacro( << "A FileName must be specified." ); + } + + // Close file from any previous image + if ( outputStream.is_open() ) + { + outputStream.close(); + } + + // Open the new file for writing + itkDebugMacro( << "Opening file for writing: " << filename ); + + std::ios::openmode mode = std::ios::out; + if ( truncate ) + { + // typically, ios::out also implies ios::trunc, but being explicit is safer + mode |= std::ios::trunc; + } + else + { + mode |= std::ios::in; + // opening a nonexistent file for reading + writing is not allowed on some platforms + if ( !itksys::SystemTools::FileExists( filename.c_str() ) ) + { + itksys::SystemTools::Touch( filename.c_str(), true ); + // don't worry about failure here, errors should be detected later when the file + // is "actually" opened, unless there is a race condition + } + } + if ( !ascii ) + { + mode |= std::ios::binary; + } + + outputStream.open( filename.c_str(), mode ); + + if ( !outputStream.is_open() || outputStream.fail() ) + { + itkExceptionMacro( << "Could not open file: " + << filename << " for writing." + << std::endl + << "Reason: " + << itksys::SystemTools::GetLastSystemError() ); + } +} + namespace { template< typename TComponent > diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOFactory.cxx otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOFactory.cxx --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOFactory.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/src/itkImageIOFactory.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -60,6 +60,6 @@ } } } - return 0; + return ITK_NULLPTR; } } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/src/itkStreamingImageIOBase.cxx otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/src/itkStreamingImageIOBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/IO/ImageBase/src/itkStreamingImageIOBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/IO/ImageBase/src/itkStreamingImageIOBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -242,63 +242,6 @@ return true; } -void StreamingImageIOBase::OpenFileForReading(std::ifstream & os, const char *filename) -{ - // Make sure that we have a file to - if ( *filename == 0 ) - { - itkExceptionMacro(<< "A FileName must be specified."); - } - - // Close file from any previous image - if ( os.is_open() ) - { - os.close(); - } - - // Open the new file for reading - itkDebugMacro(<< "Initialize: opening file " << filename); - - os.open(filename, std::ios::in | std::ios::binary); - if ( os.fail() ) - { - itkExceptionMacro(<< "Could not open file for reading: " << filename); - } -} - -void StreamingImageIOBase::OpenFileForWriting(std::ofstream & os, const char *filename, bool truncate) -{ - // Make sure that we have a file to - if ( *filename == 0 ) - { - itkExceptionMacro(<< "A FileName must be specified."); - } - - // Close file from any previous image - if ( os.is_open() ) - { - os.close(); - } - - // Open the new file for writing - itkDebugMacro(<< "Initialize: opening file " << filename); - - if ( truncate ) - { - // truncate - os.open(m_FileName.c_str(), std::ios::out | std::ios::binary | std::ios::trunc); - } - else - { - os.open(m_FileName.c_str(), std::ios::out | std::ios::binary | std::ios::in); - } - - if ( os.fail() ) - { - itkExceptionMacro(<< "Could not open file for writing: " << filename); - } -} - bool StreamingImageIOBase::CanStreamRead(void) { return true; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkEigenAnalysis2DImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkEigenAnalysis2DImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkEigenAnalysis2DImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkEigenAnalysis2DImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -216,7 +216,7 @@ const double dxy = xx - yy; const double sxy = xx + yy; - const double S = vcl_sqrt(dxy * dxy + 4.0 * xy * xy); + const double S = std::sqrt(dxy * dxy + 4.0 * xy * xy); const double pp = ( sxy + S ) / 2.0; const double qq = ( sxy - S ) / 2.0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.h 2014-09-03 08:29:34.000000000 +0000 @@ -107,7 +107,7 @@ protected: SymmetricEigenSystem(); virtual ~SymmetricEigenSystem(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Produces the eigen vectors and values. */ void GenerateData(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Eigen/include/itkSymmetricEigenSystem.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ SymmetricEigenSystem< TMatrixElement, VNumberOfRows > ::SymmetricEigenSystem() { - m_Matrix = 0; + m_Matrix = ITK_NULLPTR; m_UseAbsoluteOrder = true; m_EigenValues.Fill(NumericTraits< TMatrixElement >::Zero); ArrayType temp; @@ -54,7 +54,7 @@ os << indent << "Matrix:"; - if ( m_Matrix != 0 ) + if ( m_Matrix != ITK_NULLPTR ) { os << m_Matrix << std::endl; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.h 2014-09-03 08:29:34.000000000 +0000 @@ -20,6 +20,7 @@ #include "itkLightObject.h" #include "itkObjectFactory.h" +#include "itkNumericTraits.h" #include namespace itk @@ -37,7 +38,9 @@ TDataType m_Data; TIndexType m_Index; signed char m_NodeState; - BandNode() : m_NodeState( 0 ) {} + BandNode() : + m_Data(NumericTraits::ZeroValue()), m_NodeState(0) + {} }; /** \class NarrowBand diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NarrowBand/include/itkNarrowBand.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,6 @@ #ifndef __itkNarrowBand_hxx #define __itkNarrowBand_hxx #include "itkNarrowBand.h" -#include "vcl_cmath.h" #include namespace itk @@ -50,7 +49,7 @@ SizeType regionsize = static_cast< SizeType >( - vcl_floor( static_cast< float >( t_size ) / static_cast< float >( t_n ) ) ); + std::floor( static_cast< float >( t_size ) / static_cast< float >( t_n ) ) ); if ( regionsize == 0 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianRadialBasisFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianRadialBasisFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianRadialBasisFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianRadialBasisFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ { ScalarType val; ScalarType radius = Superclass::GetRadius(); - val = vcl_exp(-0.5*vcl_pow(input,2)/vcl_pow(radius,2)); + val = std::exp(-0.5*std::pow(input,2)/std::pow(radius,2)); return val; } @@ -65,13 +65,13 @@ ArrayType center = Superclass::GetCenter(); if(mode=='u') //w.r.t centers { - ScalarType temp1= vcl_pow(radius,2); + ScalarType temp1= std::pow(radius,2); val=Evaluate(dist) *(input.GetElement(element_id)-center.GetElement(element_id))/temp1; } else if(mode=='s') // w.r.t radius { - val=Evaluate(dist)*vcl_pow(dist,2)/vcl_pow(radius,3); + val=Evaluate(dist)*std::pow(dist,2)/std::pow(radius,3); } return val; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianTransferFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianTransferFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianTransferFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkGaussianTransferFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ GaussianTransferFunction ::Evaluate(const ScalarType& input) const { - return static_cast((vcl_exp(-1 * input * input))); + return static_cast((std::exp(-1 * input * input))); } /** Evaluate derivatives function */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -142,7 +142,7 @@ ~LayerBase(); /** Method to print the object. */ - virtual void PrintSelf( std::ostream& os, Indent indent ) const; + virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE; LayerTypeCode m_LayerTypeCode; //input, hidden, output unsigned int m_LayerId; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLayerBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ { namespace Statistics { -#define INVALID_LAYER_ID vcl_numeric_limits::max() +#define INVALID_LAYER_ID std::numeric_limits::max() template LayerBase @@ -34,10 +34,10 @@ m_NumberOfNodes = 0; m_LayerId = INVALID_LAYER_ID; m_LayerTypeCode = INVALIDLAYER; - m_InputWeightSet = 0; - m_OutputWeightSet = 0; - m_ActivationFunction = 0; - m_NodeInputFunction = 0; + m_InputWeightSet = ITK_NULLPTR; + m_OutputWeightSet = ITK_NULLPTR; + m_ActivationFunction = ITK_NULLPTR; + m_NodeInputFunction = ITK_NULLPTR; } template diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLearningFunctionBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLearningFunctionBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLearningFunctionBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLearningFunctionBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -58,7 +58,7 @@ ~LearningFunctionBase() {}; /** Method to print the object. */ - virtual void PrintSelf( std::ostream& os, Indent indent ) const + virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE { Superclass::PrintSelf( os, indent ); os << indent << "LearningFunctionBase(" << this << ")" << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,17 +30,20 @@ * \ingroup ITKNeuralNetworks */ -template -class LogSigmoidTransferFunction : public TransferFunctionBase +template +class LogSigmoidTransferFunction : public TransferFunctionBase { public: /** Standard class typedefs. */ typedef LogSigmoidTransferFunction Self; - typedef TransferFunctionBase Superclass; + typedef TransferFunctionBase Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; + typedef TScalar ScalarType; + typedef typename NumericTraits< ScalarType >::RealType RealType; + /** Run-time type information (and related methods). */ itkTypeMacro(LogSigmoidTransferFunction, TransferFunctionBase); @@ -48,10 +51,10 @@ itkNewMacro(Self); /** Evaluate at the specified input position */ - virtual ScalarType Evaluate(const ScalarType& input) const; + virtual TScalar Evaluate(const ScalarType& input) const; /** Evaluate the derivative at the specified input position */ - virtual ScalarType EvaluateDerivative(const ScalarType& input) const; + virtual TScalar EvaluateDerivative(const ScalarType& input) const; protected: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkLogSigmoidTransferFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,34 +25,31 @@ namespace Statistics { -/** Constructor */ -template -LogSigmoidTransferFunction +template +LogSigmoidTransferFunction ::LogSigmoidTransferFunction() { } -/** Destructor */ -template -LogSigmoidTransferFunction +template +LogSigmoidTransferFunction ::~LogSigmoidTransferFunction() { } -/** Evaluate */ -template -ScalarType -LogSigmoidTransferFunction +template +TScalar +LogSigmoidTransferFunction ::Evaluate(const ScalarType& input) const { - const ScalarType v = 1.0 / (1.0 + vcl_exp(-input)); + const ScalarType v = static_cast< ScalarType >( 1.0 / + ( 1.0 + std::exp( static_cast< typename NumericTraits< ScalarType >::RealType >(-input)) ) ); return v; } -/** Evaluate derivatives */ -template -ScalarType -LogSigmoidTransferFunction +template +TScalar +LogSigmoidTransferFunction ::EvaluateDerivative(const ScalarType& input) const { ScalarType f = Evaluate(input); @@ -60,9 +57,9 @@ } /** Print the object */ -template +template void -LogSigmoidTransferFunction +LogSigmoidTransferFunction ::PrintSelf( std::ostream& os, Indent indent ) const { os << indent << "LogSigmoidTransferFunction(" << this << ")" << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkMultiquadricRadialBasisFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkMultiquadricRadialBasisFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkMultiquadricRadialBasisFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkMultiquadricRadialBasisFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ MultiquadricRadialBasisFunction ::Evaluate(const ScalarType& input) const { - const ScalarType val = vcl_pow((input*input)+(m_Radius*m_Radius),0.5); + const ScalarType val = std::pow((input*input)+(m_Radius*m_Radius),0.5); return val; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkNeuralNetworkObject.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkNeuralNetworkObject.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkNeuralNetworkObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkNeuralNetworkObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -62,7 +62,7 @@ virtual ~NeuralNetworkObject(); /** Method to print the object. */ - virtual void PrintSelf( std::ostream& os, Indent indent ) const; + virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE; ValueType m_LearningRate; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkRBFBackPropagationLearningFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkRBFBackPropagationLearningFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkRBFBackPropagationLearningFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkRBFBackPropagationLearningFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -42,11 +42,6 @@ typename LayerType::WeightSetType::Pointer outputweightset = layer->GetModifiableOutputWeightSet(); typename LayerType::WeightSetType::Pointer inputweightset = layer->GetModifiableInputWeightSet(); - typedef typename LayerType::InputVectorType InputVectorType; - typedef typename LayerType::OutputVectorType OutputVectorType; - - typedef RBFLayer RbfLayerType; - typedef typename RbfLayerType::InternalVectorType ArrayType; typename LayerType::ValuePointer currentdeltavalues = inputweightset->GetTotalDeltaValues(); vnl_matrix DW_temp(currentdeltavalues,inputweightset->GetNumberOfOutputNodes(), inputweightset->GetNumberOfInputNodes()); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -24,23 +24,26 @@ { namespace Statistics { + /** \class SigmoidTransferFunction * \brief This is the itkSigmoidTransferFunction class. * * \ingroup ITKNeuralNetworks */ - -template -class SigmoidTransferFunction : public TransferFunctionBase +template +class SigmoidTransferFunction : public TransferFunctionBase { public: /** Standard class typedefs. */ typedef SigmoidTransferFunction Self; - typedef TransferFunctionBase Superclass; + typedef TransferFunctionBase Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; + typedef TScalar ScalarType; + typedef typename NumericTraits< ScalarType >::RealType RealType; + /** Run-time type information (and related methods). */ itkTypeMacro(SigmoidTransferFunction, TransferFunctionBase); @@ -48,10 +51,10 @@ itkNewMacro(Self); /** Set/Get macros */ - itkSetMacro(Alpha,ScalarType); - itkGetMacro(Alpha,ScalarType); - itkSetMacro(Beta,ScalarType); - itkGetMacro(Beta,ScalarType); + itkSetMacro(Alpha,RealType); + itkGetMacro(Alpha,RealType); + itkSetMacro(Beta,RealType); + itkGetMacro(Beta,RealType); itkSetMacro(OutputMinimum,ScalarType); itkGetMacro(OutputMinimum,ScalarType); itkSetMacro(OutputMaximum,ScalarType); @@ -73,8 +76,8 @@ private: - ScalarType m_Alpha; - ScalarType m_Beta; + RealType m_Alpha; + RealType m_Beta; ScalarType m_OutputMinimum; ScalarType m_OutputMaximum; }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSigmoidTransferFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,9 +25,9 @@ namespace Statistics { -/** Constructor */ -template -SigmoidTransferFunction< ScalarType> + +template +SigmoidTransferFunction ::SigmoidTransferFunction() { m_Alpha = 1.0; @@ -36,40 +36,40 @@ m_OutputMaximum = NumericTraits::max(); } -/** Destructor */ -template -SigmoidTransferFunction + +template +SigmoidTransferFunction ::~SigmoidTransferFunction() { } -/** Evaluate */ -template -ScalarType -SigmoidTransferFunction + +template +TScalar +SigmoidTransferFunction ::Evaluate(const ScalarType& input) const { - const ScalarType x = (static_cast(input) - m_Beta) / m_Alpha; - const ScalarType e = 1.0 / (1.0 + vcl_exp(-x)); - const ScalarType v = (m_OutputMaximum - m_OutputMinimum) * e + const RealType x = static_cast< RealType >( input - m_Beta ) / m_Alpha; + const RealType e = 1.0 / (1.0 + std::exp( static_cast< typename NumericTraits< ScalarType >::RealType >(-x))); + const ScalarType v = static_cast< ScalarType >( (m_OutputMaximum - m_OutputMinimum) * e ) + m_OutputMinimum; return v; } -/** Evaluate Derivatives */ -template -ScalarType -SigmoidTransferFunction< ScalarType> + +template +TScalar +SigmoidTransferFunction ::EvaluateDerivative(const ScalarType& input) const { ScalarType f = Evaluate(input); return f * (1 - f); } -/** Print the object */ -template + +template void -SigmoidTransferFunction +SigmoidTransferFunction ::PrintSelf( std::ostream& os, Indent indent ) const { os << indent << "SigmoidTransferFunction(" << this << ")" << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSymmetricSigmoidTransferFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSymmetricSigmoidTransferFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSymmetricSigmoidTransferFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkSymmetricSigmoidTransferFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -55,7 +55,7 @@ } else { - val= (ScalarType)1.0/(1.0+vcl_exp(-input))-0.5; + val= (ScalarType)1.0/(1.0+std::exp(-input))-0.5; } return val; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanHTransferFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanHTransferFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanHTransferFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanHTransferFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,8 +45,8 @@ TanHTransferFunction ::Evaluate(const ScalarType& input) const { - ScalarType x = vcl_exp(input); - ScalarType y = vcl_exp(-input); + ScalarType x = std::exp(input); + ScalarType y = std::exp(-input); return static_cast((float) (x - y) / (x + y)); } @@ -57,7 +57,7 @@ ::EvaluateDerivative(const ScalarType& input) const { ScalarType f = Evaluate(input); - return 1 - vcl_pow(f, 2); + return 1 - std::pow(f, 2); } /** Print the object */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanSigmoidTransferFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanSigmoidTransferFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanSigmoidTransferFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTanSigmoidTransferFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,7 @@ ::Evaluate(const ScalarType& input) const { return static_cast((2 - / (1 + vcl_exp(-2 * static_cast(input)))) + / (1 + std::exp(-2 * static_cast(input)))) - 1); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -105,7 +105,7 @@ ~TrainingFunctionBase(){}; /** Method to print the object. */ - virtual void PrintSelf( std::ostream& os, Indent indent ) const; + virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE; TSample* m_TrainingSamples;// original samples TTargetVector* m_SampleTargets; // original samples diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkTrainingFunctionBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,8 +31,8 @@ { m_PerformanceFunction = DefaultPerformanceType::New(); m_Iterations = 0; - m_TrainingSamples = NULL; - m_SampleTargets = NULL; + m_TrainingSamples = ITK_NULLPTR; + m_SampleTargets = ITK_NULLPTR; m_LearningRate = 1.0; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkWeightSetBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkWeightSetBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkWeightSetBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/NeuralNetworks/include/itkWeightSetBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -125,7 +125,7 @@ ~WeightSetBase(); /** Method to print the object. */ - virtual void PrintSelf( std::ostream& os, Indent indent ) const; + virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE; typename RandomVariateGeneratorType::Pointer m_RandomGenerator; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkAmoebaOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkAmoebaOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkAmoebaOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkAmoebaOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,10 +83,10 @@ typedef vnl_vector< double > InternalParametersType; /** Start optimization with an initial value. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Plug in a Cost Function into the optimizer */ - virtual void SetCostFunction(SingleValuedCostFunction *costFunction); + virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE; /** Set/Get the maximum number of iterations. The optimization algorithm will * terminate after the maximum number of iterations has been reached. @@ -137,7 +137,7 @@ itkGetConstMacro(FunctionConvergenceTolerance, double); /** Report the reason for stopping. */ - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; /** Return Current Value */ MeasureType GetValue() const; @@ -148,7 +148,7 @@ protected: AmoebaOptimizer(); virtual ~AmoebaOptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkConjugateGradientOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkConjugateGradientOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkConjugateGradientOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkConjugateGradientOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -57,10 +57,10 @@ vnl_conjugate_gradient * GetOptimizer(void); /** Start optimization with an initial value. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Plug in a Cost Function into the optimizer */ - virtual void SetCostFunction(SingleValuedCostFunction *costFunction); + virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE; /** Return the number of iterations performed so far */ SizeValueType GetNumberOfIterations(void) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCostFunction.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCostFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCostFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCostFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -58,7 +58,7 @@ protected: CostFunctionTemplate() {} virtual ~CostFunctionTemplate() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: CostFunctionTemplate(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianCostFunction.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianCostFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianCostFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianCostFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -74,10 +74,10 @@ /** Not necessary for this optimizer. */ void GetDerivative( const ParametersType & itkNotUsed(parameters), - DerivativeType & itkNotUsed(derivative) ) const {} + DerivativeType & itkNotUsed(derivative) ) const ITK_OVERRIDE {} /** Return the values evaluated for the given parameters. */ - MeasureType GetValue(const ParametersType & parameters) const; + virtual MeasureType GetValue(const ParametersType & parameters) const ITK_OVERRIDE; /** Return a pointer of values evaluated for the given parameters. */ MeasureType * GetValuePointer(ParametersType & parameters); @@ -89,10 +89,10 @@ double EvaluateCumulativeGaussian(double argument) const; /** Get the SpaceDimension. */ - unsigned int GetNumberOfParameters() const; + virtual unsigned int GetNumberOfParameters() const ITK_OVERRIDE; /** Get the number Range Dimension. */ - unsigned int GetNumberOfValues() const; + virtual unsigned int GetNumberOfValues() const ITK_OVERRIDE; /** Initialize the arrays. */ void Initialize(unsigned int rangeDimension); @@ -104,7 +104,7 @@ CumulativeGaussianCostFunction(); virtual ~CumulativeGaussianCostFunction(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkCumulativeGaussianOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,18 +83,18 @@ void SetDataArray(MeasureType *dataArray); /** Start the optimizer. */ - void StartOptimization(); + virtual void StartOptimization() ITK_OVERRIDE; /** Print an array. */ void PrintArray(MeasureType *array); /** Report the reason for stopping. */ - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: CumulativeGaussianOptimizer(); virtual ~CumulativeGaussianOptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkExhaustiveOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkExhaustiveOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkExhaustiveOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkExhaustiveOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -96,7 +96,7 @@ /** Run-time type information (and related methods). */ itkTypeMacro(ExhaustiveOptimizer, SingleValuedNonLinearOptimizer); - virtual void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; void StartWalking(void); @@ -117,12 +117,12 @@ itkGetConstReferenceMacro(MaximumNumberOfIterations, SizeValueType); /** Get the reason for termination */ - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: ExhaustiveOptimizer(); virtual ~ExhaustiveOptimizer() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Advance to the next grid position. */ void AdvanceOneStep(void); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkFRPROptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkFRPROptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkFRPROptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkFRPROptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ itkGetConstMacro(UseUnitLengthGradient, bool); /** Start optimization. */ - void StartOptimization(); + virtual void StartOptimization() ITK_OVERRIDE; /** Set it to the Fletch-Reeves optimizer */ void SetToFletchReeves(); @@ -85,7 +85,7 @@ FRPROptimizer(); virtual ~FRPROptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Get the value of the n-dimensional cost function at this scalar step * distance along the current line direction from the current line origin. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkGradientDescentOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkGradientDescentOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkGradientDescentOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkGradientDescentOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -87,7 +87,7 @@ virtual void AdvanceOneStep(void); /** Start optimization. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Resume previously stopped optimization with current parameters * \sa StopOptimization. */ @@ -117,7 +117,7 @@ /** Get Stop condition. */ itkGetConstReferenceMacro(StopCondition, StopConditionType); - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; /** Get Gradient condition. */ itkGetConstReferenceMacro(Gradient, DerivativeType); @@ -125,7 +125,7 @@ protected: GradientDescentOptimizer(); virtual ~GradientDescentOptimizer() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; // made protected so subclass can access DerivativeType m_Gradient; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkInitializationBiasedParticleSwarmOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkInitializationBiasedParticleSwarmOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkInitializationBiasedParticleSwarmOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkInitializationBiasedParticleSwarmOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -115,8 +115,8 @@ protected: InitializationBiasedParticleSwarmOptimizer(); virtual ~InitializationBiasedParticleSwarmOptimizer() {}; - void PrintSelf(std::ostream& os, Indent indent) const; - virtual void UpdateSwarm(); + virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE; + virtual void UpdateSwarm() ITK_OVERRIDE; private: //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSBOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSBOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSBOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSBOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -95,10 +95,10 @@ typedef LBFGSBOptimizerHelper InternalOptimizerType; /** Start optimization with an initial value. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Plug in a Cost Function into the optimizer */ - virtual void SetCostFunction(SingleValuedCostFunction *costFunction); + virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE; /** Set/Get the optimizer trace flag. If set to true, the optimizer * prints out information every iteration. @@ -175,12 +175,12 @@ itkGetConstReferenceMacro(InfinityNormOfProjectedGradient, double); /** Get the reason for termination */ - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: LBFGSBOptimizer(); virtual ~LBFGSBOptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLBFGSOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -55,10 +55,10 @@ vnl_lbfgs * GetOptimizer(void); /** Start optimization with an initial value. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Plug in a Cost Function into the optimizer */ - virtual void SetCostFunction(SingleValuedCostFunction *costFunction); + virtual void SetCostFunction(SingleValuedCostFunction *costFunction) ITK_OVERRIDE; /** Set/Get the optimizer trace flag. If set to true, the optimizer * prints out information every iteration. @@ -104,12 +104,12 @@ MeasureType GetValue() const; /** Get the reason for termination */ - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: LBFGSOptimizer(); virtual ~LBFGSOptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLevenbergMarquardtOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLevenbergMarquardtOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLevenbergMarquardtOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkLevenbergMarquardtOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -55,10 +55,10 @@ vnl_levenberg_marquardt * GetOptimizer(void) const; /** Start optimization with an initial value. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Plug in a Cost Function into the optimizer */ - virtual void SetCostFunction(MultipleValuedCostFunction *costFunction); + virtual void SetCostFunction(MultipleValuedCostFunction *costFunction) ITK_OVERRIDE; void SetNumberOfIterations(unsigned int iterations); @@ -71,7 +71,7 @@ /** Get the current value */ MeasureType GetValue() const; - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: LevenbergMarquardtOptimizer(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -70,7 +70,7 @@ protected: MultipleValuedNonLinearOptimizer(); virtual ~MultipleValuedNonLinearOptimizer() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; CostFunctionPointer m_CostFunction; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearVnlOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearVnlOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearVnlOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedNonLinearVnlOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -90,7 +90,7 @@ MultipleValuedNonLinearVnlOptimizer(); virtual ~MultipleValuedNonLinearVnlOptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; typedef MultipleValuedVnlCostFunctionAdaptor CostFunctionAdaptorType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedVnlCostFunctionAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedVnlCostFunctionAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedVnlCostFunctionAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkMultipleValuedVnlCostFunctionAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,11 +73,11 @@ /** Delegate computation of the value to the CostFunction. */ virtual void f(const InternalParametersType & inparameters, - InternalMeasureType & measures); + InternalMeasureType & measures) ITK_OVERRIDE; /** Delegate computation of the gradient to the costFunction. */ virtual void gradf(const InternalParametersType & inparameters, - InternalDerivativeType & gradient); + InternalDerivativeType & gradient) ITK_OVERRIDE; /** Delegate computation of value and gradient to the costFunction. */ virtual void compute(const InternalParametersType & x, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOnePlusOneEvolutionaryOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOnePlusOneEvolutionaryOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOnePlusOneEvolutionaryOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOnePlusOneEvolutionaryOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -151,7 +151,7 @@ /** Start optimization. * Optimization will stop when it meets either of two termination conditions, * the maximum iteration limit or epsilon (minimal search radius) */ - void StartOptimization(); + virtual void StartOptimization() ITK_OVERRIDE; /** when users call StartOptimization, this value will be set false. * By calling StopOptimization, this flag will be set true, and @@ -165,13 +165,13 @@ itkGetConstReferenceMacro(MetricWorstPossibleValue, double); itkSetMacro(MetricWorstPossibleValue, double); - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: OnePlusOneEvolutionaryOptimizer(); OnePlusOneEvolutionaryOptimizer(const OnePlusOneEvolutionaryOptimizer &); virtual ~OnePlusOneEvolutionaryOptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -86,7 +86,7 @@ protected: Optimizer(); virtual ~Optimizer() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Set the current position. */ virtual void SetCurrentPosition(const ParametersType & param); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizerBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizerBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizerBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizerBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -113,7 +113,7 @@ itkBooleanMacro( PrintSwarm ) /** Start optimization. */ - void StartOptimization( void ); + virtual void StartOptimization( void ) ITK_OVERRIDE; /** Set/Get number of particles in the swarm - the maximal number of function @@ -187,7 +187,7 @@ MeasureType GetValue() const; /** Get the reason for termination */ - virtual const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; /** Print the swarm information to the given output stream. Each line * (particle data) is of the form: @@ -198,7 +198,7 @@ protected: ParticleSwarmOptimizerBase(); virtual ~ParticleSwarmOptimizerBase(); - void PrintSelf( std::ostream& os, Indent indent ) const; + virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE; void PrintParamtersType( const ParametersType& x, std::ostream& os ) const; /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkParticleSwarmOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -94,8 +94,8 @@ protected: ParticleSwarmOptimizer(); virtual ~ParticleSwarmOptimizer(); - void PrintSelf(std::ostream& os, Indent indent) const; - virtual void UpdateSwarm(); + virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE; + virtual void UpdateSwarm() ITK_OVERRIDE; private: ParticleSwarmOptimizer(const Self&); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkPowellOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkPowellOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkPowellOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkPowellOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -121,7 +121,7 @@ itkGetConstReferenceMacro(CurrentLineIteration, unsigned int); /** Start optimization. */ - void StartOptimization(); + virtual void StartOptimization() ITK_OVERRIDE; /** When users call StartOptimization, this value will be set false. * By calling StopOptimization, this flag will be set true, and @@ -135,13 +135,13 @@ itkGetConstReferenceMacro(MetricWorstPossibleValue, double); itkSetMacro(MetricWorstPossibleValue, double); - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: PowellOptimizer(); PowellOptimizer(const PowellOptimizer &); virtual ~PowellOptimizer(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; itkSetMacro(CurrentCost, double); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkQuaternionRigidTransformGradientDescentOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkQuaternionRigidTransformGradientDescentOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkQuaternionRigidTransformGradientDescentOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkQuaternionRigidTransformGradientDescentOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -70,7 +70,7 @@ typedef Superclass::ParametersType ParametersType; /** Advance one step following the gradient direction. */ - virtual void AdvanceOneStep(void); + virtual void AdvanceOneStep(void) ITK_OVERRIDE; protected: QuaternionRigidTransformGradientDescentOptimizer() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentBaseOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentBaseOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentBaseOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentBaseOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -70,7 +70,7 @@ { SetMaximize(true); } /** Start optimization. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Resume previously stopped optimization with current parameters. * \sa StopOptimization */ @@ -98,12 +98,12 @@ itkGetConstReferenceMacro(Gradient, DerivativeType); /** Get the reason for termination */ - virtual const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: RegularStepGradientDescentBaseOptimizer(); virtual ~RegularStepGradientDescentBaseOptimizer() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Advance one step following the gradient direction * This method verifies if a change in direction is required diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkRegularStepGradientDescentOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -61,7 +61,7 @@ * \sa AdvanceOneStep */ virtual void StepAlongGradient( double factor, - const DerivativeType & transformedGradient); + const DerivativeType & transformedGradient) ITK_OVERRIDE; private: RegularStepGradientDescentOptimizer(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,7 @@ protected: SingleValuedNonLinearOptimizer(); virtual ~SingleValuedNonLinearOptimizer() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; CostFunctionPointer m_CostFunction; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearVnlOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearVnlOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearVnlOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedNonLinearVnlOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -104,7 +104,7 @@ CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor(void) const; /** Print out internal state */ - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: /** Callback function for the Command Observer */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedVnlCostFunctionAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedVnlCostFunctionAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedVnlCostFunctionAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSingleValuedVnlCostFunctionAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -71,16 +71,16 @@ { return m_CostFunction; } /** Delegate computation of the value to the CostFunction. */ - virtual InternalMeasureType f(const InternalParametersType & inparameters); + virtual InternalMeasureType f(const InternalParametersType & inparameters) ITK_OVERRIDE; /** Delegate computation of the gradient to the costFunction. */ virtual void gradf(const InternalParametersType & inparameters, - InternalDerivativeType & gradient); + InternalDerivativeType & gradient) ITK_OVERRIDE; /** Delegate computation of value and gradient to the costFunction. */ virtual void compute(const InternalParametersType & x, InternalMeasureType *f, - InternalDerivativeType *g); + InternalDerivativeType *g) ITK_OVERRIDE; /** Convert external derviative measures into internal type */ void ConvertExternalToInternalGradient( diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSPSAOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSPSAOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSPSAOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkSPSAOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -69,7 +69,7 @@ virtual void AdvanceOneStep(void); /** Start optimization. */ - void StartOptimization(void); + virtual void StartOptimization(void) ITK_OVERRIDE; /** Resume previously stopped optimization with current parameters * \sa StopOptimization. */ @@ -194,7 +194,7 @@ itkGetConstMacro(Tolerance, double); /** Get the reason for termination */ - const std::string GetStopConditionDescription() const; + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; protected: @@ -202,7 +202,7 @@ virtual ~SPSAOptimizer() {} /** PrintSelf method. */ - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Variables updated during optimization */ DerivativeType m_Gradient; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorRigid3DTransformOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorRigid3DTransformOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorRigid3DTransformOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorRigid3DTransformOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,7 +73,7 @@ /** Advance one step following the gradient direction. */ virtual void StepAlongGradient(double factor, - const DerivativeType & transformedGradient); + const DerivativeType & transformedGradient) ITK_OVERRIDE; protected: VersorRigid3DTransformOptimizer() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorTransformOptimizer.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorTransformOptimizer.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorTransformOptimizer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/include/itkVersorTransformOptimizer.h 2014-09-03 08:29:34.000000000 +0000 @@ -71,7 +71,7 @@ /** Advance one step following the gradient direction. */ virtual void StepAlongGradient(double factor, - const DerivativeType & transformedGradient); + const DerivativeType & transformedGradient) ITK_OVERRIDE; protected: VersorTransformOptimizer() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkAmoebaOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkAmoebaOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkAmoebaOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkAmoebaOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ this->m_AutomaticInitialSimplex = true; this->m_InitialSimplexDelta.Fill( NumericTraits< ParametersType::ValueType >::One ); this->m_OptimizeWithRestarts = false; - this->m_VnlOptimizer = NULL; + this->m_VnlOptimizer = ITK_NULLPTR; } @@ -78,7 +78,7 @@ SingleValuedNonLinearVnlOptimizer::CostFunctionAdaptorType *costFunction = this->GetNonConstCostFunctionAdaptor(); - if( costFunction != NULL ) + if( costFunction != ITK_NULLPTR ) { if( static_cast(costFunction->get_number_of_unknowns()) != numberOfParameters ) @@ -310,7 +310,7 @@ ::ValidateSettings() { //we have to have a cost function - if( GetCostFunctionAdaptor() == NULL ) + if( GetCostFunctionAdaptor() == ITK_NULLPTR ) { itkExceptionMacro(<<"NULL cost function") } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkConjugateGradientOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkConjugateGradientOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkConjugateGradientOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkConjugateGradientOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ ::ConjugateGradientOptimizer() { m_OptimizerInitialized = false; - m_VnlOptimizer = 0; + m_VnlOptimizer = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianCostFunction.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianCostFunction.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianCostFunction.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianCostFunction.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -65,9 +65,9 @@ double fitError = 0.0; for ( int i = 0; i < (int)( numberOfElements ); i++ ) { - fitError += vcl_pow( ( setTestArray->get(i) - m_OriginalDataArray->get(i) ), 2 ); + fitError += std::pow( ( setTestArray->get(i) - m_OriginalDataArray->get(i) ), 2 ); } - return ( vcl_sqrt( ( 1 / numberOfElements ) * fitError ) ); + return ( std::sqrt( ( 1 / numberOfElements ) * fitError ) ); } double @@ -192,7 +192,7 @@ - parameters.get(2) ) * ( EvaluateCumulativeGaussian( ( i - parameters.get(0) ) - / ( parameters.get(1) * vcl_sqrt(2.0) ) ) + 1 ) / 2 ); + / ( parameters.get(1) * std::sqrt(2.0) ) ) + 1 ) / 2 ); } return m_Measure; @@ -211,7 +211,7 @@ - parameters.get(2) ) * ( EvaluateCumulativeGaussian( ( i - parameters.get(0) ) - / ( parameters.get(1) * vcl_sqrt(2.0) ) ) + 1 ) / 2 ) ); + / ( parameters.get(1) * std::sqrt(2.0) ) ) + 1 ) / 2 ) ); } return m_MeasurePointer; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkCumulativeGaussianOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,8 +36,8 @@ m_DifferenceTolerance = 1e-10; m_Verbose = 0; m_FitError = 0; - m_FinalSampledArray = NULL; - m_CumulativeGaussianArray = NULL; + m_FinalSampledArray = ITK_NULLPTR; + m_CumulativeGaussianArray = ITK_NULLPTR; m_StopConditionDescription << this->GetNameOfClass() << ": Constructed"; } @@ -61,7 +61,7 @@ for ( int i = 0; i < (int)( extendedArray->GetNumberOfElements() ); i++ ) { - extendedArray->put( i, amplitude * vcl_exp( -( vcl_pow( ( i - mean ), 2 ) / ( 2 * vcl_pow(sd, 2) ) ) ) ); + extendedArray->put( i, amplitude * std::exp( -( std::pow( ( i - mean ), 2 ) / ( 2 * std::pow(sd, 2) ) ) ) ); } // Then insert the originalArray over the middle section of extendedArray. for ( int i = 0; i < (int)( originalArray->GetNumberOfElements() ); i++ ) @@ -141,12 +141,12 @@ averageSumOfSquaredDifferences = FindAverageSumOfSquaredDifferences(extendedArray, extendedArrayCopy); // Stop if there is a very very very small change between iterations. - if ( vcl_fabs(temp - averageSumOfSquaredDifferences) <= m_DifferenceTolerance ) + if ( std::fabs(temp - averageSumOfSquaredDifferences) <= m_DifferenceTolerance ) { m_StopConditionDescription.str(""); m_StopConditionDescription << this->GetNameOfClass() << ": " << "Change between iterations (" - << vcl_fabs(temp - averageSumOfSquaredDifferences) + << std::fabs(temp - averageSumOfSquaredDifferences) << ") is less than DifferenceTolerance (" << m_DifferenceTolerance << ")."; @@ -197,15 +197,15 @@ // Calculate the standard deviation for ( int i = 0; i < (int)( array->GetNumberOfElements() ); i++ ) { - m_ComputedStandardDeviation += array->get(i) * vcl_pow( ( i - m_ComputedMean ), 2 ); + m_ComputedStandardDeviation += array->get(i) * std::pow( ( i - m_ComputedMean ), 2 ); } - m_ComputedStandardDeviation = vcl_sqrt(m_ComputedStandardDeviation / sum); + m_ComputedStandardDeviation = std::sqrt(m_ComputedStandardDeviation / sum); // For the ERF, sum is the difference between the lower and upper intensities. m_ComputedTransitionHeight = sum; // Calculate the amplitude. - m_ComputedAmplitude = sum / ( m_ComputedStandardDeviation * vcl_sqrt(2 * vnl_math::pi) ); + m_ComputedAmplitude = sum / ( m_ComputedStandardDeviation * std::sqrt(2 * vnl_math::pi) ); } void @@ -244,7 +244,7 @@ if ( i < startingPointForInsertion || i >= startingPointForInsertion + (int)( originalArray->GetNumberOfElements() ) ) { - extendedArray->put( i, amplitude * vcl_exp( -( vcl_pow( ( i - mean ), 2 ) / ( 2 * vcl_pow(sd, 2) ) ) ) ); + extendedArray->put( i, amplitude * std::exp( -( std::pow( ( i - mean ), 2 ) / ( 2 * std::pow(sd, 2) ) ) ) ); } } return extendedArray; @@ -298,8 +298,8 @@ for ( int i = 0; i < sampledGaussianArraySize; i++ ) { sampledGaussianArray->put( i, m_ComputedAmplitude - * vcl_exp( -( vcl_pow( ( i - m_ComputedMean ), - 2 ) / ( 2 * vcl_pow(m_ComputedStandardDeviation, 2) ) ) ) ); + * std::exp( -( std::pow( ( i - m_ComputedMean ), + 2 ) / ( 2 * std::pow(m_ComputedStandardDeviation, 2) ) ) ) ); } // Add 0.5 to the mean of the sampled Gaussian curve to make up for the 0.5 // shift during derivation, then take the integral of the Gaussian sample diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkFRPROptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkFRPROptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkFRPROptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkFRPROptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -56,7 +56,7 @@ { len += ( *xi )[i] * ( *xi )[i]; } - len = vcl_sqrt( len / this->GetSpaceDimension() ); + len = std::sqrt( len / this->GetSpaceDimension() ); for ( unsigned int i = 0; i < this->GetSpaceDimension(); i++ ) { ( *xi )[i] /= len; @@ -150,8 +150,8 @@ fret = fp; this->LineOptimize(&p, xi, &fret, tempCoord); - if ( 2.0 * vcl_abs(fret - fp) <= - this->GetValueTolerance() * ( vcl_abs(fret) + vcl_abs(fp) + FRPR_TINY ) ) + if ( 2.0 * std::abs(fret - fp) <= + this->GetValueTolerance() * ( std::abs(fret) + std::abs(fp) + FRPR_TINY ) ) { if ( limitCount < this->GetSpaceDimension() ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkGradientDescentOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkGradientDescentOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkGradientDescentOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkGradientDescentOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,16 +26,17 @@ * Constructor */ GradientDescentOptimizer -::GradientDescentOptimizer() +::GradientDescentOptimizer() : + m_Maximize(false), + m_LearningRate(1.0), + m_Stop(false), + m_Value(0.0), + m_StopCondition(MaximumNumberOfIterations), + m_NumberOfIterations(100), + m_CurrentIteration(0) { itkDebugMacro("Constructor"); - m_LearningRate = 1.0; - m_NumberOfIterations = 100; - m_CurrentIteration = 0; - m_Maximize = false; - m_Value = 0.0; - m_StopCondition = MaximumNumberOfIterations; m_StopConditionDescription << this->GetNameOfClass() << ": "; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSBOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSBOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSBOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSBOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ LBFGSBOptimizer * const itkObj); /** Handle new iteration event */ - virtual bool report_iter(); + virtual bool report_iter() ITK_OVERRIDE; private: LBFGSBOptimizer * const m_ItkObj; @@ -65,7 +65,7 @@ m_MaximumNumberOfCorrections(5), m_CurrentIteration(0), m_InfinityNormOfProjectedGradient(0.0), - m_VnlOptimizer(0) + m_VnlOptimizer(ITK_NULLPTR) { m_LowerBound = InternalBoundValueType(0); m_UpperBound = InternalBoundValueType(0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLBFGSOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ ::LBFGSOptimizer() { m_OptimizerInitialized = false; - m_VnlOptimizer = 0; + m_VnlOptimizer = ITK_NULLPTR; m_Trace = false; m_MaximumNumberOfFunctionEvaluations = 2000; m_GradientConvergenceTolerance = 1e-5; @@ -221,6 +221,8 @@ m_VnlOptimizer->default_step_length = m_DefaultStepLength; m_OptimizerInitialized = true; + + this->Modified(); } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLevenbergMarquardtOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLevenbergMarquardtOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLevenbergMarquardtOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkLevenbergMarquardtOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ ::LevenbergMarquardtOptimizer() { m_OptimizerInitialized = false; - m_VnlOptimizer = 0; + m_VnlOptimizer = ITK_NULLPTR; m_NumberOfIterations = 2000; m_ValueTolerance = 1e-8; m_GradientTolerance = 1e-5; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ MultipleValuedNonLinearOptimizer ::MultipleValuedNonLinearOptimizer() { - m_CostFunction = 0; + m_CostFunction = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearVnlOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearVnlOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearVnlOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkMultipleValuedNonLinearVnlOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ MultipleValuedNonLinearVnlOptimizer ::MultipleValuedNonLinearVnlOptimizer() { - m_CostFunctionAdaptor = 0; + m_CostFunctionAdaptor = ITK_NULLPTR; m_UseGradient = true; m_Command = CommandType::New(); m_Command->SetCallbackFunction(this, @@ -45,7 +45,7 @@ ::~MultipleValuedNonLinearVnlOptimizer() { delete m_CostFunctionAdaptor; - m_CostFunctionAdaptor = 0; + m_CostFunctionAdaptor = ITK_NULLPTR; } void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkOnePlusOneEvolutionaryOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkOnePlusOneEvolutionaryOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkOnePlusOneEvolutionaryOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkOnePlusOneEvolutionaryOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,11 +30,11 @@ m_Maximize = false; m_Epsilon = (double)1.5e-4; - m_RandomGenerator = 0; + m_RandomGenerator = ITK_NULLPTR; m_Initialized = false; m_GrowthFactor = 1.05; - m_ShrinkFactor = vcl_pow(m_GrowthFactor, -0.25); + m_ShrinkFactor = std::pow(m_GrowthFactor, -0.25); m_InitialRadius = 1.01; m_MaximumIteration = 100; m_Stop = false; @@ -75,7 +75,7 @@ } if ( shrink == -1 ) { - m_ShrinkFactor = vcl_pow(m_GrowthFactor, -0.25); + m_ShrinkFactor = std::pow(m_GrowthFactor, -0.25); } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkParticleSwarmOptimizerBase.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkParticleSwarmOptimizerBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkParticleSwarmOptimizerBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkParticleSwarmOptimizerBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,7 +23,9 @@ ParticleSwarmOptimizerBase -::ParticleSwarmOptimizerBase(void) +::ParticleSwarmOptimizerBase(void): + m_FunctionBestValue(0), + m_IterationIndex(0) { this->m_PrintSwarm = false; this->m_InitializeNormalDistribution = false; @@ -323,7 +325,7 @@ unsigned int i,n; //we have to have a cost function - if( GetCostFunction() == NULL ) + if( GetCostFunction() == ITK_NULLPTR ) { itkExceptionMacro(<<"NULL cost function") } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkPowellOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkPowellOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkPowellOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkPowellOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -184,7 +184,7 @@ // Compute the golden ratio as a constant to be // used when extrapolating the bracket // - const double goldenRatio = ( 1.0 + vcl_sqrt(5.0) ) / 2.0; + const double goldenRatio = ( 1.0 + std::sqrt(5.0) ) / 2.0; // // Get the value of the function for point x2 @@ -254,7 +254,7 @@ x = bx; w = bx; - const double goldenSectionRatio = ( 3.0 - vcl_sqrt(5.0) ) / 2; /* Gold + const double goldenSectionRatio = ( 3.0 - std::sqrt(5.0) ) / 2; /* Gold section ratio */ const double POWELL_TINY = 1.0e-20; @@ -278,10 +278,10 @@ double tolerance1; double tolerance2; - tolerance1 = m_StepTolerance * vcl_fabs(x) + POWELL_TINY; + tolerance1 = m_StepTolerance * std::fabs(x) + POWELL_TINY; tolerance2 = 2.0 * tolerance1; - if ( vcl_fabs(x - middle_range) <= ( tolerance2 - 0.5 * ( b - a ) ) + if ( std::fabs(x - middle_range) <= ( tolerance2 - 0.5 * ( b - a ) ) || 0.5 * ( b - a ) < m_StepTolerance ) { *extX = x; @@ -297,7 +297,7 @@ new_step = goldenSectionRatio * ( x < middle_range ? b - x : a - x ); /* Decide if the interpolation can be tried */ - if ( vcl_fabs(x - w) >= tolerance1 ) /* If x and w are distinct */ + if ( std::fabs(x - w) >= tolerance1 ) /* If x and w are distinct */ { double t; t = ( x - w ) * ( functionValueOfX - functionValueOfV ); @@ -321,7 +321,7 @@ /* Chec if x+p/q falls in [a,b] and not too close to a and b and isn't too large */ - if ( vcl_fabs(p) < vcl_fabs(new_step * q) + if ( std::fabs(p) < std::fabs(new_step * q) && p > q * ( a - x + 2 * tolerance1 ) && p < q * ( b - x - 2 * tolerance1 ) ) { @@ -333,7 +333,7 @@ } /* Adjust the step to be not less than tolerance*/ - if ( vcl_fabs(new_step) < tolerance1 ) + if ( std::fabs(new_step) < tolerance1 ) { if ( new_step > 0.0 ) { @@ -477,15 +477,15 @@ this->SetCurrentLinePoint(xx, fx); p = this->GetCurrentPosition(); - if ( vcl_fabs(fptt - fx) > del ) + if ( std::fabs(fptt - fx) > del ) { - del = vcl_fabs(fptt - fx); + del = std::fabs(fptt - fx); ibig = i; } } - if ( 2.0 * vcl_fabs(fp - fx) - <= m_ValueTolerance * ( vcl_fabs(fp) + vcl_fabs(fx) ) ) + if ( 2.0 * std::fabs(fp - fx) + <= m_ValueTolerance * ( std::fabs(fp) + std::fabs(fx) ) ) { m_StopConditionDescription << "Cost function values at the current parameter (" << fx diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkRegularStepGradientDescentBaseOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkRegularStepGradientDescentBaseOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkRegularStepGradientDescentBaseOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkRegularStepGradientDescentBaseOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,8 @@ * Constructor */ RegularStepGradientDescentBaseOptimizer -::RegularStepGradientDescentBaseOptimizer() +::RegularStepGradientDescentBaseOptimizer(): + m_Stop(false) { itkDebugMacro("Constructor"); @@ -37,7 +38,7 @@ m_CurrentIteration = 0; m_Value = 0; m_Maximize = false; - m_CostFunction = 0; + m_CostFunction = ITK_NULLPTR; m_CurrentStepLength = 0; m_StopCondition = Unknown; m_Gradient.Fill(0.0f); @@ -165,13 +166,11 @@ if ( m_RelaxationFactor < 0.0 ) { itkExceptionMacro(<< "Relaxation factor must be positive. Current value is " << m_RelaxationFactor); - return; } if ( m_RelaxationFactor >= 1.0 ) { itkExceptionMacro(<< "Relaxation factor must less than 1.0. Current value is " << m_RelaxationFactor); - return; } // Make sure the scales have been set properly @@ -198,7 +197,7 @@ magnitudeSquare += weighted * weighted; } - const double gradientMagnitude = vcl_sqrt(magnitudeSquare); + const double gradientMagnitude = std::sqrt(magnitudeSquare); if ( gradientMagnitude < m_GradientMagnitudeTolerance ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ SingleValuedNonLinearOptimizer ::SingleValuedNonLinearOptimizer() { - m_CostFunction = 0; + m_CostFunction = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearVnlOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearVnlOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearVnlOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSingleValuedNonLinearVnlOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ SingleValuedNonLinearVnlOptimizer ::SingleValuedNonLinearVnlOptimizer() { - m_CostFunctionAdaptor = 0; + m_CostFunctionAdaptor = ITK_NULLPTR; m_Maximize = false; m_Command = CommandType::New(); m_Command->SetCallbackFunction(this, @@ -41,7 +41,7 @@ ::~SingleValuedNonLinearVnlOptimizer() { delete m_CostFunctionAdaptor; - m_CostFunctionAdaptor = 0; + m_CostFunctionAdaptor = ITK_NULLPTR; } void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSPSAOptimizer.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSPSAOptimizer.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSPSAOptimizer.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizers/src/itkSPSAOptimizer.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,8 @@ * ************************* Constructor ************************ */ SPSAOptimizer -::SPSAOptimizer() +::SPSAOptimizer(): + m_Stop(false) { itkDebugMacro("Constructor"); @@ -289,7 +290,7 @@ ::Compute_a(SizeValueType k) const { return static_cast< double >( - m_Sa / vcl_pow(m_A + k + 1, m_Alpha) ); + m_Sa / std::pow(m_A + k + 1, m_Alpha) ); } // end Compute_a /** @@ -303,7 +304,7 @@ ::Compute_c(SizeValueType k) const { return static_cast< double >( - m_Sc / vcl_pow(k + 1, m_Gamma) ); + m_Sc / std::pow(k + 1, m_Gamma) ); } // end Compute_c /** @@ -482,14 +483,14 @@ this->ComputeGradient(initialPosition, m_Gradient); for ( unsigned int j = 0; j < spaceDimension; j++ ) { - averageAbsoluteGradient[j] += vcl_fabs(m_Gradient[j]); + averageAbsoluteGradient[j] += std::fabs(m_Gradient[j]); } } // end for ++n averageAbsoluteGradient /= static_cast< double >( numberOfGradientEstimates ); /** Set a in order to make the first steps approximately have an initialStepSize */ - this->SetSa( initialStepSize * vcl_pow(m_A + 1.0, m_Alpha) + this->SetSa( initialStepSize * std::pow(m_A + 1.0, m_Alpha) / averageAbsoluteGradient.max_value() ); } //end GuessParameters diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,2 +1,3 @@ project(ITKOptimizersv4) +set(ITKOptimizersv4_LIBRARIES ITKOptimizersv4) itk_module_impl() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkAmoebaOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkAmoebaOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkAmoebaOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkAmoebaOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,162 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkAmoebaOptimizerv4_h +#define __itkAmoebaOptimizerv4_h + +#include "itkSingleValuedNonLinearVnlOptimizerv4.h" +#include "vnl/algo/vnl_amoeba.h" + +namespace itk +{ +/** \class AmoebaOptimizerv4 + * \brief Wrap of the vnl_amoeba algorithm + * + * AmoebaOptimizerv4 is a wrapper around the vnl_amoeba algorithm which + * is an implementation of the Nelder-Meade downhill simplex + * problem. For most problems, it is a few times slower than a + * Levenberg-Marquardt algorithm but does not require derivatives of + * its cost function. It works by creating a simplex (n+1 points in + * ND space). The cost function is evaluated at each corner of the + * simplex. The simplex is then modified (by reflecting a corner + * about the opposite edge, by shrinking the entire simplex, by + * contracting one edge of the simplex, or by expanding the simplex) + * in searching for the minimum of the cost function. + * + * The methods AutomaticInitialSimplex() and SetInitialSimplexDelta() + * control whether the optimizer defines the initial simplex + * automatically (by constructing a very small simplex around the + * initial position) or uses a user supplied simplex size. + * + * The method SetOptimizeWithRestarts() indicates that the amoeabe algorithm + * should be rerun after if converges. This heuristic increases the chances + * of escaping from a local optimum. Each time the simplex is initialized with + * the best solution obtained by the previous runs. The edge length is half of + * that from the previous iteration. The heuristic is terminated if the total + * number of iterations is greater-equal than the maximal number of iterations + * (SetNumberOfIterations) or the difference between the current function + * value and the best function value is less than a threshold + * (SetFunctionConvergenceTolerance) and + * max(|best_parameters_i - current_parameters_i|) is less than a threshold + * (SetParametersConvergenceTolerance). + * + * \ingroup ITKOptimizersv4 + */ +class AmoebaOptimizerv4: + public SingleValuedNonLinearVnlOptimizerv4 +{ +public: + /** Standard "Self" typedef. */ + typedef AmoebaOptimizerv4 Self; + typedef SingleValuedNonLinearVnlOptimizerv4 Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(AmoebaOptimizerv4, SingleValuedNonLinearVnlOptimizerv4); + + /** Parameters type. + * It defines a position in the optimization search space. */ + typedef Superclass::ParametersType ParametersType; + + /** InternalParameters typedef. */ + typedef vnl_vector< double > InternalParametersType; + + /** Start optimization with an initial value. */ + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** Plug in a Cost Function into the optimizer */ + virtual void SetMetric(MetricType *metric) ITK_OVERRIDE; + + /** Set/Get the mode which determines how the amoeba algorithm + * defines the initial simplex. Default is + * AutomaticInitialSimplexOn. If AutomaticInitialSimplex is on, the + * initial simplex is created with a default size. If + * AutomaticInitialSimplex is off, then InitialSimplexDelta will be + * used to define the initial simplex, setting the ith corner of the + * simplex as [x0[0], x0[1], ..., x0[i]+InitialSimplexDelta[i], ..., + * x0[d-1]]. */ + itkSetMacro(AutomaticInitialSimplex, bool); + itkBooleanMacro(AutomaticInitialSimplex); + itkGetConstMacro(AutomaticInitialSimplex, bool); + + /** Set/Get the mode that determines if we want to use multiple runs of the + * Amoeba optimizer. If true, then the optimizer is rerun after it converges. + * The additional runs are performed using a simplex initialized with the + * best solution obtained by the previous runs. The edge length is half of + * that from the previous iteration. + */ + itkSetMacro(OptimizeWithRestarts, bool); + itkBooleanMacro(OptimizeWithRestarts); + itkGetConstMacro(OptimizeWithRestarts, bool); + + /** Set/Get the deltas that are used to define the initial simplex + * when AutomaticInitialSimplex is off. */ + void SetInitialSimplexDelta(ParametersType initialSimplexDelta, + bool automaticInitialSimplex = false); + itkGetConstMacro(InitialSimplexDelta, ParametersType); + + /** The optimization algorithm will terminate when the simplex + * diameter and the difference in cost function values at the corners of + * the simplex falls below user specified thresholds. The simplex + * diameter threshold is set via SetParametersConvergenceTolerance().*/ + itkSetMacro(ParametersConvergenceTolerance, double); + itkGetConstMacro(ParametersConvergenceTolerance, double); + + /** The optimization algorithm will terminate when the simplex + * diameter and the difference in cost function values at the corners of + * the simplex falls below user specified thresholds. The cost function + * convergence threshold is set via SetFunctionConvergenceTolerance().*/ + itkSetMacro(FunctionConvergenceTolerance, double); + itkGetConstMacro(FunctionConvergenceTolerance, double); + + /** Report the reason for stopping. */ + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; + + /** Method for getting access to the internal optimizer. */ + vnl_amoeba * GetOptimizer(void) const; + +protected: + AmoebaOptimizerv4(); + virtual ~AmoebaOptimizerv4(); + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; + +private: + /**Check that the settings are valid. If not throw an exception.*/ + void ValidateSettings(); + //purposely not implemented + AmoebaOptimizerv4(const Self &); + //purposely not implemented + void operator=(const Self &); + + ParametersType::ValueType m_ParametersConvergenceTolerance; + MeasureType m_FunctionConvergenceTolerance; + bool m_AutomaticInitialSimplex; + ParametersType m_InitialSimplexDelta; + bool m_OptimizeWithRestarts; + vnl_amoeba * m_VnlOptimizer; + + std::ostringstream m_StopConditionDescription; +}; +} // end namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkConvergenceMonitoringFunction.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkConvergenceMonitoringFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkConvergenceMonitoringFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkConvergenceMonitoringFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -98,7 +98,7 @@ ~ConvergenceMonitoringFunction() {} - void PrintSelf( std::ostream & os, Indent indent ) const + virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE { Superclass::PrintSelf( os, indent ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,180 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkExhaustiveOptimizerv4_h +#define __itkExhaustiveOptimizerv4_h + +#include "itkIntTypes.h" +#include "itkObjectToObjectOptimizerBase.h" + +namespace itk +{ +/** \class ExhaustiveOptimizerv4 + * \brief Optimizer that fully samples a grid on the parametric space. + * + * This optimizer is equivalent to an exahaustive search in a discrete grid + * defined over the parametric space. The grid is centered on the initial + * position. The subdivisions of the grid along each one of the dimensions + * of the parametric space is defined by an array of number of steps. + * + * A typical use is to plot the metric space to get an idea of how noisy it + * is. An example is given below, where it is desired to plot the metric + * space with respect to translations along x, y and z in a 3D registration + * application: + * Here it is assumed that the transform is Euler3DTransform. + * + * \code + * + * OptimizerType::StepsType steps( m_Transform->GetNumberOfParameters() ); + * steps[1] = 10; + * steps[2] = 10; + * steps[3] = 10; + * m_Optimizer->SetNumberOfSteps( steps ); + * m_Optimizer->SetStepLength( 2 ); + * + * \endcode + * + * The optimizer throws IterationEvents after every iteration. We use this to plot + * the metric space in an image as follows: + * + * \code + * + * if( itk::IterationEvent().CheckEvent(& event ) ) + * { + * IndexType index; + * index[0] = m_Optimizer->GetCurrentIndex()[0]; + * index[1] = m_Optimizer->GetCurrentIndex()[1]; + * index[2] = m_Optimizer->GetCurrentIndex()[2]; + * image->SetPixel( index, m_Optimizer->GetCurrentValue() ); + * } + * + * \endcode + * + * The image size is expected to be 11 x 11 x 11. + * + * If you wish to use different step lengths along each parametric axis, + * you can use the SetScales() method. This accepts an array, each element + * represents the number of subdivisions per step length. For instance scales + * of [0.5 1 4] along with a step length of 2 will cause the optimizer + * to search the metric space on a grid with x,y,z spacing of [1 2 8]. + * + * Physical dimensions of the grid are influenced by both the scales and + * the number of steps along each dimension, a side of the region is + * stepLength*(2*numberOfSteps[d]+1)*scaling[d]. + * + * \ingroup ITKOptimizersv4 + */ +template +class ExhaustiveOptimizerv4: + public ObjectToObjectOptimizerBaseTemplate +{ +public: + /** Standard "Self" typedef. */ + typedef ExhaustiveOptimizerv4 Self; + typedef ObjectToObjectOptimizerBaseTemplate Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(ExhaustiveOptimizerv4, Superclass); + + /** Steps type */ + typedef Array< SizeValueType > StepsType; + + /** Measure type */ + typedef typename Superclass::MeasureType MeasureType; + + /** Parameters type */ + typedef typename Superclass::ParametersType ParametersType; + + /** Scales type */ + typedef typename Superclass::ScalesType ScalesType; + + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** Start optimization */ + void StartWalking(void); + + /** Resume the optimization */ + void ResumeWalking(void); + + /** Stop optimization */ + void StopWalking(void); + + itkSetMacro(StepLength, double); + itkSetMacro(NumberOfSteps, StepsType); + itkGetConstReferenceMacro(StepLength, double); + itkGetConstReferenceMacro(NumberOfSteps, StepsType); + itkGetConstReferenceMacro(CurrentValue, MeasureType); + itkGetConstReferenceMacro(MaximumMetricValue, MeasureType); + itkGetConstReferenceMacro(MinimumMetricValue, MeasureType); + itkGetConstReferenceMacro(MinimumMetricValuePosition, ParametersType); + itkGetConstReferenceMacro(MaximumMetricValuePosition, ParametersType); + itkGetConstReferenceMacro(CurrentIndex, ParametersType); + + /** Get the reason for termination */ + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; + + /** Set the position to initialize the optimization. */ + void SetInitialPosition(const ParametersType & param); + + /** Get the position to initialize the optimization. */ + ParametersType & GetInitialPosition(void) + { + return m_InitialPosition; + } + +protected: + ExhaustiveOptimizerv4(); + virtual ~ExhaustiveOptimizerv4() {} + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + /** Advance to the next grid position. */ + void AdvanceOneStep(void); + + void IncrementIndex(ParametersType & param); + +protected: + ParametersType m_InitialPosition; + MeasureType m_CurrentValue; + StepsType m_NumberOfSteps; + bool m_Stop; + unsigned int m_CurrentParameter; + double m_StepLength; + ParametersType m_CurrentIndex; + MeasureType m_MaximumMetricValue; + MeasureType m_MinimumMetricValue; + ParametersType m_MinimumMetricValuePosition; + ParametersType m_MaximumMetricValuePosition; + +private: + //purposely not implemented + ExhaustiveOptimizerv4(const Self &); + void operator=(const Self &); + + std::ostringstream m_StopConditionDescription; +}; +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkExhaustiveOptimizerv4.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkExhaustiveOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,260 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkExhaustiveOptimizerv4_hxx +#define __itkExhaustiveOptimizerv4_hxx + +#include "itkExhaustiveOptimizerv4.h" + +namespace itk +{ + +template +ExhaustiveOptimizerv4 +::ExhaustiveOptimizerv4() : + m_CurrentValue(0), + m_NumberOfSteps(0), + m_Stop(false), + m_CurrentParameter(0), + m_StepLength(1.0), + m_CurrentIndex(0), + m_MaximumMetricValue(0.0), + m_MinimumMetricValue(0.0), + m_StopConditionDescription("") +{ + this->m_NumberOfIterations = 0; +} + +template +void +ExhaustiveOptimizerv4 +::StartOptimization(bool /* doOnlyInitialization */) +{ + this->StartWalking(); +} + +template +void +ExhaustiveOptimizerv4 +::StartWalking(void) +{ + itkDebugMacro("StartWalking"); + this->InvokeEvent( StartEvent() ); + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": Running"; + + ParametersType initialPos = this->m_Metric->GetParameters(); + m_MinimumMetricValuePosition = initialPos; + m_MaximumMetricValuePosition = initialPos; + + this->SetInitialPosition( initialPos ); // store the initial position + + MeasureType initialValue = this->m_Metric->GetValue(); + m_MaximumMetricValue = initialValue; + m_MinimumMetricValue = initialValue; + + this->m_CurrentIteration = 0; + this->m_NumberOfIterations = 1; + + const unsigned int spaceDimension = this->m_Metric->GetParameters().GetSize(); + + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + this->m_NumberOfIterations *= ( 2 * m_NumberOfSteps[i] + 1 ); + } + + m_CurrentIndex.SetSize(spaceDimension); + m_CurrentIndex.Fill(0); + + const ScalesType & scales = this->GetScales(); + // Make sure the scales have been set properly + if ( scales.size() != spaceDimension ) + { + itkExceptionMacro(<< "The size of Scales is " + << scales.size() + << ", but the NumberOfParameters is " + << spaceDimension + << "."); + } + + // Setup first grid position. + ParametersType position(spaceDimension); + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + position[i] = this->GetCurrentPosition()[i] - m_NumberOfSteps[i] * m_StepLength * scales[i]; + } + this->m_Metric->SetParameters(position); + + itkDebugMacro("Calling ResumeWalking"); + + this->ResumeWalking(); +} + +template +void +ExhaustiveOptimizerv4 +::ResumeWalking(void) +{ + itkDebugMacro("ResumeWalk"); + m_Stop = false; + + while ( !m_Stop ) + { + ParametersType currentPosition = this->GetCurrentPosition(); + + if ( m_Stop ) + { + StopWalking(); + break; + } + + m_CurrentValue = this->m_Metric->GetValue(); + + if ( m_CurrentValue > m_MaximumMetricValue ) + { + m_MaximumMetricValue = m_CurrentValue; + m_MaximumMetricValuePosition = currentPosition; + } + if ( m_CurrentValue < m_MinimumMetricValue ) + { + m_MinimumMetricValue = m_CurrentValue; + m_MinimumMetricValuePosition = currentPosition; + } + + if ( m_Stop ) + { + this->StopWalking(); + break; + } + + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": Running. "; + m_StopConditionDescription << "@ index " << this->GetCurrentIndex() << " value is " << m_CurrentValue; + + this->InvokeEvent( IterationEvent() ); + this->AdvanceOneStep(); + this->m_CurrentIteration++; + } +} + +template +void +ExhaustiveOptimizerv4 +::StopWalking(void) +{ + itkDebugMacro("StopWalking"); + + m_Stop = true; + this->InvokeEvent( EndEvent() ); +} + +template +void +ExhaustiveOptimizerv4 +::AdvanceOneStep(void) +{ + itkDebugMacro("AdvanceOneStep"); + + const unsigned int spaceDimension = this->m_Metric->GetParameters().GetSize(); + + ParametersType newPosition(spaceDimension); + this->IncrementIndex(newPosition); + + itkDebugMacro(<< "new position = " << newPosition); + + this->m_Metric->SetParameters(newPosition); +} + +template +void +ExhaustiveOptimizerv4 +::IncrementIndex(ParametersType & newPosition) +{ + unsigned int idx = 0; + const unsigned int spaceDimension = this->m_Metric->GetParameters().GetSize(); + + while ( idx < spaceDimension ) + { + m_CurrentIndex[idx]++; + + if ( m_CurrentIndex[idx] > ( 2 * m_NumberOfSteps[idx] ) ) + { + m_CurrentIndex[idx] = 0; + idx++; + } + else + { + break; + } + } + + if ( idx == spaceDimension ) + { + m_Stop = true; + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": "; + m_StopConditionDescription << "Completed sampling of parametric space of size " << spaceDimension; + } + + const ScalesType & scales = this->GetScales(); + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + newPosition[i] = ( m_CurrentIndex[i] - m_NumberOfSteps[i] ) + * m_StepLength * scales[i] + + this->GetInitialPosition()[i]; + } +} + +template +const std::string +ExhaustiveOptimizerv4 +::GetStopConditionDescription() const +{ + return m_StopConditionDescription.str(); +} + +template +void +ExhaustiveOptimizerv4 +::SetInitialPosition(const ParametersType & param) +{ + m_InitialPosition = param; + this->Modified(); +} + +template +void +ExhaustiveOptimizerv4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "InitialPosition = " << m_InitialPosition << std::endl; + os << indent << "CurrentValue = " << m_CurrentValue << std::endl; + os << indent << "NumberOfSteps = " << m_NumberOfSteps << std::endl; + os << indent << "Stop = " << m_Stop << std::endl; + os << indent << "CurrentParameter = " << m_CurrentParameter << std::endl; + os << indent << "StepLength = " << m_StepLength << std::endl; + os << indent << "CurrentIndex = " << m_CurrentIndex << std::endl; + os << indent << "MaximumMetricValue = " << m_MaximumMetricValue << std::endl; + os << indent << "MinimumMetricValue = " << m_MinimumMetricValue << std::endl; + os << indent << "MinimumMetricValuePosition = " << m_MinimumMetricValuePosition << std::endl; + os << indent << "MaximumMetricValuePosition = " << m_MaximumMetricValuePosition << std::endl; +} +} // end namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentLineSearchOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -131,7 +131,7 @@ { x = b - this->m_Resphi * ( b - a ); } - if ( vcl_abs( c - a ) < this->m_Epsilon * ( vcl_abs( b ) + vcl_abs( x ) ) ) + if ( std::abs( c - a ) < this->m_Epsilon * ( std::abs( b ) + std::abs( x ) ) ) { return ( c + a ) / 2; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.h 2014-09-03 08:29:34.000000000 +0000 @@ -19,8 +19,7 @@ #define __itkGradientDescentOptimizerBasev4_h #include "itkObjectToObjectOptimizerBase.h" - -#include "itkObjectToObjectOptimizerBase.h" +#include "itkWindowConvergenceMonitoringFunction.h" #include "itkThreadedIndexedContainerPartitioner.h" #include "itkDomainThreader.h" @@ -57,14 +56,15 @@ UPDATE_PARAMETERS_ERROR, STEP_TOO_SMALL, CONVERGENCE_CHECKER_PASSED, + GRADIENT_MAGNITUDE_TOLEARANCE, OTHER_ERROR } StopConditionType; /** Stop condition return string type */ - typedef std::string StopConditionReturnStringType; + typedef typename Superclass::StopConditionReturnStringType StopConditionReturnStringType; /** Stop condition internal string type */ - typedef std::ostringstream StopConditionDescriptionType; + typedef typename Superclass::StopConditionDescriptionType StopConditionDescriptionType; /** It should be possible to derive the internal computation type from the class object. */ typedef TInternalComputationValueType InternalComputationValueType; @@ -74,7 +74,7 @@ typedef typename MetricType::Pointer MetricTypePointer; /** Derivative type */ - typedef typename MetricType::DerivativeType DerivativeType; + typedef typename Superclass::DerivativeType DerivativeType; /** Measure type */ typedef typename Superclass::MeasureType MeasureType; @@ -83,6 +83,10 @@ typedef typename Superclass::ParametersType ParametersType; + /** Type for the convergence checker */ + typedef itk::Function::WindowConvergenceMonitoringFunction + ConvergenceMonitoringType; + /** Get the most recent gradient values. */ itkGetConstReferenceMacro( Gradient, DerivativeType ); @@ -93,11 +97,14 @@ itkSetMacro(NumberOfIterations, SizeValueType); /** Get the number of iterations. */ - itkGetConstReferenceMacro(NumberOfIterations, SizeValueType); + itkGetConstMacro(NumberOfIterations, SizeValueType); /** Get the current iteration number. */ itkGetConstMacro(CurrentIteration, SizeValueType); + /** Start and run the optimization */ + virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE; + /** Resume optimization. * This runs the optimization loop, and allows continuation * of stopped optimization */ @@ -108,7 +115,7 @@ virtual void StopOptimization(void); /** Get the reason for termination */ - virtual const StopConditionReturnStringType GetStopConditionDescription() const; + virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE; /** Modify the gradient in place, to advance the optimization. * This call performs a threaded modification for transforms with @@ -150,6 +157,39 @@ GradientDescentOptimizerBasev4Template(); virtual ~GradientDescentOptimizerBasev4Template(); + /** Flag to control use of the ScalesEstimator (if set) for + * automatic learning step estimation at *each* iteration. + */ + bool m_DoEstimateLearningRateAtEachIteration; + + /** Flag to control use of the ScalesEstimator (if set) for + * automatic learning step estimation only *once*, during first iteration. + */ + bool m_DoEstimateLearningRateOnce; + + /** The maximum step size in physical units, to restrict learning rates. + * Only used with automatic learning rate estimation. + * It may be initialized either by calling SetMaximumStepSizeInPhysicalUnits + * manually or by using m_ScalesEstimator automatically, and the former has + * higher priority than the latter. See main documentation. + */ + TInternalComputationValueType m_MaximumStepSizeInPhysicalUnits; + + /** Flag to control using the convergence monitoring for stop condition. + * This flag should be always set to true except for regular step gradient + * descent optimizer that uses minimum step length to check the convergence. + */ + bool m_UseConvergenceMonitoring; + + /** Window size for the convergence checker. + * The convergence checker calculates convergence value by fitting to + * a window of the energy (metric value) profile. + */ + SizeValueType m_ConvergenceWindowSize; + + /** The convergence checker. */ + typename ConvergenceMonitoringType::Pointer m_ConvergenceMonitoring; + typename DomainThreader::Pointer m_ModifyGradientByScalesThreader; typename DomainThreader::Pointer m_ModifyGradientByLearningRateThreader; @@ -157,14 +197,13 @@ bool m_Stop; StopConditionType m_StopCondition; StopConditionDescriptionType m_StopConditionDescription; - SizeValueType m_NumberOfIterations; - SizeValueType m_CurrentIteration; /** Current gradient */ DerivativeType m_Gradient; virtual void PrintSelf(std::ostream & os, Indent indent) const; private: + GradientDescentOptimizerBasev4Template( const Self & ); //purposely not implemented void operator=( const Self& ); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerBasev4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,8 @@ //------------------------------------------------------------------- template GradientDescentOptimizerBasev4Template -::GradientDescentOptimizerBasev4Template() +::GradientDescentOptimizerBasev4Template(): + m_Stop(false) { /** Threader for apply scales to gradient */ typename GradientDescentOptimizerBasev4ModifyGradientByScalesThreaderTemplate::Pointer modifyGradientByScalesThreader = @@ -40,10 +41,16 @@ GradientDescentOptimizerBasev4ModifyGradientByLearningRateThreaderTemplate::New(); this->m_ModifyGradientByLearningRateThreader = modifyGradientByLearningRateThreader; - this->m_NumberOfIterations = 100; - this->m_CurrentIteration = 0; this->m_StopCondition = MAXIMUM_NUMBER_OF_ITERATIONS; this->m_StopConditionDescription << this->GetNameOfClass() << ": "; + + this->m_MaximumStepSizeInPhysicalUnits = NumericTraits::Zero; + + this->m_UseConvergenceMonitoring = true; + this->m_ConvergenceWindowSize = 50; + + this->m_DoEstimateLearningRateAtEachIteration = false; + this->m_DoEstimateLearningRateOnce = true; } //------------------------------------------------------------------- @@ -59,8 +66,6 @@ ::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); - os << indent << "Number of iterations: " << this->m_NumberOfIterations << std::endl; - os << indent << "Current iteration: " << this->m_CurrentIteration << std::endl; os << indent << "Stop condition:"<< this->m_StopCondition << std::endl; os << indent << "Stop condition description: " << this->m_StopConditionDescription.str() << std::endl; } @@ -118,6 +123,47 @@ } } +template +void +GradientDescentOptimizerBasev4Template +::StartOptimization( bool doOnlyInitialization ) +{ + itkDebugMacro("StartOptimization"); + + /* Validate some settings */ + if ( this->m_ScalesEstimator.IsNotNull() && + this->m_DoEstimateLearningRateOnce && + this->m_DoEstimateLearningRateAtEachIteration ) + { + itkExceptionMacro("Both m_DoEstimateLearningRateOnce and " + "m_DoEstimateLearningRateAtEachIteration " + "are enabled. Not allowed. "); + } + + /* Estimate the parameter scales if requested. */ + if ( this->m_ScalesEstimator.IsNotNull() && this->m_DoEstimateScales ) + { + this->m_ScalesEstimator->EstimateScales(this->m_Scales); + itkDebugMacro( "Estimated scales = " << this->m_Scales ); + + /* If user hasn't set this, assign the default. */ + if ( this->m_MaximumStepSizeInPhysicalUnits <= NumericTraits::epsilon()) + { + this->m_MaximumStepSizeInPhysicalUnits = this->m_ScalesEstimator->EstimateMaximumStepSize(); + } + } + + if ( this->m_UseConvergenceMonitoring ) + { + // Initialize the convergence checker + this->m_ConvergenceMonitoring = ConvergenceMonitoringType::New(); + this->m_ConvergenceMonitoring->SetWindowSize( this->m_ConvergenceWindowSize ); + } + + /* Must call the superclass version for basic validation and setup */ + Superclass::StartOptimization( doOnlyInitialization ); +} + //------------------------------------------------------------------- template void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -19,8 +19,6 @@ #define __itkGradientDescentOptimizerv4_h #include "itkGradientDescentOptimizerBasev4.h" -#include "itkOptimizerParameterScalesEstimator.h" -#include "itkWindowConvergenceMonitoringFunction.h" namespace itk { @@ -40,15 +38,8 @@ * can be stored and retried via GetValue() and GetCurrentPosition(). * See SetReturnBestParametersAndValue(). * - * The user can scale each component of the df / dp in two ways: - * 1) manually, by setting a scaling vector using method SetScales(). - * Or, - * 2) automatically, by assigning a ScalesEstimator using SetScalesEstimator(). - * When ScalesEstimator is assigned, the optimizer is enabled by default to - * estimate scales, and can be changed via SetDoEstimateScales(). The scales - * are estimated and assigned once, during the call to StartOptimization(). - * This option will override any manually-assigned scales. - * + * Gradient scales can be manually set or automatically estimated, + * as documented in the base class. * The learing rate defaults to 1.0, and can be set in two ways: * 1) manually, via \c SetLearningRate(). * Or, @@ -62,9 +53,11 @@ * SetDoEstimateLearningRateOnce(false). When enabled, the optimizer computes learning * rate(s) such that at each step, each voxel's change in physical space will be less * than m_MaximumStepSizeInPhysicalUnits. + * * m_LearningRate = * m_MaximumStepSizeInPhysicalUnits / * m_ScalesEstimator->EstimateStepScale(scaledGradient) + * * where m_MaximumStepSizeInPhysicalUnits defaults to the voxel spacing returned by * m_ScalesEstimator->EstimateMaximumStepSize() (which is typically 1 voxel), * and can be set by the user via SetMaximumStepSizeInPhysicalUnits(). @@ -111,10 +104,6 @@ typedef typename Superclass::ParametersType ParametersType; typedef typename Superclass::StopConditionType StopConditionType; - /** Type for the convergence checker */ - typedef itk::Function::WindowConvergenceMonitoringFunction - ConvergenceMonitoringType; - /** Set the learning rate. */ itkSetMacro(LearningRate, TInternalComputationValueType); @@ -132,25 +121,6 @@ /** Get the maximum step size, in physical space units. */ itkGetConstReferenceMacro(MaximumStepSizeInPhysicalUnits, TInternalComputationValueType); - /** Set the scales estimator. - * - * A ScalesEstimator is required for the scales and learning rate estimation - * options to work. See the main documentation. - * - * \sa SetDoEstimateScales() - * \sa SetDoEstimateLearningRateAtEachIteration() - * \sa SetDoEstimateLearningOnce() - */ - itkSetObjectMacro(ScalesEstimator, OptimizerParameterScalesEstimatorTemplate); - - /** Option to use ScalesEstimator for scales estimation. - * The estimation is performed once at begin of - * optimization, and overrides any scales set using SetScales(). - * Default is true. */ - itkSetMacro(DoEstimateScales, bool); - itkGetConstReferenceMacro(DoEstimateScales, bool); - itkBooleanMacro(DoEstimateScales); - /** Option to use ScalesEstimator for learning rate estimation at * *each* iteration. The estimation overrides the learning rate * set by SetLearningRate(). Default is false. @@ -213,11 +183,11 @@ itkBooleanMacro(ReturnBestParametersAndValue); /** Start and run the optimization */ - virtual void StartOptimization( bool doOnlyInitialization = false ); + virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE; - virtual void StopOptimization(void); + virtual void StopOptimization(void) ITK_OVERRIDE; - virtual void ResumeOptimization(); + virtual void ResumeOptimization() ITK_OVERRIDE; /** Estimate the learning rate based on the current gradient. */ virtual void EstimateLearningRate(); @@ -229,19 +199,14 @@ virtual void AdvanceOneStep(void); /** Modify the gradient over a given index range. */ - virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ); - virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ); + virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE; + virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE; /** Manual learning rate to apply. It is overridden by * automatic learning rate estimation if enabled. See main documentation. */ TInternalComputationValueType m_LearningRate; - /** The maximum step size in physical units, to restrict learning rates. - * Only used with automatic learning rate estimation. See main documentation. - */ - TInternalComputationValueType m_MaximumStepSizeInPhysicalUnits; - /** Default constructor */ GradientDescentOptimizerv4Template(); @@ -250,8 +215,6 @@ virtual void PrintSelf( std::ostream & os, Indent indent ) const; - typename OptimizerParameterScalesEstimatorTemplate::Pointer m_ScalesEstimator; - /** Minimum convergence value for convergence checking. * The convergence checker calculates convergence value by fitting to * a window of the energy profile. When the convergence value reaches @@ -259,19 +222,10 @@ */ TInternalComputationValueType m_MinimumConvergenceValue; - /** Window size for the convergence checker. - * The convergence checker calculates convergence value by fitting to - * a window of the energy (metric value) profile. - */ - SizeValueType m_ConvergenceWindowSize; - /** Current convergence value. */ /* WindowConvergenceMonitoringFunction always returns output convergence value in 'TInternalComputationValueType' precision */ TInternalComputationValueType m_ConvergenceValue; - /** The convergence checker. */ - typename ConvergenceMonitoringType::Pointer m_ConvergenceMonitoring; - /** Store the best value and related paramters */ MeasureType m_CurrentBestValue; ParametersType m_BestParameters; @@ -279,21 +233,14 @@ /** Flag to control returning of best value and parameters. */ bool m_ReturnBestParametersAndValue; -private: - /** Flag to control use of the ScalesEstimator (if set) for - * automatic scale estimation during StartOptimization() - */ - bool m_DoEstimateScales; - - /** Flag to control use of the ScalesEstimator (if set) for - * automatic learning step estimation at *each* iteration. + /** Store the previous gradient value at each iteration, + * so we can detect the changes in geradient direction. + * This is needed by the regular step gradient descent and + * Quasi newton optimizers. */ - bool m_DoEstimateLearningRateAtEachIteration; + DerivativeType m_PreviousGradient; - /** Flag to control use of the ScalesEstimator (if set) for - * automatic learning step estimation only *once*, during first iteration. - */ - bool m_DoEstimateLearningRateOnce; +private: GradientDescentOptimizerv4Template( const Self & ); //purposely not implemented void operator=( const Self& ); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkGradientDescentOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,21 +31,9 @@ ::GradientDescentOptimizerv4Template() { this->m_LearningRate = NumericTraits::One; - - // m_MaximumStepSizeInPhysicalUnits is used for automatic learning - // rate estimation. it may be initialized either by calling - // SetMaximumStepSizeInPhysicalUnits manually or by using m_ScalesEstimator - // automatically. and the former has higher priority than the latter. - this->m_MaximumStepSizeInPhysicalUnits = NumericTraits::Zero; - - // Initialize parameters for the convergence checker - this->m_MinimumConvergenceValue = 1e-8;//NumericTraits::epsilon();//1e-30; - this->m_ConvergenceWindowSize = 50; - - this->m_DoEstimateScales = true; - this->m_DoEstimateLearningRateAtEachIteration = false; - this->m_DoEstimateLearningRateOnce = true; + this->m_MinimumConvergenceValue = 1e-8; this->m_ReturnBestParametersAndValue = false; + this->m_PreviousGradient.Fill( NumericTraits::Zero ); } /** @@ -69,16 +57,6 @@ os << indent << "Learning rate:" << this->m_LearningRate << std::endl; os << indent << "MaximumStepSizeInPhysicalUnits: " << this->m_MaximumStepSizeInPhysicalUnits << std::endl; - if( this->m_ScalesEstimator.IsNull() ) - { - os << indent << "No ScalesEstimator set." << std::endl; - } - else - { - os << indent << "ScalesEstimator: " << std::endl; - this->m_ScalesEstimator->Print( os, indent.GetNextIndent() ); - } - os << indent << "DoEstimateScales: " << this->m_DoEstimateScales << std::endl; os << indent << "DoEstimateLearningRateAtEachIteration: " << this->m_DoEstimateLearningRateAtEachIteration << std::endl; os << indent << "DoEstimateLearningRateOnce: " @@ -93,34 +71,6 @@ GradientDescentOptimizerv4Template ::StartOptimization( bool doOnlyInitialization ) { - itkDebugMacro("StartOptimization"); - - /* Validate some settings */ - if ( this->m_ScalesEstimator.IsNotNull() && - this->m_DoEstimateLearningRateOnce && - this->m_DoEstimateLearningRateAtEachIteration ) - { - itkExceptionMacro("Both m_DoEstimateLearningRateOnce and m_DoEstimateLearningRateAtEachIteration are enabled. Not allowed. "); - } - - /* Estimate the parameter scales if requested. */ - if ( this->m_DoEstimateScales && this->m_ScalesEstimator.IsNotNull() ) - { - this->m_ScalesEstimator->EstimateScales(this->m_Scales); - itkDebugMacro( "Estimated scales = " << this->m_Scales ); - - /* If user hasn't set this, assign the default. */ - if ( this->m_MaximumStepSizeInPhysicalUnits <= - NumericTraits::epsilon()) - { - this->m_MaximumStepSizeInPhysicalUnits = this->m_ScalesEstimator->EstimateMaximumStepSize(); - } - } - - // Initialize the convergence checker - this->m_ConvergenceMonitoring = ConvergenceMonitoringType::New(); - this->m_ConvergenceMonitoring->SetWindowSize( this->m_ConvergenceWindowSize ); - /* Must call the superclass version for basic validation and setup */ Superclass::StartOptimization( doOnlyInitialization ); @@ -169,6 +119,18 @@ this->m_Stop = false; while( ! this->m_Stop ) { + // Do not run the loop if the maximum number of iterations is reached or its value is zero. + if ( this->m_CurrentIteration >= this->m_NumberOfIterations ) + { + this->m_StopConditionDescription << "Maximum number of iterations (" << this->m_NumberOfIterations << ") exceeded."; + this->m_StopCondition = Superclass::MAXIMUM_NUMBER_OF_ITERATIONS; + this->StopOptimization(); + break; + } + + // Save previous value with shallow swap that will be used by child optimizer. + swap( this->m_PreviousGradient, this->m_Gradient ); + /* Compute metric value/derivative. */ try { @@ -196,21 +158,24 @@ /* Check the convergence by WindowConvergenceMonitoringFunction. */ - this->m_ConvergenceMonitoring->AddEnergyValue( this->m_CurrentMetricValue ); - try + if ( this->m_UseConvergenceMonitoring ) { - this->m_ConvergenceValue = this->m_ConvergenceMonitoring->GetConvergenceValue(); - if (this->m_ConvergenceValue <= this->m_MinimumConvergenceValue) + this->m_ConvergenceMonitoring->AddEnergyValue( this->m_CurrentMetricValue ); + try { - this->m_StopConditionDescription << "Convergence checker passed at iteration " << this->m_CurrentIteration << "."; - this->m_StopCondition = Superclass::CONVERGENCE_CHECKER_PASSED; - this->StopOptimization(); - break; + this->m_ConvergenceValue = this->m_ConvergenceMonitoring->GetConvergenceValue(); + if (this->m_ConvergenceValue <= this->m_MinimumConvergenceValue) + { + this->m_StopConditionDescription << "Convergence checker passed at iteration " << this->m_CurrentIteration << "."; + this->m_StopCondition = Superclass::CONVERGENCE_CHECKER_PASSED; + this->StopOptimization(); + break; + } + } + catch(std::exception & e) + { + std::cerr << "GetConvergenceValue() failed with exception: " << e.what() << std::endl; } - } - catch(std::exception & e) - { - std::cerr << "GetConvergenceValue() failed with exception: " << e.what() << std::endl; } /* Advance one step along the gradient. @@ -227,13 +192,6 @@ /* Update and check iteration count */ this->m_CurrentIteration++; - if ( this->m_CurrentIteration >= this->m_NumberOfIterations ) - { - this->m_StopConditionDescription << "Maximum number of iterations (" << this->m_NumberOfIterations << ") exceeded."; - this->m_StopCondition = Superclass::MAXIMUM_NUMBER_OF_ITERATIONS; - this->StopOptimization(); - break; - } } //while (!m_Stop) } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSBOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSBOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSBOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSBOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,181 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkLBFGSBOptimizerv4_h +#define __itkLBFGSBOptimizerv4_h + +#include "itkLBFGSOptimizerBasev4.h" +#include "vnl/algo/vnl_lbfgsb.h" + +namespace itk +{ +/* Necessary forward declaration */ +/** \class LBFGSBOptimizerHelperv4 + * \brief Wrapper helper around vnl_lbfgsb. + * + * This class is used to translate iteration events, etc, from + * vnl_lbfgsb into iteration events in ITK. + * + * \ingroup ITKOptimizersv4 + */ +class LBFGSBOptimizerHelperv4; + +/** \class LBFGSBOptimizerv4 + * \brief Limited memory Broyden Fletcher Goldfarb Shannon minimization with simple bounds. + * + * This class is a wrapper for converted fortan code for performing limited + * memory Broyden Fletcher Goldfarb Shannon minimization with simple bounds. + * The algorithm miminizes a nonlinear function f(x) of n variables subject to + * simple bound constraints of l <= x <= u. + * + * See also the documentation in Numerics/lbfgsb.c + * + * References: + * + * [1] R. H. Byrd, P. Lu and J. Nocedal. + * A Limited Memory Algorithm for Bound Constrained Optimization, (1995), + * SIAM Journal on Scientific and Statistical Computing , + * 16, 5, pp. 1190-1208. + * + * [2] C. Zhu, R. H. Byrd and J. Nocedal. + * L-BFGS-B: Algorithm 778: L-BFGS-B, FORTRAN routines for large scale + * bound constrained optimization (1997), + * ACM Transactions on Mathematical Software, + * Vol 23, Num. 4, pp. 550 - 560. + * + * \ingroup Numerics Optimizersv4 + * \ingroup ITKOptimizersv4 + */ +class LBFGSBOptimizerv4: + public LBFGSOptimizerBasev4< vnl_lbfgsb > +{ +public: + /** Standard "Self" typedef. */ + typedef LBFGSBOptimizerv4 Self; + typedef LBFGSOptimizerBasev4 Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + typedef Superclass::MetricType MetricType; + typedef Superclass::ParametersType ParametersType; + typedef Superclass::ScalesType ScalesType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(LBFGSBOptimizerv4, Superclass); + + enum BoundSelectionValues { + UNBOUNDED = 0, + LOWERBOUNDED = 1, + BOTHBOUNDED = 2, + UPPERBOUNDED = 3 + }; + + /** BoundValue type. + * Use for defining the lower and upper bounds on the variables. + */ + typedef Array< double > BoundValueType; + + /** BoundSelection type + * Use for defining the boundary condition for each variables. + */ + typedef Array< long > BoundSelectionType; + + /** Set the position to initialize the optimization. */ + void SetInitialPosition(const ParametersType & param); + + /** Get the position to initialize the optimization. */ + ParametersType & GetInitialPosition(void) + { + return m_InitialPosition; + } + + /** Start optimization with an initial value. */ + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** Plug in a Cost Function into the optimizer */ + virtual void SetMetric(MetricType *metric) ITK_OVERRIDE; + + /** Set the lower bound value for each variable. */ + void SetLowerBound(const BoundValueType & value); + + itkGetConstReferenceMacro(LowerBound,BoundValueType); + + /** Set the upper bound value for each variable. */ + void SetUpperBound(const BoundValueType & value); + + itkGetConstReferenceMacro(UpperBound,BoundValueType); + + /** Set the boundary condition for each variable, where + * select[i] = 0 if x[i] is unbounded, + * = 1 if x[i] has only a lower bound, + * = 2 if x[i] has both lower and upper bounds, and + * = 3 if x[1] has only an upper bound + */ + void SetBoundSelection(const BoundSelectionType & select); + + itkGetConstReferenceMacro(BoundSelection,BoundSelectionType); + + /** Set/Get the CostFunctionConvergenceFactor. Algorithm terminates + * when the reduction in cost function is less than factor * epsmcj + * where epsmch is the machine precision. + * Typical values for factor: 1e+12 for low accuracy; + * 1e+7 for moderate accuracy and 1e+1 for extremely high accuracy. + */ + virtual void SetCostFunctionConvergenceFactor(double); + + itkGetConstMacro(CostFunctionConvergenceFactor, double); + + /** Set/Get the MaximumNumberOfCorrections. Default is 5 */ + virtual void SetMaximumNumberOfCorrections(unsigned int); + + itkGetConstMacro(MaximumNumberOfCorrections, unsigned int); + + /** This optimizer does not support scaling of the derivatives. */ + virtual void SetScales(const ScalesType &) ITK_OVERRIDE; + + /** Get the current infinity norm of the project gradient of the cost + * function. */ + itkGetConstReferenceMacro(InfinityNormOfProjectedGradient, double); + +protected: + LBFGSBOptimizerv4(); + virtual ~LBFGSBOptimizerv4(); + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; + + /** Internal optimizer type. */ + typedef LBFGSBOptimizerHelperv4 InternalOptimizerType; + + friend class LBFGSBOptimizerHelperv4; + +private: + LBFGSBOptimizerv4(const Self &); //purposely not implemented + void operator=(const Self &); //purposely not implemented + + unsigned int m_MaximumNumberOfCorrections; + + ParametersType m_InitialPosition; + BoundValueType m_LowerBound; + BoundValueType m_UpperBound; + BoundSelectionType m_BoundSelection; +}; +} // end namespace itk +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,169 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkLBFGSOptimizerBasev4_h +#define __itkLBFGSOptimizerBasev4_h + +#include "itkSingleValuedNonLinearVnlOptimizerv4.h" +#include "vnl/algo/vnl_lbfgs.h" +#include "vnl/algo/vnl_lbfgsb.h" +#include "itkAutoPointer.h" + +namespace itk +{ +/* Necessary forward declaration see below for definition */ +/** \class LBFGSOptimizerBaseHelperv4 + * \brief Wrapper helper around vnl optimizer. + * + * This class is used to translate iteration events, etc, from + * vnl_lbfgsb into iteration events in ITK. + * + * \ingroup ITKOptimizersv4 + */ +template< typename TInternalVnlOptimizerType > +class LBFGSOptimizerBaseHelperv4; + +/** \class LBFGSOptimizerBasev4 + * \brief Abstract base for vnl lbfgs algorithm optimizers in ITKv4 registration framework. + * + * \note The StopConditionDescription returned by this class is directly from the vnl + * optimizer by calling m_VnlOptimizer->get_failure_code() . This seems to + * return "Failure" even when no error has occured. The same behavior is observed + * in the ITKv3 version of this optimizer. + * + * \note Local-support (high-density) transforms. + * Local-support transforms are not supported. To add support for these, + * the class must be modified thusly: + * + * \note 1) Parameter updates: + * In SingleValuedNonLinearCostFunctionAdaptor, the handling of the gradient + * must be changed to accomodate the fact that local-support transforms expect + * a gradient to be added to the transform parameters using the + * UpdateTransformParameters method of the local support transform. Other optimizers + * in the v4 framework use this method, but the use of the vnl optimizers here + * complicates it. + * + * \note 2) Efficiency + * To work efficiently with local-support transforms, this class should be + * modified to use a single parameter object to avoid the multiple + * parameter copies that are currently performed. It should work to use + * the transform parameters pointer. + * + * This code has been adapted for the ITKv4 registration framework from the + * v3 version, itkLBFGSOptimizer. + * + * \ingroup ITKOptimizersv4 + */ +template< typename TInternalVnlOptimizerType > +class LBFGSOptimizerBasev4: + public SingleValuedNonLinearVnlOptimizerv4 +{ +public: + /** Standard "Self" typedef. */ + typedef LBFGSOptimizerBasev4 Self; + typedef SingleValuedNonLinearVnlOptimizerv4 Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Run-time type information (and related methods). */ + itkTypeMacro(LBFGSOptimizerBasev4, SingleValuedNonLinearVnlOptimizerv4); + + typedef Superclass::MetricType MetricType; + typedef Superclass::ParametersType ParametersType; + typedef Superclass::ScalesType ScalesType; + + /** Stop condition return string type */ + typedef Superclass::StopConditionReturnStringType StopConditionReturnStringType; + + /** Stop condition internal string type */ + typedef Superclass::StopConditionDescriptionType StopConditionDescriptionType; + + /** The vnl optimizer */ + typedef LBFGSOptimizerBaseHelperv4 InternalOptimizerType; + + /** Method for getting access to the internal optimizer. */ + InternalOptimizerType * GetOptimizer(void); + + /** Start optimization with an initial value. */ + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** Plug in a Cost Function into the optimizer */ + virtual void SetMetric(MetricType *metric) ITK_OVERRIDE; + + /** Set/Get the optimizer trace flag. If set to true, the optimizer + * prints out information every iteration. + */ + virtual void SetTrace(bool flag); + + itkGetConstMacro(Trace, bool); + itkBooleanMacro(Trace); + + /** Set/Get the maximum number of function evaluations allowed. */ + virtual void SetMaximumNumberOfFunctionEvaluations(unsigned int n); + + itkGetConstMacro(MaximumNumberOfFunctionEvaluations, unsigned int); + + /** Set/Get the gradient convergence tolerance. This is a positive + * real number that determines the accuracy with which the solution is to + * be found. The optimization terminates when: + * ||G|| < gtol max(1,||X||) where ||.|| denotes the Euclidean norm. + */ + virtual void SetGradientConvergenceTolerance(double gtol); + + itkGetConstMacro(GradientConvergenceTolerance, double); + + /** Get the reason for termination */ + virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE; + +protected: + LBFGSOptimizerBasev4(); + virtual ~LBFGSOptimizerBasev4(); + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + typedef Superclass::CostFunctionAdaptorType CostFunctionAdaptorType; + + bool m_OptimizerInitialized; + + typedef AutoPointer InternalOptimizerAutoPointer; + InternalOptimizerAutoPointer m_VnlOptimizer; + + mutable std::ostringstream m_StopConditionDescription; + + bool m_Trace; + unsigned int m_MaximumNumberOfFunctionEvaluations; + double m_GradientConvergenceTolerance; + double m_InfinityNormOfProjectedGradient; + unsigned int m_MaximumNumberOfIterations; + double m_CostFunctionConvergenceFactor; + + // give the helper access to member variables, to update iteration + // counts, etc. + friend class LBFGSOptimizerBaseHelperv4; + friend class LBFGSBOptimizerHelperv4; + +private: + LBFGSOptimizerBasev4(const Self &); //purposely not implemented + void operator=(const Self &); //purposely not implemented + +}; +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkLBFGSOptimizerBasev4.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerBasev4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,258 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkLBFGSOptimizerBasev4_hxx +#define __itkLBFGSOptimizerBasev4_hxx + +#include "itkLBFGSOptimizerBasev4.h" + +extern "C" { + extern double v3p_netlib_dpmeps_(); +} + +namespace itk +{ + +template< typename TInternalVnlOptimizerType > +class LBFGSOptimizerBaseHelperv4: public TInternalVnlOptimizerType +{ + public: + typedef LBFGSOptimizerBaseHelperv4 Self; + typedef TInternalVnlOptimizerType Superclass; + + LBFGSOptimizerBaseHelperv4(vnl_cost_function & f, + LBFGSOptimizerBasev4 * itkObj): + TInternalVnlOptimizerType(f), + m_ItkObj(itkObj) + { + } + + protected: + LBFGSOptimizerBasev4 * m_ItkObj; +}; + +template +LBFGSOptimizerBasev4 +::LBFGSOptimizerBasev4(): + m_OptimizerInitialized(false), + m_Trace(false), + m_MaximumNumberOfFunctionEvaluations(2000), + m_GradientConvergenceTolerance(1e-5), + m_InfinityNormOfProjectedGradient(0.0), + m_MaximumNumberOfIterations(500), + m_CostFunctionConvergenceFactor(1e+7) +{ +} + +template +LBFGSOptimizerBasev4 +::~LBFGSOptimizerBasev4() +{ +} + +template +void +LBFGSOptimizerBasev4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "Trace: "; + if ( m_Trace ) + { + os << "On"; + } + else + { + os << "Off"; + } + os << std::endl; + os << indent << "MaximumNumberOfFunctionEvaluations: " + << m_MaximumNumberOfFunctionEvaluations << std::endl; + os << indent << "GradientConvergenceTolerance: " + << m_GradientConvergenceTolerance << std::endl; +} + +template +void +LBFGSOptimizerBasev4 +::SetTrace(bool flag) +{ + if ( flag == m_Trace ) + { + return; + } + + m_Trace = flag; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_trace(m_Trace); + } + + this->Modified(); +} + +template +void +LBFGSOptimizerBasev4 +::SetMaximumNumberOfFunctionEvaluations(unsigned int n) +{ + if ( n == m_MaximumNumberOfFunctionEvaluations ) + { + return; + } + + m_MaximumNumberOfFunctionEvaluations = n; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_max_function_evals( + static_cast< int >( m_MaximumNumberOfFunctionEvaluations ) ); + } + + this->Modified(); +} + +template +void +LBFGSOptimizerBasev4 +::SetGradientConvergenceTolerance(double f) +{ + if ( f == m_GradientConvergenceTolerance ) + { + return; + } + + m_GradientConvergenceTolerance = f; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_g_tolerance(m_GradientConvergenceTolerance); + } + + this->Modified(); +} + +template +void +LBFGSOptimizerBasev4 +::SetMetric(MetricType *metric) +{ + // assign to base class + this->m_Metric = metric; + + // assign to vnl cost-function adaptor + const unsigned int numberOfParameters = metric->GetNumberOfParameters(); + + CostFunctionAdaptorType *adaptor = new CostFunctionAdaptorType( numberOfParameters ); + + adaptor->SetCostFunction( metric ); + + this->SetCostFunctionAdaptor( adaptor ); + + m_VnlOptimizer.TakeOwnership( new InternalOptimizerType( *adaptor, this ) ); +} + +template +void +LBFGSOptimizerBasev4 +::StartOptimization(bool /* doOnlyInitialization */) +{ + // Check for a local-support transform. + // These aren't currently supported, see main class documentation. + if( this->GetMetric()->HasLocalSupport() ) + { + itkExceptionMacro("The assigned transform has local-support. This is not supported for this optimizer. See the optimizer documentation."); + } + + // Perform some verification, check scales, + // pass settings to cost-function adaptor. + Superclass::StartOptimization(); +} + +template +typename LBFGSOptimizerBasev4::InternalOptimizerType * +LBFGSOptimizerBasev4 +::GetOptimizer() +{ + return m_VnlOptimizer.GetPointer(); +} + +template +const std::string +LBFGSOptimizerBasev4 +::GetStopConditionDescription() const +{ + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": "; + if ( m_VnlOptimizer ) + { + switch ( m_VnlOptimizer->get_failure_code() ) + { + case vnl_nonlinear_minimizer::ERROR_FAILURE: + m_StopConditionDescription << "Failure"; + break; + case vnl_nonlinear_minimizer::ERROR_DODGY_INPUT: + m_StopConditionDescription << "Dodgy input"; + break; + case vnl_nonlinear_minimizer::CONVERGED_FTOL: + m_StopConditionDescription << "Function tolerance reached after " + << m_CurrentIteration + << " iterations. " + << "The relative reduction of the cost function <= " + << m_CostFunctionConvergenceFactor * v3p_netlib_dpmeps_() + << " = CostFunctionConvergenceFactor (" + << m_CostFunctionConvergenceFactor + << ") * machine precision (" + << v3p_netlib_dpmeps_() + << ")."; + break; + case vnl_nonlinear_minimizer::CONVERGED_XTOL: + m_StopConditionDescription << "Solution tolerance reached"; + break; + case vnl_nonlinear_minimizer::CONVERGED_XFTOL: + m_StopConditionDescription << "Solution and Function tolerance both reached"; + break; + case vnl_nonlinear_minimizer::CONVERGED_GTOL: + m_StopConditionDescription << "Gradient tolerance reached. " + << "Gradient tolerance is " + << m_GradientConvergenceTolerance; + break; + case vnl_nonlinear_minimizer::FAILED_TOO_MANY_ITERATIONS: + m_StopConditionDescription << "Too many function evaluations. Function evaluations = " + << m_MaximumNumberOfFunctionEvaluations; + break; + case vnl_nonlinear_minimizer::FAILED_FTOL_TOO_SMALL: + m_StopConditionDescription << "Function tolerance too small"; + break; + case vnl_nonlinear_minimizer::FAILED_XTOL_TOO_SMALL: + m_StopConditionDescription << "Solution tolerance too small"; + break; + case vnl_nonlinear_minimizer::FAILED_GTOL_TOO_SMALL: + m_StopConditionDescription << "Gradient tolerance too small"; + break; + case vnl_nonlinear_minimizer::FAILED_USER_REQUEST: + m_StopConditionDescription << "User requested"; + break; + } + return m_StopConditionDescription.str(); + } + else + { + return std::string(""); + } +} +} // end namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkLBFGSOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,99 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkLBFGSOptimizerv4_h +#define __itkLBFGSOptimizerv4_h + +#include "itkLBFGSOptimizerBasev4.h" +#include "vnl/algo/vnl_lbfgs.h" + +namespace itk +{ +/** \class LBFGSOptimizerv4 + * \brief Wrap of the vnl_lbfgs algorithm for use in ITKv4 registration framework. + * + * \ingroup ITKOptimizersv4 + */ + +class LBFGSOptimizerv4: + public LBFGSOptimizerBasev4< vnl_lbfgs > +{ +public: + /** Standard "Self" typedef. */ + typedef LBFGSOptimizerv4 Self; + typedef LBFGSOptimizerBasev4 Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + typedef Superclass::MetricType MetricType; + typedef Superclass::ParametersType ParametersType; + typedef Superclass::ScalesType ScalesType; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(LBFGSOptimizerv4, Superclass); + + /** Start optimization with an initial value. */ + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** Plug in a Cost Function into the optimizer */ + virtual void SetMetric(MetricType *metric) ITK_OVERRIDE; + + void VerboseOn(void); + void VerboseOff(void); + + /** Set/Get the line search accuracy. This is a positive real number + * with a default value of 0.9, which controls the accuracy of the line + * search. If the function and gradient evalutions are inexpensive with + * respect to the cost of the iterations it may be advantageous to set + * the value to a small value (say 0.1). + */ + void SetLineSearchAccuracy(double tol); + + itkGetConstMacro(LineSearchAccuracy, double); + + /** Set/Get the default step size. This is a positive real number + * with a default value of 1.0 which determines the step size in the line + * search. + */ + void SetDefaultStepLength(double stp); + + itkGetConstMacro(DefaultStepLength, double); + +protected: + LBFGSOptimizerv4(); + virtual ~LBFGSOptimizerv4(); + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + /** InternalParameters typedef. */ + typedef vnl_vector< double > InternalParametersType; + + /** Internal optimizer type. */ + typedef vnl_lbfgs InternalOptimizerType; + +private: + LBFGSOptimizerv4(const Self &); //purposely not implemented + void operator=(const Self &); //purposely not implemented + + bool m_Verbose; + double m_LineSearchAccuracy; + double m_DefaultStepLength; +}; +} // end namespace itk +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -70,10 +70,10 @@ typedef typename Superclass::StopConditionType StopConditionType; /** Stop condition return string type */ - typedef std::string StopConditionReturnStringType; + typedef typename Superclass::StopConditionReturnStringType StopConditionReturnStringType; /** Stop condition internal string type */ - typedef std::ostringstream StopConditionDescriptionType; + typedef typename Superclass::StopConditionDescriptionType StopConditionDescriptionType; /** It should be possible to derive the internal computation type from the class object. */ typedef TInternalComputationValueType InternalComputationValueType; @@ -92,15 +92,6 @@ /** Get stop condition enum */ itkGetConstReferenceMacro(StopCondition, StopConditionType); - /** Set the number of iterations. */ - itkSetMacro(NumberOfIterations, SizeValueType); - - /** Get the number of iterations. */ - itkGetConstReferenceMacro(NumberOfIterations, SizeValueType); - - /** Get the current iteration number. */ - itkGetConstMacro(CurrentIteration, SizeValueType); - /** Begin the optimization */ virtual void StartOptimization( bool doOnlyInitialization = false ); @@ -113,7 +104,7 @@ virtual void ResumeOptimization(); /** Get the reason for termination */ - virtual const StopConditionReturnStringType GetStopConditionDescription() const; + virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE; /** Get the list of optimizers currently held. */ OptimizersListType & GetOptimizersList(); @@ -136,8 +127,6 @@ bool m_Stop; StopConditionType m_StopCondition; StopConditionDescriptionType m_StopConditionDescription; - SizeValueType m_NumberOfIterations; - SizeValueType m_CurrentIteration; OptimizersListType m_OptimizersList; MetricValuesListType m_MetricValuesList; MeasureType m_MinimumMetricValue; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiGradientOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,10 +26,10 @@ //------------------------------------------------------------------- template MultiGradientOptimizerv4Template -::MultiGradientOptimizerv4Template() +::MultiGradientOptimizerv4Template(): + m_Stop(false) { this->m_NumberOfIterations = static_cast(0); - this->m_CurrentIteration = static_cast(0); this->m_StopCondition = Superclass::MAXIMUM_NUMBER_OF_ITERATIONS; this->m_StopConditionDescription << this->GetNameOfClass() << ": "; @@ -51,8 +51,6 @@ ::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); - os << indent << "Number of iterations: " << this->m_NumberOfIterations << std::endl; - os << indent << "Current iteration: " << this->m_CurrentIteration << std::endl; os << indent << "Stop condition:"<< this->m_StopCondition << std::endl; os << indent << "Stop condition description: " << this->m_StopConditionDescription.str() << std::endl; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,10 +73,11 @@ } StopConditionType; /** Stop condition return string type */ - typedef std::string StopConditionReturnStringType; + typedef typename Superclass::StopConditionReturnStringType StopConditionReturnStringType; /** Stop condition internal string type */ - typedef std::ostringstream StopConditionDescriptionType; + typedef typename Superclass::StopConditionDescriptionType StopConditionDescriptionType; + /** Stop condition return string type */ /** It should be possible to derive the internal computation type from the class object. */ typedef TInternalComputationValueType InternalComputationValueType; @@ -95,15 +96,6 @@ /** Get stop condition enum */ itkGetConstReferenceMacro(StopCondition, StopConditionType); - /** Set the number of iterations. */ - itkSetMacro(NumberOfIterations, SizeValueType); - - /** Get the number of iterations. */ - itkGetConstReferenceMacro(NumberOfIterations, SizeValueType); - - /** Get the current iteration number. */ - itkGetConstMacro(CurrentIteration, SizeValueType); - /** Create an instance of the local optimizer */ void InstantiateLocalOptimizer(void); @@ -119,7 +111,7 @@ virtual void ResumeOptimization(); /** Get the reason for termination */ - virtual const StopConditionReturnStringType GetStopConditionDescription() const; + virtual const StopConditionReturnStringType GetStopConditionDescription() const ITK_OVERRIDE; /** Get the list of parameters over which to search. */ ParametersListType & GetParametersList(); @@ -150,8 +142,6 @@ bool m_Stop; StopConditionType m_StopCondition; StopConditionDescriptionType m_StopConditionDescription; - SizeValueType m_NumberOfIterations; - SizeValueType m_CurrentIteration; ParametersListType m_ParametersList; MetricValuesListType m_MetricValuesList; MeasureType m_MinimumMetricValue; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkMultiStartOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,17 +26,17 @@ //------------------------------------------------------------------- template MultiStartOptimizerv4Template -::MultiStartOptimizerv4Template() +::MultiStartOptimizerv4Template(): + m_Stop(false) { this->m_NumberOfIterations = static_cast(0); - this->m_CurrentIteration = static_cast(0); this->m_StopCondition = MAXIMUM_NUMBER_OF_ITERATIONS; this->m_StopConditionDescription << this->GetNameOfClass() << ": "; this->m_BestParametersIndex= static_cast(0); this->m_MaximumMetricValue=NumericTraits::max(); this->m_MinimumMetricValue = this->m_MaximumMetricValue; - m_LocalOptimizer = NULL; + m_LocalOptimizer = ITK_NULLPTR; } //------------------------------------------------------------------- @@ -52,8 +52,6 @@ ::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); - os << indent << "Number of iterations: " << this->m_NumberOfIterations << std::endl; - os << indent << "Current iteration: " << this->m_CurrentIteration << std::endl; os << indent << "Stop condition:"<< this->m_StopCondition << std::endl; os << indent << "Stop condition description: " << this->m_StopConditionDescription.str() << std::endl; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetricBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,7 @@ virtual NumberOfParametersType GetNumberOfParameters() const = 0; virtual NumberOfParametersType GetNumberOfLocalParameters() const = 0; - /** Set the active transform's parameters */ + /** Set the active transform's parameters by value*/ virtual void SetParameters( ParametersType & params ) = 0; /** Get a const reference to the active transform's parameters */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,8 @@ */ template ObjectToObjectMetric -::ObjectToObjectMetric() +::ObjectToObjectMetric(): + m_NumberOfValidPoints(0) { /* Both transforms default to an identity transform */ typedef IdentityTransform MovingIdentityTransformType; @@ -238,7 +239,7 @@ { this->m_VirtualImage = virtualImage; this->Modified(); - this->m_UserHasSetVirtualDomain = virtualImage != NULL; + this->m_UserHasSetVirtualDomain = virtualImage != ITK_NULLPTR; } } @@ -415,7 +416,7 @@ const MovingTransformType* transform = this->m_MovingTransform.GetPointer(); // If it's a CompositeTransform, get the last transform (1st applied). const MovingCompositeTransformType* comptx = dynamic_cast< const MovingCompositeTransformType * > ( transform ); - if( comptx != NULL ) + if( comptx != ITK_NULLPTR ) { transform = comptx->GetBackTransform(); } @@ -441,7 +442,7 @@ * Eventually we'll want a method in Transform something like a * GetInputDomainSize to check this cleanly. */ const MovingDisplacementFieldTransformType * displacementTransform = this->GetMovingDisplacementFieldTransform(); - if( displacementTransform == NULL ) + if( displacementTransform == ITK_NULLPTR ) { itkExceptionMacro("Expected the moving transform to be of type DisplacementFieldTransform or derived, " "or a CompositeTransform with DisplacementFieldTransform as the last to have been added." ); @@ -514,20 +515,12 @@ { Superclass::PrintSelf(os, indent); - os << indent << "ObjectToObjectMetric: " << std::endl - << indent << "Fixed Transform: " << std::endl - << indent << this->m_FixedTransform << std::endl - << indent << "Moving Transform: " << std::endl - << indent << this->m_MovingTransform << std::endl; - if( this->m_VirtualImage.IsNull() ) - { - os << indent << "Virtual Image: NULL " << std::endl; - } - else - { - os << indent << "Virtual Image: " << std::endl - << indent << this->m_VirtualImage << std::endl; - } + os << indent << "ObjectToObjectMetric: " << std::endl; + + itkPrintSelfObjectMacro( FixedTransform ); + itkPrintSelfObjectMacro( MovingTransform ); + itkPrintSelfObjectMacro( VirtualImage ); + os << indent << "m_UserHasSetVirtualDomain: " << this->m_UserHasSetVirtualDomain << std::endl << indent << "m_NumberOfValidPoints: " << this->m_NumberOfValidPoints << std::endl; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -19,6 +19,7 @@ #define __itkObjectToObjectOptimizerBase_h #include "itkOptimizerParameters.h" +#include "itkOptimizerParameterScalesEstimator.h" #include "itkObjectToObjectMetricBase.h" #include "itkIntTypes.h" @@ -38,9 +39,12 @@ * appropriate, typically by passing it to its transform that is * being optimized. * - * SetScales() allows setting of a per-local-parameter scaling array. - * The gradient of each local parameter is divided by the corresponding - * scale. If unset, the \c m_Scales array will be initialized to all 1's. + * The user can scale each component of the gradient (derivative) + * at each iteration in one of two ways: + * + * 1) manually, by setting a scaling vector using method SetScales(). + * SetScales() allows setting of a per-local-parameter scaling array. If + * unset, the \c m_Scales array will be initialized to all 1's. * Note that when used with transforms with local support, these scales * correspond to each _local_ parameter, and not to each parameter. For * example, in a DisplacementFieldTransform of dimensionality N, the Scales @@ -48,6 +52,15 @@ * transform's displacement field, and is applied to each vector in the * displacement field. * + * or, + * + * 2) automatically, by assigning a ScalesEstimator using SetScalesEstimator(). + * When ScalesEstimator is assigned, the optimizer is enabled by default to + * estimate scales, and can be changed via SetDoEstimateScales(). The scales + * are estimated and assigned once, during the call to StartOptimization(). + * This option will override any manually-assigned scales. + * + * * SetWeights() allows setting of a per-local-parameter weighting array. * If unset, the weights are treated as identity. Weights are multiplied * by the gradient at the same time scaling is applied. Weights are @@ -63,7 +76,7 @@ * * \ingroup ITKOptimizersv4 */ -template< typename TInternalComputationValueType> +template< typename TInternalComputationValueType = double> class ObjectToObjectOptimizerBaseTemplate : public Object { public: @@ -77,7 +90,8 @@ itkTypeMacro(ObjectToObjectOptimizerBaseTemplate, Object); /** Scale type. */ - typedef OptimizerParameters< TInternalComputationValueType > ScalesType; + typedef OptimizerParameters< TInternalComputationValueType > ScalesType; + typedef OptimizerParameterScalesEstimatorTemplate ScalesEstimatorType; /** Parameters type. */ typedef OptimizerParameters< TInternalComputationValueType > ParametersType; @@ -86,12 +100,21 @@ typedef ObjectToObjectMetricBaseTemplate< TInternalComputationValueType > MetricType; typedef typename MetricType::Pointer MetricTypePointer; + /** Derivative type */ + typedef typename MetricType::DerivativeType DerivativeType; + /** Number of parameters type */ typedef typename MetricType::NumberOfParametersType NumberOfParametersType; /** Measure type */ typedef typename MetricType::MeasureType MeasureType; + /** Stop condition return string type */ + typedef std::string StopConditionReturnStringType; + + /** Stop condition internal string type */ + typedef std::ostringstream StopConditionDescriptionType; + /** Accessors for Metric */ itkSetObjectMacro( Metric, MetricType ); itkGetModifiableObjectMacro(Metric, MetricType ); @@ -109,7 +132,11 @@ virtual const MeasureType & GetValue() const; /** Set current parameters scaling. */ - itkSetMacro( Scales, ScalesType ); + //itkSetMacro( Scales, ScalesType ); + virtual void SetScales(const ScalesType & scales) + { + this->m_Scales = scales; + } /** Get current parameters scaling. */ itkGetConstReferenceMacro( Scales, ScalesType ); @@ -127,6 +154,30 @@ /** Get whether weights are identity. Cannot be set */ itkGetConstReferenceMacro( WeightsAreIdentity, bool ); + /** Get whether the scales have been set. Returns + * true if m_Scales.Size() > 0 */ + bool GetScalesInitialized( void ) const; + + /** Set the scales estimator. + * + * A ScalesEstimator is required for the scales estimation + * options to work. See the main documentation. + * Derived classes may also provide learning-rate estimation, + * in which case a scales estimator is also required. + * + * \sa SetDoEstimateScales() + */ + itkSetObjectMacro(ScalesEstimator, ScalesEstimatorType); + + /** Option to use ScalesEstimator for scales estimation. + * The estimation is performed once at begin of + * optimization, and overrides any scales set using SetScales(). + * Default is true. + */ + itkSetMacro(DoEstimateScales, bool); + itkGetConstReferenceMacro(DoEstimateScales, bool); + itkBooleanMacro(DoEstimateScales); + /** Set the number of threads to use when threading. * The default is the global default number of threads * returned from itkMultiThreader. */ @@ -135,6 +186,15 @@ /** Get the number of threads set to be used. */ itkGetConstReferenceMacro( NumberOfThreads, ThreadIdType ); + /** Return current number of iterations. */ + itkGetConstMacro(CurrentIteration, SizeValueType); + + /** Set the number of iterations. */ + itkSetMacro(NumberOfIterations, SizeValueType); + + /** Get the number of iterations. */ + itkGetConstMacro(NumberOfIterations, SizeValueType); + /** Get a reference to the current position of the optimization. * This returns the parameters from the assigned metric, since the optimizer * itself does not store a position. */ @@ -149,6 +209,9 @@ * perform any additional initialization before performing optimization. */ virtual void StartOptimization( bool doOnlyInitialization = false ); + /** Stop condition return string type */ + virtual const StopConditionReturnStringType GetStopConditionDescription() const = 0; + protected: /** Default constructor */ @@ -157,6 +220,8 @@ MetricTypePointer m_Metric; ThreadIdType m_NumberOfThreads; + SizeValueType m_CurrentIteration; + SizeValueType m_NumberOfIterations; /** Metric measure value at a given iteration, as most recently evaluated. */ MeasureType m_CurrentMetricValue; @@ -174,10 +239,18 @@ /** Flag to avoid unnecessary arithmetic when scales are identity. */ bool m_ScalesAreIdentity; + /** Scales estimator. Optionally provided by user. */ + typename ScalesEstimatorType::Pointer m_ScalesEstimator; + /** Flag to avoid unnecessary arithmetic when weights are identity. */ bool m_WeightsAreIdentity; - virtual void PrintSelf(std::ostream & os, Indent indent) const; + /** Flag to control use of the ScalesEstimator (if set) for + * automatic scale estimation during StartOptimization() + */ + bool m_DoEstimateScales; + + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkObjectToObjectOptimizerBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,13 +29,16 @@ ObjectToObjectOptimizerBaseTemplate ::ObjectToObjectOptimizerBaseTemplate() { - this->m_Metric = NULL; + this->m_Metric = ITK_NULLPTR; + this->m_CurrentIteration = 0; + this->m_NumberOfIterations = 100; this->m_CurrentMetricValue = 0; // Initialize, but w/out calling SetNumberOfThreads, to avoid // valgrind warning. this->m_NumberOfThreads = MultiThreader::GetGlobalDefaultNumberOfThreads(); this->m_ScalesAreIdentity = false; this->m_WeightsAreIdentity = true; + this->m_DoEstimateScales = true; } //------------------------------------------------------------------- @@ -54,13 +57,13 @@ os << indent << "Number of threads: " << this->m_NumberOfThreads << std::endl; os << indent << "Number of scales: " << this->m_Scales.Size() << std::endl; - if( this->m_Scales.Size() > 0 ) + if( this->GetScalesInitialized() ) { os << indent << "m_Scales: " << this->m_Scales << std::endl; } else { - os << indent << "m_Scales is unset." << std::endl; + os << indent << "m_Scales: uninitialized." << std::endl; } os << indent << "m_ScalesAreIdentity: " << this->GetScalesAreIdentity() << std::endl; if( this->m_Weights.Size() > 0 ) @@ -72,8 +75,14 @@ os << indent << "m_Weights is unset. Treated as identity." << std::endl; } os << indent << "m_WeightsAreIdentity: " << this->GetWeightsAreIdentity() << std::endl; - os << indent << "Metric: " << std::endl; - m_Metric->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( Metric ); + itkPrintSelfObjectMacro( ScalesEstimator ); + if ( this->m_CurrentIteration > 0 ) + { + os << indent << "CurrentIteration: " << this->m_CurrentIteration << std::endl; + } + os << indent << "Number of iterations: " << this->m_NumberOfIterations << std::endl; + os << indent << "DoEstimateScales: " << this->m_DoEstimateScales << std::endl; } //------------------------------------------------------------------- @@ -106,9 +115,18 @@ return; } + /* Estimate the parameter scales if requested. */ + if ( this->m_DoEstimateScales && this->m_ScalesEstimator.IsNotNull() ) + { + ScalesType scales; + this->m_ScalesEstimator->EstimateScales( scales ); + this->SetScales( scales ); + itkDebugMacro( "Estimated scales = " << this->m_Scales ); + } + /* Verify m_Scales. If m_Scales hasn't been set, initialize to all 1's. */ typedef typename ScalesType::ValueType SValueType; - if( this->m_Scales.Size() > 0 ) + if( this->GetScalesInitialized() ) { if( this->m_Scales.Size() != this->m_Metric->GetNumberOfLocalParameters() ) { @@ -125,12 +143,12 @@ { if( this->m_Scales[i] <= NumericTraits::epsilon() ) { - itkExceptionMacro("m_Scales values must be > epsilon."); + itkExceptionMacro("m_Scales values must be > epsilon." << this->m_Scales); } /* Check if the scales are identity. Consider to be identity if * within a tolerance, to allow for automatically estimated scales * that may not be exactly 1.0 when in priciniple they should be. */ - SValueType difference = vcl_fabs( NumericTraits::OneValue() - this->m_Scales[i] ); + SValueType difference = std::fabs( NumericTraits::OneValue() - this->m_Scales[i] ); SValueType tolerance = static_cast( 0.01 ); if( difference > tolerance ) { @@ -161,7 +179,7 @@ this->m_WeightsAreIdentity = true; for( SizeType i=0; i < this->m_Weights.Size(); i++ ) { - SValueType difference = vcl_fabs( NumericTraits::OneValue() - this->m_Weights[i] ); + SValueType difference = std::fabs( NumericTraits::OneValue() - this->m_Weights[i] ); SValueType tolerance = static_cast( 1e-4 ); if( difference > tolerance ) { @@ -199,6 +217,13 @@ return this->GetCurrentMetricValue(); } +template +bool +ObjectToObjectOptimizerBaseTemplate +::GetScalesInitialized( void ) const +{ + return m_Scales.Size() > 0; +} }//namespace itk #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,216 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkOnePlusOneEvolutionaryOptimizerv4_h +#define __itkOnePlusOneEvolutionaryOptimizerv4_h + +#include "itkObjectToObjectOptimizerBase.h" +#include "itkRandomVariateGeneratorBase.h" +#include + +namespace itk +{ +/** \class OnePlusOneEvolutionaryOptimizerv4 + * \brief 1+1 evolutionary strategy optimizer + * + * This optimizer searches for the optimal parameters. It changes its search + * radius and position using the grow factor ,shrink factor, and isotropic + * probability function (which is a random unit normal variate generator). + * + * This optimizer needs a cost function and a random unit normal + * variate generator. + * The cost function should return cost with new position in parameter space + * which will be generated by 1+1 evolutionary strategy. + * Users should plug-in the random unit normal variate generator using + * SetNormalVariateGenerator method. + * + * The SetEpsilon method is the minimum value for the frobenius_norm of + * the covariance matrix. If the fnorm is smaller than this value, + * the optimization process will stop even before it hits the maximum + * iteration. + * + * Another way to stop the optimization process is calling the + * StopOptimization method. At next iteration after calling it, the + * optimization process will stop. + * + * This optimizing scheme was initially developed and implemented + * by Martin Styner, Univ. of North Carolina at Chapel Hill, and his + * colleagues. + * + * For more details. refer to the following articles. + * "Parametric estimate of intensity inhomogeneities applied to MRI" + * Martin Styner, G. Gerig, Christian Brechbuehler, Gabor Szekely, + * IEEE TRANSACTIONS ON MEDICAL IMAGING; 19(3), pp. 153-165, 2000, + * (http://www.cs.unc.edu/~styner/docs/tmi00.pdf) + * + * "Evaluation of 2D/3D bias correction with 1+1ES-optimization" + * Martin Styner, Prof. Dr. G. Gerig (IKT, BIWI, ETH Zuerich), TR-197 + * (http://www.cs.unc.edu/~styner/docs/StynerTR97.pdf) + * + * \sa NormalVariateGenerator + * \ingroup ITKOptimizersv4 + */ + +template +class OnePlusOneEvolutionaryOptimizerv4: + public ObjectToObjectOptimizerBaseTemplate +{ +public: + /** Standard "Self" typedef. */ + typedef OnePlusOneEvolutionaryOptimizerv4 Self; + typedef ObjectToObjectOptimizerBaseTemplate Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(OnePlusOneEvolutionaryOptimizerv4, Superclass); + + /** Type of the Cost Function */ + typedef SingleValuedCostFunctionv4 CostFunctionType; + typedef CostFunctionType::Pointer CostFunctionPointer; + + /** Normal random variate generator type. */ + typedef Statistics::RandomVariateGeneratorBase NormalVariateGeneratorType; + + /** Measure type */ + typedef typename Superclass::MeasureType MeasureType; + + /** Parameters type */ + typedef typename Superclass::ParametersType ParametersType; + + /** Scales type */ + typedef typename Superclass::ScalesType ScalesType; + + /** Set/Get maximum iteration limit. */ + itkSetMacro(MaximumIteration, unsigned int); + itkGetConstReferenceMacro(MaximumIteration, unsigned int); + + /** Set/Get the search radius grow factor in parameter space. */ + itkSetMacro(GrowthFactor, double); + itkGetConstReferenceMacro(GrowthFactor, double); + + /** Set/Get the search radius shrink factor. */ + itkSetMacro(ShrinkFactor, double); + itkGetConstReferenceMacro(ShrinkFactor, double); + + /** Set/Get initial search radius in parameter space */ + itkSetMacro(InitialRadius, double); + itkGetConstReferenceMacro(InitialRadius, double); + + /** Set/Get the minimal size of search radius + * (frobenius_norm of covariance matrix). */ + itkSetMacro(Epsilon, double); + itkGetConstReferenceMacro(Epsilon, double); + + /** Get the current Frobenius norm of covariance matrix */ + itkGetConstReferenceMacro(FrobeniusNorm, double); + + void SetNormalVariateGenerator(NormalVariateGeneratorType *generator); + + /** Initializes the optimizer. + * Before running this optimizer, this function should have been called. + * + * initialRadius: search radius in parameter space + * grow: search radius grow factor + * shrink: searhc radius shrink factor */ + void Initialize(double initialRadius, double grow = -1, double shrink = -1); + + /** Return Current Value */ + itkGetConstReferenceMacro(CurrentCost, MeasureType); + virtual const MeasureType & GetValue() const ITK_OVERRIDE; + + /** Return if optimizer has been initialized */ + itkGetConstReferenceMacro(Initialized, bool); + + /** Start optimization. + * Optimization will stop when it meets either of two termination conditions, + * the maximum iteration limit or epsilon (minimal search radius) */ + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** when users call StartOptimization, this value will be set false. + * By calling StopOptimization, this flag will be set true, and + * optimization will stop at the next iteration. */ + void StopOptimization() + { m_Stop = true; } + + itkGetConstReferenceMacro(CatchGetValueException, bool); + itkSetMacro(CatchGetValueException, bool); + + itkGetConstReferenceMacro(MetricWorstPossibleValue, double); + itkSetMacro(MetricWorstPossibleValue, double); + + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; + +protected: + OnePlusOneEvolutionaryOptimizerv4(); + OnePlusOneEvolutionaryOptimizerv4(const OnePlusOneEvolutionaryOptimizerv4 &); + virtual ~OnePlusOneEvolutionaryOptimizerv4(); + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + +private: + + /** Smart pointer to the normal random variate generator. */ + NormalVariateGeneratorType::Pointer m_RandomGenerator; + + /** Maximum iteration limit. */ + unsigned int m_MaximumIteration; + + bool m_CatchGetValueException; + double m_MetricWorstPossibleValue; + + /** The minimal size of search radius + * (frobenius_norm of covariance matrix). */ + double m_Epsilon; + + /** Initial search radius in parameter space. */ + double m_InitialRadius; + + /** Search radius growth factor in parameter space. */ + double m_GrowthFactor; + + /** Search radius shrink factor in parameter space, */ + double m_ShrinkFactor; + + /** Flag tells if the optimizer was initialized using Initialize function. */ + bool m_Initialized; + + /** Internal storage for the value type / used as a cache */ + MeasureType m_CurrentCost; + + /** This is user-settable flag to stop optimization. + * when users call StartOptimization, this value will be set false. + * By calling StopOptimization, this flag will be set true, and + * optimization will stop at the next iteration. */ + bool m_Stop; + + /** Stop description */ + std::ostringstream m_StopConditionDescription; + + /** Cache variable for reporting the Frobenius Norm + */ + double m_FrobeniusNorm; +}; // end of class +} // end of namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkOnePlusOneEvolutionaryOptimizerv4.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOnePlusOneEvolutionaryOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,337 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkOnePlusOneEvolutionaryOptimizerv4_hxx +#define __itkOnePlusOneEvolutionaryOptimizerv4_hxx + +#include "itkOnePlusOneEvolutionaryOptimizerv4.h" +#include "vnl/vnl_matrix.h" +namespace itk +{ +template +OnePlusOneEvolutionaryOptimizerv4 +::OnePlusOneEvolutionaryOptimizerv4() +{ + m_CatchGetValueException = false; + m_MetricWorstPossibleValue = 0; + + m_Epsilon = (double)1.5e-4; + m_RandomGenerator = ITK_NULLPTR; + + m_Initialized = false; + m_GrowthFactor = 1.05; + m_ShrinkFactor = std::pow(m_GrowthFactor, -0.25); + m_InitialRadius = 1.01; + m_MaximumIteration = 100; + m_Stop = false; + m_StopConditionDescription.str(""); + m_CurrentCost = 0; + m_FrobeniusNorm = 0.0; +} + +template +OnePlusOneEvolutionaryOptimizerv4 +::~OnePlusOneEvolutionaryOptimizerv4() +{} + +template +void +OnePlusOneEvolutionaryOptimizerv4 +::SetNormalVariateGenerator(NormalVariateGeneratorType *generator) +{ + if ( m_RandomGenerator != generator ) + { + m_RandomGenerator = generator; + this->Modified(); + } +} + +template +void +OnePlusOneEvolutionaryOptimizerv4 +::Initialize(double initialRadius, double grow, double shrink) +{ + m_InitialRadius = initialRadius; + + if ( grow == -1 ) + { + m_GrowthFactor = 1.05; + } + else + { + m_GrowthFactor = grow; + } + if ( shrink == -1 ) + { + m_ShrinkFactor = std::pow(m_GrowthFactor, -0.25); + } + else + { + m_ShrinkFactor = shrink; + } +} + +template +void +OnePlusOneEvolutionaryOptimizerv4 +::StartOptimization(bool /* doOnlyInitialization */) +{ + if ( this->m_Metric.IsNull() ) + { + return; + } + + Superclass::StartOptimization(); + + this->InvokeEvent( StartEvent() ); + m_Stop = false; + + unsigned int spaceDimension = this->m_Metric->GetNumberOfParameters(); + vnl_matrix< double > A(spaceDimension, spaceDimension); + vnl_vector< double > parent( this->m_Metric->GetParameters() ); + vnl_vector< double > f_norm(spaceDimension); + vnl_vector< double > child(spaceDimension); + vnl_vector< double > delta(spaceDimension); + + ParametersType parentPosition(spaceDimension); + ParametersType childPosition(spaceDimension); + + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + parentPosition[i] = parent[i]; + } + this->m_Metric->SetParameters( parentPosition ); + + double pvalue = m_MetricWorstPossibleValue; + try + { + pvalue = this->m_Metric->GetValue(); + } + catch ( ... ) + { + if ( m_CatchGetValueException ) + { + pvalue = m_MetricWorstPossibleValue; + } + else + { + throw; + } + } + + itkDebugMacro(<< ": initial position: " << parentPosition); + itkDebugMacro(<< ": initial fitness: " << pvalue); + + this->m_Metric->SetParameters(parentPosition); + const ScalesType & scales = this->GetScales(); + + // Make sure the scales have been set properly + if ( scales.size() != spaceDimension ) + { + itkExceptionMacro(<< "The size of Scales is " + << scales.size() + << ", but the NumberOfParameters for the CostFunction is " + << spaceDimension + << "."); + } + + A.set_identity(); + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + A(i, i) = m_InitialRadius / scales[i]; + } + this->m_CurrentIteration = 0; + + for ( unsigned int iter = 0; iter < m_MaximumIteration; iter++ ) + { + if ( m_Stop ) + { + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": "; + m_StopConditionDescription << "StopOptimization() called"; + break; + } + + ++this->m_CurrentIteration; + + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + if ( !m_RandomGenerator ) + { + itkExceptionMacro(<< "Random Generator is not set!"); + } + f_norm[i] = m_RandomGenerator->GetVariate(); + } + + delta = A * f_norm; + child = parent + delta; + + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + childPosition[i] = child[i]; + } + // Update the metric so we can check the metric value in childPosition + this->m_Metric->SetParameters( childPosition ); + + double cvalue = m_MetricWorstPossibleValue; + try + { + cvalue = this->m_Metric->GetValue(); + // While we got the metric value in childPosition, + // the metric paramteres are set back to parentPosition + this->m_Metric->SetParameters( parentPosition ); + } + catch ( ... ) + { + if ( m_CatchGetValueException ) + { + cvalue = m_MetricWorstPossibleValue; + } + else + { + throw; + } + } + + itkDebugMacro(<< "iter: " << iter << ": parent position: " + << parentPosition); + itkDebugMacro(<< "iter: " << iter << ": parent fitness: " + << pvalue); + itkDebugMacro(<< "iter: " << iter << ": random vector: " << f_norm); + itkDebugMacro(<< "iter: " << iter << ": A: " << std::endl << A); + itkDebugMacro(<< "iter: " << iter << ": delta: " << delta); + itkDebugMacro(<< "iter: " << iter << ": child position: " + << childPosition); + itkDebugMacro(<< "iter: " << iter << ": child fitness: " + << cvalue); + + double adjust = m_ShrinkFactor; + + if ( cvalue < pvalue ) + { + itkDebugMacro(<< "iter: " << iter << ": increasing search radius"); + pvalue = cvalue; + parent.swap(child); + adjust = m_GrowthFactor; + for ( unsigned int i = 0; i < spaceDimension; i++ ) + { + parentPosition[i] = parent[i]; + } + this->m_Metric->SetParameters(parentPosition); + } + else + { + itkDebugMacro(<< "iter: " << iter << ": decreasing search radius"); + } + + m_CurrentCost = pvalue; + // convergence criterion: f-norm of A < epsilon_A + // Compute double precision sum of absolute values of + // a single precision vector + m_FrobeniusNorm = A.fro_norm(); + itkDebugMacro(<< "A f-norm:" << m_FrobeniusNorm); + if ( m_FrobeniusNorm <= m_Epsilon ) + { + itkDebugMacro(<< "converges at iteration = " << iter); + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": "; + m_StopConditionDescription << "Fnorm (" << m_FrobeniusNorm + << ") is less than Epsilon (" << m_Epsilon + << " at iteration #" << iter; + this->InvokeEvent( EndEvent() ); + return; + } + + // A += (adjust - 1)/ (f_norm * f_norm) * A * f_norm * f_norm; + // Blas_R1_Update(A, A * f_norm, f_norm, + // ((adjust - 1) / Blas_Dot_Prod(f_norm, f_norm))); + // = DGER(Fortran) + // performs the rank 1 operation + // A := alpha*x*y' + A, + // where y' = transpose(y) + // where alpha is a scalar, x is an m element vector, y is an n element + // vector and A is an m by n matrix. + // x = A * f_norm , y = f_norm, alpha = (adjust - 1) / Blas_Dot_Prod( + // f_norm, f_norm) + + //A = A + (adjust - 1.0) * A; + double alpha = ( ( adjust - 1.0 ) / dot_product(f_norm, f_norm) ); + for ( unsigned int c = 0; c < spaceDimension; c++ ) + { + for ( unsigned int r = 0; r < spaceDimension; r++ ) + { + A(r, c) += alpha * delta[r] * f_norm[c]; + } + } + + this->InvokeEvent( IterationEvent() ); + itkDebugMacro( << "Current position: " << this->GetCurrentPosition() ); + } + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": "; + m_StopConditionDescription << "Maximum number of iterations (" + << m_MaximumIteration + << ") exceeded. "; + this->InvokeEvent( EndEvent() ); +} + +template +const std::string +OnePlusOneEvolutionaryOptimizerv4 +::GetStopConditionDescription() const +{ + return m_StopConditionDescription.str(); +} + +template +const typename OnePlusOneEvolutionaryOptimizerv4::MeasureType & +OnePlusOneEvolutionaryOptimizerv4 +::GetValue() const +{ + return this->GetCurrentCost(); +} + +template +void +OnePlusOneEvolutionaryOptimizerv4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + if ( m_RandomGenerator ) + { + os << indent << "Random Generator " << m_RandomGenerator.GetPointer() << std::endl; + } + else + { + os << indent << "Random Generator " << "(none)" << std::endl; + } + os << indent << "Maximum Iteration " << GetMaximumIteration() << std::endl; + os << indent << "Epsilon " << GetEpsilon() << std::endl; + os << indent << "Initial Radius " << GetInitialRadius() << std::endl; + os << indent << "Growth Fractor " << GetGrowthFactor() << std::endl; + os << indent << "Shrink Fractor " << GetShrinkFactor() << std::endl; + os << indent << "Initialized " << GetInitialized() << std::endl; + os << indent << "Current Cost " << GetCurrentCost() << std::endl; + os << indent << "Frobenius Norm " << GetFrobeniusNorm() << std::endl; + os << indent << "CatchGetValueException " << GetCatchGetValueException() + << std::endl; + os << indent << "MetricWorstPossibleValue " << GetMetricWorstPossibleValue() + << std::endl; +} +} // end of namespace itk +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOptimizerParameterScalesEstimator.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOptimizerParameterScalesEstimator.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOptimizerParameterScalesEstimator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkOptimizerParameterScalesEstimator.h 2014-09-03 08:29:34.000000000 +0000 @@ -20,7 +20,7 @@ #include "itkObject.h" #include "itkObjectFactory.h" -#include "itkObjectToObjectOptimizerBase.h" +#include "itkOptimizerParameters.h" namespace itk { @@ -48,11 +48,12 @@ itkTypeMacro( OptimizerParameterScalesEstimatorTemplate, Object ); /** Type of scales */ - typedef typename ObjectToObjectOptimizerBaseTemplate::ScalesType ScalesType; + typedef OptimizerParameters ScalesType; /** Type of parameters of the optimizer */ - typedef typename ObjectToObjectOptimizerBaseTemplate::ParametersType ParametersType; + typedef OptimizerParameters ParametersType; + /** Type of float */ - typedef TInternalComputationValueType FloatType; + typedef TInternalComputationValueType FloatType; /** Estimate parameter scales. */ virtual void EstimateScales(ScalesType &scales) = 0; @@ -71,7 +72,7 @@ OptimizerParameterScalesEstimatorTemplate(){}; ~OptimizerParameterScalesEstimatorTemplate(){}; - void PrintSelf(std::ostream &os, Indent indent) const + virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os,indent); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,245 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkPowellOptimizerv4_h +#define __itkPowellOptimizerv4_h + +#include "itkVector.h" +#include "itkMatrix.h" +#include "itkObjectToObjectOptimizerBase.h" + +namespace itk +{ +/** \class PowellOptimizerv4 + * \brief Implements Powell optimization using Brent line search. + * + * The code in this class was adapted from the Wikipedia and the + * netlib.org zeroin function. + * + * http://www.netlib.org/go/zeroin.f + * http://en.wikipedia.org/wiki/Brent_method + * http://en.wikipedia.org/wiki/Golden_section_search + * + * This optimizer needs a cost function. + * Partial derivatives of that function are not required. + * + * For an N-dimensional parameter space, each iteration minimizes + * the function in N (initially orthogonal) directions. Typically only 2-5 + * iterations are required. If gradients are available, consider a conjugate + * gradient line search strategy. + * + * The SetStepLength determines the initial distance to step in a line direction + * when bounding the minimum (using bracketing triple spaced using a golden + * search strategy). + * + * The StepTolerance terminates optimization when the parameter values are + * known to be within this (scaled) distance of the local extreme. + * + * The ValueTolerance terminates optimization when the cost function values at + * the current parameters and at the local extreme are likely (within a second + * order approximation) to be within this is tolerance. + * + * \ingroup ITKOptimizersv4 + */ +template +class PowellOptimizerv4: + public ObjectToObjectOptimizerBaseTemplate +{ +public: + /** Standard "Self" typedef. */ + typedef PowellOptimizerv4 Self; + typedef ObjectToObjectOptimizerBaseTemplate Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Method for creation through the object factory. */ + itkNewMacro(Self); + + /** Run-time type information (and related methods). */ + itkTypeMacro(PowellOptimizerv4, Superclass); + + typedef typename Superclass::ParametersType ParametersType; + typedef typename Superclass::MeasureType MeasureType; + typedef typename Superclass::ScalesType ScalesType; + + /** Set/Get maximum iteration limit. */ + itkSetMacro(MaximumIteration, unsigned int); + itkGetConstReferenceMacro(MaximumIteration, unsigned int); + + /** Set/Get the maximum number of line search iterations */ + itkSetMacro(MaximumLineIteration, unsigned int); + itkGetConstMacro(MaximumLineIteration, unsigned int); + + /** Set/Get StepLength for the (scaled) spacing of the sampling of + * parameter space while bracketing the extremum */ + itkSetMacro(StepLength, double); + itkGetConstReferenceMacro(StepLength, double); + + /** Set/Get StepTolerance. Once the local extreme is known to be within this + * distance of the current parameter values, optimization terminates */ + itkSetMacro(StepTolerance, double); + itkGetConstReferenceMacro(StepTolerance, double); + + /** Set/Get ValueTolerance. Once this current cost function value is known + * to be within this tolerance of the cost function value at the local + * extreme, optimization terminates */ + itkSetMacro(ValueTolerance, double); + itkGetConstReferenceMacro(ValueTolerance, double); + + /** Return Current Value */ + itkGetConstReferenceMacro(CurrentCost, MeasureType); + virtual const MeasureType & GetValue() const { return this->GetCurrentCost(); } + + /** Get the current line search iteration */ + itkGetConstReferenceMacro(CurrentLineIteration, unsigned int); + + /** Start optimization. */ + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** When users call StartOptimization, this value will be set false. + * By calling StopOptimization, this flag will be set true, and + * optimization will stop at the next iteration. */ + void StopOptimization() + { m_Stop = true; } + + itkGetConstReferenceMacro(CatchGetValueException, bool); + itkSetMacro(CatchGetValueException, bool); + + itkGetConstReferenceMacro(MetricWorstPossibleValue, double); + itkSetMacro(MetricWorstPossibleValue, double); + + virtual const std::string GetStopConditionDescription() const ITK_OVERRIDE; + +protected: + PowellOptimizerv4(); + PowellOptimizerv4(const PowellOptimizerv4 &); + virtual ~PowellOptimizerv4(); + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + + itkSetMacro(CurrentCost, double); + + /** Used to specify the line direction through the n-dimensional parameter + * space the is currently being bracketed and optimized. */ + void SetLine(const ParametersType & origin, + const vnl_vector< double > & direction); + + /** Get the value of the n-dimensional cost function at this scalar step + * distance along the current line direction from the current line origin. + * Line origin and distances are set via SetLine */ + double GetLineValue(double x) const; + + double GetLineValue(double x, ParametersType & tempCoord) const; + + /** Set the given scalar step distance (x) and function value (fx) as the + * "best-so-far" optimizer values. */ + void SetCurrentLinePoint(double x, double fx); + + /** Used in bracketing the extreme along the current line. + * Adapted from NRC */ + void Swap(double *a, double *b) const; + + /** Used in bracketing the extreme along the current line. + * Adapted from NRC */ + void Shift(double *a, double *b, double *c, double d) const; + + /** The LineBracket routine from NRC. Later reimplemented from the description + * of the method available in the Wikipedia. + * + * Uses current origin and line direction (from SetLine) to find a triple of + * points (ax, bx, cx) that bracket the extreme "near" the origin. Search + * first considers the point StepLength distance from ax. + * + * IMPORTANT: The value of ax and the value of the function at ax (i.e., fa), + * must both be provided to this function. */ + virtual void LineBracket(double *ax, double *bx, double *cx, + double *fa, double *fb, double *fc); + + virtual void LineBracket(double *ax, double *bx, double *cx, + double *fa, double *fb, double *fc, + ParametersType & tempCoord); + + /** Given a bracketing triple of points and their function values, returns + * a bounded extreme. These values are in parameter space, along the + * current line and wrt the current origin set via SetLine. Optimization + * terminates based on MaximumIteration, StepTolerance, or ValueTolerance. + * Implemented as Brent line optimers from NRC. */ + virtual void BracketedLineOptimize(double ax, double bx, double cx, + double fa, double fb, double fc, + double *extX, double *extVal); + + virtual void BracketedLineOptimize(double ax, double bx, double cx, + double fa, double fb, double fc, + double *extX, double *extVal, + ParametersType & tempCoord); + + itkGetMacro(SpaceDimension, unsigned int); + void SetSpaceDimension(unsigned int dim) + { + this->m_SpaceDimension = dim; + this->m_LineDirection.set_size(dim); + this->m_LineOrigin.set_size(dim); + this->m_CurrentPosition.set_size(dim); + this->Modified(); + } + + itkSetMacro(CurrentIteration, unsigned int); + + itkGetMacro(Stop, bool); + itkSetMacro(Stop, bool); + +private: + unsigned int m_SpaceDimension; + + /** Current iteration */ + unsigned int m_CurrentLineIteration; + + /** Maximum iteration limit. */ + unsigned int m_MaximumIteration; + unsigned int m_MaximumLineIteration; + + bool m_CatchGetValueException; + double m_MetricWorstPossibleValue; + + /** The minimal size of search */ + double m_StepLength; + double m_StepTolerance; + + ParametersType m_LineOrigin; + vnl_vector< double > m_LineDirection; + + double m_ValueTolerance; + + /** Internal storage for the value type / used as a cache */ + MeasureType m_CurrentCost; + + /** this is user-settable flag to stop optimization. + * when users call StartOptimization, this value will be set false. + * By calling StopOptimization, this flag will be set true, and + * optimization will stop at the next iteration. */ + bool m_Stop; + + ParametersType m_CurrentPosition; + + std::ostringstream m_StopConditionDescription; +}; // end of class +} // end of namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkPowellOptimizerv4.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkPowellOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,582 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkPowellOptimizerv4_hxx +#define __itkPowellOptimizerv4_hxx + +#include "itkPowellOptimizerv4.h" + +namespace itk +{ +template +PowellOptimizerv4 +::PowellOptimizerv4(): + m_SpaceDimension(0), + m_CurrentLineIteration(0), + m_MaximumIteration(100), + m_MaximumLineIteration(100), + m_CatchGetValueException(false), + m_MetricWorstPossibleValue(0), + m_StepLength(0), + m_StepTolerance(0), + m_ValueTolerance(0), + m_CurrentCost(0), + m_Stop(false) +{ + m_StopConditionDescription << this->GetNameOfClass() << ": "; +} + +template +PowellOptimizerv4 +::~PowellOptimizerv4() +{} + +template +void +PowellOptimizerv4 +::SetLine(const ParametersType & origin, + const vnl_vector< double > & direction) +{ + const ScalesType & scales = this->GetScales(); + for ( unsigned int i = 0; i < m_SpaceDimension; ++i ) + { + m_LineOrigin[i] = origin[i]; + if( this->GetScalesAreIdentity() ) + { + m_LineDirection[i] = direction[i]; + } + else + { + m_LineDirection[i] = direction[i] / scales[i]; + } + } +} + +template +double +PowellOptimizerv4 +::GetLineValue(double x) const +{ + ParametersType tempCoord(m_SpaceDimension); + + return this->GetLineValue(x, tempCoord); +} + +template +double +PowellOptimizerv4 +::GetLineValue(double x, ParametersType & tempCoord) const +{ + for ( unsigned int i = 0; i < m_SpaceDimension; i++ ) + { + tempCoord[i] = this->m_LineOrigin[i] + x * this->m_LineDirection[i]; + } + this->m_Metric->SetParameters(tempCoord); + itkDebugMacro(<< "x = " << x); + double val; + try + { + val = ( this->m_Metric->GetValue() ); + } + catch ( ... ) + { + if ( m_CatchGetValueException ) + { + val = m_MetricWorstPossibleValue; + } + else + { + throw; + } + } + itkDebugMacro(<< "val = " << val); + return val; +} + +template +void +PowellOptimizerv4 +::SetCurrentLinePoint(double x, double fx) +{ + for ( unsigned int i = 0; i < m_SpaceDimension; i++ ) + { + this->m_CurrentPosition[i] = this->m_LineOrigin[i] + x * this->m_LineDirection[i]; + } + this->m_Metric->SetParameters(m_CurrentPosition); + this->SetCurrentCost(fx); + this->Modified(); +} + +template +void +PowellOptimizerv4 +::Swap(double *a, double *b) const +{ + double tf; + + tf = *a; + *a = *b; + *b = tf; +} + +template +void +PowellOptimizerv4 +::Shift(double *a, double *b, double *c, double d) const +{ + *a = *b; + *b = *c; + *c = d; +} + +// +// This code was implemented from the description of +// the Golden section search available in the Wikipedia +// +// http://en.wikipedia.org/wiki/Golden_section_search +// +// +// The inputs to this function are +// +// x1 and its function value f1 +// x2 +// +// (f2 is not yet evaluated, it will be computed inside) +// (x2 and its function value f3 are also computed inside) +// +// The outputs are the values of x2 and f2 at +// the end of the iterations. +// +template +void +PowellOptimizerv4 +::LineBracket(double *x1, double *x2, double *x3, + double *f1, double *f2, double *f3) +{ + ParametersType tempCoord(m_SpaceDimension); + + this->LineBracket(x1, x2, x3, f1, f2, f3, tempCoord); +} + +template +void +PowellOptimizerv4 +::LineBracket(double *x1, double *x2, double *x3, + double *f1, double *f2, double *f3, + ParametersType & tempCoord) +{ + // + // Compute the golden ratio as a constant to be + // used when extrapolating the bracket + // + const double goldenRatio = ( 1.0 + std::sqrt(5.0) ) / 2.0; + + // + // Get the value of the function for point x2 + // + *f2 = this->GetLineValue(*x2, tempCoord); + + // + // Compute extrapolated point using the golden ratio + // + if ( *f2 >= *f1 ) + { + this->Swap(x1, x2); + this->Swap(f1, f2); + } + + // compute x3 on the side of x2 + *x3 = *x1 + goldenRatio * ( *x2 - *x1 ); + *f3 = this->GetLineValue(*x3, tempCoord); + + // If the new point is a minimum + // then continue extrapolating in + // that direction until we find a + // value of f3 that makes f2 to be + // a minimum. + while ( *f3 < *f2 ) + { + *x2 = *x3; + *f2 = *f3; + *x3 = *x1 + goldenRatio * ( *x2 - *x1 ); + *f3 = this->GetLineValue(*x3, tempCoord); + } + + itkDebugMacro(<< "Initial: " << *x1 << ", " << *x2 << ", " << *x3); + // + // Report the central point as the minimum + // + this->SetCurrentLinePoint(*x2, *f2); +} + +template +void +PowellOptimizerv4 +::BracketedLineOptimize(double ax, double bx, double cx, + double fa, double functionValueOfb, double fc, + double *extX, double *extVal) +{ + ParametersType tempCoord(m_SpaceDimension); + + this->BracketedLineOptimize(ax, bx, cx, fa, functionValueOfb, fc, extX, extVal, tempCoord); +} + +template +void +PowellOptimizerv4 +::BracketedLineOptimize(double ax, double bx, double cx, + double itkNotUsed(fa), double functionValueOfb, double itkNotUsed(fc), + double *extX, double *extVal, + ParametersType & tempCoord) +{ + double x; + double v = 0.0; + double w; /* Abscissae, descr. see above */ + double a; + double b; + + a = ( ax < cx ? ax : cx ); + b = ( ax > cx ? ax : cx ); + + x = bx; + w = bx; + + const double goldenSectionRatio = ( 3.0 - std::sqrt(5.0) ) / 2; /* Gold + section + ratio */ + const double POWELL_TINY = 1.0e-20; + + double functionValueOfX; /* f(x) */ + double functionValueOfV; /* f(v) */ + double functionValueOfW; /* f(w) */ + + functionValueOfV = functionValueOfb; + functionValueOfX = functionValueOfV; + functionValueOfW = functionValueOfV; + + for ( m_CurrentLineIteration = 0; + m_CurrentLineIteration < m_MaximumLineIteration; + m_CurrentLineIteration++ ) + { + double middle_range = ( a + b ) / 2; + + double new_step; /* Step at this iteration */ + + double tolerance1; + double tolerance2; + + tolerance1 = m_StepTolerance * std::fabs(x) + POWELL_TINY; + tolerance2 = 2.0 * tolerance1; + + if ( std::fabs(x - middle_range) <= ( tolerance2 - 0.5 * ( b - a ) ) + || 0.5 * ( b - a ) < m_StepTolerance ) + { + *extX = x; + *extVal = functionValueOfX; + this->SetCurrentLinePoint(x, functionValueOfX); + itkDebugMacro(<< "x = " << *extX); + itkDebugMacro(<< "val = " << *extVal); + itkDebugMacro(<< "return 1"); + return; /* Acceptable approx. is found */ + } + + /* Obtain the gold section step */ + new_step = goldenSectionRatio * ( x < middle_range ? b - x : a - x ); + + /* Decide if the interpolation can be tried */ + if ( std::fabs(x - w) >= tolerance1 ) /* If x and w are distinct */ + { + double t; + t = ( x - w ) * ( functionValueOfX - functionValueOfV ); + + double q; /* ted as p/q; division operation*/ + q = ( x - v ) * ( functionValueOfX - functionValueOfW ); + + double p; /* Interpolation step is calcula-*/ + p = ( x - v ) * q - ( x - w ) * t; + + q = 2 * ( q - t ); + + if ( q > (double)0 ) /* q was calculated with the op-*/ + { + p = -p; /* posite sign; make q positive */ + } + else /* and assign possible minus to */ + { + q = -q; /* p */ + } + + /* Chec if x+p/q falls in [a,b] and not too close to a and b + and isn't too large */ + if ( std::fabs(p) < std::fabs(new_step * q) + && p > q * ( a - x + 2 * tolerance1 ) + && p < q * ( b - x - 2 * tolerance1 ) ) + { + new_step = p / q; /* it is accepted */ + } + + /* If p/q is too large then the gold section procedure can + reduce [a,b] range to more extent */ + } + + /* Adjust the step to be not less than tolerance*/ + if ( std::fabs(new_step) < tolerance1 ) + { + if ( new_step > 0.0 ) + { + new_step = tolerance1; + } + else + { + new_step = -tolerance1; + } + } + + /* Obtain the next approximation to min */ + /* and reduce the enveloping range */ + double t = x + new_step; /* Tentative point for the min */ + + double functionValueOft; + + functionValueOft = this->GetLineValue(t, tempCoord); + + if ( functionValueOft <= functionValueOfX ) + { + if ( t < x ) /* Reduce the range so that */ + { + b = x; /* t would fall within it */ + } + else + { + a = x; + } + + /* assing the best approximation to x */ + v = w; + w = x; + x = t; + + functionValueOfV = functionValueOfW; + functionValueOfW = functionValueOfX; + functionValueOfX = functionValueOft; + } + else /* x remains the better approx */ + { + if ( t < x ) /* Reduce the range enclosing x */ + { + a = t; + } + else + { + b = t; + } + + if ( functionValueOft <= functionValueOfW || w == x ) + { + v = w; + w = t; + functionValueOfV = functionValueOfW; + functionValueOfW = functionValueOft; + } + else if ( functionValueOft <= functionValueOfV || v == x || v == w ) + { + v = t; + functionValueOfV = functionValueOft; + } + } + } + + *extX = x; + *extVal = functionValueOfX; + itkDebugMacro(<< "x = " << *extX); + itkDebugMacro(<< "val = " << *extVal); + itkDebugMacro(<< "return 2"); + + this->SetCurrentLinePoint(x, functionValueOfX); +} + +template +void +PowellOptimizerv4 +::StartOptimization(bool /* doOnlyInitialization */) +{ + if ( this->m_Metric.IsNull() ) + { + return; + } + + Superclass::StartOptimization(); + + m_StopConditionDescription.str(""); + m_StopConditionDescription << this->GetNameOfClass() << ": "; + + this->InvokeEvent( StartEvent() ); + m_Stop = false; + + this->SetSpaceDimension( this->m_Metric->GetNumberOfParameters() ); + + vnl_matrix< double > xi(m_SpaceDimension, m_SpaceDimension); + vnl_vector< double > xit(m_SpaceDimension); + xi.set_identity(); + xit.fill(0); + xit[0] = 1; + + ParametersType tempCoord(m_SpaceDimension); + ParametersType p(m_SpaceDimension); + ParametersType pt(m_SpaceDimension); + ParametersType ptt(m_SpaceDimension); + p = this->m_Metric->GetParameters(); + pt = p; + + unsigned int ibig; + double fp, del, fptt; + double ax, xx, bx; + double fa, fx, fb; + + xx = 0; + this->SetLine(p, xit); + fx = this->GetLineValue(0, tempCoord); + + for ( this->m_CurrentIteration = 0; + this->m_CurrentIteration <= m_MaximumIteration; + this->m_CurrentIteration++ ) + { + fp = fx; + ibig = 0; + del = 0.0; + + for ( unsigned int i = 0; i < m_SpaceDimension; i++ ) + { + for ( unsigned int j = 0; j < m_SpaceDimension; ++j ) + { + xit[j] = xi[j][i]; + } + fptt = fx; + + this->SetLine(p, xit); + + ax = 0.0; + fa = fx; + xx = m_StepLength; + this->LineBracket(&ax, &xx, &bx, &fa, &fx, &fb, tempCoord); + this->BracketedLineOptimize(ax, xx, bx, fa, fx, fb, &xx, &fx, tempCoord); + this->SetCurrentLinePoint(xx, fx); + p = this->GetCurrentPosition(); + + if ( std::fabs(fptt - fx) > del ) + { + del = std::fabs(fptt - fx); + ibig = i; + } + } + + if ( 2.0 * std::fabs(fp - fx) + <= m_ValueTolerance * ( std::fabs(fp) + std::fabs(fx) ) ) + { + m_StopConditionDescription << "Cost function values at the current parameter (" + << fx + << ") and at the local extrema (" + << fp + << ") are within Value Tolerance (" + << m_ValueTolerance << ")"; + this->InvokeEvent( EndEvent() ); + return; + } + + const ScalesType & scales = this->GetScales(); + for ( unsigned int j = 0; j < m_SpaceDimension; ++j ) + { + ptt[j] = 2.0 * p[j] - pt[j]; + + if( this->GetScalesAreIdentity() ) + { + xit[j] = p[j] - pt[j]; + } + else + { + xit[j] = ( p[j] - pt[j] ) * scales[j]; + } + + pt[j] = p[j]; + } + + this->SetLine(ptt, xit); + fptt = this->GetLineValue(0, tempCoord); + if ( fptt < fp ) + { + double t = 2.0 * ( fp - 2.0 * fx + fptt ) + * vnl_math_sqr(fp - fx - del) + - del *vnl_math_sqr(fp - fptt); + if ( t < 0.0 ) + { + this->SetLine(p, xit); + + ax = 0.0; + fa = fx; + xx = 1; + this->LineBracket(&ax, &xx, &bx, &fa, &fx, &fb, tempCoord); + this->BracketedLineOptimize(ax, xx, bx, fa, fx, fb, &xx, &fx, tempCoord); + this->SetCurrentLinePoint(xx, fx); + p = this->GetCurrentPosition(); + + for ( unsigned int j = 0; j < m_SpaceDimension; j++ ) + { + xi[j][ibig] = xx * xit[j]; + } + } + } + + this->InvokeEvent( IterationEvent() ); + } + + m_StopConditionDescription << "Maximum number of iterations exceeded. " + << "Number of iterations is " + << m_MaximumIteration; + this->InvokeEvent( EndEvent() ); +} + +template +const std::string +PowellOptimizerv4 +::GetStopConditionDescription() const +{ + return m_StopConditionDescription.str(); +} + +template +void +PowellOptimizerv4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "Metric Worst Possible Value " << m_MetricWorstPossibleValue << std::endl; + os << indent << "Catch GetValue Exception " << m_CatchGetValueException << std::endl; + os << indent << "Space Dimension " << m_SpaceDimension << std::endl; + os << indent << "Maximum Iteration " << m_MaximumIteration << std::endl; + os << indent << "StepLength " << m_StepLength << std::endl; + os << indent << "StepTolerance " << m_StepTolerance << std::endl; + os << indent << "ValueTolerance " << m_ValueTolerance << std::endl; + os << indent << "LineOrigin " << m_LineOrigin << std::endl; + os << indent << "LineDirection " << m_LineDirection << std::endl; + os << indent << "Current Cost " << m_CurrentCost << std::endl; + os << indent << "Maximum Line Iteration " << m_MaximumLineIteration << std::endl; + os << indent << "Current Line Iteration " << m_CurrentLineIteration << std::endl; + os << indent << "Stop " << m_Stop << std::endl; +} +} // end of namespace itk +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -130,7 +130,6 @@ /** The information about the previous step */ MeasureType m_PreviousValue; ParametersType m_PreviousPosition; - DerivativeType m_PreviousGradient; /** The best value so far and relevant information */ MeasureType m_BestValue; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkQuasiNewtonOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,9 +26,13 @@ template QuasiNewtonOptimizerv4Template -::QuasiNewtonOptimizerv4Template() +::QuasiNewtonOptimizerv4Template(): + m_MaximumIterationsWithoutProgress(30), + m_PreviousValue(0.0), + m_BestValue(0.0), + m_BestPosition(0), + m_BestIteration(0) { - this->m_MaximumIterationsWithoutProgress = 30; this->m_LearningRate = NumericTraits::One; // m_MaximumNewtonStepSizeInPhysicalUnits is used for automatic learning @@ -38,9 +42,10 @@ this->m_MaximumNewtonStepSizeInPhysicalUnits = NumericTraits::Zero; /** Threader for Quasi-Newton method */ - typedef QuasiNewtonOptimizerv4EstimateNewtonStepThreaderTemplate OptimizerType; - typedef typename OptimizerType::Pointer OptimizerPointer; - + typedef QuasiNewtonOptimizerv4EstimateNewtonStepThreaderTemplate + OptimizerType; + typedef typename OptimizerType::Pointer + OptimizerPointer; OptimizerPointer estimateNewtonStepThreader = OptimizerType::New(); this->m_EstimateNewtonStepThreader = estimateNewtonStepThreader; @@ -111,20 +116,20 @@ if (this->GetCurrentIteration() == 0) { // initialize some information - m_PreviousValue = this->GetCurrentMetricValue(); - m_PreviousPosition = this->GetCurrentPosition(); - m_PreviousGradient = this->GetGradient(); - - m_BestValue = this->m_CurrentMetricValue; - m_BestPosition = this->m_CurrentPosition; - m_BestIteration = this->GetCurrentIteration(); + this->m_PreviousValue = this->GetCurrentMetricValue(); + this->m_PreviousPosition = this->GetCurrentPosition(); + this->m_PreviousGradient = this->GetGradient(); + + this->m_BestValue = this->m_CurrentMetricValue; + this->m_BestPosition = this->m_CurrentPosition; + this->m_BestIteration = this->GetCurrentIteration(); } else if (m_BestValue > this->m_CurrentMetricValue) { // store the best value and related information - m_BestValue = this->m_CurrentMetricValue; - m_BestPosition = this->m_CurrentPosition; - m_BestIteration = this->GetCurrentIteration(); + this->m_BestValue = this->m_CurrentMetricValue; + this->m_BestPosition = this->m_CurrentPosition; + this->m_BestIteration = this->GetCurrentIteration(); } if ( this->GetCurrentIteration() - m_BestIteration @@ -170,9 +175,9 @@ this->EstimateNewtonStep(); /** Save for the next iteration */ - m_PreviousValue = this->GetCurrentMetricValue(); - m_PreviousPosition = this->GetCurrentPosition(); - m_PreviousGradient = this->GetGradient(); + this->m_PreviousValue = this->GetCurrentMetricValue(); + this->m_PreviousPosition = this->GetCurrentPosition(); + this->m_PreviousGradient = this->GetGradient(); this->CombineGradientNewtonStep(); this->ModifyCombinedNewtonStep(); @@ -268,7 +273,7 @@ } } - if (vcl_abs(this->m_LearningRate - NumericTraits::One) + if (std::abs(this->m_LearningRate - NumericTraits::One) > 0.01) { this->m_NewtonStep *= this->m_LearningRate; @@ -389,8 +394,8 @@ TInternalComputationValueType dot_dg_dx = inner_product(dg, dx); TInternalComputationValueType dot_edg_dx = inner_product(edg, dx); - if (vcl_abs(dot_dg_dx) <= NumericTraits::epsilon() - || vcl_abs(dot_edg_dx) <= NumericTraits::epsilon()) + if (std::abs(dot_dg_dx) <= NumericTraits::epsilon() + || std::abs(dot_edg_dx) <= NumericTraits::epsilon()) { return false; } @@ -412,7 +417,7 @@ TInternalComputationValueType threshold = NumericTraits::epsilon(); - if ( vcl_abs(vnl_determinant(newHessian)) <= threshold ) + if ( std::abs(vnl_determinant(newHessian)) <= threshold ) { return false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesEstimator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -82,11 +82,11 @@ itkExceptionMacro("RegistrationParameterScalesEstimator: the metric is NULL"); } - if (this->m_Metric->GetMovingTransform() == NULL) + if (this->m_Metric->GetMovingTransform() == ITK_NULLPTR) { itkExceptionMacro("RegistrationParameterScalesEstimator: this->m_MovingTransform in the metric is NULL."); } - if (this->m_Metric->GetFixedTransform() == NULL) + if (this->m_Metric->GetFixedTransform() == ITK_NULLPTR) { itkExceptionMacro("RegistrationParameterScalesEstimator: this->m_FixedTransform in the metric is NULL."); } @@ -290,9 +290,9 @@ RegistrationParameterScalesEstimator< TMetric > ::ComputeSquaredJacobianNorms( const VirtualPointType & point, ParametersType & squareNorms ) { - JacobianType jacobian; const SizeValueType numPara = this->GetNumberOfLocalParameters(); const SizeValueType dim = this->GetDimension(); + JacobianType jacobian(dim,numPara); if (this->GetTransformForward()) { @@ -475,10 +475,10 @@ const TransformBaseTemplate *transform = this->GetTransform(); - if ( dynamic_cast< const MatrixOffsetTransformBaseType * >( transform ) != NULL - || dynamic_cast< const TranslationTransformType * >( transform ) != NULL - || dynamic_cast< const IdentityTransformType * >( transform ) != NULL - || dynamic_cast< const Rigid3DPerspectiveTransformType * >( transform ) != NULL + if ( dynamic_cast< const MatrixOffsetTransformBaseType * >( transform ) != ITK_NULLPTR + || dynamic_cast< const TranslationTransformType * >( transform ) != ITK_NULLPTR + || dynamic_cast< const IdentityTransformType * >( transform ) != ITK_NULLPTR + || dynamic_cast< const Rigid3DPerspectiveTransformType * >( transform ) != ITK_NULLPTR ) { return true; @@ -642,7 +642,7 @@ } else { - FloatType ratio = 1 + vcl_log((FloatType)total/SizeOfSmallDomain); + FloatType ratio = 1 + std::log((FloatType)total/SizeOfSmallDomain); //ratio >= 1 since total/SizeOfSmallDomain > 1 this->m_NumberOfRandomSamples = static_cast(SizeOfSmallDomain * ratio); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromJacobian.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -159,19 +159,31 @@ itk::Array dTdt(dim); + JacobianType jacobianCache(dim,dim); + JacobianType jacobian(dim, + (this->GetTransformForward() ? + this->m_Metric->GetMovingTransform()->GetNumberOfParameters() + : this->m_Metric->GetFixedTransform()->GetNumberOfParameters())); + + // checking each sample point for (SizeValueType c=0; cm_SamplePoints[c]; - JacobianType jacobian; if (this->GetTransformForward()) { - this->m_Metric->GetMovingTransform()->ComputeJacobianWithRespectToParameters(point, jacobian); + this->m_Metric->GetMovingTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(point, + jacobian, + jacobianCache); } else { - this->m_Metric->GetFixedTransform()->ComputeJacobianWithRespectToParameters(point, jacobian); + this->m_Metric->GetFixedTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(point, + jacobian, + jacobianCache); } if( !this->IsDisplacementFieldTransform() ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegistrationParameterScalesFromShiftBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -142,9 +142,9 @@ FloatType maxStep = NumericTraits::Zero; for (typename ParametersType::SizeValueType p = 0; p < step.GetSize(); p++) { - if (maxStep < vcl_abs(step[p])) + if (maxStep < std::abs(step[p])) { - maxStep = vcl_abs(step[p]); + maxStep = std::abs(step[p]); } } if (maxStep <= NumericTraits::epsilon()) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,150 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkRegularStepGradientDescentOptimizerv4_h +#define __itkRegularStepGradientDescentOptimizerv4_h + +#include "itkGradientDescentOptimizerv4.h" +#include + +namespace itk +{ + /** \class RegularStepGradientDescentOptimizerv4 + * \brief Regular Step Gradient descent optimizer. + * + * This optimizer is a variant of gradient descent that attempts to prevent it + * from taking steps that are too large. At each iteration, this optimizer + * will take a step along the direction of the metric derivative. Each time the + * direction of the derivative abruptly changes, the optimizer assumes that a + * local extrema has been passed and reacts by reducing the step length by a + * relaxation factor that is set to 0.5 by default. + * The default value for the initial step length is 1, and this value can only + * be changed manually via SetLearningRate() since this optimizer does not use + * the ScaleEstimator to automatically estimate the learning rate. + * Also note that unlike the previous version of ReuglarStepGradientDescentOptimizer, + * ITKv4 does not have a "maximize/minimize" option to modify the effect of + * the metric derivative. The assigned metric is assumed to return a parameter + * derivative result that "improves" the optimization. + * + * \ingroup ITKOptimizersv4 + */ +template +class RegularStepGradientDescentOptimizerv4 +: public GradientDescentOptimizerv4Template +{ +public: + /** Standard class typedefs. */ + typedef RegularStepGradientDescentOptimizerv4 Self; + typedef GradientDescentOptimizerv4Template Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Run-time type information (and related methods). */ + itkTypeMacro(RegularStepGradientDescentOptimizerv4, Superclass); + + /** New macro for creation of through a Smart Pointer */ + itkNewMacro(Self); + + + /** It should be possible to derive the internal computation type from the class object. */ + typedef TInternalComputationValueType InternalComputationValueType; + + /** Derivative type */ + typedef typename Superclass::DerivativeType DerivativeType; + + /** Metric type over which this class is templated */ + typedef typename Superclass::MeasureType MeasureType; + typedef typename Superclass::IndexRangeType IndexRangeType; + typedef typename Superclass::ScalesType ScalesType; + typedef typename Superclass::ParametersType ParametersType; + typedef typename Superclass::StopConditionType StopConditionType; + + /** Compensated summation type */ + typedef CompensatedSummation< InternalComputationValueType > CompensatedSummationType; + + /** Minimum step length (learning rate) value for convergence checking. + * The step length is decreased by relaxation factor if the step is too + * long, and the algorithm passes the local minimum. + * When the step length value reaches a small value, it would be treated + * as converged. + * + * The default m_MinimumStepLength is set to 1e-4 to pass all + * tests. + */ + itkSetMacro(MinimumStepLength, TInternalComputationValueType); + itkGetConstReferenceMacro(MinimumStepLength, TInternalComputationValueType); + + /** Set/Get relaxation factor value */ + itkSetMacro(RelaxationFactor, TInternalComputationValueType); + itkGetConstReferenceMacro(RelaxationFactor, TInternalComputationValueType); + + /** Set/Get gradient magnitude tolerance value */ + itkSetMacro(GradientMagnitudeTolerance, TInternalComputationValueType); + itkGetConstReferenceMacro(GradientMagnitudeTolerance, TInternalComputationValueType); + + /** Start and run the optimization */ + virtual void StartOptimization( bool doOnlyInitialization = false ) ITK_OVERRIDE; + + /** Estimate the learning rate based on the current gradient. */ + virtual void EstimateLearningRate(); + +protected: + + /** Advance one Step following the gradient direction. + * Includes transform update. */ + virtual void AdvanceOneStep(void) ITK_OVERRIDE; + + /** Modify the input gradient over a given index range. */ + virtual void ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE; + virtual void ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) ITK_OVERRIDE; + + /** + * When the local minima is passed by taking a large step, + * the step size is adjusted by the relaxation factor, so we + * can take smaller steps toward the minimum point. + */ + TInternalComputationValueType m_RelaxationFactor; + + /** Default constructor */ + RegularStepGradientDescentOptimizerv4(); + + /** Destructor */ + virtual ~RegularStepGradientDescentOptimizerv4(); + + virtual void PrintSelf( std::ostream & os, Indent indent ) const; + + /** Minimum gradient step value for convergence checking */ + TInternalComputationValueType m_MinimumStepLength; + + /** Minimum gradient magnitude value for convergence checking */ + TInternalComputationValueType m_GradientMagnitudeTolerance; + + /** Current scale for learning rate */ + MeasureType m_CurrentLearningRateRelaxation; + +private: + RegularStepGradientDescentOptimizerv4( const Self & ); //purposely not implemented + void operator=( const Self& ); //purposely not implemented +}; + +} // end namespace itk + +#ifndef ITK_MANUAL_INSTANTIATION +#include "itkRegularStepGradientDescentOptimizerv4.hxx" +#endif + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.hxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkRegularStepGradientDescentOptimizerv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,299 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkRegularStepGradientDescentOptimizerv4_hxx +#define __itkRegularStepGradientDescentOptimizerv4_hxx + +#include "itkRegularStepGradientDescentOptimizerv4.h" + +namespace itk +{ + +template +RegularStepGradientDescentOptimizerv4 +::RegularStepGradientDescentOptimizerv4(): + m_RelaxationFactor( 0.5 ), + m_MinimumStepLength( 1e-4 ), // Initialize parameter for the convergence checker + m_GradientMagnitudeTolerance( 1e-4 ), + m_CurrentLearningRateRelaxation( 0 ) +{ + this->m_DoEstimateLearningRateAtEachIteration = false; + this->m_DoEstimateLearningRateOnce = false; +} + +template +RegularStepGradientDescentOptimizerv4 +::~RegularStepGradientDescentOptimizerv4() +{} + +template +void +RegularStepGradientDescentOptimizerv4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "Current learning rate relaxation: " << m_CurrentLearningRateRelaxation << std::endl; + os << indent << "Relaxation factor: " << this->m_RelaxationFactor << std::endl; + os << indent << "Minimum step length: " << this->m_MinimumStepLength << std::endl; + os << indent << "Gradient magnitude tolerance: " << this->m_GradientMagnitudeTolerance << std::endl; +} + +template +void +RegularStepGradientDescentOptimizerv4 +::StartOptimization( bool doOnlyInitialization ) +{ + this->m_UseConvergenceMonitoring = false; + + /* Must call the grandparent version for basic validation and setup */ + GradientDescentOptimizerBasev4Template::StartOptimization( doOnlyInitialization ); + + if( this->m_ReturnBestParametersAndValue ) + { + this->m_BestParameters = this->GetCurrentPosition( ); + this->m_CurrentBestValue = NumericTraits< MeasureType >::max(); + } + + const SizeValueType spaceDimension = this->m_Metric->GetNumberOfParameters(); + + this->m_Gradient = DerivativeType(spaceDimension); + this->m_PreviousGradient = DerivativeType(spaceDimension); + this->m_Gradient.Fill(0.0f); + this->m_PreviousGradient.Fill(0.0f); + + // Reset the iterations and learning rate scale when the optimizer is started again. + this->m_CurrentLearningRateRelaxation = 1.0; + this->m_CurrentIteration = 0; + + // validity check for the value of GradientMagnitudeTolerance + if ( m_GradientMagnitudeTolerance < 0.0 ) + { + itkExceptionMacro(<< "Gradient magnitude tolerance must be" + "greater or equal 0.0. Current value is " << m_GradientMagnitudeTolerance); + } + + if( ! doOnlyInitialization ) + { + this->ResumeOptimization(); + } +} + +template +void +RegularStepGradientDescentOptimizerv4 +::AdvanceOneStep() +{ + itkDebugMacro("AdvanceOneStep"); + + // Make sure the scales have been set properly + if ( this->m_Scales.size() != this->m_Gradient.Size() ) + { + itkExceptionMacro(<< "The size of Scales is " + << this->m_Scales.size() + << ", but the NumberOfParameters for the CostFunction is " + << this->m_Gradient.Size() + << "."); + } + + if ( this->m_RelaxationFactor < 0.0 ) + { + itkExceptionMacro(<< "Relaxation factor must be positive. Current value is " << this->m_RelaxationFactor); + } + + if ( this->m_RelaxationFactor >= 1.0 ) + { + itkExceptionMacro(<< "Relaxation factor must less than 1.0. Current value is " << this->m_RelaxationFactor); + } + + /* Begin threaded gradient modification. + * Scale gradient and previous gradient by scales. + * The m_Gradient and m_PreviousGradient variables are modified in-place. */ + this->ModifyGradientByScales(); + + CompensatedSummationType compensatedSummation; + for( SizeValueType dim = 0; dim < this->m_Gradient.Size(); ++dim ) + { + const double weighted = this->m_Gradient[dim]; + compensatedSummation += weighted * weighted; + } + const double gradientMagnitude = vcl_sqrt( compensatedSummation.GetSum() ); + + if( gradientMagnitude < this->m_GradientMagnitudeTolerance ) + { + this->m_StopCondition = Superclass::GRADIENT_MAGNITUDE_TOLEARANCE; + this->m_StopConditionDescription << "Gradient magnitude tolerance met after " + << this->m_CurrentIteration + << " iterations. Gradient magnitude (" + << gradientMagnitude + << ") is less than gradient magnitude tolerance (" + << this->m_GradientMagnitudeTolerance + << ")."; + this->StopOptimization(); + return; + } + + compensatedSummation.ResetToZero(); + for ( SizeValueType i = 0; i < this->m_Gradient.Size(); i++ ) + { + const double weight1 = this->m_Gradient[i]; + const double weight2 = this->m_PreviousGradient[i]; + compensatedSummation += weight1 * weight2; + } + const double scalarProduct = compensatedSummation.GetSum(); + + // If there is a direction change + if ( scalarProduct < 0 ) + { + this->m_CurrentLearningRateRelaxation *= this->m_RelaxationFactor; + } + + const double stepLength = this->m_CurrentLearningRateRelaxation*this->m_LearningRate; + + if ( stepLength < this->m_MinimumStepLength ) + { + this->m_StopCondition = Superclass::STEP_TOO_SMALL; + this->m_StopConditionDescription << "Step too small after " + << this->m_CurrentIteration + << " iterations. Current step (" + << stepLength + << ") is less than minimum step (" + << this->m_MinimumStepLength + << ")."; + this->StopOptimization(); + return; + } + + this->EstimateLearningRate(); + this->ModifyGradientByLearningRate(); + const double factor = NumericTraits::OneValue() / gradientMagnitude; + + try + { + /* Pass graident to transform and let it do its own updating */ + this->m_Metric->UpdateTransformParameters( this->m_Gradient, factor ); + } + catch ( ExceptionObject & err ) + { + this->m_StopCondition = Superclass::UPDATE_PARAMETERS_ERROR; + this->m_StopConditionDescription << "UpdateTransformParameters error"; + this->StopOptimization(); + + // Pass exception to caller + throw err; + } + + this->InvokeEvent( IterationEvent() ); +} + +template +void +RegularStepGradientDescentOptimizerv4 +::ModifyGradientByScalesOverSubRange( const IndexRangeType& subrange ) +{ + const ScalesType& scales = this->GetScales(); + const ScalesType& weights = this->GetWeights(); + + ScalesType factor( scales.Size() ); + + if( this->GetWeightsAreIdentity() ) + { + for( SizeValueType i=0; i < factor.Size(); i++ ) + { + factor[i] = NumericTraits::OneValue() / scales[i]; + } + } + else + { + for( SizeValueType i=0; i < factor.Size(); i++ ) + { + factor[i] = weights[i] / scales[i]; + } + } + + /* Loop over the range. It is inclusive. */ + for ( IndexValueType j = subrange[0]; j <= subrange[1]; j++ ) + { + // scales is checked during StartOptmization for values <= + // machine epsilon. + // Take the modulo of the index to handle gradients from transforms + // with local support. The gradient array stores the gradient of local + // parameters at each local index with linear packing. + IndexValueType index = j % scales.Size(); + this->m_Gradient[j] = this->m_Gradient[j] * factor[index]; + this->m_PreviousGradient[j] = this->m_PreviousGradient[j] * factor[index]; + } +} + +template +void +RegularStepGradientDescentOptimizerv4 +::ModifyGradientByLearningRateOverSubRange( const IndexRangeType& subrange ) +{ + /* Loop over the range. It is inclusive. */ + for ( IndexValueType j = subrange[0]; j <= subrange[1]; j++ ) + { + this->m_Gradient[j] = this->m_Gradient[j] * this->m_CurrentLearningRateRelaxation*this->m_LearningRate; + } +} + +/** +* Estimate the learning rate. +*/ +template +void +RegularStepGradientDescentOptimizerv4 +::EstimateLearningRate() +{ + if ( this->m_ScalesEstimator.IsNull() ) + { + return; + } + if ( this->m_DoEstimateLearningRateAtEachIteration || + (this->m_DoEstimateLearningRateOnce && this->m_CurrentIteration == 0) ) + { + TInternalComputationValueType stepScale + = this->m_ScalesEstimator->EstimateStepScale(this->m_Gradient); + + if (stepScale <= NumericTraits::epsilon()) + { + this->m_LearningRate = NumericTraits::One; + } + else + { + this->m_LearningRate = this->m_MaximumStepSizeInPhysicalUnits / stepScale; + } + CompensatedSummationType compensatedSummation; + for( SizeValueType dim = 0; dim < this->m_Gradient.Size(); ++dim ) + { + const double weighted = this->m_Gradient[dim]; + compensatedSummation += weighted * weighted; + } + const double gradientMagnitude = std::sqrt( compensatedSummation.GetSum() ); + + // + // Specialized to keep the step size regularized this additional + // scale is needed to make the learning rate independent on the + // gradient magnitude. + // + this->m_LearningRate *= gradientMagnitude; + + } +} + +}//namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedNonLinearVnlOptimizerv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedNonLinearVnlOptimizerv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedNonLinearVnlOptimizerv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedNonLinearVnlOptimizerv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,126 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkSingleValuedNonLinearVnlOptimizerv4_h +#define __itkSingleValuedNonLinearVnlOptimizerv4_h + +#include "itkObjectToObjectOptimizerBase.h" +#include "itkSingleValuedVnlCostFunctionAdaptorv4.h" +#include "itkCommand.h" + +namespace itk +{ +/** \class SingleValuedNonLinearVnlOptimizerv4 + * \brief This is a base for the ITKv4 Optimization methods using + * the vnl library. + * + * It is an Adaptor class for optimizers provided by the vnl library. + * + * \ingroup ITKOptimizersv4 + */ +class SingleValuedNonLinearVnlOptimizerv4 : + public ObjectToObjectOptimizerBaseTemplate +{ +public: + /** Standard class typedefs. */ + typedef SingleValuedNonLinearVnlOptimizerv4 Self; + typedef ObjectToObjectOptimizerBase Superclass; + typedef SmartPointer< Self > Pointer; + typedef SmartPointer< const Self > ConstPointer; + + /** Run-time type information (and related methods). */ + itkTypeMacro(SingleValuedNonLinearVnlOptimizerv4, ObjectToObjectOptimizerBase) + + /** Command observer that will interact with the ITKVNL cost-function + * adaptor in order to generate iteration events. This will allow to overcome + * the limitation of VNL optimizers not offering callbacks for every + * iteration */ + typedef ReceptorMemberCommand< Self > CommandType; + + typedef Superclass::MetricType MetricType; + typedef Superclass::DerivativeType DerivativeType; + typedef Superclass::ParametersType ParametersType; + typedef Superclass::ScalesType ScalesType; + + /** Stop condition return string type */ + typedef Superclass::StopConditionReturnStringType StopConditionReturnStringType; + + /** Stop condition internal string type */ + typedef Superclass::StopConditionDescriptionType StopConditionDescriptionType; + + virtual void StartOptimization(bool doOnlyInitialization = false) ITK_OVERRIDE; + + /** Set the metric (cost function). This method has to be overloaded + * by derived classes because the CostFunctionAdaptor requires + * to know the number of parameters at construction time. This + * number of parameters is obtained at run-time from the itkObjectToObjectMetric. + * As a consequence each derived optimizer should construct its own + * CostFunctionAdaptor when overloading this method */ + virtual void SetMetric(MetricType *metric) = 0; + + /** Return Cached Values. These method have the advantage of not triggering a + * recomputation of the metric value, but it has the disadvantage of returning + * a value that may not be the one corresponding to the current parameters. For + * GUI update purposes, this method is a good option. + * \note The metric value is cached in the base class, retrieved via GetValue(). */ + itkGetConstReferenceMacro(CachedDerivative, DerivativeType); + itkGetConstReferenceMacro(CachedCurrentPosition, ParametersType); + + /** Get the reason for termination */ + virtual const StopConditionReturnStringType GetStopConditionDescription() const = 0; + +protected: + SingleValuedNonLinearVnlOptimizerv4(); + virtual ~SingleValuedNonLinearVnlOptimizerv4(); + + typedef SingleValuedVnlCostFunctionAdaptorv4 CostFunctionAdaptorType; + + void SetCostFunctionAdaptor(CostFunctionAdaptorType *adaptor); + + const CostFunctionAdaptorType * GetCostFunctionAdaptor(void) const; + + CostFunctionAdaptorType * GetCostFunctionAdaptor(void); + + /** The purpose of this method is to get around the lack of + * const-correctness in VNL cost-functions and optimizers */ + CostFunctionAdaptorType * GetNonConstCostFunctionAdaptor(void) const; + + /** Print out internal state */ + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; + +private: + /** The purpose of this method is to get around the lack of iteration reporting + * in VNL optimizers. By interfacing directly with the ITK cost function + * adaptor we are generating here Iteration Events. Note the iteration events + * here are produce PER EVALUATION of the metric, not per real iteration of the + * vnl optimizer. Optimizers that evaluate the metric multiple times at each + * iteration will generate a lot more of Iteration events here. */ + void IterationReport(const EventObject & event); + + SingleValuedNonLinearVnlOptimizerv4(const Self &); //purposely not implemented + void operator=(const Self &); //purposely not implemented + + CostFunctionAdaptorType *m_CostFunctionAdaptor; + + CommandType::Pointer m_Command; + + mutable ParametersType m_CachedCurrentPosition; + mutable DerivativeType m_CachedDerivative; +}; +} // end namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedVnlCostFunctionAdaptorv4.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedVnlCostFunctionAdaptorv4.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedVnlCostFunctionAdaptorv4.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/include/itkSingleValuedVnlCostFunctionAdaptorv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,129 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#ifndef __itkSingleValuedVnlCostFunctionAdaptorv4_h +#define __itkSingleValuedVnlCostFunctionAdaptorv4_h + +#include "itkOptimizerParameters.h" +#include "itkObjectToObjectMetricBase.h" +#include "vnl/vnl_cost_function.h" + +namespace itk +{ +/** \class SingleValuedVnlCostFunctionAdaptorv4 + * \brief This class is an Adaptor that allows to pass + * itk::ObjectToObjectMetricBase objects to vnl_optimizers expecting + * a vnl_cost_function. For use in the ITKv4 registration framework. + * + * This class returns a single value. + * + * \ingroup ITKOptimizersv4 + */ +class SingleValuedVnlCostFunctionAdaptorv4: + public vnl_cost_function +{ +public: + + /** InternalMeasureType typedef. */ + typedef double InternalMeasureType; + + /** InternalParametersType typedef. */ + typedef vnl_vector< InternalMeasureType > InternalParametersType; + + /** InternalGradientType typedef. */ + typedef vnl_vector< InternalMeasureType > InternalDerivativeType; + + /** Parameters of the SingleValuedCostFunction */ + typedef ObjectToObjectMetricBase::ParametersType ParametersType; + + /** Derivatives of the SingleValuedCostFunction */ + typedef ObjectToObjectMetricBase::DerivativeType DerivativeType; + + /** Type of the SingleValuedCostFunction value */ + typedef ObjectToObjectMetricBase::MeasureType MeasureType; + + /** Scales typedef */ + typedef OptimizerParameters< InternalMeasureType > ScalesType; + + /** Constructor with size */ + SingleValuedVnlCostFunctionAdaptorv4(unsigned int spaceDimension); + + /** Set the CostFunction deriving from SingleValuedCostFunction */ + void SetCostFunction(ObjectToObjectMetricBase *costFunction) + { + m_ObjectMetric = costFunction; + } + + /** Get the CostFunction deriving from SingleValuedCostFunction */ + const ObjectToObjectMetricBase * GetCostFunction(void) const + { + return m_ObjectMetric; + } + + /** Delegate computation of the value to the CostFunction. */ + virtual InternalMeasureType f(const InternalParametersType & inparameters) ITK_OVERRIDE; + + /** Delegate computation of the gradient to the costFunction. */ + virtual void gradf(const InternalParametersType & inparameters, InternalDerivativeType & gradient) ITK_OVERRIDE; + + /** Delegate computation of value and gradient to the costFunction. */ + virtual void compute(const InternalParametersType & x, InternalMeasureType *f, InternalDerivativeType *g) ITK_OVERRIDE; + + /** Convert external derviative measures into internal type */ + void ConvertExternalToInternalGradient( const DerivativeType & input, InternalDerivativeType & output) const; + + /** Set current parameters scaling. */ + void SetScales(const ScalesType & scales); + + /** This AddObserver method allows to simulate that this class derives from + * an itkObject for the purpose of reporting iteration events. The goal of + * this method is to allow ITK-vnl optimizer adaptors to get iteration events + * despite the fact that VNL does not provide callbacks. */ + unsigned long AddObserver(const EventObject & event, Command *) const; + + /** Return the value of the last evaluation to the value of the cost function. + * Note that this method DOES NOT triggers a computation of the function or + * the derivatives, it only returns previous values. Therefore the values here + * are only valid after you invoke the f() or gradf() methods. */ + itkGetConstReferenceMacro(CachedValue, MeasureType); + + itkGetConstReferenceMacro(CachedDerivative, DerivativeType); + + /** Return the parameters directly from the assigned metric. */ + const ParametersType & GetCachedCurrentParameters() const; + +protected: + + /** This method is intended to be called by the derived classes in order to + * notify of an iteration event to any Command/Observers */ + void ReportIteration(const EventObject & event) const; + +private: + + ObjectToObjectMetricBase::Pointer m_ObjectMetric; + bool m_ScalesInitialized; + ScalesType m_Scales; + Object::Pointer m_Reporter; + + mutable MeasureType m_CachedValue; + mutable DerivativeType m_CachedDerivative; + +}; // end of Class CostFunction + +} // end namespace itk + +#endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,14 @@ +set(ITKOptimizersv4_SRC + itkSingleValuedNonLinearVnlOptimizerv4.cxx + itkSingleValuedVnlCostFunctionAdaptorv4.cxx + itkLBFGSOptimizerv4.cxx + itkLBFGSBOptimizerv4.cxx + itkAmoebaOptimizerv4.cxx + ) + +add_library(ITKOptimizersv4 ${ITKOptimizersv4_SRC}) +target_link_libraries(ITKOptimizersv4 + ${ITKMetricsv4_LIBRARIES} + ${ITKOptimizers_LIBRARIES} + ) +itk_module_target(ITKOptimizersv4) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkAmoebaOptimizerv4.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkAmoebaOptimizerv4.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkAmoebaOptimizerv4.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkAmoebaOptimizerv4.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,298 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ + +#include "itkAmoebaOptimizerv4.h" + +namespace itk +{ + + +AmoebaOptimizerv4 +::AmoebaOptimizerv4() : + m_InitialSimplexDelta(1) +{ + this->m_NumberOfIterations = 500; + this->m_ParametersConvergenceTolerance = 1e-8; + this->m_FunctionConvergenceTolerance = 1e-4; + this->m_AutomaticInitialSimplex = true; + this->m_InitialSimplexDelta.Fill( NumericTraits< ParametersType::ValueType >::One ); + this->m_OptimizeWithRestarts = false; + this->m_VnlOptimizer = ITK_NULLPTR; +} + + +AmoebaOptimizerv4 +::~AmoebaOptimizerv4() +{ + delete m_VnlOptimizer; +} + + +const std::string +AmoebaOptimizerv4 +::GetStopConditionDescription() const +{ + return this->m_StopConditionDescription.str(); +} + + +void +AmoebaOptimizerv4 +::PrintSelf( std::ostream & os, Indent indent ) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "ParametersConvergenceTolerance: " + << this->m_ParametersConvergenceTolerance << std::endl; + os << indent << "FunctionConvergenceTolerance: " + << this->m_FunctionConvergenceTolerance << std::endl; + os << indent << "AutomaticInitialSimplex: " + << ( this->m_AutomaticInitialSimplex ? "On" : "Off" ) << std::endl; + os << indent << "InitialSimplexDelta: " + << this->m_InitialSimplexDelta << std::endl; +} + + +vnl_amoeba * +AmoebaOptimizerv4 +::GetOptimizer() const +{ + return this->m_VnlOptimizer; +} + +void +AmoebaOptimizerv4:: +SetInitialSimplexDelta( ParametersType initialSimplexDelta, + bool automaticInitialSimplex ) +{ + this->m_InitialSimplexDelta = initialSimplexDelta; + this->m_AutomaticInitialSimplex = automaticInitialSimplex; + this->Modified(); +} + + +void +AmoebaOptimizerv4 +::SetMetric(MetricType *metric) +{ + this->m_Metric = metric; + + //if cost function is NULL this will throw an exception when the pointer is dereferenced + const unsigned int numberOfParameters = metric->GetNumberOfParameters(); + + // assign to vnl cost-function adaptor + CostFunctionAdaptorType *adaptor = new CostFunctionAdaptorType( numberOfParameters ); + adaptor->SetCostFunction( metric ); + this->SetCostFunctionAdaptor( adaptor ); + this->Modified(); +} + + +void +AmoebaOptimizerv4 +::StartOptimization(bool /* doOnlyInitialization */) +{ + // Perform some verification, check scales, + // pass settings to cost-function adaptor. + Superclass::StartOptimization(); + + //validate the settings (cost function is initialized, the size of its + //expected parameter vector matches the one we have etc...) + this->ValidateSettings(); + + ParametersType parameters = this->m_Metric->GetParameters(); + unsigned int n = parameters.GetSize(); + if( n == 0 ) + { + itkExceptionMacro(<<"Optimizer parameters are not initialized."); + } + + InternalParametersType delta( m_InitialSimplexDelta ); + + //start the actual work + this->InvokeEvent( StartEvent() ); + + //configure the vnl optimizer + CostFunctionAdaptorType *adaptor = GetNonConstCostFunctionAdaptor(); + //get rid of previous instance of the internal optimizer and create a + //new one + delete m_VnlOptimizer; + m_VnlOptimizer = new vnl_amoeba( *adaptor ); + m_VnlOptimizer->set_max_iterations( static_cast< int >( m_NumberOfIterations ) ); + m_VnlOptimizer->set_x_tolerance(m_ParametersConvergenceTolerance); + m_VnlOptimizer->set_f_tolerance(m_FunctionConvergenceTolerance); + + m_StopConditionDescription.str( "" ); + m_StopConditionDescription << this->GetNameOfClass() << ": Running"; + + ParametersType bestPosition = parameters; + + // Scale the initial parameters up if scales are defined. + // This compensates for later scaling them down in the cost function adaptor + // and at the end of this function. + const ScalesType & scales = GetScales(); + if ( !this->GetScalesAreIdentity() ) + { + for ( unsigned int i = 0; i < n; i++ ) + { + parameters[i] *= scales[i]; + } + } + //copy the automated initialization from vnl so that we have + //the same control as when the user provides the initial simplex. + //this also exposes the fact that there is an interaction between + //the parameter scaling and the initial simplex when using + //automated initialization - previously hidden inside vnl + if ( this->m_AutomaticInitialSimplex ) + { + const double relativeDiameter = 0.05; + const double zeroTermDelta = 0.00025; + InternalParametersType automaticDelta(n); + for( unsigned int i = 0; i < n; i++ ) + { + if( fabs( parameters[i] ) > zeroTermDelta ) + { + automaticDelta[i] = relativeDiameter*parameters[i]; + } + else + { + automaticDelta[i] = zeroTermDelta; + } + } + delta = automaticDelta; + } + + this->m_VnlOptimizer->minimize( parameters, delta ); + bestPosition = parameters; + double bestValue = adaptor->f( bestPosition ); + //multiple restart heuristic + if( this->m_OptimizeWithRestarts ) + { + this->m_CurrentIteration = static_cast( m_VnlOptimizer->get_num_evaluations() ); + bool converged = false; + unsigned int i=1; + while( !converged && ( this->m_CurrentIteration < m_NumberOfIterations ) ) + { + this->m_VnlOptimizer->set_max_iterations( + static_cast< int >( this->m_NumberOfIterations - this->m_CurrentIteration ) ); + parameters = bestPosition; + delta = delta*( 1.0/pow( 2.0, static_cast(i) ) * + (rand() > RAND_MAX/2 ? 1 : -1) ); + m_VnlOptimizer->minimize( parameters, delta ); + this->m_CurrentIteration += static_cast + (m_VnlOptimizer->get_num_evaluations()); + double currentValue = adaptor->f( parameters ); + // be consistent with the underlying vnl amoeba implementation + double maxAbs = 0.0; + for( unsigned j=0; jm_FunctionConvergenceTolerance && + maxAbs < this->m_ParametersConvergenceTolerance; + //this comparison is valid because the + //adaptor is set to always return the function value + //corresponding to minimization + if( currentValue < bestValue ) + { + bestValue = currentValue; + bestPosition = parameters; + } + i++; + } + } + // get the results, we scale the parameters down if scales are defined + if ( !this->GetScalesAreIdentity() ) + { + for ( unsigned int i = 0; i < n; ++i ) + { + bestPosition[i] /= scales[i]; + } + } + + this->m_Metric->SetParameters( bestPosition ); + + this->m_StopConditionDescription.str( "" ); + this->m_StopConditionDescription << this->GetNameOfClass() << ": "; + if ( static_cast< unsigned int >( this->m_VnlOptimizer->get_num_evaluations() ) + < this->m_NumberOfIterations ) + { + this->m_StopConditionDescription << "Both parameters convergence tolerance (" + << this->m_ParametersConvergenceTolerance + << ") and function convergence tolerance (" + << this->m_FunctionConvergenceTolerance + << ") have been met in " + << this->m_VnlOptimizer->get_num_evaluations() + << " iterations."; + } + else + { + this->m_StopConditionDescription << "Maximum number of iterations exceeded." + << " Number of iterations is " + << this->m_NumberOfIterations; + } + this->InvokeEvent( EndEvent() ); +} + + +void +AmoebaOptimizerv4 +::ValidateSettings() +{ + //if we got here it is safe to get the number of parameters the cost + //function expects + ParametersType parameters = this->m_Metric->GetParameters(); + unsigned int n = parameters.GetSize(); + + //the user gave us data to use for the initial simplex, check that it + //matches the number of parameters (simplex dimension is n+1 - the initial + //position and n vertices defined by adding m_InitialSimplexDelta[i] to + //the initial position + if( !m_AutomaticInitialSimplex ) + { + if( m_InitialSimplexDelta.size() != n ) + { + itkExceptionMacro(<<"cost function and simplex delta dimensions mismatch") + } + } + + //check that the number of scale factors matches + if ( this->GetScalesInitialized() ) + { + if( this->GetScales().Size() != n ) + { + itkExceptionMacro(<<"cost function and scaling information dimensions mismatch") + } + } + + //parameters' convergence tolerance has to be positive + if ( this->m_ParametersConvergenceTolerance < 0 ) + { + itkExceptionMacro(<<"negative parameters convergence tolerance") + } + //function convergence tolerance has to be positive + if ( this->m_FunctionConvergenceTolerance < 0 ) + { + itkExceptionMacro(<<"negative function convergence tolerance") + } +} + +} // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSBOptimizerv4.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSBOptimizerv4.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSBOptimizerv4.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSBOptimizerv4.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,296 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkLBFGSBOptimizerv4.h" + +namespace itk +{ +/** \class LBFGSBOptimizerHelperv4 + * \brief Wrapper helper around vnl_lbfgsb. + * + * This class is used to translate iteration events, etc, from + * vnl_lbfgsb into iteration events in ITK. + */ +class LBFGSBOptimizerHelperv4: +public LBFGSOptimizerBaseHelperv4 +{ + public: + typedef LBFGSBOptimizerHelperv4 Self; + typedef LBFGSOptimizerBaseHelperv4 Superclass; + + /** Create with a reference to the ITK object */ + LBFGSBOptimizerHelperv4(vnl_cost_function & f, + LBFGSBOptimizerv4 * const itkObj); + + protected: + /** Handle new iteration event */ + virtual bool report_iter(); +}; + +/** Create with a reference to the ITK object */ +LBFGSBOptimizerHelperv4 +::LBFGSBOptimizerHelperv4(vnl_cost_function & f, LBFGSBOptimizerv4 * const itkObj): + Superclass::LBFGSOptimizerBaseHelperv4(f, itkObj) +{ +} + +/** Handle new iteration event */ +bool +LBFGSBOptimizerHelperv4 +::report_iter() +{ + Superclass::report_iter(); + + m_ItkObj->m_InfinityNormOfProjectedGradient = this->get_inf_norm_projected_gradient(); + m_ItkObj->InvokeEvent( IterationEvent() ); + m_ItkObj->m_CurrentIteration = this->num_iterations_; + + // Return true to terminate the optimization loop. + if ( this->num_iterations_ > m_ItkObj->m_MaximumNumberOfIterations ) + { + return true; + } + else + { + return false; + } +} +//------------------------------------------------------------------------- + +LBFGSBOptimizerv4 + ::LBFGSBOptimizerv4(): + m_MaximumNumberOfCorrections(5), + m_InitialPosition(0), + m_LowerBound(0), + m_UpperBound(0), + m_BoundSelection(0) +{ +} + +LBFGSBOptimizerv4 +::~LBFGSBOptimizerv4() +{ +} + +void +LBFGSBOptimizerv4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + + os << indent << "InitialPosition: " << m_InitialPosition << std::endl; + os << indent << "CurrentPosition: " << this->GetCurrentPosition() << std::endl; + + os << indent << "LowerBound: " << m_LowerBound << std::endl; + os << indent << "UpperBound: " << m_UpperBound << std::endl; + os << indent << "BoundSelection: " << m_BoundSelection << std::endl; + + os << indent << "CostFunctionConvergenceFactor: " + << m_CostFunctionConvergenceFactor << std::endl; + + os << indent << "MaximumNumberOfEvaluations: " + << m_MaximumNumberOfFunctionEvaluations << std::endl; + + os << indent << "MaximumNumberOfCorrections: " + << m_MaximumNumberOfCorrections << std::endl; + + os << indent << "Value: " + << this->GetValue() << std::endl; + + os << indent << "InfinityNormOfProjectedGradient: " + << this->m_InfinityNormOfProjectedGradient << std::endl; + + if ( this->m_VnlOptimizer ) + { + os << indent << "Vnl LBFGSB Failure Code: " + << this->m_VnlOptimizer->get_failure_code() << std::endl; + } +} + +void +LBFGSBOptimizerv4 +::SetScales(const ScalesType &) +{ + std::cout << "WARNING: LBFGSB optimizer does not support scaling. All scales are set to one." << std::endl; + m_Scales.SetSize( this->m_Metric->GetNumberOfLocalParameters() ); + m_Scales.Fill( NumericTraits::OneValue() ); + this->m_ScalesAreIdentity = true; +} + +void +LBFGSBOptimizerv4 +::SetInitialPosition(const ParametersType & param) +{ + m_InitialPosition = param; + this->Modified(); +} + +void +LBFGSBOptimizerv4 +::SetLowerBound( + const BoundValueType & value) +{ + this->m_LowerBound = value; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_lower_bound(m_LowerBound); + } + this->Modified(); +} + +void +LBFGSBOptimizerv4 +::SetUpperBound( + const BoundValueType & value) +{ + this->m_UpperBound = value; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_upper_bound(m_UpperBound); + } + this->Modified(); +} + +void +LBFGSBOptimizerv4 +::SetBoundSelection( + const BoundSelectionType & value) +{ + m_BoundSelection = value; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_bound_selection( m_BoundSelection ); + } + this->Modified(); +} + +void +LBFGSBOptimizerv4 +::SetCostFunctionConvergenceFactor(double value) +{ + if ( value < 0.0 ) + { + itkExceptionMacro("Value " << value + << " is too small for SetCostFunctionConvergenceFactor()" + << "a typical range would be from 0.0 to 1e+12"); + } + m_CostFunctionConvergenceFactor = value; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_cost_function_convergence_factor( m_CostFunctionConvergenceFactor ); + } + this->Modified(); +} + +void +LBFGSBOptimizerv4 +::SetMaximumNumberOfCorrections(unsigned int value) +{ + m_MaximumNumberOfCorrections = value; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_max_variable_metric_corrections( m_MaximumNumberOfCorrections ); + } + this->Modified(); +} + +void +LBFGSBOptimizerv4 +::SetMetric(MetricType *metric) +{ + Superclass::SetMetric( metric ); + + CostFunctionAdaptorType *adaptor = this->GetCostFunctionAdaptor(); + + m_VnlOptimizer.Reset(); + m_VnlOptimizer.TakeOwnership( new InternalOptimizerType( *adaptor, this ) ); + + // set the optimizer parameters + m_VnlOptimizer->set_trace( m_Trace ); + m_VnlOptimizer->set_lower_bound( m_LowerBound ); + m_VnlOptimizer->set_upper_bound( m_UpperBound ); + m_VnlOptimizer->set_bound_selection( m_BoundSelection ); + m_VnlOptimizer->set_cost_function_convergence_factor( m_CostFunctionConvergenceFactor ); + m_VnlOptimizer->set_projected_gradient_tolerance( m_GradientConvergenceTolerance ); + m_VnlOptimizer->set_max_function_evals( static_cast< int >( m_MaximumNumberOfFunctionEvaluations ) ); + m_VnlOptimizer->set_max_variable_metric_corrections( m_MaximumNumberOfCorrections ); + + m_OptimizerInitialized = true; + + this->Modified(); +} + +void +LBFGSBOptimizerv4 +::StartOptimization(bool /*doOnlyInitialization*/ ) +{ + // Perform some verification, check scales, + // pass settings to cost-function adaptor. + Superclass::StartOptimization(); + + // Check if all the bounds parameters are the same size as the initial + // parameters. + unsigned int numberOfParameters = m_Metric->GetNumberOfParameters(); + + if ( this->GetInitialPosition().Size() < numberOfParameters ) + { + std::cout << "Set the initial position of the optimizer:" << std::endl; + this->SetInitialPosition( m_Metric->GetParameters() ); + } + + if ( m_LowerBound.size() < numberOfParameters && !m_BoundSelection.is_zero() ) + { + itkExceptionMacro(<< "LowerBound array does not have sufficient number of elements"); + } + + if ( m_UpperBound.size() < numberOfParameters && !m_BoundSelection.is_zero() ) + { + itkExceptionMacro(<< "UppperBound array does not have sufficient number of elements"); + } + + if ( m_BoundSelection.size() < numberOfParameters ) + { + itkExceptionMacro(<< "BoundSelection array does not have sufficient number of elements"); + } + + if(this->m_CostFunctionConvergenceFactor == 0.0 && this->m_GradientConvergenceTolerance == 0.0) + { + itkExceptionMacro("LBFGSB Optimizer cannot function if both CostFunctionConvergenceFactor" + " and ProjectedGradienctTolerance are zero."); + } + + ParametersType parameters( this->GetInitialPosition() ); + + this->InvokeEvent( StartEvent() ); + + // vnl optimizers return the solution by reference + // in the variable provided as initial position + m_VnlOptimizer->minimize(parameters); + + if ( parameters.GetSize() != this->GetInitialPosition().Size() ) + { + // set current position to initial position and throw an exception + this->m_Metric->SetParameters( this->GetInitialPosition() ); + itkExceptionMacro(<< "Error occurred in optimization"); + } + + this->m_Metric->SetParameters( parameters ); + + this->InvokeEvent( EndEvent() ); +} + +} // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSOptimizerv4.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSOptimizerv4.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSOptimizerv4.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkLBFGSOptimizerv4.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,207 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkLBFGSOptimizerv4.h" + +namespace itk +{ +LBFGSOptimizerv4 + ::LBFGSOptimizerv4(): + m_Verbose(false), + m_LineSearchAccuracy(0.9), + m_DefaultStepLength(1.0) +{ +} + +LBFGSOptimizerv4 +::~LBFGSOptimizerv4() +{ +} + +void +LBFGSOptimizerv4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "LineSearchAccuracy: " + << m_LineSearchAccuracy << std::endl; + os << indent << "DefaultStepLength: " + << m_DefaultStepLength << std::endl; + + if ( this->m_VnlOptimizer ) + { + os << indent << "Vnl LBFGS Failure Code: " + << this->m_VnlOptimizer->get_failure_code() << std::endl; + } +} + +void +LBFGSOptimizerv4 +::VerboseOn() +{ + if ( m_Verbose == true ) + { + return; + } + + m_Verbose = true; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_verbose(true); + } + + this->Modified(); +} + +void +LBFGSOptimizerv4 +::VerboseOff() +{ + if ( m_Verbose == false ) + { + return; + } + + m_Verbose = false; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->set_verbose(false); + } + + this->Modified(); +} + +void +LBFGSOptimizerv4 +::SetLineSearchAccuracy(double f) +{ + if ( f == m_LineSearchAccuracy ) + { + return; + } + + m_LineSearchAccuracy = f; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->line_search_accuracy = m_LineSearchAccuracy; + } + + this->Modified(); +} + +void +LBFGSOptimizerv4 +::SetDefaultStepLength(double f) +{ + if ( f == m_DefaultStepLength ) + { + return; + } + + m_DefaultStepLength = f; + if ( m_OptimizerInitialized ) + { + m_VnlOptimizer->default_step_length = m_DefaultStepLength; + } + + this->Modified(); +} + +void +LBFGSOptimizerv4 +::SetMetric(MetricType *metric) +{ + Superclass::SetMetric( metric ); + + // set the optimizer parameters + m_VnlOptimizer->set_trace( m_Trace ); + m_VnlOptimizer->set_verbose( m_Verbose ); + m_VnlOptimizer->set_max_function_evals( static_cast< int >( m_MaximumNumberOfFunctionEvaluations ) ); + m_VnlOptimizer->set_g_tolerance( m_GradientConvergenceTolerance ); + m_VnlOptimizer->line_search_accuracy = m_LineSearchAccuracy; + m_VnlOptimizer->default_step_length = m_DefaultStepLength; + // set for debugging + //m_VnlOptimizer->set_check_derivatives( true ); + + m_OptimizerInitialized = true; + + this->Modified(); +} + +void +LBFGSOptimizerv4 +::StartOptimization(bool /* doOnlyInitialization */) +{ + // Perform some verification, check scales, + // pass settings to cost-function adaptor. + Superclass::StartOptimization(); + + // Note that it's tempting to use a reference to the parameters stored + // in the metric for efficiency. + ParametersType parameters = this->m_Metric->GetParameters(); + + if( parameters.GetSize() == 0 ) + { + itkExceptionMacro(<<"Optimizer parameters are not initialized."); + } + + // Scale the initial parameters up if scales are defined. + // This compensates for later scaling them down in "compute" function of + // the cost function adaptor and at the end of this function. + InternalParametersType vnlCompatibleParameters(parameters.GetSize()); + const ScalesType & scales = this->GetScales(); + for ( SizeValueType i = 0; i < parameters.GetSize(); ++i ) + { + if( this->GetScalesAreIdentity() ) + { + vnlCompatibleParameters[i] = parameters[i]; + } + else + { + vnlCompatibleParameters[i] = parameters[i] * scales[i]; + } + } + + // vnl optimizers return the solution by reference + // in the variable provided as initial position. + // Also note that v4 registration always minimizes because v4 metrics return the negate value + // if the cost function should be maximized. + m_VnlOptimizer->minimize( vnlCompatibleParameters ); + + // Check if the output parameters are not null. + if ( vnlCompatibleParameters.size() != parameters.GetSize() ) + { + itkExceptionMacro(<< "Error occurred in optimization. Optimized parameters and initial parameters are not the same size: " + << vnlCompatibleParameters.size() << " vs. " << parameters.GetSize() ); + } + + // we scale the parameters down if scales are defined + for ( SizeValueType i = 0; i < vnlCompatibleParameters.size(); ++i ) + { + if( this->GetScalesAreIdentity() ) + { + parameters[i] = vnlCompatibleParameters[i]; + } + else + { + parameters[i] = vnlCompatibleParameters[i] / scales[i]; + } + } + + this->m_Metric->SetParameters( parameters ); +} +} // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedNonLinearVnlOptimizerv4.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,130 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkSingleValuedNonLinearVnlOptimizerv4.h" + +namespace itk +{ +SingleValuedNonLinearVnlOptimizerv4 +::SingleValuedNonLinearVnlOptimizerv4() +{ + this->m_CostFunctionAdaptor = ITK_NULLPTR; + this->m_Command = CommandType::New(); + this->m_Command->SetCallbackFunction(this, &SingleValuedNonLinearVnlOptimizerv4::IterationReport); + + this->m_CachedCurrentPosition.Fill( NumericTraits::Zero ); + this->m_CachedDerivative.Fill( NumericTraits::Zero ); +} + +SingleValuedNonLinearVnlOptimizerv4 +::~SingleValuedNonLinearVnlOptimizerv4() +{ + if ( this->m_CostFunctionAdaptor ) + { + delete this->m_CostFunctionAdaptor; + this->m_CostFunctionAdaptor = ITK_NULLPTR; + } +} + +void +SingleValuedNonLinearVnlOptimizerv4 +::StartOptimization(bool /* doOnlyInitialization */ ) +{ + // Perform some verification, check scales. + Superclass::StartOptimization(); + + // Verify adaptor + if( this->m_CostFunctionAdaptor == ITK_NULLPTR ) + { + itkExceptionMacro("CostFunctionAdaptor has not been set."); + } + + // If the user provides the scales and they're not identity, then we set. + // Otherwise we don't set them for computation speed. + // These are managed at the optimizer level, but + // applied at the cost-function adaptor level because that's + // where the per-iteration results of the vnl optimizer are accessible. + if ( ! this->GetScalesAreIdentity() ) + { + ScalesType scales = this->GetScales(); + this->GetNonConstCostFunctionAdaptor()->SetScales(scales); + } +} + +void +SingleValuedNonLinearVnlOptimizerv4 +::SetCostFunctionAdaptor(CostFunctionAdaptorType *adaptor) +{ + if ( this->m_CostFunctionAdaptor == adaptor ) + { + return; + } + + if ( this->m_CostFunctionAdaptor ) + { + delete this->m_CostFunctionAdaptor; + } + + this->m_CostFunctionAdaptor = adaptor; + + this->m_CostFunctionAdaptor->AddObserver(IterationEvent(), this->m_Command); +} + +const SingleValuedNonLinearVnlOptimizerv4::CostFunctionAdaptorType * +SingleValuedNonLinearVnlOptimizerv4 +::GetCostFunctionAdaptor(void) const +{ + return this->m_CostFunctionAdaptor; +} + +SingleValuedNonLinearVnlOptimizerv4::CostFunctionAdaptorType * +SingleValuedNonLinearVnlOptimizerv4 +::GetCostFunctionAdaptor(void) +{ + return this->m_CostFunctionAdaptor; +} + +SingleValuedNonLinearVnlOptimizerv4::CostFunctionAdaptorType * +SingleValuedNonLinearVnlOptimizerv4 +::GetNonConstCostFunctionAdaptor(void) const +{ + return this->m_CostFunctionAdaptor; +} + +void +SingleValuedNonLinearVnlOptimizerv4 +::IterationReport(const EventObject & event) +{ + const CostFunctionAdaptorType *adaptor = this->GetCostFunctionAdaptor(); + + this->m_CurrentMetricValue = adaptor->GetCachedValue(); + this->m_CachedDerivative = adaptor->GetCachedDerivative(); + this->m_CachedCurrentPosition = adaptor->GetCachedCurrentParameters(); + this->InvokeEvent(event); +} + +void +SingleValuedNonLinearVnlOptimizerv4 +::PrintSelf(std::ostream & os, Indent indent) const +{ + Superclass::PrintSelf(os, indent); + os << indent << "Cached Derivative: " << this->m_CachedDerivative << std::endl; + os << indent << "Cached current positiion: " << this->m_CachedCurrentPosition << std::endl; + os << "Command observer " << this->m_Command.GetPointer() << std::endl; + os << "Cost Function adaptor" << this->m_CostFunctionAdaptor << std::endl; +} +} // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/src/itkSingleValuedVnlCostFunctionAdaptorv4.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,194 @@ +/*========================================================================= + * + * Copyright Insight Software Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0.txt + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + *=========================================================================*/ +#include "itkSingleValuedVnlCostFunctionAdaptorv4.h" + +namespace itk +{ +SingleValuedVnlCostFunctionAdaptorv4 +::SingleValuedVnlCostFunctionAdaptorv4(unsigned int spaceDimension): + vnl_cost_function(spaceDimension) +{ + m_ScalesInitialized = false; + m_Reporter = Object::New(); + m_CachedValue = NumericTraits< MeasureType >::Zero; + m_CachedDerivative.Fill(0); +} + +void +SingleValuedVnlCostFunctionAdaptorv4 +::SetScales(const ScalesType & scales) +{ + m_Scales = scales; + m_ScalesInitialized = true; +} + +SingleValuedVnlCostFunctionAdaptorv4::InternalMeasureType +SingleValuedVnlCostFunctionAdaptorv4 +::f(const InternalParametersType & inparameters) +{ + if ( !m_ObjectMetric ) + { + itkGenericExceptionMacro( + << "Attempt to use a SingleValuedVnlCostFunctionAdaptorv4 without any Metric plugge d in"); + } + + // Use scales if they are provided + ParametersType parameters( inparameters.size() ); + if ( m_ScalesInitialized ) + { + for ( SizeValueType i = 0; i < parameters.GetSize(); ++i ) + { + parameters[i] = inparameters[i] / m_Scales[i]; + } + } + else + { + parameters.SetData( const_cast< double * >( inparameters.data_block() ) ); + } + + this->m_ObjectMetric->SetParameters( parameters ); + InternalMeasureType value = static_cast< InternalMeasureType >( m_ObjectMetric->GetValue() ); + + // Notify observers. This is used for overcoming the limitaion of VNL + // optimizers of not providing callbacks per iteration. + m_CachedValue = value; + this->ReportIteration( FunctionEvaluationIterationEvent() ); + + return value; +} + +void +SingleValuedVnlCostFunctionAdaptorv4 +::gradf(const InternalParametersType & inparameters, InternalDerivativeType & gradient) +{ + if ( !m_ObjectMetric ) + { + itkGenericExceptionMacro("Attempt to use a SingleValuedVnlCostFunctionAdaptorv4 without any Metric plugged in"); + } + + // Use scales if they are provided + ParametersType parameters( inparameters.size() ); + if ( m_ScalesInitialized ) + { + for ( SizeValueType i = 0; i < parameters.GetSize(); ++i ) + { + parameters[i] = inparameters[i] / m_Scales[i]; + } + } + else + { + parameters.SetData( const_cast< double * >( inparameters.data_block() ) ); + } + + // Delegate computation of the gradient to the ObjectMetric + this->m_ObjectMetric->SetParameters( parameters ); + this->m_ObjectMetric->GetDerivative( m_CachedDerivative ); + // This will also scale gradient by user scales + this->ConvertExternalToInternalGradient( m_CachedDerivative, gradient ); + + // Notify observers. This is used for overcoming the limitaion of VNL + // optimizers of not providing callbacks per iteration. + // Note that m_CachedDerivative is already loaded in the GetDerivative() + // above. + this->ReportIteration( GradientEvaluationIterationEvent() ); +} + +void +SingleValuedVnlCostFunctionAdaptorv4 +::compute(const InternalParametersType & x, InternalMeasureType *fun, InternalDerivativeType *g) +{ + // delegate the computation to the ObjectMetric + ParametersType parameters( x.size() ); + double measure; + + if ( m_ScalesInitialized ) + { + for ( SizeValueType i = 0; i < parameters.GetSize(); ++i ) + { + parameters[i] = x[i] / m_Scales[i]; + } + } + else + { + parameters.SetData( const_cast< double * >( x.data_block() ) ); + } + + this->m_ObjectMetric->SetParameters( parameters ); + this->m_ObjectMetric->GetValueAndDerivative( measure, m_CachedDerivative ); + if ( g ) // sometimes Vnl doesn't pass a valid pointer + { + this->ConvertExternalToInternalGradient(m_CachedDerivative, *g); + } + if ( fun ) // paranoids have longer lives... + { + *fun = static_cast< InternalMeasureType >( measure ); + // Notify observers. This is used for overcoming the limitaion of VNL + // optimizers of not providing callbacks per iteration. + // Note that m_CachedDerivative is already loaded in the GetDerivative() + // above. + m_CachedValue = *fun; + } + this->ReportIteration( FunctionAndGradientEvaluationIterationEvent() ); +} + +void +SingleValuedVnlCostFunctionAdaptorv4 +::ConvertExternalToInternalGradient(const DerivativeType & input, InternalDerivativeType & output) const +{ + // Convert external derviative measures into internal type + const unsigned int size = input.GetSize(); + + output = InternalDerivativeType(size); + for ( SizeValueType i = 0; i < size; ++i ) + { + output[i] = -input[i]; // because v4 metrics return the negate of gradient + + if ( m_ScalesInitialized ) + { + output[i] /= m_Scales[i]; + } + } +} + +void +SingleValuedVnlCostFunctionAdaptorv4 +::ReportIteration(const EventObject & event) const +{ + // This method reports iterations events. It is intended to + // help monitoring the progress of the optimization process. + this->m_Reporter->InvokeEvent(event); +} + +unsigned long +SingleValuedVnlCostFunctionAdaptorv4 +::AddObserver(const EventObject & event, Command *command) const +{ + // Connects a Command/Observer to the internal reporter class. + // This is useful for reporting iteration event to potential observers. + return m_Reporter->AddObserver(event, command); +} + +const SingleValuedVnlCostFunctionAdaptorv4::ParametersType & +SingleValuedVnlCostFunctionAdaptorv4 +::GetCachedCurrentParameters() const +{ + // Return the cached value of the parameters used for computing the function. + return this->m_ObjectMetric->GetParameters(); +} + +} // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerBasev4.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,7 @@ +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) +itk_wrap_include("itkGradientDescentOptimizerBasev4.h") +itk_wrap_class("itk::GradientDescentOptimizerBasev4Template" POINTER) + foreach(t ${WRAP_ITK_REAL}) + itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") + endforeach(t) +itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkGradientDescentOptimizerv4.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,7 @@ -itk_wrap_simple_class("itk::ObjectToObjectOptimizerBase" POINTER) -itk_wrap_simple_class("itk::GradientDescentOptimizerBasev4" POINTER) -itk_wrap_simple_class("itk::GradientDescentOptimizerv4" POINTER) +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) +itk_wrap_include("itkGradientDescentOptimizerv4.h") +itk_wrap_class("itk::GradientDescentOptimizerv4Template" POINTER) + foreach(t ${WRAP_ITK_REAL}) + itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") + endforeach(t) +itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkObjectToObjectOptimizerBase.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,7 @@ +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) +itk_wrap_include("itkObjectToObjectOptimizerBase.h") +itk_wrap_class("itk::ObjectToObjectOptimizerBaseTemplate" POINTER) + foreach(t ${WRAP_ITK_REAL}) + itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") + endforeach(t) +itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkOptimizerParameterScalesEstimator.wrap otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkOptimizerParameterScalesEstimator.wrap --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkOptimizerParameterScalesEstimator.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkOptimizerParameterScalesEstimator.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1 +1,7 @@ -itk_wrap_simple_class("itk::OptimizerParameterScalesEstimator" POINTER) +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) +itk_wrap_include("itkOptimizerParameterScalesEstimator.h") +itk_wrap_class("itk::OptimizerParameterScalesEstimatorTemplate" POINTER) + foreach(t ${WRAP_ITK_REAL}) + itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") + endforeach(t) +itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Optimizersv4/wrapping/itkQuasiNewtonOptimizerv4.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1 +1,7 @@ -itk_wrap_simple_class("itk::QuasiNewtonOptimizerv4" POINTER) +set(WRAPPER_AUTO_INCLUDE_HEADERS OFF) +itk_wrap_include("itkQuasiNewtonOptimizerv4.h") +itk_wrap_class("itk::QuasiNewtonOptimizerv4Template" POINTER) + foreach(t ${WRAP_ITK_REAL}) + itk_wrap_template("${ITKM_${t}}" "${ITKT_${t}}") + endforeach(t) +itk_end_wrap_class() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Polynomials/include/itkMultivariateLegendrePolynomial.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Polynomials/include/itkMultivariateLegendrePolynomial.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Polynomials/include/itkMultivariateLegendrePolynomial.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Polynomials/include/itkMultivariateLegendrePolynomial.h 2014-09-03 08:29:34.000000000 +0000 @@ -213,11 +213,12 @@ class SimpleForwardIterator { public: - SimpleForwardIterator (MultivariateLegendrePolynomial *polynomial) + SimpleForwardIterator (MultivariateLegendrePolynomial *polynomial) : + m_MultivariateLegendrePolynomial(polynomial), + m_Dimension (m_MultivariateLegendrePolynomial->GetDimension()), + m_DomainSize (m_MultivariateLegendrePolynomial->GetDomainSize()), + m_IsAtEnd(false) { - m_MultivariateLegendrePolynomial = polynomial; - m_Dimension = m_MultivariateLegendrePolynomial->GetDimension(); - m_DomainSize = m_MultivariateLegendrePolynomial->GetDomainSize(); m_Index.resize(m_Dimension); std::fill(m_Index.begin(), m_Index.end(), 0); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkChiSquareDistribution.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkChiSquareDistribution.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkChiSquareDistribution.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkChiSquareDistribution.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,16 +72,16 @@ /** Return the number of parameters. For a Chi-Square * distribution, the number of parameters is 1 (degrees of freedom) */ - virtual SizeValueType GetNumberOfParameters() const { return 1; } + virtual SizeValueType GetNumberOfParameters() const ITK_OVERRIDE { return 1; } /** Evaluate the probability density function (pdf). The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluatePDF(double x) const; + virtual double EvaluatePDF(double x) const ITK_OVERRIDE; /** Evaluate the probability density function (pdf). The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (degrees of freedom). */ - virtual double EvaluatePDF(double x, const ParametersType &) const; + virtual double EvaluatePDF(double x, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the probability density function (pdf). The parameters * of the distribution are passed as separate parameters. */ @@ -89,12 +89,12 @@ /** Evaluate the cumulative distribution function (cdf). The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluateCDF(double x) const; + virtual double EvaluateCDF(double x) const ITK_OVERRIDE; /** Evaluate the cumulative distribution function (cdf). The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (degreesOfFreedom). */ - virtual double EvaluateCDF(double x, const ParametersType &) const; + virtual double EvaluateCDF(double x, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the cumulative distribution function (cdf). The parameters * of the distribution are passed as separate parameters. */ @@ -103,13 +103,13 @@ /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluateInverseCDF(double p) const; + virtual double EvaluateInverseCDF(double p) const ITK_OVERRIDE; /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (degrees of freedom). */ - virtual double EvaluateInverseCDF(double p, const ParametersType &) const; + virtual double EvaluateInverseCDF(double p, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters @@ -125,16 +125,16 @@ virtual SizeValueType GetDegreesOfFreedom() const; /** Does the Chi-Square distribution have a mean? */ - virtual bool HasMean() const { return true; } + virtual bool HasMean() const ITK_OVERRIDE { return true; } /** Get the mean of the distribution. */ - virtual double GetMean() const; + virtual double GetMean() const ITK_OVERRIDE; /** Does the Chi-Square distribution have a variance? */ - virtual bool HasVariance() const { return true; } + virtual bool HasVariance() const ITK_OVERRIDE { return true; } /** Get the variance of the distribution. */ - virtual double GetVariance() const; + virtual double GetVariance() const ITK_OVERRIDE; /** Static method to evaluate the probability density function (pdf) * of a Chi-Square with a specified number of degrees of freedom. The @@ -198,7 +198,7 @@ ChiSquareDistribution(void); virtual ~ChiSquareDistribution(void) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: ChiSquareDistribution(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -64,63 +64,67 @@ itkTypeMacro(CovarianceSampleFilter, ProcessObject); itkNewMacro(Self); - /** Length of a measurement vector */ - typedef typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType; + /** Type of each measurement vector in sample */ + typedef typename SampleType::MeasurementVectorType MeasurementVectorType; - /** Measurement vector type */ - typedef typename TSample::MeasurementVectorType MeasurementVectorType; + /** Type of the length of each measurement vector */ + typedef typename SampleType::MeasurementVectorSizeType MeasurementVectorSizeType; - /** Type of vector elements */ - typedef typename TSample::MeasurementType MeasurementType; - typedef typename NumericTraits< MeasurementType >::RealType MeasurementRealType; + /** Type of measurement vector component value */ + typedef typename SampleType::MeasurementType MeasurementType; - /** Type of the measurement vector type */ + /** Type of a measurement vector, holding floating point values */ typedef typename NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType; - /** Typedef for Covariance output */ - typedef VariableSizeMatrix< double > MatrixType; + /** Type of a floating point measurement component value */ + typedef typename NumericTraits< MeasurementType >::RealType MeasurementRealType; + - /** Method to set/get the sample */ + /** Method to set the sample */ using Superclass::SetInput; void SetInput(const SampleType *sample); + /** Method to get the sample */ const SampleType * GetInput() const; - /** VariableSizeMatrix is not a DataObject, we need to decorate it to push it down - * a ProcessObject's pipeline */ - typedef SimpleDataObjectDecorator< MatrixType > MatrixDecoratedType; - - /** MeasurementVector is not a DataObject, we need to decorate it to push it down - * a ProcessObject's pipeline */ - typedef SimpleDataObjectDecorator< MeasurementVectorRealType > MeasurementVectorDecoratedType; - typedef MeasurementVectorDecoratedType OutputType; + /** Type of covariance matrix output */ + typedef VariableSizeMatrix< MeasurementRealType > MatrixType; /** Return the covariance matrix */ const MatrixType GetCovarianceMatrix() const; + /** VariableSizeMatrix is not a DataObject, we need to decorate it to push it down + * a ProcessObject's pipeline */ + typedef SimpleDataObjectDecorator< MatrixType > MatrixDecoratedType; const MatrixDecoratedType * GetCovarianceMatrixOutput() const; + /** Return the mean vector */ const MeasurementVectorRealType GetMean() const; + /** MeasurementVector is not a DataObject, we need to decorate it to push it down + * a ProcessObject's pipeline */ + typedef SimpleDataObjectDecorator< MeasurementVectorRealType > MeasurementVectorDecoratedType; const MeasurementVectorDecoratedType * GetMeanOutput() const; + typedef MeasurementVectorDecoratedType OutputType; + MeasurementVectorSizeType GetMeasurementVectorSize() const; protected: CovarianceSampleFilter(); virtual ~CovarianceSampleFilter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** DataObject pointer */ typedef DataObject::Pointer DataObjectPointer; typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: CovarianceSampleFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkCovarianceSampleFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,7 @@ { MatrixType covarianceMatrix(measurementVectorSize, measurementVectorSize); covarianceMatrix.SetIdentity(); - MatrixDecoratedType::Pointer decoratedCovarianceMatrix = MatrixDecoratedType::New(); + typename MatrixDecoratedType::Pointer decoratedCovarianceMatrix = MatrixDecoratedType::New(); decoratedCovarianceMatrix->Set(covarianceMatrix); return decoratedCovarianceMatrix.GetPointer(); } @@ -86,7 +86,7 @@ MeasurementVectorRealType mean; (void)mean; // for complainty pants : valgrind NumericTraits::SetLength(mean, this->GetMeasurementVectorSize()); - mean.Fill( NumericTraits< MeasurementRealType >::Zero ); + // NumericTraits::SetLength also initializes array to zero typename MeasurementVectorDecoratedType::Pointer decoratedMean = MeasurementVectorDecoratedType::New(); decoratedMean->Set( mean ); return decoratedMean.GetPointer(); @@ -125,6 +125,7 @@ CovarianceSampleFilter< TSample > ::GenerateData() { + // set up input / output const SampleType *input = this->GetInput(); MeasurementVectorSizeType measurementVectorSize = input->GetMeasurementVectorSize(); @@ -133,47 +134,46 @@ itkDynamicCastInDebugMode< MatrixDecoratedType * >( this->ProcessObject::GetOutput(0) ); MatrixType output = decoratedOutput->Get(); + output.SetSize( measurementVectorSize, measurementVectorSize ); + output.Fill( NumericTraits< typename MatrixType::ValueType >::Zero ); MeasurementVectorDecoratedType *decoratedMeanOutput = - itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >(this->ProcessObject::GetOutput(1)); + itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >( this->ProcessObject::GetOutput(1) ); - output.SetSize(measurementVectorSize, measurementVectorSize); - output.Fill(0.0); - - double totalFrequency = 0.0; - - typename TSample::ConstIterator iter = input->Begin(); - typename TSample::ConstIterator end = input->End(); - - MeasurementVectorRealType diff; - MeasurementVectorType measurements; - - NumericTraits::SetLength(diff, measurementVectorSize); - NumericTraits::SetLength(measurements, measurementVectorSize); - - typedef MeanSampleFilter< TSample > MeanFilterType; + // calculate mean + typedef MeanSampleFilter< SampleType > MeanFilterType; typename MeanFilterType::Pointer meanFilter = MeanFilterType::New(); meanFilter->SetInput( input ); meanFilter->Update(); - const typename MeanFilterType::MeasurementVectorDecoratedType * decorator = meanFilter->GetOutput(); - const typename MeanFilterType::MeasurementVectorRealType mean = decorator->Get(); - + const typename MeanFilterType::MeasurementVectorRealType mean = meanFilter->GetMean(); decoratedMeanOutput->Set( mean ); - iter = input->Begin(); + // covariance algorithm + MeasurementVectorRealType diff; + NumericTraits::SetLength( diff, measurementVectorSize ); + + typedef typename SampleType::TotalAbsoluteFrequencyType TotalFrequencyType; + TotalFrequencyType totalFrequency = NumericTraits< TotalFrequencyType >::Zero; + + typename SampleType::ConstIterator iter = input->Begin(); + const typename SampleType::ConstIterator end = input->End(); // fills the lower triangle and the diagonal cells in the covariance matrix - while ( iter != end ) + for (; iter != end; ++iter ) { - const double frequency = iter.GetFrequency(); + const MeasurementVectorType & measurement = iter.GetMeasurementVector(); + + const typename SampleType::AbsoluteFrequencyType frequency = iter.GetFrequency(); totalFrequency += frequency; - measurements = iter.GetMeasurementVector(); - for ( unsigned int i = 0; i < measurementVectorSize; ++i ) + for ( unsigned int dim = 0; dim < measurementVectorSize; ++dim ) { - diff[i] = static_cast< MeasurementRealType >( measurements[i] ) - mean[i]; + const MeasurementRealType component = + static_cast< MeasurementRealType >( measurement[dim] ); + + diff[dim] = ( component - mean[dim] ); } // updates the covariance matrix @@ -181,10 +181,10 @@ { for ( unsigned int col = 0; col < row + 1; ++col ) { - output(row, col) += frequency * diff[row] * diff[col]; + output(row, col) += + ( static_cast< MeasurementRealType >( frequency ) * diff[row] * diff[col] ); } } - ++iter; } // fills the upper triangle using the lower triangle @@ -196,23 +196,21 @@ } } - if( totalFrequency - 1.0 > vnl_math::eps ) + const double normalizationFactor = + ( static_cast< MeasurementRealType >( totalFrequency ) - 1.0 ); + + if( normalizationFactor > vnl_math::eps ) { - const double factor = 1.0 / ( totalFrequency - 1.0 ); + const double inverseNormalizationFactor = 1.0 / normalizationFactor; - for ( unsigned int col = 0; col < measurementVectorSize; ++col ) - { - for ( unsigned int row = 0; row < measurementVectorSize; ++row ) - { - output(col, row) *= factor; - } - } - decoratedOutput->Set(output); + output *= inverseNormalizationFactor; } else { itkExceptionMacro("Total Frequency was too close to 1.0. Value = " << totalFrequency ); } + + decoratedOutput->Set( output ); } template< typename TSample > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkDenseFrequencyContainer2.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkDenseFrequencyContainer2.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkDenseFrequencyContainer2.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkDenseFrequencyContainer2.h 2014-09-03 08:29:34.000000000 +0000 @@ -106,7 +106,7 @@ protected: DenseFrequencyContainer2(); virtual ~DenseFrequencyContainer2() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: DenseFrequencyContainer2(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkEuclideanDistanceMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkEuclideanDistanceMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkEuclideanDistanceMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkEuclideanDistanceMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -47,7 +47,7 @@ sumOfSquares += temp * temp; } - const double distance = vcl_sqrt(sumOfSquares); + const double distance = std::sqrt(sumOfSquares); return distance; } @@ -74,7 +74,7 @@ sumOfSquares += temp * temp; } - const double distance = vcl_sqrt(sumOfSquares); + const double distance = std::sqrt(sumOfSquares); return distance; } @@ -86,7 +86,7 @@ { const double temp = a - b; - return vcl_abs(temp); + return std::abs(temp); } } // end of namespace Statistics } // end of namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.h 2014-09-03 08:29:34.000000000 +0000 @@ -170,7 +170,7 @@ protected: ExpectationMaximizationMixtureModelEstimator(); virtual ~ExpectationMaximizationMixtureModelEstimator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; bool CalculateDensities(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkExpectationMaximizationMixtureModelEstimator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,15 +27,14 @@ { template< typename TSample > ExpectationMaximizationMixtureModelEstimator< TSample > -::ExpectationMaximizationMixtureModelEstimator() +::ExpectationMaximizationMixtureModelEstimator() : + m_Sample(ITK_NULLPTR), + m_MaxIteration(100), + m_CurrentIteration(0), + m_TerminationCode(NOT_CONVERGED), + m_MembershipFunctionsObject (MembershipFunctionVectorObjectType::New()), + m_MembershipFunctionsWeightArrayObject(MembershipFunctionsWeightsArrayObjectType::New()) { - m_TerminationCode = NOT_CONVERGED; - - m_MembershipFunctionsObject = MembershipFunctionVectorObjectType::New(); - m_MembershipFunctionsWeightArrayObject = - MembershipFunctionsWeightsArrayObjectType::New(); - m_Sample = 0; - m_MaxIteration = 100; } template< typename TSample > @@ -264,7 +263,7 @@ // the log may blow up if( temp > NumericTraits::epsilon() ) { - logProportion = vcl_log( temp ); + logProportion = std::log( temp ); } else { @@ -277,7 +276,7 @@ GetWeight(measurementVectorIndex); if( temp > NumericTraits::epsilon() ) { - sum += temp * ( logProportion + vcl_log( temp ) ); + sum += temp * ( logProportion + std::log( temp ) ); } else { @@ -306,7 +305,7 @@ component->Update(); if ( component->AreParametersModified() ) { - return true; + updated = true; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianDistribution.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianDistribution.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianDistribution.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianDistribution.h 2014-09-03 08:29:34.000000000 +0000 @@ -75,16 +75,16 @@ /** Return the number of parameters. For a univariate Gaussian, * this is 2 (mean, variance). */ - virtual SizeValueType GetNumberOfParameters() const { return 2; } + virtual SizeValueType GetNumberOfParameters() const ITK_OVERRIDE { return 2; } /** Evaluate the probability density function (pdf). The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluatePDF(double x) const; + virtual double EvaluatePDF(double x) const ITK_OVERRIDE; /** Evaluate the probability density function (pdf). The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (mean, variance). */ - virtual double EvaluatePDF(double x, const ParametersType &) const; + virtual double EvaluatePDF(double x, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the probability density function (pdf). The parameters * of the distribution are passed as separate parameters. */ @@ -92,12 +92,12 @@ /** Evaluate the cumulative distribution function (cdf). The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluateCDF(double x) const; + virtual double EvaluateCDF(double x) const ITK_OVERRIDE; /** Evaluate the cumulative distribution function (cdf). The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (mean, variance). */ - virtual double EvaluateCDF(double x, const ParametersType &) const; + virtual double EvaluateCDF(double x, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the cumulative distribution function (cdf). The parameters * of the distribution are passed as separate parameters. */ @@ -106,13 +106,13 @@ /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluateInverseCDF(double p) const; + virtual double EvaluateInverseCDF(double p) const ITK_OVERRIDE; /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (mean, variance). */ - virtual double EvaluateInverseCDF(double p, const ParametersType &) const; + virtual double EvaluateInverseCDF(double p, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters @@ -127,10 +127,10 @@ /** Get the mean of the Gaussian distribution. Defaults to 0.0. The * mean is stored in position 0 of the parameters vector. */ - virtual double GetMean() const; + virtual double GetMean() const ITK_OVERRIDE; /** Does this distribution have a mean? */ - virtual bool HasMean() const { return true; } + virtual bool HasMean() const ITK_OVERRIDE { return true; } /** Set the variance of the Gaussian distribution. Defaults * to 1.0. The variance is stored in position 1 of the parameters @@ -139,10 +139,10 @@ /** Get the variance of the Gaussian distribution. Defaults to * 1.0. The variance is stored in position 1 of the parameters vector. */ - virtual double GetVariance() const; + virtual double GetVariance() const ITK_OVERRIDE; /** Does this distribution have a variance? */ - virtual bool HasVariance() const { return true; } + virtual bool HasVariance() const ITK_OVERRIDE { return true; } /** Static method to evaluate the probability density function (pdf) * of a standardized (mean zero, unit variance) Gaussian. The static @@ -233,7 +233,7 @@ GaussianDistribution(void); virtual ~GaussianDistribution(void) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: GaussianDistribution(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMembershipFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ NumericTraits::SetLength(m_Mean, this->GetMeasurementVectorSize()); m_Mean.Fill( 0.0 ); - m_PreFactor = 1.0 / vcl_sqrt(2.0 * vnl_math::pi); // default univariate + m_PreFactor = 1.0 / std::sqrt(2.0 * vnl_math::pi); // default univariate m_Covariance.SetSize(this->GetMeasurementVectorSize(), this->GetMeasurementVectorSize()); m_Covariance.SetIdentity(); @@ -136,13 +136,13 @@ // calculate coefficient C of multivariate gaussian m_PreFactor = - 1.0 / ( vcl_sqrt(det) * - vcl_pow( vcl_sqrt(2.0 * vnl_math::pi), + 1.0 / ( std::sqrt(det) * + std::pow( std::sqrt(2.0 * vnl_math::pi), static_cast< double >( this->GetMeasurementVectorSize() ) ) ); } else { - const double aLargeDouble = vcl_pow(NumericTraits::max(), 1.0/3.0) + const double aLargeDouble = std::pow(NumericTraits::max(), 1.0/3.0) / (double) this->GetMeasurementVectorSize(); m_InverseCovariance.SetIdentity(); m_InverseCovariance *= aLargeDouble; @@ -173,7 +173,7 @@ double temp = dot_product( tempVector, m_InverseCovariance.GetVnlMatrix() * tempVector ); - temp = vcl_exp(-0.5 * temp); + temp = std::exp(-0.5 * temp); return m_PreFactor * temp; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMixtureModelComponent.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMixtureModelComponent.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMixtureModelComponent.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianMixtureModelComponent.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -177,7 +177,7 @@ } } - changes = vcl_sqrt(changes); + changes = std::sqrt(changes); return changes; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianRandomSpatialNeighborSubsampler.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianRandomSpatialNeighborSubsampler.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianRandomSpatialNeighborSubsampler.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkGaussianRandomSpatialNeighborSubsampler.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -69,7 +69,7 @@ { RealType randVar = this->m_RandomNumberGenerator->GetNormalVariate(mean, m_Variance); - randInt = static_cast(vcl_floor(randVar)); + randInt = static_cast(std::floor(randVar)); } while ((randInt < lowerBound) || (randInt > upperBound)); return randInt; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.h 2014-09-03 08:29:34.000000000 +0000 @@ -264,7 +264,11 @@ /** Increase the frequency of a measurement. Frequency is * increased by the specified value. Returns false if the - * measurement is outside the bounds of the histogram. */ + * measurement is outside the bounds of the histogram. + * + * \warning This function performs a dynamic allocation for the + * index length, and should not be used in tight per-pixel loops. + */ bool IncreaseFrequencyOfMeasurement( const MeasurementVectorType & measurement, AbsoluteFrequencyType value); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogram.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,11 +27,13 @@ { template< typename TMeasurement, typename TFrequencyContainer > Histogram< TMeasurement, TFrequencyContainer > -::Histogram() +::Histogram() : + m_Size(0), + m_OffsetTable(OffsetTableType(Superclass::GetMeasurementVectorSize() + 1)), + m_FrequencyContainer(FrequencyContainerType::New()), + m_NumberOfInstances(0), + m_ClipBinsAtEnds(true) { - this->m_ClipBinsAtEnds = true; - this->m_FrequencyContainer = FrequencyContainerType::New(); - this->m_OffsetTable = OffsetTableType(this->GetMeasurementVectorSize() + 1); for ( unsigned int i = 0; i < this->GetMeasurementVectorSize() + 1; i++ ) { this->m_OffsetTable[i] = itk::NumericTraits< InstanceIdentifier >::Zero; @@ -741,8 +743,7 @@ os << this->m_OffsetTable[i] << " "; } os << std::endl; - os << indent << "FrequencyContainerPointer: " << std::endl; - m_FrequencyContainer->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( FrequencyContainer ); } template< typename TMeasurement, typename TFrequencyContainer > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToEntropyImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToEntropyImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToEntropyImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToEntropyImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -73,13 +73,13 @@ { const double p = static_cast< OutputPixelType >( A ) / static_cast< OutputPixelType >( m_TotalFrequency ); - return static_cast< OutputPixelType >( ( -1 ) * p * vcl_log(p) / vcl_log(2.0) ); + return static_cast< OutputPixelType >( ( -1 ) * p * std::log(p) / std::log(2.0) ); } else { const double p = static_cast< OutputPixelType >( A + 1 ) / static_cast< OutputPixelType >( m_TotalFrequency ); - return static_cast< OutputPixelType >( ( -1 ) * p * vcl_log(p) / vcl_log(2.0) ); + return static_cast< OutputPixelType >( ( -1 ) * p * std::log(p) / std::log(2.0) ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToLogProbabilityImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToLogProbabilityImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToLogProbabilityImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToLogProbabilityImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -66,15 +66,15 @@ { if ( A ) { - return static_cast< OutputPixelType >( vcl_log( static_cast< OutputPixelType >( A ) + return static_cast< OutputPixelType >( std::log( static_cast< OutputPixelType >( A ) / static_cast< OutputPixelType >( m_TotalFrequency ) ) - / vcl_log(2.0) ); + / std::log(2.0) ); } else { // Check for Log 0. Always assume that the frequency is atleast 1. - return static_cast< OutputPixelType >( vcl_log( static_cast< OutputPixelType >( A + 1 ) + return static_cast< OutputPixelType >( std::log( static_cast< OutputPixelType >( A + 1 ) / static_cast< OutputPixelType >( m_TotalFrequency ) ) - / vcl_log(2.0) ); + / std::log(2.0) ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -161,14 +161,14 @@ protected: HistogramToRunLengthFeaturesFilter(); ~HistogramToRunLengthFeaturesFilter() {}; - void PrintSelf(std::ostream& os, Indent indent) const; + virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE; /** Make a DataObject to be used for output output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType ); + virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType ) ITK_OVERRIDE; - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: HistogramToRunLengthFeaturesFilter(const Self&); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToRunLengthFeaturesFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -57,7 +57,7 @@ { if ( this->GetNumberOfInputs() < 1 ) { - return 0; + return ITK_NULLPTR; } return itkDynamicCastInDebugMode(this->ProcessObject::GetInput( 0 ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -204,14 +204,14 @@ protected: HistogramToTextureFeaturesFilter(); ~HistogramToTextureFeaturesFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Make a DataObject to be used for output output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: HistogramToTextureFeaturesFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkHistogramToTextureFeaturesFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -114,7 +114,7 @@ MeasurementType haralickCorrelation = NumericTraits< MeasurementType >::Zero; double pixelVarianceSquared = pixelVariance * pixelVariance; - double log2 = vcl_log(2.0); + double log2 = std::log(2.0); typename RelativeFrequencyContainerType::const_iterator rFreqIterator = m_RelativeFrequencyContainer.begin(); @@ -132,15 +132,15 @@ IndexType index = inputHistogram->GetIndex( hit.GetInstanceIdentifier() ); energy += frequency * frequency; - entropy -= ( frequency > 0.0001 ) ? frequency *vcl_log(frequency) / log2:0; + entropy -= ( frequency > 0.0001 ) ? frequency *std::log(frequency) / log2:0; correlation += ( ( index[0] - pixelMean ) * ( index[1] - pixelMean ) * frequency ) / pixelVarianceSquared; inverseDifferenceMoment += frequency / ( 1.0 + ( index[0] - index[1] ) * ( index[0] - index[1] ) ); inertia += ( index[0] - index[1] ) * ( index[0] - index[1] ) * frequency; - clusterShade += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 3 ) + clusterShade += std::pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 3 ) * frequency; - clusterProminence += vcl_pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 4 ) + clusterProminence += std::pow( ( index[0] - pixelMean ) + ( index[1] - pixelMean ), 4 ) * frequency; haralickCorrelation += index[0] * index[1] * frequency; } @@ -229,7 +229,7 @@ M(1) = x(1), M(k) = M(k-1) + (x(k) - M(k-1) ) / k S(1) = 0, S(k) = S(k-1) + (x(k) - M(k-1)) * (x(k) - M(k)) for 2 <= k <= n, then - sigma = vcl_sqrt(S(n) / n) (or divide by n-1 for sample SD instead of + sigma = std::sqrt(S(n) / n) (or divide by n-1 for sample SD instead of population SD). */ marginalMean = marginalSums[0]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageClassifierFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageClassifierFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageClassifierFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageClassifierFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ this->SetNumberOfRequiredOutputs(1); /** Initialize decision rule */ - m_DecisionRule = NULL; + m_DecisionRule = ITK_NULLPTR; m_NumberOfClasses = 0; } @@ -143,7 +143,7 @@ } MembershipFunctionsWeightsArrayType membershipFunctionsWeightsArray; - if ( membershipFunctionsWeightsArrayDecorated == NULL ) + if ( membershipFunctionsWeightsArrayDecorated == ITK_NULLPTR ) { // no weights array is set and hence all membership functions will have // equal diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToHistogramFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToHistogramFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToHistogramFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToHistogramFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -235,16 +235,17 @@ { // group the results in the output histogram HistogramType * hist = m_Histograms[0]; + typename HistogramType::IndexType index; for( unsigned int i=1; iBegin(); HistogramIterator end = m_Histograms[i]->End(); while ( hit != end ) { - hist->IncreaseFrequencyOfMeasurement( hit.GetMeasurementVector(), hit.GetFrequency() ); + hist->GetIndex( hit.GetMeasurementVector(), index); + hist->IncreaseFrequencyOfIndex( index, hit.GetFrequency() ); ++hit; } } @@ -253,7 +254,7 @@ m_Histograms.clear(); m_Minimums.clear(); m_Maximums.clear(); - m_Barrier = NULL; + m_Barrier = ITK_NULLPTR; } @@ -298,11 +299,13 @@ inputIt.GoToBegin(); HistogramMeasurementVectorType m( nbOfComponents ); + typename HistogramType::IndexType index; while ( !inputIt.IsAtEnd() ) { const PixelType & p = inputIt.Get(); NumericTraits::AssignToArray( p, m ); - m_Histograms[threadId]->IncreaseFrequencyOfMeasurement( m, 1 ); + m_Histograms[threadId]->GetIndex( m, index ); + m_Histograms[threadId]->IncreaseFrequencyOfIndex( index, 1 ); ++inputIt; progress.CompletedPixel(); // potential exception thrown here } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -140,18 +140,17 @@ { friend class ImageToListSampleAdaptor; -public: + public: ConstIterator(const ImageToListSampleAdaptor *adaptor) { *this = adaptor->Begin(); } - ConstIterator(const ConstIterator & iter) - { - m_Iter = iter.m_Iter; - m_InstanceIdentifier = iter.m_InstanceIdentifier; - } + ConstIterator(const ConstIterator & iter) : + m_Iter(iter.m_Iter), + m_InstanceIdentifier(iter.m_InstanceIdentifier) + {} ConstIterator & operator=(const ConstIterator & iter) { @@ -193,20 +192,17 @@ return ( m_Iter == it.m_Iter ); } -protected: + protected: // This method should only be available to the ListSample class - ConstIterator( - ImageConstIteratorType iter, - InstanceIdentifier iid) - { - m_Iter = iter; - m_InstanceIdentifier = iid; - } + ConstIterator(const ImageConstIteratorType & iter, InstanceIdentifier iid) : + m_Iter(iter), + m_InstanceIdentifier(iid) + {} // This method is purposely not implemented ConstIterator(); -private: + private: ImageConstIteratorType m_Iter; mutable MeasurementVectorType m_MeasurementVectorCache; InstanceIdentifier m_InstanceIdentifier; @@ -216,16 +212,19 @@ * \brief Iterator * \ingroup ITKStatistics */ - class Iterator:public ConstIterator + class Iterator: + public ConstIterator { friend class ImageToListSampleAdaptor; -public: + public: - Iterator(Self *adaptor):ConstIterator(adaptor) + Iterator(Self *adaptor) : + ConstIterator(adaptor) {} - Iterator(const Iterator & iter):ConstIterator(iter) + Iterator(const Iterator & iter): + ConstIterator(iter) {} Iterator & operator=(const Iterator & iter) @@ -234,19 +233,20 @@ return *this; } -protected: + protected: // To ensure const-correctness these method must not be in the public API. // The are purposly not implemented, since they should never be called. Iterator(); Iterator(const Self *adaptor); - Iterator(ImageConstIteratorType iter, InstanceIdentifier iid); + Iterator(const ImageConstIteratorType & iter, InstanceIdentifier iid); Iterator(const ConstIterator & it); ConstIterator & operator=(const ConstIterator & it); - Iterator( ImageIteratorType iter, InstanceIdentifier iid):ConstIterator(iter, iid) + Iterator(const ImageIteratorType & iter, InstanceIdentifier iid) : + ConstIterator(iter, iid) {} -private: + private: }; /** returns an iterator that points to the beginning of the container */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ ImageToListSampleAdaptor< TImage > ::ImageToListSampleAdaptor() { - m_Image = 0; + m_Image = ITK_NULLPTR; } template< typename TImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -114,23 +114,22 @@ protected: ImageToListSampleFilter(); virtual ~ImageToListSampleFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Standard itk::ProcessObject subclass method. */ typedef DataObject::Pointer DataObjectPointer; typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** This method ensures that a mask image if specified has requested regions * that at least contain the input image's buffered region. */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; - virtual void GenerateOutputInformation(); + virtual void GenerateOutputInformation() ITK_OVERRIDE; private: ImageToListSampleFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToListSampleFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -99,7 +99,7 @@ { const ImageType *input = this->GetInput(); - if ( input == NULL ) + if ( input == ITK_NULLPTR ) { itkExceptionMacro("Input image has not been set yet"); } @@ -128,7 +128,7 @@ static_cast< ListSampleType * >( this->ProcessObject::GetOutput(0) ); const ImageType * input = this->GetInput(); - const MaskImageType *maskImage = NULL; + const MaskImageType *maskImage = ITK_NULLPTR; // Verify whether the image and the mask have the same LargestPossibleRegion. // Otherwise, throw an exception. @@ -194,7 +194,6 @@ void ImageToListSampleFilter< TImage, TMaskImage > ::GenerateInputRequestedRegion() -throw( InvalidRequestedRegionError ) { // call the superclass' implementation of this method. this should // copy the output requested region to the input requested region diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToNeighborhoodSampleAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToNeighborhoodSampleAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToNeighborhoodSampleAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkImageToNeighborhoodSampleAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,19 +25,21 @@ template < typename TImage, typename TBoundaryCondition> ImageToNeighborhoodSampleAdaptor< TImage, TBoundaryCondition> -::ImageToNeighborhoodSampleAdaptor() + ::ImageToNeighborhoodSampleAdaptor() : + m_Image(ITK_NULLPTR), + m_InstanceIdentifierInternal(0), + m_UseImageRegion(true) { - m_Image = 0; m_Radius.Fill(0); + m_NeighborIndexInternal.Fill(0); + NeighborhoodIndexType start; NeighborhoodSizeType sz; start.Fill(0); sz.Fill(0); m_Region.SetIndex(start); m_Region.SetSize(sz); - m_UseImageRegion = true; this->SetMeasurementVectorSize(1); - m_NeighborIndexInternal.Fill(0); } template < typename TImage, typename TBoundaryCondition> diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkJointDomainImageToListSampleAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkJointDomainImageToListSampleAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkJointDomainImageToListSampleAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkJointDomainImageToListSampleAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ ::JointDomainImageToListSampleAdaptor() { m_NormalizationFactors.Fill(1.0f); - m_Image = 0; + m_Image = ITK_NULLPTR; m_UsePixelContainer = true; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.h 2014-09-03 08:29:34.000000000 +0000 @@ -165,7 +165,7 @@ KdTreeBasedKmeansEstimator(); virtual ~KdTreeBasedKmeansEstimator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void FillClusterLabels(KdTreeNodeType *node, int closestIndex); @@ -176,7 +176,7 @@ class CandidateVector { public: - CandidateVector() {} + CandidateVector() : m_MeasurementVectorSize(0) {} struct Candidate { CentroidType Centroid; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeBasedKmeansEstimator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,20 +27,19 @@ { template< typename TKdTree > KdTreeBasedKmeansEstimator< TKdTree > -::KdTreeBasedKmeansEstimator() +::KdTreeBasedKmeansEstimator() : + m_CurrentIteration(0), + m_MaximumIteration(100), + m_CentroidPositionChanges(0.0), + m_CentroidPositionChangesThreshold(0.0), + m_KdTree(ITK_NULLPTR), + m_DistanceMetric(EuclideanDistanceMetric< ParameterType >::New()), + m_UseClusterLabels(false), + m_GenerateClusterLabels(false), + m_MeasurementVectorSize(0), + m_MembershipFunctionsObject(MembershipFunctionVectorObjectType::New()) { - m_CentroidPositionChangesThreshold = 0.0; - m_KdTree = 0; - m_UseClusterLabels = false; - m_MaximumIteration = 100; - m_DistanceMetric = EuclideanDistanceMetric< ParameterType >::New(); - - m_MembershipFunctionsObject = MembershipFunctionVectorObjectType::New(); - - m_CentroidPositionChanges = 0.0; m_TempVertex.Fill(0.0); - m_CurrentIteration = 0; - m_MeasurementVectorSize = 0; } template< typename TKdTree > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -140,7 +140,7 @@ /** Destructor */ virtual ~KdTreeGenerator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Returns the smart pointer to the internal Subsample object. */ SubsamplePointer GetSubsample() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTreeGenerator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ KdTreeGenerator< TSample > ::KdTreeGenerator() { - m_SourceSample = 0; + m_SourceSample = ITK_NULLPTR; m_BucketSize = 16; m_Subsample = SubsampleType::New(); m_MeasurementVectorSize = 0; @@ -42,7 +42,7 @@ Superclass::PrintSelf(os, indent); os << indent << "Source Sample: "; - if ( m_SourceSample != 0 ) + if ( m_SourceSample != ITK_NULLPTR ) { os << m_SourceSample << std::endl; } @@ -83,7 +83,7 @@ KdTreeGenerator< TSample > ::GenerateData() { - if ( m_SourceSample == 0 ) + if ( m_SourceSample == ITK_NULLPTR ) { return; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.h 2014-09-03 08:29:34.000000000 +0000 @@ -385,25 +385,25 @@ /** Return the left tree pointer. Null for terminal nodes. */ Superclass * Left() { - return 0; + return ITK_NULLPTR; } /** Return the right tree pointer. Null for terminal nodes. */ Superclass * Right() { - return 0; + return ITK_NULLPTR; } /** Return the left tree const pointer. Null for terminal nodes. */ const Superclass * Left() const { - return 0; + return ITK_NULLPTR; } /** Return the right tree const pointer. Null for terminal nodes. */ const Superclass * Right() const { - return 0; + return ITK_NULLPTR; } /** Return the size of the node. */ @@ -535,7 +535,7 @@ { public: /** Constructor */ - NearestNeighbors() {} + NearestNeighbors() : m_FarthestNeighborIndex(0) {} /** Destructor */ ~NearestNeighbors() {} @@ -674,7 +674,13 @@ /** Searches the k-nearest neighbors */ void Search( const MeasurementVectorType &, unsigned int, - InstanceIdentifierVectorType & ) const; + InstanceIdentifierVectorType & ) const; + + /** Searches the k-nearest neighbors and returns + * the distance vector along with the distance measures. + */ + void Search( const MeasurementVectorType &, unsigned int, + InstanceIdentifierVectorType &, std::vector & ) const; /** Searches the neighbors fallen into a hypersphere */ void Search( const MeasurementVectorType &, double, @@ -721,7 +727,7 @@ /** Destructor: deletes the root node and the empty terminal node. */ virtual ~KdTree(); - void PrintSelf( std::ostream & os, Indent indent ) const; + virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE; /** search loop */ int NearestNeighborSearchLoop( const KdTreeNodeType *, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkKdTree.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,12 +27,13 @@ template KdTreeNonterminalNode ::KdTreeNonterminalNode( unsigned int partitionDimension, - MeasurementType partitionValue, Superclass *left, Superclass *right ) + MeasurementType partitionValue, Superclass *left, Superclass *right ) : + m_PartitionDimension(partitionDimension), + m_PartitionValue(partitionValue), + m_InstanceIdentifier(0), + m_Left(left), + m_Right(right) { - this->m_PartitionDimension = partitionDimension; - this->m_PartitionValue = partitionValue; - this->m_Left = left; - this->m_Right = right; } template @@ -81,8 +82,8 @@ this->m_EmptyTerminalNode = new KdTreeTerminalNode(); this->m_DistanceMetric = DistanceMetricType::New(); - this->m_Sample = 0; - this->m_Root = 0; + this->m_Sample = ITK_NULLPTR; + this->m_Root = ITK_NULLPTR; this->m_BucketSize = 16; this->m_MeasurementVectorSize = 0; } @@ -91,7 +92,7 @@ KdTree ::~KdTree() { - if( this->m_Root != 0 ) + if( this->m_Root != ITK_NULLPTR ) { this->DeleteNode( this->m_Root ); } @@ -106,7 +107,7 @@ Superclass::PrintSelf( os, indent ); os << indent << "Input Sample: "; - if( this->m_Sample != 0 ) + if( this->m_Sample != ITK_NULLPTR ) { os << this->m_Sample << std::endl; } @@ -116,7 +117,7 @@ } os << indent << "Bucket Size: " << this->m_BucketSize << std::endl; os << indent << "Root Node: "; - if( this->m_Root != 0 ) + if( this->m_Root != ITK_NULLPTR ) { os << this->m_Root << std::endl; } @@ -146,12 +147,12 @@ } // non-terminal node - if( node->Left() != 0 ) + if( node->Left() != ITK_NULLPTR ) { this->DeleteNode( node->Left() ); } - if( node->Right() != 0 ) + if( node->Right() != ITK_NULLPTR ) { this->DeleteNode( node->Right() ); } @@ -183,7 +184,19 @@ void KdTree ::Search( const MeasurementVectorType & query, - unsigned int numberOfNeighborsRequested, InstanceIdentifierVectorType &result ) const + unsigned int numberOfNeighborsRequested, InstanceIdentifierVectorType &result ) const +{ + // This function has two different signatures. The other signature, that returns the distances vector too, + // is called here; however, its distances vector is discarded. + std::vector not_used_distances; + this->Search(query, numberOfNeighborsRequested, result, not_used_distances); +} + +template +void +KdTree +::Search( const MeasurementVectorType & query, + unsigned int numberOfNeighborsRequested, InstanceIdentifierVectorType &result, std::vector &distances ) const { if( numberOfNeighborsRequested > this->Size() ) { @@ -204,16 +217,17 @@ for( unsigned int d = 0; d < this->m_MeasurementVectorSize; ++d ) { - lowerBound[d] = static_cast< MeasurementType >( -vcl_sqrt( + lowerBound[d] = static_cast< MeasurementType >( -std::sqrt( -static_cast< double >( NumericTraits< MeasurementType >:: NonpositiveMin() ) ) / 2.0 ); - upperBound[d] = static_cast< MeasurementType >( vcl_sqrt( + upperBound[d] = static_cast< MeasurementType >( std::sqrt( static_cast( NumericTraits< MeasurementType >::max() ) / 2.0 ) ); } this->NearestNeighborSearchLoop( this->m_Root, query, lowerBound, upperBound, nearestNeighbors ); result = nearestNeighbors.GetNeighbors(); + distances = nearestNeighbors.GetDistances(); } template @@ -349,10 +363,10 @@ for( unsigned int d = 0; d < this->m_MeasurementVectorSize; ++d ) { - lowerBound[d] = static_cast( -vcl_sqrt( + lowerBound[d] = static_cast( -std::sqrt( -static_cast( NumericTraits:: NonpositiveMin() ) ) / 2.0 ); - upperBound[d] = static_cast< MeasurementType >( vcl_sqrt( + upperBound[d] = static_cast< MeasurementType >( std::sqrt( static_cast( NumericTraits< MeasurementType >::max() ) / 2.0 ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMembershipFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -124,7 +124,7 @@ // define the inverse to be diagonal with large values along the // diagonal. value chosen so (X-M)'inv(C)*(X-M) will usually stay // below NumericTraits::max() - const double aLargeDouble = vcl_pow(NumericTraits::max(), 1.0/3.0) + const double aLargeDouble = std::pow(NumericTraits::max(), 1.0/3.0) / (double) this->GetMeasurementVectorSize(); m_InverseCovariance.SetSize(this->GetMeasurementVectorSize(), this->GetMeasurementVectorSize()); m_InverseCovariance.SetIdentity(); @@ -145,18 +145,22 @@ // Our inverse covariance is always well formed. When the covariance // is singular, we use a diagonal inverse covariance with a large diagnonal - // Compute ( y - mean ) - vnl_vector< double > tempVector( measurementVectorSize ); - - for ( MeasurementVectorSizeType i = 0; i < measurementVectorSize; ++i ) + // temp = ( y - mean )^t * InverseCovariance * ( y - mean ) + // + // This is manually done to remove dynamic memory allocation: + // double temp = dot_product( tempVector, m_InverseCovariance.GetVnlMatrix() * tempVector ); + // + double temp = 0.0; + for (unsigned int r = 0; r < measurementVectorSize; ++r) { - tempVector[i] = measurement[i] - m_Mean[i]; + double rowdot = 0.0; + for(unsigned int c = 0; c < measurementVectorSize; ++c) + { + rowdot += m_InverseCovariance(r, c) * ( measurement[c] - m_Mean[c] ); + } + temp += rowdot * ( measurement[r] - m_Mean[r] ); } - // temp = ( y - mean )^t * InverseCovariance * ( y - mean ) - double temp = dot_product( tempVector, - m_InverseCovariance.GetVnlMatrix() * tempVector ); - return temp; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMahalanobisDistanceMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -174,7 +174,7 @@ // Compute |y - mean | * inverse(cov) * |y - mean|^T double temp; - temp = vcl_sqrt( dot_product( tempMat.as_ref(), tempVec.as_ref() ) ); + temp = std::sqrt( dot_product( tempMat.as_ref(), tempVec.as_ref() ) ); return temp; } @@ -208,7 +208,7 @@ // Compute |x1 - x2 | * inverse(cov) * |x1 - x2|^T double temp; - temp = vcl_sqrt( dot_product( tempMat.as_ref(), tempVec.as_ref() ) ); + temp = std::sqrt( dot_product( tempMat.as_ref(), tempVec.as_ref() ) ); return temp; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkManhattanDistanceMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkManhattanDistanceMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkManhattanDistanceMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkManhattanDistanceMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,7 +43,7 @@ for ( unsigned int i = 0; i < measurementVectorSize; i++ ) { - temp = vcl_abs(this->GetOrigin()[i] - x[i]); + temp = std::abs(this->GetOrigin()[i] - x[i]); distance += temp; } return distance; @@ -65,7 +65,7 @@ double temp, distance = NumericTraits< double >::Zero; for ( unsigned int i = 0; i < measurementVectorSize; i++ ) { - temp = vcl_abs(x1[i] - x2[i]); + temp = std::abs(x1[i] - x2[i]); distance += temp; } return distance; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaskedImageToHistogramFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaskedImageToHistogramFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaskedImageToHistogramFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaskedImageToHistogramFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -86,13 +86,15 @@ HistogramMeasurementVectorType m( nbOfComponents ); MaskPixelType maskValue = this->GetMaskValue(); + typename HistogramType::IndexType index; while ( !inputIt.IsAtEnd() ) { if( maskIt.Get() == maskValue ) { const PixelType & p = inputIt.Get(); NumericTraits::AssignToArray( p, m ); - this->m_Histograms[threadId]->IncreaseFrequencyOfMeasurement( m, 1 ); + this->m_Histograms[threadId]->GetIndex( m, index ); + this->m_Histograms[threadId]->IncreaseFrequencyOfIndex( index, 1 ); } ++inputIt; ++maskIt; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumDecisionRule.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumDecisionRule.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumDecisionRule.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumDecisionRule.h 2014-09-03 08:29:34.000000000 +0000 @@ -62,7 +62,7 @@ * Evaluate the decision rule, returning the class label associated * with the largest discriminant score. */ - virtual ClassIdentifierType Evaluate(const MembershipVectorType & discriminantScores) const; + virtual ClassIdentifierType Evaluate(const MembershipVectorType & discriminantScores) const ITK_OVERRIDE; protected: MaximumDecisionRule() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumRatioDecisionRule.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumRatioDecisionRule.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumRatioDecisionRule.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMaximumRatioDecisionRule.h 2014-09-03 08:29:34.000000000 +0000 @@ -87,7 +87,7 @@ * assumed). Parameter to Evaluate() is the discriminant score in * the form of a likelihood \f$p(x|i)\f$. */ - virtual ClassIdentifierType Evaluate(const MembershipVectorType & discriminantScores) const; + virtual ClassIdentifierType Evaluate(const MembershipVectorType & discriminantScores) const ITK_OVERRIDE; /** Set the prior probabilities used in evaluating * \f$p(x|i) p(i) > p(x|j) p(j)\f$. The likelihoods are set using @@ -101,7 +101,7 @@ protected: MaximumRatioDecisionRule(); virtual ~MaximumRatioDecisionRule() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: MaximumRatioDecisionRule(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,7 @@ */ template< typename TSample > -class MeanSampleFilter:public ProcessObject +class MeanSampleFilter : public ProcessObject { public: /**Standard class typedefs. */ @@ -59,45 +59,55 @@ itkTypeMacro(MeanSampleFilter, ProcessObject); itkNewMacro(Self); - /** Length of a measurement vector */ - typedef unsigned int MeasurementVectorSizeType; - typedef typename TSample::MeasurementVectorType MeasurementVectorType; - typedef typename TSample::MeasurementType MeasurementType; - typedef typename NumericTraits< MeasurementType >::RealType MeasurementRealType; + /** Type of each measurement vector in sample */ + typedef typename SampleType::MeasurementVectorType MeasurementVectorType; + + /** Type of the length of each measurement vector */ + typedef typename SampleType::MeasurementVectorSizeType MeasurementVectorSizeType; + + /** Type of measurement vector component value */ + typedef typename SampleType::MeasurementType MeasurementType; + + /** Type of a measurement vector, holding floating point values */ typedef typename NumericTraits< MeasurementVectorType >::RealType MeasurementVectorRealType; - /** Method to set/get the sample */ + /** Type of a floating point measurement component value */ + typedef typename NumericTraits< MeasurementType >::RealType MeasurementRealType; + + + /** Method to set the sample */ using Superclass::SetInput; void SetInput(const SampleType *sample); - const SampleType * GetInput() const; + /** Method to get the sample */ + const SampleType * GetInput() const; - /** MeasurementVector is not a DataObject, we need to decorate it to push it down - * a ProcessObject's pipeline */ - typedef SimpleDataObjectDecorator< MeasurementVectorRealType > MeasurementVectorDecoratedType; - - typedef MeasurementVectorDecoratedType OutputType; /** Get the mean measurement vector */ + const MeasurementVectorRealType GetMean() const; + + /** MeasurementVector is not a DataObject, we need to decorate it to push it down + * a ProcessObject's pipeline */ + typedef SimpleDataObjectDecorator< MeasurementVectorRealType > MeasurementVectorDecoratedType; const MeasurementVectorDecoratedType * GetOutput() const; + typedef MeasurementVectorDecoratedType OutputType; - const MeasurementVectorRealType GetMean() const; MeasurementVectorSizeType GetMeasurementVectorSize() const; protected: MeanSampleFilter(); virtual ~MeanSampleFilter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** DataObject pointer */ typedef DataObject::Pointer DataObjectPointer; typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: MeanSampleFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeanSampleFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,9 +18,12 @@ #ifndef __itkMeanSampleFilter_hxx #define __itkMeanSampleFilter_hxx -#include "itkMeasurementVectorTraits.h" #include "itkMeanSampleFilter.h" +#include +#include "itkCompensatedSummation.h" +#include "itkMeasurementVectorTraits.h" + namespace itk { namespace Statistics @@ -72,7 +75,7 @@ MeasurementVectorRealType mean; (void)mean; // for complainty pants : valgrind NumericTraits::SetLength( mean, this->GetMeasurementVectorSize() ); - mean.Fill( NumericTraits< MeasurementRealType >::Zero ); + // NumericTraits::SetLength also initializes array to zero typename MeasurementVectorDecoratedType::Pointer decoratedMean = MeasurementVectorDecoratedType::New(); decoratedMean->Set( mean ); return decoratedMean.GetPointer(); @@ -127,44 +130,43 @@ MeanSampleFilter< TSample > ::GenerateData() { + // set up input / output const SampleType *input = this->GetInput(); - MeasurementVectorSizeType measurementVectorSize = + const MeasurementVectorSizeType measurementVectorSize = input->GetMeasurementVectorSize(); MeasurementVectorDecoratedType *decoratedOutput = - itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >(this->ProcessObject::GetOutput(0) ); + itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >( this->ProcessObject::GetOutput(0) ); MeasurementVectorRealType output = decoratedOutput->Get(); NumericTraits::SetLength( output, this->GetMeasurementVectorSize() ); - typename TSample::ConstIterator iter = input->Begin(); - typename TSample::ConstIterator end = input->End(); - double totalFrequency = 0.0; + // algorithm start + typedef CompensatedSummation< MeasurementRealType > MeasurementRealAccumulateType; + std::vector< MeasurementRealAccumulateType > sum( measurementVectorSize ); - typedef typename NumericTraits< - MeasurementRealType >::AccumulateType MeasurementRealAccumulateType; + typedef typename SampleType::TotalAbsoluteFrequencyType TotalFrequencyType; + TotalFrequencyType totalFrequency = NumericTraits< TotalFrequencyType >::Zero; - Array< MeasurementRealAccumulateType > sum( measurementVectorSize ); - sum.Fill( NumericTraits< MeasurementRealAccumulateType >::Zero ); + typename SampleType::ConstIterator iter = input->Begin(); + const typename SampleType::ConstIterator end = input->End(); - while ( iter != end ) + for (; iter != end; ++iter ) { - double frequency = iter.GetFrequency(); - totalFrequency += frequency; - const MeasurementVectorType & measurement = iter.GetMeasurementVector(); + const typename SampleType::AbsoluteFrequencyType frequency = iter.GetFrequency(); + totalFrequency += frequency; + for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) { const MeasurementRealType component = static_cast< MeasurementRealType >( measurement[dim] ); - sum[dim] += static_cast< MeasurementRealAccumulateType >( component * frequency ); + sum[dim] += ( component * static_cast< MeasurementRealType >( frequency ) ); } - - ++iter; } // compute the mean if the total frequency is different from zero @@ -172,7 +174,7 @@ { for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) { - output[dim] = static_cast< MeasurementRealType >( sum[dim] / totalFrequency ); + output[dim] = ( sum[dim].GetSum() / static_cast< MeasurementRealType >( totalFrequency ) ); } } else diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeasurementVectorTraits.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeasurementVectorTraits.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeasurementVectorTraits.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMeasurementVectorTraits.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,9 +72,9 @@ return ( len == 0 ); } - template< typename TValueType1, unsigned int VLength, typename TValueType2, unsigned int VLength2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > &, - const FixedArray< TValueType2, VLength2 > &, + template< typename TValue1, unsigned int VLength, typename TValue2, unsigned int VLength2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, + const FixedArray< TValue2, VLength2 > &, const char *errMsg = "Length Mismatch") { if ( VLength != VLength2 ) @@ -84,9 +84,9 @@ return 0; } - template< typename TValueType1, unsigned int VLength, typename TValueType2, unsigned int VLength2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > *, - const FixedArray< TValueType2, VLength2 > *, + template< typename TValue1, unsigned int VLength, typename TValue2, unsigned int VLength2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, + const FixedArray< TValue2, VLength2 > *, const char *errMsg = "Length Mismatch") { if ( VLength != VLength2 ) @@ -96,9 +96,9 @@ return 0; } - template< typename TValueType1, typename TValueType2 > - static MeasurementVectorLength Assert(const Array< TValueType1 > & a, - const Array< TValueType2 > & b, const char *errMsg = "Length Mismatch") + template< typename TValue1, typename TValue2 > + static MeasurementVectorLength Assert(const Array< TValue1 > & a, + const Array< TValue2 > & b, const char *errMsg = "Length Mismatch") { if ( b.Size() != a.Size() ) { @@ -107,9 +107,9 @@ return 0; } - template< typename TValueType1, typename TValueType2 > - static MeasurementVectorLength Assert(const Array< TValueType1 > *a, - const Array< TValueType2 > *b, const char *errMsg = "Length Mismatch") + template< typename TValue1, typename TValue2 > + static MeasurementVectorLength Assert(const Array< TValue1 > *a, + const Array< TValue2 > *b, const char *errMsg = "Length Mismatch") { if ( b->Size() != a->Size() ) { @@ -118,9 +118,9 @@ return 0; } - template< typename TValueType1, typename TValueType2 > - static MeasurementVectorLength Assert(const VariableLengthVector< TValueType1 > & a, - const VariableLengthVector< TValueType2 > & b, + template< typename TValue1, typename TValue2 > + static MeasurementVectorLength Assert(const VariableLengthVector< TValue1 > & a, + const VariableLengthVector< TValue2 > & b, const char *errMsg = "Length Mismatch") { if ( b.Size() != a.Size() ) @@ -130,9 +130,9 @@ return 0; } - template< typename TValueType1, typename TValueType2 > - static MeasurementVectorLength Assert(const VariableLengthVector< TValueType1 > *a, - const VariableLengthVector< TValueType2 > *b, + template< typename TValue1, typename TValue2 > + static MeasurementVectorLength Assert(const VariableLengthVector< TValue1 > *a, + const VariableLengthVector< TValue2 > *b, const char *errMsg = "Length Mismatch") { if ( b->Size() != a->Size() ) @@ -142,9 +142,9 @@ return 0; } - template< typename TValueType1, typename TValueType2 > - static MeasurementVectorLength Assert(const std::vector< TValueType1 > & a, - const std::vector< TValueType2 > & b, const char *errMsg = "Length Mismatch") + template< typename TValue1, typename TValue2 > + static MeasurementVectorLength Assert(const std::vector< TValue1 > & a, + const std::vector< TValue2 > & b, const char *errMsg = "Length Mismatch") { if ( b.size() != a.size() ) { @@ -153,9 +153,9 @@ return 0; } - template< typename TValueType1, typename TValueType2 > - static MeasurementVectorLength Assert(const std::vector< TValueType1 > *a, - const std::vector< TValueType2 > *b, const char *errMsg = "Length Mismatch") + template< typename TValue1, typename TValue2 > + static MeasurementVectorLength Assert(const std::vector< TValue1 > *a, + const std::vector< TValue2 > *b, const char *errMsg = "Length Mismatch") { if ( b->size() != a->size() ) { @@ -164,9 +164,9 @@ return 0; } - template< typename TValueType1, unsigned int VLength, typename TValueType2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > &, - const Array< TValueType2 > & b, const char *errMsg = "Length Mismatch") + template< typename TValue1, unsigned int VLength, typename TValue2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, + const Array< TValue2 > & b, const char *errMsg = "Length Mismatch") { if ( b.Size() == 0 ) { @@ -182,9 +182,9 @@ return 0; } - template< typename TValueType1, unsigned int VLength, typename TValueType2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > *, - const Array< TValueType2 > *b, const char *errMsg = "Length Mismatch") + template< typename TValue1, unsigned int VLength, typename TValue2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, + const Array< TValue2 > *b, const char *errMsg = "Length Mismatch") { if ( b->Size() == 0 ) { @@ -197,9 +197,9 @@ return 0; } - template< typename TValueType1, unsigned int VLength, typename TValueType2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > &, - const VariableLengthVector< TValueType2 > & b, + template< typename TValue1, unsigned int VLength, typename TValue2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, + const VariableLengthVector< TValue2 > & b, const char *errMsg = "Length Mismatch") { if ( b.Size() == 0 ) @@ -216,9 +216,9 @@ return 0; } - template< typename TValueType1, unsigned int VLength, typename TValueType2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > *, - const VariableLengthVector< TValueType2 > *b, + template< typename TValue1, unsigned int VLength, typename TValue2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, + const VariableLengthVector< TValue2 > *b, const char *errMsg = "Length Mismatch") { if ( b->Size() == 0 ) @@ -232,9 +232,9 @@ return 0; } - template< typename TValueType1, unsigned int VLength, typename TValueType2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > &, - const std::vector< TValueType2 > & b, const char *errMsg = "Length Mismatch") + template< typename TValue1, unsigned int VLength, typename TValue2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, + const std::vector< TValue2 > & b, const char *errMsg = "Length Mismatch") { if ( b.size() == 0 ) { @@ -250,9 +250,9 @@ return 0; } - template< typename TValueType1, unsigned int VLength, typename TValueType2 > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > *, - const std::vector< TValueType2 > *b, const char *errMsg = "Length Mismatch") + template< typename TValue1, unsigned int VLength, typename TValue2 > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, + const std::vector< TValue2 > *b, const char *errMsg = "Length Mismatch") { if ( b->size() == 0 ) { @@ -265,8 +265,8 @@ return 0; } - template< typename TValueType1, unsigned int VLength > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > &, + template< typename TValue1, unsigned int VLength > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( l == 0 ) @@ -280,8 +280,8 @@ return 0; } - template< typename TValueType1, unsigned int VLength > - static MeasurementVectorLength Assert(const FixedArray< TValueType1, VLength > *, + template< typename TValue1, unsigned int VLength > + static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( l == 0 ) @@ -295,8 +295,8 @@ return 0; } - template< typename TValueType > - static MeasurementVectorLength Assert(const Array< TValueType > & a, + template< typename TValue > + static MeasurementVectorLength Assert(const Array< TValue > & a, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( ( ( l != 0 ) && ( a.Size() != l ) ) || ( a.Size() == 0 ) ) @@ -310,8 +310,8 @@ return 0; } - template< typename TValueType > - static MeasurementVectorLength Assert(const Array< TValueType > *a, + template< typename TValue > + static MeasurementVectorLength Assert(const Array< TValue > *a, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( ( ( l != 0 ) && ( a->Size() != l ) ) || ( a->Size() == 0 ) ) @@ -325,8 +325,8 @@ return 0; } - template< typename TValueType > - static MeasurementVectorLength Assert(const VariableLengthVector< TValueType > & a, + template< typename TValue > + static MeasurementVectorLength Assert(const VariableLengthVector< TValue > & a, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( ( ( l != 0 ) && ( a.Size() != l ) ) || ( a.Size() == 0 ) ) @@ -340,8 +340,8 @@ return 0; } - template< typename TValueType > - static MeasurementVectorLength Assert(const VariableLengthVector< TValueType > *a, + template< typename TValue > + static MeasurementVectorLength Assert(const VariableLengthVector< TValue > *a, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( ( ( l != 0 ) && ( a->Size() != l ) ) || ( a->Size() == 0 ) ) @@ -355,8 +355,8 @@ return 0; } - template< typename TValueType > - static MeasurementVectorLength Assert(const std::vector< TValueType > & a, + template< typename TValue > + static MeasurementVectorLength Assert(const std::vector< TValue > & a, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( ( ( l != 0 ) && ( a.size() != l ) ) || ( a.size() == 0 ) ) @@ -370,8 +370,8 @@ return 0; } - template< typename TValueType > - static MeasurementVectorLength Assert(const std::vector< TValueType > *a, + template< typename TValue > + static MeasurementVectorLength Assert(const std::vector< TValue > *a, const MeasurementVectorLength l, const char *errMsg = "Length Mismatch") { if ( ( ( l != 0 ) && ( a->size() != l ) ) || ( a->size() == 0 ) ) @@ -391,8 +391,8 @@ m = v; } - template< typename TValueType, unsigned int VLength > - static void Assign(FixedArray< TValueType, VLength > & m, const TValueType & v) + template< typename TValue, unsigned int VLength > + static void Assign(FixedArray< TValue, VLength > & m, const TValue & v) { m[0] = v; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.h 2014-09-03 08:29:34.000000000 +0000 @@ -112,8 +112,8 @@ * identifier, id. */ unsigned int GetClassLabel(const InstanceIdentifier & id) const; - /** Gets the Subsample that includes only the instances that belongs - * to the classLabel */ + /** Gets the Subsample that includes only the instances that belong + * to the classLabel. If classLabel does not exist, NULL is returned. */ const ClassSampleType * GetClassSample(const ClassLabelType & classLabel) const; /** Gets the class labels that corresponding to the each instance in @@ -136,7 +136,7 @@ TotalAbsoluteFrequencyType GetTotalFrequency() const; /** Method to graft another sample */ - virtual void Graft(const DataObject *thatObject); + virtual void Graft(const DataObject *thatObject) ITK_OVERRIDE; // void PrintSelf(std::ostream& os, Indent indent) const; @@ -288,7 +288,7 @@ protected: MembershipSample(); virtual ~MembershipSample() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: MembershipSample(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMembershipSample.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -99,6 +99,10 @@ ::GetClassSample(const ClassLabelType & classLabel) const { int classIndex = this->GetInternalClassLabel(classLabel); + if (classIndex < 0) + { + return NULL; + } return m_ClassSamples[classIndex]; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMinimumDecisionRule.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMinimumDecisionRule.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMinimumDecisionRule.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMinimumDecisionRule.h 2014-09-03 08:29:34.000000000 +0000 @@ -60,7 +60,7 @@ * Evaluate the decision rule, returning the class label associated * with the smallest discriminant score. */ - virtual ClassIdentifierType Evaluate(const MembershipVectorType & discriminantScores) const; + virtual ClassIdentifierType Evaluate(const MembershipVectorType & discriminantScores) const ITK_OVERRIDE; protected: MinimumDecisionRule() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -131,7 +131,7 @@ protected: MixtureModelComponentBase(); virtual ~MixtureModelComponentBase(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** stores the pointer to the membership function. * subclasses use this function to store their membership function diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkMixtureModelComponentBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ MixtureModelComponentBase< TSample > ::MixtureModelComponentBase() { - m_Sample = 0; - m_MembershipFunction = 0; + m_Sample = ITK_NULLPTR; + m_MembershipFunction = ITK_NULLPTR; m_MinimalParametersChange = 1.0e-06; m_ParametersModified = true; } @@ -47,7 +47,7 @@ Superclass::PrintSelf(os, indent); os << indent << "Sample: "; - if ( m_Sample != 0 ) + if ( m_Sample != ITK_NULLPTR ) { os << m_Sample << std::endl; } @@ -57,7 +57,7 @@ } os << indent << "Membership Function: "; - if ( m_MembershipFunction != 0 ) + if ( m_MembershipFunction != ITK_NULLPTR ) { os << m_MembershipFunction << std::endl; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNeighborhoodSampler.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNeighborhoodSampler.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNeighborhoodSampler.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNeighborhoodSampler.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -49,7 +49,7 @@ const InputRadiusObjectType *radiusObject = this->GetRadiusInput(); - if ( radiusObject == NULL ) + if ( radiusObject == ITK_NULLPTR ) { itkExceptionMacro("Radius input is missing"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNormalVariateGenerator.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNormalVariateGenerator.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNormalVariateGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkNormalVariateGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -115,12 +115,12 @@ void Initialize(int randomSeed); /** get a variate using FastNorm function */ - double GetVariate(); + virtual double GetVariate() ITK_OVERRIDE; protected: NormalVariateGenerator(); virtual ~NormalVariateGenerator(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** get a variate */ double FastNorm(void); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkPointSetToListSampleAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkPointSetToListSampleAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkPointSetToListSampleAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkPointSetToListSampleAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ PointSetToListSampleAdaptor< TPointSet > ::PointSetToListSampleAdaptor() { - this->m_PointSet = 0; + this->m_PointSet = ITK_NULLPTR; this->SetMeasurementVectorSize( TPointSet::PointDimension ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkProbabilityDistribution.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkProbabilityDistribution.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkProbabilityDistribution.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkProbabilityDistribution.h 2014-09-03 08:29:34.000000000 +0000 @@ -155,7 +155,7 @@ protected: ProbabilityDistribution(void) {} virtual ~ProbabilityDistribution(void) {} - void PrintSelf(std::ostream & os, Indent indent) const + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "Parameters: " << m_Parameters << std::endl; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -128,13 +128,13 @@ protected: SampleClassifierFilter(); virtual ~SampleClassifierFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; SampleClassifierFilter(const Self &); //purposely not implemented void operator=(const Self &); //purposely not implemented /** Starts the classification process */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Make a DataObject of the correct type to used as the specified * output. This method @@ -144,7 +144,7 @@ */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleClassifierFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ this->ProcessObject::SetNthOutput( 0, this->MakeOutput(0) ); /** Initialize decision rule */ - m_DecisionRule = NULL; + m_DecisionRule = ITK_NULLPTR; } template< typename TSample > @@ -146,7 +146,7 @@ } MembershipFunctionsWeightsArrayType membershipFunctionsWeightsArray; - if ( membershipFunctionsWeightsArrayDecorated == NULL ) + if ( membershipFunctionsWeightsArrayDecorated == ITK_NULLPTR ) { // no weights array is set and hence all membership functions will have // equal diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSample.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSample.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSample.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSample.h 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,7 @@ * sequential id for each measurement vector in a Sample subclass. */ typedef typename MeasurementVectorTraits::InstanceIdentifier InstanceIdentifier; - /** Typedef for the length of each measurement vector */ + /** Type of the length of each measurement vector */ typedef unsigned int MeasurementVectorSizeType; /** Get the size of the sample (number of measurements) */ @@ -158,7 +158,7 @@ itkGetConstMacro(MeasurementVectorSize, MeasurementVectorSizeType); /** Method to graft another sample */ - virtual void Graft(const DataObject *thatObject) + virtual void Graft(const DataObject *thatObject) ITK_OVERRIDE { this->Superclass::Graft(thatObject); @@ -178,7 +178,7 @@ virtual ~Sample() {} - void PrintSelf(std::ostream & os, Indent indent) const + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE { Superclass::PrintSelf(os, indent); os << indent << "Length of measurement vectors in the sample: " diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -136,7 +136,7 @@ SampleToHistogramFilter(); virtual ~SampleToHistogramFilter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Make a DataObject of the correct type to used as the specified * output. This method @@ -146,10 +146,10 @@ */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; // Where the histogram is actually computed - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: SampleToHistogramFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToHistogramFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -143,12 +143,12 @@ const InputHistogramSizeObjectType *histogramSizeObject = this->GetHistogramSizeInput(); - if ( histogramSizeObject == NULL ) + if ( histogramSizeObject == ITK_NULLPTR ) { itkSpecializedExceptionMacro(MissingHistogramSizeInput); } - if ( marginalScaleObject == NULL ) + if ( marginalScaleObject == ITK_NULLPTR ) { itkSpecializedExceptionMacro(MissingHistogramMarginalScaleInput); } @@ -274,12 +274,12 @@ } else { - if ( binMaximumObject == NULL ) + if ( binMaximumObject == ITK_NULLPTR ) { itkSpecializedExceptionMacro(MissingHistogramBinMaximumInput); } - if ( binMinimumObject == NULL ) + if ( binMinimumObject == ITK_NULLPTR ) { itkSpecializedExceptionMacro(MissingHistogramBinMinimumInput); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToSubsampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToSubsampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToSubsampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSampleToSubsampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ protected: SampleToSubsampleFilter(); virtual ~SampleToSubsampleFilter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Make a DataObject of the correct type to used as the specified * output. This method @@ -88,7 +88,7 @@ */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; private: SampleToSubsampleFilter(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceListSampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceListSampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceListSampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceListSampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -102,15 +102,15 @@ protected: ScalarImageToCooccurrenceListSampleFilter(); virtual ~ScalarImageToCooccurrenceListSampleFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; typedef DataObject::Pointer DataObjectPointer; typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: ScalarImageToCooccurrenceListSampleFilter(const Self &); //purposely not diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -172,7 +172,7 @@ protected: ScalarImageToCooccurrenceMatrixFilter(); virtual ~ScalarImageToCooccurrenceMatrixFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; virtual void FillHistogram(RadiusType radius, RegionType region); @@ -183,10 +183,10 @@ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: ScalarImageToCooccurrenceMatrixFilter(const Self &); //purposely not diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToCooccurrenceMatrixFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -173,7 +173,7 @@ RadiusType radius; radius.Fill(minRadius); - const ImageType *maskImage = NULL; + const ImageType *maskImage = ITK_NULLPTR; // Check if a mask image has been provided // @@ -183,7 +183,7 @@ } // Now fill in the histogram - if ( maskImage != NULL ) + if ( maskImage != ITK_NULLPTR ) { this->FillHistogramWithMask(radius, input->GetRequestedRegion(), maskImage); } @@ -230,6 +230,7 @@ } typename OffsetVector::ConstIterator offsets; + typename HistogramType::IndexType index; for ( offsets = m_Offsets->Begin(); offsets != m_Offsets->End(); offsets++ ) { bool pixelInBounds; @@ -253,11 +254,13 @@ cooccur[0] = centerPixelIntensity; cooccur[1] = pixelIntensity; - output->IncreaseFrequencyOfMeasurement(cooccur, 1); + output->GetIndex( cooccur, index ); + output->IncreaseFrequencyOfIndex( index, 1 ); cooccur[1] = centerPixelIntensity; cooccur[0] = pixelIntensity; - output->IncreaseFrequencyOfMeasurement(cooccur, 1); + output->GetIndex( cooccur, index ); + output->IncreaseFrequencyOfIndex( index, 1 ); } } } @@ -285,7 +288,7 @@ maskNeighborIt = NeighborhoodIteratorType(radius, maskImage, region); MeasurementVectorType cooccur( output->GetMeasurementVectorSize() ); - + typename HistogramType::IndexType index; for ( neighborIt.GoToBegin(), maskNeighborIt.GoToBegin(); !neighborIt.IsAtEnd(); ++neighborIt, ++maskNeighborIt ) { @@ -332,11 +335,14 @@ cooccur[0] = centerPixelIntensity; cooccur[1] = pixelIntensity; - output->IncreaseFrequencyOfMeasurement(cooccur, 1); + output->GetIndex( cooccur, index ); + output->IncreaseFrequencyOfIndex(index, 1); + cooccur[1] = centerPixelIntensity; cooccur[0] = pixelIntensity; - output->IncreaseFrequencyOfMeasurement(cooccur, 1); + output->GetIndex( cooccur, index ); + output->IncreaseFrequencyOfIndex(index, 1); } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToHistogramGenerator.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToHistogramGenerator.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToHistogramGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToHistogramGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -91,7 +91,7 @@ protected: ScalarImageToHistogramGenerator(); virtual ~ScalarImageToHistogramGenerator() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -196,19 +196,19 @@ protected: ScalarImageToRunLengthFeaturesFilter(); virtual ~ScalarImageToRunLengthFeaturesFilter() {} - void PrintSelf( std::ostream & os, Indent indent ) const; + virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE; void FastCompute(); void FullCompute(); /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Make a DataObject to be used for output output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; private: typename RunLengthMatrixFilterType::Pointer m_RunLengthMatrixGenerator; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthFeaturesFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -168,7 +168,7 @@ M(1) = x(1), M(k) = M(k-1) + (x(k) - M(k-1) ) / k S(1) = 0, S(k) = S(k-1) + (x(k) - M(k-1)) * (x(k) - M(k)) for 2 <= k <= n, then - sigma = vcl_sqrt(S(n) / n) (or divide by n-1 for sample SD instead of + sigma = std::sqrt(S(n) / n) (or divide by n-1 for sample SD instead of population SD). */ @@ -197,7 +197,7 @@ } for( featureNum = 0; featureNum < numFeatures; featureNum++ ) { - tempFeatureDevs[featureNum] = vcl_sqrt( tempFeatureDevs[featureNum] / + tempFeatureDevs[featureNum] = std::sqrt( tempFeatureDevs[featureNum] / numOffsets ); this->m_FeatureMeans->push_back( tempFeatureMeans[featureNum] ); @@ -320,7 +320,7 @@ { if ( this->GetNumberOfInputs() < 1 ) { - return 0; + return ITK_NULLPTR; } return static_cast( this->ProcessObject::GetInput( 0 ) ); } @@ -354,7 +354,7 @@ { if ( this->GetNumberOfInputs() < 2 ) { - return 0; + return ITK_NULLPTR; } return static_cast< const ImageType *>( this->ProcessObject::GetInput( 1 ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -233,17 +233,17 @@ protected: ScalarImageToRunLengthMatrixFilter(); virtual ~ScalarImageToRunLengthMatrixFilter() {}; - void PrintSelf( std::ostream& os, Indent indent ) const; + virtual void PrintSelf( std::ostream& os, Indent indent ) const ITK_OVERRIDE; /** Standard itk::ProcessObject subclass method. */ typedef DataObject::Pointer DataObjectPointer; typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ); + virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType idx ) ITK_OVERRIDE; /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** * Normalize the direction of the offset before it is applied. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -93,7 +93,7 @@ { if( this->GetNumberOfInputs() < 1 ) { - return 0; + return ITK_NULLPTR; } return static_cast( this->ProcessObject::GetInput( 0 ) ); } @@ -105,7 +105,7 @@ { if( this->GetNumberOfInputs() < 2 ) { - return 0; + return ITK_NULLPTR; } return static_cast( this->ProcessObject::GetInput( 1 ) ); } @@ -153,6 +153,7 @@ output->Initialize( size, this->m_LowerBound, this->m_UpperBound ); MeasurementVectorType run( output->GetMeasurementVectorSize() ); + typename HistogramType::IndexType hIndex; // Iterate over all of those pixels and offsets, adding each // distance/intensity pair to the histogram @@ -270,7 +271,8 @@ if( run[1] >= this->m_MinDistance && run[1] <= this->m_MaxDistance ) { - output->IncreaseFrequencyOfMeasurement( run, 1 ); + output->GetIndex( run, hIndex ); + output->IncreaseFrequencyOfIndex( hIndex, 1 ); itkDebugStatement(typename HistogramType::IndexType tempMeasurementIndex;) itkDebugStatement(output->GetIndex(run,tempMeasurementIndex);) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -198,19 +198,19 @@ protected: ScalarImageToTextureFeaturesFilter(); virtual ~ScalarImageToTextureFeaturesFilter() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void FastCompute(); void FullCompute(); /** This method causes the filter to generate its output. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Make a DataObject to be used for output output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType) ITK_OVERRIDE; private: typename CooccurrenceMatrixFilterType::Pointer m_GLCMGenerator; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkScalarImageToTextureFeaturesFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -145,7 +145,7 @@ M(1) = x(1), M(k) = M(k-1) + (x(k) - M(k-1) ) / k S(1) = 0, S(k) = S(k-1) + (x(k) - M(k-1)) * (x(k) - M(k)) for 2 <= k <= n, then - sigma = vcl_sqrt(S(n) / n) (or divide by n-1 for sample SD instead of + sigma = std::sqrt(S(n) / n) (or divide by n-1 for sample SD instead of population SD). */ @@ -174,7 +174,7 @@ } for ( featureNum = 0; featureNum < numFeatures; featureNum++ ) { - tempFeatureDevs[featureNum] = vcl_sqrt(tempFeatureDevs[featureNum] / numOffsets); + tempFeatureDevs[featureNum] = std::sqrt(tempFeatureDevs[featureNum] / numOffsets); m_FeatureMeans->push_back(tempFeatureMeans[featureNum]); m_FeatureStandardDeviations->push_back(tempFeatureDevs[featureNum]); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSparseFrequencyContainer2.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSparseFrequencyContainer2.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSparseFrequencyContainer2.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSparseFrequencyContainer2.h 2014-09-03 08:29:34.000000000 +0000 @@ -98,7 +98,7 @@ protected: SparseFrequencyContainer2(); virtual ~SparseFrequencyContainer2() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: SparseFrequencyContainer2(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -98,16 +98,16 @@ StandardDeviationPerComponentSampleFilter(); virtual ~StandardDeviationPerComponentSampleFilter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** DataObject pointer */ typedef DataObject::Pointer DataObjectPointer; typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; MeasurementVectorSizeType GetMeasurementVectorSize() const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStandardDeviationPerComponentSampleFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -195,7 +195,7 @@ mean[i] = meanValue; const double variance = ( sumOfSquares[i] - meanValue * meanValue * totalFrequency ) / ( totalFrequency - 1.0 ); - standardDeviation[i] = vcl_sqrt(variance); + standardDeviation[i] = std::sqrt(variance); } decoratedStandardDeviationOutput->Set(standardDeviation); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.h 2014-09-03 08:29:34.000000000 +0000 @@ -34,13 +34,29 @@ template< typename TValue > TValue MedianOfThree(const TValue a, const TValue b, const TValue c); +/** Finds the minimum and maximum of each measurement value, over an interval + * within a sample. + * + * Samples are considered independently of each other. + * + * \param[in] sample An instance of TSample. + * \param[in] begin An iterator to the first measurement vector in sample to be + * considered. + * \param[in] end An iterator to the last measurement vector in sample to be + * considered. + * \param[out] min A new measurement vector, with the minimum values. + * \param[out] max A new measurement vector, with the maximum values. + * + * \tparam TSample A subtype of Statistics::Sample. + */ template< typename TSample > void FindSampleBound(const TSample * sample, - typename TSample::ConstIterator begin, - typename TSample::ConstIterator end, + const typename TSample::ConstIterator & begin, + const typename TSample::ConstIterator & end, typename TSample::MeasurementVectorType & min, typename TSample::MeasurementVectorType & max); +/** The endIndex should points one point after the last elements. */ template< typename TSubsample > void FindSampleBoundAndMean(const TSubsample * sample, int beginIndex, @@ -49,9 +65,10 @@ typename TSubsample::MeasurementVectorType & max, typename TSubsample::MeasurementVectorType & mean); -/** The Partition algorithm performs partial sorting in a sample. Given a - * partitionValue, the algorithm moves to the beginning of the sample all - * MeasurementVectors whose component activeDimension is smaller than the +/** The Partition algorithm performs partial sorting in a sample. + * + * Given a partitionValue, the algorithm moves to the beginning of the sample + * all MeasurementVectors whose component activeDimension is smaller than the * partitionValue. In this way, the sample is partially sorted in two groups. * First the group with activeDimension component smaller than the * partitionValue, then the group of MeasurementVectors with activeDimension @@ -60,7 +77,15 @@ * Only the activeDimension components of the MeasurementVectors in the sample * will be considered by the algorithm. The Algorithm return an index in the * range of [beginIndex,endIndex] pointing to the element with activeDimension - * component closest to the partitionValue. */ + * component closest to the partitionValue. + * + * The endIndex should points one point after the last elements if multiple + * partitionValue exist in the sample the return index will points the middle + * of such values. Implemented following the description of the partition + * algorithm in the QuickSelect entry of the Wikipedia. + * + * \sa http://en.wikipedia.org/wiki/Selection_algorithm. + */ template< typename TSubsample > int Partition(TSubsample *sample, unsigned int activeDimension, @@ -68,13 +93,22 @@ const typename TSubsample::MeasurementType partitionValue); /** QuickSelect is an algorithm for finding the k-th largest element of a list. + * * In this case, only one of the components of the measurement vectors is * considered. This component is defined by the argument activeDimension. The * search is rectricted to the range between the index begin and end, also - * passed as arguments. In this version, a guess value for the median index is - * provided in the argument medianGuess. The algorithm returns the value of the - * activeDimension component in the MeasurementVector located in the kth position. - * http://en.wikipedia.org/wiki/Selection_algorithm */ + * passed as arguments. + * + * The endIndex should point one point after the last elements. Note that kth + * is an index in a different scale than [beginIndex,endIndex]. For example, + * it is possible to feed this function with beginIndex=15, endIndex=23, and + * kth=3, since we can ask for the element 3rd in the range [15,23]. + * In this version, a guess value for the median index is provided in the + * argument medianGuess. The algorithm returns the value of the activeDimension + * component in the MeasurementVector located in the kth position. + * + * \sa http://en.wikipedia.org/wiki/Selection_algorithm + */ template< typename TSubsample > typename TSubsample::MeasurementType QuickSelect(TSubsample * sample, @@ -84,11 +118,19 @@ typename TSubsample::MeasurementType medianGuess); /** QuickSelect is an algorithm for finding the k-th largest element of a list. + * * In this case, only one of the components of the measurement vectors is * considered. This component is defined by the argument activeDimension. The * search is rectricted to the range between the index begin and end, also * passed as arguments. - * http://en.wikipedia.org/wiki/Selection_algorithm. */ + * + * The endIndex should point one point after the last elements. Note that kth + * is an index in a different scale than [beginIndex,endIndex]. For example, + * it is possible to feed this function with beginIndex=15, endIndex=23, and + * kth=3, since we can ask for the element 3rd in the range [15,23]. + * + * \sa http://en.wikipedia.org/wiki/Selection_algorithm. + */ template< typename TSubsample > typename TSubsample::MeasurementType QuickSelect(TSubsample *sample, @@ -97,11 +139,13 @@ int kth); /** NthElement is an algorithm for finding the n-th largest element of a list. + * * In this case, only one of the components of the measurement vectors is * considered. This component is defined by the argument activeDimension. The * search is restricted to the range between the index begin and end, also * passed as arguments. This algorithm was based on the procedure used in the STL - * nth_element method. */ + * nth_element method. + */ template< typename TSubsample > typename TSubsample::MeasurementType NthElement(TSubsample *sample, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkStatisticsAlgorithm.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,11 +40,6 @@ return k; } -/** The endIndex should points one point after the last elements if multiple - * partitionValue exist in the sample the return index will points the middle - * of such values. Implemented following the description of the partition - * algorithm in the QuickSelect entry of the Wikipedia. - * http://en.wikipedia.org/wiki/Selection_algorithm. */ template< typename TSubsample > inline int Partition(TSubsample *sample, unsigned int activeDimension, @@ -245,23 +240,23 @@ template< typename TSample > inline void FindSampleBound(const TSample *sample, - typename TSample::ConstIterator begin, - typename TSample::ConstIterator end, + const typename TSample::ConstIterator & begin, + const typename TSample::ConstIterator & end, typename TSample::MeasurementVectorType & min, typename TSample::MeasurementVectorType & max) { typedef typename TSample::MeasurementVectorSizeType MeasurementVectorSizeType; - const MeasurementVectorSizeType Dimension = sample->GetMeasurementVectorSize(); - if ( Dimension == 0 ) + const MeasurementVectorSizeType measurementSize = sample->GetMeasurementVectorSize(); + if ( measurementSize == 0 ) { itkGenericExceptionMacro( << "Length of a sample's measurement vector hasn't been set."); } // Sanity check - MeasurementVectorTraits::Assert(max, Dimension, + MeasurementVectorTraits::Assert(max, measurementSize, "Length mismatch StatisticsAlgorithm::FindSampleBound"); - MeasurementVectorTraits::Assert(min, Dimension, + MeasurementVectorTraits::Assert(min, measurementSize, "Length mismatch StatisticsAlgorithm::FindSampleBound"); if ( sample->Size() == 0 ) @@ -271,33 +266,31 @@ measurement vectors"); } - unsigned int dimension; - typename TSample::MeasurementVectorType temp; + min = begin.GetMeasurementVector(); + max = min; - min = max = temp = begin.GetMeasurementVector(); - while ( true ) + typename TSample::ConstIterator measurementItr = begin; + // increment measurementItr once, since min and max are already set to the 0th measurement + ++measurementItr; + for(; measurementItr != end; ++measurementItr ) { - for ( dimension = 0; dimension < Dimension; dimension++ ) + const typename TSample::MeasurementVectorType & currentMeasure = + measurementItr.GetMeasurementVector(); + + for ( MeasurementVectorSizeType dimension = 0; dimension < measurementSize; ++dimension ) { - if ( temp[dimension] < min[dimension] ) + if ( currentMeasure[dimension] < min[dimension] ) { - min[dimension] = temp[dimension]; + min[dimension] = currentMeasure[dimension]; } - else if ( temp[dimension] > max[dimension] ) + else if ( currentMeasure[dimension] > max[dimension] ) { - max[dimension] = temp[dimension]; + max[dimension] = currentMeasure[dimension]; } } - ++begin; - if ( begin == end ) - { - break; - } - temp = begin.GetMeasurementVector(); - } // end of while + } } -/** The endIndex should points one point after the last elements. */ template< typename TSubsample > inline void FindSampleBoundAndMean(const TSubsample *sample, @@ -358,11 +351,6 @@ } } -/** The endIndex should point one point after the last elements. Note that kth - * is an index in a different scale than [beginIndex,endIndex]. For example, - * it is possible to feed this function with beginIndex=15, endIndex=23, and - * kth=3, since we can ask for the element 3rd in the range [15,23]. */ - template< typename TSubsample > inline typename TSubsample::MeasurementType QuickSelect(TSubsample *sample, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsample.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsample.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsample.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsample.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ Subsample< TSample > ::Subsample() { - m_Sample = 0; + m_Sample = ITK_NULLPTR; m_TotalFrequency = NumericTraits< AbsoluteFrequencyType >::Zero; m_ActiveDimension = 0; } @@ -43,7 +43,7 @@ Superclass::PrintSelf(os, indent); os << indent << "Sample: "; - if ( m_Sample != 0 ) + if ( m_Sample != ITK_NULLPTR ) { os << m_Sample << std::endl; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -114,12 +114,12 @@ * This does a complete copy of the subsampler state * to the new subsampler */ - virtual typename LightObject::Pointer InternalClone() const; + virtual typename LightObject::Pointer InternalClone() const ITK_OVERRIDE; SubsamplerBase(); virtual ~SubsamplerBase() {}; - virtual void PrintSelf(std::ostream& os, Indent indent) const; + virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE; SampleConstPointer m_Sample; bool m_RequestMaximumNumberOfResults; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkSubsamplerBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ SubsamplerBase ::SubsamplerBase() { - m_Sample = NULL; + m_Sample = ITK_NULLPTR; m_RequestMaximumNumberOfResults = true; m_CanSelectQuery = true; m_Seed = 0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkTDistribution.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkTDistribution.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkTDistribution.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkTDistribution.h 2014-09-03 08:29:34.000000000 +0000 @@ -72,16 +72,16 @@ /** Return the number of parameters. For a univariate Student-t * distribution, the number of parameters is 1 (degrees of freedom) */ - virtual SizeValueType GetNumberOfParameters() const { return 1; } + virtual SizeValueType GetNumberOfParameters() const ITK_OVERRIDE { return 1; } /** Evaluate the probability density function (pdf). The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluatePDF(double x) const; + virtual double EvaluatePDF(double x) const ITK_OVERRIDE; /** Evaluate the probability density function (pdf). The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (degrees of freedom). */ - virtual double EvaluatePDF(double x, const ParametersType &) const; + virtual double EvaluatePDF(double x, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the probability density function (pdf). The parameters * of the distribution are passed as separate parameters. */ @@ -89,12 +89,12 @@ /** Evaluate the cumulative distribution function (cdf). The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluateCDF(double x) const; + virtual double EvaluateCDF(double x) const ITK_OVERRIDE; /** Evaluate the cumulative distribution function (cdf). The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (degreesOfFreedom). */ - virtual double EvaluateCDF(double x, const ParametersType &) const; + virtual double EvaluateCDF(double x, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the cumulative distribution function (cdf). The parameters * of the distribution are passed as separate parameters. */ @@ -103,13 +103,13 @@ /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters * of the distribution are assigned via SetParameters(). */ - virtual double EvaluateInverseCDF(double p) const; + virtual double EvaluateInverseCDF(double p) const ITK_OVERRIDE; /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters * for the distribution are passed as a parameters vector. The * ordering of the parameters is (degrees of freedom). */ - virtual double EvaluateInverseCDF(double p, const ParametersType &) const; + virtual double EvaluateInverseCDF(double p, const ParametersType &) const ITK_OVERRIDE; /** Evaluate the inverse cumulative distribution function (inverse * cdf). Parameter p must be between 0.0 and 1.0. The parameters @@ -125,18 +125,18 @@ virtual SizeValueType GetDegreesOfFreedom() const; /** Does the Student-t distribution have a mean? */ - virtual bool HasMean() const { return true; } + virtual bool HasMean() const ITK_OVERRIDE { return true; } /** Get the mean of the distribution. */ - virtual double GetMean() const; + virtual double GetMean() const ITK_OVERRIDE; /** Does the Student-t distribution have a variance? Variance is * only defined for degrees of freedom greater than 2 */ - virtual bool HasVariance() const; + virtual bool HasVariance() const ITK_OVERRIDE; /** Get the variance of the distribution. If the variance does not exist, * then quiet_NaN is returned. */ - virtual double GetVariance() const; + virtual double GetVariance() const ITK_OVERRIDE; /** Static method to evaluate the probability density function (pdf) * of a Student-t with a specified number of degrees of freedom. The @@ -200,7 +200,7 @@ TDistribution(void); virtual ~TDistribution(void) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: TDistribution(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkVectorContainerToListSampleAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkVectorContainerToListSampleAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkVectorContainerToListSampleAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkVectorContainerToListSampleAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ VectorContainerToListSampleAdaptor ::VectorContainerToListSampleAdaptor() { - this->m_VectorContainer = 0; + this->m_VectorContainer = ITK_NULLPTR; } template diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -54,27 +54,23 @@ itkTypeMacro(WeightedCovarianceSampleFilter, CovarianceSampleFilter); itkNewMacro(Self); - /** Traits derived from the base class */ + /** Types derived from the base class */ typedef typename Superclass::SampleType SampleType; typedef typename Superclass::MeasurementVectorType MeasurementVectorType; typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; - typedef typename Superclass::MeasurementVectorDecoratedType MeasurementVectorDecoratedType; - typedef typename Superclass::OutputType OutputType; - typedef typename Superclass::MeasurementRealType MeasurementRealType; + typedef typename Superclass::MeasurementType MeasurementType; + + /** Types derived from the base class */ typedef typename Superclass::MeasurementVectorRealType MeasurementVectorRealType; + typedef typename Superclass::MeasurementRealType MeasurementRealType; - /** Typedef for WeightedCovariance output */ - typedef VariableSizeMatrix< double > MatrixType; - /** Weight calculation function typedef */ - typedef FunctionBase< MeasurementVectorType, double > WeightingFunctionType; + /** Type of weight values */ + typedef double WeightValueType; - /** VariableSizeMatrix is not a DataObject, we need to decorate it to push it down - * a ProcessObject's pipeline */ - typedef SimpleDataObjectDecorator< MatrixType > MatrixDecoratedType; - /** Array typedef for weights */ - typedef Array< double > WeightArrayType; + /** Array type for weights */ + typedef Array< WeightValueType > WeightArrayType; /** Type of DataObjects to use for the weight array type */ typedef SimpleDataObjectDecorator< WeightArrayType > InputWeightArrayObjectType; @@ -82,12 +78,25 @@ /** Method to set the input value of the weight array */ itkSetGetDecoratedInputMacro(Weights, WeightArrayType); + + /** Weight calculation function type */ + typedef FunctionBase< MeasurementVectorType, WeightValueType > WeightingFunctionType; + /** Type of DataObjects to use for Weight function */ typedef DataObjectDecorator< WeightingFunctionType > InputWeightingFunctionObjectType; - /** Method to set the weighting function */ + /** Method to set/get the weighting function */ itkSetGetDecoratedObjectInputMacro(WeightingFunction, WeightingFunctionType); + + /** Types derived from the base class */ + typedef typename Superclass::MatrixType MatrixType; + typedef typename Superclass::MatrixDecoratedType MatrixDecoratedType; + + /** Types derived from the base class */ + typedef typename Superclass::MeasurementVectorDecoratedType MeasurementVectorDecoratedType; + typedef typename Superclass::OutputType OutputType; + protected: WeightedCovarianceSampleFilter(); virtual ~WeightedCovarianceSampleFilter(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedCovarianceSampleFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ WeightedCovarianceSampleFilter< TSample > ::WeightedCovarianceSampleFilter() { - this->ProcessObject::SetNthInput(1, NULL); + this->ProcessObject::SetNthInput(1, ITK_NULLPTR); } template< typename TSample > @@ -58,7 +58,7 @@ const InputWeightingFunctionObjectType *functionObject = this->GetWeightingFunctionInput(); - if ( functionObject != NULL ) + if ( functionObject != ITK_NULLPTR ) { this->ComputeCovarianceMatrixWithWeightingFunction(); return; @@ -68,7 +68,7 @@ const InputWeightArrayObjectType *weightArrayObject = this->GetWeightsInput(); - if ( weightArrayObject != NULL ) + if ( weightArrayObject != ITK_NULLPTR ) { this->ComputeCovarianceMatrixWithWeights(); return; @@ -84,96 +84,100 @@ WeightedCovarianceSampleFilter< TSample > ::ComputeCovarianceMatrixWithWeightingFunction() { + // set up input / output const SampleType *input = this->GetInput(); - MeasurementVectorSizeType measurementVectorSize = - input->GetMeasurementVectorSize(); + MeasurementVectorSizeType measurementVectorSize = input->GetMeasurementVectorSize(); MatrixDecoratedType *decoratedOutput = - itkDynamicCastInDebugMode< MatrixDecoratedType * >( - this->ProcessObject::GetOutput(0) ); + itkDynamicCastInDebugMode< MatrixDecoratedType * >( this->ProcessObject::GetOutput(0) ); MatrixType output = decoratedOutput->Get(); + output.SetSize( measurementVectorSize, measurementVectorSize ); + output.Fill( NumericTraits< typename MatrixType::ValueType >::Zero ); MeasurementVectorDecoratedType *decoratedMeanOutput = - itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >( - this->ProcessObject::GetOutput(1) ); + itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >( this->ProcessObject::GetOutput(1) ); - output.SetSize(measurementVectorSize, measurementVectorSize); - output.Fill(0.0); + // calculate mean + const WeightingFunctionType * const weightingFunction = this->GetWeightingFunction(); - // if weighting function is specifed, use it to compute the mean - const InputWeightingFunctionObjectType *functionObject = this->GetWeightingFunctionInput(); - const WeightingFunctionType *weightFunction = functionObject->Get(); - - typedef WeightedMeanSampleFilter< TSample > WeightedMeanSampleFilterType; - typename WeightedMeanSampleFilterType::Pointer meanFilter = WeightedMeanSampleFilterType::New(); + typedef WeightedMeanSampleFilter< SampleType > WeightedMeanFilterType; + typename WeightedMeanFilterType::Pointer meanFilter = WeightedMeanFilterType::New(); meanFilter->SetInput( input ); - meanFilter->SetWeightingFunction( weightFunction ); + meanFilter->SetWeightingFunction( weightingFunction ); meanFilter->Update(); - const MeasurementVectorRealType mean = meanFilter->GetMean(); + const typename WeightedMeanFilterType::MeasurementVectorRealType mean = meanFilter->GetMean(); + decoratedMeanOutput->Set( mean ); + // covariance algorithm MeasurementVectorRealType diff; - NumericTraits::SetLength(diff, measurementVectorSize); - MeasurementVectorType measurements; - NumericTraits::SetLength(measurements, measurementVectorSize); - - double weight; - double totalWeight = 0.0; - double sumSquaredWeight = 0.0; + NumericTraits::SetLength( diff, measurementVectorSize ); + WeightValueType totalWeight = NumericTraits< WeightValueType >::Zero; - decoratedMeanOutput->Set( mean ); + WeightValueType totalSquaredWeight = NumericTraits< WeightValueType >::Zero; - typename TSample::ConstIterator iter = input->Begin(); - typename TSample::ConstIterator end = input->End(); + typename SampleType::ConstIterator iter = input->Begin(); + const typename SampleType::ConstIterator end = input->End(); // fills the lower triangle and the diagonal cells in the covariance matrix - while ( iter != end ) + for (; iter != end; ++iter ) { - measurements = iter.GetMeasurementVector(); - weight = iter.GetFrequency() * weightFunction->Evaluate(measurements); + const MeasurementVectorType & measurement = iter.GetMeasurementVector(); + + const typename SampleType::AbsoluteFrequencyType frequency = iter.GetFrequency(); + + const WeightValueType rawWeight = weightingFunction->Evaluate( measurement ); + + const WeightValueType weight = ( rawWeight * static_cast< WeightValueType >( frequency ) ); totalWeight += weight; - sumSquaredWeight += weight * weight; - for ( unsigned int i = 0; i < measurementVectorSize; ++i ) + totalSquaredWeight += ( weight * weight ); + + for ( unsigned int dim = 0; dim < measurementVectorSize; ++dim ) { - diff[i] = static_cast< MeasurementRealType >( measurements[i] ) - mean[i]; + const MeasurementRealType component = + static_cast< MeasurementRealType >( measurement[dim] ); + + diff[dim] = ( component - mean[dim] ); } // updates the covariance matrix - for ( unsigned int row = 0; row < measurementVectorSize; row++ ) + for ( unsigned int row = 0; row < measurementVectorSize; ++row ) { - for ( unsigned int col = 0; col < row + 1; col++ ) + for ( unsigned int col = 0; col < row + 1; ++col ) { - output(row, col) += weight * diff[row] * diff[col]; + output(row, col) += + ( static_cast< MeasurementRealType >( weight ) * diff[row] * diff[col] ); } } - ++iter; } // fills the upper triangle using the lower triangle - for ( unsigned int row = 1; row < measurementVectorSize; row++ ) + for ( unsigned int row = 1; row < measurementVectorSize; ++row ) { - for ( unsigned int col = 0; col < row; col++ ) + for ( unsigned int col = 0; col < row; ++col ) { output(col, row) = output(row, col); } } - const double normalizationFactor = ( totalWeight - ( sumSquaredWeight / totalWeight ) ); + const double normalizationFactor = ( totalWeight - ( totalSquaredWeight / totalWeight ) ); if( normalizationFactor > vnl_math::eps ) { - output /= normalizationFactor; + const double inverseNormalizationFactor = 1.0 / normalizationFactor; + + output *= inverseNormalizationFactor; } else { itkExceptionMacro("Normalization factor was too close to zero. Value = " << normalizationFactor ); } - decoratedOutput->Set(output); + decoratedOutput->Set( output ); } template< typename TSample > @@ -181,64 +185,66 @@ WeightedCovarianceSampleFilter< TSample > ::ComputeCovarianceMatrixWithWeights() { + // set up input / output const SampleType *input = this->GetInput(); - const MeasurementVectorSizeType measurementVectorSize = - input->GetMeasurementVectorSize(); + MeasurementVectorSizeType measurementVectorSize = input->GetMeasurementVectorSize(); - MatrixDecoratedType * const decoratedOutput = - itkDynamicCastInDebugMode< MatrixDecoratedType * >( - this->ProcessObject::GetOutput(0) ); + MatrixDecoratedType *decoratedOutput = + itkDynamicCastInDebugMode< MatrixDecoratedType * >( this->ProcessObject::GetOutput(0) ); MatrixType output = decoratedOutput->Get(); + output.SetSize( measurementVectorSize, measurementVectorSize ); + output.Fill( NumericTraits< typename MatrixType::ValueType >::Zero ); - MeasurementVectorDecoratedType * const decoratedMeanOutput = - itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >( - this->ProcessObject::GetOutput(1) ); - - output.SetSize(measurementVectorSize, measurementVectorSize); - output.Fill(0.0); + MeasurementVectorDecoratedType *decoratedMeanOutput = + itkDynamicCastInDebugMode< MeasurementVectorDecoratedType * >( this->ProcessObject::GetOutput(1) ); - const InputWeightArrayObjectType *weightArrayObject = this->GetWeightsInput(); - const WeightArrayType weightArray = weightArrayObject->Get(); + // calculate mean + const WeightArrayType & weightsArray = this->GetWeights(); - typedef WeightedMeanSampleFilter< TSample > WeightedMeanSampleFilterType; - typename WeightedMeanSampleFilterType::Pointer meanFilter = WeightedMeanSampleFilterType::New(); + typedef WeightedMeanSampleFilter< SampleType > WeightedMeanFilterType; + typename WeightedMeanFilterType::Pointer meanFilter = WeightedMeanFilterType::New(); meanFilter->SetInput( input ); - meanFilter->SetWeights( weightArray ); + meanFilter->SetWeights( weightsArray ); meanFilter->Update(); - const MeasurementVectorRealType mean = meanFilter->GetMean(); - - decoratedMeanOutput->Set(mean); + const typename WeightedMeanFilterType::MeasurementVectorRealType mean = meanFilter->GetMean(); + decoratedMeanOutput->Set( mean ); + // covariance algorithm MeasurementVectorRealType diff; - NumericTraits::SetLength(diff, measurementVectorSize); - MeasurementVectorType measurements; - NumericTraits::SetLength(measurements, measurementVectorSize); + NumericTraits::SetLength( diff, measurementVectorSize ); - double totalWeight = 0.0; - double sumSquaredWeight = 0.0; + WeightValueType totalWeight = NumericTraits< WeightValueType >::Zero; - unsigned int measurementVectorIndex = 0; + WeightValueType totalSquaredWeight = NumericTraits< WeightValueType >::Zero; - typename TSample::ConstIterator iter = input->Begin(); - typename TSample::ConstIterator end = input->End(); + typename SampleType::ConstIterator iter = input->Begin(); + const typename SampleType::ConstIterator end = input->End(); // fills the lower triangle and the diagonal cells in the covariance matrix - measurementVectorIndex = 0; - while ( iter != end ) + for ( unsigned int sampleVectorIndex = 0; + iter != end; + ++iter, ++sampleVectorIndex ) { - const double weight = iter.GetFrequency() * ( weightArray )[measurementVectorIndex]; - measurements = iter.GetMeasurementVector(); + const MeasurementVectorType & measurement = iter.GetMeasurementVector(); + + const typename SampleType::AbsoluteFrequencyType frequency = iter.GetFrequency(); + + const WeightValueType rawWeight = weightsArray[sampleVectorIndex]; + const WeightValueType weight = ( rawWeight * static_cast< WeightValueType >( frequency ) ); totalWeight += weight; - sumSquaredWeight += weight * weight; + totalSquaredWeight += ( weight * weight ); - for ( unsigned int i = 0; i < measurementVectorSize; ++i ) + for ( unsigned int dim = 0; dim < measurementVectorSize; ++dim ) { - diff[i] = static_cast< MeasurementRealType >( measurements[i] ) - mean[i]; + const MeasurementRealType component = + static_cast< MeasurementRealType >( measurement[dim] ); + + diff[dim] = ( component - mean[dim] ); } // updates the covariance matrix @@ -246,11 +252,10 @@ { for ( unsigned int col = 0; col < row + 1; ++col ) { - output(row, col) += weight * diff[row] * diff[col]; + output(row, col) += + ( static_cast< MeasurementRealType >( weight ) * diff[row] * diff[col] ); } } - ++iter; - ++measurementVectorIndex; } // fills the upper triangle using the lower triangle @@ -262,18 +267,20 @@ } } - const double normalizationFactor = ( totalWeight - ( sumSquaredWeight / totalWeight ) ); + const double normalizationFactor = ( totalWeight - ( totalSquaredWeight / totalWeight ) ); if( normalizationFactor > vnl_math::eps ) { - output /= normalizationFactor; + const double inverseNormalizationFactor = 1.0 / normalizationFactor; + + output *= inverseNormalizationFactor; } else { itkExceptionMacro("Normalization factor was too close to zero. Value = " << normalizationFactor ); } - decoratedOutput->Set(output); + decoratedOutput->Set( output ); } } // end of namespace Statistics } // end of namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.h otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -52,34 +52,45 @@ itkTypeMacro(WeightedMeanSampleFilter, MeanSampleFilter); itkNewMacro(Self); - /** Traits derived from the base class */ + /** Types derived from the base class */ typedef typename Superclass::SampleType SampleType; - typedef typename Superclass::MeasurementType MeasurementType; typedef typename Superclass::MeasurementVectorType MeasurementVectorType; typedef typename Superclass::MeasurementVectorSizeType MeasurementVectorSizeType; - typedef typename Superclass::MeasurementVectorDecoratedType MeasurementVectorDecoratedType; - typedef typename Superclass::OutputType OutputType; - typedef typename Superclass::MeasurementRealType MeasurementRealType; + typedef typename Superclass::MeasurementType MeasurementType; + + /** Types derived from the base class */ typedef typename Superclass::MeasurementVectorRealType MeasurementVectorRealType; + typedef typename Superclass::MeasurementRealType MeasurementRealType; + - /** Array typedef for weights */ - typedef Array< double > WeightArrayType; + /** Type of weight values */ + typedef double WeightValueType; + + + /** Array type for weights */ + typedef Array< WeightValueType > WeightArrayType; /** Type of DataObjects to use for the weight array type */ typedef SimpleDataObjectDecorator< WeightArrayType > InputWeightArrayObjectType; - /** Method to set the input value of the weight array */ + /** Method to set/get the input value of the weight array */ itkSetGetDecoratedInputMacro(Weights, WeightArrayType); - /** Weight calculation function typedef */ - typedef FunctionBase< MeasurementVectorType, double > WeightingFunctionType; + + /** Weight calculation function type */ + typedef FunctionBase< MeasurementVectorType, WeightValueType > WeightingFunctionType; /** Type of DataObjects to use for Weight function */ typedef DataObjectDecorator< WeightingFunctionType > InputWeightingFunctionObjectType; - /** Method to set the weighting function */ + /** Method to set/get the weighting function */ itkSetGetDecoratedObjectInputMacro(WeightingFunction, WeightingFunctionType); + + /** Types derived from the base class */ + typedef typename Superclass::MeasurementVectorDecoratedType MeasurementVectorDecoratedType; + typedef typename Superclass::OutputType OutputType; + protected: WeightedMeanSampleFilter(); virtual ~WeightedMeanSampleFilter(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/include/itkWeightedMeanSampleFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -18,9 +18,12 @@ #ifndef __itkWeightedMeanSampleFilter_hxx #define __itkWeightedMeanSampleFilter_hxx -#include "itkMeasurementVectorTraits.h" #include "itkWeightedMeanSampleFilter.h" +#include +#include "itkCompensatedSummation.h" +#include "itkMeasurementVectorTraits.h" + namespace itk { namespace Statistics @@ -29,7 +32,7 @@ WeightedMeanSampleFilter< TSample > ::WeightedMeanSampleFilter() { - this->ProcessObject::SetNthInput(1, NULL); + this->ProcessObject::SetNthInput(1, ITK_NULLPTR); } template< typename TSample > @@ -58,7 +61,7 @@ const InputWeightingFunctionObjectType *functionObject = this->GetWeightingFunctionInput(); - if ( functionObject != NULL ) + if ( functionObject != ITK_NULLPTR ) { this->ComputeMeanWithWeightingFunction(); return; @@ -68,7 +71,7 @@ const InputWeightArrayObjectType *weightArrayObject = this->GetWeightsInput(); - if ( weightArrayObject != NULL ) + if ( weightArrayObject != ITK_NULLPTR ) { this->ComputeMeanWithWeights(); return; @@ -83,9 +86,10 @@ WeightedMeanSampleFilter< TSample > ::ComputeMeanWithWeights() { + // set up input / output const SampleType *input = this->GetInput(); - MeasurementVectorSizeType measurementVectorSize = + const MeasurementVectorSizeType measurementVectorSize = input->GetMeasurementVectorSize(); MeasurementVectorDecoratedType *decoratedOutput = @@ -96,51 +100,44 @@ NumericTraits::SetLength( output, this->GetMeasurementVectorSize() ); - //reset the output - for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) - { - output[dim] = NumericTraits< MeasurementRealType >::Zero; - } - - typedef typename NumericTraits< - MeasurementRealType >::AccumulateType MeasurementRealAccumulateType; + // algorithm start + typedef CompensatedSummation< MeasurementRealType > MeasurementRealAccumulateType; + std::vector< MeasurementRealAccumulateType > sum( measurementVectorSize ); - Array< MeasurementRealAccumulateType > sum( measurementVectorSize ); - sum.Fill( NumericTraits< MeasurementRealAccumulateType >::Zero ); + const WeightArrayType & weightsArray = this->GetWeights(); + WeightValueType totalWeight = NumericTraits< WeightValueType >::Zero; - typename TSample::ConstIterator iter = input->Begin(); - typename TSample::ConstIterator end = input->End(); - double totalWeight = 0.0; - double weight; + typename SampleType::ConstIterator iter = input->Begin(); + typename SampleType::ConstIterator end = input->End(); - typename TSample::MeasurementVectorType measurements; + for ( unsigned int sampleVectorIndex = 0; + iter != end; + ++iter, ++sampleVectorIndex ) + { + const MeasurementVectorType & measurement = iter.GetMeasurementVector(); - const InputWeightArrayObjectType *weightArrayObject = this->GetWeightsInput(); - const WeightArrayType weightArray = weightArrayObject->Get(); + const typename SampleType::AbsoluteFrequencyType frequency = iter.GetFrequency(); - int measurementVectorIndex = 0; + const WeightValueType rawWeight = weightsArray[sampleVectorIndex]; - while ( iter != end ) - { - measurements = iter.GetMeasurementVector(); - weight = iter.GetFrequency() * ( weightArray )[measurementVectorIndex]; + const WeightValueType weight = ( rawWeight * static_cast< WeightValueType >( frequency ) ); totalWeight += weight; for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) { - const MeasurementRealType component = static_cast< MeasurementRealType >( measurements[dim] ); - sum[dim] += static_cast< MeasurementRealAccumulateType >( component * weight ); + const MeasurementRealType component = + static_cast< MeasurementRealType >( measurement[dim] ); + + sum[dim] += ( component * weight ); } - ++measurementVectorIndex; - ++iter; } if ( totalWeight > vnl_math::eps ) { for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) { - output[dim] = static_cast< MeasurementRealType >( sum[dim] / totalWeight ); + output[dim] = ( sum[dim].GetSum() / static_cast< MeasurementRealType >( totalWeight ) ); } } else @@ -148,7 +145,7 @@ itkExceptionMacro("Total weight was too close to zero. Value = " << totalWeight ); } - decoratedOutput->Set(output); + decoratedOutput->Set( output ); } template< typename TSample > @@ -156,9 +153,10 @@ WeightedMeanSampleFilter< TSample > ::ComputeMeanWithWeightingFunction() { + // set up input / output const SampleType *input = this->GetInput(); - MeasurementVectorSizeType measurementVectorSize = + const MeasurementVectorSizeType measurementVectorSize = input->GetMeasurementVectorSize(); MeasurementVectorDecoratedType *decoratedOutput = @@ -169,47 +167,50 @@ NumericTraits::SetLength( output, this->GetMeasurementVectorSize() ); - //reset the output - for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) - { - output[dim] = NumericTraits< MeasurementRealType >::Zero; - } + // algorithm start + typedef CompensatedSummation< MeasurementRealType > MeasurementRealAccumulateType; + std::vector< MeasurementRealAccumulateType > sum( measurementVectorSize ); - typename TSample::ConstIterator iter = input->Begin(); - typename TSample::ConstIterator end = input->End(); - double totalWeight = 0.0; - double weight; + const WeightingFunctionType * const weightFunction = this->GetWeightingFunction(); - typename TSample::MeasurementVectorType measurements; + WeightValueType totalWeight = NumericTraits< WeightValueType >::Zero; - // if weighting function is specifed, use it to compute the mean - const InputWeightingFunctionObjectType *functionObject = - this->GetWeightingFunctionInput(); - - const WeightingFunctionType *weightFunction = functionObject->Get(); + typename SampleType::ConstIterator iter = input->Begin(); + const typename SampleType::ConstIterator end = input->End(); - while ( iter != end ) + for (; iter != end; ++iter ) { - measurements = iter.GetMeasurementVector(); - weight = - iter.GetFrequency() * weightFunction->Evaluate(measurements); + const MeasurementVectorType & measurement = iter.GetMeasurementVector(); + + const typename SampleType::AbsoluteFrequencyType frequency = iter.GetFrequency(); + + const WeightValueType rawWeight = weightFunction->Evaluate( measurement ); + + const WeightValueType weight = ( rawWeight * static_cast< WeightValueType >( frequency ) ); totalWeight += weight; + for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) { - output[dim] += measurements[dim] * weight; + const MeasurementRealType component = + static_cast< MeasurementRealType >( measurement[dim] ); + + sum[dim] += ( component * weight ); } - ++iter; } - if ( totalWeight != 0.0 ) + if ( totalWeight > vnl_math::eps ) { for ( unsigned int dim = 0; dim < measurementVectorSize; dim++ ) { - output[dim] /= totalWeight; + output[dim] = ( sum[dim].GetSum() / static_cast< MeasurementRealType >( totalWeight ) ); } } + else + { + itkExceptionMacro("Total weight was too close to zero. Value = " << totalWeight ); + } - decoratedOutput->Set(output); + decoratedOutput->Set( output ); } } // end of namespace Statistics } // end of namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkChiSquareDistribution.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkChiSquareDistribution.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkChiSquareDistribution.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkChiSquareDistribution.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -84,8 +84,8 @@ if ( x >= 0.0 ) { - pdf = vcl_exp(-0.5 * x) * vcl_pow(x, dofon2 - 1.0) - / ( vcl_pow(2.0, dofon2) * dgamma_(&dofon2) ); + pdf = std::exp(-0.5 * x) * std::pow(x, dofon2 - 1.0) + / ( std::pow(2.0, dofon2) * dgamma_(&dofon2) ); } return pdf; @@ -159,7 +159,7 @@ nx = GaussianDistribution::InverseCDF(p); double f = 2.0 / ( 9.0 * dof ); - x = dof * vcl_pow(1.0 - f + nx * vcl_sqrt(f), 3.0); + x = dof * std::pow(1.0 - f + nx * std::sqrt(f), 3.0); // The approximation above is only accurate for large degrees of // freedom. We'll improve the approximation by a few Newton iterations. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkGaussianDistribution.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkGaussianDistribution.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkGaussianDistribution.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkGaussianDistribution.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -162,7 +162,7 @@ GaussianDistribution ::PDF(double x) { - return vnl_math::one_over_sqrt2pi * vcl_exp(-0.5 * x * x); + return vnl_math::one_over_sqrt2pi * std::exp(-0.5 * x * x); } double @@ -171,8 +171,8 @@ { double xminusmean = x - mean; - return ( vnl_math::one_over_sqrt2pi / vcl_sqrt(variance) ) - * vcl_exp(-0.5 * xminusmean * xminusmean / variance); + return ( vnl_math::one_over_sqrt2pi / std::sqrt(variance) ) + * std::exp(-0.5 * xminusmean * xminusmean / variance); } double @@ -205,7 +205,7 @@ ::CDF(double x, double mean, double variance) { // convert to zero mean unit variance - double u = ( x - mean ) / vcl_sqrt(variance); + double u = ( x - mean ) / std::sqrt(variance); return 0.5 * ( vnl_erf(vnl_math::sqrt1_2 * u) + 1.0 ); } @@ -252,7 +252,7 @@ /** Step 1: use 26.2.23 from Abramowitz and Stegun */ - dt = vcl_sqrt( -2.0 * vcl_log(dp) ); + dt = std::sqrt( -2.0 * std::log(dp) ); dx = dt - ( ( .010328e+0 * dt + .802853e+0 ) * dt + 2.515517e+0 ) / ( ( ( .001308e+0 * dt + .189269e+0 ) * dt + 1.432788e+0 ) * dt + 1.e+0 ); @@ -262,7 +262,7 @@ for ( newt = 0; newt < 3; newt++ ) { dq = 0.5e+0 * vnl_erfc(dx * vnl_math::sqrt1_2) - dp; - ddq = vcl_exp(-0.5e+0 * dx * dx) / 2.506628274631000e+0; + ddq = std::exp(-0.5e+0 * dx * dx) / 2.506628274631000e+0; dx = dx + dq / ddq; } @@ -295,7 +295,7 @@ { // apply the mean and variance to provide the value for the // prescribed Gaussian - x = x * vcl_sqrt(variance) + mean; + x = x * std::sqrt(variance) + mean; return x; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkNormalVariateGenerator.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkNormalVariateGenerator.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkNormalVariateGenerator.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkNormalVariateGenerator.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,7 +34,7 @@ m_TLEN = ( 8 * m_LEN ); m_Vec1 = new int[m_TLEN]; - m_Gausssave = 0; + m_Gausssave = ITK_NULLPTR; this->Initialize(0); } @@ -89,11 +89,11 @@ // Z = (sqrt (1/2TLEN)) * A * (B + n) // where: // B = C / A. -// We set m_Chic1 = A * vcl_sqrt(0.5 / TLEN), m_Chic2 = B +// We set m_Chic1 = A * std::sqrt(0.5 / TLEN), m_Chic2 = B fake = 1.0 + 0.125 / m_TLEN; // This is A - m_Chic2 = vcl_sqrt(2.0 * m_TLEN - fake * fake) / fake; - m_Chic1 = fake * vcl_sqrt(0.5 / m_TLEN); + m_Chic2 = std::sqrt(2.0 * m_TLEN - fake * fake) / fake; + m_Chic1 = fake * std::sqrt(0.5 / m_TLEN); m_ActualRSD = 0.0; } @@ -124,12 +124,12 @@ int r; int s; int t; - int * pa = 0; - int * pb = 0; - int * pc = 0; - int * pd = 0; + int * pa = ITK_NULLPTR; + int * pb = ITK_NULLPTR; + int * pc = ITK_NULLPTR; + int * pd = ITK_NULLPTR; int * pe; - int * p0 = 0; + int * p0 = ITK_NULLPTR; int mtype; int stype; double ts; @@ -333,16 +333,16 @@ m_Irs = ( m_Irs <= 0 ) ? ( ( m_Irs << 1 ) ^ 333556017 ) : ( m_Irs << 1 ); r = m_Irs + m_Lseed; if ( r < 0 ) { r = ~r; } - tz = -2.0 * vcl_log( ( r + 0.5 ) * m_Rcons ); /* Sum of squares */ + tz = -2.0 * std::log( ( r + 0.5 ) * m_Rcons ); /* Sum of squares */ ts += tz; - tz = vcl_sqrt(tz / tr); + tz = std::sqrt(tz / tr); m_Vec1[p++] = (int)( m_Scale * tx * tz ); m_Vec1[p++] = (int)( m_Scale * ty * tz ); if ( p < m_TLEN ) { goto nextpair; } /* Horrid, but good enough */ /* Calc correction factor to make sum of squares = TLEN */ ts = m_TLEN / ts; /* Should be close to 1.0 */ - tr = vcl_sqrt(ts); + tr = std::sqrt(ts); for ( p = 0; p < m_TLEN; p++ ) { tx = m_Vec1[p] * tr; @@ -358,7 +358,7 @@ ts += ( tx * tx ); } /* Now ts should be Scale*Scale*TLEN or thereabouts */ - ts = vcl_sqrt( ts / ( m_Scale * m_Scale * m_TLEN ) ); + ts = std::sqrt( ts / ( m_Scale * m_Scale * m_TLEN ) ); m_ActualRSD = 1.0 / ts; /* Reciprocal of actual Standard Devtn */ goto startpass; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkTDistribution.cxx otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkTDistribution.cxx --- otb-4.0.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkTDistribution.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Numerics/Statistics/src/itkTDistribution.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -85,7 +85,7 @@ double pdf; pdf = ( dgamma_(&dofplusoneon2) / dgamma_(&dofon2) ) - / ( vcl_sqrt(dof * vnl_math::pi) * vcl_pow(1.0 + ( ( x * x ) / dof ), dofplusoneon2) ); + / ( std::sqrt(dof * vnl_math::pi) * std::pow(1.0 + ( ( x * x ) / dof ), dofplusoneon2) ); return pdf; } @@ -189,10 +189,10 @@ dof4 = dof * dof3; gaussX = GaussianDistribution::InverseCDF(p); - gaussX3 = vcl_pow(gaussX, 3.0); - gaussX5 = vcl_pow(gaussX, 5.0); - gaussX7 = vcl_pow(gaussX, 7.0); - gaussX9 = vcl_pow(gaussX, 9.0); + gaussX3 = std::pow(gaussX, 3.0); + gaussX5 = std::pow(gaussX, 5.0); + gaussX7 = std::pow(gaussX, 7.0); + gaussX9 = std::pow(gaussX, 9.0); x = gaussX + ( gaussX3 + gaussX ) / ( 4.0 * dof ) @@ -411,8 +411,6 @@ << m_Parameters.size() << " parameters."); } - - return NumericTraits< double >::quiet_NaN(); } void diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -126,7 +126,7 @@ break; } itkExceptionMacro(<< "Bad output index " << idx ); - return 0; + return ITK_NULLPTR; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCenteredTransformInitializer.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCenteredTransformInitializer.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCenteredTransformInitializer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCenteredTransformInitializer.h 2014-09-03 08:29:34.000000000 +0000 @@ -135,7 +135,7 @@ CenteredTransformInitializer(); ~CenteredTransformInitializer(){} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; itkGetModifiableObjectMacro(Transform, TransformType); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandIterationUpdate.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandIterationUpdate.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandIterationUpdate.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandIterationUpdate.h 2014-09-03 08:29:34.000000000 +0000 @@ -57,12 +57,12 @@ /** * Execute method will print data at each iteration */ - void Execute(itk::Object *caller, const itk::EventObject & event) + virtual void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE { Execute( (const itk::Object *)caller, event); } - void Execute(const itk::Object *, const itk::EventObject & event) + virtual void Execute(const itk::Object *, const itk::EventObject & event) ITK_OVERRIDE { if( typeid( event ) == typeid( itk::StartEvent ) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandVnlIterationUpdate.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandVnlIterationUpdate.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandVnlIterationUpdate.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCommandVnlIterationUpdate.h 2014-09-03 08:29:34.000000000 +0000 @@ -57,12 +57,12 @@ /** * Execute method will print data at each iteration */ - void Execute(itk::Object *caller, const itk::EventObject & event) + virtual void Execute(itk::Object *caller, const itk::EventObject & event) ITK_OVERRIDE { Execute( (const itk::Object *)caller, event); } - void Execute(const itk::Object * itkNotUsed(caller), const itk::EventObject & event) + virtual void Execute(const itk::Object * itkNotUsed(caller), const itk::EventObject & event) ITK_OVERRIDE { if( typeid( event ) == typeid( itk::StartEvent ) ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCompareHistogramImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,11 +26,11 @@ template< typename TFixedImage, typename TMovingImage > CompareHistogramImageToImageMetric< TFixedImage, TMovingImage >::CompareHistogramImageToImageMetric() { - m_TrainingFixedImage = 0; // has to be provided by the user. - m_TrainingMovingImage = 0; // has to be provided by the user. - m_TrainingTransform = 0; // has to be provided by the user. - m_TrainingInterpolator = 0; // has to be provided by the user. - m_TrainingHistogram = 0; // either provided by the user or created + m_TrainingFixedImage = ITK_NULLPTR; // has to be provided by the user. + m_TrainingMovingImage = ITK_NULLPTR; // has to be provided by the user. + m_TrainingTransform = ITK_NULLPTR; // has to be provided by the user. + m_TrainingInterpolator = ITK_NULLPTR; // has to be provided by the user. + m_TrainingHistogram = ITK_NULLPTR; // either provided by the user or created } template< typename TFixedImage, typename TMovingImage > @@ -111,6 +111,7 @@ TrainingFixedIteratorType; typename FixedImageType::IndexType index; typename FixedImageType::RegionType fixedRegion; + typename HistogramType::IndexType hIndex; TrainingFixedIteratorType ti(this->m_TrainingFixedImage, this->m_TrainingFixedImageRegion); @@ -144,7 +145,9 @@ sample.SetSize(2); sample[0] = TrainingFixedValue; sample[1] = TrainingMovingValue; - this->m_TrainingHistogram->IncreaseFrequencyOfMeasurement(sample, 1); + + this->m_TrainingHistogram->GetIndex( sample, hIndex ); + this->m_TrainingHistogram->IncreaseFrequencyOfIndex( hIndex, 1 ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCorrelationCoefficientHistogramImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCorrelationCoefficientHistogramImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkCorrelationCoefficientHistogramImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkCorrelationCoefficientHistogramImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ const MeasureType varianceY = this->VarianceY(histogram); const MeasureType covariance = this->Covariance(histogram); - return vcl_fabs( covariance / ( vcl_sqrt(varianceX) * vcl_sqrt(varianceY) ) ); + return std::fabs( covariance / ( std::sqrt(varianceX) * std::sqrt(varianceY) ) ); } template< typename TFixedImage, typename TMovingImage > @@ -87,10 +87,10 @@ { varX += static_cast< double >( histogram.GetFrequency(i, 0) ) / histogram.GetTotalFrequency() - * vcl_pow(histogram.GetMeasurement(i, 0), 2); + * std::pow(histogram.GetMeasurement(i, 0), 2); } - return varX - vcl_pow(MeanX(histogram), 2); + return varX - std::pow(MeanX(histogram), 2); } template< typename TFixedImage, typename TMovingImage > @@ -105,10 +105,10 @@ { varY += static_cast< double >( histogram.GetFrequency(i, 1) ) / histogram.GetTotalFrequency() - * vcl_pow(histogram.GetMeasurement(i, 1), 2); + * std::pow(histogram.GetMeasurement(i, 1), 2); } - return varY - vcl_pow(MeanY(histogram), 2); + return varY - std::pow(MeanY(histogram), 2); } template< typename TFixedImage, typename TMovingImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkDisplacementFieldTransformParametersAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkDisplacementFieldTransformParametersAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkDisplacementFieldTransformParametersAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkDisplacementFieldTransformParametersAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -230,7 +230,7 @@ newDisplacementField->Update(); newDisplacementField->DisconnectPipeline(); - typename DisplacementFieldType::Pointer newInverseDisplacementField = NULL; + typename DisplacementFieldType::Pointer newInverseDisplacementField = ITK_NULLPTR; if( this->m_Transform->GetInverseDisplacementField() ) { typename LinearInterpolatorType::Pointer inverseInterpolator = LinearInterpolatorType::New(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkEuclideanDistancePointMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkEuclideanDistancePointMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkEuclideanDistancePointMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkEuclideanDistancePointMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ EuclideanDistancePointMetric< TFixedPointSet, TMovingPointSet, TDistanceMap > ::EuclideanDistancePointMetric() { - m_DistanceMap = 0; + m_DistanceMap = ITK_NULLPTR; // when set to true it will be a bit faster, but it will result in minimizing // the sum of distances^4 instead of the sum of distances^2 @@ -121,7 +121,7 @@ if ( !m_ComputeSquaredDistance ) { - dist = vcl_sqrt(dist); + dist = std::sqrt(dist); } if ( dist < minimumDistance ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkGradientDifferenceImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ { unsigned int iDimension; - m_TransformMovingImageFilter = 0; + m_TransformMovingImageFilter = ITK_NULLPTR; for ( iDimension = 0; iDimension < FixedImageDimension; iDimension++ ) { @@ -265,7 +265,10 @@ ++iterate; } - m_Variance[iDimension] /= nPixels; + if (nPixels > 0) + { + m_Variance[iDimension] /= nPixels; + } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkHistogramImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -277,6 +277,7 @@ typename FixedImageType::IndexType index; typename FixedImageType::RegionType fixedRegion; + typename HistogramType::IndexType hIndex; fixedRegion = this->GetFixedImageRegion(); FixedIteratorType ti(fixedImage, fixedRegion); @@ -326,7 +327,9 @@ sample.SetSize(2); sample[0] = fixedValue; sample[1] = movingValue; - histogram.IncreaseFrequencyOfMeasurement(sample, 1); + + histogram.GetIndex( sample, hIndex ); + histogram.IncreaseFrequencyOfIndex( hIndex, 1 ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -186,11 +186,11 @@ * output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** Method to return the latest modified time of this object or * any of its cached ivars */ - ModifiedTimeType GetMTime() const; + virtual ModifiedTimeType GetMTime() const ITK_OVERRIDE; #ifdef ITKV3_COMPATIBILITY /** Method that initiates the registration. This will Initialize and ensure @@ -214,10 +214,10 @@ protected: ImageRegistrationMethod(); virtual ~ImageRegistrationMethod() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Method invoked by the pipeline in order to trigger the computation of * the registration. */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Provides derived classes with the ability to set this private var */ itkSetMacro(LastTransformParameters, ParametersType); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,12 +31,12 @@ { this->SetNumberOfRequiredOutputs(1); // for the Transform - m_FixedImage = 0; // has to be provided by the user. - m_MovingImage = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. - m_Interpolator = 0; // has to be provided by the user. - m_Metric = 0; // has to be provided by the user. - m_Optimizer = 0; // has to be provided by the user. + m_FixedImage = ITK_NULLPTR; // has to be provided by the user. + m_MovingImage = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Interpolator = ITK_NULLPTR; // has to be provided by the user. + m_Metric = ITK_NULLPTR; // has to be provided by the user. + m_Optimizer = ITK_NULLPTR; // has to be provided by the user. m_InitialTransformParameters = ParametersType(1); m_LastTransformParameters = ParametersType(1); @@ -312,7 +312,7 @@ break; default: itkExceptionMacro("MakeOutput request for an output number larger than the expected number of outputs"); - return 0; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethodImageSource.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethodImageSource.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethodImageSource.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageRegistrationMethodImageSource.h 2014-09-03 08:29:34.000000000 +0000 @@ -125,7 +125,7 @@ d += displacement; const double x = d[0]; const double y = d[1]; - const double value = 200.0 * vcl_exp( - ( x*x + y*y )/(s*s) ); + const double value = 200.0 * std::exp( - ( x*x + y*y )/(s*s) ); ri.Set( static_cast(value) ); ++ri; } @@ -138,7 +138,7 @@ d = p-center; const double x = d[0]; const double y = d[1]; - const double value = 200.0 * vcl_exp( - ( x*x + y*y )/(s*s) ); + const double value = 200.0 * std::exp( - ( x*x + y*y )/(s*s) ); ti.Set( static_cast(value) ); ++ti; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.h 2014-09-03 08:29:34.000000000 +0000 @@ -209,7 +209,7 @@ void SetTransformParameters(const ParametersType & parameters) const; /** Return the number of parameters required by the Transform */ - unsigned int GetNumberOfParameters(void) const + virtual unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE { return m_Transform->GetNumberOfParameters(); } @@ -318,7 +318,7 @@ ImageToImageMetric(); virtual ~ImageToImageMetric(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** \class FixedImageSamplePoint * A fixed image spatial sample consists of the fixed domain point @@ -469,14 +469,14 @@ MovingImagePointType & mappedPoint, bool & sampleWithinSupportRegion, double & movingImageValue, - ThreadIdType threadID) const; + ThreadIdType threadId) const; virtual void TransformPointWithDerivatives(unsigned int sampleNumber, MovingImagePointType & mappedPoint, bool & sampleWithinSupportRegion, double & movingImageValue, ImageDerivativesType & gradient, - ThreadIdType threadID) const; + ThreadIdType threadId) const; /** Boolean to indicate if the interpolator BSpline. */ bool m_InterpolatorIsBSpline; @@ -489,7 +489,7 @@ /** Compute image derivatives at a point. */ virtual void ComputeImageDerivatives(const MovingImagePointType & mappedPoint, ImageDerivativesType & gradient, - ThreadIdType threadID) const; + ThreadIdType threadId) const; /** * Types and variables related to multi-threading @@ -517,20 +517,20 @@ static ITK_THREAD_RETURN_TYPE GetValueMultiThreadedPostProcess(void *arg); - virtual inline void GetValueThread(ThreadIdType threadID) const; + virtual inline void GetValueThread(ThreadIdType threadId) const; virtual inline void GetValueThreadPreProcess( - ThreadIdType itkNotUsed(threadID), + ThreadIdType itkNotUsed(threadId), bool itkNotUsed(withinSampleThread) ) const {} virtual inline bool GetValueThreadProcessSample( - ThreadIdType itkNotUsed(threadID), + ThreadIdType itkNotUsed(threadId), SizeValueType itkNotUsed(fixedImageSample), const MovingImagePointType & itkNotUsed(mappedPoint), double itkNotUsed(movingImageValue) ) const { return false; } virtual inline void GetValueThreadPostProcess( - ThreadIdType itkNotUsed(threadID), + ThreadIdType itkNotUsed(threadId), bool itkNotUsed(withinSampleThread) ) const {} @@ -546,21 +546,21 @@ static ITK_THREAD_RETURN_TYPE GetValueAndDerivativeMultiThreadedPostProcess(void *arg); - virtual inline void GetValueAndDerivativeThread(ThreadIdType threadID) const; + virtual inline void GetValueAndDerivativeThread(ThreadIdType threadId) const; virtual inline void GetValueAndDerivativeThreadPreProcess( - ThreadIdType itkNotUsed(threadID), + ThreadIdType itkNotUsed(threadId), bool itkNotUsed(withinSampleThread) ) const {} virtual inline bool GetValueAndDerivativeThreadProcessSample( - ThreadIdType itkNotUsed(threadID), + ThreadIdType itkNotUsed(threadId), SizeValueType itkNotUsed(fixedImageSample), const MovingImagePointType & itkNotUsed(mappedPoint), double itkNotUsed(movingImageValue), const ImageDerivativesType & itkNotUsed(movingImageGradientValue) ) const { return false; } virtual inline void GetValueAndDerivativeThreadPostProcess( - ThreadIdType itkNotUsed(threadID), + ThreadIdType itkNotUsed(threadId), bool itkNotUsed(withinSampleThread) ) const {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -42,19 +42,19 @@ m_NumberOfPixelsCounted(0), - m_FixedImage(0), // has to be provided by the user. - m_MovingImage(0), // has to be provided by the user. + m_FixedImage(ITK_NULLPTR), // has to be provided by the user. + m_MovingImage(ITK_NULLPTR), // has to be provided by the user. - m_Transform(NULL), // has to be provided by the user. - m_ThreaderTransform(NULL), // constructed at initialization. + m_Transform(ITK_NULLPTR), // has to be provided by the user. + m_ThreaderTransform(ITK_NULLPTR), // constructed at initialization. - m_Interpolator(0), // has to be provided by the user. + m_Interpolator(ITK_NULLPTR), // has to be provided by the user. m_ComputeGradient(true), // metric computes gradient by default - m_GradientImage(NULL), // computed at initialization + m_GradientImage(ITK_NULLPTR), // computed at initialization - m_FixedImageMask(0), - m_MovingImageMask(0), + m_FixedImageMask(ITK_NULLPTR), + m_MovingImageMask(ITK_NULLPTR), m_NumberOfThreads(1), @@ -66,7 +66,7 @@ m_TransformIsBSpline(false), m_NumBSplineWeights(0), - m_BSplineTransform(NULL), + m_BSplineTransform(ITK_NULLPTR), m_BSplineTransformWeightsArray(), m_BSplineTransformIndicesArray(), m_BSplinePreTransformPointsArray(0), @@ -76,15 +76,15 @@ m_UseCachingOfBSplineWeights(true), m_BSplineTransformWeights(), m_BSplineTransformIndices(), - m_ThreaderBSplineTransformWeights(NULL), - m_ThreaderBSplineTransformIndices(NULL), + m_ThreaderBSplineTransformWeights(ITK_NULLPTR), + m_ThreaderBSplineTransformIndices(ITK_NULLPTR), m_InterpolatorIsBSpline(false), - m_BSplineInterpolator(NULL), - m_DerivativeCalculator(NULL), + m_BSplineInterpolator(ITK_NULLPTR), + m_DerivativeCalculator(ITK_NULLPTR), m_Threader(MultiThreaderType::New()), - m_ThreaderNumberOfMovingImageSamples(NULL), + m_ThreaderNumberOfMovingImageSamples(ITK_NULLPTR), m_WithinThreadPreProcess(false), m_WithinThreadPostProcess(false) { @@ -107,16 +107,16 @@ ::~ImageToImageMetric() { delete[] m_ThreaderNumberOfMovingImageSamples; - m_ThreaderNumberOfMovingImageSamples = NULL; + m_ThreaderNumberOfMovingImageSamples = ITK_NULLPTR; delete[] m_ThreaderTransform; - m_ThreaderTransform = NULL; + m_ThreaderTransform = ITK_NULLPTR; delete[] this->m_ThreaderBSplineTransformWeights; - this->m_ThreaderBSplineTransformWeights = NULL; + this->m_ThreaderBSplineTransformWeights = ITK_NULLPTR; delete[] this->m_ThreaderBSplineTransformIndices; - this->m_ThreaderBSplineTransformIndices = NULL; + this->m_ThreaderBSplineTransformIndices = ITK_NULLPTR; } /** @@ -433,7 +433,7 @@ m_DerivativeCalculator->SetInputImage(this->m_MovingImage); - m_BSplineInterpolator = NULL; + m_BSplineInterpolator = ITK_NULLPTR; itkDebugMacro("Interpolator is not BSpline"); } else @@ -442,7 +442,7 @@ m_BSplineInterpolator->SetNumberOfThreads(m_NumberOfThreads); m_BSplineInterpolator->UseImageDirectionOn(); - m_DerivativeCalculator = NULL; + m_DerivativeCalculator = ITK_NULLPTR; itkDebugMacro("Interpolator is BSpline"); } @@ -463,7 +463,7 @@ if ( !testPtr2 ) { m_TransformIsBSpline = false; - m_BSplineTransform = NULL; + m_BSplineTransform = ITK_NULLPTR; itkDebugMacro("Transform is not BSplineDeformable"); } else @@ -484,10 +484,10 @@ this->m_BSplineTransformIndices.SetSize(1); delete[] this->m_ThreaderBSplineTransformWeights; - this->m_ThreaderBSplineTransformWeights = NULL; + this->m_ThreaderBSplineTransformWeights = ITK_NULLPTR; delete[] this->m_ThreaderBSplineTransformIndices; - this->m_ThreaderBSplineTransformIndices = NULL; + this->m_ThreaderBSplineTransformIndices = ITK_NULLPTR; if ( this->m_UseCachingOfBSplineWeights ) { @@ -893,14 +893,14 @@ MovingImagePointType & mappedPoint, bool & sampleOk, double & movingImageValue, - ThreadIdType threadID) const + ThreadIdType threadId) const { sampleOk = true; TransformType *transform; - if ( threadID > 0 ) + if ( threadId > 0 ) { - transform = this->m_ThreaderTransform[threadID - 1]; + transform = this->m_ThreaderTransform[threadId - 1]; } else { @@ -949,10 +949,10 @@ BSplineTransformWeightsType * weightsHelper; BSplineTransformIndexArrayType *indicesHelper; - if ( threadID > 0 ) + if ( threadId > 0 ) { - weightsHelper = &( this->m_ThreaderBSplineTransformWeights[threadID - 1] ); - indicesHelper = &( this->m_ThreaderBSplineTransformIndices[threadID - 1] ); + weightsHelper = &( this->m_ThreaderBSplineTransformWeights[threadId - 1] ); + indicesHelper = &( this->m_ThreaderBSplineTransformIndices[threadId - 1] ); } else { @@ -984,7 +984,7 @@ sampleOk = sampleOk && m_BSplineInterpolator->IsInsideBuffer(mappedPoint); if ( sampleOk ) { - movingImageValue = m_BSplineInterpolator->Evaluate(mappedPoint, threadID); + movingImageValue = m_BSplineInterpolator->Evaluate(mappedPoint, threadId); } } else @@ -1011,15 +1011,15 @@ bool & sampleOk, double & movingImageValue, ImageDerivativesType & movingImageGradient, - ThreadIdType threadID) const + ThreadIdType threadId) const { TransformType *transform; sampleOk = true; - if ( threadID > 0 ) + if ( threadId > 0 ) { - transform = this->m_ThreaderTransform[threadID - 1]; + transform = this->m_ThreaderTransform[threadId - 1]; } else { @@ -1068,10 +1068,10 @@ BSplineTransformWeightsType * weightsHelper; BSplineTransformIndexArrayType *indicesHelper; - if ( threadID > 0 ) + if ( threadId > 0 ) { - weightsHelper = &( this->m_ThreaderBSplineTransformWeights[threadID - 1] ); - indicesHelper = &( this->m_ThreaderBSplineTransformIndices[threadID - 1] ); + weightsHelper = &( this->m_ThreaderBSplineTransformWeights[threadId - 1] ); + indicesHelper = &( this->m_ThreaderBSplineTransformIndices[threadId - 1] ); } else { @@ -1106,7 +1106,7 @@ this->m_BSplineInterpolator->EvaluateValueAndDerivative(mappedPoint, movingImageValue, movingImageGradient, - threadID); + threadId); } } else @@ -1115,7 +1115,7 @@ sampleOk = sampleOk && m_Interpolator->IsInsideBuffer(mappedPoint); if ( sampleOk ) { - this->ComputeImageDerivatives(mappedPoint, movingImageGradient, threadID); + this->ComputeImageDerivatives(mappedPoint, movingImageGradient, threadId); movingImageValue = this->m_Interpolator->Evaluate(mappedPoint); } } @@ -1132,13 +1132,13 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::ComputeImageDerivatives(const MovingImagePointType & mappedPoint, ImageDerivativesType & gradient, - ThreadIdType threadID) const + ThreadIdType threadId) const { if ( m_InterpolatorIsBSpline ) { // Computed moving image gradient using derivative BSpline kernel. gradient = m_BSplineInterpolator->EvaluateDerivative(mappedPoint, - threadID); + threadId); } else { @@ -1182,9 +1182,9 @@ const_cast< void * >( static_cast< const void * >( &m_ThreaderParameter ) ) ); m_Threader->SingleMethodExecute(); - for ( ThreadIdType threadID = 0; threadID < m_NumberOfThreads - 1; threadID++ ) + for ( ThreadIdType threadId = 0; threadId < m_NumberOfThreads - 1; threadId++ ) { - this->m_NumberOfPixelsCounted += m_ThreaderNumberOfMovingImageSamples[threadID]; + this->m_NumberOfPixelsCounted += m_ThreaderNumberOfMovingImageSamples[threadId]; } } @@ -1206,15 +1206,15 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::GetValueMultiThreadedPreProcess(void *arg) { - ThreadIdType threadID; + ThreadIdType threadId; MultiThreaderParameterType *mtParam; - threadID = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; + threadId = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; mtParam = (MultiThreaderParameterType *) ( ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->UserData ); - mtParam->metric->GetValueThreadPreProcess(threadID, false); + mtParam->metric->GetValueThreadPreProcess(threadId, false); return ITK_THREAD_RETURN_VALUE; } @@ -1227,15 +1227,15 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::GetValueMultiThreaded(void *arg) { - ThreadIdType threadID; + ThreadIdType threadId; MultiThreaderParameterType *mtParam; - threadID = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; + threadId = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; mtParam = (MultiThreaderParameterType *) ( ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->UserData ); - mtParam->metric->GetValueThread(threadID); + mtParam->metric->GetValueThread(threadId); return ITK_THREAD_RETURN_VALUE; } @@ -1248,15 +1248,15 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::GetValueMultiThreadedPostProcess(void *arg) { - ThreadIdType threadID; + ThreadIdType threadId; MultiThreaderParameterType *mtParam; - threadID = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; + threadId = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; mtParam = (MultiThreaderParameterType *) ( ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->UserData ); - mtParam->metric->GetValueThreadPostProcess(threadID, false); + mtParam->metric->GetValueThreadPostProcess(threadId, false); return ITK_THREAD_RETURN_VALUE; } @@ -1264,15 +1264,15 @@ template< typename TFixedImage, typename TMovingImage > void ImageToImageMetric< TFixedImage, TMovingImage > -::GetValueThread(ThreadIdType threadID) const +::GetValueThread(ThreadIdType threadId) const { // Figure out how many samples to process int chunkSize = m_NumberOfFixedImageSamples / m_NumberOfThreads; // Skip to this thread's samples to process - unsigned int fixedImageSample = threadID * chunkSize; + unsigned int fixedImageSample = threadId * chunkSize; - if ( threadID == m_NumberOfThreads - 1 ) + if ( threadId == m_NumberOfThreads - 1 ) { chunkSize = m_NumberOfFixedImageSamples - ( ( m_NumberOfThreads - 1 ) @@ -1282,7 +1282,7 @@ if ( m_WithinThreadPreProcess ) { - this->GetValueThreadPreProcess(threadID, true); + this->GetValueThreadPreProcess(threadId, true); } // Process the samples @@ -1294,12 +1294,12 @@ double movingImageValue; // Get moving image value this->TransformPoint(fixedImageSample, mappedPoint, sampleOk, movingImageValue, - threadID); + threadId); if ( sampleOk ) { // CALL USER FUNCTION - if ( GetValueThreadProcessSample(threadID, fixedImageSample, + if ( GetValueThreadProcessSample(threadId, fixedImageSample, mappedPoint, movingImageValue) ) { ++numSamples; @@ -1307,9 +1307,9 @@ } } - if ( threadID > 0 ) + if ( threadId > 0 ) { - m_ThreaderNumberOfMovingImageSamples[threadID - 1] = numSamples; + m_ThreaderNumberOfMovingImageSamples[threadId - 1] = numSamples; } else { @@ -1318,7 +1318,7 @@ if ( m_WithinThreadPostProcess ) { - this->GetValueThreadPostProcess(threadID, true); + this->GetValueThreadPostProcess(threadId, true); } } @@ -1345,9 +1345,9 @@ const_cast< void * >( static_cast< const void * >( &m_ThreaderParameter ) ) ); m_Threader->SingleMethodExecute(); - for ( ThreadIdType threadID = 0; threadID < m_NumberOfThreads - 1; threadID++ ) + for ( ThreadIdType threadId = 0; threadId < m_NumberOfThreads - 1; threadId++ ) { - this->m_NumberOfPixelsCounted += m_ThreaderNumberOfMovingImageSamples[threadID]; + this->m_NumberOfPixelsCounted += m_ThreaderNumberOfMovingImageSamples[threadId]; } } @@ -1369,15 +1369,15 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::GetValueAndDerivativeMultiThreadedPreProcess(void *arg) { - ThreadIdType threadID; + ThreadIdType threadId; MultiThreaderParameterType *mtParam; - threadID = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; + threadId = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; mtParam = (MultiThreaderParameterType *) ( ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->UserData ); - mtParam->metric->GetValueAndDerivativeThreadPreProcess(threadID, false); + mtParam->metric->GetValueAndDerivativeThreadPreProcess(threadId, false); return ITK_THREAD_RETURN_VALUE; } @@ -1390,15 +1390,15 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::GetValueAndDerivativeMultiThreaded(void *arg) { - ThreadIdType threadID; + ThreadIdType threadId; MultiThreaderParameterType *mtParam; - threadID = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; + threadId = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; mtParam = (MultiThreaderParameterType *) ( ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->UserData ); - mtParam->metric->GetValueAndDerivativeThread(threadID); + mtParam->metric->GetValueAndDerivativeThread(threadId); return ITK_THREAD_RETURN_VALUE; } @@ -1411,15 +1411,15 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::GetValueAndDerivativeMultiThreadedPostProcess(void *arg) { - ThreadIdType threadID; + ThreadIdType threadId; MultiThreaderParameterType *mtParam; - threadID = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; + threadId = ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->ThreadID; mtParam = (MultiThreaderParameterType *) ( ( (MultiThreaderType::ThreadInfoStruct *)( arg ) )->UserData ); - mtParam->metric->GetValueAndDerivativeThreadPostProcess(threadID, false); + mtParam->metric->GetValueAndDerivativeThreadPostProcess(threadId, false); return ITK_THREAD_RETURN_VALUE; } @@ -1427,15 +1427,15 @@ template< typename TFixedImage, typename TMovingImage > void ImageToImageMetric< TFixedImage, TMovingImage > -::GetValueAndDerivativeThread(ThreadIdType threadID) const +::GetValueAndDerivativeThread(ThreadIdType threadId) const { // Figure out how many samples to process int chunkSize = m_NumberOfFixedImageSamples / m_NumberOfThreads; // Skip to this thread's samples to process - unsigned int fixedImageSample = threadID * chunkSize; + unsigned int fixedImageSample = threadId * chunkSize; - if ( threadID == m_NumberOfThreads - 1 ) + if ( threadId == m_NumberOfThreads - 1 ) { chunkSize = m_NumberOfFixedImageSamples - ( ( m_NumberOfThreads - 1 ) @@ -1446,7 +1446,7 @@ if ( m_WithinThreadPreProcess ) { - this->GetValueAndDerivativeThreadPreProcess(threadID, true); + this->GetValueAndDerivativeThreadPreProcess(threadId, true); } // Process the samples @@ -1459,12 +1459,12 @@ // Get moving image value TransformPointWithDerivatives(fixedImageSample, mappedPoint, sampleOk, movingImageValue, movingImageGradientValue, - threadID); + threadId); if ( sampleOk ) { // CALL USER FUNCTION - if ( this->GetValueAndDerivativeThreadProcessSample(threadID, + if ( this->GetValueAndDerivativeThreadProcessSample(threadId, fixedImageSample, mappedPoint, movingImageValue, @@ -1475,9 +1475,9 @@ } } - if ( threadID > 0 ) + if ( threadId > 0 ) { - m_ThreaderNumberOfMovingImageSamples[threadID - 1] = numSamples; + m_ThreaderNumberOfMovingImageSamples[threadId - 1] = numSamples; } else { @@ -1486,7 +1486,7 @@ if ( m_WithinThreadPostProcess ) { - this->GetValueAndDerivativeThreadPostProcess(threadID, true); + this->GetValueAndDerivativeThreadPostProcess(threadId, true); } } @@ -1575,13 +1575,13 @@ ImageToImageMetric< TFixedImage, TMovingImage > ::SynchronizeTransforms() const { - for ( ThreadIdType threadID = 0; threadID < m_NumberOfThreads - 1; threadID++ ) + for ( ThreadIdType threadId = 0; threadId < m_NumberOfThreads - 1; threadId++ ) { /** Set the fixed parameters first. Some transforms have parameters which depend on the values of the fixed parameters. For instance, the BSplineTransform checks the grid size (part of the fixed parameters) before setting the parameters. */ - this->m_ThreaderTransform[threadID]->SetFixedParameters( this->m_Transform->GetFixedParameters() ); - this->m_ThreaderTransform[threadID]->SetParameters( this->m_Transform->GetParameters() ); + this->m_ThreaderTransform[threadId]->SetFixedParameters( this->m_Transform->GetFixedParameters() ); + this->m_ThreaderTransform[threadId]->SetParameters( this->m_Transform->GetParameters() ); } } } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.h 2014-09-03 08:29:34.000000000 +0000 @@ -168,7 +168,7 @@ virtual ~ImageToSpatialObjectMetric() {} ImageToSpatialObjectMetric(const Self &) {} void operator=(const Self &) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; MeasureType m_MatchMeasure; DerivativeType m_MatchMeasureDerivatives; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,12 +25,13 @@ /** Constructor */ template< typename TFixedImage, typename TMovingSpatialObject > ImageToSpatialObjectMetric< TFixedImage, TMovingSpatialObject > -::ImageToSpatialObjectMetric() +::ImageToSpatialObjectMetric(): + m_MatchMeasure(0) { - m_FixedImage = 0; // has to be provided by the user. - m_MovingSpatialObject = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. - m_Interpolator = 0; // has to be provided by the user. + m_FixedImage = ITK_NULLPTR; // has to be provided by the user. + m_MovingSpatialObject = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Interpolator = ITK_NULLPTR; // has to be provided by the user. } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -174,11 +174,11 @@ * output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** Method to return the latest modified time of this object or * any of its cached ivars */ - ModifiedTimeType GetMTime() const; + virtual ModifiedTimeType GetMTime() const ITK_OVERRIDE; #ifdef ITKV3_COMPATIBILITY // StartRegistration is an old API from before @@ -198,11 +198,11 @@ protected: ImageToSpatialObjectRegistrationMethod(); virtual ~ImageToSpatialObjectRegistrationMethod() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Method invoked by the pipeline in order to trigger the computation of * the registration. */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Initialize by setting the interconnects between the components. */ void Initialize() diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkImageToSpatialObjectRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,12 +29,12 @@ { this->SetNumberOfRequiredOutputs(1); // for the Transform - m_FixedImage = 0; // has to be provided by the user. - m_MovingSpatialObject = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. - m_Interpolator = 0; // has to be provided by the user. - m_Metric = 0; // has to be provided by the user. - m_Optimizer = 0; // has to be provided by the user. + m_FixedImage = ITK_NULLPTR; // has to be provided by the user. + m_MovingSpatialObject = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Interpolator = ITK_NULLPTR; // has to be provided by the user. + m_Metric = ITK_NULLPTR; // has to be provided by the user. + m_Optimizer = ITK_NULLPTR; // has to be provided by the user. m_InitialTransformParameters = ParametersType(1); m_LastTransformParameters = ParametersType(1); @@ -200,7 +200,7 @@ break; default: itkExceptionMacro("MakeOutput request for an output number larger than the expected number of outputs"); - return 0; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkKappaStatisticImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -211,7 +211,10 @@ int movingArea = 0; int intersection = 0; - TransformJacobianType jacobian; + TransformJacobianType jacobian(TFixedImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TFixedImage::ImageDimension, + TFixedImage::ImageDimension); ti.GoToBegin(); while( !ti.IsAtEnd() ) @@ -255,8 +258,10 @@ intersection++; } - this->m_Transform->ComputeJacobianWithRespectToParameters( - inputPoint, jacobian); + this->m_Transform-> + ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); this->m_NumberOfPixelsCounted++; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.h 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,7 @@ * pp. 525 - 532. * * The metric is given by KL(P_test||P_train) - * = Sum_{i1,i2} P_test(i1,i2) vcl_log(P_test(i1,i2)/P_train(i1,i2)) + * = Sum_{i1,i2} P_test(i1,i2) std::log(P_test(i1,i2)/P_train(i1,i2)) * where P_test and P_train are probabilities given my normalized * histograms, and i1 and i2 are the intensity bins in the histogram. * diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkKullbackLeiblerCompareHistogramImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -68,7 +68,7 @@ double TrainingFreq = training_it.GetFrequency() + m_Epsilon; double MeasuredFreq = measured_it.GetFrequency() + m_Epsilon; - KullbackLeibler += MeasuredFreq * vcl_log(MeasuredFreq / TrainingFreq); + KullbackLeibler += MeasuredFreq * std::log(MeasuredFreq / TrainingFreq); ++measured_it; ++training_it; @@ -91,7 +91,7 @@ + this->GetHistogramSize()[0] * this->GetHistogramSize()[1] * m_Epsilon; KullbackLeibler = KullbackLeibler / static_cast< MeasureType >( AdjustedTotalMeasuredFreq ) - - vcl_log(AdjustedTotalMeasuredFreq / AdjustedTotalTrainingFreq); + - std::log(AdjustedTotalMeasuredFreq / AdjustedTotalTrainingFreq); return KullbackLeibler; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.h 2014-09-03 08:29:34.000000000 +0000 @@ -91,8 +91,6 @@ * * Notes: * 1. This class returns the negative mutual information value. - * 2. This class in not thread safe due the private data structures - * used to the store the sampled points and the marginal and joint pdfs. * * References: * [1] "Nonrigid multimodality image registration" @@ -227,9 +225,9 @@ */ const typename JointPDFType::Pointer GetJointPDF () const { - if( this->m_MMIMetricPerThreadVariables == NULL ) + if( this->m_MMIMetricPerThreadVariables == ITK_NULLPTR ) { - return JointPDFType::Pointer(NULL); + return JointPDFType::Pointer(ITK_NULLPTR); } return this->m_MMIMetricPerThreadVariables[0].JointPDF; } @@ -242,9 +240,9 @@ */ const typename JointPDFDerivativesType::Pointer GetJointPDFDerivatives () const { - if( this->m_MMIMetricPerThreadVariables == NULL ) + if( this->m_MMIMetricPerThreadVariables == ITK_NULLPTR ) { - return JointPDFDerivativesType::Pointer(NULL); + return JointPDFDerivativesType::Pointer(ITK_NULLPTR); } return this->m_MMIMetricPerThreadVariables[0].JointPDFDerivatives; } @@ -279,22 +277,22 @@ void ComputeFixedImageParzenWindowIndices( FixedImageSampleContainer & samples); /** Compute PDF derivative contribution for each parameter. */ - void ComputePDFDerivatives(ThreadIdType threadID, unsigned int sampleNumber, int movingImageParzenWindowIndex, + void ComputePDFDerivatives(ThreadIdType threadId, unsigned int sampleNumber, int movingImageParzenWindowIndex, const ImageDerivativesType & movingImageGradientValue, PDFValueType cubicBSplineDerivativeValue) const; - virtual void GetValueThreadPreProcess(ThreadIdType threadID, bool withinSampleThread) const; - virtual void GetValueThreadPostProcess(ThreadIdType threadID, bool withinSampleThread) const; + virtual void GetValueThreadPreProcess(ThreadIdType threadId, bool withinSampleThread) const; + virtual void GetValueThreadPostProcess(ThreadIdType threadId, bool withinSampleThread) const; //NOTE: The signature in base class requires that movingImageValue is of type double - virtual bool GetValueThreadProcessSample(ThreadIdType threadID, SizeValueType fixedImageSample, + virtual bool GetValueThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & mappedPoint, double movingImageValue) const; - virtual void GetValueAndDerivativeThreadPreProcess( ThreadIdType threadID, bool withinSampleThread) const; - virtual void GetValueAndDerivativeThreadPostProcess( ThreadIdType threadID, bool withinSampleThread) const; + virtual void GetValueAndDerivativeThreadPreProcess( ThreadIdType threadId, bool withinSampleThread) const; + virtual void GetValueAndDerivativeThreadPostProcess( ThreadIdType threadId, bool withinSampleThread) const; //NOTE: The signature in base class requires that movingImageValue is of type double - virtual bool GetValueAndDerivativeThreadProcessSample(ThreadIdType threadID, SizeValueType fixedImageSample, + virtual bool GetValueAndDerivativeThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & mappedPoint, double movingImageValue, const ImageDerivativesType & movingImageGradientValue) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMattesMutualInformationImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,20 +39,22 @@ m_NumberOfHistogramBins(50), m_MovingImageNormalizedMin(0.0), m_FixedImageNormalizedMin(0.0), + m_FixedImageTrueMin(0.0), + m_FixedImageTrueMax(0.0), m_MovingImageTrueMin(0.0), m_MovingImageTrueMax(0.0), m_FixedImageBinSize(0.0), m_MovingImageBinSize(0.0), - m_CubicBSplineKernel(NULL), - m_CubicBSplineDerivativeKernel(NULL), + m_CubicBSplineKernel(ITK_NULLPTR), + m_CubicBSplineDerivativeKernel(ITK_NULLPTR), m_PRatioArray(0,0), // Initialize memory m_MovingImageMarginalPDF(0), - m_MMIMetricPerThreadVariables(NULL), + m_MMIMetricPerThreadVariables(ITK_NULLPTR), m_UseExplicitPDFDerivatives(true), m_ImplicitDerivativesSecondPass(false) @@ -125,46 +127,70 @@ * in computing the range of intensity values. */ - this->m_FixedImageTrueMin = vcl_numeric_limits::max(); - this->m_FixedImageTrueMax = vcl_numeric_limits::min(); - this->m_MovingImageTrueMin = vcl_numeric_limits::max(); - this->m_MovingImageTrueMax = vcl_numeric_limits::min(); + this->m_FixedImageTrueMin = std::numeric_limits::max(); + this->m_FixedImageTrueMax = std::numeric_limits::min(); + this->m_MovingImageTrueMin = std::numeric_limits::max(); + this->m_MovingImageTrueMax = std::numeric_limits::min(); // We need to make robust measures only over the requested mask region itk::ImageRegionConstIteratorWithIndex fi(this->m_FixedImage, this->m_FixedImage->GetBufferedRegion() ); - while( !fi.IsAtEnd() ) - { - typename TFixedImage::PointType fixedSpacePhysicalPoint; - this->m_FixedImage->TransformIndexToPhysicalPoint(fi.GetIndex(), fixedSpacePhysicalPoint); - // A null mask implies entire space is to be used. - if( this->m_FixedImageMask.IsNull() - || this->m_FixedImageMask->IsInside(fixedSpacePhysicalPoint) - ) + const bool fixedMaskIsPresent = !(this->m_FixedImageMask.IsNull()); + if( fixedMaskIsPresent ) { - const typename TFixedImage::PixelType currValue = fi.Get(); - this->m_FixedImageTrueMin = (m_FixedImageTrueMin < currValue) ? this->m_FixedImageTrueMin : currValue; - this->m_FixedImageTrueMax = (m_FixedImageTrueMax > currValue) ? this->m_FixedImageTrueMax : currValue; + typename TFixedImage::PointType fixedSpacePhysicalPoint; + while( !fi.IsAtEnd() ) + { + this->m_FixedImage->TransformIndexToPhysicalPoint(fi.GetIndex(), fixedSpacePhysicalPoint); + const bool shouldCheckPixelIntensity = this->m_FixedImageMask->IsInside( fixedSpacePhysicalPoint ); + if( shouldCheckPixelIntensity ) + { + const PDFValueType & currValue = fi.Get(); + this->m_FixedImageTrueMin = std::min(m_FixedImageTrueMin, currValue); + this->m_FixedImageTrueMax = std::max(m_FixedImageTrueMax, currValue); + } + ++fi; + } + } + else + { + while( !fi.IsAtEnd() ) + { + const PDFValueType & currValue = fi.Get(); + this->m_FixedImageTrueMin = std::min(m_FixedImageTrueMin, currValue); + this->m_FixedImageTrueMax = std::max(m_FixedImageTrueMax, currValue); + ++fi; + } } - ++fi; - } { itk::ImageRegionConstIteratorWithIndex mi(this->m_MovingImage, this->m_MovingImage->GetBufferedRegion() ); - while( !mi.IsAtEnd() ) + const bool movingMaskIsPresent = !(this->m_MovingImageMask.IsNull()); + if( movingMaskIsPresent ) { typename TMovingImage::PointType movingSpacePhysicalPoint; - this->m_MovingImage->TransformIndexToPhysicalPoint(mi.GetIndex(), movingSpacePhysicalPoint); - // A null mask implies entire space is to be used. - if( this->m_MovingImageMask.IsNull() - || this->m_MovingImageMask->IsInside(movingSpacePhysicalPoint) - ) + while( !mi.IsAtEnd() ) + { + this->m_MovingImage->TransformIndexToPhysicalPoint(mi.GetIndex(), movingSpacePhysicalPoint); + const bool shouldCheckPixelIntensity = this->m_MovingImageMask->IsInside(movingSpacePhysicalPoint); + if( shouldCheckPixelIntensity ) + { + const PDFValueType & currValue = mi.Get(); + this->m_MovingImageTrueMin = std::min(m_MovingImageTrueMin, currValue); + this->m_MovingImageTrueMax = std::max(m_MovingImageTrueMax, currValue); + } + ++mi; + } + } + else + { + while( !mi.IsAtEnd() ) { - const typename TMovingImage::PixelType currValue = mi.Get(); - this->m_MovingImageTrueMin = (m_MovingImageTrueMin < currValue) ? this->m_MovingImageTrueMin : currValue; - this->m_MovingImageTrueMax = (m_MovingImageTrueMax > currValue) ? this->m_MovingImageTrueMax : currValue; + const PDFValueType & currValue = mi.Get(); + this->m_MovingImageTrueMin = std::min(m_MovingImageTrueMin, currValue); + this->m_MovingImageTrueMax = std::max(m_MovingImageTrueMax, currValue); + ++mi; } - ++mi; } } @@ -218,10 +244,10 @@ { const int binRange = this->m_NumberOfHistogramBins / this->m_NumberOfThreads; - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; threadId++ ) { - this->m_MMIMetricPerThreadVariables[threadID].JointPDFStartBin = threadID * binRange; - this->m_MMIMetricPerThreadVariables[threadID].JointPDFEndBin = ( threadID + 1 ) * binRange - 1; + this->m_MMIMetricPerThreadVariables[threadId].JointPDFStartBin = threadId * binRange; + this->m_MMIMetricPerThreadVariables[threadId].JointPDFEndBin = ( threadId + 1 ) * binRange - 1; } // Ensure that the last EndBin range contains the last histogram bin @@ -259,13 +285,13 @@ * Allocate memory for the joint PDF and joint PDF derivatives. * The joint PDF and joint PDF derivatives are store as itk::Image. */ - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; ++threadID ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; ++threadId ) { - this->m_MMIMetricPerThreadVariables[threadID].JointPDF = JointPDFType::New(); - this->m_MMIMetricPerThreadVariables[threadID].JointPDF->SetRegions(jointPDFRegion); - this->m_MMIMetricPerThreadVariables[threadID].JointPDF->SetOrigin(origin); - this->m_MMIMetricPerThreadVariables[threadID].JointPDF->SetSpacing(spacing); - this->m_MMIMetricPerThreadVariables[threadID].JointPDF->Allocate(); + this->m_MMIMetricPerThreadVariables[threadId].JointPDF = JointPDFType::New(); + this->m_MMIMetricPerThreadVariables[threadId].JointPDF->SetRegions(jointPDFRegion); + this->m_MMIMetricPerThreadVariables[threadId].JointPDF->SetOrigin(origin); + this->m_MMIMetricPerThreadVariables[threadId].JointPDF->SetSpacing(spacing); + this->m_MMIMetricPerThreadVariables[threadId].JointPDF->Allocate(); } } @@ -301,11 +327,11 @@ } // Set the regions and allocate - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; threadId++ ) { - this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives = JointPDFDerivativesType::New(); - this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives->SetRegions( jointPDFDerivativesRegion); - this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives->Allocate(); + this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives = JointPDFDerivativesType::New(); + this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives->SetRegions( jointPDFDerivativesRegion); + this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives->Allocate(); } } } @@ -313,10 +339,10 @@ { // Deallocate the memory that may have been allocated for // previous runs of the metric. - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; ++threadID ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; ++threadId ) { // Not needed if this->m_UseExplicitPDFDerivatives=false - this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives = NULL; + this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives = ITK_NULLPTR; } /** Allocate memory for helper array that will contain the pRatios @@ -326,10 +352,10 @@ this->m_PRatioArray.SetSize(this->m_NumberOfHistogramBins, this->m_NumberOfHistogramBins); this->m_PRatioArray.Fill(0.0); - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; threadId++ ) { - this->m_MMIMetricPerThreadVariables[threadID].MetricDerivative.SetSize( this->GetNumberOfParameters() ); - this->m_MMIMetricPerThreadVariables[threadID].MetricDerivative.Fill(NumericTraits::Zero); + this->m_MMIMetricPerThreadVariables[threadId].MetricDerivative.SetSize( this->GetNumberOfParameters() ); + this->m_MMIMetricPerThreadVariables[threadId].MetricDerivative.Fill(NumericTraits::Zero); } } /** @@ -388,21 +414,21 @@ template inline void MattesMutualInformationImageToImageMetric -::GetValueThreadPreProcess(ThreadIdType threadID, +::GetValueThreadPreProcess(ThreadIdType threadId, bool withinSampleThread) const { - this->Superclass::GetValueThreadPreProcess(threadID, withinSampleThread); + this->Superclass::GetValueThreadPreProcess(threadId, withinSampleThread); - this->m_MMIMetricPerThreadVariables[threadID].JointPDF->FillBuffer(0.0F); + this->m_MMIMetricPerThreadVariables[threadId].JointPDF->FillBuffer(0.0F); - this->m_MMIMetricPerThreadVariables[threadID].FixedImageMarginalPDF = std::vector( + this->m_MMIMetricPerThreadVariables[threadId].FixedImageMarginalPDF = std::vector( m_NumberOfHistogramBins, 0.0F); } template inline bool MattesMutualInformationImageToImageMetric -::GetValueThreadProcessSample(ThreadIdType threadID, +::GetValueThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & itkNotUsed(mappedPoint), double movingImageValue) const @@ -445,11 +471,11 @@ const unsigned int fixedImageParzenWindowIndex = this->m_FixedImageSamples[fixedImageSample].valueIndex; - this->m_MMIMetricPerThreadVariables[threadID].FixedImageMarginalPDF[fixedImageParzenWindowIndex] += 1; + this->m_MMIMetricPerThreadVariables[threadId].FixedImageMarginalPDF[fixedImageParzenWindowIndex] += 1; // Pointer to affected bin to be updated - JointPDFValueType *pdfPtr = this->m_MMIMetricPerThreadVariables[threadID].JointPDF->GetBufferPointer() - + ( fixedImageParzenWindowIndex * this->m_MMIMetricPerThreadVariables[threadID].JointPDF->GetOffsetTable()[1] ); + JointPDFValueType *pdfPtr = this->m_MMIMetricPerThreadVariables[threadId].JointPDF->GetBufferPointer() + + ( fixedImageParzenWindowIndex * this->m_MMIMetricPerThreadVariables[threadId].JointPDF->GetOffsetTable()[1] ); // Move the pointer to the first affected bin int pdfMovingIndex = static_cast( movingImageParzenWindowIndex ) - 1; @@ -471,15 +497,15 @@ template inline void MattesMutualInformationImageToImageMetric -::GetValueThreadPostProcess( ThreadIdType threadID, +::GetValueThreadPostProcess( ThreadIdType threadId, bool itkNotUsed(withinSampleThread) ) const { const int maxI = this->m_NumberOfHistogramBins - * ( this->m_MMIMetricPerThreadVariables[threadID].JointPDFEndBin- - this->m_MMIMetricPerThreadVariables[threadID].JointPDFStartBin + 1 ); + * ( this->m_MMIMetricPerThreadVariables[threadId].JointPDFEndBin- + this->m_MMIMetricPerThreadVariables[threadId].JointPDFStartBin + 1 ); const unsigned int tPdfPtrOffset = - ( this->m_MMIMetricPerThreadVariables[threadID].JointPDFStartBin * + ( this->m_MMIMetricPerThreadVariables[threadId].JointPDFStartBin * this->m_MMIMetricPerThreadVariables[0].JointPDF->GetOffsetTable()[1] ); JointPDFValueType * const pdfPtrStart = this->m_MMIMetricPerThreadVariables[0].JointPDF->GetBufferPointer() + tPdfPtrOffset; @@ -499,8 +525,8 @@ } } - for( int i = this->m_MMIMetricPerThreadVariables[threadID].JointPDFStartBin; - i <= this->m_MMIMetricPerThreadVariables[threadID].JointPDFEndBin; i++ ) + for( int i = this->m_MMIMetricPerThreadVariables[threadId].JointPDFStartBin; + i <= this->m_MMIMetricPerThreadVariables[threadId].JointPDFEndBin; i++ ) { PDFValueType PDFacc = this->m_MMIMetricPerThreadVariables[0].FixedImageMarginalPDF[i]; for( unsigned int t = 1; t < this->m_NumberOfThreads; t++ ) @@ -513,11 +539,11 @@ // Sum of this threads domain into the // this->m_MMIMetricPerThreadVariables[].JointPDFSum // that covers that part of the domain. - this->m_MMIMetricPerThreadVariables[threadID].JointPDFSum = 0.0; + this->m_MMIMetricPerThreadVariables[threadId].JointPDFSum = 0.0; JointPDFValueType const * pdfPtr = pdfPtrStart; for( int i = 0; i < maxI; i++ ) { - this->m_MMIMetricPerThreadVariables[threadID].JointPDFSum += *( pdfPtr++ ); + this->m_MMIMetricPerThreadVariables[threadId].JointPDFSum += *( pdfPtr++ ); } } @@ -537,9 +563,9 @@ // MUST BE CALLED TO INITIATE PROCESSING this->GetValueMultiThreadedPostProcessInitiate(); // Consolidate to the first element in the vector - for( ThreadIdType threadID = 1; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 1; threadId < this->m_NumberOfThreads; threadId++ ) { - this->m_MMIMetricPerThreadVariables[0].JointPDFSum += this->m_MMIMetricPerThreadVariables[threadID].JointPDFSum; + this->m_MMIMetricPerThreadVariables[0].JointPDFSum += this->m_MMIMetricPerThreadVariables[threadId].JointPDFSum; } if( this->m_MMIMetricPerThreadVariables[0].JointPDFSum < itk::NumericTraits< PDFValueType >::epsilon() ) { @@ -612,13 +638,13 @@ const PDFValueType jointPDFValue = *( jointPDFPtr ); // check for non-zero bin contribution - const PDFValueType closeToZero = vcl_numeric_limits::epsilon(); + const PDFValueType closeToZero = std::numeric_limits::epsilon(); if( jointPDFValue > closeToZero && movingImagePDFValue > closeToZero ) { - const PDFValueType pRatio = vcl_log(jointPDFValue / movingImagePDFValue); + const PDFValueType pRatio = std::log(jointPDFValue / movingImagePDFValue); if( fixedImagePDFValue > closeToZero ) { - sum += jointPDFValue * ( pRatio - vcl_log(fixedImagePDFValue) ); + sum += jointPDFValue * ( pRatio - std::log(fixedImagePDFValue) ); } } // end if-block to check non-zero bin contribution } // end for-loop over moving index @@ -630,22 +656,22 @@ template inline void MattesMutualInformationImageToImageMetric -::GetValueAndDerivativeThreadPreProcess( ThreadIdType threadID, +::GetValueAndDerivativeThreadPreProcess( ThreadIdType threadId, bool itkNotUsed(withinSampleThread) ) const { - this->m_MMIMetricPerThreadVariables[threadID].FixedImageMarginalPDF = std::vector( + this->m_MMIMetricPerThreadVariables[threadId].FixedImageMarginalPDF = std::vector( m_NumberOfHistogramBins, 0.0F); - this->m_MMIMetricPerThreadVariables[threadID].JointPDF->FillBuffer(0.0F); + this->m_MMIMetricPerThreadVariables[threadId].JointPDF->FillBuffer(0.0F); if( this->m_UseExplicitPDFDerivatives ) { - this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives->FillBuffer(0.0F); + this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives->FillBuffer(0.0F); } } template inline bool MattesMutualInformationImageToImageMetric -::GetValueAndDerivativeThreadProcessSample(ThreadIdType threadID, +::GetValueAndDerivativeThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & itkNotUsed(mappedPoint), double movingImageValue, @@ -694,7 +720,7 @@ // Since a zero-order BSpline (box car) kernel is used for // the fixed image marginal pdf, we need only increment the // fixedImageParzenWindowIndex by value of 1.0. - this->m_MMIMetricPerThreadVariables[threadID].FixedImageMarginalPDF[fixedImageParzenWindowIndex] += 1; + this->m_MMIMetricPerThreadVariables[threadId].FixedImageMarginalPDF[fixedImageParzenWindowIndex] += 1; /** * The region of support of the parzen window determines which bins @@ -712,7 +738,7 @@ static_cast( movingImageParzenWindowTerm ); // Pointer to affected bin to be updated - JointPDFValueType *pdfPtr = this->m_MMIMetricPerThreadVariables[threadID].JointPDF->GetBufferPointer() + JointPDFValueType *pdfPtr = this->m_MMIMetricPerThreadVariables[threadId].JointPDF->GetBufferPointer() + ( fixedImageParzenWindowIndex * this->m_NumberOfHistogramBins ) + pdfMovingIndex; @@ -727,7 +753,7 @@ movingImageParzenWindowArg); // Compute PDF derivative contribution. - this->ComputePDFDerivatives(threadID, + this->ComputePDFDerivatives(threadId, fixedImageSample, pdfMovingIndex, movingImageGradientValue, @@ -744,23 +770,23 @@ template inline void MattesMutualInformationImageToImageMetric -::GetValueAndDerivativeThreadPostProcess(ThreadIdType threadID, +::GetValueAndDerivativeThreadPostProcess(ThreadIdType threadId, bool withinSampleThread) const { - this->GetValueThreadPostProcess(threadID, withinSampleThread); + this->GetValueThreadPostProcess(threadId, withinSampleThread); if( this->m_UseExplicitPDFDerivatives ) { const unsigned int rowSize = this->m_NumberOfParameters * this->m_NumberOfHistogramBins; const unsigned int maxI = - rowSize * ( this->m_MMIMetricPerThreadVariables[threadID].JointPDFEndBin - - this->m_MMIMetricPerThreadVariables[threadID].JointPDFStartBin + 1 ); + rowSize * ( this->m_MMIMetricPerThreadVariables[threadId].JointPDFEndBin + - this->m_MMIMetricPerThreadVariables[threadId].JointPDFStartBin + 1 ); JointPDFDerivativesValueType *const pdfDPtrStart = this->m_MMIMetricPerThreadVariables[0].JointPDFDerivatives->GetBufferPointer() - + ( this->m_MMIMetricPerThreadVariables[threadID].JointPDFStartBin * rowSize ); - const unsigned int tPdfDPtrOffset = this->m_MMIMetricPerThreadVariables[threadID].JointPDFStartBin * rowSize; + + ( this->m_MMIMetricPerThreadVariables[threadId].JointPDFStartBin * rowSize ); + const unsigned int tPdfDPtrOffset = this->m_MMIMetricPerThreadVariables[threadId].JointPDFStartBin * rowSize; for( unsigned int t = 1; t < this->m_NumberOfThreads; t++ ) { JointPDFDerivativesValueType * pdfDPtr = pdfDPtrStart; @@ -813,9 +839,9 @@ else { this->m_PRatioArray.Fill(0.0); - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; threadId++ ) { - this->m_MMIMetricPerThreadVariables[threadID].MetricDerivative.Fill(NumericTraits::Zero); + this->m_MMIMetricPerThreadVariables[threadId].MetricDerivative.Fill(NumericTraits::Zero); } this->m_ImplicitDerivativesSecondPass = false; } @@ -828,9 +854,9 @@ // CALL IF DOING THREADED POST PROCESSING this->GetValueAndDerivativeMultiThreadedPostProcessInitiate(); - for( ThreadIdType threadID = 1; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 1; threadId < this->m_NumberOfThreads; threadId++ ) { - this->m_MMIMetricPerThreadVariables[0].JointPDFSum += this->m_MMIMetricPerThreadVariables[threadID].JointPDFSum; + this->m_MMIMetricPerThreadVariables[0].JointPDFSum += this->m_MMIMetricPerThreadVariables[threadId].JointPDFSum; } if( this->m_MMIMetricPerThreadVariables[0].JointPDFSum < itk::NumericTraits< PDFValueType >::epsilon() ) { @@ -900,14 +926,14 @@ const PDFValueType jointPDFValue = *( jointPDFPtr ); // check for non-zero bin contribution - const PDFValueType closeToZero = vcl_numeric_limits::epsilon(); + const PDFValueType closeToZero = std::numeric_limits::epsilon(); if( jointPDFValue > closeToZero && movingImagePDFValue > closeToZero ) { - const PDFValueType pRatio = vcl_log(jointPDFValue / movingImagePDFValue); + const PDFValueType pRatio = std::log(jointPDFValue / movingImagePDFValue); if( fixedImagePDFValue > closeToZero ) { - sum += jointPDFValue * ( pRatio - vcl_log(fixedImagePDFValue) ); + sum += jointPDFValue * ( pRatio - std::log(fixedImagePDFValue) ); } if( this->m_UseExplicitPDFDerivatives ) @@ -981,7 +1007,7 @@ template void MattesMutualInformationImageToImageMetric -::ComputePDFDerivatives(ThreadIdType threadID, +::ComputePDFDerivatives(ThreadIdType threadId, unsigned int sampleNumber, int pdfMovingIndex, const ImageDerivativesType & movingImageGradientValue, @@ -994,13 +1020,13 @@ const int pdfFixedIndex = this->m_FixedImageSamples[sampleNumber].valueIndex; - JointPDFDerivativesValueType *derivPtr=0; + JointPDFDerivativesValueType *derivPtr=ITK_NULLPTR; if( this->m_UseExplicitPDFDerivatives ) { - derivPtr = this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives->GetBufferPointer() - + ( pdfFixedIndex * this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives->GetOffsetTable()[2] ) - + ( pdfMovingIndex * this->m_MMIMetricPerThreadVariables[threadID].JointPDFDerivatives->GetOffsetTable()[1] ); + derivPtr = this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives->GetBufferPointer() + + ( pdfFixedIndex * this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives->GetOffsetTable()[2] ) + + ( pdfMovingIndex * this->m_MMIMetricPerThreadVariables[threadId].JointPDFDerivatives->GetOffsetTable()[1] ); } else { @@ -1021,9 +1047,9 @@ // For instance, Register and UnRegister have mutex locks around // the reference counts. TransformType *transform; - if( threadID > 0 ) + if( threadId > 0 ) { - transform = this->m_ThreaderTransform[threadID - 1]; + transform = this->m_ThreaderTransform[threadId - 1]; } else { @@ -1032,7 +1058,7 @@ // Compute the transform Jacobian. // Should pre-compute - typename TransformType::JacobianType &jacobian = this->m_MMIMetricPerThreadVariables[threadID].Jacobian; + typename TransformType::JacobianType &jacobian = this->m_MMIMetricPerThreadVariables[threadId].Jacobian; transform->ComputeJacobianWithRespectToParameters( this->m_FixedImageSamples[sampleNumber].point, jacobian); for( unsigned int mu = 0; mu < this->m_NumberOfParameters; mu++ ) { @@ -1051,18 +1077,18 @@ } else { - this->m_MMIMetricPerThreadVariables[threadID].MetricDerivative[mu] += precomputedWeight * + this->m_MMIMetricPerThreadVariables[threadId].MetricDerivative[mu] += precomputedWeight * derivativeContribution; } } } else { - const WeightsValueType *weights = NULL; - const IndexValueType * indices = NULL; + const WeightsValueType *weights = ITK_NULLPTR; + const IndexValueType * indices = ITK_NULLPTR; - BSplineTransformWeightsType * weightsHelper = NULL; - BSplineTransformIndexArrayType *indicesHelper = NULL; + BSplineTransformWeightsType * weightsHelper = ITK_NULLPTR; + BSplineTransformIndexArrayType *indicesHelper = ITK_NULLPTR; if( this->m_UseCachingOfBSplineWeights ) { @@ -1077,10 +1103,10 @@ } else { - if( threadID > 0 ) + if( threadId > 0 ) { - weightsHelper = &( this->m_ThreaderBSplineTransformWeights[threadID - 1] ); - indicesHelper = &( this->m_ThreaderBSplineTransformIndices[threadID - 1] ); + weightsHelper = &( this->m_ThreaderBSplineTransformWeights[threadId - 1] ); + indicesHelper = &( this->m_ThreaderBSplineTransformIndices[threadId - 1] ); } else { @@ -1122,7 +1148,7 @@ } else { - this->m_MMIMetricPerThreadVariables[threadID].MetricDerivative[parameterIndex] += precomputedWeight * + this->m_MMIMetricPerThreadVariables[threadId].MetricDerivative[parameterIndex] += precomputedWeight * derivativeContribution; } } // end mu for loop diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanReciprocalSquareDifferencePointSetToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -57,12 +57,10 @@ MeasureType measure = NumericTraits::Zero; this->m_NumberOfPixelsCounted = 0; - double lambdaSquared = vcl_pow(this->m_Lambda, 2); + double lambdaSquared = std::pow(this->m_Lambda, 2); this->SetTransformParameters(parameters); - typedef typename NumericTraits::AccumulateType AccumulateType; - while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { InputPointType inputPoint; @@ -119,12 +117,10 @@ this->m_NumberOfPixelsCounted = 0; - double lambdaSquared = vcl_pow(this->m_Lambda, 2); + double lambdaSquared = std::pow(this->m_Lambda, 2); this->SetTransformParameters(parameters); - typedef typename NumericTraits::AccumulateType AccumulateType; - const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); derivative.Fill(NumericTraits::Zero); @@ -135,7 +131,8 @@ PointDataIterator pointDataItr = fixedPointSet->GetPointData()->Begin(); PointDataIterator pointDataEnd = fixedPointSet->GetPointData()->End(); - TransformJacobianType jacobian; + TransformJacobianType jacobian(TMovingImage::ImageDimension,this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TMovingImage::ImageDimension, TMovingImage::ImageDimension); while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { @@ -154,7 +151,9 @@ const RealType diffSquared = diff * diff; // Now compute the derivatives - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); // Get the gradient by NearestNeighboorInterpolation: // which is equivalent to round up the point components. @@ -178,7 +177,7 @@ // Will it be computationally more efficient to instead calculate the // derivative using finite differences ? sum -= jacobian(dim, par) - * gradient[dim] / ( vcl_pow(lambdaSquared + diffSquared, 2) ); + * gradient[dim] / ( std::pow(lambdaSquared + diffSquared, 2) ); } derivative[par] += diff * sum; } @@ -226,9 +225,7 @@ MeasureType measure = NumericTraits::Zero; this->SetTransformParameters(parameters); - double lambdaSquared = vcl_pow(this->m_Lambda, 2); - - typedef typename NumericTraits::AccumulateType AccumulateType; + double lambdaSquared = std::pow(this->m_Lambda, 2); const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); @@ -240,6 +237,10 @@ PointDataIterator pointDataItr = fixedPointSet->GetPointData()->Begin(); PointDataIterator pointDataEnd = fixedPointSet->GetPointData()->End(); + TransformJacobianType jacobian(TMovingImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TMovingImage::ImageDimension, + TMovingImage::ImageDimension); while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { InputPointType inputPoint; @@ -255,8 +256,9 @@ this->m_NumberOfPixelsCounted++; // Now compute the derivatives - TransformJacobianType jacobian; - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); const RealType diff = movingValue - fixedValue; const RealType diffSquared = diff * diff; @@ -282,7 +284,7 @@ for( unsigned int dim = 0; dim < Self::FixedPointSetDimension; dim++ ) { sum -= jacobian(dim, par) * gradient[dim] - * vcl_pow(lambdaSquared + diffSquared, 2); + * std::pow(lambdaSquared + diffSquared, 2); } derivative[par] += diff * sum; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquareRegistrationFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquareRegistrationFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquareRegistrationFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquareRegistrationFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,8 +44,8 @@ m_TimeStep = 1.0; m_DenominatorThreshold = 1e-9; m_IntensityDifferenceThreshold = 0.001; - this->SetMovingImage(NULL); - this->SetFixedImage(NULL); + this->SetMovingImage(ITK_NULLPTR); + this->SetFixedImage(ITK_NULLPTR); m_FixedImageGradientCalculator = GradientCalculatorType::New(); typename DefaultInterpolatorType::Pointer interp = @@ -146,7 +146,7 @@ if ( normalizemetric ) { denominator = speedValue * speedValue * fixedGradientSquaredMagnitude; - denominator = vcl_sqrt(denominator); + denominator = std::sqrt(denominator); } if ( denominator == 0 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.h 2014-09-03 08:29:34.000000000 +0000 @@ -114,12 +114,12 @@ //purposely not implemented void operator=(const Self &); - inline bool GetValueThreadProcessSample(ThreadIdType threadID, + inline bool GetValueThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & mappedPoint, double movingImageValue) const; - inline bool GetValueAndDerivativeThreadProcessSample(ThreadIdType threadID, + inline bool GetValueAndDerivativeThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & mappedPoint, double movingImageValue, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -36,7 +36,7 @@ { this->SetComputeGradient(true); - m_PerThread = NULL; + m_PerThread = ITK_NULLPTR; this->m_WithinThreadPreProcess = false; this->m_WithinThreadPostProcess = false; @@ -51,7 +51,7 @@ ::~MeanSquaresImageToImageMetric() { delete[] m_PerThread; - m_PerThread = NULL; + m_PerThread = ITK_NULLPTR; } /** @@ -81,23 +81,23 @@ m_PerThread = new AlignedPerThreadType[this->m_NumberOfThreads]; - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; threadId++ ) { - m_PerThread[threadID].m_MSEDerivative.SetSize(this->m_NumberOfParameters); + m_PerThread[threadId].m_MSEDerivative.SetSize(this->m_NumberOfParameters); } } template inline bool MeanSquaresImageToImageMetric -::GetValueThreadProcessSample(ThreadIdType threadID, +::GetValueThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & itkNotUsed(mappedPoint), double movingImageValue) const { double diff = movingImageValue - this->m_FixedImageSamples[fixedImageSample].value; - m_PerThread[threadID].m_MSE += diff * diff; + m_PerThread[threadId].m_MSE += diff * diff; return true; } @@ -153,7 +153,7 @@ template inline bool MeanSquaresImageToImageMetric -::GetValueAndDerivativeThreadProcessSample(ThreadIdType threadID, +::GetValueAndDerivativeThreadProcessSample(ThreadIdType threadId, SizeValueType fixedImageSample, const MovingImagePointType & itkNotUsed(mappedPoint), double movingImageValue, @@ -162,7 +162,7 @@ { double diff = movingImageValue - this->m_FixedImageSamples[fixedImageSample].value; - AlignedPerThreadType &threadS = m_PerThread[threadID]; + AlignedPerThreadType &threadS = m_PerThread[threadId]; threadS.m_MSE += diff * diff; @@ -176,9 +176,9 @@ // the reference counts. TransformType *transform; - if( threadID > 0 ) + if( threadId > 0 ) { - transform = this->m_ThreaderTransform[threadID - 1]; + transform = this->m_ThreaderTransform[threadId - 1]; } else { @@ -232,9 +232,9 @@ memset( derivative.data_block(), 0, this->m_NumberOfParameters * sizeof( double ) ); - for( ThreadIdType threadID = 0; threadID < this->m_NumberOfThreads; threadID++ ) + for( ThreadIdType threadId = 0; threadId < this->m_NumberOfThreads; threadId++ ) { - memset( m_PerThread[threadID].m_MSEDerivative.data_block(), + memset( m_PerThread[threadId].m_MSEDerivative.data_block(), 0, this->m_NumberOfParameters * sizeof( double ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMeanSquaresPointSetToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,7 +59,6 @@ this->SetTransformParameters(parameters); - typedef typename NumericTraits::AccumulateType AccumulateType; while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { @@ -118,8 +117,6 @@ this->SetTransformParameters(parameters); - typedef typename NumericTraits::AccumulateType AccumulateType; - const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); derivative.Fill(NumericTraits::Zero); @@ -130,6 +127,10 @@ PointDataIterator pointDataItr = fixedPointSet->GetPointData()->Begin(); PointDataIterator pointDataEnd = fixedPointSet->GetPointData()->End(); + TransformJacobianType jacobian(TMovingImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TMovingImage::ImageDimension,TMovingImage::ImageDimension); + while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { InputPointType inputPoint; @@ -146,8 +147,9 @@ const RealType diff = movingValue - fixedValue; // Now compute the derivatives - TransformJacobianType jacobian; - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); // Get the gradient by NearestNeighboorInterpolation: // which is equivalent to round up the point components. @@ -217,8 +219,6 @@ this->SetTransformParameters(parameters); - typedef typename NumericTraits::AccumulateType AccumulateType; - const unsigned int ParametersDimension = this->GetNumberOfParameters(); derivative = DerivativeType(ParametersDimension); derivative.Fill(NumericTraits::Zero); @@ -229,6 +229,10 @@ PointDataIterator pointDataItr = fixedPointSet->GetPointData()->Begin(); PointDataIterator pointDataEnd = fixedPointSet->GetPointData()->End(); + TransformJacobianType jacobian(TMovingImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TMovingImage::ImageDimension,TMovingImage::ImageDimension); + while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { InputPointType inputPoint; @@ -244,8 +248,9 @@ this->m_NumberOfPixelsCounted++; // Now compute the derivatives - TransformJacobianType jacobian; - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); const RealType diff = movingValue - fixedValue; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -207,11 +207,11 @@ * output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** Method to return the latest modified time of this object or * any of its cached ivars */ - ModifiedTimeType GetMTime() const; + virtual ModifiedTimeType GetMTime() const ITK_OVERRIDE; #ifdef ITKV3_COMPATIBILITY // StartRegistration is an old API from before @@ -231,11 +231,11 @@ protected: MultiResolutionImageRegistrationMethod(); virtual ~MultiResolutionImageRegistrationMethod() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Method invoked by the pipeline in order to trigger the computation of * the registration. */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Initialize by setting the interconnects between the components. This method is executed at every level of the pyramid with the diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,12 +32,12 @@ { this->SetNumberOfRequiredOutputs(1); // for the Transform - m_FixedImage = 0; // has to be provided by the user. - m_MovingImage = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. - m_Interpolator = 0; // has to be provided by the user. - m_Metric = 0; // has to be provided by the user. - m_Optimizer = 0; // has to be provided by the user. + m_FixedImage = ITK_NULLPTR; // has to be provided by the user. + m_MovingImage = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Interpolator = ITK_NULLPTR; // has to be provided by the user. + m_Metric = ITK_NULLPTR; // has to be provided by the user. + m_Optimizer = ITK_NULLPTR; // has to be provided by the user. // Use MultiResolutionPyramidImageFilter as the default // image pyramids. @@ -274,14 +274,14 @@ const float scaleFactor = static_cast< float >( schedule[level][dim] ); size[dim] = static_cast< typename SizeType::SizeValueType >( - vcl_floor(static_cast< float >( inputSize[dim] ) / scaleFactor) ); + std::floor(static_cast< float >( inputSize[dim] ) / scaleFactor) ); if ( size[dim] < 1 ) { size[dim] = 1; } start[dim] = static_cast< typename IndexType::IndexValueType >( - vcl_ceil(static_cast< float >( inputStart[dim] ) / scaleFactor) ); + std::ceil(static_cast< float >( inputStart[dim] ) / scaleFactor) ); } m_FixedImageRegionPyramid[level].SetSize(size); m_FixedImageRegionPyramid[level].SetIndex(start); @@ -351,7 +351,7 @@ // Invoke an iteration event. // This allows a UI to reset any of the components between // resolution level. - this->InvokeEvent( IterationEvent() ); + this->InvokeEvent( MultiResolutionIterationEvent() ); // Check if there has been a stop request if ( m_Stop ) @@ -474,7 +474,7 @@ break; default: itkExceptionMacro("MakeOutput request for an output number larger than the expected number of outputs"); - return 0; + return ITK_NULLPTR; } } } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -407,11 +407,11 @@ outputSpacing[idim] = inputSpacing[idim] * shrinkFactor; outputSize[idim] = static_cast< SizeValueType >( - vcl_floor(static_cast< double >( inputSize[idim] ) / shrinkFactor) ); + std::floor(static_cast< double >( inputSize[idim] ) / shrinkFactor) ); if ( outputSize[idim] < 1 ) { outputSize[idim] = 1; } outputStartIndex[idim] = static_cast< IndexValueType >( - vcl_ceil(static_cast< double >( inputStartIndex[idim] ) / shrinkFactor) ); + std::ceil(static_cast< double >( inputStartIndex[idim] ) / shrinkFactor) ); } //Now compute the new shifted origin for the updated levels; const typename OutputImageType::PointType::VectorType outputOriginOffset = @@ -499,11 +499,11 @@ double factor = static_cast< double >( m_Schedule[ilevel][idim] ); outputSize[idim] = static_cast< SizeValueType >( - vcl_floor(static_cast< double >( baseSize[idim] ) / factor) ); + std::floor(static_cast< double >( baseSize[idim] ) / factor) ); if ( outputSize[idim] < 1 ) { outputSize[idim] = 1; } outputIndex[idim] = static_cast< IndexValueType >( - vcl_ceil(static_cast< double >( baseIndex[idim] ) / factor) ); + std::ceil(static_cast< double >( baseIndex[idim] ) / factor) ); } outputRegion.SetIndex(outputIndex); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationHistogramImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationHistogramImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationHistogramImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationHistogramImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,11 +43,11 @@ static_cast< HistogramFrequencyRealType >( histogram.GetFrequency(i, 0) ); if ( freq > 0 ) { - entropyX += freq * vcl_log(freq); + entropyX += freq * std::log(freq); } } - entropyX = -entropyX / static_cast< MeasureType >( totalFreq ) + vcl_log(totalFreq); + entropyX = -entropyX / static_cast< MeasureType >( totalFreq ) + std::log(totalFreq); for ( unsigned int i = 0; i < this->GetHistogramSize()[1]; i++ ) { @@ -55,11 +55,11 @@ static_cast< HistogramFrequencyRealType >( histogram.GetFrequency(i, 1) ); if ( freq > 0 ) { - entropyY += freq * vcl_log(freq); + entropyY += freq * std::log(freq); } } - entropyY = -entropyY / static_cast< MeasureType >( totalFreq ) + vcl_log(totalFreq); + entropyY = -entropyY / static_cast< MeasureType >( totalFreq ) + std::log(totalFreq); HistogramIteratorType it = histogram.Begin(); HistogramIteratorType end = histogram.End(); @@ -69,13 +69,13 @@ static_cast< HistogramFrequencyRealType >( it.GetFrequency() ); if ( freq > 0 ) { - jointEntropy += freq * vcl_log(freq); + jointEntropy += freq * std::log(freq); } ++it; } jointEntropy = -jointEntropy - / static_cast< MeasureType >( totalFreq ) + vcl_log(totalFreq); + / static_cast< MeasureType >( totalFreq ) + std::log(totalFreq); return entropyX + entropyY - jointEntropy; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkMutualInformationImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -257,21 +257,21 @@ if( dSumFixed.GetSum() > 0.0 ) { - dLogSumFixed -= vcl_log( dSumFixed.GetSum() ); + dLogSumFixed -= std::log( dSumFixed.GetSum() ); } if( dSumMoving.GetSum() > 0.0 ) { - dLogSumMoving -= vcl_log( dSumMoving.GetSum() ); + dLogSumMoving -= std::log( dSumMoving.GetSum() ); } if( dSumJoint.GetSum() > 0.0 ) { - dLogSumJoint -= vcl_log( dSumJoint.GetSum() ); + dLogSumJoint -= std::log( dSumJoint.GetSum() ); } } // end of sample B loop double nsamp = double(m_NumberOfSpatialSamples); - double threshold = -0.5 *nsamp *vcl_log(m_MinProbability); + double threshold = -0.5 *nsamp *std::log(m_MinProbability); if( dLogSumMoving.GetSum() > threshold || dLogSumFixed.GetSum() > threshold || dLogSumJoint.GetSum() > threshold ) { @@ -282,7 +282,7 @@ MeasureType measure = dLogSumFixed.GetSum() + dLogSumMoving.GetSum() - dLogSumJoint.GetSum(); measure /= nsamp; - measure += vcl_log(nsamp); + measure += std::log(nsamp); return measure; } @@ -376,15 +376,15 @@ if( dSumFixed.GetSum() > 0.0 ) { - dLogSumFixed -= vcl_log( dSumFixed.GetSum() ); + dLogSumFixed -= std::log( dSumFixed.GetSum() ); } if( dDenominatorMoving.GetSum() > 0.0 ) { - dLogSumMoving -= vcl_log( dDenominatorMoving.GetSum() ); + dLogSumMoving -= std::log( dDenominatorMoving.GetSum() ); } if( dDenominatorJoint.GetSum() > 0.0 ) { - dLogSumJoint -= vcl_log( dDenominatorJoint.GetSum() ); + dLogSumJoint -= std::log( dDenominatorJoint.GetSum() ); } /** get the image derivative for this B sample */ @@ -423,7 +423,7 @@ double nsamp = double(m_NumberOfSpatialSamples); - double threshold = -0.5 *nsamp *vcl_log(m_MinProbability); + double threshold = -0.5 *nsamp *std::log(m_MinProbability); if( dLogSumMoving.GetSum() > threshold || dLogSumFixed.GetSum() > threshold || dLogSumJoint.GetSum() > threshold ) { @@ -434,7 +434,7 @@ value = dLogSumFixed.GetSum() + dLogSumMoving.GetSum() - dLogSumJoint.GetSum(); value /= nsamp; - value += vcl_log(nsamp); + value += std::log(nsamp); derivative /= nsamp; derivative /= vnl_math_sqr(m_MovingImageStandardDeviation); @@ -486,7 +486,6 @@ return; } - typedef typename TransformType::JacobianType JacobianType; this->m_Transform->ComputeJacobianWithRespectToParameters(point, jacobian); unsigned int numberOfParameters = this->m_Transform->GetNumberOfParameters(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -114,7 +114,7 @@ sfm -= ( sf * sm / this->m_NumberOfPixelsCounted ); } - const RealType denom = -1.0 * vcl_sqrt(sff * smm); + const RealType denom = -1.0 * std::sqrt(sff * smm); if( this->m_NumberOfPixelsCounted > 0 && denom != 0.0 ) { @@ -220,7 +220,9 @@ ++ti; } - TransformJacobianType jacobian; + TransformJacobianType jacobian(TFixedImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TFixedImage::ImageDimension,TFixedImage::ImageDimension); // Compute contributions to derivatives ti.GoToBegin(); @@ -250,7 +252,9 @@ const RealType movingValue = this->m_Interpolator->Evaluate(transformedPoint); const RealType fixedValue = ti.Get(); - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); // Get the gradient by NearestNeighboorInterpolation: // which is equivalent to round up the point components. @@ -296,7 +300,7 @@ sfm -= ( sf * sm / this->m_NumberOfPixelsCounted ); } - const RealType denom = -1.0 * vcl_sqrt(sff * smm); + const RealType denom = -1.0 * std::sqrt(sff * smm); if( this->m_NumberOfPixelsCounted > 0 && denom != 0.0 ) { @@ -409,6 +413,9 @@ ++ti; } + TransformJacobianType jacobianCache(TFixedImage::ImageDimension,TFixedImage::ImageDimension); + TransformJacobianType jacobian(TFixedImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); // Compute contributions to derivatives ti.GoToBegin(); while( !ti.IsAtEnd() ) @@ -437,8 +444,9 @@ const RealType movingValue = this->m_Interpolator->Evaluate(transformedPoint); const RealType fixedValue = ti.Get(); - TransformJacobianType jacobian; - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); // Get the gradient by NearestNeighboorInterpolation: // which is equivalent to round up the point components. @@ -483,7 +491,7 @@ sfm -= ( sf * sm / this->m_NumberOfPixelsCounted ); } - const RealType denom = -1.0 * vcl_sqrt(sff * smm); + const RealType denom = -1.0 * std::sqrt(sff * smm); if( this->m_NumberOfPixelsCounted > 0 && denom != 0.0 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedCorrelationPointSetToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -101,7 +101,7 @@ sfm -= ( sf * sm / this->m_NumberOfPixelsCounted ); } - const RealType denom = -1.0 * vcl_sqrt(sff * smm); + const RealType denom = -1.0 * std::sqrt(sff * smm); if( this->m_NumberOfPixelsCounted > 0 && denom != 0.0 ) { @@ -169,7 +169,9 @@ PointDataIterator pointDataItr = fixedPointSet->GetPointData()->Begin(); PointDataIterator pointDataEnd = fixedPointSet->GetPointData()->End(); - TransformJacobianType jacobian; + TransformJacobianType jacobian(TMovingImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TMovingImage::ImageDimension,TMovingImage::ImageDimension); while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { @@ -195,7 +197,9 @@ this->m_NumberOfPixelsCounted++; // Now compute the derivatives - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); // Get the gradient by NearestNeighboorInterpolation: // which is equivalent to round up the point components. @@ -244,7 +248,7 @@ } } - const RealType denom = -1.0 * vcl_sqrt(sff * smm); + const RealType denom = -1.0 * std::sqrt(sff * smm); if( this->m_NumberOfPixelsCounted > 0 && denom != 0.0 ) { @@ -316,6 +320,10 @@ PointDataIterator pointDataItr = fixedPointSet->GetPointData()->Begin(); PointDataIterator pointDataEnd = fixedPointSet->GetPointData()->End(); + TransformJacobianType jacobian(TMovingImage::ImageDimension, + this->m_Transform->GetNumberOfParameters()); + TransformJacobianType jacobianCache(TMovingImage::ImageDimension,TMovingImage::ImageDimension); + while( pointItr != pointEnd && pointDataItr != pointDataEnd ) { InputPointType inputPoint; @@ -340,8 +348,9 @@ this->m_NumberOfPixelsCounted++; // Now compute the derivatives - TransformJacobianType jacobian; - this->m_Transform->ComputeJacobianWithRespectToParameters(inputPoint, jacobian); + this->m_Transform->ComputeJacobianWithRespectToParametersCachedTemporaries(inputPoint, + jacobian, + jacobianCache); // Get the gradient by NearestNeighboorInterpolation: // which is equivalent to round up the point components. @@ -390,7 +399,7 @@ } } - const RealType denom = -1.0 * vcl_sqrt(sff * smm); + const RealType denom = -1.0 * std::sqrt(sff * smm); if( this->m_NumberOfPixelsCounted > 0 && denom != 0.0 ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedMutualInformationHistogramImageToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedMutualInformationHistogramImageToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedMutualInformationHistogramImageToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkNormalizedMutualInformationHistogramImageToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,11 +46,11 @@ if ( freq > 0 ) { - entropyX += freq * vcl_log(freq); + entropyX += freq * std::log(freq); } } - entropyX = -entropyX / static_cast< MeasureType >( totalFreq ) + vcl_log(totalFreq); + entropyX = -entropyX / static_cast< MeasureType >( totalFreq ) + std::log(totalFreq); for ( unsigned int i = 0; i < this->GetHistogramSize()[1]; i++ ) { @@ -59,11 +59,11 @@ if ( freq > 0 ) { - entropyY += freq * vcl_log(freq); + entropyY += freq * std::log(freq); } } - entropyY = -entropyY / static_cast< MeasureType >( totalFreq ) + vcl_log(totalFreq); + entropyY = -entropyY / static_cast< MeasureType >( totalFreq ) + std::log(totalFreq); HistogramIteratorType it = histogram.Begin(); HistogramIteratorType end = histogram.End(); @@ -74,13 +74,13 @@ if ( freq > 0 ) { - jointEntropy += freq * vcl_log(freq); + jointEntropy += freq * std::log(freq); } ++it; } jointEntropy = -jointEntropy / static_cast< MeasureType >( totalFreq ) - + vcl_log(totalFreq); + + std::log(totalFreq); return ( entropyX + entropyY ) / jointEntropy; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPDEDeformableRegistrationFunction.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPDEDeformableRegistrationFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPDEDeformableRegistrationFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPDEDeformableRegistrationFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -112,9 +112,9 @@ protected: PDEDeformableRegistrationFunction() { - m_MovingImage = NULL; - m_FixedImage = NULL; - m_DisplacementField = NULL; + m_MovingImage = ITK_NULLPTR; + m_FixedImage = ITK_NULLPTR; + m_DisplacementField = ITK_NULLPTR; m_Energy = 0.0; m_NormalizeGradient = true; m_GradientStep = 1.0; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.h 2014-09-03 08:29:34.000000000 +0000 @@ -158,7 +158,7 @@ itkGetConstReferenceMacro(ComputeGradient, bool); /** Return the number of parameters required by the Transform */ - unsigned int GetNumberOfParameters(void) const + virtual unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE { return m_Transform->GetNumberOfParameters(); } /** Initialize the Metric by making sure that all the components @@ -169,7 +169,7 @@ protected: PointSetToImageMetric(); virtual ~PointSetToImageMetric() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; mutable SizeValueType m_NumberOfPixelsCounted; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,13 +29,13 @@ PointSetToImageMetric< TFixedPointSet, TMovingImage > ::PointSetToImageMetric() { - m_FixedPointSet = 0; // has to be provided by the user. - m_MovingImage = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. - m_Interpolator = 0; // has to be provided by the user. + m_FixedPointSet = ITK_NULLPTR; // has to be provided by the user. + m_MovingImage = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Interpolator = ITK_NULLPTR; // has to be provided by the user. m_ComputeGradient = true; // metric computes gradient by default m_NumberOfPixelsCounted = 0; // initialize to zero - m_GradientImage = NULL; // computed at initialization + m_GradientImage = ITK_NULLPTR; // computed at initialization } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -156,11 +156,11 @@ * output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** Method to return the latest modified time of this object or * any of its cached ivars */ - ModifiedTimeType GetMTime() const; + virtual ModifiedTimeType GetMTime() const ITK_OVERRIDE; #ifdef ITKV3_COMPATIBILITY /** Method that initiates the registration. */ @@ -181,11 +181,11 @@ protected: PointSetToImageRegistrationMethod(); virtual ~PointSetToImageRegistrationMethod() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Method invoked by the pipeline in order to trigger the computation of * the registration. */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: PointSetToImageRegistrationMethod(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToImageRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,12 +31,12 @@ { this->SetNumberOfRequiredOutputs(1); // for the Transform - m_FixedPointSet = 0; // has to be provided by the user. - m_MovingImage = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. - m_Interpolator = 0; // has to be provided by the user. - m_Metric = 0; // has to be provided by the user. - m_Optimizer = 0; // has to be provided by the user. + m_FixedPointSet = ITK_NULLPTR; // has to be provided by the user. + m_MovingImage = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Interpolator = ITK_NULLPTR; // has to be provided by the user. + m_Metric = ITK_NULLPTR; // has to be provided by the user. + m_Optimizer = ITK_NULLPTR; // has to be provided by the user. m_InitialTransformParameters = ParametersType(1); m_LastTransformParameters = ParametersType(1); @@ -215,7 +215,7 @@ break; default: itkExceptionMacro("MakeOutput request for an output number larger than the expected number of outputs"); - return 0; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.h 2014-09-03 08:29:34.000000000 +0000 @@ -114,7 +114,7 @@ void SetTransformParameters(const ParametersType & parameters) const; /** Return the number of parameters required by the Transform */ - unsigned int GetNumberOfParameters(void) const + virtual unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE { return m_Transform->GetNumberOfParameters(); } /** Initialize the Metric by making sure that all the components @@ -125,7 +125,7 @@ protected: PointSetToPointSetMetric(); virtual ~PointSetToPointSetMetric() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; FixedPointSetConstPointer m_FixedPointSet; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetMetric.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,9 +27,9 @@ PointSetToPointSetMetric< TFixedPointSet, TMovingPointSet > ::PointSetToPointSetMetric() { - m_FixedPointSet = 0; // has to be provided by the user. - m_MovingPointSet = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. + m_FixedPointSet = ITK_NULLPTR; // has to be provided by the user. + m_MovingPointSet = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. } /** Set the parameters that define a unique transform */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -146,11 +146,11 @@ * output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** Method to return the latest modified time of this object or * any of its cached ivars */ - ModifiedTimeType GetMTime() const; + virtual ModifiedTimeType GetMTime() const ITK_OVERRIDE; #ifdef ITKV3_COMPATIBILITY /** Method that initiates the registration. This will Initialize and ensure @@ -174,11 +174,11 @@ protected: PointSetToPointSetRegistrationMethod(); virtual ~PointSetToPointSetRegistrationMethod() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Method invoked by the pipeline in order to trigger the computation of * the registration. */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: PointSetToPointSetRegistrationMethod(const Self &); //purposely not diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToPointSetRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,11 +31,11 @@ { this->SetNumberOfRequiredOutputs(1); // for the Transform - m_FixedPointSet = 0; // has to be provided by the user. - m_MovingPointSet = 0; // has to be provided by the user. - m_Transform = 0; // has to be provided by the user. - m_Metric = 0; // has to be provided by the user. - m_Optimizer = 0; // has to be provided by the user. + m_FixedPointSet = ITK_NULLPTR; // has to be provided by the user. + m_MovingPointSet = ITK_NULLPTR; // has to be provided by the user. + m_Transform = ITK_NULLPTR; // has to be provided by the user. + m_Metric = ITK_NULLPTR; // has to be provided by the user. + m_Optimizer = ITK_NULLPTR; // has to be provided by the user. m_InitialTransformParameters = ParametersType(1); m_LastTransformParameters = ParametersType(1); @@ -204,7 +204,7 @@ break; default: itkExceptionMacro("MakeOutput request for an output number larger than the expected number of outputs"); - return 0; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.h 2014-09-03 08:29:34.000000000 +0000 @@ -103,7 +103,7 @@ protected: PointSetToSpatialObjectDemonsRegistration(); virtual ~PointSetToSpatialObjectDemonsRegistration() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: PointSetToSpatialObjectDemonsRegistration(const Self &); //purposely not diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointSetToSpatialObjectDemonsRegistration.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,8 +29,8 @@ PointSetToSpatialObjectDemonsRegistration< TFixedPointSet, TMovingSpatialObject > ::PointSetToSpatialObjectDemonsRegistration() { - m_FixedPointSet = 0; // has to be provided by the user. - m_MovingSpatialObject = 0; // has to be provided by the user. + m_FixedPointSet = ITK_NULLPTR; // has to be provided by the user. + m_MovingSpatialObject = ITK_NULLPTR; // has to be provided by the user. } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointsLocator.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointsLocator.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkPointsLocator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkPointsLocator.h 2014-09-03 08:29:34.000000000 +0000 @@ -112,7 +112,7 @@ protected: PointsLocator(); ~PointsLocator(); - virtual void PrintSelf(std::ostream& os, Indent indent) const; + virtual void PrintSelf(std::ostream& os, Indent indent) const ITK_OVERRIDE; private: PointsLocator( const Self& ); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -347,14 +347,14 @@ requestedIndex[idim] += radius[idim]; // take into account shrink component - requestedSize[idim] = static_cast< SizeValueType >( vcl_floor( + requestedSize[idim] = static_cast< SizeValueType >( std::floor( static_cast< double >( requestedSize[idim] ) / static_cast< double >( factors[idim] ) ) ); if ( requestedSize[idim] < 1 ) { requestedSize[idim] = 1; } - requestedIndex[idim] = static_cast< IndexValueType >( vcl_ceil( + requestedIndex[idim] = static_cast< IndexValueType >( std::ceil( static_cast< double >( requestedIndex[idim] ) / static_cast< double >( factors[idim] ) ) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkSimpleMultiResolutionImageRegistrationUI.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkSimpleMultiResolutionImageRegistrationUI.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkSimpleMultiResolutionImageRegistrationUI.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkSimpleMultiResolutionImageRegistrationUI.h 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,8 @@ class SimpleMultiResolutionImageRegistrationUI { public: - SimpleMultiResolutionImageRegistrationUI( TRegistrator * ptr ) + SimpleMultiResolutionImageRegistrationUI( TRegistrator * ptr ): + m_Tag(0) { if ( !ptr ) return; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkTimeVaryingBSplineVelocityFieldTransformParametersAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ this->m_RequiredTransformDomainOrigin.Fill( 0.0 ); this->m_RequiredTransformDomainDirection.SetIdentity(); - this->m_RequiredTransformDomainSize.Fill( 1.0 ); + this->m_RequiredTransformDomainSize.Fill( 1 ); this->m_RequiredTransformDomainSpacing.Fill( 0.0 ); this->m_RequiredTransformDomainMeshSize.Fill( 1 ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptorBase.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptorBase.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptorBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptorBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -67,13 +67,14 @@ itkTypeMacro( TransformParametersAdaptorBase, Object ); /** Typedefs associated with the transform */ - typedef TTransform TransformType; - typedef typename TransformType::Pointer TransformPointer; - typedef typename TransformType::ParametersType ParametersType; + typedef TTransform TransformBaseType; + typedef typename TransformBaseType::Pointer TransformBasePointer; + typedef typename TransformBaseType::ParametersType ParametersType; typedef typename ParametersType::ValueType ParametersValueType; - /** Set the transform to be adapted */ - itkSetObjectMacro( Transform, TransformType ); + // note: the void pointer is use to ensure this method has lower + // overloaded priority and avoid an ambiguous overloaded method + virtual void SetTransform( TransformBaseType *_arg, void * priorityLower = ITK_NULLPTR ) = 0; /** Set the fixed parameters */ itkSetMacro( RequiredFixedParameters, ParametersType ); @@ -88,13 +89,12 @@ TransformParametersAdaptorBase() {} ~TransformParametersAdaptorBase() {} - void PrintSelf( std::ostream & os, Indent indent ) const + virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE { - this->m_Transform->Print( os, indent ); + Superclass::PrintSelf( os, indent ); os << "Fixed parameters" << this->m_RequiredFixedParameters << std::endl; } - TransformPointer m_Transform; ParametersType m_RequiredFixedParameters; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptor.h otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptor.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/include/itkTransformParametersAdaptor.h 2014-09-03 08:29:34.000000000 +0000 @@ -19,6 +19,7 @@ #define __itkTransformParametersAdaptor_h #include "itkTransformParametersAdaptorBase.h" +#include "itkTransform.h" namespace itk { @@ -52,13 +53,13 @@ */ template class TransformParametersAdaptor -: public TransformParametersAdaptorBase +: public TransformParametersAdaptorBase< Transform > { public: /** Standard class typedefs. */ typedef TransformParametersAdaptor Self; - typedef TransformParametersAdaptorBase Superclass; + typedef TransformParametersAdaptorBase > Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; @@ -66,14 +67,23 @@ itkTypeMacro( TransformParametersAdaptor, TransformParametersAdaptorBase ); /** Typedefs associated with the transform */ + + typedef typename Superclass::TransformBaseType TransformBaseType; typedef TTransform TransformType; - typedef typename Superclass::TransformPointer TransformPointer; - typedef typename Superclass::ParametersType ParametersType; + typedef typename TransformType::Pointer TransformPointer; + typedef typename TransformType::ParametersType ParametersType; typedef typename Superclass::ParametersValueType ParametersValueType; /** Set the transform to be adapted */ itkSetObjectMacro( Transform, TransformType ); + virtual void SetTransform( TransformBaseType * _arg, void * ) + { + TransformType *tx = dynamic_cast(_arg); + itkAssertOrThrowMacro( tx != ITK_NULLPTR, "Unable to convert Transform to require concrete transform!" ); + this->SetTransform(tx); + } + /** New macro for creation of through the object factory. */ itkNewMacro( Self ); @@ -90,13 +100,13 @@ TransformParametersAdaptor() {} ~TransformParametersAdaptor() {} - void PrintSelf( std::ostream & os, Indent itkNotUsed( indent ) ) const + void PrintSelf( std::ostream & os, Indent indent ) const { - os << "Fixed parameters: " << this->m_RequiredFixedParameters << std::endl; + Superclass::PrintSelf( os, indent ); + itkPrintSelfObjectMacro( Transform ); } TransformPointer m_Transform; - ParametersType m_RequiredFixedParameters; private: TransformParametersAdaptor( const Self & ); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkBlockMatchingImageFilter.wrap otb-4.2.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkBlockMatchingImageFilter.wrap --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkBlockMatchingImageFilter.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkBlockMatchingImageFilter.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,7 @@ -itk_wrap_class("itk::BlockMatchingImageFilter" POINTER_WITH_2_SUPERCLASSES) - itk_wrap_image_filter("${WRAP_ITK_REAL}" 1 3) -itk_end_wrap_class() +itk_wrap_filter_dims(has_d_3 3) + +if(has_d_3) + itk_wrap_class("itk::BlockMatchingImageFilter" POINTER_WITH_2_SUPERCLASSES) + itk_wrap_image_filter("${WRAP_ITK_REAL}" 1 3) + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkCenteredVersorTransformInitializer.wrap otb-4.2.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkCenteredVersorTransformInitializer.wrap --- otb-4.0.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkCenteredVersorTransformInitializer.wrap 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Common/wrapping/itkCenteredVersorTransformInitializer.wrap 2014-09-03 08:29:34.000000000 +0000 @@ -1,4 +1,7 @@ -itk_wrap_class("itk::CenteredVersorTransformInitializer" POINTER) - # the superclass use a class which support only dim=3 - itk_wrap_image_filter("${WRAP_ITK_SCALAR}" 2 3) -itk_end_wrap_class() +itk_wrap_filter_dims(has_d_3 3) + +if(has_d_3) + itk_wrap_class("itk::CenteredVersorTransformInitializer" POINTER) + itk_wrap_image_filter("${WRAP_ITK_SCALAR}" 2 3) + itk_end_wrap_class() +endif(has_d_3) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/GPUPDEDeformable/include/itkGPUDemonsRegistrationFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -297,7 +297,7 @@ { m_Metric = m_SumOfSquaredDifference / static_cast( m_NumberOfPixelsProcessed ); - m_RMSChange = vcl_sqrt( m_SumOfSquaredChange / + m_RMSChange = std::sqrt( m_SumOfSquaredChange / static_cast( m_NumberOfPixelsProcessed ) ); } } @@ -415,7 +415,7 @@ { m_Metric = m_SumOfSquaredDifference / static_cast< double >( m_NumberOfPixelsProcessed ); - m_RMSChange = vcl_sqrt( m_SumOfSquaredChange + m_RMSChange = std::sqrt( m_SumOfSquaredChange / static_cast< double >( m_NumberOfPixelsProcessed ) ); } m_MetricCalculationLock.Unlock(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-09-03 08:29:34.000000000 +0000 @@ -143,7 +143,9 @@ } ScanParametersType; protected: - ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader() {} + ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader() : + m_ANTSAssociate(ITK_NULLPTR) + {} /** * Dense threader and sparse threader invoke different in multi-threading. This class uses overloaded @@ -216,7 +218,7 @@ const MovingImageGradientType & itkNotUsed(mappedMovingImageGradient), MeasureType & itkNotUsed(metricValueReturn), DerivativeType & itkNotUsed(localDerivativeReturn), - const ThreadIdType itkNotUsed(threadID) ) const + const ThreadIdType itkNotUsed(threadId) ) const { itkExceptionMacro("ProcessPoint should never be reached in ANTS CC metric threader class."); } @@ -250,12 +252,12 @@ * UpdateQueuesAtBeginningOfLine or \c UpdateQueuesToNextScanWindow. */ void UpdateQueues(const ScanIteratorType &scanIt, ScanMemType &scanMem, const ScanParametersType &scanParameters, - const ThreadIdType threadID) const; + const ThreadIdType threadId) const; void UpdateQueuesAtBeginningOfLine( const ScanIteratorType &scanIt, ScanMemType &scanMem, const ScanParametersType &scanParameters, - const ThreadIdType threadID) const; + const ThreadIdType threadId) const; /** Increment the iterator and check to see if we're at the end of the * line. If so, go to the next line. Otherwise, add the @@ -263,19 +265,19 @@ void UpdateQueuesToNextScanWindow( const ScanIteratorType &scanIt, ScanMemType &scanMem, const ScanParametersType &scanParameters, - const ThreadIdType threadID) const; + const ThreadIdType threadId) const; /** Test to see if there are any voxels we need to handle in the current * window. */ bool ComputeInformationFromQueues( const ScanIteratorType &scanIt, ScanMemType &scanMem, const ScanParametersType &scanParameters, - const ThreadIdType threadID) const; + const ThreadIdType threadId) const; void ComputeMovingTransformDerivative( const ScanIteratorType &scanIt, ScanMemType &scanMem, const ScanParametersType &scanParameters, DerivativeType &deriv, - MeasureType &local_cc, const ThreadIdType threadID) const; + MeasureType &local_cc, const ThreadIdType threadId) const; private: ANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader( const Self & ); // purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkANTSNeighborhoodCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ { /* Store the casted pointer to avoid dynamic casting in tight loops. */ this->m_ANTSAssociate = dynamic_cast< TNeighborhoodCorrelationMetric * >( this->m_Associate ); - if( this->m_ANTSAssociate == NULL ) + if( this->m_ANTSAssociate == ITK_NULLPTR ) { itkExceptionMacro("Dynamic casting of associate pointer failed."); } @@ -112,7 +112,7 @@ /* call base method */ /* Store the casted pointer to avoid dynamic casting in tight loops. */ this->m_ANTSAssociate = dynamic_cast< TNeighborhoodCorrelationMetric * >( this->m_Associate ); - if( this->m_ANTSAssociate == NULL ) + if( this->m_ANTSAssociate == ITK_NULLPTR ) { itkExceptionMacro("Dynamic casting of associate pointer failed."); } @@ -503,10 +503,15 @@ } /* Use a pre-allocated jacobian object for efficiency */ - JacobianType & jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobian; + typedef JacobianType & JacobianReferenceType; + JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobian; + JacobianReferenceType jacobianPositional = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobianPositional; /** For dense transforms, this returns identity */ - this->m_Associate->GetMovingTransform()->ComputeJacobianWithRespectToParameters( scanMem.virtualPoint, jacobian ); + this->m_Associate->GetMovingTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(scanMem.virtualPoint, + jacobian, + jacobianPositional); NumberOfParametersType numberOfLocalParameters = this->m_Associate->GetMovingTransform()->GetNumberOfLocalParameters(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-09-03 08:29:34.000000000 +0000 @@ -110,7 +110,7 @@ const MovingImageGradientType & mappedMovingImageGradient, MeasureType & metricValueReturn, DerivativeType & localDerivativeReturn, - const ThreadIdType threadID ) const; + const ThreadIdType threadId ) const; private: CorrelationImageToImageMetricv4GetValueAndDerivativeThreader( const Self & ); // purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,10 +25,10 @@ template CorrelationImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric, TCorrelationMetric> -::CorrelationImageToImageMetricv4GetValueAndDerivativeThreader(): - m_CorrelationMetricValueDerivativePerThreadVariables( NULL ) -{ -} +::CorrelationImageToImageMetricv4GetValueAndDerivativeThreader() : + m_CorrelationMetricValueDerivativePerThreadVariables( ITK_NULLPTR ), + m_CorrelationAssociate( ITK_NULLPTR ) +{} template @@ -48,7 +48,7 @@ /* Store the casted pointer to avoid dynamic casting in tight loops. */ this->m_CorrelationAssociate = dynamic_cast(this->m_Associate); - if( this->m_CorrelationAssociate == NULL ) + if( this->m_CorrelationAssociate == ITK_NULLPTR ) { itkExceptionMacro("Dynamic casting of associate pointer failed."); } @@ -56,10 +56,11 @@ /* This size always comes from the moving image */ const NumberOfParametersType globalDerivativeSize = this->GetCachedNumberOfParameters(); + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); // set size delete[] m_CorrelationMetricValueDerivativePerThreadVariables; - m_CorrelationMetricValueDerivativePerThreadVariables = new AlignedCorrelationMetricValueDerivativePerThreadStruct[ this->GetNumberOfThreadsUsed() ]; - for (ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); i++) + m_CorrelationMetricValueDerivativePerThreadVariables = new AlignedCorrelationMetricValueDerivativePerThreadStruct[ numThreadsUsed ]; + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { this->m_CorrelationMetricValueDerivativePerThreadVariables[i].fdm.SetSize(globalDerivativeSize); this->m_CorrelationMetricValueDerivativePerThreadVariables[i].mdm.SetSize(globalDerivativeSize); @@ -67,7 +68,7 @@ //--------------------------------------------------------------- // Set initial values. - for (ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); i++) + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { m_CorrelationMetricValueDerivativePerThreadVariables[i].fm = NumericTraits::Zero; m_CorrelationMetricValueDerivativePerThreadVariables[i].f2 = NumericTraits::Zero; @@ -89,11 +90,12 @@ /* This size always comes from the moving image */ const NumberOfParametersType globalDerivativeSize = this->GetCachedNumberOfParameters(); + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); /* Store the number of valid points the enclosing class \c * m_NumberOfValidPoints by collecting the valid points per thread. */ this->m_CorrelationAssociate->m_NumberOfValidPoints = NumericTraits::Zero; - for (ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); i++) + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { this->m_CorrelationAssociate->m_NumberOfValidPoints += this->m_GetValueAndDerivativePerThreadVariables[i].NumberOfValidPoints; } @@ -112,7 +114,7 @@ InternalComputationValueType fm = NumericTraits::Zero; InternalComputationValueType f2 = NumericTraits::Zero; InternalComputationValueType m2 = NumericTraits::Zero; - for (ThreadIdType threadId = 0; threadId < this->GetNumberOfThreadsUsed(); ++threadId) + for (ThreadIdType threadId = 0; threadId < numThreadsUsed; ++threadId) { fm += this->m_CorrelationMetricValueDerivativePerThreadVariables[threadId].fm; m2 += this->m_CorrelationMetricValueDerivativePerThreadVariables[threadId].m2; @@ -140,7 +142,7 @@ const InternalComputationValueType fc = static_cast( 2.0 ); - for (ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); i++) + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { fdm += this->m_CorrelationMetricValueDerivativePerThreadVariables[i].fdm; mdm += this->m_CorrelationMetricValueDerivativePerThreadVariables[i].mdm; @@ -265,7 +267,7 @@ const MovingImageGradientType & movingImageGradient, MeasureType & itkNotUsed(metricValueReturn), DerivativeType & itkNotUsed(localDerivativeReturn), - const ThreadIdType threadID) const + const ThreadIdType threadId) const { /* @@ -278,7 +280,7 @@ const InternalComputationValueType & f1 = fixedImageValue - this->m_CorrelationAssociate->m_AverageFix; const InternalComputationValueType & m1 = movingImageValue - this->m_CorrelationAssociate->m_AverageMov; - AlignedCorrelationMetricValueDerivativePerThreadStruct & cumsum = this->m_CorrelationMetricValueDerivativePerThreadVariables[threadID]; + AlignedCorrelationMetricValueDerivativePerThreadStruct & cumsum = this->m_CorrelationMetricValueDerivativePerThreadVariables[threadId]; cumsum.f += f1; cumsum.m += m1; cumsum.f2 += f1 * f1; @@ -289,10 +291,14 @@ { /* Use a pre-allocated jacobian object for efficiency */ typedef typename TImageToImageMetric::JacobianType & JacobianReferenceType; - JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadID].MovingTransformJacobian; + JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobian; + JacobianReferenceType jacobianPositional = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobianPositional; /** For dense transforms, this returns identity */ - this->m_CorrelationAssociate->GetMovingTransform()->ComputeJacobianWithRespectToParameters(virtualPoint, jacobian); + this->m_CorrelationAssociate->GetMovingTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(virtualPoint, + jacobian, + jacobianPositional); for (unsigned int par = 0; par < this->m_CorrelationAssociate->GetNumberOfLocalParameters(); par++) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4HelperThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,10 +25,10 @@ template CorrelationImageToImageMetricv4HelperThreader< TDomainPartitioner, TImageToImageMetric, TCorrelationMetric> -::CorrelationImageToImageMetricv4HelperThreader(): - m_CorrelationMetricPerThreadVariables( NULL ) -{ -} +::CorrelationImageToImageMetricv4HelperThreader() : + m_CorrelationMetricPerThreadVariables( ITK_NULLPTR ), + m_CorrelationAssociate( ITK_NULLPTR ) +{} template @@ -49,12 +49,13 @@ /* Store the casted pointer to avoid dynamic casting in tight loops. */ this->m_CorrelationAssociate = dynamic_cast(this->m_Associate); + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); delete[] this->m_CorrelationMetricPerThreadVariables; - this->m_CorrelationMetricPerThreadVariables = new AlignedCorrelationMetricPerThreadStruct[ this->GetNumberOfThreadsUsed() ]; + this->m_CorrelationMetricPerThreadVariables = new AlignedCorrelationMetricPerThreadStruct[ numThreadsUsed ]; //--------------------------------------------------------------- // Set initial values. - for (ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); i++) + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { this->m_CorrelationMetricPerThreadVariables[i].FixSum = NumericTraits::Zero; this->m_CorrelationMetricPerThreadVariables[i].MovSum = NumericTraits::Zero; @@ -72,7 +73,9 @@ * m_NumberOfValidPoints by collecting the valid points per thread. */ this->m_CorrelationAssociate->m_NumberOfValidPoints = NumericTraits::Zero; - for (ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); i++) + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); + + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { this->m_CorrelationAssociate->m_NumberOfValidPoints += this->m_GetValueAndDerivativePerThreadVariables[i].NumberOfValidPoints; } @@ -86,7 +89,7 @@ InternalComputationValueType sumF = NumericTraits::Zero; InternalComputationValueType sumM = NumericTraits::Zero; - for (ThreadIdType threadId = 0; threadId < this->GetNumberOfThreadsUsed(); ++threadId) + for (ThreadIdType threadId = 0; threadId < numThreadsUsed; ++threadId) { sumF += this->m_CorrelationMetricPerThreadVariables[threadId].FixSum; sumM += this->m_CorrelationMetricPerThreadVariables[threadId].MovSum; @@ -100,7 +103,7 @@ bool CorrelationImageToImageMetricv4HelperThreader -::ProcessVirtualPoint( const VirtualIndexType & itkNotUsed(virtualIndex), const VirtualPointType & virtualPoint, const ThreadIdType threadID ) +::ProcessVirtualPoint( const VirtualIndexType & itkNotUsed(virtualIndex), const VirtualPointType & virtualPoint, const ThreadIdType threadId ) { FixedImagePointType mappedFixedPoint; FixedImagePixelType mappedFixedPixelValue; @@ -148,8 +151,8 @@ /* Do the specific calculations for values */ try { - this->m_CorrelationMetricPerThreadVariables[threadID].FixSum += mappedFixedPixelValue; - this->m_CorrelationMetricPerThreadVariables[threadID].MovSum += mappedMovingPixelValue; + this->m_CorrelationMetricPerThreadVariables[threadId].FixSum += mappedFixedPixelValue; + this->m_CorrelationMetricPerThreadVariables[threadId].MovSum += mappedMovingPixelValue; } catch( ExceptionObject & exc ) { @@ -160,7 +163,7 @@ } if( pointIsValid ) { - this->m_GetValueAndDerivativePerThreadVariables[threadID].NumberOfValidPoints++; + this->m_GetValueAndDerivativePerThreadVariables[threadId].NumberOfValidPoints++; } return pointIsValid; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkCorrelationImageToImageMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,15 +25,17 @@ template CorrelationImageToImageMetricv4 -::CorrelationImageToImageMetricv4() +::CorrelationImageToImageMetricv4() : + m_AverageFix(0.0), + m_AverageMov(0.0) { - // We have our own GetValueAndDerivativeThreader's that we want - // ImageToImageMetricv4 to use. - this->m_DenseGetValueAndDerivativeThreader = CorrelationDenseGetValueAndDerivativeThreaderType::New(); - this->m_SparseGetValueAndDerivativeThreader = CorrelationSparseGetValueAndDerivativeThreaderType::New(); + this->m_DenseGetValueAndDerivativeThreader = + CorrelationDenseGetValueAndDerivativeThreaderType::New(); + this->m_SparseGetValueAndDerivativeThreader = + CorrelationSparseGetValueAndDerivativeThreaderType::New(); - this->m_HelperDenseThreader = CorrelationHelperDenseThreaderType::New(); - this->m_HelperSparseThreader = CorrelationHelperSparseThreaderType::New(); + m_HelperDenseThreader = CorrelationHelperDenseThreaderType::New(); + m_HelperSparseThreader = CorrelationHelperSparseThreaderType::New(); if( this->m_MovingTransform->GetTransformCategory() == MovingTransformType::DisplacementField ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-09-03 08:29:34.000000000 +0000 @@ -64,7 +64,9 @@ typedef typename Superclass::ImageDimensionType ImageDimensionType; protected: - DemonsImageToImageMetricv4GetValueAndDerivativeThreader() {} + DemonsImageToImageMetricv4GetValueAndDerivativeThreader() : + m_DemonsAssociate(ITK_NULLPTR) + {} /** Overload. * Get pointer to metric object. @@ -85,7 +87,7 @@ const MovingImageGradientType & mappedMovingImageGradient, MeasureType & metricValueReturn, DerivativeType & localDerivativeReturn, - const ThreadIdType threadID ) const; + const ThreadIdType threadId ) const; private: DemonsImageToImageMetricv4GetValueAndDerivativeThreader( const Self & ); // purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkDemonsImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,7 +31,7 @@ /* Store the casted pointer to avoid dynamic casting in tight loops. */ this->m_DemonsAssociate = dynamic_cast( this->m_Associate ); - if( this->m_DemonsAssociate == NULL ) + if( this->m_DemonsAssociate == ITK_NULLPTR ) { itkExceptionMacro("Dynamic casting of associate pointer failed."); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -38,15 +38,17 @@ * * \ingroup ITKMetricsv4 */ -template +template class EuclideanDistancePointSetToPointSetMetricv4: - public PointSetToPointSetMetricv4 + public PointSetToPointSetMetricv4 { public: /** Standard class typedefs. */ typedef EuclideanDistancePointSetToPointSetMetricv4 Self; - typedef PointSetToPointSetMetricv4 Superclass; + typedef PointSetToPointSetMetricv4 Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkEuclideanDistancePointSetToPointSetMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,23 +24,23 @@ { /** Constructor */ -template -EuclideanDistancePointSetToPointSetMetricv4 +template +EuclideanDistancePointSetToPointSetMetricv4 ::EuclideanDistancePointSetToPointSetMetricv4() { } /** Destructor */ -template -EuclideanDistancePointSetToPointSetMetricv4 +template +EuclideanDistancePointSetToPointSetMetricv4 ::~EuclideanDistancePointSetToPointSetMetricv4() { } -template -typename EuclideanDistancePointSetToPointSetMetricv4 +template +typename EuclideanDistancePointSetToPointSetMetricv4 ::MeasureType -EuclideanDistancePointSetToPointSetMetricv4 +EuclideanDistancePointSetToPointSetMetricv4 ::GetLocalNeighborhoodValue( const PointType & point, const PixelType & itkNotUsed( pixel ) ) const { PointType closestPoint; @@ -53,9 +53,9 @@ return distance; } -template +template void -EuclideanDistancePointSetToPointSetMetricv4 +EuclideanDistancePointSetToPointSetMetricv4 ::GetLocalNeighborhoodValueAndDerivative( const PointType & point, MeasureType &measure, LocalDerivativeType & localDerivative, const PixelType & itkNotUsed( pixel ) ) const { @@ -70,9 +70,9 @@ } /** PrintSelf method */ -template +template void -EuclideanDistancePointSetToPointSetMetricv4 +EuclideanDistancePointSetToPointSetMetricv4 ::PrintSelf( std::ostream & os, Indent indent ) const { Superclass::PrintSelf( os, indent ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -40,15 +40,17 @@ * * \ingroup ITKMetricsv4 */ -template +template class ExpectationBasedPointSetToPointSetMetricv4: - public PointSetToPointSetMetricv4 + public PointSetToPointSetMetricv4 { public: /** Standard class typedefs. */ typedef ExpectationBasedPointSetToPointSetMetricv4 Self; - typedef PointSetToPointSetMetricv4 Superclass; + typedef PointSetToPointSetMetricv4 Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; @@ -105,7 +107,7 @@ /** Clone method will clone the existing instance of this type, * including its internal member variables. */ - virtual ::itk::LightObject::Pointer Clone( void ) const; + virtual typename LightObject::Pointer InternalClone() const; protected: ExpectationBasedPointSetToPointSetMetricv4(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkExpectationBasedPointSetToPointSetMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,24 +24,26 @@ namespace itk { /** Constructor */ -template -ExpectationBasedPointSetToPointSetMetricv4 +template +ExpectationBasedPointSetToPointSetMetricv4 ::ExpectationBasedPointSetToPointSetMetricv4() : m_PointSetSigma( 1.0 ), + m_PreFactor( 0.0 ), + m_Denominator( 0.0 ), m_EvaluationKNeighborhood( 50 ) { } /** Destructor */ -template -ExpectationBasedPointSetToPointSetMetricv4 +template +ExpectationBasedPointSetToPointSetMetricv4 ::~ExpectationBasedPointSetToPointSetMetricv4() { } -template +template void -ExpectationBasedPointSetToPointSetMetricv4 +ExpectationBasedPointSetToPointSetMetricv4 ::Initialize( void ) throw ( ExceptionObject ) { Superclass::Initialize(); @@ -50,14 +52,14 @@ { itkExceptionMacro("m_PointSetSigma is too small. <= epsilon"); } - this->m_PreFactor = 1.0 / ( vcl_sqrt( 2 * vnl_math::pi ) * this->m_PointSetSigma ); + this->m_PreFactor = 1.0 / ( std::sqrt( 2 * vnl_math::pi ) * this->m_PointSetSigma ); this->m_Denominator = 2.0 * vnl_math_sqr( this->m_PointSetSigma ); } -template -typename ExpectationBasedPointSetToPointSetMetricv4 +template +typename ExpectationBasedPointSetToPointSetMetricv4 ::MeasureType -ExpectationBasedPointSetToPointSetMetricv4 +ExpectationBasedPointSetToPointSetMetricv4 ::GetLocalNeighborhoodValue( const PointType & point, const PixelType & itkNotUsed( pixel ) ) const { MeasureType localValue = NumericTraits::Zero; @@ -69,15 +71,15 @@ { PointType neighbor = this->m_MovingTransformedPointSet->GetPoint( *it ); const MeasureType distance = point.SquaredEuclideanDistanceTo( neighbor ); - localValue -= this->m_PreFactor * vcl_exp( -distance / this->m_Denominator ); + localValue -= this->m_PreFactor * std::exp( -distance / this->m_Denominator ); } return localValue; } -template +template void -ExpectationBasedPointSetToPointSetMetricv4 +ExpectationBasedPointSetToPointSetMetricv4 ::GetLocalNeighborhoodValueAndDerivative( const PointType & point, MeasureType &measure, LocalDerivativeType &localDerivative, const PixelType & itkNotUsed( pixel ) ) const { @@ -100,11 +102,11 @@ { PointType neighbor = this->m_MovingTransformedPointSet->GetPoint( *it ); const MeasureType distance = point.SquaredEuclideanDistanceTo( neighbor ); - measureValues[it - neighborhood.begin()] = -this->m_PreFactor * vcl_exp( -distance / this->m_Denominator ); + measureValues[it - neighborhood.begin()] = -this->m_PreFactor * std::exp( -distance / this->m_Denominator ); measure += measureValues[it - neighborhood.begin()]; } - if ( vcl_fabs(measure) <= NumericTraits::epsilon() ) + if ( std::fabs(measure) <= NumericTraits::epsilon() ) { return; } @@ -118,7 +120,7 @@ const MeasureType distance = point.SquaredEuclideanDistanceTo( weightedPoint ); - const MeasureType weight = this->m_PreFactor * vcl_exp( -distance / this->m_Denominator ) / -measure; + const MeasureType weight = this->m_PreFactor * std::exp( -distance / this->m_Denominator ) / -measure; VectorType force = ( weightedPoint - point ) * weight; @@ -128,27 +130,23 @@ } } -template -::itk::LightObject::Pointer -ExpectationBasedPointSetToPointSetMetricv4 -::Clone( void ) const +template +typename LightObject::Pointer +ExpectationBasedPointSetToPointSetMetricv4 +::InternalClone( void ) const { - ::itk::LightObject::Pointer smartPtr; - Pointer copyPtr = Self::New(); + typename Self::Pointer rval = Self::New(); + rval->SetMovingPointSet( this->m_MovingPointSet ); + rval->SetFixedPointSet( this->m_FixedPointSet ); + rval->SetPointSetSigma( this->m_PointSetSigma ); + rval->SetEvaluationKNeighborhood( this->m_EvaluationKNeighborhood ); - copyPtr->m_MovingPointSet = this->m_MovingPointSet; - copyPtr->m_FixedPointSet = this->m_FixedPointSet; - copyPtr->m_PointSetSigma = this->m_PointSetSigma; - copyPtr->m_EvaluationKNeighborhood = this->m_EvaluationKNeighborhood; - - smartPtr = static_cast( copyPtr ); - - return smartPtr; + return rval.GetPointer(); } -template +template void -ExpectationBasedPointSetToPointSetMetricv4 +ExpectationBasedPointSetToPointSetMetricv4 ::PrintSelf( std::ostream& os, Indent indent ) const { Superclass::PrintSelf( os, indent ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -138,7 +138,7 @@ * Results must be returned by derived classes in: * \param metricValueReturn * \param localDerivativeReturn - * \param threadID may be used as needed, for example to access any per-thread + * \param threadId may be used as needed, for example to access any per-thread * data cached during pre-processing by the derived class. * \warning This is called from the threader, and thus must be thread-safe. */ @@ -153,14 +153,14 @@ const MovingImageGradientType & mappedMovingImageGradient, MeasureType & metricValueReturn, DerivativeType & localDerivativeReturn, - const ThreadIdType threadID ) const = 0; + const ThreadIdType threadId ) const = 0; /** Store derivative result from a single point calculation. * \warning If this method is overridden or otherwise not used * in a derived class, be sure to *accumulate* results. */ virtual void StorePointDerivativeResult( const VirtualIndexType & virtualIndex, - const ThreadIdType threadID ); + const ThreadIdType threadId ); struct GetValueAndDerivativePerThreadStruct { @@ -177,6 +177,7 @@ /** Pre-allocated transform jacobian objects, for use as needed by dervied * classes for efficiency. */ JacobianType MovingTransformJacobian; + JacobianType MovingTransformJacobianPositional; }; itkPadStruct( ITK_CACHE_LINE_ALIGNMENT, GetValueAndDerivativePerThreadStruct, PaddedGetValueAndDerivativePerThreadStruct); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreaderBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,9 @@ template< typename TDomainPartitioner, typename TImageToImageMetricv4 > ImageToImageMetricv4GetValueAndDerivativeThreaderBase< TDomainPartitioner, TImageToImageMetricv4 > ::ImageToImageMetricv4GetValueAndDerivativeThreaderBase(): - m_GetValueAndDerivativePerThreadVariables( NULL ) + m_GetValueAndDerivativePerThreadVariables( ITK_NULLPTR ), + m_CachedNumberOfParameters( 0 ), + m_CachedNumberOfLocalParameters( 0 ) { } @@ -45,19 +47,27 @@ { //--------------------------------------------------------------- // Resize the per thread memory objects. + //----------------------------------------------------------------- + // Cache some values + this->m_CachedNumberOfParameters = this->m_Associate->GetNumberOfParameters(); + this->m_CachedNumberOfLocalParameters = this->m_Associate->GetNumberOfLocalParameters(); /* Per-thread results */ + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); delete[] m_GetValueAndDerivativePerThreadVariables; - this->m_GetValueAndDerivativePerThreadVariables = new AlignedGetValueAndDerivativePerThreadStruct[ this->GetNumberOfThreadsUsed() ]; + this->m_GetValueAndDerivativePerThreadVariables = new AlignedGetValueAndDerivativePerThreadStruct[ numThreadsUsed ]; if( this->m_Associate->GetComputeDerivative() ) { - for (ThreadIdType i=0; iGetNumberOfThreadsUsed(); ++i) + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { /* Allocate intermediary per-thread storage used to get results from * derived classes */ - this->m_GetValueAndDerivativePerThreadVariables[i].LocalDerivatives.SetSize( this->m_Associate->GetNumberOfLocalParameters() ); - this->m_GetValueAndDerivativePerThreadVariables[i].MovingTransformJacobian.SetSize( this->m_Associate->VirtualImageDimension, this->m_Associate->GetNumberOfLocalParameters() ); + this->m_GetValueAndDerivativePerThreadVariables[i].LocalDerivatives.SetSize( this->m_CachedNumberOfLocalParameters ); + this->m_GetValueAndDerivativePerThreadVariables[i].MovingTransformJacobian.SetSize( + this->m_Associate->VirtualImageDimension, this->m_CachedNumberOfLocalParameters ); + this->m_GetValueAndDerivativePerThreadVariables[i].MovingTransformJacobianPositional.SetSize( + this->m_Associate->VirtualImageDimension, this->m_Associate->VirtualImageDimension ); if ( this->m_Associate->m_MovingTransform->GetTransformCategory() == MovingTransformType::DisplacementField ) { /* For transforms with local support, e.g. displacement field, @@ -73,7 +83,7 @@ { itkDebugMacro("ImageToImageMetricv4::Initialize: transform does NOT have local support\n"); /* This size always comes from the moving image */ - const NumberOfParametersType globalDerivativeSize = this->m_Associate->GetNumberOfParameters(); + const NumberOfParametersType globalDerivativeSize = this->m_CachedNumberOfParameters; /* Global transforms get a separate derivatives container for each thread * that holds the result over a particular image region. * Use a CompensatedSummation value to provide for better consistency between @@ -85,7 +95,7 @@ //--------------------------------------------------------------- // Set initial values. - for (ThreadIdType thread = 0; threadGetNumberOfThreadsUsed(); thread++) + for (ThreadIdType thread = 0; thread < numThreadsUsed; ++thread) { this->m_GetValueAndDerivativePerThreadVariables[thread].NumberOfValidPoints = NumericTraits< SizeValueType >::Zero; this->m_GetValueAndDerivativePerThreadVariables[thread].Measure = NumericTraits< InternalComputationValueType >::Zero; @@ -96,18 +106,13 @@ /* Be sure to init to 0 here, because the threader may not use * all the threads if the region is better split into fewer * subregions. */ - for( NumberOfParametersType p = 0; p < this->m_Associate->GetNumberOfParameters(); p++ ) + for( NumberOfParametersType p = 0; p < this->m_CachedNumberOfParameters; p++ ) { this->m_GetValueAndDerivativePerThreadVariables[thread].CompensatedDerivatives[p].ResetToZero(); } } } } - - //----------------------------------------------------------------- - // Cache some values - this->m_CachedNumberOfParameters = this->m_Associate->GetNumberOfParameters(); - this->m_CachedNumberOfLocalParameters = this->m_Associate->GetNumberOfLocalParameters(); } template< typename TDomainPartitioner, typename TImageToImageMetricv4 > @@ -115,10 +120,11 @@ ImageToImageMetricv4GetValueAndDerivativeThreaderBase< TDomainPartitioner, TImageToImageMetricv4 > ::AfterThreadedExecution() { + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); /* Store the number of valid points the enclosing class \c * m_NumberOfValidPoints by collecting the valid points per thread. */ this->m_Associate->m_NumberOfValidPoints = NumericTraits< SizeValueType >::Zero; - for (ThreadIdType i=0; iGetNumberOfThreadsUsed(); i++) + for (ThreadIdType i = 0; i < numThreadsUsed; ++i) { this->m_Associate->m_NumberOfValidPoints += this->m_GetValueAndDerivativePerThreadVariables[i].NumberOfValidPoints; } @@ -134,7 +140,7 @@ /* Use a compensated sum to be ready for when there is a very large number of threads */ CompensatedDerivativeValueType sum; sum.ResetToZero(); - for (ThreadIdType i=0; iGetNumberOfThreadsUsed(); i++) + for (ThreadIdType i=0; im_GetValueAndDerivativePerThreadVariables[i].CompensatedDerivatives[p].GetSum(); } @@ -150,7 +156,7 @@ { this->m_Associate->m_Value = NumericTraits::Zero; /* Accumulate the metric value from threads and store the average. */ - for(ThreadIdType threadId = 0; threadId < this->GetNumberOfThreadsUsed(); ++threadId ) + for(ThreadIdType threadId = 0; threadId < numThreadsUsed; ++threadId ) { this->m_Associate->m_Value += this->m_GetValueAndDerivativePerThreadVariables[threadId].Measure; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,14 +30,12 @@ ::ThreadedExecution ( const DomainType & imageSubRegion, const ThreadIdType threadId ) { - VirtualPointType virtualPoint; - VirtualIndexType virtualIndex; typename VirtualImageType::ConstPointer virtualImage = this->m_Associate->GetVirtualImage(); typedef ImageRegionConstIteratorWithIndex< VirtualImageType > IteratorType; - IteratorType it( virtualImage, imageSubRegion ); - for( it.GoToBegin(); !it.IsAtEnd(); ++it ) + VirtualPointType virtualPoint; + for( IteratorType it( virtualImage, imageSubRegion ); !it.IsAtEnd(); ++it ) { - virtualIndex = it.GetIndex(); + const VirtualIndexType & virtualIndex = it.GetIndex(); virtualImage->TransformIndexToPhysicalPoint( virtualIndex, virtualPoint ); this->ProcessVirtualPoint( virtualIndex, virtualPoint, threadId ); } @@ -49,16 +47,15 @@ ::ThreadedExecution ( const DomainType & indexSubRange, const ThreadIdType threadId ) { - VirtualPointType virtualPoint; - VirtualIndexType virtualIndex; - typename VirtualImageType::ConstPointer virtualImage = this->m_Associate->GetVirtualImage(); typename TImageToImageMetricv4::VirtualPointSetType::ConstPointer virtualSampledPointSet = this->m_Associate->GetVirtualSampledPointSet(); typedef typename TImageToImageMetricv4::VirtualPointSetType::MeshTraits::PointIdentifier ElementIdentifierType; const ElementIdentifierType begin = indexSubRange[0]; const ElementIdentifierType end = indexSubRange[1]; + VirtualIndexType virtualIndex; + typename VirtualImageType::ConstPointer virtualImage = this->m_Associate->GetVirtualImage(); for( ElementIdentifierType i = begin; i <= end; ++i ) { - virtualPoint = virtualSampledPointSet->GetPoint( i ); + const VirtualPointType & virtualPoint = virtualSampledPointSet->GetPoint( i ); virtualImage->TransformPhysicalPointToIndex( virtualPoint, virtualIndex ); this->ProcessVirtualPoint( virtualIndex, virtualPoint, threadId ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkImageToImageMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -74,7 +74,7 @@ this->m_NumberOfSkippedFixedSampledPoints = 0; this->m_Value = NumericTraits::max(); - this->m_DerivativeResult = NULL; + this->m_DerivativeResult = ITK_NULLPTR; this->m_ComputeDerivative = false; } @@ -161,13 +161,13 @@ if( ! this->m_UseFixedImageGradientFilter ) { itkDebugMacro("Initialize FixedImageGradientCalculator"); - this->m_FixedImageGradientImage = NULL; + this->m_FixedImageGradientImage = ITK_NULLPTR; this->m_FixedImageGradientCalculator->SetInputImage(this->m_FixedImage); } if( ! this->m_UseMovingImageGradientFilter ) { itkDebugMacro("Initialize MovingImageGradientCalculator"); - this->m_MovingImageGradientImage = NULL; + this->m_MovingImageGradientImage = ITK_NULLPTR; this->m_MovingImageGradientCalculator->SetInputImage(this->m_MovingImage); } @@ -599,54 +599,13 @@ << indent << "UseFloatingPointCorrection: " << this->GetUseFloatingPointCorrection() << std::endl << indent << "FloatingPointCorrectionResolution: " << this->GetFloatingPointCorrectionResolution() << std::endl; - if( this->GetFixedImage() != NULL ) - { - os << indent << "FixedImage: " << this->GetFixedImage() << std::endl; - } - else - { - os << indent << "FixedImage is NULL." << std::endl; - } - if( this->GetMovingImage() != NULL ) - { - os << indent << "MovingImage: " << this->GetMovingImage() << std::endl; - } - else - { - os << indent << "MovingImage is NULL." << std::endl; - } - if( this->GetFixedTransform() != NULL ) - { - os << indent << "FixedTransform: " << this->GetFixedTransform() << std::endl; - } - else - { - os << indent << "FixedTransform is NULL." << std::endl; - } - if( this->GetMovingTransform() != NULL ) - { - os << indent << "MovingTransform: " << this->GetMovingTransform() << std::endl; - } - else - { - os << indent << "MovingTransform is NULL." << std::endl; - } - if( this->GetFixedImageMask() != NULL ) - { - os << indent << "FixedImageMask: " << this->GetFixedImageMask() << std::endl; - } - else - { - os << indent << "FixedImageMask is NULL." << std::endl; - } - if( this->GetMovingImageMask() != NULL ) - { - os << indent << "MovingImageMask: " << this->GetMovingImageMask() << std::endl; - } - else - { - os << indent << "MovingImageMask is NULL." << std::endl; - } + itkPrintSelfObjectMacro( FixedImage ); + itkPrintSelfObjectMacro( MovingImage ); + itkPrintSelfObjectMacro( FixedTransform ); + itkPrintSelfObjectMacro( MovingTransform ); + itkPrintSelfObjectMacro( FixedImageMask ); + itkPrintSelfObjectMacro( MovingImageMask ); + } }//namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -67,14 +67,15 @@ * \ingroup ITKMetricsv4 */ -template +template class JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 : - public PointSetToPointSetMetricv4 + public PointSetToPointSetMetricv4 { public: /** Standard class typedefs. */ typedef JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 Self; - typedef PointSetToPointSetMetricv4 Superclass; + typedef PointSetToPointSetMetricv4 Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; @@ -202,21 +203,22 @@ /** Get the noise kernel sigma for the anistropic covariances. */ itkGetConstMacro( KernelSigma, RealType ); - virtual MeasureType GetLocalNeighborhoodValue( const PointType & point, const PixelType & pixel = 0 ) const; + virtual MeasureType GetLocalNeighborhoodValue( const PointType & point, + const PixelType & pixel = 0 ) const; - virtual void GetLocalNeighborhoodValueAndDerivative( const PointType &, MeasureType &, LocalDerivativeType &, const PixelType & pixel = 0 ) const; + virtual void GetLocalNeighborhoodValueAndDerivative( const PointType &, MeasureType &, + LocalDerivativeType &, const PixelType & pixel = 0 ) const; /** Clone method will clone the existing instance of this type, * including its internal member variables. */ - virtual ::itk::LightObject::Pointer Clone( void ) const; + virtual typename LightObject::Pointer InternalClone() const; protected: JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4(); ~JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4(); - virtual void InitializeForIteration( void ) const; - - void ComputeValueAndDerivative( const PointType & samplePoint, MeasureType &value, LocalDerivativeType &derivativeReturn, bool calcValue, bool calcDerivative ) const; + void ComputeValueAndDerivative( const PointType & samplePoint, MeasureType & value, + LocalDerivativeType &derivativeReturn, bool calcValue, bool calcDerivative ) const; void PrintSelf( std::ostream& os, Indent indent ) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJensenHavrdaCharvatTsallisPointSetToPointSetMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,29 +23,32 @@ namespace itk { /** Constructor */ -template -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +template +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4() : m_UseAnisotropicCovariances( false ), m_PointSetSigma( static_cast( 1.0 ) ), m_KernelSigma( static_cast( 10.0 ) ), m_CovarianceKNeighborhood( static_cast( 5 ) ), m_EvaluationKNeighborhood( static_cast( 50 ) ), - m_Alpha( static_cast(1.0) ) + m_Alpha( static_cast(1.0) ), + m_TotalNumberOfPoints(0), + m_Prefactor0(0.0), + m_Prefactor1(0.0) { } /** Destructor */ -template -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +template +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::~JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4() { } /** Initialize the metric */ -template +template void -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::Initialize( void ) throw ( ExceptionObject ) { Superclass::Initialize(); @@ -55,41 +58,20 @@ this->m_FixedDensityFunction->SetKernelSigma( this->m_KernelSigma ); this->m_FixedDensityFunction->SetRegularizationSigma( this->m_PointSetSigma ); this->m_FixedDensityFunction->SetNormalize( true ); - this->m_FixedDensityFunction->SetUseAnisotropicCovariances( this->m_UseAnisotropicCovariances ); - this->m_FixedDensityFunction->SetCovarianceKNeighborhood( this->m_CovarianceKNeighborhood ); - this->m_FixedDensityFunction->SetEvaluationKNeighborhood( this->m_EvaluationKNeighborhood ); - this->m_FixedDensityFunction->SetInputPointSet( this->m_FixedTransformedPointSet ); // Initialize the moving density function this->m_MovingDensityFunction = DensityFunctionType::New(); this->m_MovingDensityFunction->SetKernelSigma( this->m_KernelSigma ); this->m_MovingDensityFunction->SetRegularizationSigma( this->m_PointSetSigma ); - this->m_MovingDensityFunction->SetNormalize( true ); - this->m_MovingDensityFunction->SetUseAnisotropicCovariances( this->m_UseAnisotropicCovariances ); - this->m_MovingDensityFunction->SetCovarianceKNeighborhood( this->m_CovarianceKNeighborhood ); - this->m_MovingDensityFunction->SetEvaluationKNeighborhood( this->m_EvaluationKNeighborhood ); - this->m_MovingDensityFunction->SetInputPointSet( this->m_MovingTransformedPointSet ); -} - -template -void -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 -::InitializeForIteration() const -{ - Superclass::InitializeForIteration(); - if( this->m_NumberOfValidPoints == 0 ) - { - itkExceptionMacro("There are no fixed points within the virtual domain."); - } // Pre-calc some values for efficiency this->m_TotalNumberOfPoints = static_cast( this->m_NumberOfValidPoints + this->m_MovingDensityFunction->GetInputPointSet()->GetNumberOfPoints() ); @@ -101,10 +83,10 @@ this->m_Prefactor1 = 1.0 / ( this->m_TotalNumberOfPoints * this->m_TotalNumberOfPoints ); } -template -typename JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +template +typename JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::MeasureType -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::GetLocalNeighborhoodValue( const PointType & point, const PixelType & itkNotUsed( pixel ) ) const { MeasureType value; @@ -114,19 +96,21 @@ } /** Get both the match Measure and the Derivative Measure */ -template +template void -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::GetLocalNeighborhoodValueAndDerivative( const PointType & point, MeasureType & value, LocalDerivativeType & derivative, const PixelType & itkNotUsed( pixel ) ) const { this->ComputeValueAndDerivative( point, value, derivative, true, true ); } -template +template void -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::ComputeValueAndDerivative( const PointType & samplePoint, MeasureType & value, LocalDerivativeType & derivativeReturn, bool calcValue, bool calcDerivative ) const { + + if( calcDerivative ) { derivativeReturn.Fill( NumericTraits::Zero ); @@ -151,18 +135,18 @@ RealType realOne = NumericTraits::One; if( this->m_Alpha == realOne ) { - value = ( vcl_log( probabilityStar ) ); + value = ( std::log( probabilityStar ) ); } else { - value = -realOne * ( vcl_pow( probabilityStar, static_cast( this->m_Alpha - realOne ) ) ); + value = -realOne * ( std::pow( probabilityStar, static_cast( this->m_Alpha - realOne ) ) ); } value *= this->m_Prefactor0; } if( calcDerivative ) { - RealType probabilityStarFactor = vcl_pow( probabilityStar, static_cast( 2.0 - this->m_Alpha ) ); + RealType probabilityStarFactor = std::pow( probabilityStar, static_cast( 2.0 - this->m_Alpha ) ); typename DensityFunctionType::NeighborsIdentifierType neighbors; this->m_MovingDensityFunction->GetPointsLocator()->FindClosestNPoints( samplePoint, this->m_EvaluationKNeighborhood, neighbors ); @@ -197,37 +181,33 @@ DerivativeValueType factor = this->m_Prefactor1 * gaussian / probabilityStarFactor; for( unsigned int i = 0; i < PointDimension; i++ ) { - derivativeReturn[i] -= diffMean[i] * factor; + derivativeReturn[i] += diffMean[i] * factor; } } } } -template -::itk::LightObject::Pointer -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 -::Clone() const -{ - ::itk::LightObject::Pointer smartPtr; - Pointer copyPtr = Self::New(); - - copyPtr->m_MovingPointSet = this->m_MovingPointSet; - copyPtr->m_FixedPointSet = this->m_FixedPointSet; - copyPtr->m_Alpha = this->m_Alpha; - copyPtr->m_PointSetSigma = this->m_PointSetSigma; - copyPtr->m_KernelSigma = this->m_KernelSigma; - copyPtr->m_CovarianceKNeighborhood = this->m_CovarianceKNeighborhood; - copyPtr->m_EvaluationKNeighborhood = this->m_EvaluationKNeighborhood; - copyPtr->m_UseAnisotropicCovariances = this->m_UseAnisotropicCovariances; - - smartPtr = static_cast( copyPtr ); +template +typename LightObject::Pointer +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +::InternalClone( void ) const +{ + typename Self::Pointer rval = Self::New(); + rval->SetMovingPointSet( this->m_MovingPointSet ); + rval->SetFixedPointSet( this->m_FixedPointSet ); + rval->SetPointSetSigma( this->m_PointSetSigma ); + rval->SetEvaluationKNeighborhood( this->m_EvaluationKNeighborhood ); + rval->SetAlpha( this->m_Alpha ); + rval->SetKernelSigma( this->m_KernelSigma ); + rval->SetCovarianceKNeighborhood( this->m_CovarianceKNeighborhood ); + rval->SetUseAnisotropicCovariances( this->m_UseAnisotropicCovariances ); - return smartPtr; + return rval.GetPointer(); } -template +template void -JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 +JensenHavrdaCharvatTsallisPointSetToPointSetMetricv4 ::PrintSelf( std::ostream& os, Indent indent ) const { Superclass::PrintSelf( os, indent ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationComputeJointPDFThreaderBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ template< typename TDomainPartitioner, typename TJointHistogramMetric > JointHistogramMutualInformationComputeJointPDFThreaderBase< TDomainPartitioner, TJointHistogramMetric > ::JointHistogramMutualInformationComputeJointPDFThreaderBase(): - m_JointHistogramMIPerThreadVariables( NULL ) + m_JointHistogramMIPerThreadVariables( ITK_NULLPTR ) { } @@ -44,9 +44,10 @@ JointHistogramMutualInformationComputeJointPDFThreaderBase< TDomainPartitioner, TJointHistogramMetric > ::BeforeThreadedExecution() { + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); delete[] this->m_JointHistogramMIPerThreadVariables; - this->m_JointHistogramMIPerThreadVariables = new AlignedJointHistogramMIPerThreadStruct[ this->GetNumberOfThreadsUsed() ]; - for( ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); ++i ) + this->m_JointHistogramMIPerThreadVariables = new AlignedJointHistogramMIPerThreadStruct[ numThreadsUsed ]; + for( ThreadIdType i = 0; i < numThreadsUsed; ++i ) { if( this->m_JointHistogramMIPerThreadVariables[i].JointHistogram.IsNull() ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.h 2014-09-03 08:29:34.000000000 +0000 @@ -60,6 +60,7 @@ typedef typename Superclass::MeasureType MeasureType; typedef typename Superclass::DerivativeType DerivativeType; typedef typename Superclass::DerivativeValueType DerivativeValueType; + typedef typename Superclass::JacobianType JacobianType; typedef TJointHistogramMetric JointHistogramMetricType; typedef typename JointHistogramMetricType::InternalComputationValueType InternalComputationValueType; @@ -67,7 +68,6 @@ typedef typename JointHistogramMetricType::MarginalPDFInterpolatorType MarginalPDFInterpolatorType; typedef typename JointHistogramMetricType::JointPDFInterpolatorPointer JointPDFInterpolatorPointer; typedef typename JointHistogramMetricType::MarginalPDFInterpolatorPointer MarginalPDFInterpolatorPointer; - typedef typename JointHistogramMetricType::FixedTransformJacobianType FixedTransformJacobianType; typedef typename JointHistogramMetricType::NumberOfParametersType NumberOfParametersType; typedef typename JointHistogramMetricType::JointPDFType JointPDFType; typedef typename JointHistogramMetricType::MarginalPDFType MarginalPDFType; @@ -96,19 +96,19 @@ const MovingImageGradientType & mappedMovingImageGradient, MeasureType & metricValueReturn, DerivativeType & localDerivativeReturn, - const ThreadIdType threadID ) const; + const ThreadIdType threadId ) const; inline InternalComputationValueType ComputeFixedImageMarginalPDFDerivative( const MarginalPDFPointType & margPDFpoint, - const ThreadIdType threadID ) const; + const ThreadIdType threadId ) const; inline InternalComputationValueType ComputeMovingImageMarginalPDFDerivative( const MarginalPDFPointType & margPDFpoint, - const ThreadIdType threadID ) const; + const ThreadIdType threadId ) const; inline InternalComputationValueType ComputeJointPDFDerivative( const JointPDFPointType & jointPDFpoint, - const ThreadIdType threadID, + const ThreadIdType threadId, const SizeValueType ind ) const; struct JointHistogramMIPerThreadStruct { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationGetValueAndDerivativeThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,10 +25,10 @@ template< typename TDomainPartitioner, typename TImageToImageMetric, typename TJointHistogramMetric > JointHistogramMutualInformationGetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric, TJointHistogramMetric > -::JointHistogramMutualInformationGetValueAndDerivativeThreader(): - m_JointHistogramMIPerThreadVariables( NULL ) -{ -} +::JointHistogramMutualInformationGetValueAndDerivativeThreader() : + m_JointHistogramMIPerThreadVariables( ITK_NULLPTR ), + m_JointAssociate( ITK_NULLPTR ) +{} template< typename TDomainPartitioner, typename TImageToImageMetric, typename TJointHistogramMetric > @@ -48,15 +48,16 @@ /* Store the casted pointer to avoid dynamic casting in tight loops. */ this->m_JointAssociate = dynamic_cast< TJointHistogramMetric * >( this->m_Associate ); - if( this->m_JointAssociate == NULL ) + if( this->m_JointAssociate == ITK_NULLPTR ) { itkExceptionMacro("Dynamic casting of associate pointer failed."); } + const ThreadIdType numThreadsUsed = this->GetNumberOfThreadsUsed(); delete[] this->m_JointHistogramMIPerThreadVariables; - this->m_JointHistogramMIPerThreadVariables = new AlignedJointHistogramMIPerThreadStruct[ this->GetNumberOfThreadsUsed() ]; + this->m_JointHistogramMIPerThreadVariables = new AlignedJointHistogramMIPerThreadStruct[ numThreadsUsed ]; - for( ThreadIdType i = 0; i < this->GetNumberOfThreadsUsed(); ++i ) + for( ThreadIdType i = 0; i < numThreadsUsed; ++i ) { if( this->m_JointHistogramMIPerThreadVariables[i].JointPDFInterpolator.IsNull() ) { @@ -141,7 +142,7 @@ if( jointPDFValue > eps && movingImagePDFValue > eps ) { const InternalComputationValueType pRatio = - vcl_log(jointPDFValue)-vcl_log(movingImagePDFValue); + std::log(jointPDFValue)-std::log(movingImagePDFValue); const InternalComputationValueType & term1 = dJPDF*pRatio; const InternalComputationValueType & term2 = this->m_JointAssociate->m_Log2 * dMmPDF * jointPDFValue / movingImagePDFValue; scalingfactor = ( term2 - term1 ); @@ -152,11 +153,15 @@ } /* Use a pre-allocated jacobian object for efficiency */ - FixedTransformJacobianType & jacobian = - const_cast< FixedTransformJacobianType & >(this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobian); + typedef JacobianType & JacobianReferenceType; + JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobian; + JacobianReferenceType jacobianPositional = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobianPositional; /** For dense transforms, this returns identity */ - this->m_JointAssociate->m_MovingTransform->ComputeJacobianWithRespectToParameters( virtualPoint, jacobian ); + this->m_JointAssociate->GetMovingTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(virtualPoint, + jacobian, + jacobianPositional); for ( NumberOfParametersType par = 0; par < this->GetCachedNumberOfLocalParameters(); par++ ) { @@ -174,7 +179,7 @@ typename JointHistogramMutualInformationGetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric, TJointHistogramMetric >::InternalComputationValueType JointHistogramMutualInformationGetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric, TJointHistogramMetric > ::ComputeFixedImageMarginalPDFDerivative( const MarginalPDFPointType & margPDFpoint, - const ThreadIdType threadID ) const + const ThreadIdType threadId ) const { InternalComputationValueType offset = 0.5*this->m_JointPDFSpacing[0]; InternalComputationValueType eps = this->m_JointPDFSpacing[0]; @@ -201,8 +206,8 @@ InternalComputationValueType delta = rightpoint[0]-leftpoint[0]; if ( delta > NumericTraits< InternalComputationValueType >::Zero ) { - InternalComputationValueType deriv = this->m_ThreaderFixedImageMarginalPDFInterpolator[threadID]->Evaluate(rightpoint) - - this->m_ThreaderFixedImageMarginalPDFInterpolator[threadID]->Evaluate(leftpoint); + InternalComputationValueType deriv = this->m_ThreaderFixedImageMarginalPDFInterpolator[threadId]->Evaluate(rightpoint) - + this->m_ThreaderFixedImageMarginalPDFInterpolator[threadId]->Evaluate(leftpoint); return deriv/delta; } else diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkJointHistogramMutualInformationImageToImageMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,8 @@ template JointHistogramMutualInformationImageToImageMetricv4 -::JointHistogramMutualInformationImageToImageMetricv4() +::JointHistogramMutualInformationImageToImageMetricv4(): + m_JointHistogramTotalCount(0) { // Initialize histogram properties this->m_NumberOfHistogramBins = 20; @@ -41,7 +42,7 @@ this->m_MovingImageBinSize = NumericTraits< TInternalComputationValueType >::Zero; this->m_Padding = 2; this->m_JointPDFSum = NumericTraits< TInternalComputationValueType >::Zero; - this->m_Log2 = vcl_log(2.0); + this->m_Log2 = std::log(2.0); this->m_VarianceForJointPDFSmoothing = 1.5; // We have our own GetValueAndDerivativeThreader's that we want @@ -70,13 +71,13 @@ /** Get the fixed and moving image true max's and mins. * Initialize them to the PixelType min and max. */ this->m_FixedImageTrueMin = - vcl_numeric_limits::max(); + std::numeric_limits::max(); this->m_FixedImageTrueMax = - vcl_numeric_limits::min(); + std::numeric_limits::min(); this->m_MovingImageTrueMin = - vcl_numeric_limits::max(); + std::numeric_limits::max(); this->m_MovingImageTrueMax = - vcl_numeric_limits::min(); + std::numeric_limits::min(); /** Iterate through the fixed image and set the true * max and min for the fixed image. */ @@ -350,7 +351,7 @@ if (pxy / denom > eps ) { //the classic mi calculation - local_mi = pxy * vcl_log( pxy / denom ); + local_mi = pxy * std::log( pxy / denom ); } } total_mi += local_mi; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -49,15 +49,17 @@ * * \ingroup ITKMetricsv4 */ -template +template class LabeledPointSetToPointSetMetricv4: - public PointSetToPointSetMetricv4 + public PointSetToPointSetMetricv4 { public: /** Standard class typedefs. */ typedef LabeledPointSetToPointSetMetricv4 Self; - typedef PointSetToPointSetMetricv4 Superclass; + typedef PointSetToPointSetMetricv4 Superclass; typedef SmartPointer Pointer; typedef SmartPointer ConstPointer; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkLabeledPointSetToPointSetMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ { /** Constructor */ -template -LabeledPointSetToPointSetMetricv4 +template +LabeledPointSetToPointSetMetricv4 ::LabeledPointSetToPointSetMetricv4() { typedef EuclideanDistancePointSetToPointSetMetricv4 DefaultMetricType; @@ -40,15 +40,15 @@ } /** Destructor */ -template -LabeledPointSetToPointSetMetricv4 +template +LabeledPointSetToPointSetMetricv4 ::~LabeledPointSetToPointSetMetricv4() { } -template +template void -LabeledPointSetToPointSetMetricv4 +LabeledPointSetToPointSetMetricv4 ::Initialize( void ) throw ( ExceptionObject ) { Superclass::Initialize(); @@ -67,6 +67,10 @@ for( it = this->m_CommonPointSetLabels.begin(); it != this->m_CommonPointSetLabels.end(); ++it ) { typename PointSetMetricType::Pointer metricPtr = dynamic_cast( this->m_PointSetMetric->Clone().GetPointer() ); + if( metricPtr.IsNull() ) + { + itkExceptionMacro( "The metric pointer clone is NULL." ); + } FixedPointSetPointer fixedPointSet = this->GetLabeledFixedPointSet( *it ); MovingPointSetPointer movingPointSet = this->GetLabeledMovingPointSet( *it ); @@ -79,10 +83,10 @@ } } -template -typename LabeledPointSetToPointSetMetricv4 +template +typename LabeledPointSetToPointSetMetricv4 ::MeasureType -LabeledPointSetToPointSetMetricv4 +LabeledPointSetToPointSetMetricv4 ::GetLocalNeighborhoodValue( const PointType & point, const LabelType & label ) const { typename LabelSetType::const_iterator labelIt = std::find( this->m_CommonPointSetLabels.begin(), this->m_CommonPointSetLabels.end(), label ); @@ -98,9 +102,9 @@ } } -template +template void -LabeledPointSetToPointSetMetricv4 +LabeledPointSetToPointSetMetricv4 ::GetLocalNeighborhoodValueAndDerivative( const PointType & point, MeasureType &measure, LocalDerivativeType & localDerivative, const LabelType & label ) const { @@ -116,9 +120,9 @@ } } -template -typename LabeledPointSetToPointSetMetricv4::FixedPointSetPointer -LabeledPointSetToPointSetMetricv4 +template +typename LabeledPointSetToPointSetMetricv4::FixedPointSetPointer +LabeledPointSetToPointSetMetricv4 ::GetLabeledFixedPointSet( const LabelType label ) const { typename FixedPointSetType::Pointer fixedPointSet = FixedPointSetType::New(); @@ -141,9 +145,9 @@ return fixedPointSet; } -template -typename LabeledPointSetToPointSetMetricv4::MovingPointSetPointer -LabeledPointSetToPointSetMetricv4 +template +typename LabeledPointSetToPointSetMetricv4::MovingPointSetPointer +LabeledPointSetToPointSetMetricv4 ::GetLabeledMovingPointSet( const LabelType label ) const { typename MovingPointSetType::Pointer movingPointSet = MovingPointSetType::New(); @@ -166,9 +170,9 @@ return movingPointSet; } -template +template void -LabeledPointSetToPointSetMetricv4 +LabeledPointSetToPointSetMetricv4 ::DetermineCommonPointSetLabels() { this->m_FixedPointSetLabels.clear(); @@ -225,9 +229,9 @@ } /** PrintSelf method */ -template +template void -LabeledPointSetToPointSetMetricv4 +LabeledPointSetToPointSetMetricv4 ::PrintSelf( std::ostream & os, Indent indent ) const { Superclass::PrintSelf( os, indent ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkManifoldParzenWindowsPointSetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkManifoldParzenWindowsPointSetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkManifoldParzenWindowsPointSetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkManifoldParzenWindowsPointSetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ template ManifoldParzenWindowsPointSetFunction ::ManifoldParzenWindowsPointSetFunction() : - m_PointsLocator( NULL ), + m_PointsLocator( ITK_NULLPTR ), m_CovarianceKNeighborhood( 5 ), m_EvaluationKNeighborhood( 50 ), m_RegularizationSigma( 1.0 ), @@ -167,7 +167,7 @@ ManifoldParzenWindowsPointSetFunction ::Evaluate( const InputPointType &point ) const { - if( this->GetInputPointSet() == NULL ) + if( this->GetInputPointSet() == ITK_NULLPTR ) { itkExceptionMacro( "The input point set has not been specified." ); } @@ -212,7 +212,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-09-03 08:29:34.000000000 +0000 @@ -82,7 +82,9 @@ typedef typename TMattesMutualInformationMetric::JacobianType JacobianType; protected: - MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader() {} + MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader() : + m_MattesAssociate(ITK_NULLPTR) + {} virtual void BeforeThreadedExecution(); @@ -102,14 +104,20 @@ const MovingImageGradientType & mappedMovingImageGradient, MeasureType & metricValueReturn, DerivativeType & localDerivativeReturn, - const ThreadIdType threadID ) const; + const ThreadIdType threadId ) const; - /** Compute PDF derivative contribution for each parameter. */ - virtual void ComputePDFDerivatives(const ThreadIdType & threadID, + /** Compute PDF derivative contribution for each parameter of a global support transform type. */ + virtual void ComputePDFDerivativesGlobalSupportTransform(const ThreadIdType & threadId, const OffsetValueType & fixedImageParzenWindowIndex, const JacobianType & jacobian, const OffsetValueType & pdfMovingIndex, const MovingImageGradientType & movingGradient, + const PDFValueType & cubicBSplineDerivativeValue) const; + + /** Compute PDF derivative contribution for each parameter of a displacement field. */ + virtual void ComputePDFDerivativesLocalSupportTransform( + const JacobianType & jacobian, + const MovingImageGradientType & movingGradient, const PDFValueType & cubicBSplineDerivativeValue, DerivativeValueType * localSupportDerivativeResultPtr) const; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ /* Store the casted pointer to avoid dynamic casting in tight loops. */ this->m_MattesAssociate = dynamic_cast(this->m_Associate); - if( this->m_MattesAssociate == NULL ) + if( this->m_MattesAssociate == ITK_NULLPTR ) { itkExceptionMacro("Dynamic casting of associate pointer failed."); } @@ -49,23 +49,25 @@ * Allocate memory for the marginal PDF and initialize values * to zero. The marginal PDFs are stored as std::vector. */ + const ThreadIdType mattesAssociateNumThreadsUsed = this->m_MattesAssociate->GetNumberOfThreadsUsed(); this->m_MattesAssociate->m_MovingImageMarginalPDF.resize(this->m_MattesAssociate->m_NumberOfHistogramBins, 0.0F); - this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF.resize(this->m_MattesAssociate->GetNumberOfThreadsUsed(), + this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF.resize(mattesAssociateNumThreadsUsed, std::vector(this->m_MattesAssociate->m_NumberOfHistogramBins, 0.0F) ); - this->m_MattesAssociate->m_ThreaderJointPDFStartBin.resize( this->GetNumberOfThreadsUsed() ); - this->m_MattesAssociate->m_ThreaderJointPDFEndBin.resize(this->GetNumberOfThreadsUsed() ); - const OffsetValueType binRange = this->m_MattesAssociate->m_NumberOfHistogramBins / this->GetNumberOfThreadsUsed(); - for( ThreadIdType threadID = 0; threadID < this->GetNumberOfThreadsUsed(); threadID++ ) + const ThreadIdType localNumberOfThreadsUsed = this->GetNumberOfThreadsUsed(); + this->m_MattesAssociate->m_ThreaderJointPDFStartBin.resize( localNumberOfThreadsUsed ); + this->m_MattesAssociate->m_ThreaderJointPDFEndBin.resize(localNumberOfThreadsUsed ); + const OffsetValueType binRange = this->m_MattesAssociate->m_NumberOfHistogramBins / localNumberOfThreadsUsed; + for( ThreadIdType threadId = 0; threadId < localNumberOfThreadsUsed; ++threadId ) { - this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadID] = threadID * binRange; - this->m_MattesAssociate->m_ThreaderJointPDFEndBin[threadID] = ( threadID + 1 ) * binRange - 1; + this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadId] = threadId * binRange; + this->m_MattesAssociate->m_ThreaderJointPDFEndBin[threadId] = ( threadId + 1 ) * binRange - 1; } // Ensure that the last EndBin range contains the last histogram bin - this->m_MattesAssociate->m_ThreaderJointPDFStartBin[this->GetNumberOfThreadsUsed() - 1] = ( this->GetNumberOfThreadsUsed() - 1 ) * binRange; - this->m_MattesAssociate->m_ThreaderJointPDFEndBin[this->GetNumberOfThreadsUsed() - 1] = this->m_MattesAssociate->m_NumberOfHistogramBins - 1; + this->m_MattesAssociate->m_ThreaderJointPDFStartBin[localNumberOfThreadsUsed - 1] = ( localNumberOfThreadsUsed - 1 ) * binRange; + this->m_MattesAssociate->m_ThreaderJointPDFEndBin[localNumberOfThreadsUsed - 1] = this->m_MattesAssociate->m_NumberOfHistogramBins - 1; - this->m_MattesAssociate->m_ThreaderJointPDFSum.resize(this->GetNumberOfThreadsUsed()); + this->m_MattesAssociate->m_ThreaderJointPDFSum.resize(localNumberOfThreadsUsed); JointPDFRegionType jointPDFRegion; // For the joint PDF define a region starting from {0,0} @@ -92,14 +94,14 @@ * Allocate memory for the joint PDF and joint PDF derivatives. * The joint PDF and joint PDF derivatives are store as itk::Image. */ - this->m_MattesAssociate->m_ThreaderJointPDF.resize(this->GetNumberOfThreadsUsed()); - for( ThreadIdType threadID = 0; threadID < this->GetNumberOfThreadsUsed(); ++threadID ) + this->m_MattesAssociate->m_ThreaderJointPDF.resize(localNumberOfThreadsUsed); + for( ThreadIdType threadId = 0; threadId < localNumberOfThreadsUsed; ++threadId ) { - this->m_MattesAssociate->m_ThreaderJointPDF[threadID] = JointPDFType::New(); - this->m_MattesAssociate->m_ThreaderJointPDF[threadID]->SetRegions(jointPDFRegion); - this->m_MattesAssociate->m_ThreaderJointPDF[threadID]->SetOrigin(origin); - this->m_MattesAssociate->m_ThreaderJointPDF[threadID]->SetSpacing(spacing); - this->m_MattesAssociate->m_ThreaderJointPDF[threadID]->Allocate(); + this->m_MattesAssociate->m_ThreaderJointPDF[threadId] = JointPDFType::New(); + this->m_MattesAssociate->m_ThreaderJointPDF[threadId]->SetRegions(jointPDFRegion); + this->m_MattesAssociate->m_ThreaderJointPDF[threadId]->SetOrigin(origin); + this->m_MattesAssociate->m_ThreaderJointPDF[threadId]->SetSpacing(spacing); + this->m_MattesAssociate->m_ThreaderJointPDF[threadId]->Allocate(); } // @@ -125,7 +127,7 @@ this->m_MattesAssociate->m_LocalDerivativeByParzenBin.resize(4); // The first container cannot point to the existing derivative result object // for efficiency, because of multi-variate metric. - for( SizeValueType n = 0; n<4; n++ ) + for( SizeValueType n = 0; n < 4; ++n ) { this->m_MattesAssociate->m_LocalDerivativeByParzenBin[n].SetSize( this->m_MattesAssociate->GetNumberOfParameters() ); // Initialize to zero because we accumulate, and so skipped points will behave properly @@ -157,13 +159,13 @@ jointPDFDerivativesRegion.SetIndex(jointPDFDerivativesIndex); jointPDFDerivativesRegion.SetSize(jointPDFDerivativesSize); - this->m_MattesAssociate->m_ThreaderJointPDFDerivatives.resize(this->GetNumberOfThreadsUsed()); + this->m_MattesAssociate->m_ThreaderJointPDFDerivatives.resize(localNumberOfThreadsUsed); // Set the regions and allocate - for( ThreadIdType threadID = 0; threadID < this->GetNumberOfThreadsUsed(); threadID++ ) + for( ThreadIdType threadId = 0; threadId < localNumberOfThreadsUsed; ++threadId ) { - this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadID] = JointPDFDerivativesType::New(); - this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadID]->SetRegions( jointPDFDerivativesRegion); - this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadID]->Allocate(); + this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadId] = JointPDFDerivativesType::New(); + this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadId]->SetRegions( jointPDFDerivativesRegion); + this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadId]->Allocate(); } } } @@ -176,16 +178,15 @@ /* This block of code is from MattesMutualImageToImageMetric::GetValueAndDerivativeThreadPreProcess */ - for( ThreadIdType threadID = 0; threadID < this->GetNumberOfThreadsUsed(); threadID++ ) - { - std::fill( this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF[threadID].begin(), this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF[threadID].end(), 0.0F); - this->m_MattesAssociate->m_ThreaderJointPDF[threadID]->FillBuffer(0.0F); - if( this->m_MattesAssociate->GetComputeDerivative() ) + const bool createPerThreadDerivativesBuffers = this->m_MattesAssociate->GetComputeDerivative() + && ( ! this->m_MattesAssociate->HasLocalSupport() ); + for( ThreadIdType threadId = 0; threadId < localNumberOfThreadsUsed; ++threadId ) + { + std::fill( this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF[threadId].begin(), this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF[threadId].end(), 0.0F); + this->m_MattesAssociate->m_ThreaderJointPDF[threadId]->FillBuffer(0.0F); + if( createPerThreadDerivativesBuffers ) { - if( ! this->m_MattesAssociate->HasLocalSupport() ) - { - this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadID]->FillBuffer(0.0F); - } + this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadId]->FillBuffer(0.0F); } } } @@ -204,8 +205,9 @@ const MovingImageGradientType & movingImageGradient, MeasureType &, DerivativeType &, - const ThreadIdType threadID) const + const ThreadIdType threadId) const { + const bool doComputeDerivative = this->m_MattesAssociate->GetComputeDerivative(); /** * Compute this sample's contribution to the marginal * and joint distributions. @@ -221,7 +223,7 @@ } // Determine parzen window arguments (see eqn 6 of Mattes paper [2]). - PDFValueType movingImageParzenWindowTerm = movingImageValue / this->m_MattesAssociate->m_MovingImageBinSize - this->m_MattesAssociate->m_MovingImageNormalizedMin; + const PDFValueType movingImageParzenWindowTerm = movingImageValue / this->m_MattesAssociate->m_MovingImageBinSize - this->m_MattesAssociate->m_MovingImageNormalizedMin; OffsetValueType movingImageParzenWindowIndex = static_cast( movingImageParzenWindowTerm ); // Make sure the extreme values are in valid bins @@ -237,7 +239,7 @@ movingImageParzenWindowIndex = nindex; } } - // Move the pointer to the fist affected bin + // Move the pointer to the first affected bin OffsetValueType pdfMovingIndex = static_cast( movingImageParzenWindowIndex ) - 1; const OffsetValueType pdfMovingIndexMax = static_cast( movingImageParzenWindowIndex ) + 2; @@ -246,7 +248,7 @@ // Since a zero-order BSpline (box car) kernel is used for // the fixed image marginal pdf, we need only increment the // fixedImageParzenWindowIndex by value of 1.0. - this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF[threadID][fixedImageParzenWindowIndex] += 1; + this->m_MattesAssociate->m_ThreaderFixedImageMarginalPDF[threadId][fixedImageParzenWindowIndex] += 1; /** * The region of support of the parzen window determines which bins @@ -262,64 +264,75 @@ PDFValueType movingImageParzenWindowArg = static_cast( pdfMovingIndex ) - static_cast( movingImageParzenWindowTerm ); // Pointer to affected bin to be updated - JointPDFValueType *pdfPtr = this->m_MattesAssociate->m_ThreaderJointPDF[threadID]->GetBufferPointer() + JointPDFValueType *pdfPtr = this->m_MattesAssociate->m_ThreaderJointPDF[threadId]->GetBufferPointer() + ( fixedImageParzenWindowIndex * this->m_MattesAssociate->m_NumberOfHistogramBins ) + pdfMovingIndex; OffsetValueType localDerivativeOffset = 0; // Store the pdf indecies for this point. // Just store the starting pdfMovingIndex and we'll iterate later // over the next four to collect results. - if( this->m_MattesAssociate->GetComputeDerivative() ) + if( doComputeDerivative && ( this->m_MattesAssociate->HasLocalSupport() ) ) { - if( this->m_MattesAssociate->HasLocalSupport() ) + const OffsetValueType jointPdfIndex1D = pdfMovingIndex + (fixedImageParzenWindowIndex * this->m_MattesAssociate->m_NumberOfHistogramBins); + localDerivativeOffset = this->m_MattesAssociate->ComputeParameterOffsetFromVirtualIndex( virtualIndex, this->GetCachedNumberOfLocalParameters() ); + for (NumberOfParametersType i=0, numLocalParameters = this->GetCachedNumberOfLocalParameters(); + i < numLocalParameters; ++i) { - OffsetValueType jointPdfIndex1D = pdfMovingIndex + (fixedImageParzenWindowIndex * this->m_MattesAssociate->m_NumberOfHistogramBins); - localDerivativeOffset = this->m_MattesAssociate->ComputeParameterOffsetFromVirtualIndex( virtualIndex, this->GetCachedNumberOfLocalParameters() ); - for (NumberOfParametersType i=0; i < this->GetCachedNumberOfLocalParameters(); i++) - { - this->m_MattesAssociate->m_JointPdfIndex1DArray[localDerivativeOffset + i] = jointPdfIndex1D; - } + this->m_MattesAssociate->m_JointPdfIndex1DArray[localDerivativeOffset + i] = jointPdfIndex1D; } } // Compute the transform Jacobian. typedef JacobianType & JacobianReferenceType; - JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadID].MovingTransformJacobian; - if( this->m_MattesAssociate->GetComputeDerivative() ) + JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobian; + if( doComputeDerivative ) { - this->m_MattesAssociate->GetMovingTransform()->ComputeJacobianWithRespectToParameters( virtualPoint, jacobian); + JacobianReferenceType jacobianPositional = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobianPositional; + this->m_MattesAssociate->GetMovingTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(virtualPoint, + jacobian, + jacobianPositional); } SizeValueType movingParzenBin = 0; + const bool transformIsDisplacement = this->m_MattesAssociate->m_MovingTransform->GetTransformCategory() == MovingTransformType::DisplacementField; while( pdfMovingIndex <= pdfMovingIndexMax ) { - PDFValueType val = static_cast( this->m_MattesAssociate->m_CubicBSplineKernel ->Evaluate( movingImageParzenWindowArg) ); + const PDFValueType val = static_cast( this->m_MattesAssociate->m_CubicBSplineKernel ->Evaluate( movingImageParzenWindowArg) ); *( pdfPtr++ ) += val; - if( this->m_MattesAssociate->GetComputeDerivative() ) + if( doComputeDerivative ) { // Compute the cubicBSplineDerivative for later repeated use. const PDFValueType cubicBSplineDerivativeValue = this->m_MattesAssociate->m_CubicBSplineDerivativeKernel->Evaluate(movingImageParzenWindowArg); - // Pointer to local derivative partial result container. - // Not used with global support transforms. - DerivativeValueType * localSupportDerivativeResultPtr = NULL; - if( this->m_MattesAssociate->m_MovingTransform->GetTransformCategory() == MovingTransformType::DisplacementField ) - { - // ptr to where the derivative result should go, for efficiency - localSupportDerivativeResultPtr = &( this->m_MattesAssociate->m_LocalDerivativeByParzenBin[movingParzenBin][localDerivativeOffset] ); - } - - // Compute PDF derivative contribution. - this->ComputePDFDerivatives(threadID, - fixedImageParzenWindowIndex, - jacobian, - pdfMovingIndex, - movingImageGradient, - cubicBSplineDerivativeValue, - localSupportDerivativeResultPtr); + if( transformIsDisplacement ) + { + // Pointer to local derivative partial result container. + // Not used with global support transforms. + // ptr to where the derivative result should go, for efficiency + DerivativeValueType * localSupportDerivativeResultPtr = + &( this->m_MattesAssociate->m_LocalDerivativeByParzenBin[movingParzenBin][localDerivativeOffset] ); + // Compute PDF derivative contribution. + + this->ComputePDFDerivativesLocalSupportTransform( + jacobian, + movingImageGradient, + cubicBSplineDerivativeValue, + localSupportDerivativeResultPtr); + } + else + { + // Compute PDF derivative contribution. + this->ComputePDFDerivativesGlobalSupportTransform(threadId, + fixedImageParzenWindowIndex, + jacobian, + pdfMovingIndex, + movingImageGradient, + cubicBSplineDerivativeValue); + } } movingImageParzenWindowArg += 1.0; @@ -328,57 +341,63 @@ } // have to do this here since we're returning false - this->m_GetValueAndDerivativePerThreadVariables[threadID].NumberOfValidPoints++; + this->m_GetValueAndDerivativePerThreadVariables[threadId].NumberOfValidPoints++; // Return false to avoid the storage of results in parent class. return false; } -/** - * ComputePDFDerivative - */ template< typename TDomainPartitioner, typename TImageToImageMetric, typename TMattesMutualInformationMetric > void MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric, TMattesMutualInformationMetric > -::ComputePDFDerivatives(const ThreadIdType & threadID, +::ComputePDFDerivativesGlobalSupportTransform(const ThreadIdType & threadId, const OffsetValueType & fixedImageParzenWindowIndex, const JacobianType & jacobian, const OffsetValueType & pdfMovingIndex, const MovingImageGradientType & movingImageGradient, - const PDFValueType & cubicBSplineDerivativeValue, - DerivativeValueType * localSupportDerivativeResultPtr) const + const PDFValueType & cubicBSplineDerivativeValue) const { // Update bins in the PDF derivatives for the current intensity pair - const OffsetValueType pdfFixedIndex = fixedImageParzenWindowIndex; - JointPDFDerivativesValueType *derivPtr=0; - if( this->m_MattesAssociate->m_MovingTransform->GetTransformCategory() != MovingTransformType::DisplacementField ) - { - derivPtr = this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadID]->GetBufferPointer() - + ( pdfFixedIndex * this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadID]->GetOffsetTable()[2] ) - + ( pdfMovingIndex * this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadID]->GetOffsetTable()[1] ); - } + JointPDFDerivativesValueType *derivPtr = this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadId]->GetBufferPointer() + + ( pdfFixedIndex * this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadId]->GetOffsetTable()[2] ) + + ( pdfMovingIndex * this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[threadId]->GetOffsetTable()[1] ); - for( NumberOfParametersType mu = 0; mu < this->GetCachedNumberOfLocalParameters(); mu++ ) + for( NumberOfParametersType mu = 0, maxElement=this->GetCachedNumberOfLocalParameters(); mu < maxElement; ++mu ) { PDFValueType innerProduct = 0.0; - for( SizeValueType dim = 0; dim < this->m_MattesAssociate->MovingImageDimension; dim++ ) + for( SizeValueType dim = 0, lastDim = this->m_MattesAssociate->MovingImageDimension; dim < lastDim; ++dim ) { innerProduct += jacobian[dim][mu] * movingImageGradient[dim]; } const PDFValueType derivativeContribution = innerProduct * cubicBSplineDerivativeValue; - if( this->m_MattesAssociate->m_MovingTransform->GetTransformCategory() == MovingTransformType::DisplacementField ) - { - *( localSupportDerivativeResultPtr ) += derivativeContribution; - localSupportDerivativeResultPtr++; - } - else + *( derivPtr ) -= derivativeContribution; + ++derivPtr; + } +} + +template< typename TDomainPartitioner, typename TImageToImageMetric, typename TMattesMutualInformationMetric > +void +MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric, TMattesMutualInformationMetric > +::ComputePDFDerivativesLocalSupportTransform( + const JacobianType & jacobian, + const MovingImageGradientType & movingImageGradient, + const PDFValueType & cubicBSplineDerivativeValue, + DerivativeValueType * localSupportDerivativeResultPtr) const +{ + for( NumberOfParametersType mu = 0, maxElement=this->GetCachedNumberOfLocalParameters(); mu < maxElement; ++mu ) + { + PDFValueType innerProduct = 0.0; + for( SizeValueType dim = 0, lastDim = this->m_MattesAssociate->MovingImageDimension; dim < lastDim; ++dim ) { - *( derivPtr ) -= derivativeContribution; - ++derivPtr; + innerProduct += jacobian[dim][mu] * movingImageGradient[dim]; } + + const PDFValueType derivativeContribution = innerProduct * cubicBSplineDerivativeValue; + *( localSupportDerivativeResultPtr ) += derivativeContribution; + localSupportDerivativeResultPtr++; } } @@ -387,6 +406,7 @@ MattesMutualInformationImageToImageMetricv4GetValueAndDerivativeThreader< TDomainPartitioner, TImageToImageMetric, TMattesMutualInformationMetric > ::AfterThreadedExecution() { + const ThreadIdType localNumberOfThreadsUsed = this->GetNumberOfThreadsUsed(); /* NOTE: It is not worth threading this method. Profiling shows that post-processing * time of images with real-world sizes is too insignificant to register in * the profiler. */ @@ -395,9 +415,9 @@ * m_NumberOfValidPoints by collecting the valid points per thread. * We do this here because we're skipping Superclass::AfterThreadedExecution*/ this->m_MattesAssociate->m_NumberOfValidPoints = NumericTraits< SizeValueType >::Zero; - for (ThreadIdType i=0; iGetNumberOfThreadsUsed(); i++) + for (ThreadIdType threadId = 0; threadId < localNumberOfThreadsUsed; ++threadId) { - this->m_MattesAssociate->m_NumberOfValidPoints += this->m_GetValueAndDerivativePerThreadVariables[i].NumberOfValidPoints; + this->m_MattesAssociate->m_NumberOfValidPoints += this->m_GetValueAndDerivativePerThreadVariables[threadId].NumberOfValidPoints; } /* Porting: This code is from @@ -406,40 +426,41 @@ /* Post-processing that is common the GetValue and GetValueAndDerivative */ this->m_MattesAssociate->GetValueCommonAfterThreadedExecution(); - if( this->m_MattesAssociate->GetComputeDerivative() ) + if( this->m_MattesAssociate->GetComputeDerivative() && ( ! this->m_MattesAssociate->HasLocalSupport() ) ) { - if( ! this->m_MattesAssociate->HasLocalSupport() ) + const NumberOfParametersType rowSize = this->GetCachedNumberOfLocalParameters() * this->m_MattesAssociate->m_NumberOfHistogramBins; + /* See note above about threading. */ + + // This entire block of code is used to accumulate the per-thread buffers into 1 thread. + for( ThreadIdType threadId = 0; threadId < localNumberOfThreadsUsed; ++threadId ) { - /* See note above about threading. */ - for( ThreadIdType threadID = 0; threadID < this->GetNumberOfThreadsUsed(); threadID++ ) - { - const NumberOfParametersType rowSize = this->GetCachedNumberOfLocalParameters() * this->m_MattesAssociate->m_NumberOfHistogramBins; + // For this thread, how many histogram elements are there? + const SizeValueType histogramBlockSize = rowSize * ( this->m_MattesAssociate->m_ThreaderJointPDFEndBin[threadId] - this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadId] + 1 ); + + JointPDFDerivativesValueType *const accumulatorPdfDPtrStart = this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[0]->GetBufferPointer() + + ( this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadId] * rowSize ); - const SizeValueType maxI = rowSize * ( this->m_MattesAssociate->m_ThreaderJointPDFEndBin[threadID] - this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadID] + 1 ); + const SizeValueType tempThreadPdfDPtrOffset = this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadId] * rowSize; - JointPDFDerivativesValueType *const pdfDPtrStart = this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[0]->GetBufferPointer() - + ( this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadID] * rowSize ); - const SizeValueType tPdfDPtrOffset = this->m_MattesAssociate->m_ThreaderJointPDFStartBin[threadID] * rowSize; - for( SizeValueType t = 1; t < this->GetNumberOfThreadsUsed(); t++ ) + for( SizeValueType t = 1; t < localNumberOfThreadsUsed; ++t ) + { + JointPDFDerivativesValueType * accumulatorPdfDPtr = accumulatorPdfDPtrStart; + JointPDFDerivativesValueType const * tempThreadPdfDPtr = this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[t]->GetBufferPointer() + tempThreadPdfDPtrOffset; + JointPDFDerivativesValueType const * const tempThreadPdfDPtrEnd = tempThreadPdfDPtr + histogramBlockSize; + // for(i = 0; i < histogramBlockSize; i++) + while( tempThreadPdfDPtr < tempThreadPdfDPtrEnd ) { - JointPDFDerivativesValueType * pdfDPtr = pdfDPtrStart; - JointPDFDerivativesValueType const *tPdfDPtr = this->m_MattesAssociate->m_ThreaderJointPDFDerivatives[t]->GetBufferPointer() + tPdfDPtrOffset; - JointPDFDerivativesValueType const * const tPdfDPtrEnd = tPdfDPtr + maxI; - // for(i = 0; i < maxI; i++) - while( tPdfDPtr < tPdfDPtrEnd ) - { - *( pdfDPtr++ ) += *( tPdfDPtr++ ); - } + *( accumulatorPdfDPtr++ ) += *( tempThreadPdfDPtr++ ); } + } - const PDFValueType nFactor = 1.0 / ( this->m_MattesAssociate->m_MovingImageBinSize * this->m_MattesAssociate->GetNumberOfValidPoints() ); + const PDFValueType nFactor = 1.0 / ( this->m_MattesAssociate->m_MovingImageBinSize * this->m_MattesAssociate->GetNumberOfValidPoints() ); - JointPDFDerivativesValueType * pdfDPtr = pdfDPtrStart; - JointPDFDerivativesValueType const * const tPdfDPtrEnd = pdfDPtrStart + maxI; - while( pdfDPtr < tPdfDPtrEnd ) - { - *( pdfDPtr++ ) *= nFactor; - } + JointPDFDerivativesValueType * accumulatorPdfDPtr = accumulatorPdfDPtrStart; + JointPDFDerivativesValueType const * const tempThreadPdfDPtrEnd = accumulatorPdfDPtrStart + histogramBlockSize; + while( accumulatorPdfDPtr < tempThreadPdfDPtrEnd ) + { + *( accumulatorPdfDPtr++ ) *= nFactor; } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -170,7 +170,7 @@ { if( this->m_ThreaderJointPDF.size() == 0 ) { - return typename JointPDFType::Pointer(NULL); + return typename JointPDFType::Pointer(ITK_NULLPTR); } return this->m_ThreaderJointPDF[0]; } @@ -185,7 +185,7 @@ { if( this->m_ThreaderJointPDFDerivatives.size() == 0 ) { - return typename JointPDFDerivativesType::Pointer(NULL); + return typename JointPDFDerivativesType::Pointer(ITK_NULLPTR); } return this->m_ThreaderJointPDFDerivatives[0]; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMattesMutualInformationImageToImageMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,13 +29,15 @@ m_NumberOfHistogramBins(50), m_MovingImageNormalizedMin(0.0), m_FixedImageNormalizedMin(0.0), + m_FixedImageTrueMin(0.0), + m_FixedImageTrueMax(0.0), m_MovingImageTrueMin(0.0), m_MovingImageTrueMax(0.0), m_FixedImageBinSize(0.0), m_MovingImageBinSize(0.0), - m_CubicBSplineKernel(NULL), - m_CubicBSplineDerivativeKernel(NULL), + m_CubicBSplineKernel(ITK_NULLPTR), + m_CubicBSplineDerivativeKernel(ITK_NULLPTR), m_PRatioArray(0), @@ -90,10 +92,10 @@ * in computing the range of intensity values. */ - this->m_FixedImageTrueMin = vcl_numeric_limits::max(); - this->m_FixedImageTrueMax = vcl_numeric_limits::min(); - this->m_MovingImageTrueMin = vcl_numeric_limits::max(); - this->m_MovingImageTrueMax = vcl_numeric_limits::min(); + this->m_FixedImageTrueMin = std::numeric_limits::max(); + this->m_FixedImageTrueMax = std::numeric_limits::min(); + this->m_MovingImageTrueMin = std::numeric_limits::max(); + this->m_MovingImageTrueMax = std::numeric_limits::min(); // We need to make robust measures only over the requested mask region itk::ImageRegionConstIteratorWithIndex fi(this->m_FixedImage, this->m_FixedImage->GetBufferedRegion() ); @@ -184,9 +186,9 @@ ::ComputeResults() const { // Collect some results - for( ThreadIdType threadID = 1; threadID < this->GetNumberOfThreadsUsed(); threadID++ ) + for( ThreadIdType threadId = 1, lastThread = this->GetNumberOfThreadsUsed(); threadId < lastThread; ++threadId ) { - this->m_ThreaderJointPDFSum[0] += this->m_ThreaderJointPDFSum[threadID]; + this->m_ThreaderJointPDFSum[0] += this->m_ThreaderJointPDFSum[threadId]; } if( this->m_ThreaderJointPDFSum[0] < itk::NumericTraits< PDFValueType >::epsilon() ) { @@ -196,14 +198,14 @@ std::fill(this->m_MovingImageMarginalPDF.begin(), this->m_MovingImageMarginalPDF.end(), 0.0F); PDFValueType totalMassOfPDF = 0.0; - for( unsigned int i = 0; i < this->m_NumberOfHistogramBins; i++ ) + for( unsigned int i = 0; i < this->m_NumberOfHistogramBins; ++i ) { totalMassOfPDF += this->m_ThreaderFixedImageMarginalPDF[0][i]; } const PDFValueType normalizationFactor = 1.0 / this->m_ThreaderJointPDFSum[0]; JointPDFValueType *pdfPtr = this->m_ThreaderJointPDF[0]->GetBufferPointer(); - for( unsigned int i = 0; i < this->m_NumberOfHistogramBins; i++ ) + for( unsigned int i = 0; i < this->m_NumberOfHistogramBins; ++i ) { PDFValueType * movingMarginalPtr = &(m_MovingImageMarginalPDF[0]); for( unsigned int j = 0; j < this->m_NumberOfHistogramBins; j++ ) @@ -213,7 +215,7 @@ } } - SizeValueType numberOfPoints = this->GetNumberOfDomainPoints(); + const SizeValueType numberOfPoints = this->GetNumberOfDomainPoints(); if( this->GetNumberOfValidPoints() < numberOfPoints / 16 ) { @@ -230,7 +232,7 @@ { itkExceptionMacro("Fixed image marginal PDF summed to zero"); } - for( unsigned int bin = 0; bin < this->m_NumberOfHistogramBins; bin++ ) + for( unsigned int bin = 0; bin < this->m_NumberOfHistogramBins; ++bin ) { this->m_ThreaderFixedImageMarginalPDF[0][bin] /= totalMassOfPDF; } @@ -247,6 +249,7 @@ const PDFValueType nFactor = 1.0 / ( this->m_MovingImageBinSize * this->GetNumberOfValidPoints() ); + static const PDFValueType closeToZero = std::numeric_limits::epsilon(); for( unsigned int fixedIndex = 0; fixedIndex < this->m_NumberOfHistogramBins; ++fixedIndex ) { const PDFValueType fixedImagePDFValue = this->m_ThreaderFixedImageMarginalPDF[0][fixedIndex]; @@ -256,16 +259,15 @@ const PDFValueType jointPDFValue = *( jointPDFPtr ); // check for non-zero bin contribution - static const PDFValueType closeToZero = vcl_numeric_limits::epsilon(); if( ! (jointPDFValue > closeToZero && movingImagePDFValue > closeToZero) ) { continue; } - const PDFValueType pRatio = vcl_log(jointPDFValue / movingImagePDFValue); + const PDFValueType pRatio = std::log(jointPDFValue / movingImagePDFValue); if( fixedImagePDFValue > closeToZero ) { - sum += jointPDFValue * ( pRatio - vcl_log(fixedImagePDFValue) ); + sum += jointPDFValue * ( pRatio - std::log(fixedImagePDFValue) ); } if( this->GetComputeDerivative() ) @@ -278,7 +280,9 @@ JointPDFValueType const * derivPtr = this->m_ThreaderJointPDFDerivatives[0]->GetBufferPointer() + ( fixedIndex * this->m_ThreaderJointPDFDerivatives[0]->GetOffsetTable()[2] ) + ( movingIndex * this->m_ThreaderJointPDFDerivatives[0]->GetOffsetTable()[1] ); - for( unsigned int parameter = 0; parameter < this->GetNumberOfLocalParameters(); ++parameter, derivPtr++ ) + for( unsigned int parameter = 0, lastParameter = this->GetNumberOfLocalParameters(); + parameter < lastParameter; + ++parameter, derivPtr++ ) { // Ref: eqn 23 of Thevenaz & Unser paper [3] (*(this->m_DerivativeResult))[parameter] += ( *derivPtr ) * pRatio; @@ -288,7 +292,7 @@ { // Collect the pRatio per pdf indecies. // Will be applied subsequently to local-support derivative - OffsetValueType index = movingIndex + (fixedIndex * this->m_NumberOfHistogramBins); + const OffsetValueType index = movingIndex + (fixedIndex * this->m_NumberOfHistogramBins); this->m_PRatioArray[index] = pRatio * nFactor; } } @@ -301,15 +305,15 @@ { if( this->HasLocalSupport() ) { - for( SizeValueType i = 0; i < this->m_DerivativeResult->Size(); i++ ) + for( SizeValueType i = 0, derivativeSize = this->m_DerivativeResult->Size(); i < derivativeSize; ++i ) { - for( SizeValueType bin = 0; bin < 4; bin++ ) + for( SizeValueType bin = 0; bin < 4; ++bin ) { // Increment the m_JointPdfIndex1DArray index by bin in order to recover // the pRatio at the moving indecies used for each portion of the derivative. // Note: in old v3 metric ComputeDerivatives, derivativeContribution is subtracted in global case, // but added in "local" (implicit) case. These operations have been switched to minimize the metric. - SizeValueType pRatioIndex = this->m_JointPdfIndex1DArray[i] + bin; + const SizeValueType pRatioIndex = this->m_JointPdfIndex1DArray[i] + bin; (*(this->m_DerivativeResult))[i] -= m_LocalDerivativeByParzenBin[bin][i] * this->m_PRatioArray[pRatioIndex]; } } @@ -332,25 +336,26 @@ // code used by GetValue and GetValueAndDerivative. // Should be threaded. But if modified to do so, should probably not be threaded // separately, but rather as a part of all post-processing. - for( ThreadIdType threadID = 0; threadID < this->GetNumberOfThreadsUsed(); threadID++ ) + for( ThreadIdType threadId = 0, localNumberOfThreadsUsed = this->GetNumberOfThreadsUsed(); + threadId < localNumberOfThreadsUsed; ++threadId ) { - const int maxI = this->m_NumberOfHistogramBins * ( this->m_ThreaderJointPDFEndBin[threadID] - this->m_ThreaderJointPDFStartBin[threadID] + 1 ); + const int histogramBlockSize = this->m_NumberOfHistogramBins * ( this->m_ThreaderJointPDFEndBin[threadId] - this->m_ThreaderJointPDFStartBin[threadId] + 1 ); - const unsigned int tPdfPtrOffset = ( this->m_ThreaderJointPDFStartBin[threadID] * this->m_ThreaderJointPDF[0]->GetOffsetTable()[1] ); + const unsigned int tPdfPtrOffset = ( this->m_ThreaderJointPDFStartBin[threadId] * this->m_ThreaderJointPDF[0]->GetOffsetTable()[1] ); JointPDFValueType * const pdfPtrStart = this->m_ThreaderJointPDF[0]->GetBufferPointer() + tPdfPtrOffset; // The PDF domain is chunked based on thread. Each thread consolodates independent parts of the PDF. - for( unsigned int t = 1; t < this->GetNumberOfThreadsUsed(); t++ ) + for( unsigned int t = 1; t < localNumberOfThreadsUsed; ++t ) { JointPDFValueType * pdfPtr = pdfPtrStart; JointPDFValueType const * tPdfPtr = this->m_ThreaderJointPDF[t]->GetBufferPointer() + tPdfPtrOffset; - JointPDFValueType const * const tPdfPtrEnd = tPdfPtr + maxI; - // for(i=0; i < maxI; i++) + JointPDFValueType const * const tPdfPtrEnd = tPdfPtr + histogramBlockSize; + // for(i=0; i < histogramBlockSize; i++) while( tPdfPtr < tPdfPtrEnd ) { *( pdfPtr++ ) += *( tPdfPtr++ ); } - for( int i = this->m_ThreaderJointPDFStartBin[threadID]; i <= this->m_ThreaderJointPDFEndBin[threadID]; i++ ) + for( int i = this->m_ThreaderJointPDFStartBin[threadId], endBin= this->m_ThreaderJointPDFEndBin[threadId]; i <= endBin; ++i ) { this->m_ThreaderFixedImageMarginalPDF[0][i] += this->m_ThreaderFixedImageMarginalPDF[t][i]; } @@ -358,11 +363,11 @@ // Sum of this threads domain into the this->m_ThreaderJointPDFSum that covers that part of the domain. PDFValueType jointPDFSum = 0.0; JointPDFValueType const * pdfPtr = pdfPtrStart; - for( int i = 0; i < maxI; i++ ) + for( int i = 0; i < histogramBlockSize; i++ ) { jointPDFSum += *( pdfPtr++ ); } - this->m_ThreaderJointPDFSum[threadID] = jointPDFSum; + this->m_ThreaderJointPDFSum[threadId] = jointPDFSum; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ const MovingImageGradientType & mappedMovingImageGradient, MeasureType & metricValueReturn, DerivativeType & localDerivativeReturn, - const ThreadIdType threadID ) const; + const ThreadIdType threadId ) const; private: MeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader( const Self & ); // purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkMeanSquaresImageToImageMetricv4GetValueAndDerivativeThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ const MovingImageGradientType & movingImageGradient, MeasureType & metricValueReturn, DerivativeType & localDerivativeReturn, - const ThreadIdType threadID) const + const ThreadIdType threadId) const { /** Only the voxelwise contribution given the point pairs. */ FixedImagePixelType diff = fixedImageValue - movingImageValue; @@ -57,10 +57,14 @@ /* Use a pre-allocated jacobian object for efficiency */ typedef typename TImageToImageMetric::JacobianType & JacobianReferenceType; - JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadID].MovingTransformJacobian; + JacobianReferenceType jacobian = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobian; + JacobianReferenceType jacobianPositional = this->m_GetValueAndDerivativePerThreadVariables[threadId].MovingTransformJacobianPositional; /** For dense transforms, this returns identity */ - this->m_Associate->GetMovingTransform()->ComputeJacobianWithRespectToParameters( virtualPoint, jacobian ); + this->m_Associate->GetMovingTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(virtualPoint, + jacobian, + jacobianPositional); for ( unsigned int par = 0; par < this->GetCachedNumberOfLocalParameters(); par++ ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkObjectToObjectMultiMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ this->m_MetricQueue.clear(); //We want the moving transform to be NULL by default - this->m_MovingTransform = NULL; + this->m_MovingTransform = ITK_NULLPTR; } /** Destructor */ @@ -146,7 +146,7 @@ this->m_MetricValueArray.SetSize( this->GetNumberOfMetrics() ); /* Verify the same transform is in all metrics. */ - const MovingTransformType * firstTransform = NULL; + const MovingTransformType * firstTransform = ITK_NULLPTR; for (SizeValueType j = 0; j < this->GetNumberOfMetrics(); j++) { const MovingTransformType * transform = this->m_MetricQueue[j]->GetMovingTransform(); @@ -154,7 +154,7 @@ // optimized, and it must be the same as in other metrics. typedef CompositeTransform CompositeType; const CompositeType * composite = dynamic_cast(transform); - if( composite != NULL ) + if( composite != ITK_NULLPTR ) { SizeValueType count = 0; for( size_t n = 0; n < composite->GetNumberOfTransforms(); n++ ) @@ -360,7 +360,7 @@ for (SizeValueType i = 0; i < this->GetNumberOfMetrics(); i++) { os << indent << "~~~ Metric " << i << " ~~~" << std::endl; - this->m_MetricQueue[i]->Print(os, indent ); + this->m_MetricQueue[i]->Print(os, indent.GetNextIndent() ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,7 +30,7 @@ PointSetFunction ::PointSetFunction() { - this->m_PointSet = NULL; + this->m_PointSet = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -66,17 +66,22 @@ * \ingroup ITKMetricsv4 */ -template +template class PointSetToPointSetMetricv4 -: public ObjectToObjectMetric +: public ObjectToObjectMetric, TInternalComputationValueType> { public: /** Standard class typedefs. */ - typedef PointSetToPointSetMetricv4 Self; - typedef ObjectToObjectMetric Superclass; - typedef SmartPointer Pointer; - typedef SmartPointer ConstPointer; + typedef PointSetToPointSetMetricv4 Self; + typedef ObjectToObjectMetric, + TInternalComputationValueType> Superclass; + typedef SmartPointer Pointer; + typedef SmartPointer ConstPointer; /** Run-time type information (and related methods). */ itkTypeMacro( PointSetToPointSetMetricv4, ObjectToObjectMetric ); @@ -173,13 +178,14 @@ /** Get/Set the fixed pointset. */ itkSetConstObjectMacro( FixedPointSet, FixedPointSetType ); - itkGetConstObjectMacro(FixedPointSet, FixedPointSetType ); + itkGetConstObjectMacro( FixedPointSet, FixedPointSetType ); /** Get the moving transformed point set. */ - itkGetModifiableObjectMacro(FixedTransformedPointSet, FixedTransformedPointSetType ); + itkGetModifiableObjectMacro( FixedTransformedPointSet, FixedTransformedPointSetType ); /** Get/Set the moving point set. */ itkSetConstObjectMacro( MovingPointSet, MovingPointSetType ); + itkGetConstObjectMacro( MovingPointSet, MovingPointSetType ); /** Get the moving transformed point set. */ itkGetModifiableObjectMacro(MovingTransformedPointSet, MovingTransformedPointSetType ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/include/itkPointSetToPointSetMetricv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,19 +25,19 @@ { /** Constructor */ -template -PointSetToPointSetMetricv4 +template +PointSetToPointSetMetricv4 ::PointSetToPointSetMetricv4() { - this->m_FixedPointSet = NULL; // has to be provided by the user. - this->m_MovingPointSet = NULL; // has to be provided by the user. + this->m_FixedPointSet = ITK_NULLPTR; // has to be provided by the user. + this->m_MovingPointSet = ITK_NULLPTR; // has to be provided by the user. - this->m_FixedTransformedPointSet = NULL; - this->m_MovingTransformedPointSet = NULL; - this->m_VirtualTransformedPointSet = NULL; + this->m_FixedTransformedPointSet = ITK_NULLPTR; + this->m_MovingTransformedPointSet = ITK_NULLPTR; + this->m_VirtualTransformedPointSet = ITK_NULLPTR; - this->m_FixedTransformedPointsLocator = NULL; - this->m_MovingTransformedPointsLocator = NULL; + this->m_FixedTransformedPointsLocator = ITK_NULLPTR; + this->m_MovingTransformedPointsLocator = ITK_NULLPTR; this->m_MovingTransformPointLocatorsNeedInitialization = false; this->m_FixedTransformPointLocatorsNeedInitialization = false; @@ -54,16 +54,16 @@ } /** Destructor */ -template -PointSetToPointSetMetricv4 +template +PointSetToPointSetMetricv4 ::~PointSetToPointSetMetricv4() { } /** Initialize the metric */ -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::Initialize( void ) throw ( ExceptionObject ) { if ( !this->m_FixedPointSet ) @@ -124,9 +124,9 @@ this->InitializePointSets(); } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::InitializePointSets() const { this->TransformMovingPointSet(); @@ -134,9 +134,9 @@ this->InitializePointsLocators(); } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::InitializeForIteration() const { this->InitializePointSets(); @@ -148,17 +148,17 @@ } } -template +template SizeValueType -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::GetNumberOfComponents() const { return this->m_FixedTransformedPointSet->GetNumberOfPoints(); } -template -typename PointSetToPointSetMetricv4::MeasureType -PointSetToPointSetMetricv4 +template +typename PointSetToPointSetMetricv4::MeasureType +PointSetToPointSetMetricv4 ::GetValue() const { this->InitializeForIteration(); @@ -207,26 +207,26 @@ return value; } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::GetDerivative( DerivativeType & derivative ) const { MeasureType value = NumericTraits::Zero; this->CalculateValueAndDerivative( value, derivative, false ); } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::GetValueAndDerivative( MeasureType & value, DerivativeType & derivative ) const { this->CalculateValueAndDerivative( value, derivative, true ); } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::CalculateValueAndDerivative( MeasureType & value, DerivativeType & derivative, bool calculateValue ) const { this->InitializeForIteration(); @@ -235,6 +235,7 @@ value = NumericTraits::Zero; MovingTransformJacobianType jacobian( MovingPointDimension, this->GetNumberOfLocalParameters() ); + MovingTransformJacobianType jacobianPositional( MovingPointDimension, MovingPointDimension ); DerivativeType localTransformDerivative( this->GetNumberOfLocalParameters() ); localTransformDerivative.Fill( NumericTraits::Zero ); @@ -286,7 +287,10 @@ // Reset to zero since we're not accumulating in the local-support case. localTransformDerivative.Fill( NumericTraits::Zero ); } - this->GetMovingTransform()->ComputeJacobianWithRespectToParameters( virtualIt.Value(), jacobian ); + this->GetMovingTransform()-> + ComputeJacobianWithRespectToParametersCachedTemporaries(virtualIt.Value(), + jacobian, + jacobianPositional); for ( NumberOfParametersType par = 0; par < this->GetNumberOfLocalParameters(); par++ ) { for( DimensionType d = 0; d < PointDimension; ++d ) @@ -317,9 +321,9 @@ this->m_Value = value; } -template +template SizeValueType -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::CalculateNumberOfValidFixedPoints() const { // Determine the number of valid fixed points, using @@ -337,9 +341,9 @@ return numberOfValidPoints; } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::StorePointDerivative( const VirtualPointType & virtualPoint, const DerivativeType & pointDerivative, DerivativeType & field ) const { // Update derivative field at some index. @@ -365,10 +369,10 @@ } } -template -typename PointSetToPointSetMetricv4 +template +typename PointSetToPointSetMetricv4 ::LocalDerivativeType -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::GetLocalNeighborhoodDerivative( const PointType & point, const PixelType & pixel ) const { MeasureType measure; @@ -377,9 +381,9 @@ return localDerivative; } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::TransformMovingPointSet() const { // Transform the moving point set with the moving transform. @@ -404,9 +408,9 @@ } } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::TransformFixedAndCreateVirtualPointSet() const { // Transform the fixed point set through the virtual domain, and into the moving domain @@ -439,9 +443,9 @@ } } -template -const typename PointSetToPointSetMetricv4::VirtualPointSetType * -PointSetToPointSetMetricv4 +template +const typename PointSetToPointSetMetricv4::VirtualPointSetType * +PointSetToPointSetMetricv4 ::GetVirtualTransformedPointSet( void ) const { // First make sure the virtual point set is current. @@ -449,9 +453,9 @@ return this->m_VirtualTransformedPointSet.GetPointer(); } -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::InitializePointsLocators() const { if( this->m_FixedTransformPointLocatorsNeedInitialization ) @@ -484,9 +488,9 @@ } /** PrintSelf */ -template +template void -PointSetToPointSetMetricv4 +PointSetToPointSetMetricv4 ::PrintSelf( std::ostream & os, Indent indent ) const { Superclass::PrintSelf( os, indent ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/itk-module.cmake otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/itk-module.cmake --- otb-4.0.0/Utilities/ITK/Modules/Registration/Metricsv4/itk-module.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/Metricsv4/itk-module.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -6,6 +6,7 @@ ITKOptimizersv4 TEST_DEPENDS ITKTestKernel + ITKOptimizersv4 DESCRIPTION "${DOCUMENTATION}" ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkCurvatureRegistrationFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkCurvatureRegistrationFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkCurvatureRegistrationFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkCurvatureRegistrationFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -176,9 +176,9 @@ for ( unsigned int idx = 0; idx < m_FixedImageDimensions[dim]; ++idx ) { #ifdef SLOW_DCT - m_DiagonalElements[dim][idx] = -2 + 2 * vcl_cos(vnl_math::pi * idx / m_FixedImageDimensions[dim]); + m_DiagonalElements[dim][idx] = -2 + 2 * std::cos(vnl_math::pi * idx / m_FixedImageDimensions[dim]); #else - m_DiagonalElements[dim][idx] = -2 + 2 * vcl_cos(vnl_math::pi * ( idx + 1 ) / m_FixedImageDimensions[dim]); + m_DiagonalElements[dim][idx] = -2 + 2 * std::cos(vnl_math::pi * ( idx + 1 ) / m_FixedImageDimensions[dim]); #endif } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkDemonsRegistrationFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkDemonsRegistrationFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkDemonsRegistrationFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkDemonsRegistrationFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -43,8 +43,8 @@ m_TimeStep = 1.0; m_DenominatorThreshold = 1e-9; m_IntensityDifferenceThreshold = 0.001; - this->SetMovingImage(NULL); - this->SetFixedImage(NULL); + this->SetMovingImage(ITK_NULLPTR); + this->SetFixedImage(ITK_NULLPTR); //m_FixedImageSpacing.Fill( 1.0 ); //m_FixedImageOrigin.Fill( 0.0 ); m_Normalizer = 1.0; @@ -273,7 +273,7 @@ { m_Metric = m_SumOfSquaredDifference / static_cast< double >( m_NumberOfPixelsProcessed ); - m_RMSChange = vcl_sqrt( m_SumOfSquaredChange + m_RMSChange = std::sqrt( m_SumOfSquaredChange / static_cast< double >( m_NumberOfPixelsProcessed ) ); } m_MetricCalculationLock.Unlock(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkFastSymmetricForcesDemonsRegistrationFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkFastSymmetricForcesDemonsRegistrationFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkFastSymmetricForcesDemonsRegistrationFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkFastSymmetricForcesDemonsRegistrationFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -294,7 +294,7 @@ { m_Metric = m_SumOfSquaredDifference / static_cast< double >( m_NumberOfPixelsProcessed ); - m_RMSChange = vcl_sqrt( m_SumOfSquaredChange + m_RMSChange = std::sqrt( m_SumOfSquaredChange / static_cast< double >( m_NumberOfPixelsProcessed ) ); } m_MetricCalculationLock.Unlock(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkLevelSetMotionRegistrationFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkLevelSetMotionRegistrationFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkLevelSetMotionRegistrationFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkLevelSetMotionRegistrationFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,8 +44,8 @@ m_GradientMagnitudeThreshold = 1e-9; m_IntensityDifferenceThreshold = 0.001; m_GradientSmoothingStandardDeviations = 1.0; - this->SetMovingImage(NULL); - this->SetFixedImage(NULL); + this->SetMovingImage(ITK_NULLPTR); + this->SetFixedImage(ITK_NULLPTR); typename DefaultInterpolatorType::Pointer interp = DefaultInterpolatorType::New(); @@ -362,7 +362,7 @@ } gradientMagnitude += vnl_math_sqr(gradient[j]); } - gradientMagnitude = vcl_sqrt(gradientMagnitude); + gradientMagnitude = std::sqrt(gradientMagnitude); /** * Compute Update. @@ -451,7 +451,7 @@ { m_Metric = m_SumOfSquaredDifference / static_cast< double >( m_NumberOfPixelsProcessed ); - m_RMSChange = vcl_sqrt( m_SumOfSquaredChange + m_RMSChange = std::sqrt( m_SumOfSquaredChange / static_cast< double >( m_NumberOfPixelsProcessed ) ); } m_MetricCalculationLock.Unlock(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkMultiResolutionPDEDeformableRegistration.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,7 @@ m_MovingImagePyramid = MovingImagePyramidType::New(); m_FixedImagePyramid = FixedImagePyramidType::New(); m_FieldExpander = FieldExpanderType::New(); - m_InitialDisplacementField = NULL; + m_InitialDisplacementField = ITK_NULLPTR; m_NumberOfLevels = 3; m_NumberOfIterations.SetSize(m_NumberOfLevels); @@ -262,7 +262,7 @@ unsigned int fixedLevel = vnl_math_min( (int)m_CurrentLevel, (int)m_FixedImagePyramid->GetNumberOfLevels() ); - DisplacementFieldPointer tempField = NULL; + DisplacementFieldPointer tempField = ITK_NULLPTR; DisplacementFieldPointer inputPtr = const_cast< DisplacementFieldType * >( this->GetInput(0) ); @@ -318,7 +318,7 @@ m_FieldExpander->SetOutputDirection( fi->GetDirection() ); m_FieldExpander->UpdateLargestPossibleRegion(); - m_FieldExpander->SetInput(NULL); + m_FieldExpander->SetInput(ITK_NULLPTR); tempField = m_FieldExpander->GetOutput(); tempField->DisconnectPipeline(); } @@ -329,7 +329,7 @@ { if ( tempField.IsNull() ) { - m_RegistrationFilter->SetInitialDisplacementField(NULL); + m_RegistrationFilter->SetInitialDisplacementField(ITK_NULLPTR); } else { @@ -348,7 +348,7 @@ m_FieldExpander->SetOutputDirection( fi->GetDirection() ); m_FieldExpander->UpdateLargestPossibleRegion(); - m_FieldExpander->SetInput(NULL); + m_FieldExpander->SetInput(ITK_NULLPTR); tempField = m_FieldExpander->GetOutput(); tempField->DisconnectPipeline(); @@ -386,7 +386,7 @@ (int)m_FixedImagePyramid->GetNumberOfLevels() ); // Invoke an iteration event. - this->InvokeEvent( IterationEvent() ); + this->InvokeEvent( MultiResolutionIterationEvent() ); // We can release data from pyramid which are no longer required. if ( movingLevel > 0 ) @@ -427,9 +427,9 @@ } // Release memory - m_FieldExpander->SetInput(NULL); + m_FieldExpander->SetInput(ITK_NULLPTR); m_FieldExpander->GetOutput()->ReleaseData(); - m_RegistrationFilter->SetInput(NULL); + m_RegistrationFilter->SetInput(ITK_NULLPTR); m_RegistrationFilter->GetOutput()->ReleaseData(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkSymmetricForcesDemonsRegistrationFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkSymmetricForcesDemonsRegistrationFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkSymmetricForcesDemonsRegistrationFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/PDEDeformable/include/itkSymmetricForcesDemonsRegistrationFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,8 +39,8 @@ m_TimeStep = 1.0; m_DenominatorThreshold = 1e-9; m_IntensityDifferenceThreshold = 0.001; - this->SetMovingImage(NULL); - this->SetFixedImage(NULL); + this->SetMovingImage(ITK_NULLPTR); + this->SetFixedImage(ITK_NULLPTR); m_FixedImageSpacing.Fill(1.0); m_Normalizer = 0.0; m_FixedImageGradientCalculator = GradientCalculatorType::New(); @@ -317,7 +317,7 @@ { m_Metric = m_SumOfSquaredDifference / static_cast< double >( m_NumberOfPixelsProcessed ); - m_RMSChange = vcl_sqrt( m_SumOfSquaredChange + m_RMSChange = std::sqrt( m_SumOfSquaredChange / static_cast< double >( m_NumberOfPixelsProcessed ) ); } m_MetricCalculationLock.Unlock(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -25,13 +25,6 @@ namespace itk { -//Forward-declare these because of module dependency conflict. -//They will soon be moved to a different module, at which -// time this can be removed. -template -class ImageToData; -template -class Array1DToData; /** \class BSplineSyNImageRegistrationMethod * \brief Interface method for the performing greedy B-spline SyN image registration. @@ -90,6 +83,7 @@ typedef typename Superclass::NumberOfIterationsArrayType NumberOfIterationsArrayType; + typedef typename Superclass::InitialTransformType InitialTransformType; typedef TOutputTransform OutputTransformType; typedef typename OutputTransformType::Pointer OutputTransformPointer; typedef typename OutputTransformType::ScalarType RealType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkBSplineSyNImageRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -79,7 +79,6 @@ ::StartOptimization() { const DisplacementVectorType zeroVector( 0.0 ); - typedef ImageDuplicator DisplacementFieldDuplicatorType; typename VirtualImageType::ConstPointer virtualDomainImage; typename MovingImageMaskType::ConstPointer movingImageMask; @@ -115,21 +114,22 @@ } } + InitialTransformType* fixedInitialTransform = const_cast(this->GetFixedInitialTransform()); + // Monitor the convergence typedef itk::Function::WindowConvergenceMonitoringFunction ConvergenceMonitoringType; typename ConvergenceMonitoringType::Pointer convergenceMonitoring = ConvergenceMonitoringType::New(); convergenceMonitoring->SetWindowSize( this->m_ConvergenceWindowSize ); - typedef IdentityTransform IdentityTransformType; - typename IdentityTransformType::Pointer identityTransform; - identityTransform = IdentityTransformType::New(); - IterationReporter reporter( this, 0, 1 ); while( this->m_CurrentIteration++ < this->m_NumberOfIterationsPerLevel[this->m_CurrentLevel] && !this->m_IsConverged ) { typename CompositeTransformType::Pointer fixedComposite = CompositeTransformType::New(); - fixedComposite->AddTransform( this->m_FixedInitialTransform ); + if ( fixedInitialTransform != ITK_NULLPTR ) + { + fixedComposite->AddTransform( fixedInitialTransform ); + } fixedComposite->AddTransform( this->m_FixedToMiddleTransform->GetInverseTransform() ); fixedComposite->FlattenTransformQueue(); fixedComposite->SetOnlyMostRecentTransformToOptimizeOn(); @@ -170,7 +170,7 @@ fixedComposer->Update(); DisplacementFieldPointer fixedToMiddleSmoothTotalFieldTmp = this->BSplineSmoothDisplacementField( fixedComposer->GetOutput(), - this->m_FixedToMiddleTransform->GetNumberOfControlPointsForTheTotalField(), NULL ); + this->m_FixedToMiddleTransform->GetNumberOfControlPointsForTheTotalField(), ITK_NULLPTR ); typename ComposerType::Pointer movingComposer = ComposerType::New(); movingComposer->SetDisplacementField( movingToMiddleSmoothUpdateField ); @@ -178,7 +178,7 @@ movingComposer->Update(); DisplacementFieldPointer movingToMiddleSmoothTotalFieldTmp = this->BSplineSmoothDisplacementField( movingComposer->GetOutput(), - this->m_MovingToMiddleTransform->GetNumberOfControlPointsForTheTotalField(), NULL ); + this->m_MovingToMiddleTransform->GetNumberOfControlPointsForTheTotalField(), ITK_NULLPTR ); // Iteratively estimate the inverse fields. @@ -384,7 +384,7 @@ importer->SetDirection( virtualDomainImage->GetDirection() ); importer->Update(); - typename WeightedMaskImageType::Pointer weightedMask = NULL; + typename WeightedMaskImageType::Pointer weightedMask = ITK_NULLPTR; if( mask ) { @@ -424,7 +424,7 @@ { localNorm += vnl_math_sqr( vector[d] / spacing[d] ); } - localNorm = vcl_sqrt( localNorm ); + localNorm = std::sqrt( localNorm ); if( localNorm > maxNorm ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ #include "itkImageToImageMetricv4.h" #include "itkShrinkImageFilter.h" #include "itkTransform.h" -#include "itkTransformParametersAdaptor.h" +#include "itkTransformParametersAdaptorBase.h" #include @@ -85,7 +85,10 @@ * * \ingroup ITKRegistrationMethodsv4 */ -template +template, + typename TVirtualImage = TFixedImage> class ImageRegistrationMethodv4 :public ProcessObject { @@ -140,6 +143,9 @@ */ typedef DataObjectDecorator DecoratedOutputTransformType; typedef typename DecoratedOutputTransformType::Pointer DecoratedOutputTransformPointer; + typedef DataObjectDecorator DecoratedInitialTransformType; + typedef typename DecoratedInitialTransformType::Pointer DecoratedInitialTransformPointer; + typedef ShrinkImageFilter ShrinkFilterType; typedef typename ShrinkFilterType::ShrinkFactorsType ShrinkFactorsPerDimensionContainerType; @@ -150,7 +156,7 @@ typedef Array MetricSamplingPercentageArrayType; /** Transform adaptor typedefs */ - typedef TransformParametersAdaptor TransformParametersAdaptorType; + typedef TransformParametersAdaptorBase TransformParametersAdaptorType; typedef typename TransformParametersAdaptorType::Pointer TransformParametersAdaptorPointer; typedef std::vector TransformParametersAdaptorsContainerType; @@ -221,12 +227,27 @@ itkGetConstMacro( MetricSamplingPercentagePerLevel, MetricSamplingPercentageArrayType ); /** Set/Get the initial fixed transform. */ - itkSetObjectMacro( FixedInitialTransform, InitialTransformType ); - itkGetModifiableObjectMacro( FixedInitialTransform, InitialTransformType ); + itkSetGetDecoratedObjectInputMacro( FixedInitialTransform, InitialTransformType ); /** Set/Get the initial moving transform. */ - itkSetObjectMacro( MovingInitialTransform, InitialTransformType ); - itkGetModifiableObjectMacro( MovingInitialTransform, InitialTransformType ); + itkSetGetDecoratedObjectInputMacro( MovingInitialTransform, InitialTransformType ); + + /** Set/Get the initial transform to be optimized + * + * This transform is composed with the MovingInitialTransform to + * specify the initial transformation from the moving image to + * the virtual image. It is used for the default parameters, and can + * be use to specify the transform type. + * + * If the filter has "InPlace" set then this transform will be the + * output transform object or "grafted" to the output. Otherwise, + * this InitialTransform will be deep copied or "cloned" to the + * output. + * + * If this parameter is not set then a default constructed output + * transform is used. + */ + itkSetGetDecoratedObjectInputMacro(InitialTransform, InitialTransformType); /** Set/Get the transform adaptors. */ void SetTransformParametersAdaptorsPerLevel( TransformParametersAdaptorsContainerType & ); @@ -303,11 +324,18 @@ /** Make a DataObject of the correct type to be used as the specified output. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType ); + virtual DataObjectPointer MakeOutput( DataObjectPointerArraySizeType ) ITK_OVERRIDE; /** Returns the transform resulting from the registration process */ + virtual DecoratedOutputTransformType * GetOutput(); virtual const DecoratedOutputTransformType * GetOutput() const; + virtual DecoratedOutputTransformType * GetTransformOutput() { return this->GetOutput(); } + virtual const DecoratedOutputTransformType * GetTransformOutput() const { return this->GetOutput(); } + + virtual OutputTransformType * GetModifiableTransform(); + virtual const OutputTransformType * GetTransform() const; + /** Get the current level. This is a helper function for reporting observations. */ itkGetConstMacro( CurrentLevel, SizeValueType ); @@ -323,6 +351,14 @@ /** Get the current convergence state per level. This is a helper function for reporting observations. */ itkGetConstReferenceMacro( IsConverged, bool ); + /** Request that the InitialTransform be grafted onto the output, + * there by not creating a copy. + */ + itkSetMacro(InPlace, bool); + itkGetConstMacro(InPlace, bool); + itkBooleanMacro(InPlace); + + #ifdef ITKV3_COMPATIBILITY /** Method that initiates the registration. This will Initialize and ensure * that all inputs the registration needs are in place, via a call to @@ -345,10 +381,12 @@ protected: ImageRegistrationMethodv4(); virtual ~ImageRegistrationMethodv4(); - virtual void PrintSelf( std::ostream & os, Indent indent ) const; + virtual void PrintSelf( std::ostream & os, Indent indent ) const ITK_OVERRIDE; /** Perform the registration. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; + + virtual void AllocateOutputs(); /** Initialize by setting the interconnects between the components. */ virtual void InitializeRegistrationAtEachLevel( const SizeValueType ); @@ -380,18 +418,33 @@ SmoothingSigmasArrayType m_SmoothingSigmasPerLevel; bool m_SmoothingSigmasAreSpecifiedInPhysicalUnits; - InitialTransformPointer m_MovingInitialTransform; - InitialTransformPointer m_FixedInitialTransform; - TransformParametersAdaptorsContainerType m_TransformParametersAdaptorsPerLevel; CompositeTransformPointer m_CompositeTransform; + //TODO: m_OutputTransform should be removed and replaced with a named input parameter for + // the pipeline --- Along with many other fixes OutputTransformPointer m_OutputTransform; + private: ImageRegistrationMethodv4( const Self & ); //purposely not implemented - void operator=( const Self & ); //purposely not implemented + void operator=( const Self & ); //purposely not implemented + + bool m_InPlace; + + // helper function to create the right kind of concrete transform + template + static void MakeOutputTransform(SmartPointer &ptr) + { + ptr = TTransform::New(); + } + + static void MakeOutputTransform(SmartPointer &ptr) + { + ptr = itk::IdentityTransform::New().GetPointer(); + } + }; } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkImageRegistrationMethodv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,21 @@ ImageRegistrationMethodv4 ::ImageRegistrationMethodv4() { - this->SetNumberOfRequiredOutputs( 1 ); + ProcessObject::SetNumberOfRequiredOutputs(1); + Self::SetPrimaryOutputName("Transform"); + + // indexed input are alternating fixed and moving images + Self::SetPrimaryInputName("Fixed"); + Self::AddRequiredInputName("Moving",1); + ProcessObject::SetNumberOfRequiredInputs(2); + + // optional named inputs + Self::SetInput("InitialTransform", ITK_NULLPTR); + Self::SetInput("FixedInitialTransform", ITK_NULLPTR); + Self::SetInput("MovingInitialTransform", ITK_NULLPTR); + + + Self::ReleaseDataBeforeUpdateFlagOff(); this->m_CurrentLevel = 0; this->m_CurrentIteration = 0; @@ -49,15 +63,11 @@ this->m_NumberOfFixedImages = 0; this->m_NumberOfMovingImages = 0; - this->m_CompositeTransform = CompositeTransformType::New(); - - typedef IdentityTransform IdentityTransformType; + Self::ReleaseDataBeforeUpdateFlagOff(); - typename IdentityTransformType::Pointer defaultFixedInitialTransform = IdentityTransformType::New(); - this->m_FixedInitialTransform = defaultFixedInitialTransform; + this->m_InPlace = true; - typename IdentityTransformType::Pointer defaultMovingInitialTransform = IdentityTransformType::New(); - this->m_MovingInitialTransform = defaultMovingInitialTransform; + this->m_CompositeTransform = CompositeTransformType::New(); typedef MattesMutualInformationImageToImageMetricv4 DefaultMetricType; typename DefaultMetricType::Pointer mutualInformationMetric = DefaultMetricType::New(); @@ -82,11 +92,11 @@ this->m_OptimizerWeights.SetSize( 0 ); this->m_OptimizerWeightsAreIdentity = true; - this->m_OutputTransform = OutputTransformType::New(); - DecoratedOutputTransformPointer transformDecorator = DecoratedOutputTransformType::New().GetPointer(); - transformDecorator->Set( this->m_OutputTransform ); + DecoratedOutputTransformPointer transformDecorator = + itkDynamicCastInDebugMode< DecoratedOutputTransformType * >( this->MakeOutput(0).GetPointer() ); this->ProcessObject::SetNthOutput( 0, transformDecorator ); + this->m_OutputTransform = transformDecorator->GetModifiable(); // By default we set up a 3-level image registration. @@ -200,7 +210,7 @@ for( unsigned int i = 0; i < this->m_OptimizerWeights.Size(); i++ ) { OptimizerWeightsValueType difference = - vcl_fabs( NumericTraits::OneValue() - this->m_OptimizerWeights[i] ); + std::fabs( NumericTraits::OneValue() - this->m_OptimizerWeights[i] ); if( difference > tolerance ) { this->m_OptimizerWeightsAreIdentity = false; @@ -227,7 +237,7 @@ itkExceptionMacro( "The number of fixed and moving images is not equal." ); } - SizeValueType numberOfImagePairs = static_cast( 0.5 * this->GetNumberOfInputs() ); + SizeValueType numberOfImagePairs = static_cast( 0.5 * this->GetNumberOfIndexedInputs() ); if( numberOfImagePairs == 0 ) { @@ -264,12 +274,15 @@ itkExceptionMacro( "The image metric is not present." ); } + InitialTransformType* movingInitialTransform = const_cast(this->GetMovingInitialTransform()); + InitialTransformType* fixedInitialTransform = const_cast(this->GetFixedInitialTransform()); + this->m_CurrentIteration = 0; this->m_CurrentMetricValue = 0.0; this->m_CurrentConvergenceValue = 0.0; this->m_IsConverged = false; - this->InvokeEvent( InitializeEvent() ); + this->InvokeEvent( MultiResolutionIterationEvent() ); // For each level, we adapt the current transform. For many transforms, e.g. // affine, the base transform adaptor does not do anything. However, in the @@ -289,13 +302,22 @@ { this->m_CompositeTransform->ClearTransformQueue(); - // If the moving initial transform is a composite transform, unroll - // it into m_CompositeTransform. This is a temporary fix to accommodate - // the lack of support for calculating the jacobian in the composite - // transform. + // Since we cannot instantiate a null object from an abstract class, we need to initialize the moving + // initial transform as an identity transform. + // Nevertheless, we do not need add this transform to the composite transform when it is only an + // identity transform. Simply by not setting that, we can save lots of time in jacobian computations + // of the composite transform since we can avoid some matrix multiplications. + + // Skip adding an IdentityTransform to the m_CompositeTransform + if( movingInitialTransform != ITK_NULLPTR && + std::string(movingInitialTransform->GetNameOfClass() ) != std::string("IdentityTransform") ) + { + this->m_CompositeTransform->AddTransform( movingInitialTransform ); + } - this->m_CompositeTransform->AddTransform( this->m_MovingInitialTransform ); this->m_CompositeTransform->AddTransform( this->m_OutputTransform ); + // If the moving initial transform is a composite transform, unroll + // it into m_CompositeTransform. this->m_CompositeTransform->FlattenTransformQueue(); if( this->m_OptimizerWeights.Size() > 0 ) @@ -317,7 +339,16 @@ typename MultiMetricType::Pointer multiMetric2 = dynamic_cast( this->m_Metric.GetPointer() ); if( multiMetric2 ) { - multiMetric2->SetFixedTransform( this->m_FixedInitialTransform ); + if ( fixedInitialTransform ) + { + multiMetric2->SetFixedTransform( fixedInitialTransform ); + } + else + { + typedef IdentityTransform IdentityTransformType; + typename IdentityTransformType::Pointer defaultFixedInitialTransform = IdentityTransformType::New(); + multiMetric2->SetFixedTransform( defaultFixedInitialTransform ); + } multiMetric2->SetMovingTransform( this->m_CompositeTransform ); multiMetric2->SetVirtualDomainFromImage( shrinkFilter->GetOutput() ); for( unsigned int n = 0; n < multiMetric2->GetNumberOfMetrics(); n++ ) @@ -338,7 +369,16 @@ typename ImageMetricType::Pointer imageMetric = dynamic_cast( this->m_Metric.GetPointer() ); if( imageMetric.IsNotNull() ) { - imageMetric->SetFixedTransform( this->m_FixedInitialTransform ); + if ( fixedInitialTransform ) + { + imageMetric->SetFixedTransform( fixedInitialTransform ); + } + else + { + typedef IdentityTransform IdentityTransformType; + typename IdentityTransformType::Pointer defaultFixedInitialTransform = IdentityTransformType::New(); + imageMetric->SetFixedTransform( defaultFixedInitialTransform ); + } imageMetric->SetMovingTransform( this->m_CompositeTransform ); imageMetric->SetVirtualDomainFromImage( shrinkFilter->GetOutput() ); } @@ -439,6 +479,80 @@ } } + +template +void +ImageRegistrationMethodv4 +::AllocateOutputs() +{ + const DecoratedInitialTransformType * decoratedInitialTransform = this->GetInitialTransformInput(); + DecoratedOutputTransformType *decoratedOutputTransform = this->GetOutput(); + + if ( decoratedInitialTransform ) + { + const InitialTransformType * initialTransform = decoratedInitialTransform->Get(); + + if ( initialTransform ) + { + if ( this->GetInPlace() ) + { + // graft the input to the output which may fail if the types + // aren't compatible. + decoratedOutputTransform->Graft( decoratedInitialTransform ); + + if ( decoratedOutputTransform->Get() ) + { + this->m_OutputTransform = decoratedOutputTransform->GetModifiable(); + + // This is generally done in the ReleaseInputs methods, + // however we do not need it again + const_cast(decoratedInitialTransform)->ReleaseData(); + + // successful in-place grafting + itkDebugMacro("inplace allocation of output transform"); + return; + } + } + + const OutputTransformType * initialAsOutputTransform = dynamic_cast( initialTransform ); + + if ( initialAsOutputTransform ) + { + // Clone performs a deep copy of the parameters and composition + this->m_OutputTransform = initialAsOutputTransform->Clone(); + decoratedOutputTransform->Set(this->m_OutputTransform); + + // successful deep copy from initial to output + itkDebugMacro("clone copy allocation of output transform"); + return; + } + else + { + itkExceptionMacro("Unable to convert InitialTransform input to the OutputTransform type"); + } + + } + } + + // fallback allocation and initialization + + + // initialize to identity? what happens if we re-run with optimized values? + itkDebugMacro("fallback allocation of output transform"); + + if ( !decoratedOutputTransform->Get() ) + { + // the output decorated component is null, allocate + OutputTransformPointer ptr; + Self::MakeOutputTransform(ptr); + decoratedOutputTransform->Set(ptr); + } + + this->m_OutputTransform = this->GetModifiableTransform(); + +} + + /* * Start the registration */ @@ -447,6 +561,7 @@ ImageRegistrationMethodv4 ::GenerateData() { + this->AllocateOutputs(); for( this->m_CurrentLevel = 0; this->m_CurrentLevel < this->m_NumberOfLevels; this->m_CurrentLevel++ ) { this->InitializeRegistrationAtEachLevel( this->m_CurrentLevel ); @@ -507,8 +622,7 @@ this->m_TransformParametersAdaptorsPerLevel.clear(); for( SizeValueType level = 0; level < this->m_NumberOfLevels; level++ ) { - typename TransformParametersAdaptorType::Pointer transformParametersAdaptor = TransformParametersAdaptorType::New(); - this->m_TransformParametersAdaptorsPerLevel.push_back( transformParametersAdaptor.GetPointer() ); + this->m_TransformParametersAdaptorsPerLevel.push_back( ITK_NULLPTR ); } for( unsigned int level = 0; level < this->m_NumberOfLevels; ++level ) @@ -591,7 +705,7 @@ { case REGULAR: { - const unsigned long sampleCount = static_cast( vcl_ceil( 1.0 / this->m_MetricSamplingPercentagePerLevel[this->m_CurrentLevel] ) ); + const unsigned long sampleCount = static_cast( std::ceil( 1.0 / this->m_MetricSamplingPercentagePerLevel[this->m_CurrentLevel] ) ); unsigned long count = sampleCount; //Start at sampleCount to keep behavior backwards identical, using first element. ImageRegionConstIteratorWithIndex It( virtualImage, virtualDomainRegion ); for( It.GoToBegin(); !It.IsAtEnd(); ++It ) @@ -663,8 +777,9 @@ ::PrintSelf( std::ostream & os, Indent indent ) const { Superclass::PrintSelf( os, indent ); + Indent indent2 = indent.GetNextIndent(); - os << "Number of levels = " << this->m_NumberOfLevels << std::endl; + os << indent << "Number of levels = " << this->m_NumberOfLevels << std::endl; for( unsigned int level = 0; level < this->m_NumberOfLevels; ++level ) { @@ -675,11 +790,11 @@ if( this->m_SmoothingSigmasAreSpecifiedInPhysicalUnits == true ) { - os << indent << indent << "Smoothing sigmas are specified in physical units." << std::endl; + os << indent2 << "Smoothing sigmas are specified in physical units." << std::endl; } else { - os << indent << indent << "Smoothing sigmas are specified in voxel units." << std::endl; + os << indent2 << "Smoothing sigmas are specified in voxel units." << std::endl; } if( this->m_OptimizerWeights.Size() > 0 ) @@ -695,12 +810,22 @@ os << this->m_MetricSamplingPercentagePerLevel[i] << " "; } os << std::endl; + + os << indent << "InPlace: " << ( m_InPlace ? "On" : "Off" ) << std::endl; } /* * Get output transform */ template +typename ImageRegistrationMethodv4::DecoratedOutputTransformType * +ImageRegistrationMethodv4 +::GetOutput() +{ + return static_cast( this->ProcessObject::GetOutput( 0 ) ); +} + +template const typename ImageRegistrationMethodv4::DecoratedOutputTransformType * ImageRegistrationMethodv4 ::GetOutput() const @@ -709,6 +834,28 @@ } template +typename ImageRegistrationMethodv4::OutputTransformType * +ImageRegistrationMethodv4 +::GetModifiableTransform() +{ + DecoratedOutputTransformType * temp = this->GetOutput(); + // required outputs of process object should always exits + itkAssertInDebugAndIgnoreInReleaseMacro( temp != ITK_NULLPTR ); + return temp->GetModifiable(); +} + +template +const typename ImageRegistrationMethodv4::OutputTransformType * +ImageRegistrationMethodv4 +::GetTransform() const +{ + const DecoratedOutputTransformType * temp = this->GetOutput(); + // required outputs of process object should always exits + itkAssertInDebugAndIgnoreInReleaseMacro( temp != ITK_NULLPTR ); + return temp->Get(); +} + +template DataObject::Pointer ImageRegistrationMethodv4 ::MakeOutput( DataObjectPointerArraySizeType output ) @@ -716,11 +863,16 @@ switch ( output ) { case 0: - return DecoratedOutputTransformType::New().GetPointer(); - break; + { + OutputTransformPointer ptr; + Self::MakeOutputTransform(ptr); + DecoratedOutputTransformPointer transformDecorator = DecoratedOutputTransformType::New(); + transformDecorator->Set( ptr ); + return transformDecorator.GetPointer(); + } default: itkExceptionMacro("MakeOutput request for an output number larger than the expected number of outputs"); - return 0; + return ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -24,13 +24,6 @@ namespace itk { -//Forward-declare these because of module dependency conflict. -//They will soon be moved to a different module, at which -// time this can be removed. -template -class ImageToData; -template -class Array1DToData; /** \class SyNImageRegistrationMethod * \brief Interface method for the performing greedy SyN image registration. @@ -107,6 +100,7 @@ typedef typename ImageMetricType::FixedImageMaskType FixedImageMaskType; typedef typename ImageMetricType::MovingImageMaskType MovingImageMaskType; + typedef typename Superclass::InitialTransformType InitialTransformType; typedef TOutputTransform OutputTransformType; typedef typename OutputTransformType::Pointer OutputTransformPointer; typedef typename OutputTransformType::ScalarType RealType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -130,7 +130,6 @@ ::StartOptimization() { const DisplacementVectorType zeroVector( 0.0 ); - typedef ImageDuplicator DisplacementFieldDuplicatorType; typename VirtualImageType::ConstPointer virtualDomainImage; typename MultiMetricType::Pointer multiMetric = dynamic_cast( this->m_Metric.GetPointer() ); if( multiMetric ) @@ -142,21 +141,22 @@ virtualDomainImage = dynamic_cast( this->m_Metric.GetPointer() )->GetVirtualImage(); } + InitialTransformType* fixedInitialTransform = const_cast(this->GetFixedInitialTransform()); + // Monitor the convergence typedef itk::Function::WindowConvergenceMonitoringFunction ConvergenceMonitoringType; typename ConvergenceMonitoringType::Pointer convergenceMonitoring = ConvergenceMonitoringType::New(); convergenceMonitoring->SetWindowSize( this->m_ConvergenceWindowSize ); - typedef IdentityTransform IdentityTransformType; - typename IdentityTransformType::Pointer identityTransform; - identityTransform = IdentityTransformType::New(); - IterationReporter reporter( this, 0, 1 ); while( this->m_CurrentIteration++ < this->m_NumberOfIterationsPerLevel[this->m_CurrentLevel] && !this->m_IsConverged ) { typename CompositeTransformType::Pointer fixedComposite = CompositeTransformType::New(); - fixedComposite->AddTransform( this->m_FixedInitialTransform ); + if ( fixedInitialTransform != ITK_NULLPTR ) + { + fixedComposite->AddTransform( fixedInitialTransform ); + } fixedComposite->AddTransform( this->m_FixedToMiddleTransform->GetInverseTransform() ); fixedComposite->FlattenTransformQueue(); fixedComposite->SetOnlyMostRecentTransformToOptimizeOn(); @@ -173,9 +173,9 @@ MeasureType movingMetricValue = 0.0; DisplacementFieldPointer fixedToMiddleSmoothUpdateField = this->ComputeUpdateField( - this->m_FixedSmoothImages, fixedComposite, this->m_MovingSmoothImages, movingComposite, NULL, movingMetricValue ); + this->m_FixedSmoothImages, fixedComposite, this->m_MovingSmoothImages, movingComposite, ITK_NULLPTR, movingMetricValue ); DisplacementFieldPointer movingToMiddleSmoothUpdateField = this->ComputeUpdateField( - this->m_MovingSmoothImages, movingComposite, this->m_FixedSmoothImages, fixedComposite, NULL, fixedMetricValue ); + this->m_MovingSmoothImages, movingComposite, this->m_FixedSmoothImages, fixedComposite, ITK_NULLPTR, fixedMetricValue ); if ( this->m_AverageMidPointGradients ) { @@ -406,7 +406,7 @@ { localNorm += vnl_math_sqr( vector[d] / spacing[d] ); } - localNorm = vcl_sqrt( localNorm ); + localNorm = std::sqrt( localNorm ); if( localNorm > maxNorm ) { @@ -550,6 +550,8 @@ SyNImageRegistrationMethod ::GenerateData() { + this->AllocateOutputs(); + for( this->m_CurrentLevel = 0; this->m_CurrentLevel < this->m_NumberOfLevels; this->m_CurrentLevel++ ) { this->InitializeRegistrationAtEachLevel( this->m_CurrentLevel ); @@ -580,9 +582,7 @@ this->m_OutputTransform->SetDisplacementField( composer->GetOutput() ); this->m_OutputTransform->SetInverseDisplacementField( inverseComposer->GetOutput() ); - DecoratedOutputTransformPointer transformDecorator = DecoratedOutputTransformType::New().GetPointer(); - transformDecorator->Set( this->m_OutputTransform ); - this->ProcessObject::SetNthOutput( 0, transformDecorator ); + this->GetTransformOutput()->Set(this->m_OutputTransform); } /* diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,13 +26,6 @@ namespace itk { -//Forward-declare these because of module dependency conflict. -//They will soon be moved to a different module, at which -// time this can be removed. -template -class ImageToData; -template -class Array1DToData; /** \class TimeVaryingBSplineVelocityFieldImageRegistrationMethod * \brief Interface method for the current registration framework diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -153,7 +153,7 @@ this->m_OutputTransform->SetVelocityFieldSize( sampledVelocityFieldSize ); this->m_OutputTransform->IntegrateVelocityField(); - typename TimeVaryingWeightedMaskImageType::Pointer timeVaryingFixedWeightedMaskImage = NULL; + typename TimeVaryingWeightedMaskImageType::Pointer timeVaryingFixedWeightedMaskImage = ITK_NULLPTR; if( fixedImageMask ) { timeVaryingFixedWeightedMaskImage = TimeVaryingWeightedMaskImageType::New(); @@ -444,7 +444,7 @@ const typename VirtualImageType::IndexType virtualDomainIndex = virtualDomainImage->GetLargestPossibleRegion().GetIndex(); const typename VirtualImageType::SizeType virtualDomainSize = virtualDomainImage->GetLargestPossibleRegion().GetSize(); - typename MaskImageType::ConstPointer maskImage = NULL; + typename MaskImageType::ConstPointer maskImage = ITK_NULLPTR; if( fixedImageMask ) { typename ImageMaskSpatialObjectType::Pointer imageMask = dynamic_cast( const_cast( fixedImageMask.GetPointer() ) ); @@ -559,7 +559,7 @@ TimeVaryingVelocityFieldControlPointLatticePointer updateControlPointLattice = bspliner->GetPhiLattice(); - TimeVaryingVelocityFieldPointer velocityField = NULL; + TimeVaryingVelocityFieldPointer velocityField = ITK_NULLPTR; if( this->GetDebug() ) { velocityField = bspliner->GetOutput(); @@ -581,6 +581,15 @@ if( this->m_CurrentConvergenceValue < this->m_ConvergenceThreshold ) { this->m_IsConverged = true; + } + + if( this->m_IsConverged || this->m_CurrentIteration >= this->m_NumberOfIterationsPerLevel[this->m_CurrentLevel] ) + { + + // Once we finish by convergence or exceeding number of iterations, + // we need to reset the transform by resetting the time bounds to the + // full range [0,1] and integrating the velocity field to get the + // forward and inverse displacement fields. this->m_OutputTransform->SetLowerTimeBound( 0 ); this->m_OutputTransform->SetUpperTimeBound( 1.0 ); @@ -637,6 +646,9 @@ TimeVaryingBSplineVelocityFieldImageRegistrationMethod ::GenerateData() { + + this->AllocateOutputs(); + for( this->m_CurrentLevel = 0; this->m_CurrentLevel < this->m_NumberOfLevels; this->m_CurrentLevel++ ) { this->InitializeRegistrationAtEachLevel( this->m_CurrentLevel ); @@ -652,9 +664,7 @@ this->m_CompositeTransform->AddTransform( this->m_OutputTransform ); } - DecoratedOutputTransformPointer transformDecorator = DecoratedOutputTransformType::New().GetPointer(); - transformDecorator->Set( this->m_OutputTransform ); - this->ProcessObject::SetNthOutput( 0, transformDecorator ); + this->GetTransformOutput()->Set(this->m_OutputTransform); } /* diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.h otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.h --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.h 2014-09-03 08:29:34.000000000 +0000 @@ -25,14 +25,6 @@ namespace itk { -// Forward-declare these because of module dependency conflict. -// They will soon be moved to a different module, at which -// time this can be removed. -template -class ImageToData; -template -class Array1DToData; - /** \class TimeVaryingVelocityFieldImageRegistrationMethodv4 * \brief Interface method for the current registration framework * using the time varying velocity field transform. diff -Nru otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx --- otb-4.0.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -334,6 +334,15 @@ if( this->m_CurrentConvergenceValue < this->m_ConvergenceThreshold ) { this->m_IsConverged = true; + } + + if( this->m_IsConverged || this->m_CurrentIteration >= this->m_NumberOfIterationsPerLevel[this->m_CurrentLevel] ) + { + + // Once we finish by convergence or exceeding number of iterations, + // we need to reset the transform by resetting the time bounds to the + // full range [0,1] and integrating the velocity field to get the + // forward and inverse displacement fields. this->m_OutputTransform->SetLowerTimeBound( 0 ); this->m_OutputTransform->SetUpperTimeBound( 1.0 ); @@ -390,6 +399,9 @@ TimeVaryingVelocityFieldImageRegistrationMethodv4 ::GenerateData() { + + this->AllocateOutputs(); + for( this->m_CurrentLevel = 0; this->m_CurrentLevel < this->m_NumberOfLevels; this->m_CurrentLevel++ ) { this->InitializeRegistrationAtEachLevel( this->m_CurrentLevel ); @@ -405,9 +417,7 @@ this->m_CompositeTransform->AddTransform( this->m_OutputTransform ); } - DecoratedOutputTransformPointer transformDecorator = DecoratedOutputTransformType::New().GetPointer(); - transformDecorator->Set( this->m_OutputTransform ); - this->ProcessObject::SetNthOutput( 0, transformDecorator ); + this->GetTransformOutput()->Set(this->m_OutputTransform); } /* diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/AnalyzeObjectMapIO.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/AnalyzeObjectMapIO.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/AnalyzeObjectMapIO.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/AnalyzeObjectMapIO.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,5 @@ +itk_fetch_module(AnalyzeObjectMapIO + "AnalyzeObjectMapIO plugin for ITK. From Insight Journal article with handle: http://hdl.handle.net/1926/593" + GIT_REPOSITORY https://github.com/InsightSoftwareConsortium/itkAnalyzeObjectMap.git + GIT_TAG ea14a5547de995c3f2c7f10948a3df2091de3034 + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/FDFImageIO.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/FDFImageIO.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/FDFImageIO.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/FDFImageIO.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,5 @@ +itk_fetch_module(FDFImageIO + "FDFImageIO plugin for ITK. Authors Gleen Pierce/Nick Tustison/Kent Williams" + GIT_REPOSITORY http://github.com/InsightSoftwareConsortium/itkFDFImageIO.git + GIT_TAG df4888e4f843c18605da1229c28553933994ddbd + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/IOSTL.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/IOSTL.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/IOSTL.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/IOSTL.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,7 @@ +# Contact: Luis Ibanez +itk_fetch_module(IOSTL + "This module contains classes for reading and writing QuadEdgeMeshes using + the STL (STereoLithography)file format. http://hdl.handle.net/10380/3452" + GIT_REPOSITORY https://github.com/InsightSoftwareConsortium/ITKSTLMeshIO.git + GIT_TAG 933359a5fd1bac792a3c0af5f4e05e291e153677 + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/LesionSizingToolkit.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/LesionSizingToolkit.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/LesionSizingToolkit.remote.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/LesionSizingToolkit.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,5 @@ itk_fetch_module(LesionSizingToolkit "Framework for determining the sizes of lesions in medical images." GIT_REPOSITORY http://public.kitware.com/LesionSizingToolkit.git - GIT_TAG c03168c0ff69386d7f59b00b46875273852068c7 + GIT_TAG fd9cfcef3bb4f7678bc50ecbe6ad51c6998cc3db ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/MGHIO.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/MGHIO.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/MGHIO.remote.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/MGHIO.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,5 @@ itk_fetch_module(MGHIO "MGHIO ImageIO plugin for ITK" GIT_REPOSITORY https://github.com/Slicer/itkMGHImageIO.git - GIT_TAG d43fc18d3023a8eba2bdc50cae8adf1f77160c67 + GIT_TAG f4e475c47f5c246b1ebf0529e052f65b73c7d13d ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/SCIFIO.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/SCIFIO.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/SCIFIO.remote.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/SCIFIO.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,5 @@ itk_fetch_module(SCIFIO "SCIFIO (Bioformats) ImageIO plugin for ITK" GIT_REPOSITORY https://github.com/scifio/scifio-imageio.git - GIT_TAG 3e76055918e70c8e97730d1e321ec59f15007f4c + GIT_TAG da6edd6bcefd8f107a3ed34ed663bfc69b3dc167 ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/SkullStrip.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/SkullStrip.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/SkullStrip.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/SkullStrip.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,5 @@ +itk_fetch_module(SkullStrip + "A class to perform automatic skull-stripping for neuroimage analysis." + GIT_REPOSITORY https://github.com/lorensen/skullStrip.git + GIT_TAG master + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/SmoothingRecursiveYvvGaussianFilter.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/SmoothingRecursiveYvvGaussianFilter.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/SmoothingRecursiveYvvGaussianFilter.remote.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/SmoothingRecursiveYvvGaussianFilter.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -2,5 +2,5 @@ itk_fetch_module(SmoothingRecursiveYvvGaussianFilter "GPU and CPU Young & Van Vliet Recursive Gaussian Smoothing Filter: http://hdl.handle.net/10380/3425" GIT_REPOSITORY https://github.com/Inria-Asclepios/SmoothingRecursiveYvvGaussianFilter - GIT_TAG d66cc15f97f98a6ecbf6e6ef8a5b52615ffb883e + GIT_TAG b3b6cab4848b4ad88b31384ada303ea2eeb663e4 ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/SphinxExamples.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/SphinxExamples.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/SphinxExamples.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/SphinxExamples.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,7 @@ +# Contact: Matt McCormick +itk_fetch_module(SphinxExamples + "This module builds the examples found at http://itk.org/ITKExamples/" + GIT_REPOSITORY http://itk.org/ITKExamples.git + # 2014-06-19 + GIT_TAG e256071ab7e813fc5c8c3875d591c8625e766fd1 + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/SplitComponents.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/SplitComponents.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/SplitComponents.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/SplitComponents.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,9 @@ +# Contact: Matt McCormick +itk_fetch_module(SplitComponents +"This module contains filter called +itk::SplitComponentsImageFilter. This filter generates component images from an +itk::Image of, for example, itk::Vector, itk::CovariantVector, or +itk::SymmetricSecondRankTensor. http://hdl.handle.net/10380/3230" + GIT_REPOSITORY https://github.com/thewtex/ITKSplitComponents/ + GIT_TAG 9747f758d63ba957923c268123b1124e4e2cb075 + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/VariationalRegistration.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/VariationalRegistration.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/VariationalRegistration.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/VariationalRegistration.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,9 @@ +# Insight Journal Handle: http://hdl.handle.net/10380/3460 +# Contact: Alexander Schmidt-Richberg +# Jan Ehrhardt +# Rene Werner +itk_fetch_module(VariationalRegistration + "A module to perform variational image registration. http://hdl.handle.net/10380/3460" + GIT_REPOSITORY https://github.com/VariationalRegistration/VariationalRegistration.git + GIT_TAG bd3ae2f8a37f76dc1700e7369e8edb03c31ff6dd + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Remote/WikiExamples.remote.cmake otb-4.2.0/Utilities/ITK/Modules/Remote/WikiExamples.remote.cmake --- otb-4.0.0/Utilities/ITK/Modules/Remote/WikiExamples.remote.cmake 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Remote/WikiExamples.remote.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,13 @@ +# +# ITK WikiExamples +# This remote module require a VTK build +# The following CMake variable must be set for the ITK build +# +# Check for requires cmake variables + +itk_fetch_module(WikiExamples + "A collection of examples that illustrate how to use ITK." + GIT_REPOSITORY https://github.com/InsightSoftwareConsortium/ITKWikiExamples.git +# June 17, 2014 + GIT_TAG 3d2213fb7475adbd1522f0e3a5e1747aa4dfe4f4 + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.h 2014-09-03 08:29:34.000000000 +0000 @@ -56,7 +56,7 @@ virtual void Mitosis(void); - virtual void Apoptosis(void); + virtual void Apoptosis(void) ITK_OVERRIDE; virtual void ReceptorsReading(void); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCell.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,8 @@ */ template< unsigned int NSpaceDimension > Cell< NSpaceDimension > -::Cell() +::Cell() : + m_Aggregate(ITK_NULLPTR) { m_Force.Fill(0.0f); @@ -64,8 +65,8 @@ // Broad compensation for Volume distribution among daugthers. // The type of root should depend on the Dimension... - siblingA->m_Radius = m_Radius / vcl_sqrt(2.0f); - siblingB->m_Radius = m_Radius / vcl_sqrt(2.0f); + siblingA->m_Radius = m_Radius / std::sqrt(2.0f); + siblingB->m_Radius = m_Radius / std::sqrt(2.0f); // Update Teleomeres siblingA->m_Generation = m_Generation + 1; @@ -85,8 +86,8 @@ siblingB->m_Genome = m_GenomeCopy; // Mark that the genome pointer is not owned by this cell anymore. - m_Genome = NULL; - m_GenomeCopy = NULL; + m_Genome = ITK_NULLPTR; + m_GenomeCopy = ITK_NULLPTR; // Register both daughter cells with the CellularAggregate. CellularAggregateBase *aggregate = this->GetCellularAggregate(); @@ -188,7 +189,7 @@ if ( m_ChemoAttractantLevel > ChemoAttractantLowThreshold && m_ChemoAttractantLevel < ChemoAttractantHighThreshold ) { - double factor = 1.0 / vcl_pow( m_Radius, (double)( NSpaceDimension ) ); + double factor = 1.0 / std::pow( m_Radius, (double)( NSpaceDimension ) ); m_Force += force; m_Pressure += force.GetNorm() * factor; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregateBase.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregateBase.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregateBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregateBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -66,7 +66,7 @@ CellularAggregateBase(); virtual ~CellularAggregateBase(); CellularAggregateBase(const Self &); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; }; } // end namespace bio } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.h 2014-09-03 08:29:34.000000000 +0000 @@ -128,9 +128,9 @@ virtual void Add(CellBase *cell, const VectorType & perturbation); - virtual void Add(CellBase *cellA, CellBase *cellB, double perturbationLength); + virtual void Add(CellBase *cellA, CellBase *cellB, double perturbationLength) ITK_OVERRIDE; - virtual void Remove(CellBase *cell); + virtual void Remove(CellBase *cell) ITK_OVERRIDE; virtual void GetVoronoi(IdentifierType cellId, VoronoiRegionAutoPointer &) const; @@ -141,7 +141,7 @@ virtual SubstratesVector & GetSubstrates(void); virtual SubstrateValueType GetSubstrateValue(IdentifierType cellId, - unsigned int substrateId) const; + unsigned int substrateId) const ITK_OVERRIDE; virtual void KillAll(void); @@ -151,7 +151,7 @@ CellularAggregate(const Self &); void operator=(const Self &); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; virtual void ComputeForces(void); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioCellularAggregate.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -453,7 +453,7 @@ { const IdentifierType cell2Id = ( *neighbor ); - BioCellType *cell2 = 0; + BioCellType *cell2 = ITK_NULLPTR; PointType position2; if ( !m_Mesh->GetPoint(cell2Id, &position2) ) @@ -506,7 +506,7 @@ PointsConstIterator point2It = beginPoints; - BioCellType *cell1 = 0; + BioCellType *cell1 = ITK_NULLPTR; IdentifierType cell1Id = point1It.Index(); m_Mesh->GetPointData(cell1Id, &cell1); @@ -627,7 +627,6 @@ SubstratePointer substrate = m_Substrates[substrateId]; typename SubstrateType::IndexType index; - typedef typename SubstrateType::IndexType::IndexValueType IndexValueType; substrate->TransformPhysicalPointToIndex(cellPosition, index); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioGenome.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioGenome.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioGenome.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/include/itkBioGenome.h 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ #include #include -#include "vcl_cmath.h" +#include namespace itk { @@ -65,7 +65,7 @@ * be used for gene network computations. */ static double Sigmoide(double threshold, double slant, double value) { - return vcl_atan( ( value - threshold ) / slant ) / 3.1416 + 0.5001; + return std::atan( ( value - threshold ) / slant ) / 3.1416 + 0.5001; } private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/src/itkBioCellBase.cxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/src/itkBioCellBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/BioCell/src/itkBioCellBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/BioCell/src/itkBioCellBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -64,8 +64,8 @@ CellBase ::CellBase() { - m_Genome = NULL; - m_GenomeCopy = NULL; + m_Genome = ITK_NULLPTR; + m_GenomeCopy = ITK_NULLPTR; m_Radius = DefaultRadius; m_Color = DefaultColor; @@ -107,9 +107,9 @@ ::~CellBase() { delete m_Genome; - m_Genome = NULL; + m_Genome = ITK_NULLPTR; delete m_GenomeCopy; - m_GenomeCopy = NULL; + m_GenomeCopy = ITK_NULLPTR; } /** @@ -132,9 +132,9 @@ ::Apoptosis(void) { delete m_Genome; - m_Genome = NULL; + m_Genome = ITK_NULLPTR; delete m_GenomeCopy; - m_GenomeCopy = NULL; + m_GenomeCopy = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -46,7 +46,7 @@ m_UserProvidedSmoothingFilter = false; this->SetNumberOfRequiredOutputs(2); m_NumberOfSmoothingIterations = 0; - m_SmoothingFilter = NULL; + m_SmoothingFilter = ITK_NULLPTR; PosteriorsImagePointer p = static_cast< PosteriorsImageType * >( this->MakeOutput(1).GetPointer() ); this->SetNthOutput( 1, p.GetPointer() ); @@ -174,7 +174,7 @@ const PriorsImageType *priorsImage = dynamic_cast< const PriorsImageType * >( this->GetInput(1) ); - if ( priorsImage == NULL ) + if ( priorsImage == ITK_NULLPTR ) { itkExceptionMacro("Second input type does not correspond to expected Priors Image Type"); } @@ -182,7 +182,7 @@ PosteriorsImageType *posteriorsImage = dynamic_cast< PosteriorsImageType * >( this->GetPosteriorImage() ); - if ( posteriorsImage == NULL ) + if ( posteriorsImage == ITK_NULLPTR ) { itkExceptionMacro("Second output type does not correspond to expected Posteriors Image Type"); } @@ -219,7 +219,7 @@ PosteriorsImageType *posteriorsImage = dynamic_cast< PosteriorsImageType * >( this->GetPosteriorImage() ); - if ( posteriorsImage == NULL ) + if ( posteriorsImage == ITK_NULLPTR ) { itkExceptionMacro("Second output type does not correspond to expected Posteriors Image Type"); } @@ -365,7 +365,7 @@ PosteriorsImageType *posteriorsImage = dynamic_cast< PosteriorsImageType * >( this->GetPosteriorImage() ); - if ( posteriorsImage == NULL ) + if ( posteriorsImage == ITK_NULLPTR ) { itkExceptionMacro("Second output type does not correspond to expected Posteriors Image Type"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierInitializationImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierInitializationImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierInitializationImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkBayesianClassifierInitializationImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,7 @@ m_UserSuppliesMembershipFunctions(false), m_NumberOfClasses(0) { - m_MembershipFunctionContainer = NULL; + m_MembershipFunctionContainer = ITK_NULLPTR; } // GenerateOutputInformation method. Here we force update on the entire input diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -150,7 +150,7 @@ protected: ClassifierBase(); ~ClassifierBase(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** The real classification logic implementaion. All the subclasses * of this class should implement this method. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkClassifierBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ ::ClassifierBase() { m_NumberOfClasses = 0; - m_DecisionRule = 0; + m_DecisionRule = ITK_NULLPTR; m_MembershipFunctions.resize(0); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageClassifierBase.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageClassifierBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageClassifierBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageClassifierBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -161,7 +161,6 @@ this->SetClassifiedImage(classifiedImage); - typedef typename TClassifiedImage::IndexType myIndex; typename TClassifiedImage::IndexType classifiedImageIndex; classifiedImageIndex.Fill(0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageGaussianModelEstimator.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageGaussianModelEstimator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageGaussianModelEstimator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageGaussianModelEstimator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ typename TTrainingImage > ImageGaussianModelEstimator< TInputImage, TMembershipFunction, TTrainingImage > ::ImageGaussianModelEstimator(void): - m_Covariance(NULL) + m_Covariance(ITK_NULLPTR) {} template< typename TInputImage, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageKmeansModelEstimator.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageKmeansModelEstimator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageKmeansModelEstimator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageKmeansModelEstimator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -615,12 +615,12 @@ double muloffset; double rand_num; - addoffset = m_OffsetAdd / vcl_pow(2.0, (double)scale); - muloffset = m_OffsetMultiply / vcl_pow(2.0, (double)scale); + addoffset = m_OffsetAdd / std::pow(2.0, (double)scale); + muloffset = m_OffsetMultiply / std::pow(2.0, (double)scale); for ( i = 0; i < m_VectorDimension; i++ ) { - srand( (unsigned)time(NULL) ); + srand( (unsigned)time(ITK_NULLPTR) ); rand_num = ( rand() ) / ( (double)RAND_MAX ); if ( oldCodeword[i] == 0.0 ) @@ -628,7 +628,7 @@ newCodeword[i] = addoffset * rand_num; } - else if ( vcl_fabs(oldCodeword[i]) < 0.9 * addoffset ) + else if ( std::fabs(oldCodeword[i]) < 0.9 * addoffset ) { newCodeword[i] = oldCodeword[i]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageModelEstimatorBase.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageModelEstimatorBase.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageModelEstimatorBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkImageModelEstimatorBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -131,9 +131,9 @@ protected: ImageModelEstimatorBase(); ~ImageModelEstimatorBase(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkScalarImageKmeansImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkScalarImageKmeansImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkScalarImageKmeansImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Classifiers/include/itkScalarImageKmeansImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -106,7 +106,6 @@ this->m_FinalMeans = estimator->GetParameters(); typedef typename InputImageType::RegionType RegionType; - typedef typename InputImageType::SizeType SizeType; // Now classify the samples DecisionRuleType::Pointer decisionRule = DecisionRuleType::New(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ InputPixelType value, neighborValue; OutputPixelType label, originalLabel, neighborLabel; - OutputPixelType maxLabel = NumericTraits< OutputPixelType >::Zero; + OutputPixelType maxLabel = NumericTraits< OutputPixelType >::ZeroValue(); const OutputPixelType maxPossibleLabel = NumericTraits< OutputPixelType >::max(); typename TOutputImage::Pointer output = this->GetOutput(); @@ -49,7 +49,7 @@ // Set up the boundary condition to be zero padded (used on output image) ConstantBoundaryCondition< TOutputImage > BC; - BC.SetConstant(NumericTraits< OutputPixelType >::Zero); + BC.SetConstant(NumericTraits< OutputPixelType >::ZeroValue()); // Neighborhood iterators. Let's use a shaped neighborhood so we can // restrict the access to face connected neighbors. These iterators @@ -119,10 +119,10 @@ oit.GoToBegin(); while ( !mit.IsAtEnd() ) { - if ( mit.Get() == NumericTraits< MaskPixelType >::Zero ) + if ( mit.Get() == NumericTraits< MaskPixelType >::ZeroValue() ) { // mark pixel as unlabeled - oit.Set(NumericTraits< OutputPixelType >::Zero); + oit.Set(NumericTraits< OutputPixelType >::ZeroValue()); } ++mit; @@ -146,7 +146,7 @@ originalLabel = label; // If the pixel is not background - if ( label != NumericTraits< OutputPixelType >::Zero ) + if ( label != NumericTraits< OutputPixelType >::ZeroValue() ) { // loop over the "previous" neighbors to find labels. this loop // may establish one or more new equivalence classes @@ -160,7 +160,7 @@ // if the previous pixel has a label, verify equivalence or // establish a new equivalence - if ( neighborLabel != NumericTraits< OutputPixelType >::Zero ) + if ( neighborLabel != NumericTraits< OutputPixelType >::ZeroValue() ) { // see if current pixel is connected to its neighbor neighborValue = isIt.Get(); @@ -228,7 +228,7 @@ { label = oit.Get(); // if pixel has a label, write out the final equivalence - if ( label != NumericTraits< OutputPixelType >::Zero ) + if ( label != NumericTraits< OutputPixelType >::ZeroValue() ) { oit.Set( eqTable->Lookup(label) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -407,9 +407,9 @@ ::AfterThreadedGenerateData() { m_NumberOfLabels.clear(); - m_Barrier = NULL; + m_Barrier = ITK_NULLPTR; m_LineMap.clear(); - m_Input = NULL; + m_Input = ITK_NULLPTR; } template< typename TInputImage, typename TOutputImage, typename TMaskImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -89,7 +89,8 @@ ImageToImageFilter); /** Typedef to describe the type of pixel. */ - typedef typename TInputImage::PixelType PixelType; + typedef typename TInputImage::PixelType PixelType; + typedef typename TOutputImage::PixelType OutputPixelType; /** The pixel type must support comparison operators. */ itkConceptMacro( PixelTypeComparable, ( Concept::Comparable< PixelType > ) ); @@ -215,8 +216,9 @@ unsigned int m_MinimumObjectSizeInPixels; // Binary threshold variables - PixelType m_OutsideValue; - PixelType m_InsideValue; + OutputPixelType m_OutsideValue; + OutputPixelType m_InsideValue; + PixelType m_LowerBoundary; PixelType m_UpperBoundary; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkThresholdMaximumConnectedComponentsImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -59,10 +59,10 @@ // Initialize values for the theshold filters // Default. Use ITK set macro "SetOutsideValue" to change - m_OutsideValue = static_cast< PixelType >( minLabel ); + m_OutsideValue = static_cast< OutputPixelType >( minLabel ); // Default. Use ITK set macro "SetInsideValue" to change - m_InsideValue = static_cast< PixelType >( maxLabel ); + m_InsideValue = static_cast< OutputPixelType >( maxLabel ); m_LowerBoundary = m_ThresholdValue; @@ -212,10 +212,10 @@ Superclass::PrintSelf(os, indent); os << indent << "InsideValue: " - << static_cast< typename NumericTraits< PixelType >::PrintType >( + << static_cast< typename NumericTraits< OutputPixelType >::PrintType >( m_InsideValue ) << std::endl; os << indent << "OutsideValue: " - << static_cast< typename NumericTraits< PixelType >::PrintType >( + << static_cast< typename NumericTraits< OutputPixelType >::PrintType >( m_OutsideValue ) << std::endl; os << indent << "Lower: " << static_cast< typename NumericTraits< PixelType >::PrintType >( diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/ConnectedComponents/include/itkVectorConnectedComponentImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -51,7 +51,7 @@ { public: SimilarVectorsFunctor() - { m_Threshold = itk::NumericTraits< typename TInput::ValueType >::Zero; } + { m_Threshold = itk::NumericTraits< typename TInput::ValueType >::ZeroValue(); } ~SimilarVectorsFunctor() {} @@ -72,7 +72,7 @@ bool operator()(const TInput & a, const TInput & b) const { typedef typename NumericTraits::RealType RealValueType; - RealValueType dotProduct = NumericTraits::Zero; + RealValueType dotProduct = NumericTraits::ZeroValue(); for ( unsigned int i = 0; i < NumericTraits::GetLength(a); ++i) { dotProduct += a[i]*b[i]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DBalloonForceFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DBalloonForceFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DBalloonForceFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DBalloonForceFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -72,9 +72,9 @@ coord[1] = static_cast< GradientIndexValueType >( data->pos[1] ); coord[2] = static_cast< GradientIndexValueType >( data->pos[2] ); - coord2[0] = static_cast< GradientIndexValueType >( vcl_ceil(data->pos[0]) ); - coord2[1] = static_cast< GradientIndexValueType >( vcl_ceil(data->pos[1]) ); - coord2[2] = static_cast< GradientIndexValueType >( vcl_ceil(data->pos[2]) ); + coord2[0] = static_cast< GradientIndexValueType >( std::ceil(data->pos[0]) ); + coord2[1] = static_cast< GradientIndexValueType >( std::ceil(data->pos[1]) ); + coord2[2] = static_cast< GradientIndexValueType >( std::ceil(data->pos[2]) ); tmp_co_1[0] = coord2[0]; tmp_co_1[1] = coord[1]; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -66,7 +66,7 @@ this->ProcessObject::SetNumberOfRequiredOutputs(1); this->ProcessObject::SetNthOutput( 0, output.GetPointer() ); - this->m_Data = NULL; + this->m_Data = ITK_NULLPTR; } template< typename TInputMesh, typename TOutputMesh > @@ -150,7 +150,7 @@ IdentifierType idx = pointItr.Index(); data = this->m_Data->GetElement(idx); delete data->neighborSet; - data->neighborSet = NULL; + data->neighborSet = ITK_NULLPTR; pointItr++; } @@ -294,10 +294,10 @@ double tmpNormalProd = dot_product( tmp.GetVnlVector(), data->normal.GetVnlVector() ); double sinphi = 2 *data->circleRadius *D *vnl_math_sgn(tmpNormalProd); - double phi = vcl_asin(sinphi); + double phi = std::asin(sinphi); data->phi = phi; - data->meanCurvature = vcl_abs(sinphi / data->circleRadius); + data->meanCurvature = std::abs(sinphi / data->circleRadius); tmp = data->pos - data->neighbors[0]; //compute the foot of p projection of p onto the triangle spanned by its @@ -374,7 +374,7 @@ eps1Diff = epsRef[0] - eps[0]; eps2Diff = epsRef[1] - eps[1]; eps3Diff = epsRef[2] - eps[2]; - // diffAbsSum = vcl_abs(eps1Diff)+vcl_abs(eps2Diff)+vcl_abs(eps3Diff); + // diffAbsSum = std::abs(eps1Diff)+std::abs(eps2Diff)+std::abs(eps3Diff); tangentForce.SetVnlVector(eps1Diff * ( data->neighbors[0] ).GetVnlVector() + eps2Diff * ( data->neighbors[1] ).GetVnlVector() @@ -423,9 +423,9 @@ coord[1] = static_cast< GradientIndexValueType >( data->pos[1] ); coord[2] = static_cast< GradientIndexValueType >( data->pos[2] ); - coord2[0] = static_cast< GradientIndexValueType >( vcl_ceil(data->pos[0]) ); - coord2[1] = static_cast< GradientIndexValueType >( vcl_ceil(data->pos[1]) ); - coord2[2] = static_cast< GradientIndexValueType >( vcl_ceil(data->pos[2]) ); + coord2[0] = static_cast< GradientIndexValueType >( std::ceil(data->pos[0]) ); + coord2[1] = static_cast< GradientIndexValueType >( std::ceil(data->pos[1]) ); + coord2[2] = static_cast< GradientIndexValueType >( std::ceil(data->pos[2]) ); tmp_co_1[0] = coord2[0]; tmp_co_1[1] = coord[1]; @@ -583,7 +583,7 @@ double r2 = r * r; double d2 = d * d; double r2Minusd2 = r2 - d2; - double tanPhi = vcl_tan(phi); + double tanPhi = std::tan(phi); double eps = 1.0; @@ -595,7 +595,7 @@ double tmpSqr = r2 + r2Minusd2 * tanPhi * tanPhi; if ( tmpSqr > 0 ) { - double denom = eps * ( vcl_sqrt(tmpSqr) + r ); + double denom = eps * ( std::sqrt(tmpSqr) + r ); if ( denom != 0 ) { L = ( r2Minusd2 * tanPhi ) / denom; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DGradientConstraintForceFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,7 @@ ::DeformableSimplexMesh3DGradientConstraintForceFilter() { m_Range = 1; - m_StartVoxel = NULL; + m_StartVoxel = ITK_NULLPTR; } template< typename TInputMesh, typename TOutputMesh > @@ -58,7 +58,7 @@ ::Clear() { delete m_StartVoxel; - m_StartVoxel = 0; + m_StartVoxel = ITK_NULLPTR; std::vector< ImageVoxel * >::iterator it; for ( it = m_Positive.begin(); it != m_Positive.end(); it++ ) { @@ -363,7 +363,7 @@ } else { - m_StartVoxel = 0; + m_StartVoxel = ITK_NULLPTR; } // now fun begins try to use all the above @@ -384,7 +384,7 @@ vec_for[2] = gradient3[2]; // check magnitude - mag = vcl_sqrt( dot_product( vec_for.GetVnlVector(), vec_for.GetVnlVector() ) ); + mag = std::sqrt( dot_product( vec_for.GetVnlVector(), vec_for.GetVnlVector() ) ); if ( mag > max ) { max = mag; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMRegionGrowImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,8 @@ m_NumberOfRegions(0), m_InternalLambda(0), m_InitialNumberOfRegions(0), - m_BorderCandidate(NULL), + m_TotalBorderLength(0.0), + m_BorderCandidate(ITK_NULLPTR), m_InitialRegionArea(0) { m_InitialRegionMean.set_size(InputImageVectorDimension); @@ -702,8 +703,8 @@ // Remove any duplicate borders found during SpliceRegionBorders: // lambda = -1.0, pRegion1 and pRegion2 = NULL - while ( m_BorderCandidate->m_Pointer->GetRegion1() == NULL - || m_BorderCandidate->m_Pointer->GetRegion2() == NULL ) + while ( m_BorderCandidate->m_Pointer->GetRegion1() == ITK_NULLPTR + || m_BorderCandidate->m_Pointer->GetRegion2() == ITK_NULLPTR ) { m_BordersDynamicPointer.erase(m_BordersDynamicPointer.end() - 1); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationBorder.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationBorder.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationBorder.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationBorder.h 2014-09-03 08:29:34.000000000 +0000 @@ -179,7 +179,7 @@ ~KLMSegmentationBorder(); /** Print self identity */ - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: KLMSegmentationBorder(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationRegion.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationRegion.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationRegion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkKLMSegmentationRegion.h 2014-09-03 08:29:34.000000000 +0000 @@ -215,7 +215,7 @@ protected: KLMSegmentationRegion(); ~KLMSegmentationRegion(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: KLMSegmentationRegion(const Self &); // purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationBorder.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationBorder.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationBorder.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationBorder.h 2014-09-03 08:29:34.000000000 +0000 @@ -70,7 +70,7 @@ protected: SegmentationBorder(); ~SegmentationBorder(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: SegmentationBorder(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationRegion.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationRegion.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationRegion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/include/itkSegmentationRegion.h 2014-09-03 08:29:34.000000000 +0000 @@ -78,7 +78,7 @@ protected: SegmentationRegion(); ~SegmentationRegion(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: SegmentationRegion(const Self &); //purposely not implemented diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationBorder.cxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationBorder.cxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationBorder.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationBorder.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -23,8 +23,8 @@ ::KLMSegmentationBorder(void) { m_Lambda = 0.0; - m_Region1 = 0; - m_Region2 = 0; + m_Region1 = ITK_NULLPTR; + m_Region2 = ITK_NULLPTR; } KLMSegmentationBorder diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationRegion.cxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationRegion.cxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationRegion.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/KLMRegionGrowing/src/itkKLMSegmentationRegion.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -97,7 +97,7 @@ KLMSegmentationRegion ::DeleteRegionBorder(KLMSegmentationBorder *pBorderCandidate) { - if ( pBorderCandidate == NULL ) + if ( pBorderCandidate == ITK_NULLPTR ) { itkExceptionMacro(<< "Null pointer to segmentation region border"); } @@ -130,7 +130,7 @@ KLMSegmentationRegion ::PushBackRegionBorder(KLMSegmentationBorder *pBorderCandidate) { - if ( pBorderCandidate == NULL ) + if ( pBorderCandidate == ITK_NULLPTR ) { itkExceptionMacro(<< "Null pointer to segmentation region border"); } @@ -141,7 +141,7 @@ KLMSegmentationRegion ::PushFrontRegionBorder(KLMSegmentationBorder *pBorderCandidate) { - if ( pBorderCandidate == NULL ) + if ( pBorderCandidate == ITK_NULLPTR ) { itkExceptionMacro(<< "Null pointer to segmentation region border"); } @@ -153,7 +153,7 @@ ::InsertRegionBorder(KLMSegmentationBorder *pBorderCandidate) { // Ensure that the border candidate is not a null pointer - if ( pBorderCandidate == NULL ) + if ( pBorderCandidate == ITK_NULLPTR ) { itkExceptionMacro(<< "Null pointer to segmentation region border"); } @@ -209,7 +209,7 @@ KLMSegmentationBorder *pBorderCandidate) { // Ensure that the border candidate is not a null pointer - if ( pBorderCandidate == NULL ) + if ( pBorderCandidate == ITK_NULLPTR ) { itkExceptionMacro(<< "Null pointer to segmentation region border"); } @@ -379,8 +379,8 @@ } // end else // Nullify the duplicate border so it can be identified and removed. - ( *thatRegionBordersIt )->SetRegion1(NULL); - ( *thatRegionBordersIt )->SetRegion2(NULL); + ( *thatRegionBordersIt )->SetRegion1(ITK_NULLPTR); + ( *thatRegionBordersIt )->SetRegion2(ITK_NULLPTR); ( *thatRegionBordersIt )->SetLambda(-1.0); thisRegionBordersIt++; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -103,8 +103,7 @@ * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -44,7 +44,6 @@ void BinaryMedianImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkLabelVotingImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkLabelVotingImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkLabelVotingImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkLabelVotingImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -21,6 +21,7 @@ #include "itkLabelVotingImageFilter.h" #include "itkImageRegionIterator.h" +#include "itkProgressReporter.h" #include "vnl/vnl_math.h" @@ -104,8 +105,10 @@ void LabelVotingImageFilter< TInputImage, TOutputImage > ::ThreadedGenerateData( const OutputImageRegionType & outputRegionForThread, - ThreadIdType itkNotUsed(threadId) ) + ThreadIdType threadId ) { + ProgressReporter progress( this, threadId, outputRegionForThread.GetNumberOfPixels() ); + typedef ImageRegionConstIterator< TInputImage > IteratorType; typedef ImageRegionIterator< TOutputImage > OutIteratorType; @@ -159,6 +162,7 @@ } } } + progress.CompletedPixel(); } delete[] it; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkMultiLabelSTAPLEImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -27,6 +27,7 @@ #include "vector" #include "itkArray.h" #include "itkArray2D.h" +#include "itkNumericTraits.h" namespace itk { @@ -256,12 +257,15 @@ } protected: - MultiLabelSTAPLEImageFilter() + MultiLabelSTAPLEImageFilter() : + m_TotalLabelCount(0), + m_LabelForUndecidedPixels(NumericTraits::Zero), + m_HasLabelForUndecidedPixels(false), + m_HasPriorProbabilities(false), + m_HasMaximumNumberOfIterations(false), + m_MaximumNumberOfIterations(0), + m_TerminationUpdateThreshold(1e-5) { - this->m_HasLabelForUndecidedPixels = false; - this->m_HasPriorProbabilities = false; - this->m_HasMaximumNumberOfIterations = false; - this->m_TerminationUpdateThreshold = 1e-5; } virtual ~MultiLabelSTAPLEImageFilter() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -103,8 +103,7 @@ * in order to inform the pipeline execution model. * * \sa ImageToImageFilter::GenerateInputRequestedRegion() */ - virtual void GenerateInputRequestedRegion() - throw( InvalidRequestedRegionError ); + virtual void GenerateInputRequestedRegion(); #ifdef ITK_USE_CONCEPT_CHECKING // Begin concept checking diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LabelVoting/include/itkVotingBinaryImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,7 +45,6 @@ void VotingBinaryImageFilter< TInputImage, TOutputImage > ::GenerateInputRequestedRegion() -throw ( InvalidRequestedRegionError ) { // call the superclass' implementation of this method Superclass::GenerateInputRequestedRegion(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkBinaryMaskToNarrowBandPointSetFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkBinaryMaskToNarrowBandPointSetFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkBinaryMaskToNarrowBandPointSetFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkBinaryMaskToNarrowBandPointSetFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -130,7 +130,7 @@ { const NodeType & node = nodeItr.Value(); const float distance = node.GetValue(); - if ( vcl_fabs(distance) < m_BandWidth ) + if ( std::fabs(distance) < m_BandWidth ) { image->TransformIndexToPhysicalPoint(node.GetIndex(), point); points->push_back(point); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCollidingFrontsImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,8 +29,8 @@ CollidingFrontsImageFilter< TInputImage, TOutputImage > ::CollidingFrontsImageFilter() { - m_SeedPoints1 = NULL; - m_SeedPoints2 = NULL; + m_SeedPoints1 = ITK_NULLPTR; + m_SeedPoints2 = ITK_NULLPTR; m_StopOnTargets = false; m_ApplyConnectivity = true; m_NegativeEpsilon = -1E-6; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetFunction.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -113,15 +113,15 @@ virtual void Initialize(const RadiusType & r); protected: - CurvesLevelSetFunction() + CurvesLevelSetFunction() : + m_Center(0), + m_DerivativeSigma(1.0) { //Curvature term is the minimal curvature. this->UseMinimalCurvatureOn(); this->SetAdvectionWeight(NumericTraits< ScalarValueType >::One); this->SetPropagationWeight(NumericTraits< ScalarValueType >::One); this->SetCurvatureWeight(NumericTraits< ScalarValueType >::One); - - m_DerivativeSigma = 1.0; } virtual ~CurvesLevelSetFunction() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkCurvesLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -45,8 +45,7 @@ ::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); - os << indent << "CurvesFunction: \n"; - m_CurvesFunction->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( CurvesFunction ); } template< typename TInputImage, typename TFeatureImage, typename TOutputType > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkExtensionVelocitiesImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkExtensionVelocitiesImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkExtensionVelocitiesImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkExtensionVelocitiesImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -74,7 +74,7 @@ { if ( idx >= VAuxDimension || this->GetNumberOfIndexedInputs() < idx + 2 ) { - return NULL; + return ITK_NULLPTR; } return dynamic_cast< AuxImageType * >( @@ -92,7 +92,7 @@ { if ( idx >= VAuxDimension || this->GetNumberOfIndexedOutputs() < idx + 2 ) { - return NULL; + return ITK_NULLPTR; } return itkDynamicCastInDebugMode< AuxImageType * >(this->ProcessObject::GetOutput(idx + 1) ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkGeodesicActiveContourShapePriorLevelSetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkGeodesicActiveContourShapePriorLevelSetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkGeodesicActiveContourShapePriorLevelSetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkGeodesicActiveContourShapePriorLevelSetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -20,6 +20,7 @@ #include "itkGeodesicActiveContourShapePriorLevelSetFunction.h" #include "itkGradientRecursiveGaussianImageFilter.h" +#include "itkGradientImageFilter.h" #include "itkImageAlgorithm.h" namespace itk @@ -46,18 +47,44 @@ void GeodesicActiveContourShapePriorLevelSetFunction< TImageType, TFeatureImageType > ::CalculateAdvectionImage() { - /* compoute the gradient of the feature image. */ - typedef GradientRecursiveGaussianImageFilter< FeatureImageType, VectorImageType > - DerivativeFilterType; - - typename DerivativeFilterType::Pointer derivative = DerivativeFilterType::New(); - derivative->SetInput( this->GetFeatureImage() ); - derivative->SetSigma(m_DerivativeSigma); - derivative->Update(); + + typename VectorImageType::Pointer gradientImage; + + if ( m_DerivativeSigma != NumericTraits< float >::Zero ) + { + /* compute the gradient of the feature image. */ + typedef GradientRecursiveGaussianImageFilter< FeatureImageType, VectorImageType > + DerivativeFilterType; + + typename DerivativeFilterType::Pointer derivative = DerivativeFilterType::New(); + derivative->SetInput( this->GetFeatureImage() ); + derivative->SetSigma( m_DerivativeSigma ); + derivative->Update(); + + gradientImage = derivative->GetOutput(); + } + else + { + typedef GradientImageFilter< FeatureImageType > DerivativeFilterType; + + typename DerivativeFilterType::Pointer derivative = DerivativeFilterType::New(); + derivative->SetInput( this->GetFeatureImage() ); + derivative->SetUseImageSpacingOn(); + derivative->Update(); + + typedef typename DerivativeFilterType::OutputImageType DerivativeOutputImageType; + typedef VectorCastImageFilter< DerivativeOutputImageType, VectorImageType > GradientCasterType; + + typename GradientCasterType::Pointer caster = GradientCasterType::New(); + caster->SetInput( derivative->GetOutput() ); + caster->Update(); + + gradientImage = caster->GetOutput(); + } /* copy negative gradient into the advection image. */ ImageRegionIterator< VectorImageType > - dit( derivative->GetOutput(), this->GetFeatureImage()->GetRequestedRegion() ); + dit( gradientImage, this->GetFeatureImage()->GetRequestedRegion() ); ImageRegionIterator< VectorImageType > ait( this->GetAdvectionImage(), this->GetFeatureImage()->GetRequestedRegion() ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkImplicitManifoldNormalVectorFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,7 +28,7 @@ ::ImplicitManifoldNormalVectorFilter() { this->SetPrecomputeFlag(true); - m_NormalFunction = 0; + m_NormalFunction = ITK_NULLPTR; // set defaults for parameters m_IsoLevelLow = NumericTraits< NodeValueType >::Zero; @@ -113,7 +113,7 @@ } else { - output->SetPixel(index, 0); + output->SetPixel(index, ITK_NULLPTR); } ++it; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -290,13 +290,15 @@ } protected: - LevelSetFunction() + LevelSetFunction() : + m_Center(0), + m_UseMinimalCurvature(false), + m_EpsilonMagnitude(static_cast< ScalarValueType >( 1.0e-5 )), + m_AdvectionWeight(NumericTraits< ScalarValueType >::Zero), + m_PropagationWeight(NumericTraits< ScalarValueType >::Zero), + m_CurvatureWeight(NumericTraits< ScalarValueType >::Zero), + m_LaplacianSmoothingWeight(NumericTraits< ScalarValueType >::Zero) { - m_EpsilonMagnitude = static_cast< ScalarValueType >( 1.0e-5 ); - m_AdvectionWeight = m_PropagationWeight = - m_CurvatureWeight = m_LaplacianSmoothingWeight = - NumericTraits< ScalarValueType >::Zero; - m_UseMinimalCurvature = false; } virtual ~LevelSetFunction() {} diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -57,7 +57,7 @@ const FloatOffsetType & itkNotUsed(offset), GlobalDataStruct *gd) { unsigned int i, j, n; - ScalarValueType gradMag = vcl_sqrt(gd->m_GradMagSqr); + ScalarValueType gradMag = std::sqrt(gd->m_GradMagSqr); ScalarValueType Pgrad[ImageDimension][ImageDimension]; ScalarValueType tmp_matrix[ImageDimension][ImageDimension]; const ScalarValueType ZERO = NumericTraits< ScalarValueType >::Zero; @@ -150,7 +150,7 @@ { discriminant = 0.0; } - discriminant = vcl_sqrt(discriminant); + discriminant = std::sqrt(discriminant); return ( mean_curve - discriminant ); } @@ -434,7 +434,7 @@ vnl_math_max( gd->m_MaxPropagationChange, vnl_math_abs(propagation_term) ); - propagation_term *= vcl_sqrt(propagation_gradient); + propagation_term *= std::sqrt(propagation_gradient); } else { propagation_term = ZERO; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetFunctionWithRefitTerm.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -166,9 +166,9 @@ NodeType * targetnode = m_SparseTargetImage->GetPixel (idx); ScalarValueType refitterm, cv, tcv; - if ( ( targetnode == 0 ) || ( targetnode->m_CurvatureFlag == false ) ) + if ( ( targetnode == ITK_NULLPTR ) || ( targetnode->m_CurvatureFlag == false ) ) { - if ( targetnode == 0 ) + if ( targetnode == ITK_NULLPTR ) { itkExceptionMacro(<< "required node has null pointer\n"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.h 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,7 @@ protected: LevelSetNeighborhoodExtractor(); ~LevelSetNeighborhoodExtractor(){} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; typename LevelSetImageType::PixelType GetLargeValue() const { return m_LargeValue; } @@ -145,7 +145,7 @@ virtual double CalculateDistance(IndexType & index); - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; bool GetLastPointIsInside() const { return m_LastPointIsInside; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetNeighborhoodExtractor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,19 +32,19 @@ */ template< typename TLevelSet > LevelSetNeighborhoodExtractor< TLevelSet > -::LevelSetNeighborhoodExtractor() +::LevelSetNeighborhoodExtractor() : + m_LevelSetValue(0.0), + m_InsidePoints(ITK_NULLPTR), + m_OutsidePoints(ITK_NULLPTR), + m_InputLevelSet(ITK_NULLPTR), + m_NarrowBanding(false), + m_NarrowBandwidth(12.0), + m_InputNarrowBand(ITK_NULLPTR), + m_LargeValue(NumericTraits< PixelType >::max()), + m_LastPointIsInside(false) { - m_LevelSetValue = 0.0; - m_InsidePoints = 0; - m_OutsidePoints = 0; - m_InputLevelSet = 0; - - m_LargeValue = NumericTraits< PixelType >::max(); m_NodesUsed.resize(SetDimension); - m_NarrowBanding = false; - m_NarrowBandwidth = 12.0; - m_InputNarrowBand = 0; for ( unsigned int i = 0; i < SetDimension; ++i ) { m_ImageSize[i] = 0; @@ -320,7 +320,7 @@ return m_LargeValue; } - distance = vcl_sqrt(1.0 / distance); + distance = std::sqrt(1.0 / distance); centerNode.SetValue(distance); if ( inside ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.h 2014-09-03 08:29:34.000000000 +0000 @@ -107,7 +107,7 @@ { if ( idx >= VAuxDimension ) { - return NULL; + return ITK_NULLPTR; } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkLevelSetVelocityNeighborhoodExtractor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -31,11 +31,11 @@ LevelSetVelocityNeighborhoodExtractor< TLevelSet, TAuxValue, VAuxDimension > ::LevelSetVelocityNeighborhoodExtractor() { - m_AuxInsideValues = 0; - m_AuxOutsideValues = 0; + m_AuxInsideValues = ITK_NULLPTR; + m_AuxOutsideValues = ITK_NULLPTR; for ( unsigned int i = 0; i < VAuxDimension; ++i ) { - m_AuxImage[i] = 0; + m_AuxImage[i] = ITK_NULLPTR; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNarrowBandLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNarrowBandLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNarrowBandLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNarrowBandLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,7 +40,7 @@ this->SetNumberOfRequiredInputs(2); //this->SetNarrowBandInnerRadius(); //this->SetNarrowBandTotalRadius(); - m_SegmentationFunction = 0; + m_SegmentationFunction = ITK_NULLPTR; m_IsoFilter = IsoFilterType::New(); m_ChamferFilter = ChamferFilterType::New(); @@ -77,7 +77,7 @@ NarrowBandLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType, TOutputImage > ::GenerateData() { - if ( m_SegmentationFunction == 0 ) + if ( m_SegmentationFunction == ITK_NULLPTR ) { itkExceptionMacro("No finite difference function was specified."); } // A positive speed value causes surface expansion, the opposite of the @@ -137,8 +137,8 @@ m_ChamferFilter->Update(); this->GraftOutput( m_ChamferFilter->GetOutput() ); - m_IsoFilter->SetInput(NULL); - m_ChamferFilter->SetInput(NULL); + m_IsoFilter->SetInput(ITK_NULLPTR); + m_ChamferFilter->SetInput(ITK_NULLPTR); } } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.h 2014-09-03 08:29:34.000000000 +0000 @@ -143,7 +143,7 @@ { // the slow exp function could be replaced with a lookup table if ( v <= 0.0 ) { return NumericTraits< NodeValueType >::One; } - else { return static_cast< NodeValueType >( vcl_exp(m_FluxStopConstant * v) ); } + else { return static_cast< NodeValueType >( std::exp(m_FluxStopConstant * v) ); } } private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorDiffusionFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,8 +38,8 @@ this->SetRadius(r); this->SetTimeStep( static_cast< TimeStepType >( 0.5 / ImageDimension ) ); m_NormalProcessType = 0; - m_ConductanceParameter = NumericTraits< NodeValueType >::Zero; - m_FluxStopConstant = NumericTraits< NodeValueType >::Zero; + m_ConductanceParameter = NumericTraits< NodeValueType >::ZeroValue(); + m_FluxStopConstant = NumericTraits< NodeValueType >::ZeroValue(); } template< typename TSparseImageType > @@ -84,11 +84,11 @@ for ( i = 0; i < ImageDimension; i++ ) // flux offset axis { PreviousNode = it.GetPrevious (i); - if ( PreviousNode == 0 ) + if ( PreviousNode == ITK_NULLPTR ) { for ( j = 0; j < ImageDimension; j++ ) { - CenterNode->m_Flux[i][j] = NumericTraits< NodeValueType >::Zero; + CenterNode->m_Flux[i][j] = NumericTraits< NodeValueType >::ZeroValue(); } } else @@ -100,7 +100,7 @@ { // compute differences (j-axis) in line with center pixel OtherNode = it.GetPrevious (j); - if ( OtherNode == 0 ) + if ( OtherNode == ITK_NULLPTR ) { NegativeSidePixel[0] = CenterPixel; } @@ -109,7 +109,7 @@ NegativeSidePixel[0] = OtherNode->m_Data; } OtherNode = it.GetNext (j); - if ( OtherNode == 0 ) + if ( OtherNode == ITK_NULLPTR ) { PositiveSidePixel[0] = CenterPixel; } @@ -120,7 +120,7 @@ // compute derivative (j-axis) offset from center pixel on i-axis OtherNode = it.GetPixel (center - stride[i] - stride[j]); - if ( OtherNode == 0 ) + if ( OtherNode == ITK_NULLPTR ) { NegativeSidePixel[1] = PreviousPixel; } @@ -129,7 +129,7 @@ NegativeSidePixel[1] = OtherNode->m_Data; } OtherNode = it.GetPixel (center - stride[i] + stride[j]); - if ( OtherNode == 0 ) + if ( OtherNode == ITK_NULLPTR ) { PositiveSidePixel[1] = PreviousPixel; } @@ -151,7 +151,7 @@ // now compute the intrinsic derivative for ( j = 0; j < ImageDimension; j++ ) // component axis { - DotProduct = NumericTraits< NodeValueType >::Zero; + DotProduct = NumericTraits< NodeValueType >::ZeroValue(); for ( k = 0; k < ImageDimension; k++ ) // derivative axis { DotProduct += ( gradient[k][j] * CenterNode->m_ManifoldNormal[i][k] ); @@ -190,11 +190,11 @@ const NeighborhoodScalesType neighborhoodScales = this->ComputeNeighborhoodScales(); - change = NumericTraits< NormalVectorType >::Zero; + change = NumericTraits< NormalVectorType >::ZeroValue(); for ( i = 0; i < ImageDimension; i++ ) // flux offset axis { NextNode = it.GetNext (i); - if ( NextNode == 0 ) + if ( NextNode == ITK_NULLPTR ) { change -= CenterNode->m_Flux[i] * neighborhoodScales[i]; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorFunctionBase.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorFunctionBase.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorFunctionBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkNormalVectorFunctionBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ typedef typename NodeType::NodeDataType NormalVectorType; /** Globaldata methods are not needed in this class. */ - virtual void * GetGlobalDataPointer() const { return 0; } + virtual void * GetGlobalDataPointer() const { return ITK_NULLPTR; } virtual void ReleaseGlobalDataPointer(void *) const {} /** For the global time step, we return the time step parameter. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -128,19 +128,24 @@ template< typename TInputImage, typename TOutputImage > ParallelSparseFieldLevelSetImageFilter< TInputImage, TOutputImage > -::ParallelSparseFieldLevelSetImageFilter() +::ParallelSparseFieldLevelSetImageFilter() : + m_ConstantGradientValue(1.0), + m_NumberOfLayers(ImageDimension), + m_IsoSurfaceValue(m_ValueZero), + m_NumOfThreads(0), + m_SplitAxis(0), + m_ZSize(0), + m_BoundaryChanged(false), + m_Boundary(ITK_NULLPTR), + m_GlobalZHistogram(ITK_NULLPTR), + m_MapZToThreadNumber(ITK_NULLPTR), + m_ZCumulativeFrequency(ITK_NULLPTR), + m_Data(ITK_NULLPTR), + m_Stop(false), + m_InterpolateSurfaceLocation(true), + m_BoundsCheckingActive(false) { - m_IsoSurfaceValue = m_ValueZero; - m_NumberOfLayers = ImageDimension; this->SetRMSChange( static_cast< double >( m_ValueOne ) ); - m_InterpolateSurfaceLocation = true; - m_BoundsCheckingActive = false; - m_ConstantGradientValue = 1.0; - m_GlobalZHistogram = 0; - m_ZCumulativeFrequency = 0; - m_MapZToThreadNumber = 0; - m_Boundary = 0; - m_Data = 0; } template< typename TInputImage, typename TOutputImage > @@ -545,7 +550,7 @@ length += dx_backward * dx_backward; } } - length = vcl_sqrt(length) + MIN_NORM; + length = std::sqrt(length) + MIN_NORM; distance = shiftedIt.GetCenterPixel() / length; m_OutputImage->SetPixel( activeIt->m_Index, @@ -716,7 +721,7 @@ } // deallocate the shifted-image - m_ShiftedImage = 0; + m_ShiftedImage = ITK_NULLPTR; } template< typename TInputImage, typename TOutputImage > @@ -974,16 +979,16 @@ // Delete data structures used for load distribution and balancing. delete[] m_GlobalZHistogram; - m_GlobalZHistogram = 0; + m_GlobalZHistogram = ITK_NULLPTR; delete[] m_ZCumulativeFrequency; - m_ZCumulativeFrequency = 0; + m_ZCumulativeFrequency = ITK_NULLPTR; delete[] m_MapZToThreadNumber; - m_MapZToThreadNumber = 0; + m_MapZToThreadNumber = ITK_NULLPTR; delete[] m_Boundary; - m_Boundary = 0; + m_Boundary = ITK_NULLPTR; // Deallocate the status image. - m_StatusImage = 0; + m_StatusImage = ITK_NULLPTR; // Remove the barrier from the system. // m_Barrier->Remove (); @@ -994,7 +999,7 @@ for ( i = 0; i < 2 * static_cast< unsigned int >( m_NumberOfLayers ) + 1; i++ ) { // return all the nodes in layer i to the main node pool - LayerNodeType * nodePtr = 0; + LayerNodeType * nodePtr = ITK_NULLPTR; LayerPointerType layerPtr = m_Layers[i]; while ( !layerPtr->Empty() ) { @@ -1010,7 +1015,7 @@ m_Layers.clear(); } - if ( m_Data != 0 ) + if ( m_Data != ITK_NULLPTR ) { // Deallocate the thread local data structures. for ( ThreadIdType ThreadId = 0; ThreadId < m_NumOfThreads; ThreadId++ ) @@ -1019,10 +1024,10 @@ delete[] m_Data[ThreadId].m_ZHistogram; - if ( m_Data[ThreadId].globalData != 0 ) + if ( m_Data[ThreadId].globalData != ITK_NULLPTR ) { this->GetDifferenceFunction()->ReleaseGlobalDataPointer (m_Data[ThreadId].globalData); - m_Data[ThreadId].globalData = 0; + m_Data[ThreadId].globalData = ITK_NULLPTR; } // 1. delete nodes on the thread layers @@ -1102,7 +1107,7 @@ delete[] m_Data; } // if m_data != 0 - m_Data = 0; + m_Data = ITK_NULLPTR; } template< typename TInputImage, typename TOutputImage > @@ -1197,13 +1202,13 @@ if ( ThreadId == 0 ) { - str->Filter->m_StatusImage = 0; + str->Filter->m_StatusImage = ITK_NULLPTR; str->Filter->m_StatusImage = str->Filter->m_StatusImageTemp; - str->Filter->m_StatusImageTemp = 0; + str->Filter->m_StatusImageTemp = ITK_NULLPTR; - str->Filter->m_OutputImage = 0; + str->Filter->m_OutputImage = ITK_NULLPTR; str->Filter->m_OutputImage = str->Filter->m_OutputImageTemp; - str->Filter->m_OutputImageTemp = 0; + str->Filter->m_OutputImageTemp = ITK_NULLPTR; // str->Filter->GraftOutput(str->Filter->m_OutputImage); } @@ -1246,7 +1251,7 @@ unsigned int count = str->Filter->m_Data[0].m_Count; if ( count != 0 ) { - str->Filter->SetRMSChange( static_cast< double >( vcl_sqrt( + str->Filter->SetRMSChange( static_cast< double >( std::sqrt( ( static_cast< float >( str->Filter->GetRMSChange() ) ) / count) ) ); } @@ -1276,7 +1281,7 @@ } if ( count != 0 ) { - str->Filter->SetRMSChange( static_cast< double >( vcl_sqrt( ( static_cast< float >( str->Filter-> + str->Filter->SetRMSChange( static_cast< double >( std::sqrt( ( static_cast< float >( str->Filter-> m_RMSChange ) ) / count ) ) ); } @@ -2665,7 +2670,7 @@ for ( ThreadId = 0; ThreadId < m_NumOfThreads; ThreadId++ ) { os << indent << "ThreadId: " << ThreadId << std::endl; - if ( m_Data != 0 ) + if ( m_Data != ITK_NULLPTR ) { for ( i = 0; i < m_Data[ThreadId].m_Layers.size(); i++ ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,8 +39,8 @@ m_NarrowBanding = false; m_InputNarrowBandwidth = 12.0; m_OutputNarrowBandwidth = 12.0; - m_InputNarrowBand = NULL; - m_OutputNarrowBand = NULL; + m_InputNarrowBand = ITK_NULLPTR; + m_OutputNarrowBand = ITK_NULLPTR; } /* diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSegmentationLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -39,7 +39,7 @@ { this->SetNumberOfRequiredInputs(2); this->SetNumberOfLayers(TInputImage::ImageDimension); - m_SegmentationFunction = 0; + m_SegmentationFunction = ITK_NULLPTR; m_AutoGenerateSpeedAdvection = true; this->SetIsoSurfaceValue(NumericTraits< ValueType >::Zero); @@ -73,7 +73,7 @@ SegmentationLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType > ::GenerateData() { - if ( m_SegmentationFunction == 0 ) + if ( m_SegmentationFunction == ITK_NULLPTR ) { itkExceptionMacro("No finite difference function was specified."); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapeDetectionLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -42,8 +42,7 @@ ::PrintSelf(std::ostream & os, Indent indent) const { Superclass::PrintSelf(os, indent); - os << indent << "ShapeDetectionFunction: " << std::endl; - m_ShapeDetectionFunction.GetPointer()->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( ShapeDetectionFunction ); } template< typename TInputImage, typename TFeatureImage, typename TOutputType > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -106,15 +106,15 @@ /** This method returns the value of the cost function corresponding * to the specified parameters. */ - virtual MeasureType GetValue(const ParametersType & parameters) const; + virtual MeasureType GetValue(const ParametersType & parameters) const ITK_OVERRIDE; /** This method returns the derivative of the cost function corresponding * to the specified parameters. */ - virtual void GetDerivative(const ParametersType &, DerivativeType &) const + virtual void GetDerivative(const ParametersType &, DerivativeType &) const ITK_OVERRIDE { itkExceptionMacro(<< "This function is currently not supported."); } /** Return the number of parameters. */ - virtual unsigned int GetNumberOfParameters(void) const + virtual unsigned int GetNumberOfParameters(void) const ITK_OVERRIDE { return m_ShapeFunction->GetNumberOfParameters(); } /** Compute the inside term component of the MAP cost function. @@ -142,7 +142,7 @@ ShapePriorMAPCostFunctionBase(); virtual ~ShapePriorMAPCostFunctionBase() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; ShapeFunctionPointer m_ShapeFunction; NodeContainerPointer m_ActiveRegion; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorMAPCostFunctionBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,9 +29,9 @@ ShapePriorMAPCostFunctionBase< TFeatureImage, TOutputPixel > ::ShapePriorMAPCostFunctionBase() { - m_ShapeFunction = NULL; - m_ActiveRegion = NULL; - m_FeatureImage = NULL; + m_ShapeFunction = ITK_NULLPTR; + m_ActiveRegion = ITK_NULLPTR; + m_FeatureImage = ITK_NULLPTR; } /** diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,7 +29,7 @@ ShapePriorSegmentationLevelSetFunction< TImageType, TFeatureImageType > ::ShapePriorSegmentationLevelSetFunction() { - m_ShapeFunction = NULL; + m_ShapeFunction = ITK_NULLPTR; m_ShapePriorWeight = NumericTraits< ScalarValueType >::Zero; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkShapePriorSegmentationLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -40,10 +40,10 @@ ShapePriorSegmentationLevelSetImageFilter< TInputImage, TFeatureImage, TOutputPixelType > ::ShapePriorSegmentationLevelSetImageFilter() { - m_ShapeFunction = NULL; - m_Optimizer = NULL; - m_CostFunction = NULL; - m_ShapePriorSegmentationFunction = NULL; + m_ShapeFunction = ITK_NULLPTR; + m_Optimizer = ITK_NULLPTR; + m_CostFunction = ITK_NULLPTR; + m_ShapePriorSegmentationFunction = ITK_NULLPTR; } template< typename TInputImage, typename TFeatureImage, typename TOutputPixelType > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -233,7 +233,7 @@ processing band. */ unsigned int GetMinimumNumberOfLayers() const { - return (int)vcl_ceil( m_CurvatureBandWidth + return (int)std::ceil( m_CurvatureBandWidth + itkGetStaticConstMacro(ImageDimension) ); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldFourthOrderLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -41,7 +41,7 @@ ::SparseFieldFourthOrderLevelSetImageFilter() { m_RefitIteration = 0; - m_LevelSetFunction = 0; + m_LevelSetFunction = ITK_NULLPTR; m_ConvergenceFlag = false; this->SetIsoSurfaceValue(0); @@ -122,7 +122,7 @@ position -= stride[k]; } } - if ( it.GetPixel (position) == 0 ) + if ( it.GetPixel (position) == ITK_NULLPTR ) { flag = true; } @@ -186,7 +186,7 @@ } else { - if ( node != 0 ) + if ( node != ITK_NULLPTR ) { node->m_CurvatureFlag = false; } @@ -211,7 +211,7 @@ while ( layerIt != this->m_Layers[0]->End() ) { node = im->GetPixel(layerIt->m_Value); - if ( ( node == 0 ) + if ( ( node == ITK_NULLPTR ) || ( node->m_CurvatureFlag == false ) ) { //level set touching edge of normal band diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -32,11 +32,11 @@ * lists of indices and other values. * \ingroup ITKLevelSets */ -template< typename TValueType > +template< typename TValue > class SparseFieldLevelSetNode { public: - TValueType m_Value; + TValue m_Value; SparseFieldLevelSetNode *Next; SparseFieldLevelSetNode *Previous; }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkSparseFieldLevelSetImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -128,16 +128,18 @@ template< typename TInputImage, typename TOutputImage > SparseFieldLevelSetImageFilter< TInputImage, TOutputImage > -::SparseFieldLevelSetImageFilter() +::SparseFieldLevelSetImageFilter() : + m_ConstantGradientValue(1.0), + m_NumberOfLayers(2), + m_IsoSurfaceValue(m_ValueZero), + m_InterpolateSurfaceLocation(true), + m_InputImage(ITK_NULLPTR), + m_OutputImage(ITK_NULLPTR), + m_BoundsCheckingActive(false) { - m_IsoSurfaceValue = m_ValueZero; - m_NumberOfLayers = 2; m_LayerNodeStore = LayerNodeStorageType::New(); m_LayerNodeStore->SetGrowthStrategyToExponential(); this->SetRMSChange( static_cast< double >( m_ValueZero ) ); - m_InterpolateSurfaceLocation = true; - m_BoundsCheckingActive = false; - m_ConstantGradientValue = 1.0; } template< typename TInputImage, typename TOutputImage > @@ -482,7 +484,7 @@ } else { - this->SetRMSChange( static_cast< double >( vcl_sqrt( (double)( rms_change_accumulator + this->SetRMSChange( static_cast< double >( std::sqrt( (double)( rms_change_accumulator / static_cast< ValueType >( counter ) ) ) ) ); } } @@ -871,7 +873,7 @@ length += dx_backward * dx_backward; } } - length = vcl_sqrt( (double)length ) + MIN_NORM; + length = std::sqrt( (double)length ) + MIN_NORM; distance = shiftedIt.GetCenterPixel() / length; output->SetPixel( activeIt->m_Value, @@ -1192,8 +1194,7 @@ unsigned int i; os << indent << "m_IsoSurfaceValue: " << m_IsoSurfaceValue << std::endl; - os << indent << "m_LayerNodeStore: " << std::endl; - m_LayerNodeStore->Print( os, indent.GetNextIndent() ); + itkPrintSelfObjectMacro( LayerNodeStore ); os << indent << "m_BoundsCheckingActive: " << m_BoundsCheckingActive; for ( i = 0; i < m_Layers.size(); i++ ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSets/include/itkVectorThresholdSegmentationLevelSetFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ ScalarValueType threshold; for ( fit.GoToBegin(), sit.GoToBegin(); !fit.IsAtEnd(); ++sit, ++fit ) { - threshold = m_Threshold - vcl_sqrt( m_Mahalanobis->Evaluate( fit.Get() ) ); + threshold = m_Threshold - std::sqrt( m_Mahalanobis->Evaluate( fit.Get() ) ); sit.Set( static_cast< ScalarValueType >( threshold ) ); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkBinaryImageToLevelSetImageAdaptor.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -139,7 +139,7 @@ this->m_LevelSet->SetLabelMap( this->m_LabelMap ); // release the memory - this->m_InternalImage = NULL; + this->m_InternalImage = ITK_NULLPTR; } template< typename TInput, typename TOutput > @@ -463,7 +463,7 @@ FindActiveLayer(); this->m_LevelSet->SetLabelMap( this->m_LabelMap ); - this->m_InternalImage = NULL; + this->m_InternalImage = ITK_NULLPTR; } @@ -622,7 +622,7 @@ this->CreateMinimalInterface(); this->m_LevelSet->SetLabelMap( this->m_LabelMap ); - this->m_InternalImage = NULL; + this->m_InternalImage = ITK_NULLPTR; } template< typename TInput > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkDiscreteLevelSetImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -710,20 +710,7 @@ { Superclass::CopyInformation( data ); - const Self *LevelSet = NULL; - - try - { - LevelSet = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // LevelSet could not be cast back down - itkExceptionMacro( << "itk::DiscreteLevelSetImage::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } - + const Self *LevelSet = dynamic_cast< const Self * >( data ); if ( !LevelSet ) { // pointer could not be cast back down @@ -740,19 +727,7 @@ ::Graft( const DataObject* data ) { Superclass::Graft( data ); - const Self *LevelSet = NULL; - - try - { - LevelSet = dynamic_cast< const Self* >( data ); - } - catch( ... ) - { - // image could not be cast back down - itkExceptionMacro( << "itk::DiscreteLevelSetImage::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *LevelSet = dynamic_cast< const Self* >( data ); if ( !LevelSet ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -178,26 +178,26 @@ itkGetConstMacro(MaximumNumberOfRegions, RegionType); /** Initialize the level set function */ - virtual void Initialize(); + virtual void Initialize() ITK_OVERRIDE; /** Methods to manage streaming. */ - virtual void UpdateOutputInformation(); + virtual void UpdateOutputInformation() ITK_OVERRIDE; - virtual void SetRequestedRegionToLargestPossibleRegion(); + virtual void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE; - virtual void CopyInformation(const DataObject *data); + virtual void CopyInformation(const DataObject *data) ITK_OVERRIDE; - virtual void Graft(const DataObject *data); + virtual void Graft(const DataObject *data) ITK_OVERRIDE; - virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); + virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE; - virtual bool VerifyRequestedRegion(); + virtual bool VerifyRequestedRegion() ITK_OVERRIDE; /** Set the requested region from this data object to match the requested * region of the data object passed in as a parameter. This method * implements the API from DataObject. The data object parameter must be * castable to a PointSet. */ - virtual void SetRequestedRegion( const DataObject *data); + virtual void SetRequestedRegion( const DataObject *data) ITK_OVERRIDE; /** Set/Get the Requested region */ virtual void SetRequestedRegion(const RegionType & region); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,13 @@ template< typename TInput, unsigned int VDimension, typename TOutput, typename TDomain > LevelSetBase< TInput, VDimension, TOutput, TDomain > -::LevelSetBase() - {} +::LevelSetBase() : + m_MaximumNumberOfRegions(0), + m_NumberOfRegions(0), + m_RequestedNumberOfRegions(0), + m_BufferedRegion(0), + m_RequestedRegion(0) +{} // ---------------------------------------------------------------------------- template< typename TInput, unsigned int VDimension, typename TOutput, typename TDomain > @@ -208,19 +213,7 @@ LevelSetBase< TInput, VDimension, TOutput, TDomain > ::CopyInformation(const DataObject *data) { - const LevelSetBase *levelSet = NULL; - - try - { - levelSet = dynamic_cast< const LevelSetBase * >( data ); - } - catch ( ... ) - { - // pointer could not be cast back down - itkExceptionMacro( << "itk::LevelSetBase::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( LevelSetBase * ).name() ); - } + const LevelSetBase *levelSet = dynamic_cast< const LevelSetBase * >( data ); if ( !levelSet ) { @@ -247,19 +240,7 @@ // Copy Meta Data this->CopyInformation(data); - const Self * levelSet = NULL; - - try - { - levelSet = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // pointer could not be cast back down - itkExceptionMacro( << "itk::LevelSetBase::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self * levelSet = dynamic_cast< const Self * >( data ); if ( !levelSet ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainerBase.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainerBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainerBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetContainerBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -100,7 +100,7 @@ } else { - return NULL; + return ITK_NULLPTR; } } @@ -151,7 +151,7 @@ if( it != m_Container.end() ) { - it->second = NULL; + it->second = ITK_NULLPTR; m_Container.erase( it ); this->Modified(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDenseImage.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDenseImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDenseImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDenseImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -77,7 +77,7 @@ { Superclass::Initialize(); - this->m_Image = NULL; + this->m_Image = ITK_NULLPTR; } // ---------------------------------------------------------------------------- @@ -88,19 +88,7 @@ { Superclass::CopyInformation( data ); - const Self *LevelSet = NULL; - - try - { - LevelSet = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // LevelSet could not be cast back down - itkExceptionMacro( << "itk::LevelSetDenseImage::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *LevelSet = dynamic_cast< const Self * >( data ); if ( !LevelSet ) { @@ -118,19 +106,7 @@ ::Graft( const DataObject* data ) { Superclass::Graft( data ); - const Self *LevelSet = NULL; - - try - { - LevelSet = dynamic_cast< const Self* >( data ); - } - catch( ... ) - { - // image could not be cast back down - itkExceptionMacro( << "itk::LevelSetDenseImage::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *LevelSet = dynamic_cast< const Self* >( data ); if ( !LevelSet ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainMapImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,8 +29,8 @@ { this->Superclass::SetNumberOfRequiredInputs ( 1 ); this->Superclass::SetNumberOfRequiredOutputs ( 1 ); - this->m_InputImage = 0; - this->m_OutputImage = 0; + this->m_InputImage = ITK_NULLPTR; + this->m_OutputImage = ITK_NULLPTR; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainPartitionImageWithKdTree.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainPartitionImageWithKdTree.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainPartitionImageWithKdTree.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetDomainPartitionImageWithKdTree.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -25,7 +25,7 @@ template< typename TImage > LevelSetDomainPartitionImageWithKdTree< TImage > ::LevelSetDomainPartitionImageWithKdTree() : - m_KdTree(NULL), m_NumberOfNeighbors( 10 ) + m_KdTree(ITK_NULLPTR), m_NumberOfNeighbors( 10 ) { } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseExternalTerm.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseExternalTerm.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseExternalTerm.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationChanAndVeseExternalTerm.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,8 +29,8 @@ { this->m_TermName = "External Chan And Vese term"; this->m_RequiredData.insert( "Value" ); - this->m_DomainMapImageFilter = 0; - this->m_CacheImage = 0; + this->m_DomainMapImageFilter = ITK_NULLPTR; + this->m_CacheImage = ITK_NULLPTR; } template< typename TInput, typename TLevelSetContainer > @@ -58,7 +58,7 @@ if( this->m_LevelSetContainer->HasDomainMap() ) { - if(this->m_DomainMapImageFilter == 0) + if(this->m_DomainMapImageFilter == ITK_NULLPTR) { this->m_DomainMapImageFilter = this->m_LevelSetContainer->GetModifiableDomainMapFilter(); this->m_CacheImage = this->m_DomainMapImageFilter->GetOutput(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationOverlapPenaltyTerm.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationOverlapPenaltyTerm.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationOverlapPenaltyTerm.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEquationOverlapPenaltyTerm.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -30,8 +30,8 @@ { this->m_TermName = "Overlap term"; this->m_RequiredData.insert( "" ); - this->m_DomainMapImageFilter = 0; - this->m_CacheImage = 0; + this->m_DomainMapImageFilter = ITK_NULLPTR; + this->m_CacheImage = ITK_NULLPTR; } template< typename TInput, typename TLevelSetContainer > @@ -98,7 +98,7 @@ if( this->m_LevelSetContainer->HasDomainMap() ) { - if(this->m_DomainMapImageFilter == 0) + if(this->m_DomainMapImageFilter == ITK_NULLPTR) { this->m_DomainMapImageFilter = this->m_LevelSetContainer->GetModifiableDomainMapFilter(); this->m_CacheImage = this->m_DomainMapImageFilter->GetOutput(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolution.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -27,7 +27,8 @@ template< typename TEquationContainer, typename TImage > LevelSetEvolution< TEquationContainer, LevelSetDenseImage< TImage > > -::LevelSetEvolution() +::LevelSetEvolution() : + m_IdListToProcessWhenThreading(ITK_NULLPTR) { this->m_SplitLevelSetComputeIterationThreader = SplitLevelSetComputeIterationThreaderType::New(); this->m_SplitDomainMapComputeIterationThreader = SplitDomainMapComputeIterationThreaderType::New(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionUpdateLevelSetsThreader.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionUpdateLevelSetsThreader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionUpdateLevelSetsThreader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetEvolutionUpdateLevelSetsThreader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -38,7 +38,7 @@ { this->m_RMSChangeAccumulatorPerThread.resize( this->GetNumberOfThreadsUsed() ); - for( ThreadIdType ii = 0; ii < this->GetNumberOfThreadsUsed(); ++ii ) + for( ThreadIdType ii = 0, maxThreads = this->GetNumberOfThreadsUsed(); ii < maxThreads; ++ii ) { this->m_RMSChangeAccumulatorPerThread[ii].ResetToZero(); } @@ -66,10 +66,9 @@ levelSetImageIt.GoToBegin(); levelSetUpdateImageIt.GoToBegin(); - LevelSetOutputRealType p; while( !levelSetImageIt.IsAtEnd() ) { - p = this->m_Associate->m_Dt * levelSetUpdateImageIt.Get(); + const LevelSetOutputRealType & p = this->m_Associate->m_Dt * levelSetUpdateImageIt.Get(); levelSetImageIt.Set( levelSetImageIt.Get() + p ); this->m_RMSChangeAccumulatorPerThread[threadId] += p*p; @@ -84,7 +83,7 @@ LevelSetEvolutionUpdateLevelSetsThreader< LevelSetDenseImage< TImage >, ThreadedImageRegionPartitioner< TImage::ImageDimension >, TLevelSetEvolution > ::AfterThreadedExecution() { - for( ThreadIdType ii = 0; ii < this->GetNumberOfThreadsUsed(); ++ii ) + for( ThreadIdType ii = 0, maxThreads = this->GetNumberOfThreadsUsed(); ii < maxThreads; ++ii ) { this->m_Associate->m_RMSChangeAccumulator += this->m_RMSChangeAccumulatorPerThread[ii].GetSum(); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetQuadEdgeMesh.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetQuadEdgeMesh.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetQuadEdgeMesh.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetQuadEdgeMesh.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -113,19 +113,7 @@ { Superclass::CopyInformation( data ); - const Self *levelSet = NULL; - - try - { - levelSet = dynamic_cast< const Self * >( data ); - } - catch ( ... ) - { - // levelSet could not be cast back down - itkExceptionMacro( << "itk::LevelSetQuadEdgeMesh::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *levelSet = dynamic_cast< const Self * >( data ); if ( !levelSet ) { @@ -141,19 +129,7 @@ LevelSetQuadEdgeMesh< TMesh >::Graft( const DataObject* data ) { Superclass::Graft( data ); - const Self *levelSet = NULL; - - try - { - levelSet = dynamic_cast< const Self* >( data ); - } - catch( ... ) - { - // mesh could not be cast back down - itkExceptionMacro( << "itk::LevelSetQuadEdgeMesh::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *levelSet = dynamic_cast< const Self* >( data ); if ( !levelSet ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetSparseImage.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetSparseImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetSparseImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkLevelSetSparseImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -81,19 +81,7 @@ ::Graft( const DataObject* data ) { Superclass::Graft( data ); - const Self *LevelSet = 0; - - try - { - LevelSet = dynamic_cast< const Self* >( data ); - } - catch( ... ) - { - // mesh could not be cast back down - itkExceptionMacro( << "itk::MalcolmSparseLevelSet::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *LevelSet = dynamic_cast< const Self* >( data ); if ( !LevelSet ) { @@ -157,7 +145,7 @@ { Superclass::Initialize(); - this->m_LabelMap = 0; + this->m_LabelMap = ITK_NULLPTR; this->InitializeLayers(); this->InitializeInternalLabelList(); } @@ -170,18 +158,7 @@ { Superclass::CopyInformation( data ); - const Self *LevelSet = NULL; - try - { - LevelSet = dynamic_cast< const Self* >( data ); - } - catch( ... ) - { - // LevelSet could not be cast back down - itkExceptionMacro( << "itk::MalcolmSparseLevelSet::CopyInformation() cannot cast " - << typeid( data ).name() << " to " - << typeid( Self * ).name() ); - } + const Self *LevelSet = dynamic_cast< const Self* >( data ); if ( !LevelSet ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkMalcolmSparseLevelSetImage.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkMalcolmSparseLevelSetImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkMalcolmSparseLevelSetImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkMalcolmSparseLevelSetImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,6 @@ itkGenericExceptionMacro( <<"status " << static_cast< int >( status ) << " should be 1 or -1" ); - return PlusOneLayer(); } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkShiSparseLevelSetImage.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkShiSparseLevelSetImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkShiSparseLevelSetImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkShiSparseLevelSetImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -76,7 +76,6 @@ itkGenericExceptionMacro( <<"status " << static_cast< int >( status ) << " should be 3 or -3" ); - return static_cast( this->PlusThreeLayer() ); } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkWhitakerSparseLevelSetImage.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkWhitakerSparseLevelSetImage.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkWhitakerSparseLevelSetImage.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/LevelSetsv4/include/itkWhitakerSparseLevelSetImage.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -77,7 +77,6 @@ itkGenericExceptionMacro( <<"status " << static_cast< int >( status ) << " should be 3 or -3" ); - return static_cast( this->PlusThreeLayer() ); } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkMRFImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,10 +32,10 @@ m_TotalNumberOfPixelsInInputImage(1), m_ErrorTolerance(0.2), m_SmoothingFactor(1), - m_ClassProbability(0), + m_ClassProbability(ITK_NULLPTR), m_NumberOfIterations(0), m_StopCondition(MaximumNumberOfIterations), - m_ClassifierPtr(0) + m_ClassifierPtr(ITK_NULLPTR) { if ( (int)InputImageDimension != (int)ClassifiedImageDimension ) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/MarkovRandomFieldsClassifiers/include/itkRGBGibbsPriorFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -32,19 +32,19 @@ template< typename TInputImage, typename TClassifiedImage > RGBGibbsPriorFilter< TInputImage, TClassifiedImage > ::RGBGibbsPriorFilter(void): - m_InputImage(0), - m_TrainingImage(0), - m_LabelledImage(0), + m_InputImage(ITK_NULLPTR), + m_TrainingImage(ITK_NULLPTR), + m_LabelledImage(ITK_NULLPTR), m_NumberOfClasses(0), m_MaximumNumberOfIterations(10), - m_ClassifierPtr(0), + m_ClassifierPtr(ITK_NULLPTR), m_BoundaryGradient(7), m_BoundaryWeight(1), m_GibbsPriorWeight(1), m_StartRadius(10), m_RecursiveNumber(0), - m_LabelStatus(0), - m_MediumImage(0), + m_LabelStatus(ITK_NULLPTR), + m_MediumImage(ITK_NULLPTR), m_Temp(0), m_ImageWidth(0), m_ImageHeight(0), @@ -53,8 +53,8 @@ m_ObjectLabel(1), m_VecDim(0), m_LowPoint(), - m_Region(NULL), - m_RegionCount(NULL), + m_Region(ITK_NULLPTR), + m_RegionCount(ITK_NULLPTR), m_CliqueWeight_1(0.0), m_CliqueWeight_2(0.0), m_CliqueWeight_3(0.0), @@ -348,7 +348,7 @@ { difenergy = energy[label] - energy[1 - label]; double rand_num = (double)( rand() / 32768.0 ); - double energy_num = (double)( vcl_exp( (double)( difenergy * 0.5 * size / ( 2 * size - m_Temp ) ) ) ); + double energy_num = (double)( std::exp( (double)( difenergy * 0.5 * size / ( 2 * size - m_Temp ) ) ) ); if ( rand_num < energy_num ) { m_LabelledImage->SetPixel(offsetIndex3D, 1 - label); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkConfidenceConnectedImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -244,8 +244,8 @@ m_Variance = ( sumOfSquares - ( sum * sum / double(num) ) ) / ( double(num) - 1.0 ); } - lower = m_Mean - m_Multiplier *vcl_sqrt(m_Variance); - upper = m_Mean + m_Multiplier *vcl_sqrt(m_Variance); + lower = m_Mean - m_Multiplier *std::sqrt(m_Variance); + upper = m_Mean + m_Multiplier *std::sqrt(m_Variance); // Find the highest and lowest seed intensity. InputRealType lowestSeedIntensity = itk::NumericTraits< InputImagePixelType >::max(); @@ -299,7 +299,7 @@ itkDebugMacro( << "\nLower intensity = " << lower << ", Upper intensity = " << upper << "\nmean = " << m_Mean - << " , vcl_sqrt(variance) = " << vcl_sqrt(m_Variance) ); + << " , std::sqrt(variance) = " << std::sqrt(m_Variance) ); // Segment the image, the iterator walks the output image (so Set() // writes into the output image), starting at the seed point. As @@ -355,15 +355,15 @@ << ", Upper intensity = " << upper << "\nmean = " << m_Mean << ", variance = " << m_Variance - << " , vcl_sqrt(variance) = " << vcl_sqrt(m_Variance) ); + << " , std::sqrt(variance) = " << std::sqrt(m_Variance) ); itkDebugMacro(<< "\nsum = " << sum << ", sumOfSquares = " << sumOfSquares << "\nnumberOfSamples = " << numberOfSamples); break; } - lower = m_Mean - m_Multiplier *vcl_sqrt(m_Variance); - upper = m_Mean + m_Multiplier *vcl_sqrt(m_Variance); + lower = m_Mean - m_Multiplier *std::sqrt(m_Variance); + upper = m_Mean + m_Multiplier *std::sqrt(m_Variance); // Adjust lower and upper to always contain the seed's intensity, otherwise, // no pixels will be @@ -394,7 +394,7 @@ << ", Upper intensity = " << upper << "\nmean = " << m_Mean << ", variance = " << m_Variance - << " , vcl_sqrt(variance) = " << vcl_sqrt(m_Variance) ); + << " , std::sqrt(variance) = " << std::sqrt(m_Variance) ); itkDebugMacro(<< "\nsum = " << sum << ", sumOfSquares = " << sumOfSquares << "\nnum = " << numberOfSamples); // Rerun the segmentation, the iterator walks the output image, diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.h 2014-09-03 08:29:34.000000000 +0000 @@ -84,7 +84,6 @@ /** Run-time type information (and related methods). */ itkTypeMacro(IsolatedConnectedImageFilter, ImageToImageFilter); - typedef TInputImage InputImageType; typedef typename InputImageType::Pointer InputImagePointer; typedef typename InputImageType::ConstPointer InputImageConstPointer; @@ -105,27 +104,34 @@ void PrintSelf(std::ostream & os, Indent indent) const; - /** Set seed point 1. This seed will be isolated from Seed2 (if possible). + /** Add seed point 1. This seed will be isolated from Seed2 (if possible). + * All pixels connected to this seed will be replaced with ReplaceValue. */ + void AddSeed1(const IndexType & seed); + +#if ! defined ( ITK_FUTURE_LEGACY_REMOVE ) + /** \deprecated + * Set seed point 1. This seed will be isolated from Seed2 (if possible). * All pixels connected to this seed will be replaced with ReplaceValue. - * This method is deprecated, please use AddSeed() */ + * This method is deprecated, please use AddSeed1(). */ void SetSeed1(const IndexType & seed); +#endif /** Clear all the seeds1. */ void ClearSeeds1(); - /** Add seed point 1. */ - void AddSeed1(const IndexType & seed); + /** Add seed point 2. This seed will be isolated from Seed1 (if possible). */ + void AddSeed2(const IndexType & seed); - /** Set seed point 2. This seed will be isolated from Seed1 (if possible). - * This method is deprecated, please use AddSeed() */ +#if ! defined ( ITK_FUTURE_LEGACY_REMOVE ) + /** \deprecated + * Set seed point 2. This seed will be isolated from Seed1 (if possible). + * This method is deprecated, please use AddSeed2(). */ void SetSeed2(const IndexType & seed); +#endif /** Clear all the seeds2. */ void ClearSeeds2(); - /** Add seed point 2. */ - void AddSeed2(const IndexType & seed); - /** Method to access seed container */ virtual const SeedsContainerType &GetSeeds1() const; virtual const SeedsContainerType &GetSeeds2() const; @@ -140,7 +146,9 @@ itkSetMacro(Upper, InputImagePixelType); itkGetConstReferenceMacro(Upper, InputImagePixelType); - /** Set/Get the limit on the upper threshold value. The default is +#if ! defined ( ITK_FUTURE_LEGACY_REMOVE ) + /** \deprecated + * Set/Get the limit on the upper threshold value. The default is the max() for the InputPixelType. These methods have been deprecated. Please use Set/Get Upper instead. */ void SetUpperValueLimit(InputImagePixelType upperValue) @@ -152,6 +160,7 @@ { return this->GetUpper(); } +#endif /** Set/Get the precision required for the intensity threshold * value. The default is 1. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/RegionGrowing/include/itkIsolatedConnectedImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -99,6 +99,20 @@ output->SetRequestedRegionToLargestPossibleRegion(); } +/** Add seed point 1. This seed will be isolated from Seed2 (if possible). */ +template< typename TInputImage, typename TOutputImage > +void +IsolatedConnectedImageFilter< TInputImage, TOutputImage > +::AddSeed1(const IndexType & seed) +{ + this->m_Seeds1.push_back(seed); + this->Modified(); +} + +#if ! defined ( ITK_FUTURE_LEGACY_REMOVE ) +/** \deprecated + * Set seed point 1. This seed will be isolated from Seed2 (if possible). + * This method is deprecated, please use AddSeed1() */ template< typename TInputImage, typename TOutputImage > void IsolatedConnectedImageFilter< TInputImage, TOutputImage > @@ -107,6 +121,7 @@ this->ClearSeeds1(); this->AddSeed1(seed); } +#endif /** Clear all the seeds1. */ template< typename TInputImage, typename TOutputImage > @@ -121,18 +136,20 @@ } } -/** Add seed point 1. */ +/** Add seed point 2. This seed will be isolated from Seed1 (if possible). */ template< typename TInputImage, typename TOutputImage > void IsolatedConnectedImageFilter< TInputImage, TOutputImage > -::AddSeed1(const IndexType & seed) +::AddSeed2(const IndexType & seed) { - this->m_Seeds1.push_back(seed); + this->m_Seeds2.push_back(seed); this->Modified(); } -/** Set seed point 2. This seed will be isolated from Seed1 (if possible). - * This method is deprecated, please use AddSeed() */ +#if ! defined ( ITK_FUTURE_LEGACY_REMOVE ) +/** \deprecated + * Set seed point 2. This seed will be isolated from Seed1 (if possible). + * This method is deprecated, please use AddSeed2() */ template< typename TInputImage, typename TOutputImage > void IsolatedConnectedImageFilter< TInputImage, TOutputImage > @@ -141,6 +158,7 @@ this->ClearSeeds2(); this->AddSeed2(seed); } +#endif /** Clear all the seeds2. */ template< typename TInputImage, typename TOutputImage > @@ -173,16 +191,6 @@ return this->m_Seeds2; } -/** Add seed point 2. */ -template< typename TInputImage, typename TOutputImage > -void -IsolatedConnectedImageFilter< TInputImage, TOutputImage > -::AddSeed2(const IndexType & seed) -{ - this->m_Seeds2.push_back(seed); - this->Modified(); -} - template< typename TInputImage, typename TOutputImage > void IsolatedConnectedImageFilter< TInputImage, TOutputImage > @@ -231,8 +239,8 @@ // two sets of seeds. const unsigned int maximumIterationsInBinarySearch = static_cast< unsigned int >( - vcl_log( ( static_cast< float >( upper ) - static_cast< float >( lower ) ) - / static_cast< float >( m_IsolatedValueTolerance ) ) / vcl_log(2.0) ); + std::log( ( static_cast< float >( upper ) - static_cast< float >( lower ) ) + / static_cast< float >( m_IsolatedValueTolerance ) ) / std::log(2.0) ); progressWeight = 1.0f / static_cast< float >( maximumIterationsInBinarySearch + 2 ); cumulatedProgress = 0.0f; @@ -298,8 +306,8 @@ // two sets of seeds. const unsigned int maximumIterationsInBinarySearch = static_cast< unsigned int >( - vcl_log( ( static_cast< float >( upper ) - static_cast< float >( lower ) ) - / static_cast< float >( m_IsolatedValueTolerance ) ) / vcl_log(2.0) ); + std::log( ( static_cast< float >( upper ) - static_cast< float >( lower ) ) + / static_cast< float >( m_IsolatedValueTolerance ) ) / std::log(2.0) ); progressWeight = 1.0f / static_cast< float >( maximumIterationsInBinarySearch + 2 ); cumulatedProgress = 0.0f; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkPCAShapeSignedDistanceFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkPCAShapeSignedDistanceFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkPCAShapeSignedDistanceFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkPCAShapeSignedDistanceFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ m_NumberOfPrincipalComponents = 0; m_NumberOfTransformParameters = 0; - m_MeanImage = NULL; + m_MeanImage = ITK_NULLPTR; m_PrincipalComponentImages.resize(0); m_PrincipalComponentStandardDeviations.SetSize(0); @@ -55,7 +55,7 @@ { m_NumberOfPrincipalComponents = n; - m_PrincipalComponentImages.resize(n, NULL); + m_PrincipalComponentImages.resize(n, ITK_NULLPTR); m_PrincipalComponentStandardDeviations.SetSize(n); m_PrincipalComponentStandardDeviations.Fill(1.0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkSphereSignedDistanceFunction.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkSphereSignedDistanceFunction.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkSphereSignedDistanceFunction.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/SignedDistanceFunction/include/itkSphereSignedDistanceFunction.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ output += vnl_math_sqr( ( point[j] - m_Translation[j] ) ); } - output = vcl_sqrt(output) - m_Radius; + output = std::sqrt(output) - m_Radius; return output; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,7 @@ * \brief Implement the Sweep Line Algorithm for the construction of the * 2D Voronoi Diagram. * - * Detailed informations of this method can be found in: + * Detailed information on this method can be found in: * "A sweepline algorithm for Voronoi diagrams." * S. Fortune, Algorithmica 2, 153-174, 1987. * @@ -41,10 +41,9 @@ * (1) Size of the region. * (2) Seed points coordinates. These coordinates can also be randomly set. * - * Template parameters for VoronoiDiagram2DGenerator: + * \tparam TCoordType The type associated with the coordination of the seeds + * and the resulting vertices. * - * TCoordType: the type associated with the coordination of the seeds and the - * resulting vertices. * \ingroup ITKVoronoi */ template< typename TCoordType > @@ -77,16 +76,20 @@ /** Get the number of seed points. */ itkGetConstMacro(NumberOfSeeds, unsigned int); - /** Input the seeds information, will overwrite if seeds already - * exists. */ + /** Set the seed points. + * + * Specify the number of seeds as "num". Will overwrite if seeds already + * exists. + */ void SetSeeds(int num, SeedsIterator begin); - /** Add more seeds at one time. */ + /** Add more seeds. Specify the number of seeds to be added as "num". */ void AddSeeds(int num, SeedsIterator begin); + /** Add one seed. */ void AddOneSeed(PointType); - /** Sort the seeds by ____. */ + /** Sort the seeds with their y, then x, coordinates. */ void SortSeeds(void); /** Produce the output information. */ @@ -95,12 +98,15 @@ /** Update the Voronoi Diagram after adding seed(s). */ void UpdateDiagram(void); - /** The boundary that enclose the whole voronoi diagram. */ + /** Set the rectangle that encloses the whole Voronoi Diagram. */ void SetBoundary(PointType vorsize); void SetOrigin(PointType vorsize); - /** Set the seeds points randomly. */ + /** Set the seeds points randomly. + * + * Specify the number of seeds as "num". + */ void SetRandomSeeds(int num); /** Return the given indexed seed. */ @@ -123,46 +129,64 @@ OutputType m_OutputVD; SeedsType m_Seeds; + /** Compare point coordinates in the y direction. */ static bool comp(PointType arg1, PointType arg2); /** \class FortuneSite - * Small data structures for Fortune's Method - * and some public variables/methods not for external access. + * \brief Small data structures for Fortune's Method and some public + * variables/methods not for external access. + * * \ingroup ITKVoronoi */ class FortuneSite; class FortuneEdge; class FortuneHalfEdge; - /** All private nested classes must be friend classes to work with SunOS-CC compiler. - * If not, the private nested classes will not be able to access each other. */ + // All private nested classes must be friend classes to work with SunOS-CC + // compiler. If not, the private nested classes will not be able to access + // each other. friend class FortuneSite; friend class FortuneEdge; friend class FortuneHalfEdge; class FortuneSite { -public: + public: PointType m_Coord; int m_Sitenbr; - FortuneSite():m_Sitenbr( NumericTraits< int >::max() ) { m_Coord.Fill( NumericTraits< CoordRepType >::max() ); } + + FortuneSite() : + m_Sitenbr( NumericTraits< int >::max() ) + { + m_Coord.Fill( NumericTraits< CoordRepType >::max() ); + } + ~FortuneSite(){} }; class FortuneEdge { -public: + public: float m_A, m_B, m_C; // explicit line function: Ax + By = C; FortuneSite *m_Ep[2]; FortuneSite *m_Reg[2]; int m_Edgenbr; - FortuneEdge():m_A(0.0), m_B(0.0), m_C(0.0) { m_Ep[0] = m_Ep[1] = m_Reg[0] = m_Reg[1] = 0; } + + FortuneEdge() : + m_A(0.0), + m_B(0.0), + m_C(0.0), + m_Edgenbr(0) + { + m_Ep[0] = m_Ep[1] = m_Reg[0] = m_Reg[1] = ITK_NULLPTR; + } + ~FortuneEdge(){} }; class FortuneHalfEdge { -public: + public: FortuneHalfEdge *m_Left; FortuneHalfEdge *m_Right; FortuneEdge * m_Edge; @@ -170,15 +194,28 @@ FortuneSite * m_Vert; double m_Ystar; FortuneHalfEdge *m_Next; - FortuneHalfEdge():m_Left(0), m_Right(0), m_Edge(0), m_RorL(false), m_Vert(0), m_Ystar(0.0), m_Next(0) {} - FortuneHalfEdge(const FortuneHalfEdge & edge):m_Left(edge.m_Left), + + FortuneHalfEdge() : + m_Left(ITK_NULLPTR), + m_Right(ITK_NULLPTR), + m_Edge(ITK_NULLPTR), + m_RorL(false), + m_Vert(ITK_NULLPTR), + m_Ystar(0.0), + m_Next(ITK_NULLPTR) + {} + + FortuneHalfEdge(const FortuneHalfEdge & edge) : + m_Left(edge.m_Left), m_Right(edge.m_Right), m_Edge(edge.m_Edge), m_RorL(edge.m_RorL), m_Vert(edge.m_Vert), m_Ystar(edge.m_Ystar), - m_Next(edge.m_Next) {} - ~FortuneHalfEdge(){} + m_Next(edge.m_Next) + {} + + ~FortuneHalfEdge() {} }; double m_Pxmin; @@ -205,6 +242,9 @@ FortuneEdge m_DELETED; std::vector< FortuneSite > m_SeedSites; + /** Methods to convert the result from Fortune Algorithm into itkMesh + * structure. + */ bool differentPoint(PointType p1, PointType p2); bool almostsame(CoordRepType p1, CoordRepType p2); @@ -223,6 +263,10 @@ FortuneHalfEdge * ELgethash(int b); + /** Generate Voronoi Diagram using Fortune's Method. (Sweep Line) + * + * Information is stored in m_VertexList, m_EdgeList and m_LineList. + */ bool right_of(FortuneHalfEdge *el, PointType *p); FortuneSite * getRightReg(FortuneHalfEdge *he); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiDiagram2DGenerator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,13 +29,24 @@ const double DIFF_TOLERENCE = 0.001; template< typename TCoordRepType > -VoronoiDiagram2DGenerator< TCoordRepType >::VoronoiDiagram2DGenerator() -{ - m_NumberOfSeeds = 0; - m_Pxmin = 0; - m_Pymin = 0; - m_OutputVD = this->GetOutput(); -} +VoronoiDiagram2DGenerator< TCoordRepType >::VoronoiDiagram2DGenerator() : + m_NumberOfSeeds( 0 ), + m_OutputVD( this->GetOutput() ), + m_Pxmin( 0.0 ), + m_Pxmax( 0.0 ), + m_Pymin( 0.0 ), + m_Pymax( 0.0 ), + m_Deltax( 0.0 ), + m_Deltay( 0.0 ), + m_SqrtNSites( 0.0 ), + m_PQcount( 0 ), + m_PQmin( 0 ), + m_PQhashsize( 0 ), + m_Nedges( 0 ), + m_Nvert( 0 ), + m_BottomSite( ITK_NULLPTR ), + m_ELhashsize( 0 ) +{} template< typename TCoordRepType > VoronoiDiagram2DGenerator< TCoordRepType >:: @@ -51,7 +62,6 @@ << m_NumberOfSeeds << std::endl; } -/* Set random seed points. Specify the number of seeds as "num". */ template< typename TCoordRepType > void VoronoiDiagram2DGenerator< TCoordRepType >::SetRandomSeeds(int num) @@ -70,7 +80,6 @@ m_NumberOfSeeds = num; } -/* Set the seed points. Specify the number of seeds as "num". */ template< typename TCoordRepType > void VoronoiDiagram2DGenerator< TCoordRepType >::SetSeeds(int num, SeedsIterator begin) @@ -84,7 +93,6 @@ m_NumberOfSeeds = num; } -/* Set the rectangle that encloses the Voronoi Diagram. */ template< typename TCoordRepType > void VoronoiDiagram2DGenerator< TCoordRepType >::SetBoundary(PointType vorsize) @@ -103,16 +111,19 @@ m_OutputVD->SetOrigin(vorsize); } -/* Compare point coordinates in the y direction. */ template< typename TCoordRepType > bool VoronoiDiagram2DGenerator< TCoordRepType >::comp(PointType arg1, PointType arg2) { - if ( arg1[1] < arg2[1] ) { return 1; } + if ( arg1[1] < arg2[1] ) + { + return 1; + } else if ( arg1[1] > arg2[1] ) { return 0; } + // arg1[1] == arg2[1] else if ( arg1[0] < arg2[0] ) { return 1; @@ -121,10 +132,13 @@ { return 0; } - else { return 1; } + // arg1[0] == arg2[0] + else + { + return 0; + } } -/* Sort the seeds with their y coordinates. */ template< typename TCoordRepType > void VoronoiDiagram2DGenerator< TCoordRepType >::SortSeeds(void) @@ -132,10 +146,9 @@ std::sort(m_Seeds.begin(), m_Seeds.end(), comp); } -/* Add seeds. Specify the number of seeds to be added as "num". */ template< typename TCoordRepType > void -VoronoiDiagram2DGenerator< TCoordRepType >::AddSeeds(int num, SeedsIterator begin) +VoronoiDiagram2DGenerator< TCoordRepType >::AddSeeds(int num, SeedsIterator begin) { SeedsIterator ii(begin); @@ -146,7 +159,6 @@ m_NumberOfSeeds += num; } -/* Add one seed. */ template< typename TCoordRepType > void VoronoiDiagram2DGenerator< TCoordRepType >::AddOneSeed(PointType inputSeed) @@ -183,9 +195,6 @@ this->GenerateData(); } -/** Methods to convert the result from Fortune Algorithm into - * itkMesh structure. */ - template< typename TCoordRepType > bool VoronoiDiagram2DGenerator< TCoordRepType >::differentPoint(PointType p1, PointType p2) @@ -437,10 +446,6 @@ delete[] rawEdges; } -/** - * Generate Voronoi Diagram using Fortune's Method. (Sweep Line) - * Infomations are stored in m_VertexList, m_EdgeList and m_LineList. */ - template< typename TCoordRepType > bool VoronoiDiagram2DGenerator< TCoordRepType >::right_of(FortuneHalfEdge *el, PointType *p) @@ -496,15 +501,15 @@ { task->m_Edge = e; task->m_RorL = pm; - task->m_Next = NULL; - task->m_Vert = NULL; + task->m_Next = ITK_NULLPTR; + task->m_Vert = ITK_NULLPTR; } template< typename TCoordRepType > void VoronoiDiagram2DGenerator< TCoordRepType >::PQshowMin(PointType *answer) { - while ( ( m_PQHash[m_PQmin].m_Next ) == NULL ) + while ( ( m_PQHash[m_PQmin].m_Next ) == ITK_NULLPTR ) { m_PQmin += 1; } @@ -518,7 +523,7 @@ { FortuneHalfEdge *last; - if ( ( task->m_Vert ) != NULL ) + if ( ( task->m_Vert ) != ITK_NULLPTR ) { last = &( m_PQHash[PQbucket(task)] ); while ( ( last->m_Next ) != task ) @@ -527,7 +532,7 @@ } last->m_Next = ( task->m_Next ); m_PQcount--; - task->m_Vert = NULL; + task->m_Vert = ITK_NULLPTR; } } @@ -571,7 +576,7 @@ FortuneHalfEdge *last = &( m_PQHash[PQbucket(he)] ); FortuneHalfEdge *enext; - while ( ( ( enext = ( last->m_Next ) ) != NULL ) + while ( ( ( enext = ( last->m_Next ) ) != ITK_NULLPTR ) && ( ( ( he->m_Ystar ) > ( enext->m_Ystar ) ) || ( ( ( he->m_Ystar ) == ( enext->m_Ystar ) ) && ( ( v->m_Coord[0] ) > ( enext->m_Vert->m_Coord[0] ) ) ) ) ) @@ -590,7 +595,7 @@ double dx = ( s1->m_Coord[0] ) - ( s2->m_Coord[0] ); double dy = ( s1->m_Coord[1] ) - ( s2->m_Coord[1] ); - return ( vcl_sqrt(dx * dx + dy * dy) ); + return ( std::sqrt(dx * dx + dy * dy) ); } template< typename TCoordRepType > @@ -599,14 +604,14 @@ { if ( ( b < 0 ) || ( b >= static_cast< int >( m_ELhashsize ) ) ) { - return ( NULL ); + return ( ITK_NULLPTR ); } FortuneHalfEdge *he = m_ELHash[b]; - if ( he == NULL ) + if ( he == ITK_NULLPTR ) { return ( he ); } - if ( he->m_Edge == NULL ) + if ( he->m_Edge == ITK_NULLPTR ) { return ( he ); } @@ -614,9 +619,9 @@ { return ( he ); } - m_ELHash[b] = NULL; + m_ELHash[b] = ITK_NULLPTR; - return ( NULL ); + return ( ITK_NULLPTR ); } template< typename TCoordRepType > @@ -635,12 +640,12 @@ bucket = static_cast< int >( m_ELhashsize ) - 1; } FortuneHalfEdge *he = ELgethash(bucket); - if ( he == NULL ) + if ( he == ITK_NULLPTR ) { for ( i = 1; 1; i++ ) { - if ( ( he = ELgethash(bucket - i) ) != NULL ) { break; } - if ( ( he = ELgethash(bucket + i) ) != NULL ) { break; } + if ( ( he = ELgethash(bucket - i) ) != ITK_NULLPTR ) { break; } + if ( ( he = ELgethash(bucket + i) ) != ITK_NULLPTR ) { break; } } } @@ -673,7 +678,7 @@ typename VoronoiDiagram2DGenerator< TCoordRepType >::FortuneSite * VoronoiDiagram2DGenerator< TCoordRepType >::getRightReg(FortuneHalfEdge *he) { - if ( ( he->m_Edge ) == NULL ) + if ( ( he->m_Edge ) == ITK_NULLPTR ) { return ( m_BottomSite ); } @@ -691,7 +696,7 @@ typename VoronoiDiagram2DGenerator< TCoordRepType >::FortuneSite * VoronoiDiagram2DGenerator< TCoordRepType >::getLeftReg(FortuneHalfEdge *he) { - if ( ( he->m_Edge ) == NULL ) + if ( ( he->m_Edge ) == ITK_NULLPTR ) { return ( m_BottomSite ); } @@ -721,8 +726,8 @@ { answer->m_Reg[0] = s1; answer->m_Reg[1] = s2; - answer->m_Ep[0] = NULL; - answer->m_Ep[1] = NULL; + answer->m_Ep[0] = ITK_NULLPTR; + answer->m_Ep[1] = ITK_NULLPTR; double dx = ( s2->m_Coord[0] ) - ( s1->m_Coord[0] ); double dy = ( s2->m_Coord[1] ) - ( s1->m_Coord[1] ); @@ -759,12 +764,12 @@ FortuneHalfEdge *saveHE; FortuneEdge * saveE; - if ( e1 == NULL ) + if ( e1 == ITK_NULLPTR ) { newV->m_Sitenbr = -1; return; } - if ( e2 == NULL ) + if ( e2 == ITK_NULLPTR ) { newV->m_Sitenbr = -2; return; @@ -825,7 +830,7 @@ void VoronoiDiagram2DGenerator< TCoordRepType >::clip_line(FortuneEdge *task) { -/* clip line */ + /* clip line */ FortuneSite *s1; FortuneSite *s2; double x1, y1, x2, y2; @@ -845,7 +850,7 @@ int id2; if ( ( task->m_A ) == 1.0 ) { - if ( ( s1 != NULL ) && ( ( s1->m_Coord[1] ) > m_Pymin ) ) + if ( ( s1 != ITK_NULLPTR ) && ( ( s1->m_Coord[1] ) > m_Pymin ) ) { y1 = s1->m_Coord[1]; if ( y1 > m_Pymax ) @@ -862,7 +867,7 @@ id1 = -1; } - if ( ( s2 != NULL ) && ( ( s2->m_Coord[1] ) < m_Pymax ) ) + if ( ( s2 != ITK_NULLPTR ) && ( ( s2->m_Coord[1] ) < m_Pymax ) ) { y2 = s2->m_Coord[1]; if ( y2 < m_Pymin ) @@ -914,7 +919,7 @@ } else { - if ( ( s1 != NULL ) && ( ( s1->m_Coord[0] ) > m_Pxmin ) ) + if ( ( s1 != ITK_NULLPTR ) && ( ( s1->m_Coord[0] ) > m_Pxmin ) ) { x1 = s1->m_Coord[0]; if ( x1 > m_Pxmax ) @@ -930,7 +935,7 @@ y1 = ( task->m_C ) - ( task->m_A ) * x1; id1 = -1; } - if ( ( s2 != NULL ) && ( ( s2->m_Coord[0] ) < m_Pxmax ) ) + if ( ( s2 != ITK_NULLPTR ) && ( ( s2->m_Coord[0] ) < m_Pxmax ) ) { x2 = s2->m_Coord[0]; if ( x2 < m_Pxmin ) @@ -1022,7 +1027,7 @@ VoronoiDiagram2DGenerator< TCoordRepType >::makeEndPoint(FortuneEdge *task, bool lr, FortuneSite *ends) { task->m_Ep[lr] = ends; - if ( ( task->m_Ep[1 - lr] ) == NULL ) + if ( ( task->m_Ep[1 - lr] ) == ITK_NULLPTR ) { return; } @@ -1043,13 +1048,13 @@ m_SeedSites[i].m_Coord = m_Seeds[i]; m_SeedSites[i].m_Sitenbr = i; } -/* Initialize Boundary. */ + /* Initialize Boundary. */ m_Pxmax = m_VorBoundary[0]; m_Pymax = m_VorBoundary[1]; m_Deltay = m_Pymax - m_Pymin; m_Deltax = m_Pxmax - m_Pxmin; - m_SqrtNSites = vcl_sqrt( (float)( m_NumberOfSeeds + 4 ) ); + m_SqrtNSites = std::sqrt( (float)( m_NumberOfSeeds + 4 ) ); /* Initialize outputLists. */ m_Nedges = 0; @@ -1065,20 +1070,20 @@ m_PQHash.resize(m_PQhashsize); for ( i = 0; i < m_PQhashsize; i++ ) { - m_PQHash[i].m_Next = NULL; + m_PQHash[i].m_Next = ITK_NULLPTR; } m_ELhashsize = (int)( 2 * m_SqrtNSites ); m_ELHash.resize(m_ELhashsize); for ( i = 0; i < m_ELhashsize; i++ ) { - m_ELHash[i] = NULL; + m_ELHash[i] = ITK_NULLPTR; } - createHalfEdge(&( m_ELleftend ), NULL, 0); - createHalfEdge(&( m_ELrightend ), NULL, 0); - m_ELleftend.m_Left = NULL; + createHalfEdge(&( m_ELleftend ), ITK_NULLPTR, 0); + createHalfEdge(&( m_ELrightend ), ITK_NULLPTR, 0); + m_ELleftend.m_Left = ITK_NULLPTR; m_ELleftend.m_Right = &( m_ELrightend ); m_ELrightend.m_Left = &( m_ELleftend ); - m_ELrightend.m_Right = NULL; + m_ELrightend.m_Right = ITK_NULLPTR; m_ELHash[0] = &( m_ELleftend ); m_ELHash[m_ELhashsize - 1] = &( m_ELrightend ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiPartitioningImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiPartitioningImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiPartitioningImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiPartitioningImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -187,7 +187,7 @@ double savevar; if ( num > 1 ) { - savevar = vcl_sqrt( ( addpp - ( addp * addp ) / static_cast< double >( num ) ) + savevar = std::sqrt( ( addpp - ( addp * addp ) / static_cast< double >( num ) ) / ( static_cast< double >( num ) - 1.0 ) ); } else @@ -195,7 +195,7 @@ savevar = -1; } - return ( savevar >= 0 && vcl_sqrt(savevar) < m_SigmaThreshold ); + return ( savevar >= 0 && std::sqrt(savevar) < m_SigmaThreshold ); } template< typename TInputImage, typename TOutputImage > diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilterBase.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilterBase.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilterBase.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilterBase.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,20 +29,21 @@ /* Constructor: setting the default parameter values. */ template< typename TInputImage, typename TOutputImage, typename TBinaryPriorImage > VoronoiSegmentationImageFilterBase< TInputImage, TOutputImage, TBinaryPriorImage > -::VoronoiSegmentationImageFilterBase() +::VoronoiSegmentationImageFilterBase() : + m_NumberOfSeeds(200), + m_MinRegion(20), + m_Steps(0), + m_LastStepSeeds(0), + m_NumberOfSeedsToAdded(0), + m_NumberOfBoundary(0), + m_MeanDeviation(0.8), + m_UseBackgroundInAPrior(false), + m_OutputBoundary(false), + m_InteractiveSegmentation(false), + m_WorkingVD(VoronoiDiagram::New()), + m_VDGenerator(VoronoiDiagramGenerator::New()) { m_Size.Fill(0); - m_MinRegion = 20; - m_Steps = 0; - m_LastStepSeeds = 0; - m_NumberOfSeeds = 200; - m_NumberOfSeedsToAdded = 0; - m_MeanDeviation = 0.8; - m_UseBackgroundInAPrior = false; - m_OutputBoundary = false; - m_InteractiveSegmentation = false; - m_WorkingVD = VoronoiDiagram::New(); - m_VDGenerator = VoronoiDiagramGenerator::New(); } /* Destructor. */ @@ -125,7 +126,7 @@ rightP = vertlist.back(); double beginy = currP[1]; - int intbeginy = (int)vcl_ceil(beginy); + int intbeginy = (int)std::ceil(beginy); idx[1] = intbeginy; double leftendy = leftP[1]; double rightendy = rightP[1]; @@ -169,7 +170,7 @@ rightDx = ( rightP[0] - endx ) / ( rightP[1] - beginy ); } - int intendy = (int)vcl_floor(endy); + int intendy = (int)std::floor(endy); if ( intbeginy > intendy ) { //no scanline if ( RorL ) @@ -191,7 +192,7 @@ { beginx = leftP[0]; } - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; ( *PixelPool ).push_back(idx); @@ -205,7 +206,7 @@ beginx += offset * leftDx; while ( idx[1] <= intendy ) { - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; ( *PixelPool ).push_back(idx); @@ -271,8 +272,8 @@ endy = leftendy; } - intendy = (int)vcl_floor(endy); - intbeginy = (int)vcl_ceil(beginy); + intendy = (int)std::floor(endy); + intbeginy = (int)std::ceil(beginy); if ( intbeginy > intendy ) { //no scanline @@ -292,7 +293,7 @@ beginx += offset * leftDx; while ( idx[1] <= intendy ) { - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; ( *PixelPool ).push_back(idx); @@ -315,8 +316,8 @@ beginy = leftP[1]; endy = rightP[1]; } - intbeginy = (int)vcl_ceil(beginy); - intendy = (int)vcl_floor(endy); + intbeginy = (int)std::ceil(beginy); + intendy = (int)std::floor(endy); if ( intbeginy <= intendy ) { if ( RorL ) @@ -350,7 +351,7 @@ endx += offset * rightDx; while ( idx[1] <= intendy ) { - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; ( *PixelPool ).push_back(idx); @@ -689,7 +690,7 @@ rightP = vertlist.back(); double beginy = currP[1]; - int intbeginy = (int)vcl_ceil(beginy); + int intbeginy = (int)std::ceil(beginy); idx[1] = intbeginy; double leftendy = leftP[1]; double rightendy = rightP[1]; @@ -731,7 +732,7 @@ { rightDx = ( rightP[0] - endx ) / ( rightP[1] - beginy ); } - int intendy = (int)vcl_floor(endy); + int intendy = (int)std::floor(endy); if ( intbeginy > intendy ) { //no scanline if ( RorL ) @@ -753,7 +754,7 @@ { beginx = leftP[0]; } - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; output->SetPixel(idx, color); @@ -767,7 +768,7 @@ beginx += offset * leftDx; while ( idx[1] <= intendy ) { - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; output->SetPixel(idx, color); @@ -833,8 +834,8 @@ endy = leftendy; } - intendy = (int)vcl_floor(endy); - intbeginy = (int)vcl_ceil(beginy); + intendy = (int)std::floor(endy); + intbeginy = (int)std::ceil(beginy); if ( intbeginy > intendy ) { //no scanline @@ -854,7 +855,7 @@ beginx += offset * leftDx; while ( idx[1] <= intendy ) { - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; output->SetPixel(idx, color); @@ -877,8 +878,8 @@ beginy = leftP[1]; endy = rightP[1]; } - intbeginy = (int)vcl_ceil(beginy); - intendy = (int)vcl_floor(endy); + intbeginy = (int)std::ceil(beginy); + intendy = (int)std::floor(endy); if ( intbeginy <= intendy ) { if ( RorL ) @@ -912,7 +913,7 @@ endx += offset * rightDx; while ( idx[1] <= intendy ) { - for ( i = static_cast< int >( vcl_ceil(beginx) ); i <= static_cast< int >( vcl_floor(endx) ); i++ ) + for ( i = static_cast< int >( std::ceil(beginx) ); i <= static_cast< int >( std::floor(endx) ); i++ ) { idx[0] = i; output->SetPixel(idx, color); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -81,7 +81,7 @@ if ( num > 1 ) { savemean = addp / num; - saveSTD = vcl_sqrt( ( addpp - ( addp * addp ) / ( num ) ) / ( num - 1 ) ); + saveSTD = std::sqrt( ( addpp - ( addp * addp ) / ( num ) ) / ( num - 1 ) ); } else { @@ -90,7 +90,7 @@ } // // jvm - Mahalanobis distance - // if (savevar > 0 && vcl_fabs(savemean - m_Mean) / m_Var < 2.5) + // if (savevar > 0 && std::fabs(savemean - m_Mean) / m_Var < 2.5) // return true; // else // return false; @@ -197,12 +197,12 @@ } m_Mean = addp / num; - m_STD = vcl_sqrt( ( addpp - ( addp * addp ) / num ) / ( num - 1 ) ); + m_STD = std::sqrt( ( addpp - ( addp * addp ) / num ) / ( num - 1 ) ); float b_Mean = addb / numb; if ( this->GetUseBackgroundInAPrior() ) { - m_MeanTolerance = vcl_fabs(m_Mean - b_Mean) * this->GetMeanDeviation(); + m_MeanTolerance = std::fabs(m_Mean - b_Mean) * this->GetMeanDeviation(); } else { diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationRGBImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationRGBImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationRGBImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationRGBImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -62,7 +62,7 @@ for ( unsigned int i = 0; i < 6; i++ ) { m_MeanPercentError[i] = x[i]; - m_MeanTolerance[i] = vcl_fabs(x[i] * m_Mean[i]); + m_MeanTolerance[i] = std::fabs(x[i] * m_Mean[i]); } } @@ -132,22 +132,22 @@ X = 0.607 * ipixel[0] + 0.174 * ipixel[1] + 0.201 * ipixel[2]; Y = 0.299 * ipixel[0] + 0.587 * ipixel[1] + 0.114 * ipixel[2]; Z = 0.066 * ipixel[1] + 1.117 * ipixel[2]; - X = vcl_pow( ( X / X0 ), 0.3333 ); - Y = vcl_pow( ( Y / Y0 ), 0.3333 ); - Z = vcl_pow( ( Z / Z0 ), 0.3333 ); + X = std::pow( ( X / X0 ), 0.3333 ); + Y = std::pow( ( Y / Y0 ), 0.3333 ); + Z = std::pow( ( Z / Z0 ), 0.3333 ); L = 116 * Y - 16; a = 500 * ( X - Y ); b = 200 * ( Y - Z ); if ( b != 0.0 ) { - wpixel[3] = vcl_atan2(b, a); //H + wpixel[3] = std::atan2(b, a); //H } else { wpixel[3] = 0; } - wpixel[4] = vcl_sqrt(a * a + b * b); //C + wpixel[4] = std::sqrt(a * a + b * b); //C wpixel[5] = L; //V wit.Set(wpixel); ++wit; @@ -181,7 +181,7 @@ for ( i = 0; i < 6; i++ ) { savemean[i] = addp[i] / num; - saveSTD[i] = vcl_sqrt( ( addpp[i] - ( addp[i] * addp[i] ) / ( num ) ) / ( num - 1 ) ); + saveSTD[i] = std::sqrt( ( addpp[i] - ( addp[i] * addp[i] ) / ( num ) ) / ( num - 1 ) ); } } else @@ -320,21 +320,57 @@ for ( unsigned int i = 0; i < 6; i++ ) { m_Mean[i] = objaddp[i] / objnum; - m_STD[i] = vcl_sqrt( ( objaddpp[i] - ( objaddp[i] * objaddp[i] ) / objnum ) / ( objnum - 1 ) ); + m_STD[i] = std::sqrt( ( objaddpp[i] - ( objaddp[i] * objaddp[i] ) / objnum ) / ( objnum - 1 ) ); m_STDTolerance[i] = m_STD[i] * m_STDPercentError[i]; - b_Mean[i] = bkgaddp[i] / bkgnum; - b_STD[i] = vcl_sqrt( ( bkgaddpp[i] - ( bkgaddp[i] * bkgaddp[i] ) / bkgnum ) / ( bkgnum - 1 ) ); - diffMean[i] = ( b_Mean[i] - m_Mean[i] ) / m_Mean[i]; - if ( diffMean[i] < 0 ) { diffMean[i] = -diffMean[i]; } - diffSTD[i] = ( b_STD[i] - m_STD[i] ) / m_STD[i]; - if ( diffSTD[i] < 0 ) { diffSTD[i] = -diffSTD[i]; } + if (bkgnum > 0) + { + b_Mean[i] = bkgaddp[i] / bkgnum; + } + else + { + b_Mean[i] = 0.0; + } + if (bkgnum > 1) + { + b_STD[i] = + std::sqrt( ( bkgaddpp[i] - ( bkgaddp[i] * bkgaddp[i] ) / bkgnum ) + / ( bkgnum - 1 ) ); + } + else + { + b_STD[i] = 0.0; + } + if (m_Mean[i] != 0.0) + { + diffMean[i] = ( b_Mean[i] - m_Mean[i] ) / m_Mean[i]; + } + else + { + diffMean[i] = 0.0; + } + if ( diffMean[i] < 0 ) + { + diffMean[i] = -diffMean[i]; + } + if (m_STD[i] != 0.0) + { + diffSTD[i] = ( b_STD[i] - m_STD[i] ) / m_STD[i]; + } + else + { + diffSTD[i] = 0.0; + } + if ( diffSTD[i] < 0 ) + { + diffSTD[i] = -diffSTD[i]; + } if ( this->GetUseBackgroundInAPrior() ) { m_MeanTolerance[i] = diffMean[i] * m_Mean[i] * this->GetMeanDeviation(); } else { - m_MeanTolerance[i] = vcl_fabs(m_Mean[i] * m_MeanPercentError[i]); + m_MeanTolerance[i] = std::fabs(m_Mean[i] * m_MeanPercentError[i]); } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkIsolatedWatershedImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -123,8 +123,8 @@ const unsigned int maximumIterationsInBinarySearch = static_cast< unsigned int >( - vcl_log( ( static_cast< float >( upper ) - static_cast< float >( lower ) ) - / static_cast< float >( m_IsolatedValueTolerance ) ) / vcl_log(2.0) ); + std::log( ( static_cast< float >( upper ) - static_cast< float >( lower ) ) + / static_cast< float >( m_IsolatedValueTolerance ) ) / std::log(2.0) ); const float progressWeight = 1.0f / static_cast< float >( maximumIterationsInBinarySearch + 2 ); float cumulatedProgress = 0.0f; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkOneWayEquivalencyTable.h 2014-09-03 08:29:34.000000000 +0000 @@ -129,7 +129,7 @@ OneWayEquivalencyTable(const Self &); // purposely not implemented void operator=(const Self &); // purposely not implemented - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; HashTableType m_HashMap; }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundary.h 2014-09-03 08:29:34.000000000 +0000 @@ -200,7 +200,7 @@ virtual ~Boundary() {} Boundary(const Self &) {} void operator=(const Self &) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** The Nx2 matrix of faces of this boundary. */ std::vector< std::pair< FacePointer, FacePointer > > m_Faces; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundaryResolver.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundaryResolver.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundaryResolver.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedBoundaryResolver.h 2014-09-03 08:29:34.000000000 +0000 @@ -111,12 +111,12 @@ } /** Standard non-threaded pipeline method */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Standard itk::ProcessObject subclass method. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; protected: BoundaryResolver():m_Face(0) @@ -131,10 +131,10 @@ virtual ~BoundaryResolver() {} BoundaryResolver(const Self &) {} void operator=(const Self &) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; unsigned short m_Face; - void GenerateOutputRequestedRegion(DataObject *output); + virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE; }; } // end namespace watershed } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedEquivalenceRelabeler.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedEquivalenceRelabeler.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedEquivalenceRelabeler.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedEquivalenceRelabeler.h 2014-09-03 08:29:34.000000000 +0000 @@ -106,12 +106,12 @@ } /** Standard non-threaded pipeline method */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Standard itk::ProcessObject subclass method. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; protected: EquivalenceRelabeler() @@ -125,11 +125,11 @@ virtual ~EquivalenceRelabeler() {} EquivalenceRelabeler(const Self &) {} void operator=(const Self &) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; - void GenerateOutputRequestedRegion(DataObject *output); + virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; }; } // end namespace watershed } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedMiniPipelineProgressCommand.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedMiniPipelineProgressCommand.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedMiniPipelineProgressCommand.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedMiniPipelineProgressCommand.h 2014-09-03 08:29:34.000000000 +0000 @@ -42,9 +42,9 @@ itkNewMacro(Self); /** Standard Command virtual methods */ - void Execute(Object *caller, const EventObject & event); + virtual void Execute(Object *caller, const EventObject & event) ITK_OVERRIDE; - void Execute(const Object *caller, const EventObject & event); + virtual void Execute(const Object *caller, const EventObject & event) ITK_OVERRIDE; /** Set/Get the filter whose UpdateProgress will be set by this * command object */ @@ -63,10 +63,10 @@ itkGetConstMacro(NumberOfFilters, double); protected: - WatershedMiniPipelineProgressCommand():m_Count(0.0), m_Filter(NULL), + WatershedMiniPipelineProgressCommand():m_Count(0.0), m_Filter(ITK_NULLPTR), m_NumberOfFilters(1.0) {} virtual ~WatershedMiniPipelineProgressCommand() {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: double m_Count; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedRelabeler.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedRelabeler.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedRelabeler.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedRelabeler.h 2014-09-03 08:29:34.000000000 +0000 @@ -88,7 +88,7 @@ /** Standard itk::ProcessObject subclass method. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** Set/Get the input image */ void SetInputImage(ImageType *img) @@ -127,7 +127,7 @@ } /** Standard non-threaded pipeline method */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Set/Get the percentage of the maximum saliency level * to merge to. */ @@ -144,12 +144,12 @@ virtual ~Relabeler() {} Relabeler(const Self &) {} void operator=(const Self &) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; double m_FloodLevel; - void GenerateOutputRequestedRegion(DataObject *output); + virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; }; } // end namespace watershed } // end namespace itk diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.h 2014-09-03 08:29:34.000000000 +0000 @@ -172,7 +172,7 @@ { this->ProcessObject::SetNthOutput(2, b); } /** Standard non-threaded pipeline execution method. */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** This method is necessary until the streaming mechanisms of the Itk * pipeline are full fleshed out. It is only used for streaming @@ -199,7 +199,7 @@ /** Standard itk::ProcessObject subclass method. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; /** Gets/Sets the initial label (IdentifierType integer value) used * by the labeling algorithm. Only necessary for streaming applications. */ @@ -267,7 +267,7 @@ Segmenter(); Segmenter(const Self &) {} virtual ~Segmenter(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; void operator=(const Self &) {} @@ -278,11 +278,11 @@ /** This method asks for an image region that is one pixel larger * at each boundary than the region being processed. This single pixel * expansion represents an overlap with adjacent image chunks */ - void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; - void GenerateOutputRequestedRegion(DataObject *output); + virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE; - void UpdateOutputInformation(); + virtual void UpdateOutputInformation() ITK_OVERRIDE; /** Allocates boundary structure information and sets the * boundary data to null values. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -325,7 +325,6 @@ ImageRegionIterator< OutputImageType > labelIt; typename BoundaryType::face_t::Pointer face; - typedef typename BoundaryType::flat_hash_t flats_t; typename BoundaryType::flat_hash_t * flats; typename BoundaryType::flat_hash_t::iterator flats_it; typename BoundaryType::flat_region_t flr; @@ -953,7 +952,7 @@ // and update its minimum value if necessary. segment_ptr = segments->Lookup(segment_label); edge_table_entry_ptr = edgeHash.find(segment_label); - if ( segment_ptr == 0 ) // This segment not yet identified. + if ( segment_ptr == ITK_NULLPTR ) // This segment not yet identified. { // So add it to the table. temp_segment.min = searchIt.GetPixel(hoodCenter); segments->Add(segment_label, temp_segment); @@ -1016,7 +1015,7 @@ { // Lookup the corresponding segment entry segment_ptr = segments->Lookup( ( *edge_table_entry_ptr ).first ); - if ( segment_ptr == 0 ) + if ( segment_ptr == ITK_NULLPTR ) { itkGenericExceptionMacro (<< "UpdateSegmentTable:: An unexpected and fatal error has occurred."); } @@ -1252,7 +1251,7 @@ { return BoundaryType::New().GetPointer(); } - else { return 0; } + else { return ITK_NULLPTR; } } template< typename TInputImage > @@ -1354,8 +1353,8 @@ m_CurrentLabel = 1; m_DoBoundaryAnalysis = false; m_SortEdgeLists = true; - m_Connectivity.direction = 0; - m_Connectivity.index = 0; + m_Connectivity.direction = ITK_NULLPTR; + m_Connectivity.index = ITK_NULLPTR; typename OutputImageType::Pointer img = static_cast< OutputImageType * >( this->MakeOutput(0).GetPointer() ); typename SegmentTableType::Pointer st = diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTable.h 2014-09-03 08:29:34.000000000 +0000 @@ -112,7 +112,7 @@ { Iterator result = m_HashMap.find(a); - if ( result == m_HashMap.end() ) { return 0; } + if ( result == m_HashMap.end() ) { return ITK_NULLPTR; } else { return &( ( *result ).second ); } } @@ -203,7 +203,9 @@ } protected: - SegmentTable() {} + SegmentTable() : + m_MaximumDepth(0) + {} virtual ~SegmentTable() {} HashMapType m_HashMap; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.h 2014-09-03 08:29:34.000000000 +0000 @@ -140,7 +140,7 @@ } /** Standard non-threaded itk pipeline method */ - void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** Get/Set a boolean flag indicating whether or not to pre-merge the segments marked as equivalent in the EquivalencyTable. This is only @@ -190,14 +190,14 @@ /** Standard itk::ProcessObject subclass method. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; protected: SegmentTreeGenerator(); virtual ~SegmentTreeGenerator() {} SegmentTreeGenerator(const Self &) {} void operator=(const Self &) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Generates an initial list of all potentential merges in * the segment table. */ @@ -210,9 +210,9 @@ void MergeEquivalencies(); /** Methods required by the itk pipeline */ - void GenerateOutputRequestedRegion(DataObject *output); + virtual void GenerateOutputRequestedRegion(DataObject *output) ITK_OVERRIDE; - void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; private: bool m_Merge; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.hxx otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.hxx --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTreeGenerator.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -430,7 +430,7 @@ typename SegmentTableType::segment_t * from_seg = segments->Lookup(FROM); typename SegmentTableType::segment_t * to_seg = segments->Lookup(TO); - if ( from_seg == 0 || to_seg == 0 ) + if ( from_seg == ITK_NULLPTR || to_seg == ITK_NULLPTR ) { itkGenericExceptionMacro ( << diff -Nru otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTree.h otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTree.h --- otb-4.0.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTree.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Segmentation/Watersheds/include/itkWatershedSegmentTree.h 2014-09-03 08:29:34.000000000 +0000 @@ -157,14 +157,14 @@ /** Standard DataObject routine to initialize. Returns the segment * tree to a default state, deallocating memory. */ - void Initialize(); + virtual void Initialize() ITK_OVERRIDE; protected: SegmentTree() {} virtual ~SegmentTree() {} SegmentTree(const Self &) {} void operator=(const Self &) {} - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; DequeType m_Deque; }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum.cc otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum.cc --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum.cc 2014-09-03 08:29:34.000000000 +0000 @@ -40,6 +40,7 @@ template static int BitSize(S value) { + (void) value; // Mark variable as used. return 8 * sizeof(value); } @@ -122,9 +123,8 @@ static int HexCharValue(char c) { if ('0' <= c && c <= '9') return c - '0'; if ('a' <= c && c <= 'f') return 10 + c - 'a'; - if ('A' <= c && c <= 'F') return 10 + c - 'A'; - UNREACHABLE(); - return 0; // To make compiler happy. + ASSERT('A' <= c && c <= 'F'); + return 10 + c - 'A'; } @@ -505,9 +505,10 @@ // is big. This function is implemented for doubleToString where // the result should be small (less than 10). ASSERT(other.bigits_[other.used_digits_ - 1] >= ((1 << kBigitSize) / 16)); + ASSERT(bigits_[used_digits_ - 1] < 0x10000); // Remove the multiples of the first digit. // Example this = 23 and other equals 9. -> Remove 2 multiples. - result += bigits_[used_digits_ - 1]; + result += static_cast(bigits_[used_digits_ - 1]); SubtractTimes(other, bigits_[used_digits_ - 1]); } @@ -523,13 +524,15 @@ // Shortcut for easy (and common) case. int quotient = this_bigit / other_bigit; bigits_[used_digits_ - 1] = this_bigit - other_bigit * quotient; - result += quotient; + ASSERT(quotient < 0x10000); + result += static_cast(quotient); Clamp(); return result; } int division_estimate = this_bigit / (other_bigit + 1); - result += division_estimate; + ASSERT(division_estimate < 0x10000); + result += static_cast(division_estimate); SubtractTimes(other, division_estimate); if (other_bigit * (division_estimate + 1) > this_bigit) { @@ -560,8 +563,8 @@ static char HexCharOfValue(int value) { ASSERT(0 <= value && value <= 16); - if (value < 10) return value + '0'; - return value - 10 + 'A'; + if (value < 10) return static_cast(value + '0'); + return static_cast(value - 10 + 'A'); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum-dtoa.cc otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum-dtoa.cc --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum-dtoa.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/bignum-dtoa.cc 2014-09-03 08:29:34.000000000 +0000 @@ -192,13 +192,13 @@ delta_plus = delta_minus; } *length = 0; - while (true) { + for (;;) { uint16_t digit; digit = numerator->DivideModuloIntBignum(*denominator); ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive. // digit = numerator / denominator (integer division). // numerator = numerator % denominator. - buffer[(*length)++] = digit + '0'; + buffer[(*length)++] = static_cast(digit + '0'); // Can we stop already? // If the remainder of the division is less than the distance to the lower @@ -282,7 +282,7 @@ // exponent (decimal_point), when rounding upwards. static void GenerateCountedDigits(int count, int* decimal_point, Bignum* numerator, Bignum* denominator, - Vector(buffer), int* length) { + Vector buffer, int* length) { ASSERT(count >= 0); for (int i = 0; i < count - 1; ++i) { uint16_t digit; @@ -290,7 +290,7 @@ ASSERT(digit <= 9); // digit is a uint16_t and therefore always positive. // digit = numerator / denominator (integer division). // numerator = numerator % denominator. - buffer[i] = digit + '0'; + buffer[i] = static_cast(digit + '0'); // Prepare for next iteration. numerator->Times10(); } @@ -300,7 +300,8 @@ if (Bignum::PlusCompare(*numerator, *numerator, *denominator) >= 0) { digit++; } - buffer[count - 1] = digit + '0'; + ASSERT(digit <= 10); + buffer[count - 1] = static_cast(digit + '0'); // Correct bad digits (in case we had a sequence of '9's). Propagate the // carry until we hat a non-'9' or til we reach the first digit. for (int i = count - 1; i > 0; --i) { diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/cached-powers.cc otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/cached-powers.cc --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/cached-powers.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/cached-powers.cc 2014-09-03 08:29:34.000000000 +0000 @@ -152,6 +152,7 @@ ASSERT(0 <= index && index < kCachedPowersLength); CachedPower cached_power = kCachedPowers[index]; ASSERT(min_exponent <= cached_power.binary_exponent); + (void) max_exponent; // Mark variable as used. ASSERT(cached_power.binary_exponent <= max_exponent); *decimal_exponent = cached_power.decimal_exponent; *power = DiyFp(cached_power.significand, cached_power.binary_exponent); diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -30,21 +30,14 @@ itk_module_target(itkdouble-conversion NO_INSTALL) # -# associates the list of headers with the library -# for the purposes of installation/import into other projects -# # install command to set up library install # given the above PUBLIC_HEADER property set, this # pulls along all the header files with the library. -if(NOT ITK_INSTALL_NO_LIBRARIES) - install(TARGETS itkdouble-conversion - EXPORT ${ITKDoubleConversion-targets} - RUNTIME DESTINATION "${ITKDoubleConversion_INSTALL_RUNTIME_DIR}" COMPONENT Applications - LIBRARY DESTINATION "${ITKDoubleConversion_INSTALL_LIBRARY_DIR}" COMPONENT Libraries - ARCHIVE DESTINATION "${ITKDoubleConversion_INSTALL_LIBRARY_DIR}" COMPONENT Development) -endif() +install(TARGETS itkdouble-conversion + EXPORT ${ITKDoubleConversion-targets} + RUNTIME DESTINATION "${ITKDoubleConversion_INSTALL_RUNTIME_DIR}" COMPONENT Applications + LIBRARY DESTINATION "${ITKDoubleConversion_INSTALL_LIBRARY_DIR}" COMPONENT Libraries + ARCHIVE DESTINATION "${ITKDoubleConversion_INSTALL_LIBRARY_DIR}" COMPONENT Development) -if(NOT ITK_INSTALL_NO_DEVELOPMENT) - install(FILES ${headers} - DESTINATION "${ITKDoubleConversion_INSTALL_INCLUDE_DIR}" COMPONENT Development) -endif() +install(FILES ${headers} + DESTINATION "${ITKDoubleConversion_INSTALL_INCLUDE_DIR}" COMPONENT Development) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.cc otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.cc --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.cc 2014-09-03 08:29:34.000000000 +0000 @@ -348,7 +348,6 @@ case DoubleToStringConverter::PRECISION: return BIGNUM_DTOA_PRECISION; default: UNREACHABLE(); - return BIGNUM_DTOA_SHORTEST; // To silence compiler. } } @@ -403,8 +402,8 @@ vector, length, point); break; default: - UNREACHABLE(); fast_worked = false; + UNREACHABLE(); } if (fast_worked) return; @@ -417,8 +416,9 @@ // Consumes the given substring from the iterator. // Returns false, if the substring does not match. -static bool ConsumeSubString(const char** current, - const char* end, +template +static bool ConsumeSubString(Iterator* current, + Iterator end, const char* substring) { ASSERT(**current == *substring); for (substring++; *substring != '\0'; substring++) { @@ -440,10 +440,36 @@ const int kMaxSignificantDigits = 772; +static const char kWhitespaceTable7[] = { 32, 13, 10, 9, 11, 12 }; +static const int kWhitespaceTable7Length = ARRAY_SIZE(kWhitespaceTable7); + + +static const uc16 kWhitespaceTable16[] = { + 160, 8232, 8233, 5760, 6158, 8192, 8193, 8194, 8195, + 8196, 8197, 8198, 8199, 8200, 8201, 8202, 8239, 8287, 12288, 65279 +}; +static const int kWhitespaceTable16Length = ARRAY_SIZE(kWhitespaceTable16); + + +static bool isWhitespace(int x) { + if (x < 128) { + for (int i = 0; i < kWhitespaceTable7Length; i++) { + if (kWhitespaceTable7[i] == x) return true; + } + } else { + for (int i = 0; i < kWhitespaceTable16Length; i++) { + if (kWhitespaceTable16[i] == x) return true; + } + } + return false; +} + + // Returns true if a nonspace found and false if the end has reached. -static inline bool AdvanceToNonspace(const char** current, const char* end) { +template +static inline bool AdvanceToNonspace(Iterator* current, Iterator end) { while (*current != end) { - if (**current != ' ') return true; + if (!isWhitespace(**current)) return true; ++*current; } return false; @@ -462,26 +488,50 @@ } +// Returns true if 'c' is a decimal digit that is valid for the given radix. +// +// The function is small and could be inlined, but VS2012 emitted a warning +// because it constant-propagated the radix and concluded that the last +// condition was always true. By moving it into a separate function the +// compiler wouldn't warn anymore. +static bool IsDecimalDigitForRadix(int c, int radix) { + return '0' <= c && c <= '9' && (c - '0') < radix; +} + +// Returns true if 'c' is a character digit that is valid for the given radix. +// The 'a_character' should be 'a' or 'A'. +// +// The function is small and could be inlined, but VS2012 emitted a warning +// because it constant-propagated the radix and concluded that the first +// condition was always false. By moving it into a separate function the +// compiler wouldn't warn anymore. +static bool IsCharacterDigitForRadix(int c, int radix, char a_character) { + return radix > 10 && c >= a_character && c < a_character + radix - 10; +} + + // Parsing integers with radix 2, 4, 8, 16, 32. Assumes current != end. -template -static double RadixStringToIeee(const char* current, - const char* end, +template +static double RadixStringToIeee(Iterator* current, + Iterator end, bool sign, bool allow_trailing_junk, double junk_string_value, bool read_as_double, - const char** trailing_pointer) { - ASSERT(current != end); + bool* result_is_junk) { + ASSERT(*current != end); const int kDoubleSize = Double::kSignificandSize; const int kSingleSize = Single::kSignificandSize; const int kSignificandSize = read_as_double? kDoubleSize: kSingleSize; + *result_is_junk = true; + // Skip leading 0s. - while (*current == '0') { - ++current; - if (current == end) { - *trailing_pointer = end; + while (**current == '0') { + ++(*current); + if (*current == end) { + *result_is_junk = false; return SignedZero(sign); } } @@ -492,14 +542,14 @@ do { int digit; - if (*current >= '0' && *current <= '9' && *current < '0' + radix) { - digit = static_cast(*current) - '0'; - } else if (radix > 10 && *current >= 'a' && *current < 'a' + radix - 10) { - digit = static_cast(*current) - 'a' + 10; - } else if (radix > 10 && *current >= 'A' && *current < 'A' + radix - 10) { - digit = static_cast(*current) - 'A' + 10; + if (IsDecimalDigitForRadix(**current, radix)) { + digit = static_cast(**current) - '0'; + } else if (IsCharacterDigitForRadix(**current, radix, 'a')) { + digit = static_cast(**current) - 'a' + 10; + } else if (IsCharacterDigitForRadix(**current, radix, 'A')) { + digit = static_cast(**current) - 'A' + 10; } else { - if (allow_trailing_junk || !AdvanceToNonspace(¤t, end)) { + if (allow_trailing_junk || !AdvanceToNonspace(current, end)) { break; } else { return junk_string_value; @@ -523,14 +573,14 @@ exponent = overflow_bits_count; bool zero_tail = true; - while (true) { - ++current; - if (current == end || !isDigit(*current, radix)) break; - zero_tail = zero_tail && *current == '0'; + for (;;) { + ++(*current); + if (*current == end || !isDigit(**current, radix)) break; + zero_tail = zero_tail && **current == '0'; exponent += radix_log_2; } - if (!allow_trailing_junk && AdvanceToNonspace(¤t, end)) { + if (!allow_trailing_junk && AdvanceToNonspace(current, end)) { return junk_string_value; } @@ -552,13 +602,13 @@ } break; } - ++current; - } while (current != end); + ++(*current); + } while (*current != end); ASSERT(number < ((int64_t)1 << kSignificandSize)); ASSERT(static_cast(static_cast(number)) == number); - *trailing_pointer = current; + *result_is_junk = false; if (exponent == 0) { if (sign) { @@ -573,13 +623,14 @@ } +template double StringToDoubleConverter::StringToIeee( - const char* input, + Iterator input, int length, - int* processed_characters_count, - bool read_as_double) const { - const char* current = input; - const char* end = input + length; + bool read_as_double, + int* processed_characters_count) const { + Iterator current = input; + Iterator end = input + length; *processed_characters_count = 0; @@ -600,7 +651,7 @@ if (allow_leading_spaces || allow_trailing_spaces) { if (!AdvanceToNonspace(¤t, end)) { - *processed_characters_count = current - input; + *processed_characters_count = static_cast(current - input); return empty_string_value_; } if (!allow_leading_spaces && (input != current)) { @@ -626,7 +677,7 @@ if (*current == '+' || *current == '-') { sign = (*current == '-'); ++current; - const char* next_non_space = current; + Iterator next_non_space = current; // Skip following spaces (if allowed). if (!AdvanceToNonspace(&next_non_space, end)) return junk_string_value_; if (!allow_spaces_after_sign && (current != next_non_space)) { @@ -649,7 +700,7 @@ } ASSERT(buffer_pos == 0); - *processed_characters_count = current - input; + *processed_characters_count = static_cast(current - input); return sign ? -Double::Infinity() : Double::Infinity(); } } @@ -668,7 +719,7 @@ } ASSERT(buffer_pos == 0); - *processed_characters_count = current - input; + *processed_characters_count = static_cast(current - input); return sign ? -Double::NaN() : Double::NaN(); } } @@ -677,7 +728,7 @@ if (*current == '0') { ++current; if (current == end) { - *processed_characters_count = current - input; + *processed_characters_count = static_cast(current - input); return SignedZero(sign); } @@ -690,17 +741,17 @@ return junk_string_value_; // "0x". } - const char* tail_pointer = NULL; - double result = RadixStringToIeee<4>(current, + bool result_is_junk; + double result = RadixStringToIeee<4>(¤t, end, sign, allow_trailing_junk, junk_string_value_, read_as_double, - &tail_pointer); - if (tail_pointer != NULL) { - if (allow_trailing_spaces) AdvanceToNonspace(&tail_pointer, end); - *processed_characters_count = tail_pointer - input; + &result_is_junk); + if (!result_is_junk) { + if (allow_trailing_spaces) AdvanceToNonspace(¤t, end); + *processed_characters_count = static_cast(current - input); } return result; } @@ -709,7 +760,7 @@ while (*current == '0') { ++current; if (current == end) { - *processed_characters_count = current - input; + *processed_characters_count = static_cast(current - input); return SignedZero(sign); } } @@ -757,7 +808,7 @@ while (*current == '0') { ++current; if (current == end) { - *processed_characters_count = current - input; + *processed_characters_count = static_cast(current - input); return SignedZero(sign); } exponent--; // Move this 0 into the exponent. @@ -855,16 +906,17 @@ if (octal) { double result; - const char* tail_pointer = NULL; - result = RadixStringToIeee<3>(buffer, + bool result_is_junk; + char* start = buffer; + result = RadixStringToIeee<3>(&start, buffer + buffer_pos, sign, allow_trailing_junk, junk_string_value_, read_as_double, - &tail_pointer); - ASSERT(tail_pointer != NULL); - *processed_characters_count = current - input; + &result_is_junk); + ASSERT(!result_is_junk); + *processed_characters_count = static_cast(current - input); return result; } @@ -882,8 +934,42 @@ } else { converted = Strtof(Vector(buffer, buffer_pos), exponent); } - *processed_characters_count = current - input; + *processed_characters_count = static_cast(current - input); return sign? -converted: converted; } + +double StringToDoubleConverter::StringToDouble( + const char* buffer, + int length, + int* processed_characters_count) const { + return StringToIeee(buffer, length, true, processed_characters_count); +} + + +double StringToDoubleConverter::StringToDouble( + const uc16* buffer, + int length, + int* processed_characters_count) const { + return StringToIeee(buffer, length, true, processed_characters_count); +} + + +float StringToDoubleConverter::StringToFloat( + const char* buffer, + int length, + int* processed_characters_count) const { + return static_cast(StringToIeee(buffer, length, false, + processed_characters_count)); +} + + +float StringToDoubleConverter::StringToFloat( + const uc16* buffer, + int length, + int* processed_characters_count) const { + return static_cast(StringToIeee(buffer, length, false, + processed_characters_count)); +} + } // namespace double_conversion diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.h otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.h --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/double-conversion.h 2014-09-03 08:29:34.000000000 +0000 @@ -415,9 +415,10 @@ // junk, too. // - ALLOW_TRAILING_JUNK: ignore trailing characters that are not part of // a double literal. - // - ALLOW_LEADING_SPACES: skip over leading spaces. - // - ALLOW_TRAILING_SPACES: ignore trailing spaces. - // - ALLOW_SPACES_AFTER_SIGN: ignore spaces after the sign. + // - ALLOW_LEADING_SPACES: skip over leading whitespace, including spaces, + // new-lines, and tabs. + // - ALLOW_TRAILING_SPACES: ignore trailing whitespace. + // - ALLOW_SPACES_AFTER_SIGN: ignore whitespace after the sign. // Ex: StringToDouble("- 123.2") -> -123.2. // StringToDouble("+ 123.2") -> 123.2 // @@ -502,19 +503,24 @@ // in the 'processed_characters_count'. Trailing junk is never included. double StringToDouble(const char* buffer, int length, - int* processed_characters_count) const { - return StringToIeee(buffer, length, processed_characters_count, true); - } + int* processed_characters_count) const; + + // Same as StringToDouble above but for 16 bit characters. + double StringToDouble(const uc16* buffer, + int length, + int* processed_characters_count) const; // Same as StringToDouble but reads a float. // Note that this is not equivalent to static_cast(StringToDouble(...)) // due to potential double-rounding. float StringToFloat(const char* buffer, int length, - int* processed_characters_count) const { - return static_cast(StringToIeee(buffer, length, - processed_characters_count, false)); - } + int* processed_characters_count) const; + + // Same as StringToFloat above but for 16 bit characters. + float StringToFloat(const uc16* buffer, + int length, + int* processed_characters_count) const; private: const int flags_; @@ -523,10 +529,11 @@ const char* const infinity_symbol_; const char* const nan_symbol_; - double StringToIeee(const char* buffer, + template + double StringToIeee(Iterator start_pointer, int length, - int* processed_characters_count, - bool read_as_double) const; + bool read_as_double, + int* processed_characters_count) const; DISALLOW_IMPLICIT_CONSTRUCTORS(StringToDoubleConverter); }; diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fast-dtoa.cc otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fast-dtoa.cc --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fast-dtoa.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fast-dtoa.cc 2014-09-03 08:29:34.000000000 +0000 @@ -248,10 +248,7 @@ // Note: kPowersOf10[i] == 10^(i-1). exponent_plus_one_guess++; // We don't have any guarantees that 2^number_bits <= number. - // TODO(floitsch): can we change the 'while' into an 'if'? We definitely see - // number < (2^number_bits - 1), but I haven't encountered - // number < (2^number_bits - 2) yet. - while (number < kSmallPowersOfTen[exponent_plus_one_guess]) { + if (number < kSmallPowersOfTen[exponent_plus_one_guess]) { exponent_plus_one_guess--; } *power = kSmallPowersOfTen[exponent_plus_one_guess]; @@ -350,7 +347,8 @@ // that is smaller than integrals. while (*kappa > 0) { int digit = integrals / divisor; - buffer[*length] = '0' + digit; + ASSERT(digit <= 9); + buffer[*length] = static_cast('0' + digit); (*length)++; integrals %= divisor; (*kappa)--; @@ -379,13 +377,14 @@ ASSERT(one.e() >= -60); ASSERT(fractionals < one.f()); ASSERT(UINT64_2PART_C(0xFFFFFFFF, FFFFFFFF) / 10 >= one.f()); - while (true) { + for (;;) { fractionals *= 10; unit *= 10; unsafe_interval.set_f(unsafe_interval.f() * 10); // Integer division by one. int digit = static_cast(fractionals >> -one.e()); - buffer[*length] = '0' + digit; + ASSERT(digit <= 9); + buffer[*length] = static_cast('0' + digit); (*length)++; fractionals &= one.f() - 1; // Modulo by one. (*kappa)--; @@ -459,7 +458,8 @@ // that is smaller than 'integrals'. while (*kappa > 0) { int digit = integrals / divisor; - buffer[*length] = '0' + digit; + ASSERT(digit <= 9); + buffer[*length] = static_cast('0' + digit); (*length)++; requested_digits--; integrals %= divisor; @@ -492,7 +492,8 @@ w_error *= 10; // Integer division by one. int digit = static_cast(fractionals >> -one.e()); - buffer[*length] = '0' + digit; + ASSERT(digit <= 9); + buffer[*length] = static_cast('0' + digit); (*length)++; requested_digits--; fractionals &= one.f() - 1; // Modulo by one. diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fixed-dtoa.cc otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fixed-dtoa.cc --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fixed-dtoa.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/fixed-dtoa.cc 2014-09-03 08:29:34.000000000 +0000 @@ -133,7 +133,7 @@ while (number != 0) { int digit = number % 10; number /= 10; - buffer[(*length) + number_length] = '0' + digit; + buffer[(*length) + number_length] = static_cast('0' + digit); number_length++; } // Exchange the digits. @@ -150,7 +150,7 @@ } -static void FillDigits64FixedLength(uint64_t number, int /* requested_length */, +static void FillDigits64FixedLength(uint64_t number, Vector buffer, int* length) { const uint32_t kTen7 = 10000000; // For efficiency cut the number into 3 uint32_t parts, and print those. @@ -253,7 +253,8 @@ fractionals *= 5; point--; int digit = static_cast(fractionals >> point); - buffer[*length] = '0' + digit; + ASSERT(digit <= 9); + buffer[*length] = static_cast('0' + digit); (*length)++; fractionals -= static_cast(digit) << point; } @@ -274,7 +275,8 @@ fractionals128.Multiply(5); point--; int digit = fractionals128.DivModPowerOf2(point); - buffer[*length] = '0' + digit; + ASSERT(digit <= 9); + buffer[*length] = static_cast('0' + digit); (*length)++; } if (fractionals128.BitAt(point - 1) == 1) { @@ -358,7 +360,7 @@ remainder = (dividend % divisor) << exponent; } FillDigits32(quotient, buffer, length); - FillDigits64FixedLength(remainder, divisor_power, buffer, length); + FillDigits64FixedLength(remainder, buffer, length); *decimal_point = *length; } else if (exponent >= 0) { // 0 <= exponent <= 11 diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/ieee.h otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/ieee.h --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/ieee.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/ieee.h 2014-09-03 08:29:34.000000000 +0000 @@ -256,6 +256,8 @@ return (significand & kSignificandMask) | (biased_exponent << kPhysicalSignificandSize); } + + DISALLOW_COPY_AND_ASSIGN(Double); }; class Single { @@ -391,6 +393,8 @@ static const uint32_t kNaN = 0x7FC00000; const uint32_t d32_; + + DISALLOW_COPY_AND_ASSIGN(Single); }; } // namespace double_conversion diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/strtod.cc otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/strtod.cc --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/strtod.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/strtod.cc 2014-09-03 08:29:34.000000000 +0000 @@ -137,6 +137,7 @@ Vector right_trimmed = TrimTrailingZeros(left_trimmed); exponent += left_trimmed.length() - right_trimmed.length(); if (right_trimmed.length() > kMaxSignificantDecimalDigits) { + (void) space_size; // Mark variable as used. ASSERT(space_size >= kMaxSignificantDecimalDigits); CutToMaxSignificantDigits(right_trimmed, exponent, buffer_copy_space, updated_exponent); @@ -263,7 +264,6 @@ case 7: return DiyFp(UINT64_2PART_C(0x98968000, 00000000), -40); default: UNREACHABLE(); - return DiyFp(0, 0); } } @@ -515,6 +515,7 @@ double double_next2 = Double(double_next).NextDouble(); f4 = static_cast(double_next2); } + (void) f2; // Mark variable as used. ASSERT(f1 <= f2 && f2 <= f3 && f3 <= f4); // If the guess doesn't lie near a single-precision boundary we can simply diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/utils.h otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/utils.h --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/utils.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/double-conversion/utils.h 2014-09-03 08:29:34.000000000 +0000 @@ -33,7 +33,8 @@ #include #ifndef ASSERT -#define ASSERT(condition) (assert(condition)) +#define ASSERT(condition) \ + assert(condition); #endif #ifndef UNIMPLEMENTED #define UNIMPLEMENTED() (abort()) @@ -60,7 +61,7 @@ defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ defined(__SH4__) || defined(__alpha__) || \ defined(_MIPS_ARCH_MIPS32R2) || \ - defined(_AARCH64EL_) + defined(__AARCH64EL__) #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) #if defined(_WIN32) @@ -73,6 +74,11 @@ #error Target architecture was not detected as supported by Double-Conversion. #endif +#if defined(__GNUC__) +#define DOUBLE_CONVERSION_UNUSED __attribute__((unused)) +#else +#define DOUBLE_CONVERSION_UNUSED +#endif #if defined(_WIN32) && !defined(__MINGW32__) @@ -92,6 +98,8 @@ #endif +typedef uint16_t uc16; + // The following macro works on both 32 and 64-bit platforms. // Usage: instead of writing 0x1234567890123456 // write UINT64_2PART_C(0x12345678,90123456); @@ -298,7 +306,8 @@ inline Dest BitCast(const Source& source) { // Compile time assertion: sizeof(Dest) == sizeof(Source) // A compile error here means your Dest and Source have different sizes. - typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1]; + DOUBLE_CONVERSION_UNUSED + typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1]; Dest dest; memmove(&dest, &source, sizeof(dest)); diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/UpdateDoubleConversionFromGoogle.sh otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/UpdateDoubleConversionFromGoogle.sh --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/UpdateDoubleConversionFromGoogle.sh 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/DoubleConversion/src/UpdateDoubleConversionFromGoogle.sh 2014-09-03 08:29:34.000000000 +0000 @@ -25,8 +25,8 @@ # EDIT THIS SCRIPT to change the hash tag at which to begin the # next update... # -# This merge done April 30 2013 -git branch DoubleConversion-upstream 0447797f4afab5c5 +# This merge done April 28, 2014 +git branch DoubleConversion-upstream 1feae55e5af21e36 # # Make a temp directory to handle the import of the upstream source @@ -53,13 +53,16 @@ # recover the upstream commit date. cd double-conversion upstream_date="$(git log -n 1 --format='%cd')" +upstream_sha="$(git rev-parse HEAD)" cd .. # # Check to see if LICENSE file changed -- if changed, fix in a separate # commit. -if [ ! diff double-conversion/LICENSE ../Modules/ThirdParty/DoubleConversion/LICENSE ] +if diff double-conversion/LICENSE ../Modules/ThirdParty/DoubleConversion/src/LICENSE then + echo LICENSE file unchanged +else echo The double-conversion LICENSE file has changed. Please echo add the change in a separate commit by hand and run this script again. exit 1 @@ -77,7 +80,12 @@ GIT_AUTHOR_NAME='Google double-conversion Maintainers' \ GIT_AUTHOR_EMAIL='floitsch@google.com' \ GIT_AUTHOR_DATE="${upstream_date}" \ -git commit -q -m "Google double-conversion (reduced)" +git commit -q -m "Google double-conversion (reduced) + +This corresponds to commit hash + ${upstream_sha} +from Google repository + http://code.google.com/p/double-conversion" # # push to the DoubleConversion-upstream branch in the diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/Expat/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/Expat/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/Expat/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/Expat/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,10 +1,22 @@ project(ITKExpat) set(ITKExpat_THIRD_PARTY 1) -set(ITKExpat_INCLUDE_DIRS +option(ITK_USE_SYSTEM_EXPAT "Use system-installed expat" OFF) +mark_as_advanced(ITK_USE_SYSTEM_EXPAT) + +if(ITK_USE_SYSTEM_EXPAT) + find_package(EXPAT REQUIRED) + set(ITKExpat_INCLUDE_DIRS ${ITKExpat_BINARY_DIR}/src ) + set(ITKExpat_SYSTEM_INCLUDE_DIRS "${EXPAT_INCLUDE_DIR}") + set(ITKExpat_LIBRARIES "${EXPAT_LIBRARY}") + set(ITKExpat_NO_SRC 1) +else() + set(ITKExpat_INCLUDE_DIRS ${ITKExpat_BINARY_DIR}/src/expat ${ITKExpat_SOURCE_DIR}/src/expat ) set(ITKExpat_LIBRARIES ITKEXPAT) +endif() + itk_module_impl() diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/Expat/src/expat/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/Expat/src/expat/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/Expat/src/expat/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/Expat/src/expat/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -28,19 +28,15 @@ SET_TARGET_PROPERTIES(ITKEXPAT PROPERTIES ${ITK_LIBRARY_PROPERTIES}) ENDIF(ITK_LIBRARY_PROPERTIES) -IF(NOT ITK_INSTALL_NO_LIBRARIES) - INSTALL(TARGETS ITKEXPAT - EXPORT ${ITK3P_INSTALL_EXPORT_NAME} - RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries - LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries - ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development - ) -ENDIF(NOT ITK_INSTALL_NO_LIBRARIES) +INSTALL(TARGETS ITKEXPAT + EXPORT ${ITK3P_INSTALL_EXPORT_NAME} + RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development + ) -IF(NOT ITK_INSTALL_NO_DEVELOPMENT) - INSTALL(FILES - ${ITK3P_EXPAT_BINARY_DIR}/expatDllConfig.h - ${ITK3P_EXPAT_SOURCE_DIR}/expat.h - DESTINATION ${ITK3P_INSTALL_INCLUDE_DIR} # TODO: itk_expat.h #include "itkexpat/expat.h" - COMPONENT Development) -ENDIF(NOT ITK_INSTALL_NO_DEVELOPMENT) +INSTALL(FILES + ${ITK3P_EXPAT_BINARY_DIR}/expatDllConfig.h + ${ITK3P_EXPAT_SOURCE_DIR}/expat.h + DESTINATION ${ITK3P_INSTALL_INCLUDE_DIR} # TODO: itk_expat.h #include "itkexpat/expat.h" + COMPONENT Development) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -18,6 +18,7 @@ set(KWSYS_INSTALL_EXPORT_NAME ${ITKKWSys-targets}) set(KWSYS_INSTALL_COMPONENT_NAME_RUNTIME RuntimeLibraries) set(KWSYS_INSTALL_COMPONENT_NAME_DEVELOPMENT Development) +set(KWSYS_PROPERTIES_CXX MACOSX_RPATH 1) add_subdirectory(KWSys) itk_module_target(${KWSYS_NAMESPACE} NO_INSTALL) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -85,6 +85,9 @@ # written. CMAKE_MINIMUM_REQUIRED(VERSION 2.6.3 FATAL_ERROR) +IF(POLICY CMP0025) + CMAKE_POLICY(SET CMP0025 NEW) +ENDIF() #----------------------------------------------------------------------------- # If a namespace is not specified, use "kwsys" and enable testing. @@ -296,6 +299,13 @@ ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") IF(CMAKE_SYSTEM MATCHES "HP-UX") SET(KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p") + IF(CMAKE_CXX_COMPILER_ID MATCHES "HP") + # it is known that version 3.85 fails and 6.25 works without these flags + IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4) + # use new C++ library and improved template support + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98") + ENDIF() + ENDIF() ENDIF(CMAKE_SYSTEM MATCHES "HP-UX") ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) @@ -682,6 +692,7 @@ # usually it's in libc but on FreeBSD # it's in libexecinfo FIND_LIBRARY(EXECINFO_LIB "execinfo") + MARK_AS_ADVANCED(EXECINFO_LIB) IF (NOT EXECINFO_LIB) SET(EXECINFO_LIB "") ENDIF() @@ -1073,6 +1084,11 @@ ) ENDIF() +IF(WIN32) + # Help enforce the use of wide Windows apis. + ADD_DEFINITIONS(-DUNICODE -D_UNICODE) +ENDIF() + IF(KWSYS_USE_String) # Activate code in "String.c". See the comment in the source. SET_SOURCE_FILES_PROPERTIES(String.c PROPERTIES @@ -1133,6 +1149,11 @@ testEncoding ) ENDIF(KWSYS_STL_HAS_WSTRING) + IF(KWSYS_USE_FStream) + SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} + testFStream + ) + ENDIF(KWSYS_USE_FStream) IF(KWSYS_USE_SystemInformation) SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation) ENDIF(KWSYS_USE_SystemInformation) @@ -1214,6 +1235,9 @@ # Some Apple compilers produce bad optimizations in this source. IF(APPLE AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(GNU|LLVM)$") SET_SOURCE_FILES_PROPERTIES(testProcess.c PROPERTIES COMPILE_FLAGS -O0) + ELSEIF(CMAKE_C_COMPILER_ID STREQUAL "XL") + # Tell IBM XL not to warn about our test infinite loop + SET_PROPERTY(SOURCE testProcess.c PROPERTY COMPILE_FLAGS -qsuppress=1500-010) ENDIF() # Test SharedForward diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingC.c otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingC.c --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingC.c 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingC.c 2014-09-03 08:29:34.000000000 +0000 @@ -68,7 +68,7 @@ char* kwsysEncoding_DupToNarrow(const wchar_t* str) { char* ret = NULL; - size_t length = kwsysEncoding_wcstombs(0, str, 0); + size_t length = kwsysEncoding_wcstombs(0, str, 0) + 1; if(length > 0) { ret = malloc(length); diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingCXX.cxx otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingCXX.cxx --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingCXX.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/EncodingCXX.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -29,6 +29,7 @@ #endif #include +#include #ifdef _MSC_VER # pragma warning (disable: 4786) @@ -42,6 +43,101 @@ namespace KWSYS_NAMESPACE { +Encoding::CommandLineArguments +Encoding::CommandLineArguments::Main(int argc, char const* const* argv) +{ +#ifdef _WIN32 + (void) argc; + (void) argv; + + int ac; + LPWSTR* w_av = CommandLineToArgvW(GetCommandLineW(), &ac); + + std::vector av1(ac); + std::vector av2(ac); + for(int i=0; iargv_.resize(ac+1); + for(int i=0; iargv_[i] = strdup(av[i]); + } + this->argv_[ac] = 0; +} + +Encoding::CommandLineArguments::CommandLineArguments(int ac, + wchar_t const* const* av) +{ + this->argv_.resize(ac+1); + for(int i=0; iargv_[i] = kwsysEncoding_DupToNarrow(av[i]); + } + this->argv_[ac] = 0; +} + +Encoding::CommandLineArguments::~CommandLineArguments() +{ + for(size_t i=0; iargv_.size(); i++) + { + free(argv_[i]); + } +} + +Encoding::CommandLineArguments:: + CommandLineArguments(const CommandLineArguments& other) +{ + this->argv_.resize(other.argv_.size()); + for(size_t i=0; iargv_.size(); i++) + { + this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0; + } +} + +Encoding::CommandLineArguments& +Encoding::CommandLineArguments::operator=(const CommandLineArguments& other) +{ + if(this != &other) + { + size_t i; + for(i=0; iargv_.size(); i++) + { + free(this->argv_[i]); + } + + this->argv_.resize(other.argv_.size()); + for(i=0; iargv_.size(); i++) + { + this->argv_[i] = other.argv_[i] ? strdup(other.argv_[i]) : 0; + } + } + + return *this; +} + +int Encoding::CommandLineArguments::argc() const +{ + return static_cast(this->argv_.size() - 1); +} + +char const* const* Encoding::CommandLineArguments::argv() const +{ + return &this->argv_[0]; +} + #if KWSYS_STL_HAS_WSTRING kwsys_stl::wstring Encoding::ToWide(const kwsys_stl::string& str) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Encoding.hxx.in otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Encoding.hxx.in --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Encoding.hxx.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Encoding.hxx.in 2014-09-03 08:29:34.000000000 +0000 @@ -14,6 +14,7 @@ #include <@KWSYS_NAMESPACE@/Configure.hxx> #include <@KWSYS_NAMESPACE@/stl/string> +#include <@KWSYS_NAMESPACE@/stl/vector> /* Define these macros temporarily to keep the code readable. */ #if !defined (KWSYS_NAMESPACE) && !@KWSYS_NAMESPACE@_NAME_IS_KWSYS @@ -25,6 +26,36 @@ class @KWSYS_NAMESPACE@_EXPORT Encoding { public: + + // Container class for argc/argv. + class CommandLineArguments + { + public: + // On Windows, get the program command line arguments + // in this Encoding module's 8 bit encoding. + // On other platforms the given argc/argv is used, and + // to be consistent, should be the argc/argv from main(). + static CommandLineArguments Main(int argc, char const* const* argv); + + // Construct CommandLineArguments with the given + // argc/argv. It is assumed that the string is already + // in the encoding used by this module. + CommandLineArguments(int argc, char const* const* argv); + + // Construct CommandLineArguments with the given + // argc and wide argv. This is useful if wmain() is used. + CommandLineArguments(int argc, wchar_t const* const* argv); + ~CommandLineArguments(); + CommandLineArguments(const CommandLineArguments&); + CommandLineArguments& operator=(const CommandLineArguments&); + + int argc() const; + char const* const* argv() const; + + protected: + std::vector argv_; + }; + /** * Convert between char and wchar_t */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.cxx otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.cxx --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.cxx 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,76 @@ +/*============================================================================ + KWSys - Kitware System Library + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "kwsysPrivate.h" +#include KWSYS_HEADER(FStream.hxx) + +// Work-around CMake dependency scanning limitation. This must +// duplicate the above list of headers. +#if 0 +# include "FStream.hxx.in" +#endif + +namespace KWSYS_NAMESPACE +{ +namespace FStream +{ + +BOM ReadBOM(std::istream& in) +{ + if(!in.good()) + { + return BOM_None; + } + unsigned long orig = in.tellg(); + unsigned char bom[4]; + in.read(reinterpret_cast(bom), 2); + if(!in.good()) + { + in.seekg(orig); + return BOM_None; + } + if(bom[0] == 0xEF && bom[1] == 0xBB) + { + in.read(reinterpret_cast(bom+2), 1); + if(in.good() && bom[2] == 0xBF) + { + return BOM_UTF8; + } + } + else if(bom[0] == 0xFE && bom[1] == 0xFF) + { + return BOM_UTF16BE; + } + else if(bom[0] == 0x00 && bom[1] == 0x00) + { + in.read(reinterpret_cast(bom+2), 2); + if(in.good() && bom[2] == 0xFE && bom[3] == 0xFF) + { + return BOM_UTF32BE; + } + } + else if(bom[0] == 0xFF && bom[1] == 0xFE) + { + unsigned long p = in.tellg(); + in.read(reinterpret_cast(bom+2), 2); + if(in.good() && bom[2] == 0x00 && bom[3] == 0x00) + { + return BOM_UTF32LE; + } + in.seekg(p); + return BOM_UTF16LE; + } + in.seekg(orig); + return BOM_None; +} + +} // FStream namespace +} //KWSYS_NAMESPACE diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.hxx.in otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.hxx.in --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.hxx.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/FStream.hxx.in 2014-09-03 08:29:34.000000000 +0000 @@ -25,8 +25,9 @@ typedef std::basic_filebuf my_base_type; basic_filebuf *open(char const *s,std::ios_base::openmode mode) { - my_base_type::open(Encoding::ToWide(s).c_str(), mode); - return this; + return static_cast( + my_base_type::open(Encoding::ToWide(s).c_str(), mode) + ); } }; @@ -81,7 +82,7 @@ internal_buffer_type *rdbuf() const { - return buf_.get(); + return buf_; } ~basic_ifstream() @@ -160,13 +161,28 @@ typedef basic_ofstream ofstream; #else - using @KWSYS_NAMESPACE@_ios_namespace::basic_filebuf; using @KWSYS_NAMESPACE@_ios_namespace::ofstream; using @KWSYS_NAMESPACE@_ios_namespace::ifstream; #endif + namespace FStream + { + enum BOM + { + BOM_None, + BOM_UTF8, + BOM_UTF16BE, + BOM_UTF16LE, + BOM_UTF32BE, + BOM_UTF32LE + }; + + // Read a BOM, if one exists. + // If a BOM exists, the stream is advanced to after the BOM. + // This function requires a seekable stream (but not a relative + // seekable stream). + BOM ReadBOM(std::istream& in); + } } - - #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/hashtable.hxx.in otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/hashtable.hxx.in --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/hashtable.hxx.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/hashtable.hxx.in 2014-09-03 08:29:34.000000000 +0000 @@ -310,6 +310,9 @@ { _Hashtable_node* _M_next; _Val _M_val; + void public_method_to_quiet_warning_about_all_methods_private(); +private: + void operator=(_Hashtable_node<_Val> const&); // poison node assignment }; template md5_state, (md5_byte_t const*)data, (size_t)length); + else + { + dlen = (size_t)length; + } + md5_append(&md5->md5_state, (md5_byte_t const*)data, dlen); } /*--------------------------------------------------------------------------*/ diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/ProcessUNIX.c otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/ProcessUNIX.c --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/ProcessUNIX.c 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/ProcessUNIX.c 2014-09-03 08:29:34.000000000 +0000 @@ -2449,6 +2449,7 @@ if(f) { size_t nread = fread(buffer, 1, KWSYSPE_PIPE_BUFFER_SIZE, f); + fclose(f); buffer[nread] = '\0'; if(nread > 0) { @@ -2463,7 +2464,6 @@ } } } - fclose(f); } } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SharedForward.h.in otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SharedForward.h.in --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SharedForward.h.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SharedForward.h.in 2014-09-03 08:29:34.000000000 +0000 @@ -415,7 +415,7 @@ { #if defined(_WIN32) && !defined(__CYGWIN__) /* Implementation for Windows. */ - DWORD n = GetFullPathName(in_path, KWSYS_SHARED_FORWARD_MAXPATH, + DWORD n = GetFullPathNameA(in_path, KWSYS_SHARED_FORWARD_MAXPATH, out_path, 0); return n > 0 && n <= KWSYS_SHARED_FORWARD_MAXPATH; #else @@ -429,9 +429,9 @@ { #if defined(_WIN32) int result = 0; - HANDLE h1 = CreateFile(file1, GENERIC_READ, FILE_SHARE_READ, NULL, + HANDLE h1 = CreateFileA(file1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - HANDLE h2 = CreateFile(file2, GENERIC_READ, FILE_SHARE_READ, NULL, + HANDLE h2 = CreateFileA(file2, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if(h1 != INVALID_HANDLE_VALUE && h2 != INVALID_HANDLE_VALUE) { @@ -462,7 +462,7 @@ #if defined(_WIN32) && !defined(__CYGWIN__) /* Implementation for Windows. */ DWORD original = GetLastError(); - DWORD length = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | + DWORD length = FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, 0, original, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), message, KWSYS_SHARED_FORWARD_MAXPATH, 0); diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.c otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.c --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.c 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.c 2014-09-03 08:29:34.000000000 +0000 @@ -353,6 +353,10 @@ if(kwsysSystem_Shell__ArgumentNeedsQuotes(in, isUnix, flags)) { /* Surrounding quotes are needed. Allocate space for them. */ + if((flags & kwsysSystem_Shell_Flag_WatcomQuote) && (isUnix)) + { + size += 2; + } size += 2; /* We must escape all ending backslashes when quoting on windows. */ @@ -377,7 +381,18 @@ if(needQuotes) { /* Add the opening quote for this argument. */ - *out++ = '"'; + if(flags & kwsysSystem_Shell_Flag_WatcomQuote) + { + if(isUnix) + { + *out++ = '"'; + } + *out++ = '\''; + } + else + { + *out++ = '"'; + } } /* Scan the string for characters that require escaping or quoting. */ @@ -549,7 +564,18 @@ } /* Add the closing quote for this argument. */ - *out++ = '"'; + if(flags & kwsysSystem_Shell_Flag_WatcomQuote) + { + *out++ = '\''; + if(isUnix) + { + *out++ = '"'; + } + } + else + { + *out++ = '"'; + } } /* Store a terminating null without incrementing. */ diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.h.in otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.h.in --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.h.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/System.h.in 2014-09-03 08:29:34.000000000 +0000 @@ -36,6 +36,7 @@ # define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake) # define kwsysSystem_Shell_Flag_NMake kwsys_ns(System_Shell_Flag_NMake) # define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables) +# define kwsysSystem_Shell_Flag_WatcomQuote kwsys_ns(System_Shell_Flag_WatcomQuote) #endif #ifdef __VMS @@ -102,14 +103,17 @@ kwsysSystem_Shell_Flag_MinGWMake = (1<<4), /** The target shell is in a NMake makefile. */ - kwsysSystem_Shell_Flag_NMake = (1<<6), + kwsysSystem_Shell_Flag_NMake = (1<<5), /** Make variable reference syntax $(MAKEVAR) should not be escaped to allow a build tool to replace it. Replacement values containing spaces, quotes, backslashes, or other non-alphanumeric characters that have significance to some makes or shells produce undefined behavior. */ - kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<5) + kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<6), + + /** The target shell quoting uses extra single Quotes for Watcom tools. */ + kwsysSystem_Shell_Flag_WatcomQuote = (1<<7) }; /** @@ -156,6 +160,7 @@ # undef kwsysSystem_Shell_Flag_MinGWMake # undef kwsysSystem_Shell_Flag_NMake # undef kwsysSystem_Shell_Flag_AllowMakeVariables +# undef kwsysSystem_Shell_Flag_WatcomQuote # endif #endif diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemInformation.cxx otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemInformation.cxx --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemInformation.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemInformation.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -3162,8 +3162,17 @@ kwsys_stl::string cores = this->ExtractValueFromCpuInfoFile(buffer,"cpu cores"); int numberOfCoresPerCPU=atoi(cores.c_str()); - this->NumberOfPhysicalCPU=static_cast( - numberOfCoresPerCPU*(maxId+1)); + if (maxId > 0) + { + this->NumberOfPhysicalCPU=static_cast( + numberOfCoresPerCPU*(maxId+1)); + } + else + { + // Linux Sparc: get cpu count + this->NumberOfPhysicalCPU= + atoi(this->ExtractValueFromCpuInfoFile(buffer,"ncpus active").c_str()); + } #else // __CYGWIN__ // does not have "physical id" entries, neither "cpu cores" @@ -3185,7 +3194,19 @@ // CPU speed (checking only the first processor) kwsys_stl::string CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"cpu MHz"); - this->CPUSpeedInMHz = static_cast(atof(CPUSpeed.c_str())); + if(!CPUSpeed.empty()) + { + this->CPUSpeedInMHz = static_cast(atof(CPUSpeed.c_str())); + } +#ifdef __linux + else + { + // Linux Sparc: CPU speed is in Hz and encoded in hexadecimal + CPUSpeed = this->ExtractValueFromCpuInfoFile(buffer,"Cpu0ClkTck"); + this->CPUSpeedInMHz = static_cast( + strtoull(CPUSpeed.c_str(),0,16))/1000000.0f; + } +#endif // Chip family kwsys_stl::string familyStr = @@ -4677,11 +4698,28 @@ { #if defined(__HAIKU__) + // CPU count system_info info; get_system_info(&info); - this->NumberOfPhysicalCPU = info.cpu_count; - this->CPUSpeedInMHz = info.cpu_clock_speed / 1000000.0F; + + // CPU speed + uint32 topologyNodeCount = 0; + cpu_topology_node_info* topology = 0; + get_cpu_topology_info(0, &topologyNodeCount); + if (topologyNodeCount != 0) + topology = new cpu_topology_node_info[topologyNodeCount]; + get_cpu_topology_info(topology, &topologyNodeCount); + + for (uint32 i = 0; i < topologyNodeCount; i++) { + if (topology[i].type == B_TOPOLOGY_CORE) { + this->CPUSpeedInMHz = topology[i].data.core.default_frequency / + 1000000.0f; + break; + } + } + + delete[] topology; // Physical Memory this->TotalPhysicalMemory = (info.max_pages * B_PAGE_SIZE) / (1024 * 1024) ; @@ -4985,16 +5023,26 @@ case CPU_PA_RISC1_0: this->ChipID.Vendor = "Hewlett-Packard"; this->ChipID.Family = 0x100; + break; case CPU_PA_RISC1_1: this->ChipID.Vendor = "Hewlett-Packard"; this->ChipID.Family = 0x110; + break; case CPU_PA_RISC2_0: this->ChipID.Vendor = "Hewlett-Packard"; this->ChipID.Family = 0x200; + break; +# if defined(CPU_HP_INTEL_EM_1_0) || defined(CPU_IA64_ARCHREV_0) +# ifdef CPU_HP_INTEL_EM_1_0 + case CPU_HP_INTEL_EM_1_0: +# endif +# ifdef CPU_IA64_ARCHREV_0 case CPU_IA64_ARCHREV_0: +# endif this->ChipID.Vendor = "GenuineIntel"; this->Features.HasIA64 = true; break; +# endif default: return false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemTools.cxx otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemTools.cxx --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemTools.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/SystemTools.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -188,6 +188,9 @@ #endif #if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) + +#include + inline int Mkdir(const char* dir) { return _wmkdir(KWSYS_NAMESPACE::Encoding::ToWide(dir).c_str()); @@ -2115,10 +2118,10 @@ SystemTools::RemoveFile(destination); #if defined(_WIN32) || defined(__CYGWIN__) - kwsys_ios::ofstream fout(destination, + kwsys::ofstream fout(destination, kwsys_ios::ios::binary | kwsys_ios::ios::out | kwsys_ios::ios::trunc); #else - kwsys_ios::ofstream fout(destination, + kwsys::ofstream fout(destination, kwsys_ios::ios::out | kwsys_ios::ios::trunc); #endif if(!fout) @@ -4915,8 +4918,8 @@ // Strip off one directory level and see if the logical // mapping still works. - pwd_str = SystemTools::GetFilenamePath(pwd_str.c_str()); - cwd_str = SystemTools::GetFilenamePath(cwd_str.c_str()); + pwd_str = SystemTools::GetFilenamePath(pwd_str); + cwd_str = SystemTools::GetFilenamePath(cwd_str); Realpath(pwd_str.c_str(), pwd_path); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Terminal.c otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Terminal.c --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Terminal.c 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/Terminal.c 2014-09-03 08:29:34.000000000 +0000 @@ -155,6 +155,7 @@ "mach-color", "mlterm", "putty", + "putty-256color", "rxvt", "rxvt-256color", "rxvt-cygwin", diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/testEncoding.cxx otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/testEncoding.cxx --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/testEncoding.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/KWSys/src/KWSys/testEncoding.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -16,14 +16,18 @@ #endif #include KWSYS_HEADER(Encoding.hxx) +#include KWSYS_HEADER(Encoding.h) #include KWSYS_HEADER(ios/iostream) #include +#include +#include // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. #if 0 # include "Encoding.hxx.in" +# include "Encoding.h.in" # include "kwsys_ios_iostream.h.in" #endif @@ -68,11 +72,16 @@ std::cout << str << std::endl; std::wstring wstr = kwsys::Encoding::ToWide(str); std::string str2 = kwsys::Encoding::ToNarrow(wstr); - if(!wstr.empty() && str != str2) + wchar_t* c_wstr = kwsysEncoding_DupToWide(str.c_str()); + char* c_str2 = kwsysEncoding_DupToNarrow(c_wstr); + if(!wstr.empty() && (str != str2 || strcmp(c_str2, str.c_str()))) { std::cout << "converted string was different: " << str2 << std::endl; + std::cout << "converted string was different: " << c_str2 << std::endl; ret++; } + free(c_wstr); + free(c_str2); } return ret; } @@ -136,6 +145,36 @@ return ret; } +static int testCommandLineArguments() +{ + int status = 0; + + char const* argv[2] = { + "./app.exe", + (char const*)helloWorldStrings[1] + }; + + kwsys::Encoding::CommandLineArguments args(2, argv); + kwsys::Encoding::CommandLineArguments arg2 = + kwsys::Encoding::CommandLineArguments(args); + + char const* const* u8_argv = args.argv(); + for(int i=0; i +#ifdef __BORLANDC__ +# include /* memcmp */ +#endif + +// Work-around CMake dependency scanning limitation. This must +// duplicate the above list of headers. +#if 0 +# include "FStream.hxx.in" +# include "kwsys_ios_iostream.h.in" +#endif + + +//---------------------------------------------------------------------------- +static int testNoFile() +{ + kwsys::ifstream in_file("NoSuchFile.txt"); + if(in_file) + { + return 1; + } + + return 0; +} + +static kwsys::FStream::BOM expected_bom[5] = +{ + kwsys::FStream::BOM_UTF8, + kwsys::FStream::BOM_UTF16LE, + kwsys::FStream::BOM_UTF16BE, + kwsys::FStream::BOM_UTF32LE, + kwsys::FStream::BOM_UTF32BE +}; + +static unsigned char expected_bom_data[5][5] = +{ + {3, 0xEF, 0xBB, 0xBF}, + {2, 0xFF, 0xFE}, + {2, 0xFE, 0xFF}, + {4, 0xFF, 0xFE, 0x00, 0x00}, + {4, 0x00, 0x00, 0xFE, 0xFF}, +}; + +static unsigned char file_data[5][45] = +{ + {11, 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'}, + {22, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, 0x00, + 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64, 0x00}, + {22, 0x00, 0x48, 0x00, 0x65, 0x00, 0x6C, 0x00, 0x6C, 0x00, 0x6F, 0x00, 0x20, + 0x00, 0x57, 0x00, 0x6F, 0x00, 0x72, 0x00, 0x6C, 0x00, 0x64}, + {44, 0x48, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, + 0x6C, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, + 0x57, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x72, 0x00, 0x00, 0x00, + 0x6C, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00}, + {44, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x65, 0x00, 0x00, 0x00, 0x6C, + 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x00, 0x57, 0x00, 0x00, 0x00, 0x6F, 0x00, 0x00, 0x00, 0x72, + 0x00, 0x00, 0x00, 0x6C, 0x00, 0x00, 0x00, 0x64}, +}; + +//---------------------------------------------------------------------------- +static int testBOM() +{ + // test various encodings in binary mode + for(int i=0; i<5; i++) + { + { + kwsys::ofstream out("bom.txt", kwsys::ofstream::binary); + out.write(reinterpret_cast(expected_bom_data[i]+1), + *expected_bom_data[i]); + out.write(reinterpret_cast(file_data[i]+1), + file_data[i][0]); + } + + kwsys::ifstream in("bom.txt", kwsys::ofstream::binary); + kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); + if(bom != expected_bom[i]) + { + kwsys_ios::cout << "Unexpected BOM " << i << std::endl; + return 1; + } + char data[45]; + in.read(data, file_data[i][0]); + if(!in.good()) + { + kwsys_ios::cout << "Unable to read data " << i << std::endl; + return 1; + } + + if(memcmp(data, file_data[i]+1, file_data[i][0]) != 0) + { + kwsys_ios::cout << "Incorrect read data " << i << std::endl; + return 1; + } + + } + + // test text file without bom + { + { + kwsys::ofstream out("bom.txt"); + out << "Hello World"; + } + + kwsys::ifstream in("bom.txt"); + kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); + if(bom != kwsys::FStream::BOM_None) + { + kwsys_ios::cout << "Unexpected BOM for none case" << std::endl; + return 1; + } + char data[45]; + in.read(data, file_data[0][0]); + if(!in.good()) + { + kwsys_ios::cout << "Unable to read data for none case" << std::endl; + return 1; + } + + if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) + { + kwsys_ios::cout << "Incorrect read data for none case" << std::endl; + return 1; + } + } + + // test text file with utf-8 bom + { + { + kwsys::ofstream out("bom.txt"); + out.write(reinterpret_cast(expected_bom_data[0]+1), + *expected_bom_data[0]); + out << "Hello World"; + } + + kwsys::ifstream in("bom.txt"); + kwsys::FStream::BOM bom = kwsys::FStream::ReadBOM(in); + if(bom != kwsys::FStream::BOM_UTF8) + { + kwsys_ios::cout << "Unexpected BOM for utf-8 case" << std::endl; + return 1; + } + char data[45]; + in.read(data, file_data[0][0]); + if(!in.good()) + { + kwsys_ios::cout << "Unable to read data for utf-8 case" << std::endl; + return 1; + } + + if(memcmp(data, file_data[0]+1, file_data[0][0]) != 0) + { + kwsys_ios::cout << "Incorrect read data for utf-8 case" << std::endl; + return 1; + } + } + + return 0; +} + + +//---------------------------------------------------------------------------- +int testFStream(int, char*[]) +{ + int ret = 0; + + ret |= testNoFile(); + ret |= testBOM(); + + return ret; +} diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/Netlib/src/netlib/slatec/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/Netlib/src/netlib/slatec/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/Netlib/src/netlib/slatec/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/Netlib/src/netlib/slatec/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -19,7 +19,7 @@ initds.c xermsg.c d_int.c - d_mod.c + d_mod.c ) IF(ITK_USE_SYSTEM_VXL) @@ -32,13 +32,11 @@ SET_TARGET_PROPERTIES(itkNetlibSlatec PROPERTIES ${ITK_LIBRARY_PROPERTIES}) ENDIF(ITK_LIBRARY_PROPERTIES) -IF(NOT ITK_INSTALL_NO_LIBRARIES) - INSTALL(TARGETS itkNetlibSlatec - EXPORT ${ITK3P_INSTALL_EXPORT_NAME} - RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries - LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries - ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development) -ENDIF(NOT ITK_INSTALL_NO_LIBRARIES) +INSTALL(TARGETS itkNetlibSlatec + EXPORT ${ITK3P_INSTALL_EXPORT_NAME} + RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development) IF (BORLAND) SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w-8004 -w-8057") diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithm.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithm.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithm.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithm.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,334 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""defines few unrelated algorithms, that works on declarations""" + +import types + +def declaration_path( decl, with_defaults=True ): + """ + returns a list of parent declarations names + + @param decl: declaration for which declaration path should be calculated + @type decl: L{declaration_t} + + @return: [names], where first item contains top parent name and last item + contains decl name + """ + if not decl: + return [] + if not decl.cache.declaration_path: + result = [ decl.name ] + parent = decl.parent + while parent: + if parent.cache.declaration_path: + result.reverse() + decl.cache.declaration_path = parent.cache.declaration_path + result + return decl.cache.declaration_path + else: + result.append( parent.name ) + parent = parent.parent + result.reverse() + decl.cache.declaration_path = result + return result + else: + return decl.cache.declaration_path + +def partial_declaration_path( decl ): + """ + returns a list of parent declarations names without template arguments that + have default value + + @param decl: declaration for which declaration path should be calculated + @type decl: L{declaration_t} + + @return: [names], where first item contains top parent name and last item + contains decl name + """ + #TODO: + #If parent declaration cache already has declaration_path, reuse it for + #calculation. + if not decl: + return [] + if not decl.cache.partial_declaration_path: + result = [ decl.partial_name ] + parent = decl.parent + while parent: + if parent.cache.partial_declaration_path: + result.reverse() + decl.cache.partial_declaration_path \ + = parent.cache.partial_declaration_path + result + return decl.cache.partial_declaration_path + else: + result.append( parent.partial_name ) + parent = parent.parent + result.reverse() + decl.cache.partial_declaration_path = result + return result + else: + return decl.cache.partial_declaration_path + +def get_named_parent( decl ): + """ + returns a reference to a named parent declaration + + @param decl: the child declaration + @type decl: L{declaration_t} + + @return: reference to L{declaration_t} or None if not found + """ + if not decl: + return None + + parent = decl.parent + while parent and ( not parent.name or parent.name == '::' ): + parent = parent.parent + return parent + + +def full_name_from_declaration_path( dpath ): + ##Here I have lack of knowledge: + ##TODO: "What is the full name of declaration declared in unnamed namespace?" + result = filter( None, dpath ) + result = result[0] + '::'.join( result[1:] ) + return result + +def full_name( decl, with_defaults=True ): + """ + returns full name of the declaration + @param decl: declaration for which full name should be calculated. If decl + belongs to unnamed namespace, then L{full_name} is not valid C++ full name. + + @type decl: L{declaration_t} + + @return: full name of declarations. + """ + if None is decl: + raise RuntimeError( "Unable to generate full name for None object!" ) + if with_defaults: + if not decl.cache.full_name: + decl.cache.full_name = full_name_from_declaration_path( declaration_path( decl ) ) + return decl.cache.full_name + else: + if not decl.cache.full_partial_name: + decl.cache.full_partial_name \ + = full_name_from_declaration_path( partial_declaration_path( decl ) ) + return decl.cache.full_partial_name + +def make_flatten( decl_or_decls ): + """ + converts tree representation of declarations to flatten one. + + @param decl_or_decls: reference to list of declaration's or single declaration + @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] + + @return: [ all internal declarations ] + """ + import pygccxml.declarations #prevent cyclic import + def proceed_single( decl ): + answer = [ decl ] + if not isinstance( decl, pygccxml.declarations.scopedef_t ): + return answer + for elem in decl.declarations: + if isinstance( elem, pygccxml.declarations.scopedef_t ): + answer.extend( proceed_single( elem ) ) + else: + answer.append( elem ) + return answer + + decls = [] + if isinstance( decl_or_decls, types.ListType ): + decls.extend( decl_or_decls ) + else: + decls.append( decl_or_decls ) + answer = [] + for decl in decls: + answer.extend( proceed_single( decl ) ) + return answer + +def __make_flatten_generator( decl_or_decls ): + """ + converts tree representation of declarations to flatten one. + + @param decl_or_decls: reference to list of declaration's or single declaration + @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] + + @return: [ all internal declarations ] + """ + + import pygccxml.declarations + def proceed_single( decl ): + yield decl + if not isinstance( decl, pygccxml.declarations.scopedef_t): + return + for internal in decl.declarations: + if isinstance( internal, pygccxml.declarations.scopedef_t): + for internal_internal in proceed_single( internal ): + yield internal_internal + else: + yield internal + + if isinstance( decl_or_decls, types.ListType ): + for creator in decl_or_decls: + for internal in proceed_single( creator ): + yield internal + else: + for internal in proceed_single( decl_or_decls ): + yield internal + +def get_global_namespace(decls): + import pygccxml.declarations + found = filter( lambda decl: decl.name == '::' + and isinstance( decl, pygccxml.declarations.namespace_t ) + , make_flatten( decls ) ) + if len( found ) == 1: + return found[0] + raise RuntimeError( "Unable to find global namespace." ) + +class match_declaration_t: + """ + helper class for different search algorithms. + + This class will help developer to match declaration by: + - declaration type, for example L{class_t} or L{operator_t}. + - declaration name + - declaration full name + - reference to parent declaration + """ + + def __init__( self, type=None, name=None, fullname=None, parent=None ): + self.type = type + self.name = name + self.fullname = fullname + self.parent = parent + + def does_match_exist(self, inst): + """ + returns True if inst do match one of specified criteria + + @param inst: declaration instance + @type inst: L{declaration_t} + + @return: bool + """ + answer = True + if None != self.type: + answer &= isinstance( inst, self.type) + if None != self.name: + answer &= inst.name == self.name + if None != self.parent: + answer &= self.parent is inst.parent + if None != self.fullname: + if inst.name: + answer &= self.fullname == full_name( inst ) + else: + answer = False + return answer + + def __call__(self, inst): + """C{return self.does_match_exist(inst)}""" + return self.does_match_exist(inst) + +def find_all_declarations( declarations + , type=None + , name=None + , parent=None + , recursive=True + , fullname=None ): + """ + returns a list of all declarations that match criteria, defined by developer + + For more information about arguments see L{match_declaration_t} class. + + @return: [ matched declarations ] + """ + decls = [] + if recursive: + decls = make_flatten( declarations ) + else: + decls = declarations + + return filter( match_declaration_t(type, name, fullname, parent), decls ) + +def find_declaration( declarations + , type=None + , name=None + , parent=None + , recursive=True + , fullname=None ): + """ + returns single declaration that match criteria, defined by developer. + If more the one declaration was found None will be returned. + + For more information about arguments see L{match_declaration_t} class. + + @return: matched declaration L{declaration_t} or None + """ + decl = find_all_declarations( declarations, type=type, name=name, parent=parent, recursive=recursive, fullname=fullname ) + if len( decl ) == 1: + return decl[0] + +def find_first_declaration( declarations, type=None, name=None, parent=None, recursive=True, fullname=None ): + """ + returns first declaration that match criteria, defined by developer + + For more information about arguments see L{match_declaration_t} class. + + @return: matched declaration L{declaration_t} or None + """ + matcher = match_declaration_t(type, name, fullname, parent) + if recursive: + decls = make_flatten( declarations ) + else: + decls = declarations + for decl in decls: + if matcher( decl ): + return decl + return None + +def declaration_files(decl_or_decls): + """ + returns set of files + + Every declaration is declared in some file. This function returns set, that + contains all file names of declarations. + + @param decl_or_decls: reference to list of declaration's or single declaration + @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] + + @return: set( declaration file names ) + """ + files = set() + decls = make_flatten( decl_or_decls ) + for decl in decls: + if decl.location: + files.add( decl.location.file_name ) + return files + +class visit_function_has_not_been_found_t( RuntimeError ): + """ + exception that is raised, from L{apply_visitor}, when a visitor could not be + applied. + + """ + def __init__( self, visitor, decl_inst ): + RuntimeError.__init__( self ) + self.__msg = \ + "Unable to find visit function. Visitor class: %s. Declaration instance class: %s'" \ + % ( visitor.__class__.__name__, decl_inst.__class__.__name__ ) + def __str__(self): + return self.__msg + +def apply_visitor( visitor, decl_inst): + """ + applies a visitor on declaration instance + + @param visitor: instance + @type visitor: L{type_visitor_t} or L{decl_visitor_t} + """ + fname = 'visit_' + decl_inst.__class__.__name__[:-2] #removing '_t' from class name + if not hasattr(visitor, fname ): + raise visit_function_has_not_been_found_t( visitor, decl_inst ) + getattr( visitor, fname )() diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithms_cache.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithms_cache.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithms_cache.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/algorithms_cache.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,147 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines class that will keep results of different calculations. +""" + + +class declaration_algs_cache_t( object ): + def __init__( self ): + object.__init__( self ) + self._enabled = True + self._full_name = None + self._full_partial_name = None + self._access_type = None + self._demangled_name = None + self._declaration_path = None + self._partial_declaration_path = None + self._container_key_type = None + self._container_element_type = None + + def disable( self ): + self._enabled = False + + def enable( self ): + self._enabled = True + + @property + def enabled( self ): + return self._enabled + + def _get_full_name( self ): + return self._full_name + def _set_full_name( self, fname ): + if not self.enabled: + fname = None + self._full_name = fname + full_name = property( _get_full_name, _set_full_name ) + + def _get_full_partial_name( self ): + return self._full_partial_name + def _set_full_partial_name( self, fname ): + if not self.enabled: + fname = None + self._full_partial_name = fname + full_partial_name = property( _get_full_partial_name, _set_full_partial_name ) + + def _get_access_type( self ): + return self._access_type + def _set_access_type( self, access_type ): + if not self.enabled: + access_type = None + self._access_type = access_type + access_type = property( _get_access_type, _set_access_type ) + + def _get_demangled_name( self ): + return self._demangled_name + def _set_demangled_name( self, demangled_name ): + if not self.enabled: + demangled_name = None + self._demangled_name = demangled_name + demangled_name = property( _get_demangled_name, _set_demangled_name ) + + def _get_declaration_path( self ): + return self._declaration_path + def _set_declaration_path( self, declaration_path ): + if not self.enabled: + declaration_path = None + self._declaration_path = declaration_path + declaration_path = property( _get_declaration_path, _set_declaration_path ) + + def _get_partial_declaration_path( self ): + return self._partial_declaration_path + def _set_partial_declaration_path( self, partial_declaration_path ): + if not self.enabled: + partial_declaration_path = None + self._partial_declaration_path = partial_declaration_path + partial_declaration_path = property( _get_partial_declaration_path + , _set_partial_declaration_path ) + + def _get_container_element_type( self ): + return self._container_element_type + def _set_container_element_type( self, etype ): + if not self.enabled: + etype = None + self._container_element_type = etype + container_element_type = property( _get_container_element_type, _set_container_element_type ) + + def _get_container_key_type( self ): + return self._container_key_type + def _set_container_key_type( self, ktype ): + if not self.enabled: + ktype = None + self._container_key_type = ktype + container_key_type = property( _get_container_key_type, _set_container_key_type ) + + def reset( self ): + self.full_name = None + self.full_partial_name = None + self.access_type = None + self.demangled_name = None + self.declaration_path = None + self.partial_declaration_path = None + self.container_key_type = None + self.container_element_type = None + + def reset_name_based( self ): + self.full_name = None + self.full_partial_name = None + self.demangled_name = None + self.declaration_path = None + self.partial_declaration_path = None + self.container_key_type = None + self.container_element_type = None + + def reset_access_type( self ): + self.access_type = None + +class type_algs_cache_t( object ): + enabled = True + + @staticmethod + def disable(): + type_algs_cache_t.enabled = False + + @staticmethod + def enable( self ): + type_algs_cache_t.enabled = True + + def __init__( self ): + object.__init__( self ) + self._remove_alias = None + + def _get_remove_alias( self ): + return self._remove_alias + def _set_remove_alias( self, remove_alias ): + if not type_algs_cache_t.enabled: + remove_alias = None + self._remove_alias = remove_alias + + remove_alias = property( _get_remove_alias, _set_remove_alias ) + + def reset(self): + self.remove_alias = None + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/calldef.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/calldef.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/calldef.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/calldef.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,561 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines classes, that describes "callable" declarations + +This modules contains definition for next C++ declarations: + - operator + - member + - free + - function + - member + - free + - constructor + - destructor +""" + +import cpptypes +import algorithm +import declaration +import type_traits +import dependencies +import call_invocation + +class VIRTUALITY_TYPES: + """class that defines "virtuality" constants""" + NOT_VIRTUAL = 'not virtual' + VIRTUAL = 'virtual' + PURE_VIRTUAL = 'pure virtual' + ALL = [NOT_VIRTUAL, VIRTUAL, PURE_VIRTUAL] +#preserving backward compatebility +FUNCTION_VIRTUALITY_TYPES = VIRTUALITY_TYPES + +#First level in hierarchy of calldef +class argument_t(object): + """ + class, that describes argument of "callable" declaration + """ + + def __init__( self, name='', type=None, default_value=None, attributes=None): + object.__init__(self) + self._name = name + self._default_value = default_value + self._type = type + self._attributes = attributes + + def clone( self, **keywd ): + """constructs new argument_t instance + + return argument_t( name=keywd.get( 'name', self.name ) + , type=keywd.get( 'type', self.type ) + , default_value=keywd.get( 'default_value', self.default_value ) + , attributes=keywd.get( 'attributes', self.attributes ) ) + + """ + return argument_t( name=keywd.get( 'name', self.name ) + , type=keywd.get( 'type', self.type ) + , default_value=keywd.get( 'default_value', self.default_value ) + , attributes=keywd.get( 'attributes', self.attributes ) ) + + def __str__(self): + if self.ellipsis: + return "..." + else: + if self.default_value==None: + return "%s %s"%(self.type, self.name) + else: + return "%s %s=%s"%(self.type, self.name, self.default_value) + + def __eq__(self, other): + if not isinstance( other, self.__class__ ): + return False + return self.name == other.name \ + and self.default_value == other.default_value \ + and self.type == other.type + + def __ne__( self, other): + return not self.__eq__( other ) + + def __lt__(self, other): + if not isinstance( other, self.__class__ ): + return self.__class__.__name__ < other.__class__.__name__ + return self.name < other.name \ + and self.default_value < other.default_value \ + and self.type < other.type + + def _get_name(self): + return self._name + def _set_name(self, name): + self._name = name + name = property( _get_name, _set_name + , doc="""Argument name. + @type: str""" ) + + @property + def ellipsis(self): + """bool, if True argument represents ellipsis ( "..." ) in function definition""" + return isinstance( self.type, cpptypes.ellipsis_t ) + + def _get_default_value(self): + return self._default_value + def _set_default_value(self, default_value): + self._default_value = default_value + default_value = property( _get_default_value, _set_default_value + , doc="""Argument's default value or None. + @type: str""") + + def _get_type(self): + return self._type + def _set_type(self, type): + self._type = type + type = property( _get_type, _set_type + , doc="""The type of the argument. + @type: L{type_t}""") + + def _get_attributes( self ): + return self._attributes + def _set_attributes( self, attributes ): + self._attributes = attributes + attributes = property( _get_attributes, _set_attributes + , doc="""GCCXML attributes, set using __attribute__((gccxml("..."))) + @type: str + """ ) + + +class calldef_t( declaration.declaration_t ): + """base class for all "callable" declarations""" + def __init__( self, name='', arguments=None, exceptions=None, return_type=None, has_extern=False, does_throw=True ): + declaration.declaration_t.__init__( self, name ) + if not arguments: + arguments = [] + self._arguments = arguments + if not exceptions: + exceptions = [] + self._does_throw = does_throw + self._exceptions = exceptions + self._return_type = return_type + self._has_extern = has_extern + self._demangled_name = None + + def _get__cmp__call_items(self): + """implementation details""" + raise NotImplementedError() + + def _get__cmp__items( self ): + """implementation details""" + items = [ self.arguments + , self.return_type + , self.has_extern + , self.does_throw + , self._sorted_list( self.exceptions ) ] + items.extend( self._get__cmp__call_items() ) + return items + + def __eq__(self, other): + if not declaration.declaration_t.__eq__( self, other ): + return False + return self.return_type == other.return_type \ + and self.arguments == other.arguments \ + and self.has_extern == other.has_extern \ + and self.does_throw == other.does_throw \ + and self._sorted_list( self.exceptions ) \ + == other._sorted_list( other.exceptions ) + + def _get_arguments(self): + return self._arguments + def _set_arguments(self, arguments): + self._arguments = arguments + arguments = property( _get_arguments , _set_arguments + , doc="""The argument list. + @type: list of L{argument_t}""") + + @property + def has_ellipsis( self ): + return self.arguments and self.arguments[-1].ellipsis + + @property + def argument_types( self ): + """list of all argument types""" + return [ arg.type for arg in self.arguments ] + + @property + def required_args(self): + """list of all required arguments""" + r_args = [] + for arg in self.arguments: + if not arg.default_value: + r_args.append( arg ) + else: + break + return r_args + + @property + def optional_args(self): + """list of all optional arguments, the arguments that have default value""" + return self.arguments[ len( self.required_args ) : ] + + def _get_does_throw(self): + return self._does_throw + def _set_does_throw(self, does_throw): + self._does_throw = does_throw + does_throw = property( _get_does_throw, _set_does_throw, + doc="""If False, than function does not throw any exception. + In this case, function was declared with empty throw + statement. + """) + + def _get_exceptions(self): + return self._exceptions + def _set_exceptions(self, exceptions): + self._exceptions = exceptions + exceptions = property( _get_exceptions, _set_exceptions + , doc="""The list of exceptions. + @type: list of L{declaration_t}""") + + def _get_return_type(self): + return self._return_type + def _set_return_type(self, return_type): + self._return_type = return_type + return_type = property( _get_return_type, _set_return_type + , doc='''The type of the return value of the "callable" or None (constructors). + @type: L{type_t} + ''') + @property + def overloads(self): + """A list of overloaded "callables" (i.e. other callables with the same name within the same scope. + + @type: list of L{calldef_t} + """ + if not self.parent: + return [] + # finding all functions with the same name + return self.parent.calldefs( name=self.name + , function=lambda decl: not (decl is self ) + , allow_empty=True + , recursive=False ) + + def _get_has_extern(self): + return self._has_extern + def _set_has_extern(self, has_extern): + self._has_extern = has_extern + has_extern = property( _get_has_extern, _set_has_extern, + doc="""Was this callable declared as "extern"? + @type: bool + """) + + def __remove_parent_fname( self, demangled ): + """implementation details""" + demangled = demangled.strip() + parent_fname = algorithm.full_name( self.parent ) + if parent_fname.startswith( '::' ) and not demangled.startswith( '::' ): + parent_fname = parent_fname[2:] + demangled = demangled[ len( parent_fname ): ] + return demangled + + def _get_demangled_name( self ): + if not self.demangled: + self._demangled_name = '' + + if self._demangled_name: + return self._demangled_name + + if self._demangled_name == '': + return self.name + + demangled = self.demangled + if self.return_type: + return_type = type_traits.remove_alias( self.return_type ).decl_string + + if return_type.startswith( '::' ) and not self.demangled.startswith( '::' ): + return_type = return_type[2:] + demangled = self.demangled + if demangled.startswith( return_type ): + demangled = demangled[ len( return_type ): ] + demangled = demangled.strip() + #removing scope + demangled_name = call_invocation.name( self.__remove_parent_fname( demangled ) ) + if demangled_name.startswith( '::' ): + demangled_name = demangled_name[2:] + #to be on the safe side + if demangled_name.startswith( self.name ): + self._demangled_name = demangled_name + return self._demangled_name + + #well, I am going to try an other strategy + fname = algorithm.full_name( self ) + found = self.demangled.find( fname ) + if -1 == found: + if fname.startswith( '::' ): + fname = fname[2:] + found = self.demangled.find( fname ) + if -1 == found: + self._demangled_name = '' + return self.name + demangled_name = call_invocation.name( self.demangled[ found: ] ) + demangled_name = self.__remove_parent_fname( demangled_name ) + if demangled_name.startswith( '::' ): + demangled_name = demangled_name[2:] + #to be on the safe side + if demangled_name.startswith( self.name ): + self._demangled_name = demangled_name + return self._demangled_name + #if -1 == found: + self._demangled_name = '' + return self.name + + demangled_name = property( _get_demangled_name + , doc="returns function demangled name. It can help you to deal with function template instantiations") + + def i_depend_on_them( self, recursive=True ): + report_dependency = lambda *args, **keywd: dependencies.dependency_info_t( self, *args, **keywd ) + answer = [] + if self.return_type: + answer.append( report_dependency( self.return_type, hint="return type" ) ) + map( lambda arg: answer.append( report_dependency( arg.type ) ) + , self.arguments ) + map( lambda exception: answer.append( report_dependency( exception, hint="exception" ) ) + , self.exceptions ) + return answer + +#Second level in hierarchy of calldef +class member_calldef_t( calldef_t ): + """base class for "callable" declarations that defined within C++ class or struct""" + def __init__( self, virtuality=None, has_const=None, has_static=None, *args, **keywords ): + calldef_t.__init__( self, *args, **keywords ) + self._virtuality = virtuality + self._has_const = has_const + self._has_static = has_static + + def __str__(self): + # Get the full name of the calldef... + name = algorithm.full_name(self) + if name[:2]=="::": + name = name[2:] + # Add the arguments... + args = map(lambda a: str(a), self.arguments) + res = "%s(%s)"%(name, ", ".join(args)) + # Add the return type... + if self.return_type!=None: + res = "%s %s"%(self.return_type, res) + # const? + if self.has_const: + res += " const" + # static? + if self.has_static: + res = "static "+res + # Append the declaration class + cls = self.__class__.__name__ + if cls[-2:]=="_t": + cls = cls[:-2] + cls = cls.replace( '_', ' ' ) + return "%s [%s]"%(res, cls) + + def _get__cmp__call_items(self): + """implementation details""" + return [ self.virtuality, self.has_static, self.has_const ] + + def __eq__(self, other): + if not calldef_t.__eq__( self, other ): + return False + return self.virtuality == other.virtuality \ + and self.has_static == other.has_static \ + and self.has_const == other.has_const + + def get_virtuality(self): + return self._virtuality + def set_virtuality(self, virtuality): + assert virtuality in VIRTUALITY_TYPES.ALL + self._virtuality = virtuality + virtuality = property( get_virtuality, set_virtuality + , doc="""Describes the "virtuality" of the member (as defined by the string constants in the class L{VIRTUALITY_TYPES}). + @type: str""") + + def _get_access_type(self): + return self.parent.find_out_member_access_type( self ) + access_type = property( _get_access_type + , doc="""Return the access type of the member (as defined by the string constants in the class L{ACCESS_TYPES}. + @type: str""") + + def _get_has_const(self): + return self._has_const + def _set_has_const(self, has_const): + self._has_const = has_const + has_const = property( _get_has_const, _set_has_const + , doc="""describes, whether "callable" has const modifier or not""") + + def _get_has_static(self): + return self._has_static + def _set_has_static(self, has_static): + self._has_static = has_static + has_static = property( _get_has_static, _set_has_static + , doc="""describes, whether "callable" has static modifier or not""") + + def function_type(self): + """returns function type. See L{type_t} hierarchy""" + if self.has_static: + return cpptypes.free_function_type_t( return_type=self.return_type + , arguments_types=[ arg.type for arg in self.arguments ] ) + else: + return cpptypes.member_function_type_t( class_inst=self.parent + , return_type=self.return_type + , arguments_types=[ arg.type for arg in self.arguments ] + , has_const=self.has_const ) + + def create_decl_string(self, with_defaults=True): + f_type = self.function_type() + if with_defaults: + return f_type.decl_string + else: + return f_type.partial_decl_string + +class free_calldef_t( calldef_t ): + """base class for "callable" declarations that defined within C++ namespace""" + def __init__( self, *args, **keywords ): + calldef_t.__init__( self, *args, **keywords ) + + def __str__(self): + # Get the full name of the calldef... + name = algorithm.full_name(self) + if name[:2]=="::": + name = name[2:] + # Add the arguments... + args = map(lambda a: str(a), self.arguments) + res = "%s(%s)"%(name, ", ".join(args)) + # Add the return type... + if self.return_type!=None: + res = "%s %s"%(self.return_type, res) + # extern? + if self.has_extern: + res = "extern "+res + # Append the declaration class + cls = self.__class__.__name__ + if cls[-2:]=="_t": + cls = cls[:-2] + cls = cls.replace( '_', ' ' ) + return "%s [%s]"%(res, cls) + + def _get__cmp__call_items(self): + """implementation details""" + return [] + + def function_type(self): + """returns function type. See L{type_t} hierarchy""" + return cpptypes.free_function_type_t( return_type=self.return_type + , arguments_types=[ arg.type for arg in self.arguments ] ) + + def create_decl_string(self, with_defaults=True): + f_type = self.function_type() + if with_defaults: + return f_type.decl_string + else: + return f_type.partial_decl_string + + +class operator_t(object): + """base class for "operator" declarations""" + OPERATOR_WORD_LEN = len( 'operator' ) + def __init__(self): + object.__init__(self) + + @property + def symbol(self): + "operator's symbol. For example: operator+, symbol is equal to '+'" + return self.name[operator_t.OPERATOR_WORD_LEN:].strip() + +#Third level in hierarchy of calldef +class member_function_t( member_calldef_t ): + """describes member function declaration""" + def __init__( self, *args, **keywords ): + member_calldef_t.__init__( self, *args, **keywords ) + +class constructor_t( member_calldef_t ): + """describes constructor declaration""" + def __init__( self, *args, **keywords ): + member_calldef_t.__init__( self, *args, **keywords ) + + def __str__(self): + # Get the full name of the calldef... + name = algorithm.full_name(self) + if name[:2]=="::": + name = name[2:] + # Add the arguments... + args = map(lambda a: str(a), self.arguments) + res = "%s(%s)"%(name, ", ".join(args)) + # Append the declaration class + cls = 'constructor' + if self.is_copy_constructor: + cls = 'copy ' + cls + return "%s [%s]"%(res, cls) + + @property + def is_copy_constructor(self): + """returns True if described declaration is copy constructor, otherwise False""" + args = self.arguments + if 1 != len( args ): + return False + arg = args[0] + if not type_traits.is_reference( arg.type ): + return False + if not type_traits.is_const( arg.type.base ): + return False + unaliased = type_traits.remove_alias( arg.type.base ) + #unaliased now refers to const_t instance + if not isinstance( unaliased.base, cpptypes.declarated_t ): + return False + return id(unaliased.base.declaration) == id(self.parent) + + @property + def is_trivial_constructor(self): + return not bool( self.arguments ) + + +class destructor_t( member_calldef_t ): + """describes deconstructor declaration""" + def __init__( self, *args, **keywords ): + member_calldef_t.__init__( self, *args, **keywords ) + +class member_operator_t( member_calldef_t, operator_t ): + """describes member operator declaration""" + def __init__( self, *args, **keywords ): + member_calldef_t.__init__( self, *args, **keywords ) + operator_t.__init__( self, *args, **keywords ) + self.__class_types = None + +class casting_operator_t( member_calldef_t, operator_t ): + """describes casting operator declaration""" + def __init__( self, *args, **keywords ): + member_calldef_t.__init__( self, *args, **keywords ) + operator_t.__init__( self, *args, **keywords ) + +class free_function_t( free_calldef_t ): + """describes free function declaration""" + def __init__( self, *args, **keywords ): + free_calldef_t.__init__( self, *args, **keywords ) + +class free_operator_t( free_calldef_t, operator_t ): + """describes free operator declaration""" + def __init__( self, *args, **keywords ): + free_calldef_t.__init__( self, *args, **keywords ) + operator_t.__init__( self, *args, **keywords ) + self.__class_types = None + + @property + def class_types( self ): + """list of class/class declaration types, extracted from the operator arguments""" + if None is self.__class_types: + self.__class_types = [] + for type_ in self.argument_types: + decl = None + type_ = type_traits.remove_reference( type_ ) + if type_traits.is_class( type_ ): + decl = type_traits.class_traits.get_declaration( type_ ) + elif type_traits.is_class_declaration( type_ ): + decl = type_traits.class_declaration_traits.get_declaration( type_ ) + else: + pass + if decl: + self.__class_types.append( decl ) + return self.__class_types diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/call_invocation.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/call_invocation.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/call_invocation.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/call_invocation.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,78 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +free function call parser + +This module implements all functionality necessary to parse C++ free function +invocation. In other words this module is able to extract next information from +the string like this C{ print_message( message ) }. + - name ( print_message ) + - list of arguments ( message ) + +This module also defines few convenience function like L{split} and L{join}. +""" + +import pattern_parser + +__THE_PARSER = pattern_parser.parser_t( '(', ')', ',' ) + +def is_call_invocation( decl_string ): + """ + returns True if decl_string is function invocation and False otherwise + + @param decl_string: string that should be checked for pattern presence + @type decl_string: str + + @return: bool + """ + global __THE_PARSER + return __THE_PARSER.has_pattern( decl_string ) + +def name( decl_string ): + """ + returns name of function + + @type decl_string: str + @return: str + """ + global __THE_PARSER + return __THE_PARSER.name( decl_string ) + +def args( decl_string ): + """ + returns list of function arguments + + @type decl_string: str + @return: [str] + """ + global __THE_PARSER + return __THE_PARSER.args( decl_string ) + +NOT_FOUND = __THE_PARSER.NOT_FOUND +def find_args( text, start=None ): + """ + finds arguments within function invocation. + + @type text: str + @return: [ arguments ] or L{NOT_FOUND} if arguments could not be found + """ + global __THE_PARSER + return __THE_PARSER.find_args( text, start ) + +def split( decl_string ): + """returns (name, [arguments] )""" + global __THE_PARSER + return __THE_PARSER.split( decl_string ) + +def split_recursive( decl_string ): + """returns [(name, [arguments])]""" + global __THE_PARSER + return __THE_PARSER.split_recursive( decl_string ) + +def join( name, args, arg_separator=None ): + """returns name( argument_1, argument_2, ..., argument_n )""" + global __THE_PARSER + return __THE_PARSER.join( name, args, arg_separator ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/class_declaration.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/class_declaration.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/class_declaration.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/class_declaration.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,532 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines classes, that describes C++ classes + +This modules contains definition for next C++ declarations: + - class definition + - class declaration + - small helper class for describing C++ class hierarchy +""" + +import scopedef +import itertools +import compilers +import algorithm +import declaration +import dependencies +from pygccxml import utils + +class ACCESS_TYPES: + """class that defines "access" constants""" + PUBLIC = "public" + PRIVATE = "private" + PROTECTED = "protected" + ALL = [ PUBLIC, PRIVATE, PROTECTED ] + +class CLASS_TYPES: + """class that defines "class" type constants""" + CLASS = "class" + STRUCT = "struct" + UNION = "union" + ALL = [ CLASS, STRUCT, UNION ] + +def get_partial_name( name ): + import templates + import container_traits #prevent cyclic dependencies + ct = container_traits.find_container_traits( name ) + if ct: + return ct.remove_defaults( name ) + elif templates.is_instantiation( name ): + tmpl_name, args = templates.split( name ) + for i, arg_name in enumerate( args ): + args[i] = get_partial_name( arg_name.strip() ) + return templates.join( tmpl_name, args ) + else: + return name + + +class hierarchy_info_t( object ): + """describes class relationship""" + def __init__(self, related_class=None, access=None, is_virtual=False ): + """creates class that contains partial information about class relationship""" + if related_class: + assert( isinstance( related_class, class_t ) ) + self._related_class = related_class + if access: + assert( access in ACCESS_TYPES.ALL) + self._access=access + self._is_virtual = is_virtual + + def __eq__(self, other): + if not isinstance( other, hierarchy_info_t ): + return False + return algorithm.declaration_path( self.related_class ) == algorithm.declaration_path( other.related_class ) \ + and self.access == other.access \ + and self.is_virtual == other.is_virtual + + def __ne__( self, other): + return not self.__eq__( other ) + + def __lt__(self, other): + if not isinstance( other, self.__class__ ): + return self.__class__.__name__ < other.__class__.__name__ + return ( algorithm.declaration_path( self.related_class ), self.access, self.is_virtual ) \ + < ( algorithm.declaration_path( other.related_class ), other.access, self.is_virtual ) + + def _get_related_class(self): + return self._related_class + def _set_related_class(self, new_related_class): + if new_related_class: + assert( isinstance( new_related_class, class_t ) ) + self._related_class = new_related_class + related_class = property( _get_related_class, _set_related_class + , doc="reference to base or derived L{class}") + + def _get_access(self): + return self._access + def _set_access(self, new_access): + assert( new_access in ACCESS_TYPES.ALL ) + self._access = new_access + access = property( _get_access, _set_access ) + access_type = property( _get_access, _set_access + , doc="describes L{hierarchy type}") + + #TODO: check whether GCC XML support this and if so parser this information + def _get_is_virtual(self): + return self._is_virtual + def _set_is_virtual(self, new_is_virtual): + self._is_virtual = new_is_virtual + is_virtual = property( _get_is_virtual, _set_is_virtual + , doc="indicates whether the inheritance is virtual or not") + + +class class_declaration_t( declaration.declaration_t ): + """describes class declaration""" + def __init__( self, name='' ): + """creates class that describes C++ class declaration( and not definition )""" + declaration.declaration_t.__init__( self, name ) + self._aliases = [] + self._container_traits = None + self._container_traits_set = False + + def _get__cmp__items(self): + """implementation details""" + return [] + + def i_depend_on_them( self, recursive=True ): + return [] + + def _get_aliases(self): + return self._aliases + def _set_aliases( self, new_aliases ): + self._aliases = new_aliases + aliases = property( _get_aliases, _set_aliases + , doc="List of L{aliases} to this instance") + + @property + def container_traits( self ): + """reference to L{container traits} or None""" + if self._container_traits_set == False: + import container_traits #prevent cyclic dependencies + self._container_traits_set = True + self._container_traits = container_traits.find_container_traits( self ) + return self._container_traits + + def _get_partial_name_impl( self ): + return get_partial_name( self.name ) + +class class_t( scopedef.scopedef_t ): + """describes class definition""" + + USE_DEMANGLED_AS_NAME = True + def __init__( self, name='', class_type=CLASS_TYPES.CLASS, is_abstract=False ): + """creates class that describes C++ class definition""" + scopedef.scopedef_t.__init__( self, name ) + if class_type: + assert( class_type in CLASS_TYPES.ALL ) + self._class_type = class_type + self._bases = [] + self._derived = [] + self._is_abstract = is_abstract + self._public_members = [] + self._private_members = [] + self._protected_members = [] + self._aliases = [] + self._byte_size = 0 + self._byte_align = 0 + self._container_traits = None + self._container_traits_set = False + self._recursive_bases = None + self._recursive_derived = None + + def _get_name_impl( self ): + if not self._name: #class with empty name + return self._name + elif class_t.USE_DEMANGLED_AS_NAME and self.demangled and 'GCC' in self.compiler: + if not self.cache.demangled_name: + fname = algorithm.full_name( self.parent ) + if fname.startswith( '::' ) and not self.demangled.startswith( '::' ): + fname = fname[2:] + if self.demangled.startswith( fname ): + tmp = self.demangled[ len( fname ): ] #demangled::name + if tmp.startswith( '::' ): + tmp = tmp[2:] + if '<' not in tmp and '<' in self._name: + #we have template class, but for some reason demangled + #name doesn't contain any template + #This happens for std::string class, but this breaks + #other cases, because this behaviour is not consistent + self.cache.demangled_name = self._name + return self.cache.demangled_name + else: + self.cache.demangled_name = tmp + return tmp + else: + self.cache.demangled_name = self._name + return self._name + else: + return self.cache.demangled_name + else: + return self._name + + def __str__(self): + name = algorithm.full_name(self) + if name[:2]=="::": + name = name[2:] + return "%s [%s]"%(name, self.class_type) + + def _get__cmp__scope_items(self): + """implementation details""" + return [ self.class_type + , self._sorted_list( [ algorithm.declaration_path( base.related_class ) for base in self.bases ] ) + , self._sorted_list( [ algorithm.declaration_path( derive.related_class ) for derive in self.derived ] ) + , self.is_abstract + , self._sorted_list( self.public_members ) + , self._sorted_list( self.private_members ) + , self._sorted_list( self.protected_members ) ] + + def __eq__(self, other): + if not scopedef.scopedef_t.__eq__( self, other ): + return False + return self.class_type == other.class_type \ + and self._sorted_list( [ algorithm.declaration_path( base.related_class ) for base in self.bases ] ) \ + == other._sorted_list( [ algorithm.declaration_path( base.related_class ) for base in other.bases ] ) \ + and self._sorted_list( [ algorithm.declaration_path( derive.related_class ) for derive in self.derived ] ) \ + == other._sorted_list( [ algorithm.declaration_path( derive.related_class ) for derive in other.derived ] ) \ + and self.is_abstract == other.is_abstract \ + and self._sorted_list( self.public_members ) \ + == other._sorted_list( other.public_members ) \ + and self._sorted_list( self.private_members ) \ + == other._sorted_list( other.private_members ) \ + and self._sorted_list( self.protected_members ) \ + == self._sorted_list( other.protected_members ) + + def _get_class_type(self): + return self._class_type + def _set_class_type( self, new_class_type): + if new_class_type: + assert( new_class_type in CLASS_TYPES.ALL ) + self._class_type = new_class_type + class_type = property( _get_class_type, _set_class_type + , doc="describes class L{type}") + + def _get_bases(self): + return self._bases + def _set_bases( self, new_bases ): + self._bases = new_bases + bases = property( _get_bases, _set_bases + , doc="list of L{base classes}") + + @property + def recursive_bases(self): + """list of all L{base classes}""" + if self._recursive_bases is None: + to_go = self.bases[:] + all_bases = [] + while to_go: + base = to_go.pop() + if base not in all_bases: + all_bases.append( base ) + to_go.extend( base.related_class.bases ) + self._recursive_bases = all_bases + return self._recursive_bases + + def _get_derived(self): + return self._derived + def _set_derived( self, new_derived ): + self._derived = new_derived + derived = property( _get_derived, _set_derived + , doc="list of L{derived classes}") + + @property + def recursive_derived(self): + """list of all L{derive classes}""" + if self._recursive_derived is None: + to_go = self.derived[:] + all_derived = [] + while to_go: + derive = to_go.pop() + if derive not in all_derived: + all_derived.append( derive ) + to_go.extend( derive.related_class.derived ) + self._recursive_derived = all_derived + return self._recursive_derived + + def _get_is_abstract(self): + if self.compiler == compilers.MSVC_PDB_9: + #prevent cyclic dependencies + import calldef + import function_traits + from matchers import virtuality_type_matcher_t as vtmatcher_t + filter_pv = vtmatcher_t( calldef.VIRTUALITY_TYPES.PURE_VIRTUAL ) + if self.calldefs( filter_pv, recursive=False, allow_empty=True ): + return True + filter_npv = vtmatcher_t( calldef.VIRTUALITY_TYPES.VIRTUAL ) \ + | vtmatcher_t( calldef.VIRTUALITY_TYPES.NOT_VIRTUAL ) + pv_calldefs = [] + npv_calldefs = [] + + npv_calldefs.extend( self.calldefs( filter_npv, recursive=False, allow_empty=True ) ) + for base in self.recursive_bases: + cls = base.related_class + pv_calldefs.extend( cls.calldefs( filter_pv, recursive=False, allow_empty=True ) ) + npv_calldefs.extend( cls.calldefs( filter_npv, recursive=False, allow_empty=True ) ) + + for pure_virtual in pv_calldefs: + impl_found = filter( lambda f: function_traits.is_same_function( pure_virtual, f ) + , npv_calldefs ) + if not impl_found: + return True + return False + else: + return self._is_abstract + def _set_is_abstract( self, is_abstract ): + self._is_abstract = is_abstract + is_abstract = property( _get_is_abstract, _set_is_abstract + ,doc="describes whether class abstract or not" ) + + def _get_public_members(self): + return self._public_members + def _set_public_members( self, new_public_members ): + self._public_members = new_public_members + public_members = property( _get_public_members, _set_public_members + , doc="list of all public L{members}") + + def _get_private_members(self): + return self._private_members + def _set_private_members( self, new_private_members ): + self._private_members = new_private_members + private_members = property( _get_private_members, _set_private_members + , doc="list of all private L{members}") + + def _get_protected_members(self): + return self._protected_members + def _set_protected_members( self, new_protected_members ): + self._protected_members = new_protected_members + protected_members = property( _get_protected_members, _set_protected_members + , doc="list of all protected L{members}" ) + + def _get_aliases(self): + return self._aliases + def _set_aliases( self, new_aliases ): + self._aliases = new_aliases + aliases = property( _get_aliases, _set_aliases + , doc="List of L{aliases} to this instance") + + def _get_byte_size(self): + return self._byte_size + def _set_byte_size( self, new_byte_size ): + self._byte_size = new_byte_size + byte_size = property( _get_byte_size, _set_byte_size + , doc="Size of this class in bytes @type: int") + + def _get_byte_align(self): + if self.compiler == compilers.MSVC_PDB_9: + compilers.on_missing_functionality( self.compiler, "byte align" ) + return self._byte_align + def _set_byte_align( self, new_byte_align ): + self._byte_align = new_byte_align + byte_align = property( _get_byte_align, _set_byte_align + , doc="Alignment of this class in bytes @type: int") + + def _get_declarations_impl(self): + return self.get_members() + + def get_members( self, access=None): + """ + returns list of members according to access type + + If access equals to None, then returned list will contain all members. + You should not modify the list content, otherwise different optimization + data will stop work and may to give you wrong results. + + @param access: describes desired members + @type access: L{ACCESS_TYPES} + + @return: [ members ] + """ + if access == ACCESS_TYPES.PUBLIC: + return self.public_members + elif access == ACCESS_TYPES.PROTECTED: + return self.protected_members + elif access == ACCESS_TYPES.PRIVATE: + return self.private_members + else: + all_members = [] + all_members.extend( self.public_members ) + all_members.extend( self.protected_members ) + all_members.extend( self.private_members ) + return all_members + + def adopt_declaration( self, decl, access ): + """adds new declaration to the class + + @param decl: reference to a L{declaration} + + @param access: member access type + @type access: L{ACCESS_TYPES} + """ + if access == ACCESS_TYPES.PUBLIC: + self.public_members.append( decl ) + elif access == ACCESS_TYPES.PROTECTED: + self.protected_members.append( decl ) + elif access == ACCESS_TYPES.PRIVATE: + self.private_members.append( decl ) + else: + raise RuntimeError( "Invalid access type: %s." % access ) + decl.parent = self + decl.cache.reset() + decl.cache.access_type = access + + def remove_declaration( self, decl ): + """ + removes decl from members list + + @param decl: declaration to be removed + @type decl: L{declaration_t} + """ + container = None + access_type = self.find_out_member_access_type( decl ) + if access_type == ACCESS_TYPES.PUBLIC: + container = self.public_members + elif access_type == ACCESS_TYPES.PROTECTED: + container = self.protected_members + else: #decl.cache.access_type == ACCESS_TYPES.PRVATE + container = self.private_members + del container[ container.index( decl ) ] + decl.cache.reset() + + def find_out_member_access_type( self, member ): + """ + returns member access type + + @param member: member of the class + @type member: L{declaration_t} + + @return: L{ACCESS_TYPES} + """ + assert member.parent is self + if not member.cache.access_type: + access_type = None + if member in self.public_members: + access_type = ACCESS_TYPES.PUBLIC + elif member in self.protected_members: + access_type = ACCESS_TYPES.PROTECTED + elif member in self.private_members: + access_type = ACCESS_TYPES.PRIVATE + else: + raise RuntimeError( "Unable to find member within internal members list." ) + member.cache.access_type = access_type + return access_type + else: + return member.cache.access_type + + def __find_out_member_dependencies( self, access_type ): + members = self.get_members( access_type ) + answer = [] + map( lambda mem: answer.extend( mem.i_depend_on_them(recursive=True) ), members ) + member_ids = set( map( lambda m: id( m ), members ) ) + for dependency in answer: + if id( dependency.declaration ) in member_ids: + dependency.access_type = access_type + return answer + + def i_depend_on_them( self, recursive=True ): + report_dependency = lambda *args: dependencies.dependency_info_t( self, *args ) + + answer = [] + + map( lambda base: answer.append( report_dependency( base.related_class, base.access_type, "base class" ) ) + , self.bases ) + + if recursive: + map( lambda access_type: answer.extend( self.__find_out_member_dependencies( access_type ) ) + , ACCESS_TYPES.ALL ) + + return answer + + @property + def container_traits( self ): + """reference to L{container traits} or None""" + if self._container_traits_set == False: + import container_traits #prevent cyclic dependencies + self._container_traits_set = True + self._container_traits = container_traits.find_container_traits( self ) + return self._container_traits + + def find_copy_constructor( self ): + copy_ = self.constructors( lambda x: x.is_copy_constructor, recursive=False, allow_empty=True ) + if copy_: + return copy_[0] + else: + return None + + def find_trivial_constructor( self ): + trivial = self.constructors( lambda x: x.is_trivial_constructor, recursive=False, allow_empty=True ) + if trivial: + return trivial[0] + else: + return None + + def _get_partial_name_impl( self ): + import type_traits #prevent cyclic dependencies + if type_traits.is_std_string( self ): + return 'string' + elif type_traits.is_std_wstring( self ): + return 'wstring' + else: + return get_partial_name( self.name ) + + def find_noncopyable_vars( self ): + """returns list of all noncopyable variables""" + import type_traits as tt#prevent cyclic dependencies + logger = utils.loggers.cxx_parser + mvars = self.vars( lambda v: not v.type_qualifiers.has_static, recursive=False, allow_empty=True ) + noncopyable_vars = [] + for mvar in mvars: + type_ = tt.remove_reference( mvar.type ) + if tt.is_const( type_ ): + no_const = tt.remove_const( type_ ) + if tt.is_fundamental( no_const ) or tt.is_enum( no_const): + logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes const member variable - fundamental or enum" % self.decl_string ) + noncopyable_vars.append( mvar ) + if tt.is_class( no_const ): + logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes const member variable - class" % self.decl_string ) + noncopyable_vars.append( mvar ) + if tt.is_array( no_const ): + logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes const member variable - array" % self.decl_string ) + noncopyable_vars.append( mvar ) + if tt.class_traits.is_my_case( type_ ): + cls = tt.class_traits.get_declaration( type_ ) + if tt.is_noncopyable( cls ): + logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes member variable - class that is not copyable" % self.decl_string ) + noncopyable_vars.append( mvar ) + logger.debug( "__contains_noncopyable_mem_var - %s - false - doesn't contains noncopyable members" % self.decl_string ) + return noncopyable_vars + + +class_types = ( class_t, class_declaration_t ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/compilers.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/compilers.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/compilers.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/compilers.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,23 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +contains enumeration of all compilers supported by the project +""" + +GCC_XML_06 = "GCC-XML 0.6" +GCC_XML_07 = "GCC-XML 0.7" +GCC_XML_09 = "GCC-XML 0.9" +GCC_XML_09_BUGGY = "GCC-XML 0.9 BUGGY" +#revision 122: +#After this fix, all constructors and destructors that exist for a class +#are dumped whether the user declared them or not. Those that were +#implicitly declared by the compiler are marked as "artificial". + +MSVC_PDB_9 = "MSVC PDB 9.0" + +def on_missing_functionality( compiler, functionality ): + raise NotImplementedError( '"%s" compiler doesn\'t support functionality "%s"' + % ( compiler, functionality )) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/container_traits.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/container_traits.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/container_traits.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/container_traits.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,487 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines few algorithms, that deals with different properties of std containers +""" + +import types +import string +import calldef +import cpptypes +import namespace +import templates +import type_traits +import class_declaration + +std_namespaces = ( 'std', 'stdext', '__gnu_cxx' ) + +class defaults_eraser: + @staticmethod + def normalize( type_str ): + return type_str.replace( ' ', '' ) + + @staticmethod + def replace_basic_string( cls_name ): + strings = { + 'std::string' : ( 'std::basic_string,std::allocator >' + , 'std::basic_string, std::allocator >' ) + , 'std::wstring' : ( 'std::basic_string,std::allocator >' + , 'std::basic_string, std::allocator >' ) } + + new_name = cls_name + for short_name, long_names in strings.iteritems(): + for lname in long_names: + new_name = new_name.replace( lname, short_name ) + return new_name + + class recursive_impl: + @staticmethod + def decorated_call_prefix( cls_name, text, doit ): + has_text = cls_name.startswith( text ) + if has_text: + cls_name = cls_name[ len( text ): ] + answer = doit( cls_name ) + if has_text: + answer = text + answer + return answer + + @staticmethod + def decorated_call_suffix( cls_name, text, doit ): + has_text = cls_name.endswith( text ) + if has_text: + cls_name = cls_name[: len( text )] + answer = doit( cls_name ) + if has_text: + answer = answer + text + return answer + + @staticmethod + def erase_call( cls_name ): + global find_container_traits + c_traits = find_container_traits( cls_name ) + if not c_traits: + return cls_name + return c_traits.remove_defaults( cls_name ) + + @staticmethod + def erase_recursive( cls_name ): + ri = defaults_eraser.recursive_impl + no_std = lambda cls_name: ri.decorated_call_prefix( cls_name, 'std::', ri.erase_call ) + no_stdext = lambda cls_name: ri.decorated_call_prefix( cls_name, 'stdext::', no_std ) + no_gnustd = lambda cls_name: ri.decorated_call_prefix( cls_name, '__gnu_cxx::', no_stdext ) + no_const = lambda cls_name: ri.decorated_call_prefix( cls_name, 'const ', no_gnustd ) + no_end_const = lambda cls_name: ri.decorated_call_suffix( cls_name, ' const', no_const ) + return no_end_const( cls_name ) + + @staticmethod + def erase_recursive( cls_name ): + return defaults_eraser.recursive_impl.erase_recursive( cls_name ) + + @staticmethod + def erase_allocator( cls_name, default_allocator='std::allocator' ): + cls_name = defaults_eraser.replace_basic_string( cls_name ) + c_name, c_args = templates.split( cls_name ) + if 2 != len( c_args ): + return + value_type = c_args[0] + tmpl = string.Template( "$container< $value_type, $allocator<$value_type> >" ) + tmpl = tmpl.substitute( container=c_name, value_type=value_type, allocator=default_allocator ) + if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ): + return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) + + @staticmethod + def erase_container( cls_name, default_container_name='std::deque' ): + cls_name = defaults_eraser.replace_basic_string( cls_name ) + c_name, c_args = templates.split( cls_name ) + if 2 != len( c_args ): + return + value_type = c_args[0] + dc_no_defaults = defaults_eraser.erase_recursive( c_args[1] ) + if defaults_eraser.normalize( dc_no_defaults ) \ + != defaults_eraser.normalize( templates.join( default_container_name, [value_type] ) ): + return + return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) + + @staticmethod + def erase_container_compare( cls_name, default_container_name='std::vector', default_compare='std::less' ): + cls_name = defaults_eraser.replace_basic_string( cls_name ) + c_name, c_args = templates.split( cls_name ) + if 3 != len( c_args ): + return + dc_no_defaults = defaults_eraser.erase_recursive( c_args[1] ) + if defaults_eraser.normalize( dc_no_defaults ) \ + != defaults_eraser.normalize( templates.join( default_container_name, [c_args[0]] ) ): + return + dcomp_no_defaults = defaults_eraser.erase_recursive( c_args[2] ) + if defaults_eraser.normalize( dcomp_no_defaults ) \ + != defaults_eraser.normalize( templates.join( default_compare, [c_args[0]] ) ): + return + value_type = defaults_eraser.erase_recursive( c_args[0] ) + return templates.join( c_name, [value_type] ) + + @staticmethod + def erase_compare_allocator( cls_name, default_compare='std::less', default_allocator='std::allocator' ): + cls_name = defaults_eraser.replace_basic_string( cls_name ) + c_name, c_args = templates.split( cls_name ) + if 3 != len( c_args ): + return + value_type = c_args[0] + tmpl = string.Template( "$container< $value_type, $compare<$value_type>, $allocator<$value_type> >" ) + tmpl = tmpl.substitute( container=c_name + , value_type=value_type + , compare=default_compare + , allocator=default_allocator ) + if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ): + return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) + + @staticmethod + def erase_map_compare_allocator( cls_name, default_compare='std::less', default_allocator='std::allocator' ): + cls_name = defaults_eraser.replace_basic_string( cls_name ) + c_name, c_args = templates.split( cls_name ) + if 4 != len( c_args ): + return + key_type = c_args[0] + mapped_type = c_args[1] + tmpls = [ + string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< const $key_type, $mapped_type> > >" ) + , string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< $key_type const, $mapped_type> > >" ) + , string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< $key_type, $mapped_type> > >" )] + for tmpl in tmpls: + tmpl = tmpl.substitute( container=c_name + , key_type=key_type + , mapped_type=mapped_type + , compare=default_compare + , allocator=default_allocator ) + if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ): + return templates.join( c_name + , [ defaults_eraser.erase_recursive( key_type ) + , defaults_eraser.erase_recursive( mapped_type )] ) + + + @staticmethod + def erase_hash_allocator( cls_name ): + cls_name = defaults_eraser.replace_basic_string( cls_name ) + c_name, c_args = templates.split( cls_name ) + if len( c_args ) < 3: + return + + default_hash=None + default_less='std::less' + default_equal_to='std::equal_to' + default_allocator='std::allocator' + + tmpl = None + if 3 == len( c_args ): + default_hash='hash_compare' + tmpl = "$container< $value_type, $hash<$value_type, $less<$value_type> >, $allocator<$value_type> >" + elif 4 == len( c_args ): + default_hash='hash' + tmpl = "$container< $value_type, $hash<$value_type >, $equal_to<$value_type >, $allocator<$value_type> >" + else: + return + + value_type = c_args[0] + tmpl = string.Template( tmpl ) + for ns in std_namespaces: + inst = tmpl.substitute( container=c_name + , value_type=value_type + , hash= ns + '::' + default_hash + , less=default_less + , equal_to=default_equal_to + , allocator=default_allocator ) + if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( inst ): + return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) + + + @staticmethod + def erase_hashmap_compare_allocator( cls_name ): + cls_name = defaults_eraser.replace_basic_string( cls_name ) + c_name, c_args = templates.split( cls_name ) + + default_hash=None + default_less='std::less' + default_allocator='std::allocator' + default_equal_to = 'std::equal_to' + + tmpl = None + key_type = None + mapped_type = None + if 2 < len( c_args ): + key_type = c_args[0] + mapped_type = c_args[1] + else: + return + + if 4 == len( c_args ): + default_hash = 'hash_compare' + tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type, $less<$key_type> >, $allocator< std::pair< const $key_type, $mapped_type> > >" ) + if key_type.startswith( 'const ' ) or key_type.endswith( ' const' ): + tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type, $less<$key_type> >, $allocator< std::pair< $key_type, $mapped_type> > >" ) + elif 5 == len( c_args ): + default_hash = 'hash' + tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type >, $equal_to<$key_type>, $allocator< $mapped_type> >" ) + if key_type.startswith( 'const ' ) or key_type.endswith( ' const' ): + tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type >, $equal_to<$key_type>, $allocator< $mapped_type > >" ) + else: + return + + for ns in std_namespaces: + inst = tmpl.substitute( container=c_name + , key_type=key_type + , mapped_type=mapped_type + , hash=ns + '::' + default_hash + , less=default_less + , equal_to = default_equal_to + , allocator=default_allocator ) + if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( inst ): + return templates.join( c_name + , [ defaults_eraser.erase_recursive( key_type ) + , defaults_eraser.erase_recursive( mapped_type )] ) + + +class container_traits_impl_t: + """this class implements the functionality needed for convinient work with + STD container classes. + + Implemented functionality: + - find out whether a declaration is STD container or not + - find out container value( mapped ) type + + This class tries to be useful as much, as possible. For example, for class + declaration( and not definition ) it parsers the class name in order to + extract all the information. + """ + def __init__( self + , container_name + , element_type_index + , element_type_typedef + , defaults_remover + , key_type_index=None + , key_type_typedef=None ): + """ + container_name - std container name + element_type_index - position of value\\mapped type within template + arguments list + element_type_typedef - class typedef to the value\\mapped type + key_type_index - position of key type within template arguments list + key_type_typedef - class typedef to the key type + """ + self._name = container_name + self.remove_defaults_impl = defaults_remover + self.element_type_index = element_type_index + self.element_type_typedef = element_type_typedef + self.key_type_index = key_type_index + self.key_type_typedef = key_type_typedef + + def name(self): + return self._name + + def get_container_or_none( self, type ): + """returns reference to the class declaration or None""" + type = type_traits.remove_alias( type ) + type = type_traits.remove_cv( type ) + + cls = None + if isinstance( type, cpptypes.declarated_t ): + cls = type_traits.remove_alias( type.declaration ) + elif isinstance( type, class_declaration.class_t ): + cls = type + elif isinstance( type, class_declaration.class_declaration_t ): + cls = type + else: + return + + if not cls.name.startswith( self.name() + '<' ): + return + + for ns in std_namespaces: + if type_traits.impl_details.is_defined_in_xxx( ns, cls ): + return cls + + def is_my_case( self, type ): + """checks, whether type is STD container or not""" + return bool( self.get_container_or_none( type ) ) + + def class_declaration( self, type ): + """returns reference to the class declaration""" + cls = self.get_container_or_none( type ) + if not cls: + raise TypeError( 'Type "%s" is not instantiation of std::%s' % ( type.decl_string, self.name() ) ) + return cls + + def is_sequence( self, type ): + #raise exception if type is not container + unused = self.class_declaration( type ) + return self.key_type_index is None + + def is_mapping( self, type ): + return not self.is_sequence( type ) + + def __find_xxx_type( self, type, xxx_index, xxx_typedef, cache_property_name ): + cls = self.class_declaration( type ) + result = getattr( cls.cache, cache_property_name ) + if not result: + if isinstance( cls, class_declaration.class_t ): + xxx_type = cls.typedef( xxx_typedef, recursive=False ).type + result = type_traits.remove_declarated( xxx_type ) + else: + xxx_type_str = templates.args( cls.name )[xxx_index] + result = type_traits.impl_details.find_value_type( cls.top_parent, xxx_type_str ) + if None is result: + raise RuntimeError( "Unable to find out %s '%s' key\\value type." + % ( self.name(), cls.decl_string ) ) + setattr( cls.cache, cache_property_name, result ) + return result + + def element_type( self, type ): + """returns reference to the class value\\mapped type declaration""" + return self.__find_xxx_type( type + , self.element_type_index + , self.element_type_typedef + , 'container_element_type') + + def key_type( self, type ): + """returns reference to the class key type declaration""" + if not self.is_mapping( type ): + raise TypeError( 'Type "%s" is not "mapping" container' % str( type ) ) + return self.__find_xxx_type( type + , self.key_type_index + , self.key_type_typedef + , 'container_key_type' ) + + def remove_defaults( self, type_or_string ): + """remove template defaults from a template class instantiation + + For example: + std::vector< int, std::allocator< int > > + will become + std::vector< int > + """ + name = type_or_string + if not isinstance( type_or_string, types.StringTypes ): + name = self.class_declaration( type_or_string ).name + if not self.remove_defaults_impl: + return name + no_defaults = self.remove_defaults_impl( name ) + if not no_defaults: + return name + else: + return no_defaults + +create_traits = container_traits_impl_t +list_traits = create_traits( 'list' + , 0 + , 'value_type' + , defaults_eraser.erase_allocator ) + +deque_traits = create_traits( 'deque' + , 0 + , 'value_type' + , defaults_eraser.erase_allocator ) + +queue_traits = create_traits( 'queue' + , 0 + , 'value_type' + , defaults_eraser.erase_container ) + +priority_queue_traits = create_traits( 'priority_queue' + , 0 + , 'value_type' + , defaults_eraser.erase_container_compare ) + +vector_traits = create_traits( 'vector' + , 0 + , 'value_type' + , defaults_eraser.erase_allocator ) + +stack_traits = create_traits( 'stack' + , 0 + , 'value_type' + , defaults_eraser.erase_container ) + +map_traits = create_traits( 'map' + , 1 + , 'mapped_type' + , defaults_eraser.erase_map_compare_allocator + , key_type_index=0 + , key_type_typedef='key_type') + +multimap_traits = create_traits( 'multimap' + , 1 + , 'mapped_type' + , defaults_eraser.erase_map_compare_allocator + , key_type_index=0 + , key_type_typedef='key_type') + + +hash_map_traits = create_traits( 'hash_map' + , 1 + , 'mapped_type' + , defaults_eraser.erase_hashmap_compare_allocator + , key_type_index=0 + , key_type_typedef='key_type') + + +hash_multimap_traits = create_traits( 'hash_multimap' + , 1 + , 'mapped_type' + , defaults_eraser.erase_hashmap_compare_allocator + , key_type_index=0 + , key_type_typedef='key_type') + +set_traits = create_traits( 'set' + , 0 + , 'value_type' + , defaults_eraser.erase_compare_allocator) + +multiset_traits = create_traits( 'multiset' + , 0 + , 'value_type' + , defaults_eraser.erase_compare_allocator ) + +hash_set_traits = create_traits( 'hash_set' + , 0 + , 'value_type' + , defaults_eraser.erase_hash_allocator ) + +hash_multiset_traits = create_traits( 'hash_multiset' + , 0 + , 'value_type' + , defaults_eraser.erase_hash_allocator ) + +container_traits = ( + list_traits + , deque_traits + , queue_traits + , priority_queue_traits + , vector_traits + , stack_traits + , map_traits + , multimap_traits + , hash_map_traits + , hash_multimap_traits + , set_traits + , hash_set_traits + , multiset_traits + , hash_multiset_traits ) +"""tuple of all STD container traits classes""" + +def find_container_traits( cls_or_string ): + if isinstance( cls_or_string, types.StringTypes ): + if not templates.is_instantiation( cls_or_string ): + return None + name = templates.name( cls_or_string ) + if name.startswith( 'std::' ): + name = name[ len( 'std::' ): ] + for cls_traits in container_traits: + if cls_traits.name() == name: + return cls_traits + else: + for cls_traits in container_traits: + if cls_traits.is_my_case( cls_or_string ): + return cls_traits + + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/cpptypes.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/cpptypes.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/cpptypes.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/cpptypes.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,710 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines classes, that describe C++ types +""" + +import compilers +import algorithms_cache + +class type_t(object): + """base class for all types""" + def __init__(self): + object.__init__( self ) + self.cache = algorithms_cache.type_algs_cache_t() + self._byte_size = 0 + self._byte_align = 0 + self.compiler = None + + def __str__(self): + res = self.decl_string + if res[:2]=="::": + res = res[2:] + return res + + def __eq__(self, other): + if not isinstance( other, type_t ): + return False + return self.decl_string == other.decl_string + + def __ne__( self, other): + return not self.__eq__( other ) + + def __lt__(self, other): + if not isinstance( other, self.__class__ ): + return self.__class__.__name__ < other.__class__.__name__ + return self.decl_string < other.decl_string + + def build_decl_string(self, with_defaults=True): + raise NotImplementedError() + + @property + def decl_string( self ): + return self.build_decl_string() + + @property + def partial_decl_string( self ): + return self.build_decl_string( False ) + + def _clone_impl( self ): + raise NotImplementedError() + + def clone( self ): + "returns new instance of the type" + answer = self._clone_impl() + return answer + + def _get_byte_size(self): + return self._byte_size + def _set_byte_size( self, new_byte_size ): + self._byte_size = new_byte_size + byte_size = property( _get_byte_size, _set_byte_size + , doc="Size of this type in bytes @type: int") + + def _get_byte_align(self): + if self.compiler == compilers.MSVC_PDB_9: + compilers.on_missing_functionality( self.compiler, "byte align" ) + return self._byte_align + def _set_byte_align( self, new_byte_align ): + self._byte_align = new_byte_align + byte_align = property( _get_byte_align, _set_byte_align + , doc="Alignment of this type in bytes @type: int") + + +#There are cases when GCC-XML reports something like this +# +#In this case I will use this as type + + +class dummy_type_t( type_t ): + """provides L{type_t} interface for a string, that defines C++ type. + + This class could be very useful in the code generator. + """ + def __init__( self, decl_string ): + type_t.__init__( self ) + self._decl_string = decl_string + + def build_decl_string(self, with_defaults=True): + return self._decl_string + + def _clone_impl( self ): + return dummy_type_t( self._decl_string ) + +class unknown_t( type_t ): + "type, that represents all C++ types, that could not be parsed by GCC-XML" + def __init__( self ): + type_t.__init__( self ) + + def build_decl_string(self, with_defaults=True): + return '?unknown?' + + def _clone_impl( self ): + return self + +class ellipsis_t( type_t ): + """type, that represents "..." in function definition""" + def __init__( self ): + type_t.__init__( self ) + + def build_decl_string(self, with_defaults=True): + return '...' + + def _clone_impl( self ): + return self + +################################################################################ +## Fundamental types: + +class fundamental_t( type_t ): + """base class for all fundamental, build-in types""" + def __init__( self, name ): + type_t.__init__( self ) + self._name = name + + def build_decl_string(self, with_defaults=True): + return self._name + + def _clone_impl( self ): + return self + +class java_fundamental_t( fundamental_t ): + """base class for all JNI defined fundamental types""" + def __init__( self, name ): + fundamental_t.__init__( self, name ) + +class void_t( fundamental_t ): + """represents void type""" + CPPNAME = 'void' + def __init__( self ): + fundamental_t.__init__( self,void_t.CPPNAME ) + +class char_t( fundamental_t ): + """represents char type""" + CPPNAME = 'char' + def __init__( self ): + fundamental_t.__init__( self, char_t.CPPNAME ) + +class signed_char_t( fundamental_t ): + """represents signed char type""" + CPPNAME = 'signed char' + def __init__( self ): + fundamental_t.__init__( self, signed_char_t.CPPNAME ) + +class unsigned_char_t( fundamental_t ): + """represents unsigned char type""" + CPPNAME = 'unsigned char' + def __init__( self ): + fundamental_t.__init__( self, unsigned_char_t.CPPNAME ) + +class wchar_t( fundamental_t ): + """represents wchar_t type""" + CPPNAME = 'wchar_t' + def __init__( self ): + fundamental_t.__init__( self, wchar_t.CPPNAME ) + +class short_int_t( fundamental_t ): + """represents short int type""" + CPPNAME = 'short int' + def __init__( self ): + fundamental_t.__init__( self, short_int_t.CPPNAME ) + +class short_unsigned_int_t( fundamental_t ): + """represents short unsigned int type""" + CPPNAME = 'short unsigned int' + def __init__( self ): + fundamental_t.__init__( self, short_unsigned_int_t.CPPNAME ) + +class bool_t( fundamental_t ): + """represents bool type""" + CPPNAME = 'bool' + def __init__( self ): + fundamental_t.__init__( self, bool_t.CPPNAME ) + +class int_t( fundamental_t ): + """represents int type""" + CPPNAME = 'int' + def __init__( self ): + fundamental_t.__init__( self, int_t.CPPNAME ) + +class unsigned_int_t( fundamental_t ): + """represents unsigned int type""" + CPPNAME = 'unsigned int' + def __init__( self ): + fundamental_t.__init__( self, unsigned_int_t.CPPNAME ) + +class long_int_t( fundamental_t ): + """represents long int type""" + CPPNAME = 'long int' + def __init__( self ): + fundamental_t.__init__( self, long_int_t.CPPNAME ) + +class long_unsigned_int_t( fundamental_t ): + """represents long unsigned int type""" + CPPNAME = 'long unsigned int' + def __init__( self ): + fundamental_t.__init__( self, long_unsigned_int_t.CPPNAME ) + +class long_long_int_t( fundamental_t ): + """represents long long int type""" + CPPNAME = 'long long int' + def __init__( self ): + fundamental_t.__init__( self, long_long_int_t.CPPNAME ) + +class long_long_unsigned_int_t( fundamental_t ): + """represents long long unsigned int type""" + CPPNAME = 'long long unsigned int' + def __init__( self ): + fundamental_t.__init__( self, long_long_unsigned_int_t.CPPNAME ) + +class float_t( fundamental_t ): + """represents float type""" + CPPNAME = 'float' + def __init__( self ): + fundamental_t.__init__( self, float_t.CPPNAME ) + +class double_t( fundamental_t ): + """represents double type""" + CPPNAME = 'double' + def __init__( self ): + fundamental_t.__init__( self, double_t.CPPNAME ) + +class long_double_t( fundamental_t ): + """represents long double type""" + CPPNAME = 'long double' + def __init__( self ): + fundamental_t.__init__( self, long_double_t.CPPNAME ) + +class complex_double_t( fundamental_t ): + """represents complex double type""" + CPPNAME = 'complex double' + def __init__( self ): + fundamental_t.__init__( self, complex_double_t.CPPNAME ) + +class complex_long_double_t( fundamental_t ): + """represents complex long double type""" + CPPNAME = 'complex long double' + def __init__( self ): + fundamental_t.__init__( self, complex_long_double_t.CPPNAME ) + +class complex_float_t( fundamental_t ): + """represents complex float type""" + CPPNAME = 'complex float' + def __init__( self ): + fundamental_t.__init__( self, complex_float_t.CPPNAME ) + +class jbyte_t( java_fundamental_t ): + """represents jbyte type""" + JNAME = 'jbyte' + def __init__( self ): + java_fundamental_t.__init__( self, jbyte_t.JNAME ) + +class jshort_t( java_fundamental_t ): + """represents jshort type""" + JNAME = 'jshort' + def __init__( self ): + java_fundamental_t.__init__( self, jshort_t.JNAME ) + +class jint_t( java_fundamental_t ): + """represents jint type""" + JNAME = 'jint' + def __init__( self ): + java_fundamental_t.__init__( self, jint_t.JNAME ) + +class jlong_t( java_fundamental_t ): + """represents jlong type""" + JNAME = 'jlong' + def __init__( self ): + java_fundamental_t.__init__( self, jlong_t.JNAME ) + +class jfloat_t( java_fundamental_t ): + """represents jfloat type""" + JNAME = 'jfloat' + def __init__( self ): + java_fundamental_t.__init__( self, jfloat_t.JNAME ) + +class jdouble_t( java_fundamental_t ): + """represents jdouble type""" + JNAME = 'jdouble' + def __init__( self ): + java_fundamental_t.__init__( self, jdouble_t.JNAME ) + +class jchar_t( java_fundamental_t ): + """represents jchar type""" + JNAME = 'jchar' + def __init__( self ): + java_fundamental_t.__init__( self, jchar_t.JNAME ) + +class jboolean_t( java_fundamental_t ): + """represents jboolean type""" + JNAME = 'jboolean' + def __init__( self ): + java_fundamental_t.__init__( self, jboolean_t.JNAME ) + +FUNDAMENTAL_TYPES = { + void_t.CPPNAME : void_t() + , char_t.CPPNAME : char_t() + , signed_char_t.CPPNAME : signed_char_t() + , unsigned_char_t.CPPNAME : unsigned_char_t() + , wchar_t.CPPNAME : wchar_t() + , short_int_t.CPPNAME : short_int_t() + , 'signed ' + short_int_t.CPPNAME : short_int_t() + , short_unsigned_int_t.CPPNAME : short_unsigned_int_t() + , bool_t.CPPNAME : bool_t() + , int_t.CPPNAME : int_t() + , 'signed ' + int_t.CPPNAME : int_t() + , unsigned_int_t.CPPNAME : unsigned_int_t() + , long_int_t.CPPNAME : long_int_t() + , long_unsigned_int_t.CPPNAME : long_unsigned_int_t() + , long_long_int_t.CPPNAME : long_long_int_t() + , long_long_unsigned_int_t.CPPNAME : long_long_unsigned_int_t() + , float_t.CPPNAME : float_t() + , double_t.CPPNAME : double_t() + , long_double_t.CPPNAME : long_double_t() + , complex_long_double_t.CPPNAME : complex_long_double_t() + , complex_double_t.CPPNAME : complex_double_t() + , complex_float_t.CPPNAME : complex_float_t() + ##adding java types + , jbyte_t.JNAME : jbyte_t() + , jshort_t.JNAME : jshort_t() + , jint_t.JNAME : jint_t() + , jlong_t.JNAME : jlong_t() + , jfloat_t.JNAME : jfloat_t() + , jdouble_t.JNAME : jdouble_t() + , jchar_t.JNAME : jchar_t() + , jboolean_t.JNAME : jboolean_t() + , '__java_byte' : jbyte_t() + , '__java_short' : jshort_t() + , '__java_int' : jint_t() + , '__java_long' : jlong_t() + , '__java_float' : jfloat_t() + , '__java_double' : jdouble_t() + , '__java_char' : jchar_t() + , '__java_boolean' : jboolean_t() +} +""" +defines a mapping between fundamental type name and its synonym to the instance +of class that describes the type +""" + +################################################################################ +## Compaund types: + +class compound_t( type_t ): + """class that allows to represent compound types like C{const int*}""" + def __init__( self, base ): + type_t.__init__( self ) + self._base = base + + def _get_base(self): + return self._base + def _set_base(self, new_base): + self._base = new_base + + base = property( _get_base, _set_base + , doc="reference to internal/base class") + +class volatile_t( compound_t ): + """represents C{volatile whatever} type""" + def __init__( self, base ): + compound_t.__init__( self, base) + + def build_decl_string(self, with_defaults=True): + return 'volatile ' + self.base.build_decl_string(with_defaults) + + def _clone_impl( self ): + return volatile_t( self.base.clone() ) + +class restrict_t( compound_t ): + """represents C{restrict whatever} type""" + + #The restrict keyword can be considered an extension to the strict aliasing + #rule. It allows the programmer to declare that pointers which share the same + #type (or were otherwise validly created) do not alias eachother. By using + #restrict the programmer can declare that any loads and stores through the + #qualified pointer (or through another pointer copied either directly or + #indirectly from the restricted pointer) are the only loads and stores to + #the same address during the lifetime of the pointer. In other words, the + #pointer is not aliased by any pointers other than its own copies. + + def __init__( self, base ): + compound_t.__init__( self, base) + + def build_decl_string(self, with_defaults=True): + return '__restrict__ ' + self.base.build_decl_string( with_defaults ) + + def _clone_impl( self ): + return restrict_t( self.base.clone() ) + +class const_t( compound_t ): + """represents C{whatever const} type""" + def __init__( self, base ): + compound_t.__init__( self, base ) + + def build_decl_string(self, with_defaults=True): + return self.base.build_decl_string(with_defaults) + ' const' + + def _clone_impl( self ): + return const_t( self.base.clone() ) + +class pointer_t( compound_t ): + """represents C{whatever*} type""" + def __init__( self, base ): + compound_t.__init__( self, base ) + + def build_decl_string(self, with_defaults=True): + return self.base.build_decl_string( with_defaults ) + ' *' + + def _clone_impl( self ): + return pointer_t( self.base.clone() ) + +class reference_t( compound_t ): + """represents C{whatever&} type""" + def __init__( self, base ): + compound_t.__init__( self, base) + + def build_decl_string(self, with_defaults=True): + return self.base.build_decl_string(with_defaults) + ' &' + + def _clone_impl( self ): + return reference_t( self.base.clone() ) + +class array_t( compound_t ): + """represents C++ array type""" + SIZE_UNKNOWN = -1 + def __init__( self, base, size ): + compound_t.__init__( self, base ) + self._size = size + + def _get_size(self): + return self._size + def _set_size(self, size):#sometimes there is a need to update the size of the array + self.cache.reset() + self._size = size + size = property( _get_size, _set_size, + doc="returns array size" ) + + def build_decl_string(self, with_defaults=True): + return self.base.build_decl_string(with_defaults) + '[%d]' % self.size + + def _clone_impl( self ): + return array_t( self.base.clone(), self.size ) + +class calldef_type_t( object ): + """base class for all types that describes "callable" declaration""" + def __init__( self, return_type=None, arguments_types=None ): + object.__init__( self ) + self._return_type = return_type + if arguments_types is None: + arguments_types = [] + self._arguments_types = arguments_types + + def _get_return_type(self): + return self._return_type + def _set_return_type(self, new_return_type): + self._return_type = new_return_type + return_type = property( _get_return_type, _set_return_type + , doc="reference to L{return type}") + + def _get_arguments_types(self): + return self._arguments_types + def _set_arguments_types(self, new_arguments_types): + self._arguments_types = new_arguments_types + arguments_types = property( _get_arguments_types, _set_arguments_types + , doc="list of argument L{types}") + + @property + def has_ellipsis( self ): + return self.arguments_types and isinstance( self.arguments_types[-1], ellipsis_t ) + + +class free_function_type_t( type_t, calldef_type_t ): + """describes free function type""" + NAME_TEMPLATE = '%(return_type)s (*)( %(arguments)s )' + TYPEDEF_NAME_TEMPLATE = '%(return_type)s ( *%(typedef_name)s )( %(arguments)s )' + def __init__( self, return_type=None, arguments_types=None ): + type_t.__init__(self) + calldef_type_t.__init__( self, return_type, arguments_types ) + + @staticmethod + def create_decl_string( return_type, arguments_types, with_defaults=True ): + """ + returns free function type + + @param return_type: function return type + @type return_type: L{type_t} + + @param arguments_types: list of argument L{type} + + @return: L{free_function_type_t} + """ + return free_function_type_t.NAME_TEMPLATE % { + 'return_type' : return_type.build_decl_string( with_defaults ) + , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults ) + , arguments_types ) ) } + + def build_decl_string(self, with_defaults=True): + return self.create_decl_string( self.return_type, self.arguments_types, with_defaults ) + + def _clone_impl( self ): + rt_clone = None + if self.return_type: + rt_clone = self.return_type.clone() + return free_function_type_t( rt_clone + , [ arg.clone() for arg in self.arguments_types ] ) + + #TODO: create real typedef + def create_typedef( self, typedef_name, unused=None, with_defaults=True): + """returns string, that contains valid C++ code, that defines typedef to function type + + @param name: the desired name of typedef + """ + #unused argument simplifies user code + return free_function_type_t.TYPEDEF_NAME_TEMPLATE % { + 'typedef_name' : typedef_name + , 'return_type' : self.return_type.build_decl_string( with_defaults ) + , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults ) + , self.arguments_types ) ) } + +class member_function_type_t( type_t, calldef_type_t ): + """describes member function type""" + NAME_TEMPLATE = '%(return_type)s ( %(class)s::* )( %(arguments)s ) %(has_const)s' + TYPEDEF_NAME_TEMPLATE = '%(return_type)s ( %(class)s::*%(typedef_name)s )( %(arguments)s ) %(has_const)s' + + def __init__( self, class_inst=None, return_type=None, arguments_types=None, has_const=False): + type_t.__init__(self) + calldef_type_t.__init__( self, return_type, arguments_types ) + self._has_const = has_const + self._class_inst = class_inst + + def _get_has_const(self): + return self._has_const + def _set_has_const(self, has_const ): + self._has_const = has_const + has_const = property( _get_has_const, _set_has_const + , doc="describes, whether function has const modifier") + + def _get_class_inst(self): + return self._class_inst + def _set_class_inst(self, class_inst ): + self._class_inst = class_inst + class_inst = property( _get_class_inst, _set_class_inst + ,doc="reference to parent L{class}" ) + + #TODO: create real typedef + def create_typedef( self, typedef_name, class_alias=None, with_defaults=True): + """creates typedef to the function type + + @param typedef_name: desired type name + @return: string + """ + has_const_str = '' + if self.has_const: + has_const_str = 'const' + if None is class_alias: + if with_defaults: + class_alias = self.class_inst.decl_string + else: + class_alias = self.class_inst.partial_decl_string + return member_function_type_t.TYPEDEF_NAME_TEMPLATE % { + 'typedef_name' : typedef_name + , 'return_type' : self.return_type.build_decl_string( with_defaults ) + , 'class' : class_alias + , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults) + , self.arguments_types ) ) + , 'has_const' : has_const_str } + + def create(self): + return self.build_decl_string( self.return_type + , self.class_inst.decl_string + , self.arguments_types + , self.has_const ) + + + @staticmethod + def create_decl_string(return_type, class_decl_string, arguments_types, has_const, with_defaults=True): + has_const_str = '' + if has_const: + has_const_str = 'const' + return_type_decl_string = '' + if return_type: + return_type_decl_string = return_type.build_decl_string( with_defaults ) + return member_function_type_t.NAME_TEMPLATE % { + 'return_type' : return_type_decl_string + , 'class' : class_decl_string + , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults) + , arguments_types ) ) + , 'has_const' : has_const_str } + + def build_decl_string(self, with_defaults=True): + return self.create_decl_string( self.return_type + , self.class_inst.decl_string + , self.arguments_types + , self.has_const + , with_defaults) + + def _clone_impl( self ): + rt_clone = None + if self.return_type: + rt_clone = self.return_type.clone() + + return member_function_type_t( self.class_inst + , rt_clone + , [ arg.clone() for arg in self.arguments_types ] + , self.has_const ) + + +class member_variable_type_t( compound_t ): + """describes member variable type""" + NAME_TEMPLATE = '%(type)s ( %(class)s::* )' + def __init__( self, class_inst=None, variable_type=None ): + compound_t.__init__(self, class_inst) + self._mv_type = variable_type + + def _get_variable_type(self): + return self._mv_type + def _set_variable_type(self, new_type): + self._mv_type = new_type + variable_type = property( _get_variable_type, _set_variable_type + , doc="describes member variable L{type}") + + def build_decl_string(self, with_defaults=True): + return self.NAME_TEMPLATE % { 'type' : self.variable_type.build_decl_string(with_defaults) + , 'class' : self.base.build_decl_string(with_defaults) } + + def _clone_impl( self ): + return member_variable_type_t( class_inst=self.base + , variable_type=self.variable_type.clone() ) + + +################################################################################ +## declarated types: + +class declarated_t( type_t ): + """class that binds between to hierarchies: L{type_t} and L{declaration_t}""" + def __init__( self, declaration ): + type_t.__init__( self ) + self._declaration = declaration + + def _get_declaration(self): + return self._declaration + def _set_declaration(self, new_declaration): + self._declaration = new_declaration + declaration = property( _get_declaration, _set_declaration + , doc="reference to L{declaration}") + + def build_decl_string(self, with_defaults=True): + if with_defaults: + return self._declaration.decl_string + else: + return self._declaration.partial_decl_string + + def _clone_impl( self ): + return declarated_t( self._declaration ) + + @property + def byte_size (self): + "Size of this type in bytes @type: int" + return self._declaration.byte_size + + @property + def byte_align (self): + "alignment of this type in bytes @type: int" + return self._declaration.byte_align + +class type_qualifiers_t( object ): + """contains additional information about type: mutable, static, extern""" + def __init__(self, has_static=False, has_mutable=False ): + self._has_static = has_static + self._has_mutable = has_mutable + + def __eq__(self, other): + if not isinstance( other, type_qualifiers_t ): + return False + return self.has_static == other.has_static \ + and self.has_mutable == other.has_mutable + + def __ne__( self, other): + return not self.__eq__( other ) + + def __lt__(self, other): + if not isinstance( other, type_qualifiers_t ): + return object.__lt__( self, other ) + return self.has_static < other.has_static \ + and self.has_mutable < other.has_mutable + + def _get_has_static(self): + return self._has_static + def _set_has_static(self, has_static ): + self._has_static = has_static + has_static = property( _get_has_static, _set_has_static ) + has_extern = has_static #synonim to static + + def _get_has_mutable(self): + return self._has_mutable + def _set_has_mutable(self, has_mutable ): + self._has_mutable = has_mutable + has_mutable = property( _get_has_mutable, _set_has_mutable ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/declaration.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,277 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines 2 important classes + +This module defines: +* declaration_t - base class for all pygccxml defined classes, which describe + a C++ declaration +* location_t - provides information about physical location of the declaration +""" + +import algorithm +import templates +import algorithms_cache + +class location_t(object): + """provides information about the location of the declaration within the source file""" + + def __init__(self, file_name='', line=-1 ): + self._file_name = file_name + self._line = line + + def __eq__(self, other): + if not isinstance( other, self.__class__ ): + return False + return self.line == other.line \ + and self.file_name == other.file_name + + def __ne__( self, other): + return not self.__eq__( other ) + + def __lt__( self, other ): + if not isinstance( other, location_t ): + return self.__class__.__name__ < other.__class__.__name__ + return ( self.file_name, self.line ) < ( other.file_name, other.line ) + + def _get_file_name(self): + return self._file_name + def _set_file_name(self, new_file_name): + self._file_name = new_file_name + file_name = property( _get_file_name, _set_file_name + , doc="""absolute source file name, type string""" ) + + def _get_line( self ): + return self._line + def _set_line( self, new_line ): + self._line = new_line + line = property( _get_line, _set_line, doc="""line number, type int""") + + def as_tuple( self ): + """return tuple(self.file_name, self.line)""" + return (self.file_name, self.line) + +class declaration_t( object ): + """base class for all classes that represent a C++ declaration""" + + def __init__( self, name='', location=None, is_artificial=False, mangled=None, demangled=None, attributes=None ): + self._name = name + self._location = location + self._is_artificial = is_artificial + self._mangled = mangled + self._demangled = demangled + self._attributes = attributes + self._parent = None + self._cache = algorithms_cache.declaration_algs_cache_t() + self._compiler = None + self._partial_name = None + + def __str__(self): + """Default __str__ method. + + This version just returns the decl_string and the class. + Derived classes may override this method to provide more detailed + information. + + A __str__ method for a declaration should always provide enough + information so that it uniquely identifies the declaration and + the user is able to find the declaration in his source code. + """ + name = self.decl_string + if name[:2]=="::": + name = name[2:] + # Append the declaration class + cls = self.__class__.__name__ + if cls[-2:]=="_t": + cls = cls[:-2] + cls = cls.replace( '_', ' ' ) + return "%s [%s]"%(name, cls) + + @staticmethod + def _sorted_list( some_list ): + """implementation details""" + some_list.sort() + return some_list + + def _get__cmp__items( self ): + """implementation details""" + #Every derived class should implement this method. This method should + #return a list of items, that should be compared. + + print '_get__cmp__items not implemented for class ', self.__class__.__name__ + raise NotImplemented() + + def _get__cmp__data(self): + """implementation details""" + data = [ algorithm.declaration_path( self.parent ), self.name, self.location ] + data.extend( self._get__cmp__items() ) + return data + + def __eq__(self, other): + """ + function will return true, if both declarations refers to the same object. + This function could be implemented in terms of _get__cmp__data, but in + this case it will downgrade performance. self.mangled property is not + compared, because it could be chaned from one compilation time to an + other. + """ + if not isinstance( other, self.__class__ ): + return False + return self.name == other.name \ + and self.location == other.location \ + and algorithm.declaration_path( self.parent ) \ + == algorithm.declaration_path( other.parent ) + + def __ne__( self, other): + """return not self.__eq__( other )""" + return not self.__eq__( other ) + + def __lt__(self, other): + """ + C{if not isinstance( other, self.__class__ ):} + C{ return self.__class__.__name__ < other.__class__.__name__} + C{return self._get__cmp__data() < other._get__cmp__data()} + """ + if not isinstance( other, self.__class__ ): + return self.__class__.__name__ < other.__class__.__name__ + return self._get__cmp__data() < other._get__cmp__data() + + def _get_name_impl( self ): + return self._name + + def _get_name( self ): + return self._get_name_impl() + + def _on_rename( self ): + pass + + def _set_name( self, new_name ): + previous_name = self._name + self._name = new_name + self._partial_name = None + self.cache.reset_name_based() + if previous_name: #the was a rename and not initial "set" + self._on_rename() + + name = property( _get_name, _set_name + , doc="""Declaration name + @type: str + """) + + def _get_partial_name_impl( self ): + return self.name + + @property + def partial_name( self ): + """declaration name, without template default arguments + Right now std containers is the only classes that support this functionality""" + if None is self._partial_name: + self._partial_name = self._get_partial_name_impl() + return self._partial_name + + def _get_parent(self): + return self._parent + def _set_parent(self, new_parent): + if new_parent: + assert( isinstance( new_parent, declaration_t ) ) + self._parent = new_parent + parent = property( _get_parent, _set_parent + , doc="""Reference to parent declaration + @type: declaration_t + """) + + def __get_top_parent(self): + parent = self.parent + me = self + while True: + if not parent: + return me + else: + me = parent + parent = me.parent + top_parent = property( __get_top_parent, + doc="""reference to top parent declaration + @type: declaration_t + """ ) + + def _get_location( self ): + return self._location + def _set_location( self, new_location ): + self._location = new_location + location = property( _get_location, _set_location + , doc="""Location of the declaration within source file + @type: L{location_t} + """) + + def _get_is_artificial( self ): + return self._is_artificial + def _set_is_artificial( self, new_artificial ): + self._is_artificial = new_artificial + is_artificial = property( _get_is_artificial, _set_is_artificial + , doc="""Describes whether declaration is compiler generated or not + @type: bool + """) + + def _get_mangled( self ): + return self._mangled + def _set_mangled( self, mangled ): + self._mangled = mangled + mangled = property( _get_mangled, _set_mangled + , doc="""Compiler generated declaration name + @type: str + """ ) + + def _get_demangled( self ): + return self._demangled + def _set_demangled( self, demangled ): + self._demangled = demangled + demangled = property( _get_demangled, _set_demangled + , doc="""Demangled compiler generated declaration name + @type: str + """ ) + + def _get_attributes( self ): + return self._attributes + def _set_attributes( self, attributes ): + self._attributes = attributes + attributes = property( _get_attributes, _set_attributes + , doc="""GCCXML attributes, set using __attribute__((gccxml("..."))) + @type: str + """ ) + + def create_decl_string(self, with_defaults=True): + return algorithm.full_name( self, with_defaults ) + + @property + def decl_string(self): + """declaration full name""" + return self.create_decl_string() + + @property + def partial_decl_string(self): + """declaration full name""" + return self.create_decl_string(with_defaults=False) + + @property + def cache( self ): + """implementation details + + reference to instance of L{algorithms_cache.algorithms_cache_t} class. + """ + return self._cache + + def i_depend_on_them( self, recursive=True ): + """return list of all types and declarations the declaration depends on""" + print self + raise NotImplementedError() + + def _get_compiler( self ): + return self._compiler + def _set_compiler( self, compiler ): + self._compiler = compiler + compiler = property( _get_compiler, _set_compiler + , doc="""compiler name + version + @type: str""" ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_factory.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_factory.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_factory.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_factory.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,82 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines default declarations factory class +""" + +from calldef import member_function_t +from calldef import constructor_t +from calldef import destructor_t +from calldef import member_operator_t +from calldef import casting_operator_t +from calldef import free_function_t +from calldef import free_operator_t +from enumeration import enumeration_t +from namespace import namespace_t +from class_declaration import class_t +from class_declaration import class_declaration_t +from typedef import typedef_t +from variable import variable_t + +class decl_factory_t(object): + """ + declarations factory class + """ + def __init__(self): + """creates declarations factory""" + object.__init__(self) + + def create_member_function( self, *arguments, **keywords ): + """creates instance of class that describes member function declaration""" + return member_function_t(*arguments, **keywords) + + def create_constructor( self, *arguments, **keywords ): + """creates instance of class that describes constructor declaration""" + return constructor_t(*arguments, **keywords) + + def create_destructor( self, *arguments, **keywords ): + """creates instance of class that describes destructor declaration""" + return destructor_t(*arguments, **keywords) + + def create_member_operator( self, *arguments, **keywords ): + """creates instance of class that describes member operator declaration""" + return member_operator_t(*arguments, **keywords) + + def create_casting_operator( self, *arguments, **keywords ): + """creates instance of class that describes casting operator declaration""" + return casting_operator_t(*arguments, **keywords) + + def create_free_function( self, *arguments, **keywords ): + """creates instance of class that describes free function declaration""" + return free_function_t(*arguments, **keywords) + + def create_free_operator( self, *arguments, **keywords ): + """creates instance of class that describes free operator declaration""" + return free_operator_t(*arguments, **keywords) + + def create_class_declaration(self, *arguments, **keywords ): + """creates instance of class that describes class declaration""" + return class_declaration_t(*arguments, **keywords) + + def create_class( self, *arguments, **keywords ): + """creates instance of class that describes class definition declaration""" + return class_t(*arguments, **keywords) + + def create_enumeration( self, *arguments, **keywords ): + """creates instance of class that describes enumeration declaration""" + return enumeration_t(*arguments, **keywords) + + def create_namespace( self, *arguments, **keywords ): + """creates instance of class that describes namespace declaration""" + return namespace_t(*arguments, **keywords) + + def create_typedef( self, *arguments, **keywords ): + """creates instance of class that describes typedef declaration""" + return typedef_t(*arguments, **keywords) + + def create_variable( self, *arguments, **keywords ): + """creates instance of class that describes variable declaration""" + return variable_t(*arguments, **keywords) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_printer.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_printer.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_printer.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_printer.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,258 @@ +# Copyright 2004-2008 Roman Yakovenko, 2006 Allen Bierbaum, Matthias Baas +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines class, decl_printer_t that prints declarations tree in a user friendly format +""" + +import os +import sys +import calldef +import algorithm +import decl_visitor + + +class decl_printer_t( decl_visitor.decl_visitor_t ): + """Helper class for printing decl tree. + + This class provides more information than the __str__() methods do. + The class is not just meant to provide a unique "id" for a declaration + but to inspect an entire declaration tree. This is particularly useful + for new users who want to find out how Py++ works and how it + stores its data. + """ + JUSTIFY = 20 + INDENT_SIZE = 4 + + def __init__( self, level=0, print_details=True, recursive=True, writer=None ): + decl_visitor.decl_visitor_t.__init__(self) + self.__inst = None + self.__level = level + self.__print_details = print_details + self.__recursive = recursive + self.__writer = writer + if not self.__writer: + self.__writer = lambda x: sys.stdout.write( x + os.linesep ) + + def clone(self, increment_level=True): + level = self.__level + if increment_level: + level += 1 + return decl_printer_t( level + , self.print_details + , recursive=self.recursive + , writer=self.writer ) + + def _get_recursive(self): + return self.__recursive + def _set_recursive(self, recursive): + self.__recursive = recursive + recursive = property( _get_recursive, _set_recursive) + + def _get_level(self): + return self.__level + def _set_level(self, lvl): + self.__level = lvl + level = property( _get_level, _set_level ) + + def _get_print_details(self): + return self.__print_details + def _set_print_details(self, details): + self.__print_details = details + print_details = property( _get_print_details, _set_print_details) + + def _get_writer(self): + return self.__writer + def _set_writer(self, writer): + self.__writer = writer + writer = property( _get_writer, _set_writer) + + def _get_inst(self): + return self.__inst + def _set_inst(self, inst): + self.__inst = inst + instance = property( _get_inst, _set_inst ) + + def __nice_decl_name( self, inst ): + name = inst.__class__.__name__ + return name + #if name.endswith( '_t' ): + # name = name[:-len('_t')] + #return name.replace( '_', ' ' ) + + def print_decl_header(self): + header = self.__nice_decl_name( self.__inst ) + ": '%s'" % self.__inst.name + self.writer( ' ' * self.level * self.INDENT_SIZE + header.ljust( self.JUSTIFY )) + if self.__print_details: + curr_level = self.level + 1 + if self.__inst.location: + location = 'location: [%s]:%s'%(self.__inst.location.file_name, self.__inst.location.line) + self.writer( ' ' * curr_level * self.INDENT_SIZE + location) + artificial = 'artificial: ' + "'%s'" % str(self.__inst.is_artificial) + self.writer( ' ' * curr_level * self.INDENT_SIZE + artificial.ljust( self.JUSTIFY )) + if self.__inst.attributes: + attributes = 'attributes: %s'%(self.__inst.attributes) + self.writer( ' ' * curr_level * self.INDENT_SIZE + attributes) + if self.__inst.demangled: + demangled = 'demangled: %s'%(self.__inst.demangled) + self.writer( ' ' * curr_level * self.INDENT_SIZE + demangled) + if self.__inst.mangled: + mangled = 'mangled: %s'%(self.__inst.mangled) + self.writer( ' ' * curr_level * self.INDENT_SIZE + mangled) + + + + def print_calldef_info(self, decl=None): + """ Returns function signature: [retval, [arg1, ..., argN]]. """ + if None is decl: + decl = self.__inst + + retval = None + if decl.return_type: + retval = decl.return_type.decl_string + args = [] + for arg in decl.arguments: + args.append(arg.type.decl_string + ' ' + arg.name) + indent = ' ' * (self.level+1) * self.INDENT_SIZE + self.writer( indent + "return type: " + str(retval) ) + self.writer( indent + "arguments type: " + ', '.join(args)) + if isinstance( decl, calldef.member_calldef_t ): + self.writer( indent + "virtual: " + str(decl.virtuality)) + self.writer( indent + "is const: " + str(decl.has_const)) + self.writer( indent + "is static: " + str(decl.has_static)) + + def visit_member_function( self ): + self.print_decl_header() + self.print_calldef_info() + + def visit_constructor( self ): + self.print_decl_header() + self.print_calldef_info() + + if self.__print_details: + self.writer( ' ' * ( self.level + 1 ) * self.INDENT_SIZE + + 'copy constructor: ' + str(self.__inst.is_copy_constructor) ) + + def visit_destructor( self ): + self.print_decl_header() + + def visit_member_operator( self ): + self.print_decl_header() + self.print_calldef_info() + + def visit_casting_operator( self ): + self.print_decl_header() + self.print_calldef_info() + + def visit_free_function( self ): + self.print_decl_header() + self.print_calldef_info() + + def visit_free_operator( self ): + self.print_decl_header() + self.print_calldef_info() + + def visit_class_declaration(self ): + self.print_decl_header() + + def visit_class(self ): + self.print_decl_header() + curr_level = self.level + 1 + class_type = 'class type: ' + "'%s'" % str(self.__inst.class_type) + self.writer( ' ' * curr_level * self.INDENT_SIZE + class_type.ljust( self.JUSTIFY )) + if self.__print_details: + byte_size = 'size: %d'%(self.__inst.byte_size) + self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_size.ljust( self.JUSTIFY )) + try: + byte_align = 'align: %d'%(self.__inst.byte_align) + self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_align.ljust( self.JUSTIFY )) + except NotImplementedError: + self.writer( ' ' * curr_level * self.INDENT_SIZE + "align: not implemented".ljust( self.JUSTIFY )) + + if self.__inst.aliases: + aliases = map( lambda typedef: typedef.name, self.__inst.aliases ) + aliases.sort() + msg = 'aliases: ' + `aliases` + self.writer( ' ' * curr_level * self.INDENT_SIZE + msg.ljust( self.JUSTIFY )) + + def print_hierarchy(hierarchy_type, classes, curr_level): + self.writer( ' ' * curr_level * self.INDENT_SIZE + hierarchy_type.ljust( self.JUSTIFY )) + curr_level += 1 + for class_ in classes: + class_str = 'class: ' + "'%s'" % str(class_.related_class.decl_string) + self.writer( ' ' * curr_level * self.INDENT_SIZE + class_str.ljust( self.JUSTIFY )) + access = 'access type: ' + "'%s'" % str(class_.access) + self.writer( ' ' * (curr_level + 1)* self.INDENT_SIZE + access.ljust( self.JUSTIFY )) + if not ( None is class_.is_virtual ): + is_virtual = 'virtual inheritance: ' + "'%s'" % str(class_.is_virtual) + self.writer( ' ' * (curr_level + 1)* self.INDENT_SIZE + is_virtual.ljust( self.JUSTIFY )) + + def print_members(members_type, members, curr_level): + self.writer( ' ' * curr_level * self.INDENT_SIZE + members_type.ljust( self.JUSTIFY )) + if self.__recursive: + curr_level += 1 + for member in members: + prn = self.clone() + prn.instance = member + algorithm.apply_visitor( prn, member ) + + if self.__inst.bases: + print_hierarchy( 'base classes: ', self.__inst.bases, curr_level ) + + if self.__inst.derived: + print_hierarchy( 'derived classes: ', self.__inst.derived, curr_level ) + + print_members( 'public: ', self.__inst.public_members, curr_level ) + print_members( 'protected: ', self.__inst.protected_members, curr_level ) + print_members( 'private: ', self.__inst.private_members, curr_level ) + + def visit_enumeration(self): + self.print_decl_header() + curr_level = self.level + 1 + self.writer( ' ' * curr_level * self.INDENT_SIZE + 'values:'.ljust( self.JUSTIFY ) ) + value_level = ' ' * ( curr_level + 1 )* self.INDENT_SIZE + self.writer( os.linesep ) + for name, value in self.__inst.values: + self.writer( value_level + "%s : %s"% (name, value)) + + def visit_namespace(self ): + self.print_decl_header() + if self.__recursive: + for decl in self.__inst.declarations: + prn = self.clone() + prn.instance = decl + algorithm.apply_visitor( prn, decl ) + + def visit_typedef(self ): + self.print_decl_header() + curr_level = self.level + 1 + self.writer( ' ' * curr_level * self.INDENT_SIZE + 'alias to: ' + self.__inst.type.decl_string) + + def visit_variable(self ): + self.print_decl_header() + curr_level = self.level + 1 + self.writer( ' ' * curr_level * self.INDENT_SIZE + 'type: %s value: %s'%(self.__inst.type.decl_string, self.__inst.value) + os.linesep) + if self.__print_details: + byte_size = 'size: %d'%(self.__inst.type.byte_size) + self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_size.ljust( self.JUSTIFY )) + try: + byte_align = 'align: %d'%(self.__inst.type.byte_align) + self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_align.ljust( self.JUSTIFY )) + except NotImplementedError: + self.writer( ' ' * curr_level * self.INDENT_SIZE + "align: not implemented".ljust( self.JUSTIFY )) + byte_offset = 'offset: %d'%(self.__inst.byte_offset) + self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_offset + os.linesep) + +def print_declarations( decls, detailed=True, recursive=True, writer=lambda x: sys.stdout.write( x + os.linesep ) ): + """ Print decl tree rooted at each of the included nodes. + decls - either a single decl or a list of decls. + """ + prn = decl_printer_t(0, detailed, recursive, writer) + if type(decls) is not list: + decls = [decls] + for d in decls: + prn.level = 0 + prn.instance = d + algorithm.apply_visitor(prn, d) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_visitor.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_visitor.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_visitor.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/decl_visitor.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,56 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines declarations visitor class interface +""" + +class decl_visitor_t(object): + """ + declarations visitor interface + + All functions within this class should be redefined in derived classes. + """ + def __init__(self): + object.__init__(self) + + def visit_member_function( self ): + raise NotImplementedError() + + def visit_constructor( self ): + raise NotImplementedError() + + def visit_destructor( self ): + raise NotImplementedError() + + def visit_member_operator( self ): + raise NotImplementedError() + + def visit_casting_operator( self ): + raise NotImplementedError() + + def visit_free_function( self ): + raise NotImplementedError() + + def visit_free_operator( self ): + raise NotImplementedError() + + def visit_class_declaration(self ): + raise NotImplementedError() + + def visit_class(self ): + raise NotImplementedError() + + def visit_enumeration(self ): + raise NotImplementedError() + + def visit_namespace(self ): + raise NotImplementedError() + + def visit_typedef(self ): + raise NotImplementedError() + + def visit_variable(self ): + raise NotImplementedError() \ No newline at end of file diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/dependencies.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/dependencies.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/dependencies.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/dependencies.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,61 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +this module contains class that keeps dependency information of some declaration +""" + +import cpptypes + +class dependency_info_t( object ): + def __init__( self, declaration, depend_on_it, access_type=None, hint=None ): + object.__init__( self ) + #prevent recursive import + import class_declaration + assert isinstance( depend_on_it, ( class_declaration.class_t, cpptypes.type_t ) ) + self._declaration = declaration + self._depend_on_it = depend_on_it + self._access_type = access_type + self._hint = hint + + @property + def declaration( self ): + return self._declaration + #short name + decl = declaration + + @property + def depend_on_it( self ): + return self._depend_on_it + + def _get_access_type( self ): + return self._access_type + def _set_access_type( self, access_type ): + self._access_type = access_type + access_type = property( _get_access_type, _set_access_type ) + + def __str__( self ): + return 'declaration "%s" depends( %s ) on "%s" ' \ + % ( self.declaration, self.access_type, self.depend_on_it ) + + @property + def hint(self): + """the declaration, that report dependency can put some additional inforamtion + about dependency. It can be used later""" + return self._hint + + def find_out_depend_on_declaration( self ): + """if declaration depends on other declaration and not on some type + this function will return reference to it. Otherwise None will be returned + """ + #prevent recursive import + from pygccxml import declarations + + if isinstance( self.depend_on_it, declarations.declaration_t ): + return self.depend_on_it + base_type = declarations.base_type( declarations.remove_alias( self.depend_on_it ) ) + if isinstance( base_type, cpptypes.declarated_t ): + return base_type.declaration + return None diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/enumeration.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/enumeration.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/enumeration.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/enumeration.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,138 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines class, that describes C++ enum +""" + +import copy +import types +import compilers +import declaration + +class enumeration_t( declaration.declaration_t ): + """ + describes C++ enum + """ + def __init__( self, name='', values=None ): + """creates class that describes C++ enum declaration + + The items of the list 'values' may either be strings containing + the enumeration value name or tuples (name, numvalue). + + @param name: Enum name + @type name: str + @param parent: Parent declaration + @type parent: declaration_t + @param values: Enumeration values + @type values: list + """ + declaration.declaration_t.__init__( self, name ) + + # A list of tuples (valname(str), valnum(int)). The order of the list should + # be the same as the order in the C/C++ source file. + self._values = [] + + # Initialize values via property access + self.values = values + self._byte_size = 0 + self._byte_align = 0 + + def __eq__(self, other): + if not declaration.declaration_t.__eq__( self, other ): + return False + return self.values == other.values + + def _get__cmp__items( self ): + """implementation details""" + return [self.values] + + def _get_values(self): + return copy.copy(self._values) + def _set_values(self, values): + self._values = [] + # None is treated like an empty list + if (values==None): + return + # Check that we have indeed a list... + if type(values)!=list: + raise ValueError, "'values' must be a list (got a %s instead)"%type(values).__name__ + # Append the items individually. This has the effect that there's + # some additional type checking and that a copy of 'values' is stored + # and the caller cannot further manipulate the list via his own reference + for item in values: + if isinstance(item, types.StringTypes): + self.append_value(item) + elif type(item)==tuple: + name,num = item + self.append_value(name, num) + else: + raise ValueError, "'values' contains an invalid item: %s"%item + values = property( _get_values, _set_values + , doc="""A list of tuples (valname(str), valnum(int)) that contain the enumeration values. + @type: list""") + + def append_value(self, valuename, valuenum=None): + """Append another enumeration value to the enum. + + The numeric value may be None in which case it is automatically determined by + increasing the value of the last item. + + When the 'values' attribute is accessed the resulting list will be in the same + order as append_value() was called. + + @param valuename: The name of the value. + @type valuename: str + @param valuenum: The numeric value or None. + @type valuenum: int + """ + # No number given? Then use the previous one + 1 + if valuenum==None: + if len(self._values)==0: + valuenum = 0 + else: + valuenum = self._values[-1][1]+1 + + # Store the new value + self._values.append((valuename, int(valuenum))) + + def has_value_name(self, name): + """Check if this enum has a particular name among its values. + + @param name: Enumeration value name + @type name: str + @return: True if there is an enumeration value with the given name + """ + for val,num in self._values: + if val==name: + return True + return False + + def get_name2value_dict( self ): + """returns a dictionary, that maps between enum name( key ) and enum value( value )""" + x = {} + for val, num in self._values: + x[val] = num + return x + + def i_depend_on_them( self, recursive=True ): + return [] + + def _get_byte_size(self): + return self._byte_size + def _set_byte_size( self, new_byte_size ): + self._byte_size = new_byte_size + byte_size = property( _get_byte_size, _set_byte_size + , doc="Size of this class in bytes @type: int") + + def _get_byte_align(self): + if self.compiler == compilers.MSVC_PDB_9: + compilers.on_missing_functionality( self.compiler, "byte align" ) + return self._byte_align + def _set_byte_align( self, new_byte_align ): + self._byte_align = new_byte_align + byte_align = property( _get_byte_align, _set_byte_align + , doc="Alignment of this class in bytes @type: int") + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/filtering.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/filtering.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/filtering.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/filtering.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,79 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +deprecated! + +This module defines few algorithms for filtering declarations. +""" + +import os +import algorithm + +class filtering: + """deprecated! + + defines few algorithms for filtering declarations + """ + + @staticmethod + def normalize_path( some_path ): + """return os.path.normcase( os.path.normpath( some_path ) )""" + return os.path.normcase( os.path.normpath( some_path ) ) + + @staticmethod + def contains_parent_dir( fpath, dirs ): + #precondition: dirs and fpath should be normalize_path'ed before calling this function + return bool( filter( lambda dir: fpath.startswith( dir ), dirs ) ) + + @staticmethod + def by_location( decls, locations ): + """ + returns list of declarations that belongs to specified locations. + + This function works recursively. Pay attention: if you remove namespace, + then you remove all declarations defined within the namespace. + + @param decls: declaration or list of declarations + @type decls: L{declaration} or list of L{declarations} + + @param locations: list of directories and/or files names + @type locations: list of strings + + @return: list of L{declarations} + """ + #precondition: decls is a list of op level namespaces + #locations is list of directories and\or files + temp_decls = algorithm.make_flatten( decls ) + locations = map( filtering.normalize_path, locations ) + dirs = filter( lambda location: os.path.isdir( location ), locations ) + files = filter( lambda location: os.path.isfile( location ), locations ) + result = [] + for decl in temp_decls: + if not decl.location: + result.append( decl ) + continue + fpath = filtering.normalize_path( decl.location.file_name ) + if filtering.contains_parent_dir( fpath, dirs ) or fpath in files: + result.append( decl ) + return result + + @staticmethod + def user_defined( decls, matcher ): + """ + returns list of declarations that match user specified criteria. + + This function works recursively. + + @param decls: declaration or list of declarations + @type decls: L{declaration} or list of L{declarations} + + @param matcher: callable object, that takes 1 argument - declaration + and returns True if object should stay, and false otherwise + + @return: list of L{declarations} + """ + #precondition: decls is a list of op level namespaces + return filter( matcher, algorithm.make_flatten( decls ) ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/function_traits.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/function_traits.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/function_traits.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/function_traits.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,92 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines few algorithms, that deals with different properties of functions +""" + +import calldef +import type_traits +import class_declaration + +def is_same_return_type( f1, f2 ): + #covariant returns + #The return type of an overriding function shall be either identical to the + #return type of the overridden function or covariant with the classes of the + #functions. If a function D::f overrides a function B::f, the return types + #of the functions are covariant if they satisfy the following criteria: + + #* both are pointers to classes or references to classes + #* the class in the return type of B::f is the same class as the class in + # the return type of D::f or, is an unambiguous direct or indirect base + # class of the class in the return type of D::f and is accessible in D + #* both pointers or references have the same cv-qualification and the class + # type in the return type of D::f has the same cv-qualification as or less + # cv-qualification than the class type in the return type of B::f. + + if not f1.__class__ is f2.__class__: + #it should be assert + return False #2 different calldef types + if not isinstance( f1, calldef.member_calldef_t ): + #for free functions we compare return types as usual + return type_traits.is_same( f1.return_type, f2.return_type) + if f1.virtuality == calldef.VIRTUALITY_TYPES.NOT_VIRTUAL \ + or f2.virtuality == calldef.VIRTUALITY_TYPES.NOT_VIRTUAL: + #for non-virtual member functions we compare types as usual + return type_traits.is_same( f1.return_type, f2.return_type) + rt1 = f1.return_type + rt2 = f2.return_type + if type_traits.is_pointer( rt1 ) and type_traits.is_pointer( rt2 ): + rt1 = type_traits.remove_pointer( rt1 ) + rt2 = type_traits.remove_pointer( rt2 ) + elif type_traits.is_reference( rt1 ) and type_traits.is_reference( rt2 ): + rt1 = type_traits.remove_reference( rt1 ) + rt2 = type_traits.remove_reference( rt2 ) + else: + return type_traits.is_same( f1.return_type, f2.return_type) + if ( type_traits.is_const( rt1 ) and type_traits.is_const( rt2 ) ) \ + or ( False == type_traits.is_const( rt1 ) and False == type_traits.is_const( rt2 ) ): + rt1 = type_traits.remove_const( rt1 ) + rt2 = type_traits.remove_const( rt2 ) + else: + return False + if not type_traits.is_class( rt1 ) or not type_traits.is_class( rt2 ): + return type_traits.is_same( rt1, rt2 ) + c1 = type_traits.class_traits.get_declaration( rt1 ) + c2 = type_traits.class_traits.get_declaration( rt2 ) + if c1.class_type == class_declaration.CLASS_TYPES.UNION \ + or c2.class_type == class_declaration.CLASS_TYPES.UNION: + return type_traits.is_same( rt1, rt2 ) + return type_traits.is_same( c1, c2 ) \ + or type_traits.is_base_and_derived( c1, c2 ) \ + or type_traits.is_base_and_derived( c2, c1 ) + + +def is_same_function( f1, f2 ): + """returns true if f1 and f2 is same function + + Use case: sometimes when user defines some virtual function in base class, + it overrides it in a derived one. Sometimes we need to know whether two member + functions is actualy same function. + """ + if f1 is f2: + return True + if not f1.__class__ is f2.__class__: + return False + if isinstance( f1, calldef.member_calldef_t ) and f1.has_const != f2.has_const: + return False + if f1.name != f2.name: + return False + if not is_same_return_type( f1, f2 ): + return False + if len( f1.arguments ) != len(f2.arguments): + return False + for f1_arg, f2_arg in zip( f1.arguments, f2.arguments ): + if not type_traits.is_same( f1_arg.type, f2_arg.type ): + return False + return True + + + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/__init__.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/__init__.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/__init__.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,345 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +contains classes that describe different C++ declarations +""" + +import compilers + +from dependencies import dependency_info_t +from declaration import location_t +from declaration import declaration_t +from scopedef import scopedef_t +from enumeration import enumeration_t +from namespace import namespace_t + +from class_declaration import class_t +from class_declaration import CLASS_TYPES +from class_declaration import ACCESS_TYPES +from class_declaration import hierarchy_info_t +from class_declaration import class_declaration_t +from class_declaration import class_types + +from typedef import typedef_t + +from cpptypes import type_t +from cpptypes import dummy_type_t +from cpptypes import unknown_t +from cpptypes import ellipsis_t +from cpptypes import fundamental_t +from cpptypes import void_t +from cpptypes import char_t +from cpptypes import signed_char_t +from cpptypes import unsigned_char_t +from cpptypes import wchar_t +from cpptypes import short_int_t +from cpptypes import short_unsigned_int_t +from cpptypes import bool_t +from cpptypes import int_t +from cpptypes import unsigned_int_t +from cpptypes import long_int_t +from cpptypes import long_unsigned_int_t +from cpptypes import long_long_int_t +from cpptypes import long_long_unsigned_int_t +from cpptypes import float_t +from cpptypes import double_t +from cpptypes import long_double_t +from cpptypes import FUNDAMENTAL_TYPES +from cpptypes import compound_t +from cpptypes import volatile_t +from cpptypes import const_t +from cpptypes import pointer_t +from cpptypes import reference_t +from cpptypes import restrict_t +from cpptypes import array_t +from cpptypes import calldef_type_t +from cpptypes import free_function_type_t +from cpptypes import member_function_type_t +from cpptypes import member_variable_type_t +from cpptypes import declarated_t +from cpptypes import type_qualifiers_t +#java types +from cpptypes import java_fundamental_t +from cpptypes import jbyte_t +from cpptypes import jshort_t +from cpptypes import jint_t +from cpptypes import jlong_t +from cpptypes import jfloat_t +from cpptypes import jdouble_t +from cpptypes import jchar_t +from cpptypes import jboolean_t + + + +from variable import variable_t + +from algorithm import full_name +from algorithm import full_name_from_declaration_path +from algorithm import make_flatten +from algorithm import apply_visitor +from algorithm import declaration_path +from algorithm import get_named_parent +from algorithm import find_declaration +from algorithm import match_declaration_t +from algorithm import find_all_declarations +from algorithm import find_first_declaration +from algorithm import declaration_files +from algorithm import visit_function_has_not_been_found_t +from algorithm import get_global_namespace + +from calldef import VIRTUALITY_TYPES +from calldef import FUNCTION_VIRTUALITY_TYPES +from calldef import argument_t +from calldef import calldef_t +from calldef import member_calldef_t +from calldef import free_calldef_t +from calldef import operator_t +from calldef import member_function_t +from calldef import constructor_t +from calldef import destructor_t +from calldef import member_operator_t +from calldef import casting_operator_t +from calldef import free_function_t +from calldef import free_operator_t + +from decl_visitor import decl_visitor_t +from type_visitor import type_visitor_t + +from type_traits import decompose_type +from type_traits import decompose_class + + +from type_traits import is_enum +from type_traits import enum_declaration +from type_traits import enum_traits + +from type_traits import is_class +from type_traits import class_traits +from type_traits import is_class_declaration +from type_traits import class_declaration_traits + + +from type_traits import is_bool +from type_traits import is_same +from type_traits import is_void +from type_traits import is_void_pointer +from type_traits import is_const +from type_traits import base_type +from type_traits import is_array +from type_traits import is_pointer +from type_traits import is_volatile +from type_traits import is_integral +from type_traits import is_reference +from type_traits import is_arithmetic +from type_traits import is_fundamental +from type_traits import is_floating_point +from type_traits import is_base_and_derived +from type_traits import is_convertible +from type_traits import is_noncopyable +from type_traits import is_std_string +from type_traits import is_std_wstring +from type_traits import is_std_ostream +from type_traits import is_std_wostream +from type_traits import is_calldef_pointer + +from type_traits import is_unary_operator +from type_traits import is_binary_operator + +from type_traits import array_size +from type_traits import array_item_type + +from type_traits import remove_cv +from type_traits import remove_const +from type_traits import remove_alias +from type_traits import remove_pointer +from type_traits import remove_volatile +from type_traits import remove_reference +from type_traits import remove_declarated + +from type_traits import has_destructor +from type_traits import has_public_less +from type_traits import has_copy_constructor +has_trivial_copy = has_copy_constructor #backward comp mode will be removed +from type_traits import has_public_equal +from type_traits import has_public_assign +from type_traits import has_public_destructor +from type_traits import has_public_constructor +from type_traits import has_trivial_constructor +from type_traits import find_trivial_constructor +from type_traits import has_public_binary_operator +from type_traits import has_any_non_copyconstructor + +from type_traits import auto_ptr_traits +from type_traits import smart_pointer_traits + +from container_traits import list_traits +from container_traits import deque_traits +from container_traits import queue_traits +from container_traits import priority_queue_traits +from container_traits import vector_traits +from container_traits import stack_traits +from container_traits import map_traits +from container_traits import multimap_traits +from container_traits import hash_map_traits +from container_traits import hash_multimap_traits +from container_traits import set_traits +from container_traits import hash_set_traits +from container_traits import multiset_traits +from container_traits import hash_multiset_traits +from container_traits import find_container_traits + +from function_traits import is_same_function + +all_container_traits = container_traits.container_traits +"""tuple of all STD container traits classes""" + +sequential_container_traits = \ +[ + list_traits + , deque_traits + , queue_traits + , priority_queue_traits + , vector_traits + , stack_traits + , set_traits + , hash_set_traits + , multiset_traits + , hash_multiset_traits +] +"""list, that contains all STD container traits classes""" + + +import templates +import call_invocation + +from filtering import filtering + +from decl_factory import decl_factory_t + +from matchers import matcher_base_t +from matchers import or_matcher_t +from matchers import and_matcher_t +from matchers import not_matcher_t +from matchers import declaration_matcher_t +from matchers import calldef_matcher_t +from matchers import namespace_matcher_t +from matchers import variable_matcher_t +from matchers import regex_matcher_t +from matchers import access_type_matcher_t +from matchers import operator_matcher_t +from matchers import custom_matcher_t +from matchers import virtuality_type_matcher_t + +#make matchers to look more like functors +or_matcher = or_matcher_t +"""see L{or_matcher} for documentation""" +and_matcher = and_matcher_t +"""see L{and_matcher} for documentation""" +not_matcher = not_matcher_t +"""see L{not_matcher} for documentation""" +declaration_matcher = declaration_matcher_t +"""see L{declaration_matcher} for documentation""" +calldef_matcher = calldef_matcher_t +"""see L{calldef_matcher} for documentation""" +namespace_matcher = namespace_matcher_t +"""see L{namespace_matcher} for documentation""" +variable_matcher = variable_matcher_t +"""see L{variable_matcher} for documentation""" +regex_matcher = regex_matcher_t +"""see L{regex_matcher} for documentation""" +access_type_matcher = access_type_matcher_t +"""see L{access_type_matcher} for documentation""" +operator_matcher = operator_matcher_t +"""see L{operator_matcher} for documentation""" +custom_matcher = custom_matcher_t +"""see L{custom_matcher} for documentation""" +virtuality_type_matcher = virtuality_type_matcher_t +"""see L{virtuality_type_matcher} for documentation""" + +from matcher import matcher + +from mdecl_wrapper import mdecl_wrapper_t + +from decl_printer import decl_printer_t +from decl_printer import print_declarations + + +import scopedef + +scopedef.scopedef_t._impl_all_decl_types = \ +[ + scopedef.scopedef_t + , enumeration_t + , namespace_t + , class_t + , class_declaration_t + , typedef_t + , variable_t + , calldef_t + , member_calldef_t + , free_calldef_t + , operator_t + , member_function_t + , constructor_t + , destructor_t + , member_operator_t + , casting_operator_t + , free_function_t + , free_operator_t +] + +__impl_matchers = scopedef.scopedef_t._impl_matchers +__impl_decl_types = scopedef.scopedef_t._impl_decl_types + +__impl_matchers[ scopedef.scopedef_t.decl ] = declaration_matcher_t + +__impl_matchers[ scopedef.scopedef_t.class_ ] = declaration_matcher_t +__impl_decl_types[ scopedef.scopedef_t.class_ ] = class_t + +__impl_matchers[ scopedef.scopedef_t.variable ] = variable_matcher_t + +__impl_matchers[ scopedef.scopedef_t.calldef ] = calldef_matcher_t +__impl_decl_types[ scopedef.scopedef_t.calldef ] = calldef_t + +__impl_matchers[ scopedef.scopedef_t.operator ] = operator_matcher_t +__impl_decl_types[ scopedef.scopedef_t.operator ] = operator_t + +__impl_matchers[ scopedef.scopedef_t.member_function ] = calldef_matcher_t +__impl_decl_types[ scopedef.scopedef_t.member_function ] = member_function_t + +__impl_matchers[ scopedef.scopedef_t.constructor ] = calldef_matcher_t +__impl_decl_types[ scopedef.scopedef_t.constructor ] = constructor_t + +__impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t +__impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t + +__impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t +__impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t + +__impl_matchers[ scopedef.scopedef_t.casting_operator ] = calldef_matcher_t +__impl_decl_types[ scopedef.scopedef_t.casting_operator ] = casting_operator_t + +__impl_matchers[ scopedef.scopedef_t.enumeration ] = declaration_matcher_t +__impl_decl_types[ scopedef.scopedef_t.enumeration ] = enumeration_t + +__impl_matchers[ scopedef.scopedef_t.typedef ] = declaration_matcher_t +__impl_decl_types[ scopedef.scopedef_t.typedef ] = typedef_t + +__impl_matchers[ namespace_t.namespace ] = namespace_matcher_t + +__impl_matchers[ namespace_t.free_function ] = calldef_matcher_t +__impl_decl_types[ namespace_t.free_function ] = free_function_t + +__impl_matchers[ namespace_t.free_operator ] = operator_matcher_t +__impl_decl_types[ namespace_t.free_operator ] = free_operator_t + + + + + + + + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matcher.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matcher.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matcher.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matcher.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,81 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""implements few "find" algorithms on declarations tree""" + +import types +import algorithm + +class matcher: + """class-namespace, contains implementation of few "find" algorithms and + definition of related exception classes""" + + class declaration_not_found_t( RuntimeError ): + """exception, that will be raised, if the declaration could not be found""" + def __init__( self, matcher ): + RuntimeError.__init__( self ) + self.matcher = matcher + + def __str__( self ): + return "Unable to find declaration. matcher: [%s]"%str(self.matcher) + + class multiple_declarations_found_t( RuntimeError ): + """exception, that will be raised, if more than one declaration was found""" + def __init__( self, matcher ): + RuntimeError.__init__( self ) + self.matcher = matcher + + def __str__( self ): + return "Multiple declarations has been found. matcher: [%s]"%str(self.matcher) + + @staticmethod + def find( decl_matcher, decls, recursive=True ): + """returns a list of declarations that match "decl_matcher" defined criretia or None + + @param decl_matcher: Python callable object, that takes one argument - reference to declaration + @param decls: reference to declaration or list of declarations to be searched in + @param recursive: boolean, if True the method will run decl_matcher, on internal declarations too + """ + + where = [] + if isinstance( decls, types.ListType ): + where.extend( decls ) + else: + where.append( decls ) + if recursive: + where = algorithm.make_flatten( where ) + return filter( decl_matcher, where ) + + @staticmethod + def find_single( decl_matcher, decls, recursive=True ): + """returns a reference to declaration, that match "decl_matcher" defined + criretia, if a unique declaration could not be found the method will return + None. + + @param decl_matcher: Python callable object, that takes one argument - reference to declaration + @param decls: reference to declaration or list of declarations to be searched in + @param recursive: boolean, if True the method will run decl_matcher, on internal declarations too + """ + answer = matcher.find( decl_matcher, decls, recursive ) + if len(answer) == 1: + return answer[0] + + @staticmethod + def get_single( decl_matcher, decls, recursive=True ): + """returns a reference to declaration, that match "decl_matcher" defined + criretia, if a unique declaration could not be found, an appropriate + exception will be raised. + + @param decl_matcher: Python callable object, that takes one argument - reference to declaration + @param decls: reference to declaration or list of declarations to be searched in + @param recursive: boolean, if True the method will run decl_matcher, on internal declarations too + """ + answer = matcher.find( decl_matcher, decls, recursive ) + if len(answer) == 1: + return answer[0] + elif len(answer) == 0: + raise matcher.declaration_not_found_t( decl_matcher ) + else: + raise matcher.multiple_declarations_found_t( decl_matcher ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matchers.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matchers.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matchers.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/matchers.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,527 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines all "built-in" classes that implement declarations compare functionality +according to some criteria +""" + +import os +import re +import types +import algorithm +import variable +import namespace +import calldef +import cpptypes +import templates +import class_declaration +from pygccxml import utils + +class matcher_base_t(object): + """matcher_base_t class defines interface for classes that will implement + compare functionality according to some criteria. + """ + def __init__( self ): + object.__init__( self ) + + def __call__(self, decl): + raise NotImplementedError( "matcher must always implement the __call__() method." ) + + def __invert__(self): + """not-operator (~)""" + return not_matcher_t(self) + + def __and__(self, other): + """and-operator (&)""" + return and_matcher_t([self, other]) + + def __or__(self, other): + """or-operator (|)""" + return or_matcher_t([self, other]) + + def __str__( self ): + return "base class for all matchers" + +class and_matcher_t(matcher_base_t): + """Combine several other matchers with "&". + + For example: find all private functions with name XXX + + C{ matcher = access_type_matcher_t( 'private' ) & calldef_matcher_t( name='XXX' ) } + """ + def __init__(self, matchers): + matcher_base_t.__init__(self) + self.matchers = matchers + + def __call__(self, decl): + for matcher in self.matchers: + if not matcher(decl): + return False + return True + + def __str__(self): + return " & ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) + + +class or_matcher_t(matcher_base_t): + """Combine several other matchers with "|". + + For example: find all functions and variables with name 'XXX' + + C{ matcher = variable_matcher_t( name='XXX' ) | calldef_matcher_t( name='XXX' ) } + + """ + def __init__(self, matchers): + matcher_base_t.__init__(self) + self.matchers = matchers + + def __call__(self, decl): + for matcher in self.matchers: + if matcher(decl): + return True + return False + + def __str__(self): + return " | ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) + + +class not_matcher_t(matcher_base_t): + """Return the inverse result of matcher, using "~" + + For example: find all private and protected declarations + + C{ matcher = ~access_type_matcher_t( 'private' ) } + + """ + def __init__(self, matcher): + matcher_base_t.__init__(self) + self.matcher = matcher + + def __call__(self, decl): + return not self.matcher(decl) + + def __str__(self): + return "~(%s)"%str(self.matcher) + +class declaration_matcher_t( matcher_base_t ): + """ + Instance of this class will match declarations by next criteria: + - declaration name, also could be fully qualified name + Example: wstring or ::std::wstring + - declaration type + Example: L{class_t}, L{namespace_t}, L{enumeration_t} + - location within file system ( file or directory ) + """ + def __init__( self, name=None, decl_type=None, header_dir=None, header_file=None ): + """ + @param decl_type: declaration type to match by. For example L{enumeration_t}. + @type decl_type: any class that derives from L{declarations.declaration_t} class + + @param name: declaration name, could be full name. + @type name: str + + @param header_dir: absolute directory path + @type header_dir: str + + @param header_file: absolute file path + @type header_file: str + + """ + #An other option is that pygccxml will create absolute path using + #os.path.abspath function. But I think this is just wrong, because abspath + #builds path using current working directory. This behavior is fragile + #and very difficult to find a bug. + matcher_base_t.__init__( self ) + self.decl_type = decl_type + self.__name = None + self.__opt_is_tmpl_inst = None + self.__opt_tmpl_name = None + self.__opt_is_full_name = None + self.__decl_name_only = None + + self._set_name( name ) + + self.header_dir = header_dir + self.header_file = header_file + + if self.header_dir: + self.header_dir = utils.normalize_path( self.header_dir ) + if not os.path.isabs( self.header_dir ): + raise RuntimeError( "Path to header directory should be absolute!" ) + + if self.header_file: + self.header_file = utils.normalize_path( self.header_file ) + if not os.path.isabs( self.header_file ): + raise RuntimeError( "Path to header file should be absolute!" ) + + def _get_name(self): + return self.__name + + def _set_name( self, name ): + self.__name = name + if not self.__name: + self.__opt_is_tmpl_inst = None + self.__opt_tmpl_name = None + self.__opt_is_full_name = None + self.__decl_name_only = None + else: + self.__opt_is_tmpl_inst = templates.is_instantiation( self.__name ) + self.__opt_tmpl_name = templates.name( self.__name ) + if self.__opt_is_tmpl_inst: + if '::' in self.__opt_tmpl_name: + self.__opt_is_full_name = True + self.__decl_name_only = self.__opt_tmpl_name.split('::')[-1] + else: + self.__opt_is_full_name = False + self.__decl_name_only = self.__opt_tmpl_name + self.__name = templates.normalize( name ) + else: + if '::' in self.__name: + self.__opt_is_full_name = True + self.__decl_name_only = self.__name.split('::')[-1] + else: + self.__opt_is_full_name = False + self.__decl_name_only = self.__name + + + name = property( _get_name, _set_name ) + + def __str__( self ): + msg = [] + if not None is self.decl_type: + msg.append( '(decl type==%s)' % self.decl_type.__name__ ) + if not None is self.name: + msg.append( '(name==%s)' % self.name ) + if not None is self.header_dir: + msg.append( '(header dir==%s)' % self.header_dir ) + if not None is self.header_file: + msg.append( '(header file==%s)' % self.header_file ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + + def __call__( self, decl ): + if not None is self.decl_type: + if not isinstance( decl, self.decl_type ): + return False + if not None is self.name: + if not self.check_name( decl ): + return False + if not None is self.header_dir and decl.location: + decl_dir = os.path.abspath( os.path.dirname( decl.location.file_name ) ) + decl_dir = utils.normalize_path( decl_dir ) + if decl_dir[:len(self.header_dir)] != self.header_dir: + return False + if not None is self.header_file and decl.location: + decl_file = os.path.abspath( decl.location.file_name ) + decl_file = utils.normalize_path( decl_file ) + if decl_file != self.header_file: + return False + return True + + def check_name( self, decl ): + assert not None is self.name + if self.__opt_is_tmpl_inst: + if not self.__opt_is_full_name: + if self.name != templates.normalize( decl.name ) \ + and self.name != templates.normalize( decl.partial_name ): + return False + else: + if self.name != templates.normalize( algorithm.full_name( decl, with_defaults=True ) ) \ + and self.name != templates.normalize( algorithm.full_name( decl, with_defaults=False ) ): + return False + else: + if not self.__opt_is_full_name: + if self.name != decl.name and self.name != decl.partial_name: + return False + else: + if self.name != algorithm.full_name( decl, with_defaults=True ) \ + and self.name != algorithm.full_name( decl, with_defaults=False ): + return False + return True + + def is_full_name(self): + return self.__opt_is_full_name + + def _get_decl_name_only(self): + return self.__decl_name_only + decl_name_only = property( _get_decl_name_only ) + +class variable_matcher_t( declaration_matcher_t ): + """ + Instance of this class will match variables by next criteria: + - L{declaration_matcher_t} criteria + - variable type. Example: L{int_t} or 'int' + """ + def __init__( self, name=None, type=None, header_dir=None, header_file=None ): + """ + @param type: variable type + @type type: string or instance of L{type_t} derived class + """ + declaration_matcher_t.__init__( self + , name=name + , decl_type=variable.variable_t + , header_dir=header_dir + , header_file=header_file ) + self.type = type + + def __call__( self, decl ): + if not super( variable_matcher_t, self ).__call__( decl ): + return False + if not None is self.type: + if isinstance( self.type, cpptypes.type_t ): + if self.type != decl.type: + return False + else: + if self.type != decl.type.decl_string: + return False + return True + + def __str__( self ): + msg = [ super( variable_matcher_t, self ).__str__() ] + if msg == [ 'any' ]: + msg = [] + if not None is self.type: + msg.append( '(value type==%s)' % str(self.type) ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + + +class namespace_matcher_t( declaration_matcher_t ): + """Instance of this class will match namespaces by name.""" + + def __init__( self, name=None ): + declaration_matcher_t.__init__( self, name=name, decl_type=namespace.namespace_t) + + def __call__( self, decl ): + if self.name and decl.name == '': + #unnamed namespace have same name as thier parent, we should prevent + #this happens. The price is: user should search for unnamed namespace + #directly. + return False + return super( namespace_matcher_t, self ).__call__( decl ) + + +class calldef_matcher_t( declaration_matcher_t ): + """ + Instance of this class will match callable by next criteria: + - L{declaration_matcher_t} criteria + - return type. Example: L{int_t} or 'int' + - argument types + """ + + def __init__( self, name=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): + """ + @param return_type: callable return type + @type return_type: string or instance of L{type_t} derived class + + @param arg_types: list of function argument types. arg_types can contain. + Any item within the list could be string or instance of L{type_t} derived + class. If you don't want some argument to participate in match you can + put None. For example: + + C{ calldef_matcher_t( arg_types=[ 'int &', None ] ) } + + will match all functions that takes 2 arguments, where the first one is + reference to integer and second any + @type arg_types: list + """ + if None is decl_type: + decl_type = calldef.calldef_t + declaration_matcher_t.__init__( self + , name=name + , decl_type=decl_type + , header_dir=header_dir + , header_file=header_file ) + + self.return_type = return_type + self.arg_types = arg_types + + def __call__( self, decl ): + if not super( calldef_matcher_t, self ).__call__( decl ): + return False + if not None is self.return_type \ + and not self.__compare_types( self.return_type, decl.return_type ): + return False + if self.arg_types: + if isinstance( self.arg_types, (types.ListType, types.TupleType)): + if len(self.arg_types) != len( decl.arguments ): + return False + for type_or_str, arg in zip( self.arg_types, decl.arguments ): + if None == type_or_str: + continue + else: + if not self.__compare_types( type_or_str, arg.type ): + return False + return True + + def __compare_types( self, type_or_str, type ): + assert type_or_str + if type is None: + return False + if isinstance( type_or_str, cpptypes.type_t ): + if type_or_str != type: + return False + else: + if type_or_str != type.decl_string: + return False + return True + + def __str__( self ): + msg = [ super( calldef_matcher_t, self ).__str__() ] + if msg == [ 'any' ]: + msg = [] + if not None is self.return_type: + msg.append( '(return type==%s)' % str(self.return_type) ) + if self.arg_types: + for i in range( len( self.arg_types ) ): + if self.arg_types[i] is None: + msg.append( '(arg %d type==any)' % i ) + else: + msg.append( '(arg %d type==%s)' % ( i, str( self.arg_types[i] ) ) ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + + +class operator_matcher_t( calldef_matcher_t ): + """ + Instance of this class will match operators by next criteria: + - L{calldef_matcher_t} criteria + - operator symbol: =, !=, (), [] and etc + """ + def __init__( self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): + """ + @param symbol: operator symbol + @type symbol: str + """ + if None is decl_type: + decl_type = calldef.operator_t + calldef_matcher_t.__init__( self + , name=name + , return_type=return_type + , arg_types=arg_types + , decl_type=decl_type + , header_dir=header_dir + , header_file=header_file) + self.symbol = symbol + + def __call__( self, decl ): + if not super( operator_matcher_t, self ).__call__( decl ): + return False + if not None is self.symbol: + if self.symbol != decl.symbol: + return False + return True + + def __str__( self ): + msg = [ super( operator_matcher_t, self ).__str__() ] + if msg == [ 'any' ]: + msg = [] + if not None is self.symbol: + msg.append( '(symbol==%s)' % str(self.symbol) ) + if not msg: + msg.append( 'any' ) + return ' and '.join( msg ) + +class regex_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration using regular expression. + User should supply a function that will extract from declaration desired + information as string. Later, this matcher will match that string using + user regular expression. + """ + def __init__( self, regex, function=None ): + """ + @param regex: regular expression + @type regex: string, an instance of this class will compile it for you + + @param function: function that will be called to get an information from + declaration as string. As input this function takes 1 argument: reference + to declaration. Return value should be string. If function is None, then + the matcher will use declaration name. + + """ + matcher_base_t.__init__(self) + self.regex = re.compile( regex ) + self.function = function + if None is self.function: + self.function = lambda decl: decl.name + + def __call__( self, decl ): + text = self.function( decl ) + return bool( self.regex.match( text ) ) + + def __str__( self ): + return '(regex=%s)' % self.regex + +class access_type_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration by its access type: public, + private or protected. If declarations does not have access type, for example + free function, then False will be returned. + """ + + def __init__( self, access_type ): + """ + @param access_type: declaration access type + @type access_type: L{ACCESS_TYPES} defines few consts for your convinience. + Any way you can pass public, private or protected as argument to this function + """ + matcher_base_t.__init__( self ) + self.access_type = access_type + + def __call__( self, decl ): + if not isinstance( decl.parent, class_declaration.class_t ): + return False + return self.access_type == decl.parent.find_out_member_access_type( decl ) + + def __str__( self ): + return '(access type=%s)' % self.access_type + +class virtuality_type_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration by its virtuality type: not virtual, + virtual or pure virtual. If declarations does not have virtuality type, for example + free function, then False will be returned. + """ + + def __init__( self, virtuality_type ): + """ + @param access_type: declaration access type + @type access_type: L{VIRTUALITY_TYPES} defines few consts for your convinience. + """ + matcher_base_t.__init__( self ) + self.virtuality_type = virtuality_type + + def __call__( self, decl ): + if not isinstance( decl.parent, class_declaration.class_t ): + return False + return self.virtuality_type == decl.virtuality + + def __str__( self ): + return '(virtuality type=%s)' % self.virtuality_type + + +class custom_matcher_t( matcher_base_t ): + """ + Instance of this class will match declaration by user custom criteria. + """ + + def __init__( self, function ): + """ + @param function: callable, that takes single argument - declaration instance + should return True or False + """ + matcher_base_t.__init__( self ) + self.function = function + + def __call__( self, decl ): + return bool( self.function( decl ) ) + + def __str__( self ): + return '(user criteria)' diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/mdecl_wrapper.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/mdecl_wrapper.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/mdecl_wrapper.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/mdecl_wrapper.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,96 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines class L{mdecl_wrapper_t} that allows to work on set of declarations, +as it was one declaration. + +The L{class} allows user to not write "for" loops within the code. +""" + +import os + +class call_redirector_t( object ): + """Internal class used to call some function of objects""" + def __init__( self, name, decls ): + """creates call_redirector_t instance. + + @param name: name of method, to be called on every object in C{decls} list + @param decls: list of objects + """ + object.__init__( self ) + self.name = name + self.decls = decls + + def __call__( self, *arguments, **keywords ): + """calls method C{self.name} on every object within C{self.decls} list""" + for d in self.decls: + callable_ = getattr(d, self.name) + callable_( *arguments, **keywords ) + +class mdecl_wrapper_t( object ): + """Multiple declarations wrapper. + + The main purpose of this class is to allow an user to work on many + declarations, as they were only one single declaration. + + Example: + mb = module_builder_t( ... ) + #lets say we want to exclude all member functions, that returns reference to int: + mb.member_functions( return_type='int &' ).exclude() + + "exclude" function will be called on every function that match the criteria. + """ + + def __init__( self, decls ): + """@param decls: list of declarations to operate on. + @type decls: list of L{declaration wrappers} + """ + object.__init__( self ) + self.__dict__['declarations'] = decls + + def __nonzero__( self ): + return bool( self.declarations ) + + def __len__( self ): + """returns the number of declarations""" + return len( self.declarations ) + + def __getitem__( self, index ): + """provides access to declaration""" + return self.declarations[index] + + def __iter__( self ): + return iter(self.declarations) + + def __ensure_attribute( self, name ): + invalid_decls = filter( lambda d: not hasattr( d, name ), self.declarations ) + sep = os.linesep + ' ' + if invalid_decls: + raise RuntimeError( "Next declarations don't have '%s' attribute: %s" + % ( name, sep.join( map( str, invalid_decls ) ) ) ) + + def __setattr__( self, name, value ): + """Updates the value of attribute on all declarations. + @param name: name of attribute + @param value: new value of attribute + """ + self.__ensure_attribute( name ) + for d in self.declarations: + setattr( d, name, value ) + + def __getattr__( self, name ): + """@param name: name of method + """ + return call_redirector_t( name, self.declarations ) + + def __contains__( self, item ): + return item in self.declarations + + def to_list(self): + l = [] + for d in self.declarations: + l.append( d ) + return l \ No newline at end of file diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/namespace.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/namespace.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/namespace.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/namespace.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,144 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""defines class, that describes C++ namespace declaration""" + +import declaration +import scopedef +import algorithm + +class namespace_t( scopedef.scopedef_t ): + """ + describes C++ namespace + """ + + def __init__( self, name='', declarations=None ): + """creates class that describes C++ namespace declaration""" + scopedef.scopedef_t.__init__( self, name ) + if not declarations: + declarations = [] + self._declarations = declarations # list of all declarations belongs to this namespace + + def __str__(self): + name = algorithm.full_name(self) + if name!="::" and name[:2]=="::": + name = name[2:] + return "%s [namespace]"%name + + def _get__cmp__scope_items(self): + """implementation details""" + return [ self._sorted_list( self.declarations ) ] + + def _get_declarations_impl(self): + return self._declarations + def _set_declarations(self, declarations): + self._declarations = declarations + declarations = property( scopedef.scopedef_t._get_declarations + , _set_declarations + , doc="list of all declarations, defined in the namespace") + + def take_parenting( self, inst ): + """Takes parenting from inst and transfers it to self""" + if self is inst: + return + for decl in inst.declarations: + decl.parent = self + self.declarations.append( decl ) + inst.declarations = [] + + def adopt_declaration( self, decl ): + self.declarations.append( decl ) + decl.parent = self + decl.cache.reset() + + def remove_declaration( self, decl ): + """ + removes decl from members list + + @param decl: declaration to be removed + @type decl: L{declaration_t} + """ + del self.declarations[ self.declarations.index( decl ) ] + decl.cache.reset() + #add more comment about this. + #if not keep_parent: + # decl.parent=None + + def namespace( self, name=None, function=None, recursive=None ): + """returns reference to namespace declaration, that is matched defined criterias""" + return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.namespace ] + , name=name + , function=function + , recursive=recursive ) + ns = namespace + + def namespaces( self, name=None, function=None, recursive=None, allow_empty=None ): + """returns a set of namespace declarations, that are matched defined criterias""" + return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.namespace ] + , name=name + , function=function + , recursive=recursive + , allow_empty=allow_empty) + nss = namespaces + + def free_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to free function declaration, that is matched defined criterias""" + return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.free_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ namespace_t.free_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + free_fun = free_function + + def free_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of free function declarations, that are matched defined criterias""" + return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.free_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ namespace_t.free_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + free_funs = free_functions + + def free_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to free operator declaration, that is matched defined criterias""" + return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.free_operator ] + , name=self._build_operator_name( name, function, symbol ) + , symbol=symbol + , function=self._build_operator_function( name, function ) + , decl_type=self._impl_decl_types[ namespace_t.free_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def free_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of free operator declarations, that are matched defined criterias""" + return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.free_operator ] + , name=self._build_operator_name( name, function, symbol ) + , symbol=symbol + , function=self._build_operator_function( name, function ) + , decl_type=self._impl_decl_types[ namespace_t.free_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def i_depend_on_them( self, recursive=True ): + answer = [] + if recursive: + map( lambda decl: answer.extend( decl.i_depend_on_them() ), self.declarations ) + return answer diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/pattern_parser.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/pattern_parser.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/pattern_parser.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/pattern_parser.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,140 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""implementation details""" + +import types + +class parser_t( object ): + """implementation details""" + def __init__( self + , pattern_char_begin + , pattern_char_end + , pattern_char_separator ): + self.__begin = pattern_char_begin + self.__end = pattern_char_end + self.__separator = pattern_char_separator + #right now parser does not take into account next qualifiers, but it will + self.__text_qualifier = '"' + self.__char_qualifier = "'" + self.__escape = '\\' + + def has_pattern( self, decl_string ): + """implementation details""" + last_part = decl_string.split( '::' )[-1] + return -1 != decl_string.find( self.__begin ) and -1 != last_part.find( self.__end ) + + def name( self, decl_string ): + """implementation details""" + assert isinstance( decl_string, types.StringTypes ) + if not self.has_pattern( decl_string ): + return decl_string + args_begin = decl_string.find( self.__begin ) + return decl_string[0: args_begin].strip() + + def __find_args_separator( self, decl_string, start_pos ): + """implementation details""" + bracket_depth = 0 + for index, ch in enumerate( decl_string[start_pos:] ): + if ch not in ( self.__begin, self.__end, self.__separator ): + continue #I am interested only in < and > + elif self.__separator == ch: + if not bracket_depth: + return index + start_pos + elif self.__begin == ch: + bracket_depth += 1 + elif not bracket_depth: + return index + start_pos + else: + bracket_depth -= 1 + return -1 + + def args( self, decl_string ): + """implementation details""" + args_begin = decl_string.find( self.__begin ) + args_end = decl_string.rfind( self.__end ) + if -1 in ( args_begin, args_end ) or args_begin == args_end: + raise RuntimeError( "%s doesn't valid template instantiation string" % decl_string ) + + args_only = decl_string[args_begin + 1: args_end ] + args = [] + previous_found, found = 0, 0 + while True: + found = self.__find_args_separator( args_only, previous_found) + if -1 == found: + args.append( args_only[ previous_found : ] ) + break + #elif decl_string[ found ] == self.__end: + # print args + # raise RuntimeError( "unmatched '%s' token has been found." % self.__end ) + else: + args.append( args_only[ previous_found : found ] ) + previous_found = found + 1 #skip found sep + return [ arg.strip() for arg in args ] + + NOT_FOUND = ( -1, -1 ) + """implementation details""" + + def find_args(self, text, start=None ): + """implementation details""" + if start==None: + start = 0 + first_occurance = text.find( self.__begin, start ) + if first_occurance == -1: + return self.NOT_FOUND + previous_found, found = first_occurance + 1, 0 + while True: + found = self.__find_args_separator( text, previous_found) + if -1 == found: + return self.NOT_FOUND + elif text[ found ] == self.__end: + return ( first_occurance, found ) + else: + previous_found = found + 1 #skip found sep + + def split( self, decl_string ): + """implementation details""" + assert self.has_pattern( decl_string ) + return self.name( decl_string ), self.args( decl_string ) + + def split_recursive( self, decl_string ): + """implementation details""" + assert self.has_pattern( decl_string ) + answer = [] + to_go = [ decl_string ] + while to_go: + name, args = self.split( to_go.pop() ) + answer.append( ( name, args ) ) + for arg in args: + if self.has_pattern( arg ): + to_go.append( arg ) + return answer + + def join( self, name, args, arg_separator=None ): + """implementation details""" + if None is arg_separator: + arg_separator = ', ' + args = filter( None, args) + args_str = '' + if not args: + args_str = ' ' + elif 1 == len( args ): + args_str = ' ' + args[0] + ' ' + else: + args_str = ' ' + arg_separator.join( args ) + ' ' + + return ''.join( [ name, self.__begin, args_str, self.__end ] ) + + def normalize( self, decl_string, arg_separator=None ): + """implementation details""" + if not self.has_pattern( decl_string ): + return decl_string + name, args = self.split( decl_string ) + for i, arg in enumerate( args ): + args[i] = self.normalize( arg ) + return self.join( name, args, arg_separator ) + + + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/scopedef.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/scopedef.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/scopedef.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/scopedef.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,655 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines base class for L{namespace_t} and L{class_t} classes +""" + +import time +import algorithm +import filtering +import templates +import declaration +import mdecl_wrapper +from pygccxml import utils +import matcher as matcher_module + +class scopedef_t( declaration.declaration_t ): + """Base class for L{namespace_t} and L{class_t} classes. + + This is the base class for all declaration classes that may have + children nodes. The children can be accessed via the C{declarations} + property. + + Also this class provides "get/select/find" interface. Using this class you + can get instance or instances of internal declaration(s). + + You can find declaration(s) using next criteria: + 1. name - declaration name, could be full qualified name + 2. header_dir - directory, to which belongs file, that the declaration was declarated in. + header_dir should be absolute path. + 3. header_file - file that the declaration was declarated in. + 4. function - user ( your ) custom criteria. The interesting thing is that + this function will be joined with other arguments ( criteria ). + 5. recursive - the search declaration range, if True will be search in + internal declarations too. + + Every "select" API you can invoke and pass as first argument at declaration + name or function. This class will find out correctly what argument represents. + + Example:: + ns - referrers to global namespace + ns.member_function( "do_something ) - will return reference to member + function named "do_something". If there is no such function exception + will be raised. If there is more then one function exception will be + raised too. + + Example 2:: + ns - referers to global namespace + do_smths = ns.member_functions( "do_something ) - will return instance + of L{mdecl_wrapper_t} object. This object allows you few things: + + 1. To iterate on selected declarations + 2. To set some property to desired value using one line of code only: + do_smths.call_policies = x + 3. To call some function on every instance using one line of code: + do_smths.exclude() + + Pay attention: you can not use "get" functions or properties. + """ + + RECURSIVE_DEFAULT = True + ALLOW_EMPTY_MDECL_WRAPPER = False + + declaration_not_found_t = matcher_module.matcher.declaration_not_found_t + multiple_declarations_found_t = matcher_module.matcher.multiple_declarations_found_t + + _impl_matchers = {} #this class variable is used to prevent recursive imports + _impl_decl_types = {} #this class variable is used to prevent recursive imports + _impl_all_decl_types = [] #this class variable is used to prevent recursive imports + + def __init__( self, name=''): + declaration.declaration_t.__init__( self, name ) + + self._optimized = False + self._type2decls = {} + self._type2name2decls = {} + self._type2decls_nr = {} + self._type2name2decls_nr = {} + self._all_decls = None + self._all_decls_not_recursive = None + + def _get_logger( self ): + return utils.loggers.queries_engine + _logger = property( _get_logger, doc="reference to C{queries_engine} logger" ) + + def _get__cmp__scope_items(self): + """implementation details""" + raise NotImplementedError() + + def _get__cmp__items(self): + """implementation details""" + items = [] + if self._optimized: + #in this case we don't need to build class internal declarations list + items.append( self._sorted_list( self._all_decls_not_recursive ) ) + else: + items.append( self._sorted_list( self.declarations ) ) + items.extend( self._get__cmp__scope_items() ) + return items + + def __eq__(self, other): + if not declaration.declaration_t.__eq__( self, other ): + return False + return self._sorted_list( self.declarations[:] ) \ + == other._sorted_list( other.declarations[:] ) + #self_decls = self._all_decls_not_recursive + #if not self._optimized: + #self_decls = self._sorted_list( self.declarations[:] ) + #other_decls = other._all_decls_not_recursive[:] + #if not other._optimized: + #other_decls = other._sorted_list( other.declarations[:] ) + #else: + #return self_decls == other_decls + + def _get_declarations_impl(self): + raise NotImplementedError() + + def _get_declarations(self): + if True == self._optimized: + return self._all_decls_not_recursive + else: + return self._get_declarations_impl() + declarations = property( _get_declarations, doc="list of children L{declarations}" ) + + def remove_declaration( self, decl ): + raise NotImplementedError() + + def __decl_types( self, decl ): + """implementation details""" + types = [] + bases = list( decl.__class__.__bases__ ) + visited = set() + if 'pygccxml' in decl.__class__.__module__: + types.append( decl.__class__ ) + while bases: + base = bases.pop() + if base is declaration.declaration_t: + continue + if base in visited: + continue + if 'pygccxml' not in base.__module__: + continue + types.append( base ) + bases.extend( base.__bases__ ) + return types + + def clear_optimizer(self): + """Cleans query optimizer state""" + self._optimized = False + self._type2decls = {} + self._type2name2decls = {} + self._type2decls_nr = {} + self._type2name2decls_nr = {} + self._all_decls = None + self._all_decls_not_recursive = None + + map( lambda decl: decl.clear_optimizer() + , filter( lambda decl: isinstance( decl, scopedef_t ) + , self.declarations ) ) + + def init_optimizer(self): + """Initializes query optimizer state. + There are 4 internals hash tables: + 1. from type to declarations + 2. from type to declarations for non-recursive queries + 3. from type to name to declarations + 4. from type to name to declarations for non-recursive queries + + Almost every query includes declaration type information. Also very + common query is to search some declaration(s) by name or full name. + Those hashtables allows to search declaration very quick. + """ + if self.name == '::': + self._logger.debug( "preparing data structures for query optimizer - started" ) + start_time = time.clock() + + self.clear_optimizer() + + for dtype in scopedef_t._impl_all_decl_types: + self._type2decls[ dtype ] = [] + self._type2decls_nr[ dtype ] = [] + self._type2name2decls[ dtype ] = {} + self._type2name2decls_nr[ dtype ] = {} + + self._all_decls_not_recursive = self.declarations + self._all_decls = algorithm.make_flatten( self._all_decls_not_recursive ) + for decl in self._all_decls: + types = self.__decl_types( decl ) + for type_ in types: + self._type2decls[ type_ ].append( decl ) + name2decls = self._type2name2decls[ type_ ] + if not name2decls.has_key( decl.name ): + name2decls[ decl.name ] = [] + name2decls[ decl.name ].append( decl ) + if self is decl.parent: + self._type2decls_nr[ type_ ].append( decl ) + name2decls_nr = self._type2name2decls_nr[ type_ ] + if not name2decls_nr.has_key( decl.name ): + name2decls_nr[ decl.name ] = [] + name2decls_nr[ decl.name ].append( decl ) + + map( lambda decl: decl.init_optimizer() + , filter( lambda decl: isinstance( decl, scopedef_t ) + , self._all_decls_not_recursive ) ) + if self.name == '::': + self._logger.debug( "preparing data structures for query optimizer - done( %f seconds ). " + % ( time.clock() - start_time ) ) + self._optimized = True + + def _build_operator_function( self, name, function ): + if callable( name ): + return name + else: + return function + + def _build_operator_name( self, name, function, symbol ): + """implementation details""" + def add_operator( sym ): + if 'new' in sym or 'delete' in sym: + return 'operator ' + sym + else: + return 'operator'+ sym + if callable( name ) and None is function: + name = None + if name: + if not 'operator' in name: + name = add_operator( name ) + return name + elif symbol: + return add_operator( symbol ) + return name #both name and symbol are None + + def _on_rename( self ): + for decl in self.decls(allow_empty=True): + decl.cache.reset_name_based() + #I am not sure whether to introduce this or not? + #It could be very time consuming operation + it changes optimize query + #data structures. + #if self.parent: + # if self.parent._optimized: + # self.parent.init_optimizer() + + def __normalize_args( self, **keywds ): + """implementation details""" + if callable( keywds['name'] ) and None is keywds['function']: + keywds['function'] = keywds['name'] + keywds['name'] = None + return keywds + + def __findout_recursive( self, **keywds ): + """implementation details""" + if None is keywds[ 'recursive' ]: + return self.RECURSIVE_DEFAULT + else: + return keywds[ 'recursive' ] + + def __findout_allow_empty( self, **keywds ): + """implementation details""" + if None is keywds[ 'allow_empty' ]: + return self.ALLOW_EMPTY_MDECL_WRAPPER + else: + return keywds[ 'allow_empty' ] + + def __findout_decl_type( self, match_class, **keywds ): + """implementation details""" + if keywds.has_key( 'decl_type' ): + return keywds['decl_type'] + + matcher_args = keywds.copy() + del matcher_args['function'] + del matcher_args['recursive'] + if matcher_args.has_key('allow_empty'): + del matcher_args['allow_empty'] + + matcher = match_class( **matcher_args ) + if matcher.decl_type: + return matcher.decl_type + return None + + def __create_matcher( self, match_class, **keywds ): + """implementation details""" + matcher_args = keywds.copy() + del matcher_args['function'] + del matcher_args['recursive'] + if matcher_args.has_key('allow_empty'): + del matcher_args['allow_empty'] + + matcher = match_class( **matcher_args ) + if keywds['function']: + self._logger.debug( 'running query: %s and ' % str( matcher ) ) + return lambda decl: matcher( decl ) and keywds['function'](decl) + else: + self._logger.debug( 'running query: %s' % str( matcher ) ) + return matcher + + def __findout_range( self, name, decl_type, recursive ): + """implementation details""" + if not self._optimized: + self._logger.debug( 'running non optimized query - optimization has not been done' ) + decls = self.declarations + if recursive: + decls = algorithm.make_flatten( self.declarations ) + if decl_type: + decls = filter( lambda d: isinstance( d, decl_type ), decls ) + return decls + + if name and templates.is_instantiation( name ): + #templates has tricky mode to compare them, so lets check the whole + #range + name = None + + if name and decl_type: + matcher = scopedef_t._impl_matchers[ scopedef_t.decl ]( name=name ) + if matcher.is_full_name(): + name = matcher.decl_name_only + if recursive: + self._logger.debug( 'query has been optimized on type and name' ) + if self._type2name2decls[decl_type].has_key( name ): + return self._type2name2decls[decl_type][name] + else: + return [] + else: + self._logger.debug( 'non recursive query has been optimized on type and name' ) + if self._type2name2decls_nr[decl_type].has_key( name ): + return self._type2name2decls_nr[decl_type][name] + else: + return [] + elif decl_type: + if recursive: + self._logger.debug( 'query has been optimized on type' ) + return self._type2decls[ decl_type ] + else: + self._logger.debug( 'non recursive query has been optimized on type' ) + return self._type2decls_nr[ decl_type ] + else: + if recursive: + self._logger.debug( 'query has not been optimized ( hint: query does not contain type and/or name )' ) + return self._all_decls + else: + self._logger.debug( 'non recursive query has not been optimized ( hint: query does not contain type and/or name )' ) + return self._all_decls_not_recursive + + def _find_single( self, match_class, **keywds ): + """implementation details""" + self._logger.debug( 'find single query execution - started' ) + start_time = time.clock() + norm_keywds = self.__normalize_args( **keywds ) + matcher = self.__create_matcher( match_class, **norm_keywds ) + dtype = self.__findout_decl_type( match_class, **norm_keywds ) + recursive_ = self.__findout_recursive( **norm_keywds ) + decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) + found = matcher_module.matcher.get_single( matcher, decls, False ) + self._logger.debug( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) ) + return found + + def _find_multiple( self, match_class, **keywds ): + """implementation details""" + self._logger.debug( 'find all query execution - started' ) + start_time = time.clock() + norm_keywds = self.__normalize_args( **keywds ) + matcher = self.__create_matcher( match_class, **norm_keywds ) + dtype = self.__findout_decl_type( match_class, **norm_keywds ) + recursive_ = self.__findout_recursive( **norm_keywds ) + allow_empty = self.__findout_allow_empty( **norm_keywds ) + decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) + found = matcher_module.matcher.find( matcher, decls, False ) + mfound = mdecl_wrapper.mdecl_wrapper_t( found ) + self._logger.debug( '%d declaration(s) that match query' % len(mfound) ) + self._logger.debug( 'find single query execution - done( %f seconds )' + % ( time.clock() - start_time ) ) + if not mfound and not allow_empty: + raise RuntimeError( "Multi declaration query returned 0 declarations." ) + return mfound + + def decl( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.decl ] + , name=name + , function=function + , decl_type=decl_type + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def decls( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.decl ] + , name=name + , function=function + , decl_type=decl_type + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def class_( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to class declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.class_ ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.class_ ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def classes( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of class declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.class_ ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.class_ ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def variable( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to variable declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.variable ] + , name=name + , function=function + , type=type + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + var = variable #small alias + + def variables( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of variable declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.variable ] + , name=name + , function=function + , type=type + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + vars = variables #small alias + + def calldef( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to "calldef" declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.calldef ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.calldef ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def calldefs( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of calldef declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.calldef ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.calldef ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to operator declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.operator ] + , name=self._build_operator_name( name, function, symbol ) + , symbol=symbol + , function=self._build_operator_function( name, function ) + , decl_type=self._impl_decl_types[ scopedef_t.operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of operator declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.operator ] + , name=self._build_operator_name( name, function, symbol ) + , symbol=symbol + , function=self._build_operator_function( name, function ) + , decl_type=self._impl_decl_types[ scopedef_t.operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def member_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to member declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.member_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.member_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + mem_fun = member_function + + def member_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of member function declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.member_function ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.member_function ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + mem_funs = member_functions + + def constructor( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to constructor declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.constructor ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.constructor ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def constructors( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of constructor declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.constructor ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.constructor ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def member_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to member operator declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.member_operator ] + , name=self._build_operator_name( name, function, symbol ) + , symbol=symbol + , function=self._build_operator_function( name, function ) + , decl_type=self._impl_decl_types[ scopedef_t.member_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + mem_oper = member_operator + def member_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of member operator declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.member_operator ] + , name=self._build_operator_name( name, function, symbol ) + , symbol=symbol + , function=self._build_operator_function( name, function ) + , decl_type=self._impl_decl_types[ scopedef_t.member_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + mem_opers = member_operators + + def casting_operator( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to casting operator declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.casting_operator ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.casting_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive ) + + def casting_operators( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of casting operator declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.casting_operator ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.casting_operator ] + , return_type=return_type + , arg_types=arg_types + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def enumeration( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to enumeration declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.enumeration ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.enumeration ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + enum = enumeration + """adding small aliase to enumeration method""" + + def enumerations( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of enumeration declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.enumeration ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.enumeration ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + #adding small aliase + enums = enumerations + + def typedef( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): + """returns reference to typedef declaration, that is matched defined criterias""" + return self._find_single( self._impl_matchers[ scopedef_t.typedef ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.typedef ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive) + + def typedefs( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): + """returns a set of typedef declarations, that are matched defined criterias""" + return self._find_multiple( self._impl_matchers[ scopedef_t.typedef ] + , name=name + , function=function + , decl_type=self._impl_decl_types[ scopedef_t.typedef ] + , header_dir=header_dir + , header_file=header_file + , recursive=recursive + , allow_empty=allow_empty) + + def __getitem__(self, name_or_function): + """ Allow simple name based find of decls. Internally just calls decls() method. + @param name_or_function Name of decl to lookup or finder function. + """ + return self.decls(name_or_function) + + + + + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/templates.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/templates.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/templates.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/templates.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,76 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +template instantiation parser + +This module implements all functionality necessary to parse C++ template +instantiations.In other words this module is able to extract next information from +the string like this C{ std::vector }. + - name ( std::vector ) + - list of arguments ( int ) + +This module also defines few convenience function like L{split} and L{join}. +""" + +import pattern_parser + +__THE_PARSER = pattern_parser.parser_t( '<', '>', ',' ) + +def is_instantiation( decl_string ): + """ + returns True if decl_string is template instantiation and False otherwise + + @param decl_string: string that should be checked for pattern presence + @type decl_string: str + + @return: bool + """ + global __THE_PARSER + return __THE_PARSER.has_pattern( decl_string ) + +def name( decl_string ): + """ + returns name of instantiated template + + @type decl_string: str + @return: str + """ + global __THE_PARSER + return __THE_PARSER.name( decl_string ) + +def args( decl_string ): + """ + returns list of template arguments + + @type decl_string: str + @return: [str] + """ + global __THE_PARSER + return __THE_PARSER.args( decl_string ) + +def split( decl_string ): + """returns (name, [arguments] )""" + global __THE_PARSER + return __THE_PARSER.split( decl_string ) + +def split_recursive( decl_string ): + """returns [(name, [arguments])]""" + global __THE_PARSER + return __THE_PARSER.split_recursive( decl_string ) + +def join( name, args ): + """returns name< argument_1, argument_2, ..., argument_n >""" + global __THE_PARSER + return __THE_PARSER.join( name, args ) + +def normalize( decl_string ): + """returns decl_string, which contains "normalized" spaces + + this functionality allows to implement comparison of 2 different string + which are actually same: x::y< z > and x::y + """ + global __THE_PARSER + return __THE_PARSER.normalize( decl_string ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/typedef.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/typedef.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/typedef.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/typedef.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,48 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines class that describes C++ typedef declaration +""" + +import declaration +import dependencies + +class typedef_t( declaration.declaration_t ): + """describes C++ typedef declaration""" + + def __init__( self, name='', type=None ): + """creates class that describes C++ typedef""" + declaration.declaration_t.__init__( self, name ) + self._type = type + + def _get__cmp__items( self ): + """implementation details""" + return [self.type] + + def __eq__(self, other): + if not declaration.declaration_t.__eq__( self, other ): + return False + return self.type == other.type + + def _get_type(self): + return self._type + def _set_type(self, type): + self._type = type + type = property( _get_type, _set_type + , doc="reference to the original L{type}" ) + + def i_depend_on_them( self, recursive=True ): + return [ dependencies.dependency_info_t( self, self.type ) ] + + @property + def byte_size (self): + "Size of this type in bytes @type: int" + return self._type.byte_size + + @property + def byte_align (self): + "alignment of this type in bytes @type: int" + return self._type.byte_align diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_traits.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,1101 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines few algorithms, that deals with different properties of C++ types + +Do you aware of boost::type_traits library? pygccxml has functionality similar to +it. Using functions defined in this module you can + - find out some properties of the type + - modify type + +Those functions are very valuable for code generation. Almost all functions +within this module works on L{type_t} class hierarchy and\\or L{class_t}. +""" + +import os +import types +import matchers +import typedef +import calldef +import cpptypes +import variable +import algorithm +import namespace +import templates +import enumeration +import class_declaration +from pygccxml import utils +import types as build_in_types + +def __remove_alias(type_): + """implementation details""" + if isinstance( type_, typedef.typedef_t ): + return __remove_alias( type_.type ) + if isinstance( type_, cpptypes.declarated_t ) and isinstance( type_.declaration, typedef.typedef_t ): + return __remove_alias( type_.declaration.type ) + if isinstance( type_, cpptypes.compound_t ): + type_.base = __remove_alias( type_.base ) + return type_ + return type_ + +def remove_alias(type_): + """returns type without typedefs""" + type_ref = None + if isinstance( type_, cpptypes.type_t ): + type_ref = type_ + elif isinstance( type_, typedef.typedef_t ): + type_ref = type_.type + else: + pass #not a valid input, just return it + if not type_ref: + return type_ + if type_ref.cache.remove_alias: + return type_ref.cache.remove_alias + no_alias = __remove_alias( type_ref.clone() ) + type_ref.cache.remove_alias = no_alias + return no_alias + +def create_cv_types( base ): + """implementation details""" + return [ base + , cpptypes.const_t( base ) + , cpptypes.volatile_t( base ) + , cpptypes.volatile_t( cpptypes.const_t( base ) ) ] + +def decompose_type(tp): + """implementation details""" + #implementation of this function is important + if isinstance( tp, cpptypes.compound_t ): + return [tp] + decompose_type( tp.base ) + elif isinstance( tp, typedef.typedef_t ): + return decompose_type( tp.type ) + elif isinstance( tp, cpptypes.declarated_t ) and isinstance( tp.declaration, typedef.typedef_t ): + return decompose_type( tp.declaration.type ) + else: + return [tp] + +def decompose_class(type): + """implementation details""" + types = decompose_type( type ) + return [ tp.__class__ for tp in types ] + +def base_type(type): + """returns base type. + + For C{const int} will return C{int} + """ + types = decompose_type( type ) + return types[-1] + +def does_match_definition(given, main, secondary ): + """implementation details""" + assert isinstance( secondary, build_in_types.TupleType ) + assert 2 == len( secondary ) #general solution could be provided + types = decompose_type( given ) + if isinstance( types[0], main ): + return True + elif 2 <= len( types ) and \ + ( ( isinstance( types[0], main ) and isinstance( types[1], secondary ) ) \ + or ( isinstance( types[1], main ) and isinstance( types[0], secondary ) ) ): + return True + elif 3 <= len( types ): + classes = set( [tp.__class__ for tp in types[:3]] ) + desired = set( [main] + list( secondary ) ) + return classes == desired + else: + return False + +def is_bool( type_ ): + """returns True, if type represents C{bool}, False otherwise""" + return remove_alias( type_ ) in create_cv_types( cpptypes.bool_t() ) + +def is_void( type ): + """returns True, if type represents C{void}, False otherwise""" + return remove_alias( type ) in create_cv_types( cpptypes.void_t() ) + +def is_void_pointer( type ): + """returns True, if type represents C{void*}, False otherwise""" + return is_same( type, cpptypes.pointer_t( cpptypes.void_t() ) ) + +def is_integral( type ): + """returns True, if type represents C++ integral type, False otherwise""" + integral_def = create_cv_types( cpptypes.char_t() ) \ + + create_cv_types( cpptypes.unsigned_char_t() ) \ + + create_cv_types( cpptypes.signed_char_t() ) \ + + create_cv_types( cpptypes.wchar_t() ) \ + + create_cv_types( cpptypes.short_int_t() ) \ + + create_cv_types( cpptypes.short_unsigned_int_t() ) \ + + create_cv_types( cpptypes.bool_t() ) \ + + create_cv_types( cpptypes.int_t() ) \ + + create_cv_types( cpptypes.unsigned_int_t() ) \ + + create_cv_types( cpptypes.long_int_t() ) \ + + create_cv_types( cpptypes.long_unsigned_int_t() ) \ + + create_cv_types( cpptypes.long_long_int_t() ) \ + + create_cv_types( cpptypes.long_long_unsigned_int_t() ) + + return remove_alias( type ) in integral_def + +def is_floating_point( type ): + """returns True, if type represents C++ floating point type, False otherwise""" + float_def = create_cv_types( cpptypes.float_t() ) \ + + create_cv_types( cpptypes.double_t() ) \ + + create_cv_types( cpptypes.long_double_t() ) + + return remove_alias( type ) in float_def + +def is_arithmetic( type ): + """returns True, if type represents C++ integral or floating point type, False otherwise""" + return is_integral( type ) or is_floating_point( type ) + +def is_pointer(type): + """returns True, if type represents C++ pointer type, False otherwise""" + return does_match_definition( type + , cpptypes.pointer_t + , (cpptypes.const_t, cpptypes.volatile_t) ) + +def is_calldef_pointer(type): + """returns True, if type represents pointer to free/member function, False otherwise""" + if not is_pointer(type): + return False + nake_type = remove_alias( type ) + nake_type = remove_const( nake_type ) + nake_type = remove_volatile( nake_type ) + return isinstance( nake_type, cpptypes.compound_t ) \ + and isinstance( nake_type.base, cpptypes.calldef_type_t ) + +def remove_pointer(type): + """removes pointer from the type definition + + If type is not pointer type, it will be returned as is. + """ + nake_type = remove_alias( type ) + if not is_pointer( nake_type ): + return type + elif isinstance( nake_type, cpptypes.volatile_t ) and isinstance( nake_type.base, cpptypes.pointer_t ): + return cpptypes.volatile_t( nake_type.base.base ) + elif isinstance( nake_type, cpptypes.const_t ) and isinstance( nake_type.base, cpptypes.pointer_t ): + return cpptypes.const_t( nake_type.base.base ) + elif isinstance( nake_type.base, cpptypes.calldef_type_t ): + return type + else: + return nake_type.base + +def is_reference(type): + """returns True, if type represents C++ reference type, False otherwise""" + nake_type = remove_alias( type ) + return isinstance( nake_type, cpptypes.reference_t ) + +def is_array(type): + """returns True, if type represents C++ array type, False otherwise""" + nake_type = remove_alias( type ) + nake_type = remove_reference( nake_type ) + nake_type = remove_cv( nake_type ) + return isinstance( nake_type, cpptypes.array_t ) + +def array_size(type): + """returns array size""" + nake_type = remove_alias( type ) + nake_type = remove_reference( nake_type ) + nake_type = remove_cv( nake_type ) + assert isinstance( nake_type, cpptypes.array_t ) + return nake_type.size + +def array_item_type(type_): + """returns array item type""" + if is_array(type_): + type_ = remove_alias( type_ ) + type_ = remove_cv( type_ ) + return type_.base + elif is_pointer( type_ ): + return remove_pointer( type_ ) + else: + assert 0 + +def remove_reference(type): + """removes reference from the type definition + + If type is not reference type, it will be returned as is. + """ + nake_type = remove_alias( type ) + if not is_reference( nake_type ): + return type + else: + return nake_type.base + +def is_const(type): + """returns True, if type represents C++ const type, False otherwise""" + nake_type = remove_alias( type ) + return isinstance( nake_type, cpptypes.const_t ) + +def remove_const(type): + """removes const from the type definition + + If type is not const type, it will be returned as is + """ + + nake_type = remove_alias( type ) + if not is_const( nake_type ): + return type + else: + return nake_type.base + +def remove_declarated( type ): + """removes type-declaration class-binder L{declarated_t} from the type + + If type is not L{declarated_t}, it will be returned as is + """ + type = remove_alias( type ) + if isinstance( type, cpptypes.declarated_t ): + type = type.declaration + return type + +def is_same(type1, type2): + """returns True, if type1 and type2 are same types""" + nake_type1 = remove_declarated( type1 ) + nake_type2 = remove_declarated( type2 ) + return nake_type1 == nake_type2 + +def is_volatile(type): + """returns True, if type represents C++ volatile type, False otherwise""" + nake_type = remove_alias( type ) + return isinstance( nake_type, cpptypes.volatile_t ) + +def remove_volatile(type): + """removes volatile from the type definition + + If type is not volatile type, it will be returned as is + """ + nake_type = remove_alias( type ) + if not is_volatile( nake_type ): + return type + else: + return nake_type.base + +def remove_cv(type): + """removes const and volatile from the type definition""" + + nake_type = remove_alias(type) + if not is_const( nake_type ) and not is_volatile( nake_type ): + return type + result = nake_type + if is_const( nake_type ): + result = nake_type.base + if is_volatile( result ): + result = result.base + return result + +def is_fundamental(type): + """returns True, if type represents C++ fundamental type""" + return does_match_definition( type + , cpptypes.fundamental_t + , (cpptypes.const_t, cpptypes.volatile_t) ) + +class declaration_xxx_traits: + """this class implements the functionality needed for convinient work with + declaration classes + + Implemented functionality: + - find out whether a declaration is a desired one + - get reference to the declaration + """ + sequence = [ remove_alias, remove_cv, remove_declarated ] + def __init__( self, declaration_class ): + self.declaration_class = declaration_class + + def __apply_sequence( self, type ): + for f in self.sequence: + type = f( type ) + return type + + def is_my_case( self, type ): + """returns True, if type represents the desired declaration, False otherwise""" + return isinstance( self.__apply_sequence( type ), self.declaration_class ) + + def get_declaration( self, type ): + """returns reference to the declaration + + Precondition: self.is_my_case( type ) == True + """ + assert self.is_my_case( type ) + return self.__apply_sequence( type ) + +enum_traits = declaration_xxx_traits( enumeration.enumeration_t ) +"""implements functionality, needed for convinient work with C++ enums""" + +is_enum = enum_traits.is_my_case +"""returns True, if type represents C++ enumeration declaration, False otherwise""" + +enum_declaration = enum_traits.get_declaration +"""returns reference to enum declaration""" + +class_traits = declaration_xxx_traits( class_declaration.class_t ) +"""implements functionality, needed for convinient work with C++ classes""" + +is_class = class_traits.is_my_case +"""returns True, if type represents C++ class definition, False otherwise""" + +class_declaration_traits = declaration_xxx_traits( class_declaration.class_declaration_t ) +"""implements functionality, needed for convinient work with C++ class declarations""" + +is_class_declaration = class_declaration_traits.is_my_case +"""returns True, if type represents C++ class declaration, False otherwise""" + +def find_trivial_constructor( type ): + """returns reference to trivial constructor or None""" + assert isinstance( type, class_declaration.class_t ) + return type.find_trivial_constructor() + +def has_trivial_constructor( class_ ): + """if class has public trivial constructor, this function will return reference to it, None otherwise""" + class_ = class_traits.get_declaration( class_ ) + trivial = class_.find_trivial_constructor() + if trivial and trivial.access_type == 'public': + return trivial + +def has_copy_constructor( class_ ): + """if class has public copy constructor, this function will return reference to it, None otherwise""" + class_ = class_traits.get_declaration( class_ ) + copy_constructor = class_.find_copy_constructor() + if copy_constructor and copy_constructor.access_type == 'public': + return copy_constructor + +def has_destructor(class_): + """if class has destructor, this function will return reference to it, None otherwise""" + class_ = class_traits.get_declaration( class_ ) + destructor = class_.decls( decl_type=calldef.destructor_t, recursive=False, allow_empty=True ) + if destructor: + return destructor[0] + +def has_public_constructor(class_): + """if class has any public constructor, this function will return list of them, otherwise None""" + class_ = class_traits.get_declaration(class_) + decls = class_.constructors( lambda c: not c.is_copy_constructor and c.access_type == 'public' + , recursive=False, allow_empty=True ) + if decls: + return decls + +def has_public_assign(class_): + """returns True, if class has public assign operator, False otherwise""" + class_ = class_traits.get_declaration( class_ ) + decls = class_.mem_opers( lambda o: o.symbol == '=' and o.access_type == 'public' + , recursive=False, allow_empty=True ) + return bool( decls ) + +def has_public_destructor(type): + """returns True, if class has public destructor, False otherwise""" + d = has_destructor( type ) + return d and d.access_type == 'public' + +def is_base_and_derived( based, derived ): + """returns True, if there is "base and derived" relationship between classes, False otherwise""" + assert isinstance( based, class_declaration.class_t ) + assert isinstance( derived, ( class_declaration.class_t, tuple ) ) + + all_derived = None + if isinstance( derived, class_declaration.class_t ): + all_derived = ( [derived] ) + else: #tuple + all_derived = derived + + for derived_cls in all_derived: + for base_desc in derived_cls.recursive_bases: + if base_desc.related_class == based: + return True + return False + +def has_any_non_copyconstructor( type): + """if class has any public constructor, which is not copy constructor, this function will return list of them, otherwise None""" + class_ = class_traits.get_declaration( type ) + decls = class_.constructors( lambda c: not c.is_copy_constructor and c.access_type == 'public' + , recursive=False, allow_empty=True ) + if decls: + return decls + +def has_public_binary_operator( type, operator_symbol ): + """returns True, if type has public binary operator, otherwise False""" + not_artificial = lambda decl: decl.is_artificial == False + type = remove_alias( type ) + type = remove_cv( type ) + type = remove_declarated( type ) + assert isinstance( type, class_declaration.class_t ) + + if is_std_string( type ) or is_std_wstring( type ): + #In some case compare operators of std::basic_string are not instantiated + return True + + operators = type.member_operators( function=matchers.custom_matcher_t( not_artificial ) \ + & matchers.access_type_matcher_t( 'public' ) + , symbol=operator_symbol + , allow_empty=True + , recursive=False ) + if operators: + return True + + t = cpptypes.declarated_t( type ) + t = cpptypes.const_t( t ) + t = cpptypes.reference_t( t ) + operators = type.top_parent.operators( function=not_artificial + , arg_types=[t, None] + , symbol=operator_symbol + , allow_empty=True + , recursive=True ) + if operators: + return True + for bi in type.recursive_bases: + assert isinstance( bi, class_declaration.hierarchy_info_t ) + if bi.access_type != class_declaration.ACCESS_TYPES.PUBLIC: + continue + operators = bi.related_class.member_operators( function=matchers.custom_matcher_t( not_artificial ) \ + & matchers.access_type_matcher_t( 'public' ) + , symbol=operator_symbol + , allow_empty=True + , recursive=False ) + if operators: + return True + return False + +def has_public_equal( type ): + """returns True, if class has public operator==, otherwise False""" + return has_public_binary_operator( type, '==' ) + +def has_public_less( type ): + """returns True, if class has public operator<, otherwise False""" + return has_public_binary_operator( type, '<' ) + +def is_unary_operator( oper ): + """returns True, if operator is unary operator, otherwise False""" + #~ definition: + #~ memeber in class + #~ ret-type operator symbol() + #~ ret-type operator [++ --](int) + #~ globally + #~ ret-type operator symbol( arg ) + #~ ret-type operator [++ --](X&, int) + symbols = [ '!', '&', '~', '*', '+', '++', '-', '--' ] + if not isinstance( oper, calldef.operator_t ): + return False + if oper.symbol not in symbols: + return False + if isinstance( oper, calldef.member_operator_t ): + if 0 == len( oper.arguments ): + return True + elif oper.symbol in [ '++', '--' ] and isinstance( oper.arguments[0].type, cpptypes.int_t ): + return True + else: + return False + else: + if 1 == len( oper.arguments ): + return True + elif oper.symbol in [ '++', '--' ] \ + and 2 == len( oper.arguments ) \ + and isinstance( oper.arguments[1].type, cpptypes.int_t ): + #may be I need to add additional check whether first argument is reference or not? + return True + else: + return False + +def is_binary_operator( oper ): + """returns True, if operator is binary operator, otherwise False""" + #~ definition: + #~ memeber in class + #~ ret-type operator symbol(arg) + #~ globally + #~ ret-type operator symbol( arg1, arg2 ) + symbols = [ ',', '()', '[]', '!=', '%', '%=', '&', '&&', '&=', '*', '*=', '+', '+=' + , '-', '-=', '->', '->*', '/', '/=', '<', '<<', '<<=', '<=' + , '=', '==', '>', '>=', '>>', '>>=', '^', '^=', '|', '|=', '||' + ] + if not isinstance( oper, calldef.operator_t ): + return False + if oper.symbol not in symbols: + return False + if isinstance( oper, calldef.member_operator_t ): + if 1 == len( oper.arguments ): + return True + else: + return False + else: + if 2 == len( oper.arguments ): + return True + else: + return False + +class __is_convertible_t: + """implementation details""" + def __init__( self, source, target ): + self.__source = self.__normalize( source ) + self.__target = self.__normalize( target ) + + def __find_class_by_class_declaration( self, class_decl ): + found = algorithm.find_declaration( class_decl.parent.declarations + , name=class_decl.name + , type=class_declaration.class_t ) + return found + + def __normalize( self, type_ ): + type_ = remove_alias( type_ ) + bt_of_type = base_type( type_ ) + if isinstance( bt_of_type, cpptypes.declarated_t ) \ + and isinstance( bt_of_type.declaration, class_declaration.class_declaration_t ): + type_ = type_.clone() + bt_of_type = base_type( type_ ) + bt_of_type.declaration = self.__find_class_by_class_declaration( bt_of_type.declaration ) + return type_ + + def __test_trivial( self, source, target ): + if not ( source and target ): + return False + if is_same( source, target ): + return True #X => X + if is_const( target ) and is_same( source, target.base ): + return True #X => const X + if is_reference( target ) and is_same( source, target.base ): + return True #X => X& + if is_reference( target ) and is_const( target.base ) and is_same( source, target.base.base ): + return True #X => const X& + if is_same( target, cpptypes.pointer_t( cpptypes.void_t() ) ): + if is_integral( source ) or is_enum( source ): + return False + else: + return True #X => void* + if is_pointer( source ) and is_pointer( target ): + if is_const( target.base ) and is_same( source.base, target.base.base ): + return True#X* => const X* + if is_reference( source ) and is_reference( target ): + if is_const( target.base ) and is_same( source.base, target.base.base ): + return True#X& => const X& + if not is_const( source ) and is_array( source ) and is_pointer( target ): + if is_same( base_type(source), target.base ): + return True#X[2] => X* + if is_array( source ) and is_pointer( target ) and is_const( target.base ): + if is_same( base_type(source), target.base.base ): + return True + + def __test_pointer_to_func_or_mv__to__func_or_mv( self, source, target ): + if is_pointer( source ) \ + and is_reference( target ) \ + and isinstance( target.base + , ( cpptypes.free_function_type_t + , cpptypes.member_function_type_t + , cpptypes.member_variable_type_t ) ) \ + and is_same( source.base, target.base ): + return True + + if is_pointer( source ) \ + and isinstance( target + , ( cpptypes.free_function_type_t + , cpptypes.member_function_type_t + , cpptypes.member_variable_type_t ) ) \ + and is_same( source.base, target ): + return True + + if is_pointer( target ) \ + and is_reference( source ) \ + and isinstance( source.base + , ( cpptypes.free_function_type_t + , cpptypes.member_function_type_t + , cpptypes.member_variable_type_t ) ) \ + and is_same( source.base, target.base ): + return True + + if is_pointer( target ) \ + and isinstance( source + , ( cpptypes.free_function_type_t + , cpptypes.member_function_type_t + , cpptypes.member_variable_type_t ) ) \ + and is_same( target.base, source ): + return True + + + def __test_const_x_ref__to__x( self, source, target ): + if not is_reference( source ) \ + or not is_const( source.base ) \ + or not is_same( source.base.base, target ): + return False + if is_fundamental( target ): + return True + if is_enum( target ): + return True + if isinstance( target, cpptypes.declarated_t ): + assert isinstance( target.declaration, class_declaration.class_t ) + if has_copy_constructor( target.declaration ): + return True #we have copy constructor + return False + + def __test_const_ref_x__to__y(self, source, target): + if not is_reference( source ) or not is_const( source.base ): + return False + if is_fundamental( source.base.base ) and is_fundamental( target ): + return True + if is_convertible( source.base.base, cpptypes.int_t() ) and is_enum( target ): + return True + if isinstance( target, cpptypes.declarated_t ): + assert isinstance( target.declaration, class_declaration.class_t ) + if has_copy_constructor( target.declaration ): + return True #we have copy constructor + return False + + def __test_ref_x__to__x( self, source, target ): + if not is_reference( source ) or not is_same( source.base, target ): + return False + if is_fundamental( target ): + return True + if is_enum( target ): + return True + if isinstance( target, cpptypes.declarated_t ): + assert isinstance( target.declaration, class_declaration.class_t ) + if has_copy_constructor( target.declaration ): + return True #we have copy constructor + return False + + def __test_ref_x__to__y(self, source, target): + if not is_reference( source ): + return False + if is_fundamental( source.base ) and is_fundamental( target ): + return True + if is_convertible( source.base, cpptypes.int_t() ) and is_enum( target ): + return True + if isinstance( target, cpptypes.declarated_t ): + assert isinstance( target.declaration, class_declaration.class_t ) + if has_copy_constructor( target.declaration ): + return True #we have copy constructor + return False + + def __test_fundamental__to__fundamental(self, source, target): + if not is_fundamental( base_type( source ) ) or not is_fundamental( base_type( target ) ): + return False + if is_void( base_type( source ) ) or is_void( base_type( target ) ): + return False + if is_fundamental( source ) and is_fundamental( target ): + return True + if not is_pointer( source ) and is_fundamental( target ): + return True + if not is_pointer( source ) and is_const( target ) and is_fundamental( target.base ): + return True + if is_fundamental( source ) \ + and is_reference( target ) \ + and is_const( target.base ) \ + and is_fundamental( target.base.base ): + return True #X => const Y& + return False + + def __test_derived_to_based( self, source, target ): + derived = base_type( source ) + base = base_type( target ) + if not ( isinstance( derived, cpptypes.declarated_t ) \ + and isinstance( derived.declaration, class_declaration.class_t ) ): + return False + if not ( isinstance( base, cpptypes.declarated_t ) \ + and isinstance( base.declaration, class_declaration.class_t ) ): + return False + base = base.declaration + derived = derived.declaration + if not is_base_and_derived( base, derived ): + return False + for b in derived.recursive_bases: + if ( b.related_class is base ) and b.access_type != class_declaration.ACCESS_TYPES.PRIVATE: + break + else: + return False + + base = target + derived = source + is_both_declarated = lambda x, y: isinstance( x, cpptypes.declarated_t ) \ + and isinstance( y, cpptypes.declarated_t ) + #d => b + if is_both_declarated( base, derived ): + return True + #d* => b* + if is_pointer( derived ) and is_pointer( base ) \ + and is_both_declarated( base.base, derived.base ): + return True + #const d* => const b* + if is_pointer( derived ) and is_pointer( base ) \ + and is_const( derived.base ) and is_const( base.base ) \ + and is_both_declarated( base.base.base, derived.base.base ): + return True + #d* => const b* + if is_pointer( derived ) and is_pointer( base ) \ + and is_const( derived.base )\ + and is_both_declarated( base.base.base, derived.base ): + return True + + #d& => b& + if is_reference( derived ) and is_reference( base ) \ + and is_both_declarated( base.base, derived.base ): + return True + #const d& => const b& + if is_reference( derived ) and is_reference( base ) \ + and is_const( derived.base ) and is_const( base.base ) \ + and is_both_declarated( base.base.base, derived.base.base ): + return True + #d& => const b& + if is_reference( derived ) and is_reference( base ) \ + and is_const( derived.base )\ + and is_both_declarated( base.base.base, derived.base ): + return True + return False + + def is_convertible( self ): + source = self.__source + target = self.__target + + if self.__test_trivial(source, target): + return True + if is_array( source ) or is_array( target ): + return False + if self.__test_const_x_ref__to__x(source, target): + return True + if self.__test_const_ref_x__to__y(source, target): + return True + if self.__test_ref_x__to__x(source, target): + return True + if self.__test_ref_x__to__y(source, target): + return True + if self.__test_fundamental__to__fundamental( source, target ): + return True + if self.__test_pointer_to_func_or_mv__to__func_or_mv( source, target ): + return True + if self.__test_derived_to_based( source, target ): + return True + + if isinstance( source, cpptypes.declarated_t ): + if isinstance( source.declaration, enumeration.enumeration_t ) \ + and is_fundamental( target ) \ + and not is_void( target ): + return True # enum could be converted to any integral type + + if isinstance( source.declaration, class_declaration.class_t ): + source_inst = source.declaration + #class instance could be convertible to something else if it has operator + casting_operators = algorithm.find_all_declarations( source_inst.declarations + , type=calldef.casting_operator_t + , recursive=False ) + if casting_operators: + for operator in casting_operators: + if is_convertible( operator.return_type, target ): + return True + + #may be target is class too, so in this case we should check whether is + #has constructor from source + if isinstance( target, cpptypes.declarated_t ): + if isinstance( target.declaration, class_declaration.class_t ): + constructors = algorithm.find_all_declarations( target.declaration.declarations + , type=calldef.constructor_t + , recursive=False ) + if constructors: + for constructor in constructors: + if 1 != len( constructor.arguments ): + continue + #TODO: add test to check explicitness + if is_convertible( source, constructor.arguments[0].type ): + return True + + return False + +def is_convertible( source, target ): + """returns True, if source could be converted to target, otherwise False""" + return __is_convertible_t( source, target ).is_convertible() + +def __is_noncopyable_single( class_): + """implementation details""" + #It is not enough to check base classes, we should also to check + #member variables. + logger = utils.loggers.cxx_parser + + if has_copy_constructor( class_ ) \ + and has_public_constructor( class_ ) \ + and has_public_assign( class_ ) \ + and has_public_destructor( class_ ): + msg = os.linesep.join([ + "__is_noncopyable_single - %s - COPYABLE:" % class_.decl_string + , " trivial copy constructor: yes" + , " public constructor: yes" + , " public assign: yes" + , " public destructor: yes" + ]) + logger.debug( msg ) + return False + if class_.find_noncopyable_vars(): + logger.debug( "__is_noncopyable_single(TRUE) - %s - contains noncopyable members" % class_.decl_string ) + return True + else: + logger.debug( "__is_noncopyable_single(FALSE) - %s - COPYABLE, because is doesn't contains noncopyable members" % class_.decl_string ) + return False + +def is_noncopyable( class_ ): + """returns True, if class is noncopyable, False otherwise""" + logger = utils.loggers.cxx_parser + class_ = class_traits.get_declaration( class_ ) + + true_header = "is_noncopyable(TRUE) - %s - " % class_.decl_string + false_header = "is_noncopyable(false) - %s - " % class_.decl_string + + if class_.class_type == class_declaration.CLASS_TYPES.UNION: + return False + + if class_.is_abstract: + logger.debug( true_header + "abstract client" ) + return True + + #if class has public, user defined copy constructor, than this class is + #copyable + copy_ = class_.find_copy_constructor() + if copy_ and copy_.access_type == 'public' and not copy_.is_artificial: + return False + + for base_desc in class_.recursive_bases: + assert isinstance( base_desc, class_declaration.hierarchy_info_t ) + if base_desc.related_class.decl_string in ('::boost::noncopyable', '::boost::noncopyable_::noncopyable' ): + logger.debug( true_header + "derives from boost::noncopyable" ) + return True + if not has_copy_constructor( base_desc.related_class ): + base_copy_ = base_desc.related_class.find_copy_constructor() + if base_copy_: + if base_copy_.access_type == 'private': + logger.debug( true_header + "there is private copy constructor" ) + return True + else: + if __is_noncopyable_single( base_desc.related_class ): + logger.debug( true_header + "__is_noncopyable_single returned True" ) + return True + if __is_noncopyable_single( base_desc.related_class ): + logger.debug( true_header + "__is_noncopyable_single returned True" ) + return True + + if not has_copy_constructor( class_ ): + logger.debug( true_header + "does not have trival copy constructor" ) + return True + elif not has_public_constructor( class_ ): + logger.debug( true_header + "does not have a public constructor" ) + return True + elif has_destructor( class_ ) and not has_public_destructor( class_ ): + logger.debug( true_header + "has private destructor") + return True + else: + return __is_noncopyable_single( class_ ) + +def is_defined_in_xxx( xxx, cls ): + """small helper function, that checks whether class ( C{cls} ) is defined + under C{::xxx} namespace""" + if not cls.parent: + return False + + if not isinstance( cls.parent, namespace.namespace_t ): + return False + + if xxx != cls.parent.name: + return False + + xxx_ns = cls.parent + if not xxx_ns.parent: + return False + + if not isinstance( xxx_ns.parent, namespace.namespace_t ): + return False + + if '::' != xxx_ns.parent.name: + return False + + global_ns = xxx_ns.parent + return None is global_ns.parent + +class impl_details: + """implementation details""" + @staticmethod + def is_defined_in_xxx( xxx, cls ): + """implementation details""" + if not cls.parent: + return False + + if not isinstance( cls.parent, namespace.namespace_t ): + return False + + if xxx != cls.parent.name: + return False + + xxx_ns = cls.parent + if not xxx_ns.parent: + return False + + if not isinstance( xxx_ns.parent, namespace.namespace_t ): + return False + + if '::' != xxx_ns.parent.name: + return False + + global_ns = xxx_ns.parent + return None is global_ns.parent + + @staticmethod + def find_value_type( global_ns, value_type_str ): + """implementation details""" + if not value_type_str.startswith( '::' ): + value_type_str = '::' + value_type_str + found = global_ns.decls( name=value_type_str + , function=lambda decl: not isinstance( decl, calldef.calldef_t ) + , allow_empty=True ) + if not found: + no_global_ns_value_type_str = value_type_str[2:] + if cpptypes.FUNDAMENTAL_TYPES.has_key( no_global_ns_value_type_str ): + return cpptypes.FUNDAMENTAL_TYPES[ no_global_ns_value_type_str ] + elif is_std_string( value_type_str ): + string_ = global_ns.typedef( '::std::string' ) + return remove_declarated( string_ ) + elif is_std_wstring( value_type_str ): + string_ = global_ns.typedef( '::std::wstring' ) + return remove_declarated( string_ ) + else: + value_type_str = no_global_ns_value_type_str + has_const = value_type_str.startswith( 'const ' ) + if has_const: + value_type_str = value_type_str[ len('const '): ] + has_pointer = value_type_str.endswith( '*' ) + if has_pointer: + value_type_str = value_type_str[:-1] + found = None + if has_const or has_pointer: + found = impl_details.find_value_type( global_ns, value_type_str ) + if not found: + return None + else: + if isinstance( found, class_declaration.class_types ): + found = cpptypes.declarated_t( found ) + if has_const: + found = cpptypes.const_t( found ) + if has_pointer: + found = cpptypes.pointer_t( found ) + return found + if len( found ) == 1: + return found[0] + else: + return None + +class smart_pointer_traits: + """implements functionality, needed for convinient work with smart pointers""" + + @staticmethod + def is_smart_pointer( type ): + """returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise""" + type = remove_alias( type ) + type = remove_cv( type ) + type = remove_declarated( type ) + if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): + return False + if not impl_details.is_defined_in_xxx( 'boost', type ): + return False + return type.decl_string.startswith( '::boost::shared_ptr<' ) + + @staticmethod + def value_type( type ): + """returns reference to boost::shared_ptr value type""" + if not smart_pointer_traits.is_smart_pointer( type ): + raise TypeError( 'Type "%s" is not instantiation of boost::shared_ptr' % type.decl_string ) + type = remove_alias( type ) + cls = remove_cv( type ) + cls = remove_declarated( type ) + if isinstance( cls, class_declaration.class_t ): + return remove_declarated( cls.typedef( "value_type", recursive=False ).type ) + elif not isinstance( cls, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): + raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) + else: + value_type_str = templates.args( cls.name )[0] + ref = impl_details.find_value_type( cls.top_parent, value_type_str ) + if None is ref: + raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) + return ref + +class auto_ptr_traits: + """implements functionality, needed for convinient work with std::auto_ptr pointers""" + + @staticmethod + def is_smart_pointer( type ): + """returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise""" + type = remove_alias( type ) + type = remove_cv( type ) + type = remove_declarated( type ) + if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): + return False + if not impl_details.is_defined_in_xxx( 'std', type ): + return False + return type.decl_string.startswith( '::std::auto_ptr<' ) + + @staticmethod + def value_type( type ): + """returns reference to boost::shared_ptr value type""" + if not auto_ptr_traits.is_smart_pointer( type ): + raise TypeError( 'Type "%s" is not instantiation of std::auto_ptr' % type.decl_string ) + type = remove_alias( type ) + cls = remove_cv( type ) + cls = remove_declarated( type ) + if isinstance( cls, class_declaration.class_t ): + return remove_declarated( cls.typedef( "element_type", recursive=False ).type ) + elif not isinstance( cls, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): + raise RuntimeError( "Unable to find out auto_ptr value type. auto_ptr class is: %s" % cls.decl_string ) + else: + value_type_str = templates.args( cls.name )[0] + ref = impl_details.find_value_type( cls.top_parent, value_type_str ) + if None is ref: + raise RuntimeError( "Unable to find out auto_ptr value type. shared_ptr class is: %s" % cls.decl_string ) + return ref + + +def is_std_string( type ): + """returns True, if type represents C++ std::string, False otherwise""" + decl_strings = [ + '::std::basic_string,std::allocator >' + , '::std::basic_string, std::allocator >' + , '::std::string' ] + if isinstance( type, types.StringTypes ): + return type in decl_strings + else: + type = remove_alias( type ) + return remove_cv( type ).decl_string in decl_strings + +def is_std_wstring( type ): + """returns True, if type represents C++ std::wstring, False otherwise""" + decl_strings = [ + '::std::basic_string,std::allocator >' + , '::std::basic_string, std::allocator >' + , '::std::wstring' ] + if isinstance( type, types.StringTypes ): + return type in decl_strings + else: + type = remove_alias( type ) + return remove_cv( type ).decl_string in decl_strings + +def is_std_ostream( type ): + """returns True, if type represents C++ std::string, False otherwise""" + decl_strings = [ + '::std::basic_ostream >' + , '::std::basic_ostream >' + , '::std::ostream' ] + if isinstance( type, types.StringTypes ): + return type in decl_strings + else: + type = remove_alias( type ) + return remove_cv( type ).decl_string in decl_strings + + +def is_std_wostream( type ): + """returns True, if type represents C++ std::string, False otherwise""" + decl_strings = [ + '::std::basic_ostream >' + , '::std::basic_ostream >' + , '::std::wostream' ] + if isinstance( type, types.StringTypes ): + return type in decl_strings + else: + type = remove_alias( type ) + return remove_cv( type ).decl_string in decl_strings + + + + + + + + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_visitor.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_visitor.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_visitor.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/type_visitor.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,132 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines types visitor class interface +""" + +class type_visitor_t(object): + """ + types visitor interface + + All functions within this class should be redefined in derived classes. + """ + def __init__(self): + object.__init__(self) + + def visit_void( self ): + raise NotImplementedError() + + def visit_char( self ): + raise NotImplementedError() + + def visit_unsigned_char( self ): + raise NotImplementedError() + + def visit_signed_char( self ): + raise NotImplementedError() + + def visit_wchar( self ): + raise NotImplementedError() + + def visit_short_int( self ): + raise NotImplementedError() + + def visit_short_unsigned_int( self ): + raise NotImplementedError() + + def visit_bool( self ): + raise NotImplementedError() + + def visit_int( self ): + raise NotImplementedError() + + def visit_unsigned_int( self ): + raise NotImplementedError() + + def visit_long_int( self ): + raise NotImplementedError() + + def visit_long_unsigned_int( self ): + raise NotImplementedError() + + def visit_long_long_int( self ): + raise NotImplementedError() + + def visit_long_long_unsigned_int( self ): + raise NotImplementedError() + + def visit_float( self ): + raise NotImplementedError() + + def visit_double( self ): + raise NotImplementedError() + + def visit_long_double( self ): + raise NotImplementedError() + + def visit_complex_long_double(self): + raise NotImplementedError() + + def visit_complex_double(self): + raise NotImplementedError() + + def visit_complex_float(self): + raise NotImplementedError() + + def visit_jbyte(self): + raise NotImplementedError() + + def visit_jshort(self): + raise NotImplementedError() + + def visit_jint(self): + raise NotImplementedError() + + def visit_jlong(self): + raise NotImplementedError() + + def visit_jfloat(self): + raise NotImplementedError() + + def visit_jdouble(self): + raise NotImplementedError() + + def visit_jchar(self): + raise NotImplementedError() + + def visit_jboolean(self): + raise NotImplementedError() + + def visit_volatile( self ): + raise NotImplementedError() + + def visit_const( self ): + raise NotImplementedError() + + def visit_pointer( self ): + raise NotImplementedError() + + def visit_reference( self ): + raise NotImplementedError() + + def visit_array( self ): + raise NotImplementedError() + + def visit_free_function_type( self ): + raise NotImplementedError() + + def visit_member_function_type( self ): + raise NotImplementedError() + + def visit_member_variable_type( self ): + raise NotImplementedError() + + def visit_declarated( self ): + raise NotImplementedError() + + def visit_restrict( self ): + raise NotImplementedError() + \ No newline at end of file diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/variable.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/variable.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/variable.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/declarations/variable.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,82 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines class that describes C++ global and member variable declaration +""" + +import declaration +import dependencies +import class_declaration + +class variable_t( declaration.declaration_t ): + """describes C++ global and member variable declaration""" + + def __init__( self, name='', type=None, type_qualifiers=None, value=None, bits=None): + """creates class that describes C++ global or member variable""" + declaration.declaration_t.__init__( self, name ) + self._type = type + self._type_qualifiers = type_qualifiers + self._value = value + self._bits = bits + self._byte_offset = 0 + + def _get__cmp__items( self ): + """implementation details""" + return [ self.type, self.type_qualifiers, self.value ] + + def __eq__(self, other): + """implementation details""" + if not declaration.declaration_t.__eq__( self, other ): + return False + return self.type == other.type \ + and self.type_qualifiers == other.type_qualifiers \ + and self.value == other.value \ + and self.bits == other.bits + + def _get_type(self): + return self._type + def _set_type(self, type): + self._type = type + type = property( _get_type, _set_type + , doc="reference to the variable L{type}" ) + + def _get_type_qualifiers(self): + return self._type_qualifiers + def _set_type_qualifiers(self, type_qualifiers): + self._type_qualifiers = type_qualifiers + type_qualifiers = property( _get_type_qualifiers, _set_type_qualifiers + , doc="reference to the L{type_qualifiers_t} instance" ) + + def _get_value(self): + return self._value + def _set_value(self, value): + self._value = value + value = property( _get_value, _set_value + , doc="string, that contains the variable value" ) + + def _get_bits(self): + return self._bits + def _set_bits(self, bits): + self._bits = bits + bits = property( _get_bits, _set_bits + , doc="integer, that contains information about how many bit takes bit field") + + def _get_byte_offset(self): + return self._byte_offset + def _set_byte_offset(self, byte_offset): + self._byte_offset = byte_offset + byte_offset = property( _get_byte_offset, _set_byte_offset + , doc="integer, offset of the field from the beginning of class.") + + + @property + def access_type(self): + if not isinstance( self.parent, class_declaration.class_t ): + raise RuntimeError( "access_type functionality only available on member variables and not on global variables" ) + return self.parent.find_out_member_access_type( self ) + + def i_depend_on_them( self, recursive=True ): + return [ dependencies.dependency_info_t( self, self.type ) ] diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/__init__.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/__init__.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/__init__.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,42 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""Python GCC-XML front end. + +This package provides functionality to extract and inspect +declarations from C/C++ header files. This is accomplished +by invoking the external tool U{gccxml} +which parses a header file and dumps the declarations as a +XML file. This XML file is then read by pygccxml and the contents +are made available as appropriate Python objects. + +To parse a set of C/C++ header files you use the +L{parse()} function in the L{parser} sub package which +returns a tree that contains all declarations found in the header +files. The root of the tree represents the main namespace C{::} and +the children nodes represent the namespace contents such as other +namespaces, classes, functions, etc. Each node in the tree is an +object of a type derived from the +L{declaration_t} base class. An inner +node is always either a namespace (L{namespace_t}) +or a class (L{class_t}) which are both derived +from L{scopedef_t}. Everything else (free functions, +member functions, enumerations, variables, etc.) is always a leaf. +You will find all those declaration classes in the L{declarations} +sub-package. + +""" + +import pygccxml.declarations as declarations +import pygccxml.parser as parser +import pygccxml.utils as utils + +#TODO: +# 1. Write documentation for filtering functionality. +# 2. Add "explicit" property for constructors + +__version__ = '1.0.0' + +__revision__ = 1080 diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/c_wrapper.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/c_wrapper.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/c_wrapper.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/c_wrapper.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,284 @@ +import os +import sys +import ctypes +import logging + +from ctypes import * +from ctypes.wintypes import ULONG +from ctypes.wintypes import DWORD +from ctypes.wintypes import BOOL +from ctypes.wintypes import BYTE +from ctypes.wintypes import WORD +from ctypes.wintypes import UINT + +from .. import config as msvc_cfg +from ... import utils #import utils from pygccxml package + +STRING = c_char_p +_libraries = {} +_libraries['msvcr70.dll'] = CDLL(msvc_cfg.msvcr_path, mode=RTLD_GLOBAL) +_libraries['msbsc70.dll'] = CDLL(msvc_cfg.msbsc_path, mode=RTLD_GLOBAL) + + +qyMac = 9 +refreshAllOp = 4 +qyDervOf = 7 +delOp = 1 +qyImpMembers = 8 +changeOp = 2 +qyRefs = 4 +qyCalls = 2 +changeIinstOp = 3 +qyContains = 1 +qyCalledBy = 3 +noOp = 5 +qyBaseOf = 6 +qyNil = 0 +addOp = 0 +qyDefs = 5 +PULONG = POINTER(ULONG) +USHORT = c_ushort +PUSHORT = POINTER(USHORT) +UCHAR = c_ubyte +PUCHAR = POINTER(UCHAR) +PSZ = STRING +FLOAT = c_float +PFLOAT = POINTER(FLOAT) +PBOOL = POINTER(BOOL) +LPBOOL = POINTER(BOOL) +PBYTE = POINTER(BYTE) +LPBYTE = POINTER(BYTE) +PINT = POINTER(c_int) +LPINT = POINTER(c_int) +PWORD = POINTER(WORD) +LPWORD = POINTER(WORD) +LPLONG = POINTER(c_long) +PDWORD = POINTER(DWORD) +LPDWORD = POINTER(DWORD) +LPVOID = c_void_p +LPCVOID = c_void_p +INT = c_int +PUINT = POINTER(c_uint) +ULONG_PTR = POINTER(ULONG) +NI = ULONG +IINST = ULONG +IREF = ULONG +IDEF = ULONG +IMOD = USHORT +LINE = USHORT +TYP = BYTE +ATR = USHORT +ATR32 = ULONG +MBF = ULONG +SZ = STRING +SZ_CONST = STRING + +class Bsc(Structure): + pass + +# values for enumeration 'OPERATION' +OPERATION = c_int # enum +class IinstInfo(Structure): + pass +IinstInfo._fields_ = [ + ('m_iinst', IINST), + ('m_szName', SZ_CONST), + ('m_ni', NI), +] +class BSC_STAT(Structure): + pass +BSC_STAT._fields_ = [ + ('cDef', ULONG), + ('cRef', ULONG), + ('cInst', ULONG), + ('cMod', ULONG), + ('cUseLink', ULONG), + ('cBaseLink', ULONG), +] +class NiQ(Structure): + pass +NiQ._fields_ = [ + ('m_iinstOld', IINST), + ('m_iInfoNew', IinstInfo), + ('m_op', OPERATION), + ('m_typ', TYP), +] +pfnNotifyChange = CFUNCTYPE(BOOL, POINTER(NiQ), ULONG, ULONG_PTR) + +# values for enumeration '_qy_' +_qy_ = c_int # enum +QY = _qy_ +Bsc._fields_ = [ +] +BSCOpen = _libraries['msbsc70.dll'].BSCOpen +BSCOpen.restype = BOOL +BSCOpen.argtypes = [SZ_CONST, POINTER(POINTER(Bsc))] +BSCClose = _libraries['msbsc70.dll'].BSCClose +BSCClose.restype = BOOL +BSCClose.argtypes = [POINTER(Bsc)] +BSCIinstInfo = _libraries['msbsc70.dll'].BSCIinstInfo +BSCIinstInfo.restype = BOOL +BSCIinstInfo.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR)] +BSCIrefInfo = _libraries['msbsc70.dll'].BSCIrefInfo +BSCIrefInfo.restype = BOOL +BSCIrefInfo.argtypes = [POINTER(Bsc), IREF, POINTER(SZ), POINTER(LINE)] +BSCIdefInfo = _libraries['msbsc70.dll'].BSCIdefInfo +BSCIdefInfo.restype = BOOL +BSCIdefInfo.argtypes = [POINTER(Bsc), IDEF, POINTER(SZ), POINTER(LINE)] +BSCImodInfo = _libraries['msbsc70.dll'].BSCImodInfo +BSCImodInfo.restype = BOOL +BSCImodInfo.argtypes = [POINTER(Bsc), IMOD, POINTER(SZ)] +BSCSzFrTyp = _libraries['msbsc70.dll'].BSCSzFrTyp +BSCSzFrTyp.restype = SZ +BSCSzFrTyp.argtypes = [POINTER(Bsc), TYP] +BSCSzFrAtr = _libraries['msbsc70.dll'].BSCSzFrAtr +BSCSzFrAtr.restype = SZ +BSCSzFrAtr.argtypes = [POINTER(Bsc), ATR] +BSCGetIinstByvalue = _libraries['msbsc70.dll'].BSCGetIinstByvalue +BSCGetIinstByvalue.restype = BOOL +BSCGetIinstByvalue.argtypes = [POINTER(Bsc), SZ, TYP, ATR, POINTER(IINST)] +BSCGetOverloadArray = _libraries['msbsc70.dll'].BSCGetOverloadArray +BSCGetOverloadArray.restype = BOOL +BSCGetOverloadArray.argtypes = [POINTER(Bsc), SZ, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCGetUsedByArray = _libraries['msbsc70.dll'].BSCGetUsedByArray +BSCGetUsedByArray.restype = BOOL +BSCGetUsedByArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCGetUsesArray = _libraries['msbsc70.dll'].BSCGetUsesArray +BSCGetUsesArray.restype = BOOL +BSCGetUsesArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCGetBaseArray = _libraries['msbsc70.dll'].BSCGetBaseArray +BSCGetBaseArray.restype = BOOL +BSCGetBaseArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCGetDervArray = _libraries['msbsc70.dll'].BSCGetDervArray +BSCGetDervArray.restype = BOOL +BSCGetDervArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCGetMembersArray = _libraries['msbsc70.dll'].BSCGetMembersArray +BSCGetMembersArray.restype = BOOL +BSCGetMembersArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCGetDefArray = _libraries['msbsc70.dll'].BSCGetDefArray +BSCGetDefArray.restype = BOOL +BSCGetDefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)] +BSCGetRefArray = _libraries['msbsc70.dll'].BSCGetRefArray +BSCGetRefArray.restype = BOOL +BSCGetRefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)] +BSCGetModuleContents = _libraries['msbsc70.dll'].BSCGetModuleContents +BSCGetModuleContents.restype = BOOL +BSCGetModuleContents.argtypes = [POINTER(Bsc), IMOD, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCGetModuleByName = _libraries['msbsc70.dll'].BSCGetModuleByName +BSCGetModuleByName.restype = BOOL +BSCGetModuleByName.argtypes = [POINTER(Bsc), SZ, POINTER(IMOD)] +BSCGetAllModulesArray = _libraries['msbsc70.dll'].BSCGetAllModulesArray +BSCGetAllModulesArray.restype = BOOL +BSCGetAllModulesArray.argtypes = [POINTER(Bsc), POINTER(POINTER(IMOD)), POINTER(ULONG)] +BSCDisposeArray = _libraries['msbsc70.dll'].BSCDisposeArray +BSCDisposeArray.restype = None +BSCDisposeArray.argtypes = [POINTER(Bsc), c_void_p] +BSCFormatDname = _libraries['msbsc70.dll'].BSCFormatDname +BSCFormatDname.restype = SZ +BSCFormatDname.argtypes = [POINTER(Bsc), SZ] +BSCFInstFilter = _libraries['msbsc70.dll'].BSCFInstFilter +BSCFInstFilter.restype = BOOL +BSCFInstFilter.argtypes = [POINTER(Bsc), IINST, MBF] +BSCIinstFrIref = _libraries['msbsc70.dll'].BSCIinstFrIref +BSCIinstFrIref.restype = IINST +BSCIinstFrIref.argtypes = [POINTER(Bsc), IREF] +BSCIinstFrIdef = _libraries['msbsc70.dll'].BSCIinstFrIdef +BSCIinstFrIdef.restype = IINST +BSCIinstFrIdef.argtypes = [POINTER(Bsc), IDEF] +BSCIinstContextIref = _libraries['msbsc70.dll'].BSCIinstContextIref +BSCIinstContextIref.restype = IINST +BSCIinstContextIref.argtypes = [POINTER(Bsc), IREF] +BSCGetStatistics = _libraries['msbsc70.dll'].BSCGetStatistics +BSCGetStatistics.restype = BOOL +BSCGetStatistics.argtypes = [POINTER(Bsc), POINTER(BSC_STAT)] +BSCGetModuleStatistics = _libraries['msbsc70.dll'].BSCGetModuleStatistics +BSCGetModuleStatistics.restype = BOOL +BSCGetModuleStatistics.argtypes = [POINTER(Bsc), IMOD, POINTER(BSC_STAT)] +BSCFCaseSensitive = _libraries['msbsc70.dll'].BSCFCaseSensitive +BSCFCaseSensitive.restype = BOOL +BSCFCaseSensitive.argtypes = [POINTER(Bsc)] +BSCSetCaseSensitivity = _libraries['msbsc70.dll'].BSCSetCaseSensitivity +BSCSetCaseSensitivity.restype = BOOL +BSCSetCaseSensitivity.argtypes = [POINTER(Bsc), BOOL] +BSCGetAllGlobalsArray = _libraries['msbsc70.dll'].BSCGetAllGlobalsArray +BSCGetAllGlobalsArray.restype = BOOL +BSCGetAllGlobalsArray.argtypes = [POINTER(Bsc), MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] +BSCSzFrAtr2 = _libraries['msbsc70.dll'].BSCSzFrAtr2 +BSCSzFrAtr2.restype = SZ +BSCSzFrAtr2.argtypes = [POINTER(Bsc), ATR32] +BSCIinstInfo2 = _libraries['msbsc70.dll'].BSCIinstInfo2 +BSCIinstInfo2.restype = BOOL +BSCIinstInfo2.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR32)] +BSCGetIinstByvalue2 = _libraries['msbsc70.dll'].BSCGetIinstByvalue2 +BSCGetIinstByvalue2.restype = BOOL +BSCGetIinstByvalue2.argtypes = [POINTER(Bsc), SZ, TYP, ATR32, POINTER(IINST)] +OpenBSCQuery = _libraries['msbsc70.dll'].OpenBSCQuery +OpenBSCQuery.restype = BOOL +OpenBSCQuery.argtypes = [POINTER(Bsc)] +CloseBSCQuery = _libraries['msbsc70.dll'].CloseBSCQuery +CloseBSCQuery.restype = BOOL +CloseBSCQuery.argtypes = [] +BOB = ULONG +InitBSCQuery = _libraries['msbsc70.dll'].InitBSCQuery +InitBSCQuery.restype = BOOL +InitBSCQuery.argtypes = [QY, BOB] +BobNext = _libraries['msbsc70.dll'].BobNext +BobNext.restype = BOB +BobNext.argtypes = [] +BobFrName = _libraries['msbsc70.dll'].BobFrName +BobFrName.restype = BOB +BobFrName.argtypes = [SZ] +LszNameFrBob = _libraries['msbsc70.dll'].LszNameFrBob +LszNameFrBob.restype = SZ +LszNameFrBob.argtypes = [BOB] +CLS = USHORT + +class enums: + class MBF(utils.enum): + NIL = 0x000 + VARS = 0x001 + FUNCS = 0x002 + MACROS = 0x004 + TYPES = 0x008 + CLASS = 0x010 + INCL = 0x020 + MSGMAP = 0x040 + DIALOGID = 0x080 + LIBRARY = 0x100 + IMPORT = 0x200 + TEMPLATE = 0x400 + NAMESPACE = 0x800 + ALL = 0xFFF + + class TYPES(utils.enum): + FUNCTION = 0x01 + LABEL = 0x02 + PARAMETER = 0x03 + VARIABLE = 0x04 + CONSTANT = 0x05 + MACRO = 0x06 + TYPEDEF = 0x07 + STRUCNAM = 0x08 + ENUMNAM = 0x09 + ENUMMEM = 0x0A + UNIONNAM = 0x0B + SEGMENT = 0x0C + GROUP = 0x0D + PROGRAM = 0x0E + CLASSNAM = 0x0F + MEMFUNC = 0x10 + MEMVAR = 0x11 + + class ATTRIBUTES(utils.enum): + LOCAL = 0x001 + STATIC = 0x002 + SHARED = 0x004 + NEAR = 0x008 + COMMON = 0x010 + DECL_ONLY = 0x020 + PUBLIC = 0x040 + NAMED = 0x080 + MODULE = 0x100 + VIRTUAL = 0x200 + PRIVATE = 0x400 + PROTECT = 0x800 diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/__init__.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/__init__.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/bsc/__init__.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,291 @@ +import os +import sys +import logging +from c_wrapper import * +from .. import common_utils as msvc_utils + +class definition_t(object): + #represents some other symbol + def __init__( self, def_id, bsc ): + self.__bsc = bsc + self.__def_id = def_id + + @property + def def_id(self): + return self.__def_id + + @utils.cached + def location( self ): + module = STRING() + line = LINE() + if not BSCIdefInfo( self.__bsc, self.def_id, byref( module ), byref( line ) ): + raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__def_id ) ) + return (module, line) + + @utils.cached + def file_name(self): + return self.location[0].value + + @utils.cached + def line(self): + return self.location[1].value + + def __str__( self ): + return self.file_name + ': %d' % self.line + ' name: %s' % self.as_instance.name + + @utils.cached + def as_instance(self): + return self.__bsc.create_instance( BSCIinstFrIdef( self.__bsc, self.def_id) ) + +class instance_t(object): + #represents some symbol + def __init__( self, inst_id, bsc ): + self.__bsc = bsc + self.__inst_id = inst_id + + @property + def inst_id(self): + return self.__inst_id + + @utils.cached + def name_type_attribute_mangled_name( self ): + name = STRING() + typ = TYP() + attribute = ATR() + if not BSCIinstInfo( self.__bsc, self.inst_id, byref( name ), byref( typ ), byref( attribute ) ): + raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__inst_id ) ) + undecorated_name = msvc_utils.undecorate_name( name.value ) + if undecorated_name.startswith( ' ?? ' ): + undecorated_name = undecorated_name[4:] + #BSCFormatDname( self.__bsc, name ) + return undecorated_name, typ, attribute, name.value + + @utils.cached + def mangled_name(self): + return self.name_type_attribute_mangled_name[3] + + @utils.cached + def name(self): + return self.name_type_attribute_mangled_name[0] + + @utils.cached + def type(self): + return self.name_type_attribute_mangled_name[1].value + + @utils.cached + def attribute(self): + return self.name_type_attribute_mangled_name[2].value + + @utils.cached + def is_class(self): + return self.type in [ enums.TYPES.STRUCNAM + , enums.TYPES.UNIONNAM + , enums.TYPES.CLASSNAM ] + + def __str__( self ): + tmp = [] + if enums.TYPES.has_value( self.type ): + tmp.append( 'type( "%s" )' % enums.TYPES.name_of( self.type ) ) + if enums.ATTRIBUTES.has_value( self.attribute ): + tmp.append( 'attribute( "%s" )' % enums.ATTRIBUTES.name_of( self.attribute ) ) + tmp.append( 'name( "%s" )' % self.name ) + tmp.append( 'mangled name( "%s" )' % self.mangled_name ) + return ', '.join( tmp ) + + + @utils.cached + def definitions( self ): + definitions_len = ULONG(0) + definitions_ids = pointer( IDEF() ) + + if not BSCGetDefArray( self.__bsc, self.inst_id, byref( definitions_ids ), byref( definitions_len ) ): + raise RuntimeError( "Unable to call BSCGetDefArray" ) + + definitions = map( lambda i: definition_t( definitions_ids[i], self.__bsc ) + , range( definitions_len.value ) ) + + BSCDisposeArray( self.__bsc, definitions_ids ) + return definitions + + @utils.cached + def members( self ): + instances_len = ULONG(0) + instances_ids = pointer( IINST() ) + + if not BSCGetMembersArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): + raise RuntimeError( "Unable to call BSCGetMembersArray" ) + + instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) + , range( instances_len.value ) ) + + BSCDisposeArray( self.__bsc, instances_ids ) + return instances + + @utils.cached + def used_symbols(self): + instances_len = ULONG(0) + instances_ids = pointer( IINST() ) + + if not BSCGetUsesArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): + raise RuntimeError( "Unable to call BSCGetUsesArray" ) + + instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) + , range( instances_len.value ) ) + + BSCDisposeArray( self.__bsc, instances_ids ) + return instances + + @utils.cached + def base_classes(self): + instances_len = ULONG(0) + instances_ids = pointer( IINST() ) + + if not BSCGetBaseArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ): + raise RuntimeError( "Unable to call BSCGetBaseArray" ) + + instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) + , range( instances_len.value ) ) + + BSCDisposeArray( self.__bsc, instances_ids ) + return instances + + @utils.cached + def derived_classes(self): + instances_len = ULONG(0) + instances_ids = pointer( IINST() ) + + if not BSCGetDervArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ): + raise RuntimeError( "Unable to call BSCGetDervArray" ) + + instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) + , range( instances_len.value ) ) + + BSCDisposeArray( self.__bsc, instances_ids ) + return instances + +class module_t(object): + #represents file + def __init__( self, mod_id, bsc ): + self.__bsc = bsc + self.__mod_id = mod_id + + @property + def mod_id( self ): + return self.__mod_id + + @utils.cached + def path( self ): + name = STRING() + BSCImodInfo(self.__bsc, self.__mod_id, byref(name)) + return name.value + + @utils.cached + def instances( self ): + instances_len = ULONG(0) + instances_ids = pointer( IINST() ) + + if not BSCGetModuleContents( self.__bsc, self.mod_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): + raise RuntimeError( "Unable to call BSCGetModuleContents" ) + + instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) + , range( instances_len.value ) ) + + BSCDisposeArray( self.__bsc, instances_ids ) + return instances + +class reader_t( object ): + def __init__( self, bsc_file ): + self.logger = utils.loggers.pdb_reader + self.logger.setLevel(logging.INFO) + + self.__bsc_file = bsc_file + self.__bsc = pointer( Bsc() ) + if not BSCOpen( self.__bsc_file, byref( self.__bsc ) ): + raise RuntimeError( "Unable to open bsc file '%s'" % self.__bsc_file ) + + self.__instances_cache = {} #inst id : instance_t + self.__bsc.create_instance = lambda inst_id: self.__create_instance( inst_id ) + + @utils.cached + def instances(self): + return self.__instances_cache.values() + + def __create_instance( self, inst_id ): + try: + return self.__instances_cache[ inst_id ] + except KeyError: + inst = instance_t( inst_id, self.__bsc ) + self.__instances_cache[ inst_id ] = inst + return inst + + def load_instances( self ): + instances_len = ULONG(0) + instances_ids = pointer( IINST() ) + + if not BSCGetAllGlobalsArray( self.__bsc, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): + raise RuntimeError( "Unable to load all globals symbols" ) + + for i in range( instances_len.value ): + self.__create_instance( instances_ids[i] ) + + BSCDisposeArray( self.__bsc, instances_ids ) + + @utils.cached + def is_case_sensitive( self ): + return bool( BSCFCaseSensitive( self.__bsc ) ) + + @utils.cached + def files(self): + module_ids = pointer( IMOD() ) + module_len = ULONG() + bs = BSC_STAT() + + if not BSCGetAllModulesArray( self.__bsc, module_ids, byref(module_len) ): + raise RuntimeError( "Unable to load all modules" ) + + modules = map( lambda i: module_t( module_ids[i], self.__bsc ) + , range( module_len.value ) ) + + BSCDisposeArray( self.__bsc, module_ids ) + + return modules + + def print_stat( self ): + stat = BSC_STAT() + BSCGetStatistics( self.__bsc, byref( stat ) ) + for f, t in stat._fields_: + print '%s: %s' % ( f, str( getattr( stat, f) ) ) + + def print_classes(self, file_name=None): + for m in self.files: + if file_name and m.path != file_name: + continue + print 'File: ', m.path + if m.instances: + print '\tInstances:' + for inst in m.instances: + print '\t\t', str(inst) + if inst.definitions: + print '\t\t\tDefinitions:' + for definition in inst.definitions: + print '\t\t\t\t', str( definition ) + if inst.members: + print '\t\t\tMembers:' + for member in inst.members: + print '\t\t\t\t', str( member ) + if inst.used_symbols: + print '\t\t\tUsed symbols:' + for used_symbol in inst.used_symbols: + print '\t\t\t\t', str( used_symbol ) + if inst.base_classes: + print '\t\t\tBase classes:' + for base_class in inst.base_classes: + print '\t\t\t\t', str( base_class ) + if inst.derived_classes: + print '\t\t\tDerived classes:' + for derived_class in inst.derived_classes: + print '\t\t\t\t', str( derived_class ) + + def __del__( self ): + if self.__bsc: + BSCClose( self.__bsc ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/common_utils.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/common_utils.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/common_utils.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/common_utils.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,70 @@ +import ctypes +import ctypes.wintypes +import config as msvc_cfg + +class UNDECORATE_NAME_OPTIONS: + UNDNAME_COMPLETE = 0x0000 #Enables full undecoration. + UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords. + UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords. + UNDNAME_NO_FUNCTION_RETURNS = 0x0004 #Disables expansion of return type for primary declaration. + UNDNAME_NO_ALLOCATION_MODEL = 0x0008 #Disables expansion of the declaration model. + UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010 #Disables expansion of the declaration language specifier. + UNDNAME_RESERVED1 = 0x0020 #RESERVED. + UNDNAME_RESERVED2 = 0x0040 #RESERVED. + UNDNAME_NO_THISTYPE = 0x0060 #Disables all modifiers on the this type. + UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080 #Disables expansion of access specifiers for members. + UNDNAME_NO_THROW_SIGNATURES = 0x0100 #Disables expansion of "throw-signatures" for functions and pointers to functions. + UNDNAME_NO_MEMBER_TYPE = 0x0200 #Disables expansion of static or virtual members. + UNDNAME_NO_RETURN_UDT_MODEL = 0x0400 #Disables expansion of the Microsoft model for UDT returns. + UNDNAME_32_BIT_DECODE = 0x0800 #Undecorates 32-bit decorated names. + UNDNAME_NAME_ONLY = 0x1000 #Gets only the name for primary declaration; returns just [scope::]name. Expands template params. + UNDNAME_TYPE_ONLY = 0x2000 #Input is just a type encoding; composes an abstract declarator. + UNDNAME_HAVE_PARAMETERS = 0x4000 #The real template parameters are available. + UNDNAME_NO_ECSU = 0x8000 #Suppresses enum/class/struct/union. + UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters. + UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output. + + UNDNAME_SCOPES_ONLY = UNDNAME_NO_LEADING_UNDERSCORES \ + | UNDNAME_NO_MS_KEYWORDS \ + | UNDNAME_NO_FUNCTION_RETURNS \ + | UNDNAME_NO_ALLOCATION_MODEL \ + | UNDNAME_NO_ALLOCATION_LANGUAGE \ + | UNDNAME_NO_ACCESS_SPECIFIERS \ + | UNDNAME_NO_THROW_SIGNATURES \ + | UNDNAME_NO_MEMBER_TYPE \ + | UNDNAME_NO_ECSU \ + | UNDNAME_NO_IDENT_CHAR_CHECK + +#__unDName definition was taken from: +#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html +msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL) + +free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type +malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type + + +__unDName = msvcrxx.__unDName +__unDName.argtypes = [ ctypes.c_char_p #undecorated name + , ctypes.c_char_p #decorated name + , ctypes.c_int #sizeof undecorated name + , malloc_type + , free_type + , ctypes.c_ushort #flags + ] +__unDName.restype = ctypes.c_char_p + + +def undecorate_name( name, options=None ): + if not name: + return '' + if options is None: + options = UNDECORATE_NAME_OPTIONS.UNDNAME_NO_ECSU + buffer_size = 1024 * 32 + undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol + __unDName( undecorated_name + , name + , buffer_size + , malloc_type( msvcrxx.malloc ) + , free_type( msvcrxx.free ) + , options ) + return undecorated_name.value diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/config.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/config.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/config.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/config.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,73 @@ +import os +import sys +import comtypes +from .. import utils +import comtypes.client +import _winreg as win_registry +from distutils import msvccompiler + +class binaries_searcher_t: + + def get_msbsc_path( self ): + relative_path = os.path.dirname( sys.modules[__name__].__file__) + absolute_path = os.path.abspath (relative_path) + return os.path.join( absolute_path, 'msbsc70.dll' ) + + def get_msvcr70_path( self ): + relative_path = os.path.dirname( sys.modules[__name__].__file__) + absolute_path = os.path.abspath (relative_path) + return os.path.join( absolute_path, 'msvcr70.dll' ) + + + def get_msvcr_path( self ): + vss_installed = self.__get_installed_vs_dirs() + for f in utils.files_walker( vss_installed, ["*.dll"], ): + f_path, f_name = os.path.split( f.upper() ) + if f_name.startswith( 'MSVCR' ): + return f + else: + raise RuntimeError( 'Unable to find msvcrXX.dll. Search path is: %s' % vss_installed ) + + def get_msdia_path( self ): + vss_installed = self.__get_installed_vs_dirs() + msdia_dlls = self.__get_msdia_dll_paths( vss_installed ) + if 1 == len(msdia_dlls): + return msdia_dlls[0] + else: + #TODO find the highest version and use it. + pass + + def __get_msdia_dll_paths( self, vss_installed ): + msdia_dlls = [] + for vs in vss_installed: + debug_dir = os.path.join( vs, 'Common7', 'Packages', 'Debugger' ) + files = filter( lambda f: f.startswith( 'msdia' ) and f.endswith( '.dll' ) + , os.listdir( debug_dir ) ) + if not files: + continue + msdia_dlls.extend([ os.path.join( debug_dir, f ) for f in files ]) + if not msdia_dlls: + raise RuntimeError( 'pygccxml unable to find out msdiaXX.dll location' ) + return msdia_dlls + + def __get_installed_vs_dirs( self ): + vs_reg_path = 'Software\Microsoft\VisualStudio\SxS\VS7' + values = self.read_values( win_registry.HKEY_LOCAL_MACHINE, vs_reg_path ) + return [ values.values()[0] ] + + def read_keys(self, base, key): + return msvccompiler.read_keys(base, key) + + def read_values(self, base, key): + return msvccompiler.read_values(base, key) + +bs = binaries_searcher_t() + +msdia_path = bs.get_msdia_path() +print 'msdia path: ', msdia_path + +msbsc_path = bs.get_msbsc_path() +print 'msbsc path: ', msbsc_path + +msvcr_path = bs.get_msvcr_path() +print 'msvcr path: ', msvcr_path diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/enums.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/enums.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/enums.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/enums.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,60 @@ +from ... import utils #import utils from pygccxml package + +class BasicType(utils.enum): + btNoType = 0 + btVoid = 1 + btChar = 2 + btWChar = 3 + btInt = 6 + btUInt = 7 + btFloat = 8 + btBCD = 9 + btBool = 10 + btLong = 13 + btULong = 14 + btCurrency = 25 + btDate = 26 + btVariant = 27 + btComplex = 28 + btBit = 29 + btBSTR = 30 + btHresult = 31 + + + + +#Adding code, that was not generated for some reason. +class UdtKind(utils.enum): + UdtStruct, UdtClass, UdtUnion = (0, 1, 2) + +class CV_access_e(utils.enum): + CV_private, CV_protected, CV_public = (1, 2, 3) + +class NameSearchOptions(utils.enum): + nsNone = 0 + nsfCaseSensitive = 0x1 + nsfCaseInsensitive = 0x2 + nsfFNameExt = 0x4 + nsfRegularExpression = 0x8 + nsfUndecoratedName = 0x10 + + # For backward compabibility: + nsCaseSensitive = nsfCaseSensitive + nsCaseInsensitive = nsfCaseInsensitive + nsFNameExt = nsfFNameExt + nsRegularExpression = nsfRegularExpression | nsfCaseSensitive + nsCaseInRegularExpression = nsfRegularExpression | nsfCaseInsensitive + + +class DataKind( utils.enum ): + DataIsUnknown = 0 + DataIsLocal = 1 + DataIsStaticLocal = 2 + DataIsParam = 3 + DataIsObjectPtr = 4 + DataIsFileStatic = 5 + DataIsGlobal = 6 + DataIsMember = 7 + DataIsStaticMember = 8 + DataIsConstant = 9 + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/impl_details.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/impl_details.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/impl_details.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/impl_details.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,73 @@ +from . import enums +from pygccxml import declarations + +def guess_class_type( udt_kind ): + if enums.UdtKind.UdtStruct == udt_kind: + return declarations.CLASS_TYPES.STRUCT + elif enums.UdtKind.UdtClass == udt_kind: + return declarations.CLASS_TYPES.CLASS + else: + return declarations.CLASS_TYPES.UNION + +class full_name_splitter_t( object ): + def __init__( self, full_name ): + self.__full_name = full_name + self.__identifiers = self.__split_scope_identifiers() + self.__scope_identifiers = None + + @property + def name( self ): + return self.__identifiers[-1] + + @property + def scope_names( self ): + if None is self.__scope_identifiers: + self.__scope_identifiers = []# ['::'] + for i in range( len(self.__identifiers) - 1): + self.__scope_identifiers.append( '::'.join( self.__identifiers[0:i+1] ) ) + return self.__scope_identifiers + + @property + def identifiers( self ): + return self.__identifiers + + def __split_scope_identifiers( self ): + try: + result = [] + tmp = self.__full_name.split( '::' ) + tmp.reverse() + while tmp: + token = tmp.pop() + less_count = token.count( '<' ) + greater_count = token.count( '>' ) + if less_count != greater_count: + while less_count != greater_count and tmp: + next_token = tmp.pop() + token = token + '::' + next_token + less_count += next_token.count( '<' ) + greater_count += next_token.count( '>' ) + result.append( token ) + return result + except Exception, err: + msg = 'Unable to split scope for identifiers. The full scope name is: "%s". Error: %s' + msg = msg % ( self.__full_name, str(err) ) + raise RuntimeError( msg ) + +__name_splitters = {} +def get_name_splitter( full_name ): + try: + return __name_splitters[full_name] + except KeyError: + splitter = full_name_splitter_t( full_name ) + __name_splitters[full_name] = splitter + return splitter + +if '__main__' == __name__: + name = "boost::detail::is_base_and_derived_impl2::Host" + fnsp = full_name_splitter_t( name ) + for x in fnsp.scope_names: + print x + + fnsp = full_name_splitter_t( 'x' ) + for x in fnsp.scope_names: + print x diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/__init__.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/__init__.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/__init__.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,25 @@ +import os +import sys +import ctypes +import pprint +import logging +import comtypes +import comtypes.client + +from . import impl_details + +from ... import utils +from ... import declarations +from .. import config as msvc_cfg + +msdia = comtypes.client.GetModule( msvc_cfg.msdia_path ) + +#~ comtypes_client_gen_dir = comtypes.client.gen_dir +#~ try: + #~ comtypes.client.gen_dir = None + #~ msdia = comtypes.client.GetModule( msvc_cfg.msdia_path ) +#~ finally: + #~ comtypes.client.gen_dir = comtypes_client_gen_dir + +from loader import decl_loader_t + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/kb.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/kb.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/kb.txt 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/kb.txt 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,17 @@ +url: http://www.hightechtalks.com/visual-studio-net-debugging/re-using-dia-sdk-find-360868.html +Q: how to find out member variable offset? +A (By Oleg): +1. Assuming that you have IDiaSymbol interface pointer for the class (UDT) symbol, +use IDiaSymbol::findChildren (with SymTagData as the tag) to lookup the field +with the given name (or all fields). + +2. IDiaSymbol::findChildren will give you IDiaEnumSymbols interface, which you can use +to retrieve IDiaSymbol for the field(s). + +3. Using the field's IDiaSymbol interface, call IDiaSymbol::get_locationType to determine +the location of the field. +If the location is LocIsThisRel, use IDiaSymbol::get_offset to obtain the offset. +If the location is LocIsStatic, use IDiaSymbol::get_addressSection and IDiaSymbol::get_addressOffset, +or IDiaSymbol::get_relativeVirtualAddress, or IDiaSymbol::get_virtualAddress to obtain +the address of the static member. + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/loader.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/loader.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/loader.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/msvc/pdb/loader.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,703 @@ +import os +import re +import pdb +import sys +import ctypes +import pprint +import logging +import comtypes +import itertools +import comtypes.client + +from . import enums +from . import impl_details + +from ... import utils +from ... import declarations +from .. import config as msvc_cfg +from .. import common_utils as msvc_utils + +msdia = comtypes.client.GetModule( msvc_cfg.msdia_path ) + +SymTagEnum = 12 +msdia.SymTagEnum = 12 + +def iif( condition, true_value, false_value ): + if condition: + return true_value + else: + return false_value + +def as_symbol( x ): + return ctypes.cast( x, ctypes.POINTER( msdia.IDiaSymbol ) ) + +def as_table( x ): + return ctypes.cast( x, ctypes.POINTER( msdia.IDiaTable ) ) + +def as_enum_symbols( x ): + return ctypes.cast( x, ctypes.POINTER( msdia.IDiaEnumSymbols ) ) + +def as_enum_variant( x ): + return ctypes.cast( x, ctypes.POINTER( comtypes.automation.IEnumVARIANT ) ) + +def print_files( session ): + files = iter( session.findFile( None, '', 0 ) ) + for f in files: + f = ctypes.cast( f, ctypes.POINTER(msdia.IDiaSourceFile) ) + print 'File: ', f.fileName + +class decl_loader_t(object): + COMPILER = declarations.compilers.MSVC_PDB_9 + def __init__(self, pdb_file_path ): + self.logger = utils.loggers.pdb_reader + self.logger.setLevel(logging.INFO) + self.logger.debug( 'creating DiaSource object' ) + self.__dia_source = comtypes.client.CreateObject( msdia.DiaSource ) + self.logger.debug( 'loading pdb file: %s' % pdb_file_path ) + self.__dia_source.loadDataFromPdb(pdb_file_path) + self.logger.debug( 'opening session' ) + self.__dia_session = self.__dia_source.openSession() + self.logger.debug( 'opening session - done' ) + self.__global_ns = declarations.namespace_t( '::' ) + self.__global_ns.compiler = self.COMPILER + self.__id2decl = {} #cache symIndexId : decl + self.__types_cache = {} #smbl id : type + + def __find_table(self, name): + valid_names = ( 'Symbols', 'SourceFiles', 'Sections' + , 'SegmentMap', 'InjectedSource', 'FrameData' ) + tables = self.__dia_session.getEnumTables() + for table in itertools.imap(as_table, tables): + if name == table.name: + return table + else: + return None + + @utils.cached + def symbols_table(self): + return self.__find_table( "Symbols" ) + + @utils.cached + def symbols(self): + self.logger.info( 'loading symbols from the file' ) + smbls = {} + for smbl in itertools.imap( as_symbol, as_enum_variant( self.symbols_table._NewEnum ) ): + smbl.uname = msvc_utils.undecorate_name( smbl.name, msvc_utils.UNDECORATE_NAME_OPTIONS.UNDNAME_SCOPES_ONLY ) + def smbl_undecorate_name( options = None ): + return msvc_utils.undecorate_name( smbl.name, options ) + smbl.undecorate_name = smbl_undecorate_name + smbls[ smbl.symIndexId ] = smbl + self.logger.info( 'loading symbols(%d) from the file - done', len( smbls ) ) + return smbls + + def __load_nss(self): + def ns_filter( smbl ): + self.logger.debug( '__load_ns.ns_filter, %s', smbl.uname ) + tags = ( msdia.SymTagFunction + , msdia.SymTagBlock + , msdia.SymTagData + #~ , msdia.SymTagAnnotation + #~ , msdia.SymTagPublicSymbol + , msdia.SymTagUDT + , msdia.SymTagEnum + #~ , msdia.SymTagFunctionType + #~ , msdia.SymTagPointerType + , msdia.SymTagArrayType + , msdia.SymTagBaseType + , msdia.SymTagTypedef + , msdia.SymTagBaseClass + , msdia.SymTagFriend + #~ , msdia.SymTagFunctionArgType + #~ , msdia.SymTagUsingNamespace + ) + if smbl.symTag not in tags: + self.logger.debug( 'smbl.symTag not in tags, %s', smbl.uname ) + return False + elif smbl.symTag == msdia.SymTagData and not self.__is_my_var( smbl ): + return False + elif not smbl.name: + self.logger.debug( 'not smbl.name, %s', smbl.uname ) + return False + #~ elif '-' in smbl.name: + #~ self.logger.debug( '"-" in smbl.name, %s', smbl.uname ) + #~ return False + elif smbl.classParent: + parent_smbl = self.symbols[ smbl.classParentId ] + while parent_smbl: + if parent_smbl.symTag == msdia.SymTagUDT: + if parent_smbl.uname in smbl.uname: + #for some reason std::map is reported as parent of std::_Tree, in source code + #std::map derives from std::_Tree. In logical sense parent name is a subset of the child name + self.logger.debug( 'parent_smbl.symTag == msdia.SymTagUDT, %s', parent_smbl.uname ) + return False + else: + return True + else: + parent_smbl = self.symbols[ parent_smbl.classParentId ] + else: + return True + + self.logger.debug( 'scanning symbols table' ) + + self.logger.debug( 'looking for scopes' ) + names = set() + for index, smbl in enumerate( itertools.ifilter( ns_filter, self.symbols.itervalues() ) ): + if index and ( index % 10000 == 0 ): + self.logger.debug( '%d symbols scanned', index ) + name_splitter = impl_details.get_name_splitter( smbl.uname ) + for sn in name_splitter.scope_names: + if '<' in sn: + break + else: + names.add( sn ) + names = list( names ) + names.sort() + self.logger.debug( 'looking for scopes - done' ) + + nss = {'': self.__global_ns} + + self.logger.debug( 'building namespace objects' ) + for ns_name in itertools.ifilterfalse( self.__find_udt, names ): + self.logger.debug( 'inserting ns "%s" into declarations tree', ns_name ) + name_splitter = impl_details.get_name_splitter( ns_name ) + if not name_splitter.scope_names: + parent_ns = self.global_ns + else: + parent_ns = nss.get( name_splitter.scope_names[-1], None ) + if not parent_ns: + continue #in this case the parent scope is UDT + ns_decl = declarations.namespace_t( name_splitter.name ) + ns_decl.compiler = self.COMPILER + ns_decl.mangled = ns_decl.name + ns_decl.demangled = ns_decl.name + parent_ns.adopt_declaration( ns_decl ) + nss[ ns_name ] = ns_decl + self.logger.debug( 'inserting ns "%s" into declarations tree - done', ns_name ) + self.logger.debug( 'building namespace objects - done' ) + + self.logger.debug( 'scanning symbols table - done' ) + + def __update_decls_tree( self, decl ): + #~ if decl.name == 'money_base' and isinstance( decl, declarations.class_t ): + #~ pdb.set_trace() + smbl = decl.dia_symbols[0] + if smbl.classParentId in self.__id2decl: + self.__adopt_declaration( self.__id2decl[smbl.classParentId], decl ) + else: + name_splitter = impl_details.get_name_splitter( smbl.uname ) + if not name_splitter.scope_names: + self.__adopt_declaration( self.global_ns, decl ) + else: + parent_name = '::' + name_splitter.scope_names[-1] + try: + parent = self.global_ns.decl( parent_name ) + except: + declarations.print_declarations( self.global_ns ) + print 'identifiers:' + for index, identifier in enumerate(name_splitter.identifiers): + print index, ':', identifier + raise + self.__adopt_declaration( parent, decl ) + + def __adopt_declaration( self, parent, decl ): + smbl = decl.dia_symbols[0] + already_added = parent.decls( decl.name, decl_type=decl.__class__, recursive=False, allow_empty=True ) + if not already_added: + if isinstance( parent, declarations.namespace_t ): + parent.adopt_declaration( decl ) + else: + parent.adopt_declaration( decl, self.__guess_access_type( smbl ) ) + self.__id2decl[ smbl.symIndexId ] = decl + else: + for other_decl in already_added: + if self.__is_same_smbls( other_decl, decl ): + other_decl.dia_symbols.append( smbl ) + self.__id2decl[ smbl.symIndexId ] = other_decl + return + else: + if isinstance( parent, declarations.namespace_t ): + parent.adopt_declaration( decl ) + else: + parent.adopt_declaration( decl, self.__guess_access_type( smbl ) ) + self.__id2decl[ smbl.symIndexId ] = decl + + def __guess_access_type( self, smbl ): + if enums.CV_access_e.CV_private == smbl.access: + return declarations.ACCESS_TYPES.PRIVATE + elif enums.CV_access_e.CV_protected == smbl.access: + return declarations.ACCESS_TYPES.PROTECTED + else: + fully_undecorated_name = smbl.undecorate_name() + if fully_undecorated_name.startswith( 'private:' ): + declarations.ACCESS_TYPES.PRIVATE + elif fully_undecorated_name.startswith( 'protected:' ): + declarations.ACCESS_TYPES.PROTECTED + else: + return declarations.ACCESS_TYPES.PUBLIC + + class parent_exists_t: + def __init__( self, global_ns, classes, id2decl ): + self.global_ns = global_ns + self.classes = classes + self.id2decl = id2decl + self.__parent_exist = set() + + def __call__( self, decl ): + smbl = decl.dia_symbols[0] + if smbl.classParent: + if smbl.classParentId in self.id2decl: + return True + else: + return False + if self.classes.has_key( smbl.classParentId ): + return False + name_splitter = impl_details.get_name_splitter( smbl.uname ) + if not name_splitter.scope_names: + return True #global namespace + else: + #print "I am here " + '::' + name_splitter.scope_names[-1] + parent_name = '::' + name_splitter.scope_names[-1] + if parent_name in self.__parent_exist: + return True + found = self.global_ns.decls( parent_name + , decl_type=declarations.scopedef_t + , allow_empty=True + , recursive=True ) + if found: + self.__parent_exist.add( parent_name ) + return bool( found ) + + def __clear_symbols(self): + self.logger.info( 'clearing symbols' ) + to_be_deleted = [] + useless_tags = ( + msdia.SymTagAnnotation + , msdia.SymTagPublicSymbol + , msdia.SymTagBlock + , msdia.SymTagFuncDebugStart + , msdia.SymTagFuncDebugEnd + ) + for smbl_id, smbl in self.symbols.iteritems(): + if smbl.symTag in useless_tags \ + or ( smbl.symTag == msdia.SymTagData and not self.__is_my_var( smbl ) ): + to_be_deleted.append( smbl_id ) + + map( lambda smbl_id: self.symbols.pop( smbl_id ), to_be_deleted ) + self.logger.info( 'clearing symbols(%d) - done', len( to_be_deleted ) ) + + + def __normalize_name( self, decl ): + if decl.name == '': + decl.name = '' + elif decl.name.startswith( '?' ): + decl.name = '' + elif isinstance( decl, declarations.namespace_t ) and 'anonymous-namespace' in decl.name: + decl.name = '' + else: + pass + + def __join_unnamed_nss( self, ns_parent ): + child_nss = ns_parent.namespaces( name='', recursive=False, allow_empty=True ) + if len(child_nss) > 1: + alive_ns = child_nss[0] + dead_nss = child_nss[1:] + for dead_ns in dead_nss: + decls = dead_ns.decls( recursive=False, allow_empty=True ) + map( dead_ns.remove_declaration, decls ) + map( alive_ns.adopt_declaration, decls ) + map( ns_parent.remove_declaration, dead_nss ) + map( self.__join_unnamed_nss + , ns_parent.namespaces( recursive=False, allow_empty=True ) ) + + + def read(self): + self.__clear_symbols() + self.__load_nss() + self.__load_classes() + self.__load_base_classes() + self.__load_enums() + self.__load_vars() + self.__load_typedefs() + self.__load_calldefs() + map( self.__normalize_name, self.global_ns.decls(recursive=True) ) + self.__join_unnamed_nss( self.global_ns ) + #join unnamed namespaces + + @property + def dia_global_scope(self): + return self.__dia_session.globalScope + + @property + def global_ns(self): + return self.__global_ns + + def __is_same_smbls( self, decl1, decl2 ): + if not( decl1.__class__ is decl2.__class__ ): + return False + if decl1.name == decl2.name: + if isinstance( decl1, declarations.calldef_t ): + #TODO: well, I will have to fix this someday + return False + else: + return True + else: + return False + #~ return self.__dia_session.symsAreEquiv( decl1.dia_symbols[0], decl2.dia_symbols[0] ) + + def __find_udt( self, name ): + self.logger.debug( 'testing whether name( "%s" ) is UDT symbol' % name ) + flags = enums.NameSearchOptions.nsfCaseSensitive + found = self.dia_global_scope.findChildren( msdia.SymTagUDT, name, flags ) + if found.Count == 1: + self.logger.debug( 'name( "%s" ) is UDT symbol' % name ) + return as_symbol( found.Item(0) ) + elif 1 < found.Count: + raise RuntimeError( "duplicated UDTs with name '%s', were found" % name ) + #~ self.logger.debug( 'name( "%s" ) is UDT symbol' % name ) + #~ return [as_symbol( s ) for s in iter(found)] + #~ for s in iter(found): + #~ s = + #~ print s.name + #~ print impl_details.guess_class_type(s.udtKind) + else: + self.logger.debug( 'name( "%s" ) is **NOT** UDT symbol' % name ) + return None + + def __update_decl( self, decl, smbl ): + decl.dia_symbols = [smbl] + decl.compiler = self.COMPILER + if not isinstance( decl, declarations.typedef_t ): + decl.byte_size = smbl.length + decl.byte_offset = smbl.offset + decl.mangled = iif( smbl.get_undecoratedNameEx(0), smbl.name, '' ) + decl.demangled = iif( smbl.uname, smbl.uname, '' ) + decl.is_artificial = bool( smbl.compilerGenerated ) + decl.location = declarations.location_t( smbl.lexicalParent.sourceFileName ) + + + def __load_classes( self ): + classes = {}#unique symbol id : class decl + is_udt = lambda smbl: smbl.symTag == msdia.SymTagUDT + self.logger.info( 'building udt objects' ) + for udt_smbl in itertools.ifilter( is_udt, self.symbols.itervalues() ): + classes[udt_smbl.symIndexId] = self.__create_class(udt_smbl) + self.logger.info( 'building udt objects(%d) - done', len(classes) ) + + self.logger.info( 'integrating udt objects with namespaces' ) + does_parent_exists = self.parent_exists_t( self.global_ns, classes, self.__id2decl ) + while classes: + to_be_integrated = len( classes ) + self.logger.info( 'there are %d classes to go', len( classes ) ) + to_be_deleted = filter( does_parent_exists, classes.itervalues() ) + map( self.__update_decls_tree, to_be_deleted ) + map( lambda decl: classes.pop( decl.dia_symbols[0].symIndexId ) + , to_be_deleted ) + if not ( to_be_integrated - len( classes ) ): + for cls in classes.itervalues(): + self.logger.warning( 'unable to integrate class "%s" into declarations tree', cls.dia_symbols[0].uname ) + break + self.logger.info( 'integrating udt objects with namespaces - done' ) + + def __load_base_classes( self ): + make_hi = declarations.hierarchy_info_t + is_base_class = lambda smbl: smbl.symTag == msdia.SymTagBaseClass \ + and False == smbl.indirectVirtualBaseClass + self.logger.info( 'building class hierarchies' ) + for count, smbl in enumerate( itertools.ifilter( is_base_class, self.symbols.itervalues() ) ): + base_id = smbl.type.symIndexId + derived_id = smbl.classParentId + + hi_base = make_hi( self.__id2decl[base_id] + , self.__guess_access_type( smbl ) + , bool( smbl.virtualBaseClass ) ) + self.__id2decl[ derived_id ].bases.append( hi_base ) + + hi_derived = make_hi( self.__id2decl[derived_id] + , self.__guess_access_type( smbl ) + , bool( smbl.virtualBaseClass ) ) + self.__id2decl[ base_id ].derived.append( hi_derived ) + + self.logger.info( 'building class hierarchies(%d) - done', count ) + + def __load_enums( self ): + is_enum = lambda smbl: smbl.symTag == msdia.SymTagEnum + self.logger.info( 'building enum objects' ) + for enums_count, enum_smbl in enumerate( itertools.ifilter( is_enum, self.symbols.itervalues() ) ): + enum_decl = self.__create_enum(enum_smbl) + if not enum_decl: + continue + self.__update_decls_tree( enum_decl ) + self.logger.info( 'building enum objects(%d) - done', enums_count ) + + def __create_enum( self, enum_smbl ): + name_splitter = impl_details.get_name_splitter( enum_smbl.uname ) + self.logger.debug( 'working on enum %s', enum_smbl.uname ) + enum_decl = declarations.enumeration_t( name_splitter.name ) + self.__update_decl( enum_decl, enum_smbl ) + + values = enum_smbl.findChildren( msdia.SymTagData, None, 0 ) + for v in itertools.imap(as_symbol, values): + if v.classParent.symIndexId != enum_smbl.symIndexId: + continue + enum_decl.append_value( v.name, v.value ) + if enum_decl.values: + return enum_decl + else: + #for some reason same enum could appear under global namespace and + #under the class, it was defined in. This is a criteria I use to distinguish + #between those cases + return None + + def __create_class( self, class_smbl ): + name_splitter = impl_details.get_name_splitter( class_smbl.uname ) + class_decl = declarations.class_t( name_splitter.name ) + self.__update_decl( class_decl, class_smbl ) + class_decl.class_type = impl_details.guess_class_type(class_smbl.udtKind) + return class_decl + + def __is_my_var( self, smbl ): + #I am only interested in global and class variables + if smbl.symTag != msdia.SymTagData: + return False + if not smbl.uname: + return False + if smbl.classParentId not in self.symbols: + return True #global scope + parent_smbl = self.symbols[ smbl.classParentId ] + return bool( parent_smbl.symTag == msdia.SymTagUDT ) + + def __load_vars( self ): + self.logger.info( 'building variable objects' ) + + for vars_count, var_smbl in enumerate( itertools.ifilter( self.__is_my_var, self.symbols.itervalues() ) ): + var_decl = self.__create_var(var_smbl) + if var_decl: + self.__update_decls_tree( var_decl ) + self.logger.info( 'building variable objects(%d) - done', vars_count ) + + def __create_var( self, smbl ): + self.logger.debug( 'creating variable "%s"', smbl.uname ) + name_splitter = impl_details.get_name_splitter( smbl.uname ) + decl = declarations.variable_t( name_splitter.name ) + self.__update_decl( decl, smbl ) + decl.type = self.create_type( smbl.type ) + decl.value = str(smbl.value) + self.logger.debug( 'creating variable "%s" - done', smbl.uname ) + return decl + + def __load_typedefs( self ): + self.logger.info( 'building typedef objects' ) + is_typedef = lambda smbl: smbl.symTag == msdia.SymTagTypedef + for typedefs_count, typedef_smbl in enumerate( itertools.ifilter( is_typedef, self.symbols.itervalues() ) ): + typedef_decl = self.__create_typedef(typedef_smbl) + self.__update_decls_tree( typedef_decl ) + self.logger.info( 'building typedef objects(%d) - done', typedefs_count ) + + def __create_typedef( self, smbl ): + self.logger.debug( 'creating typedef "%s"', smbl.uname ) + name_splitter = impl_details.get_name_splitter( smbl.uname ) + decl = declarations.typedef_t( name_splitter.name + , self.create_type( smbl.type ) ) + self.__update_decl( decl, smbl ) + self.logger.debug( 'creating typedef "%s" - done', smbl.uname ) + return decl + + def __load_calldefs( self ): + self.logger.info( 'building function objects' ) + is_function = lambda smbl: smbl.symTag == msdia.SymTagFunction + for functions_count, function_smbl in enumerate( itertools.ifilter( is_function, self.symbols.itervalues() ) ): + function_decl = self.__create_calldef(function_smbl) + if function_decl: + self.__update_decls_tree( function_decl ) + self.logger.info( 'building function objects(%d) - done', functions_count ) + + def __guess_operator_type( self, smbl, operator_type ): + #assumption: the code deals with correct code + if not smbl.uname.startswith( 'operator' ) or smbl.uname == 'operator': + return None + oper_smbls = ('!', ' ', '*', '%', '&', '(', '+', '-', ',', '/', '|', '~', '[', '^', '=', '<') + if smbl.uname[ len( 'operator' ) ] not in oper_smbls: + return None + if smbl.uname[ len( 'operator' ) ] == ' ' \ + and smbl.uname not in ['operator new', 'operator delete']: + #we have casting operator + return declarations.casting_operator_t() + if isinstance( operator_type, declarations.member_function_type_t ): + return declarations.member_operator_t() + else: + return declarations.free_operator_t() + + def __guess_constructor( self, smbl, calldef_type ): + tmpls = declarations.templates + class_ = declarations.remove_declarated( calldef_type.class_inst ) + if class_.name == smbl.uname \ + or ( tmpls.is_instantiation( class_.name ) + and tmpls.name( class_.name ) == smbl.uname ): + calldef_type.return_type = None + return declarations.constructor_t() + + def __create_calldef( self, smbl ): + self.logger.debug( 'creating calldef "%s"', smbl.uname ) + #~ if smbl.uname == 'some_function': + #~ pdb.set_trace() + name_splitter = impl_details.get_name_splitter( smbl.uname ) + calldef_type = self.create_type( smbl.type ) #what does happen with constructor? + decl = None + if isinstance( calldef_type, declarations.member_function_type_t ): + could_be_static = False + could_be_const = False + if smbl.uname.startswith( '~' ): + decl = declarations.destructor_t() + if not decl: #may be operator + decl = self.__guess_operator_type(smbl, calldef_type) + could_be_static = True + could_be_const = True + if not decl: #may be constructor + decl = self.__guess_constructor( smbl, calldef_type ) + if not decl: + decl = declarations.member_function_t() + could_be_static = True + could_be_const = True + if smbl.virtual: + decl.virtuality = iif( smbl.pure + , declarations.VIRTUALITY_TYPES.PURE_VIRTUAL + , declarations.VIRTUALITY_TYPES.VIRTUAL ) + decl.has_const = bool( could_be_const and smbl.constType ) + decl.has_static = bool( could_be_static and smbl.isStatic ) + else: + decl = self.__guess_operator_type(smbl, calldef_type) + if not decl: + if 'instantiate::`dynamic initializer for' in smbl.uname: + return #in this case we deal with initializer of some global variable + decl = declarations.free_function_t() + decl.name = smbl.uname + decl.arguments = map( lambda t: declarations.argument_t( type=t ) + , calldef_type.arguments_types ) + + args_smbls = map( as_symbol, smbl.findChildren( msdia.SymTagData, None, 0 ) ) + args_smbls = filter( lambda smbl: smbl.dataKind == enums.DataKind.DataIsParam, args_smbls ) + + for index, arg_smbl in enumerate( args_smbls ): + arg_decl = decl.arguments[index] + arg_decl.name = arg_smbl.name + arg_decl.default_value = arg_smbl.value + decl.return_type = calldef_type.return_type + + self.__update_decl( decl, smbl ) + self.logger.debug( 'creating calldef "%s" - done', smbl.uname ) + return decl + + def __create_function_type( self, smbl ): + return_type = self.create_type( smbl.type ) + args_smbls = smbl.findChildren( msdia.SymTagFunctionArgType, None, 0 ) + args_types = map( self.create_type, itertools.imap(as_symbol, args_smbls) ) + if smbl.objectPointerType: + try: + class_ = self.create_type( smbl.objectPointerType ) + class_ = declarations.base_type( class_ ) + #~ pdb.set_trace() + return declarations.member_function_type_t( class_, return_type, args_types ) + except: + self.logger.warning( 'unable to find out the type of the object pointer for a class method.' ) + return declarations.unknown_t() + else: + return declarations.free_function_type_t( return_type, args_types ) + + def create_type( self, smbl ): + #http://msdn2.microsoft.com/en-us/library/s3f49ktz(VS.80).aspx + if smbl.symIndexId in self.__types_cache: + return self.__types_cache[smbl.symIndexId] + my_type = None + if msdia.SymTagBaseType == smbl.symTag: + if enums.BasicType.btNoType == smbl.baseType: + my_type = declarations.unknown_t() + elif enums.BasicType.btVoid == smbl.baseType: + my_type = declarations.void_t() + elif enums.BasicType.btChar == smbl.baseType: + my_type = declarations.char_t() + elif enums.BasicType.btWChar == smbl.baseType: + my_type = declarations.wchar_t() + elif smbl.baseType in ( enums.BasicType.btInt, enums.BasicType.btLong ): + if 8 == smbl.length: + my_type = declarations.long_long_int_t() + elif 4 == smbl.length: + my_type = declarations.int_t() #long_int_t + elif 2 == smbl.length: + my_type = declarations.short_int_t() + else: + my_type = declarations.int_t() + elif enums.BasicType.btUInt == smbl.baseType: + if 2 == smbl.length: + my_type = declarations.short_unsigned_int_t() + else: + my_type = declarations.unsigned_int_t() + elif enums.BasicType.btFloat == smbl.baseType: + if 8 == smbl.length: + my_type = declarations.double_t() + else: + my_type = declarations.float_t() + elif enums.BasicType.btBCD == smbl.baseType: + my_type = declarations.unknown_t() + elif enums.BasicType.btBool == smbl.baseType: + my_type = declarations.bool_t() + elif enums.BasicType.btULong == smbl.baseType: + if 8 == smbl.length: + my_type = declarations.long_long_unsigned_int_t() + else: + my_type = declarations.long_unsigned_int_t() + elif enums.BasicType.btCurrency == smbl.baseType: + my_type = declarations.unknown_t() + elif enums.BasicType.btDate == smbl.baseType: + my_type = declarations.double_t() + elif enums.BasicType.btVariant == smbl.baseType: + my_type = declarations.unknown_t() + elif enums.BasicType.btComplex == smbl.baseType: + my_type = declarations.complex_double_t() + elif enums.BasicType.btBit == smbl.baseType: + my_type = declarations.unknown_t() + elif enums.BasicType.btBSTR == smbl.baseType: + my_type = declarations.unknown_t() + elif enums.BasicType.btHresult == smbl.baseType: + my_type = declarations.long_int_t() + else: + my_type = declarations.unknown_t() + elif msdia.SymTagPointerType == smbl.symTag: + base_type = self.create_type( smbl.type ) + if smbl.reference: + my_type = declarations.reference_t( base_type ) + else: + my_type = declarations.pointer_t( base_type ) + elif msdia.SymTagArrayType == smbl.symTag: + element_type = self.create_type( smbl.type ) + size = declarations.array_t.SIZE_UNKNOWN + if smbl.count: + size = smbl.count + #~ if smbl.length and element_type.byte_size: + #~ size = smbl.length / element_type.byte_size + my_type = declarations.array_t( element_type, size ) + elif smbl.symTag in ( msdia.SymTagUDT, msdia.SymTagTypedef, msdia.SymTagEnum ): + if smbl.symIndexId in self.__id2decl: + decl = self.__id2decl[ smbl.symIndexId ] + my_type = declarations.declarated_t( decl ) + else: + my_type = declarations.unknown_t() + elif msdia.SymTagFunctionArgType == smbl.symTag: + my_type = self.create_type( smbl.type ) + elif msdia.SymTagFunctionType == smbl.symTag: + my_type = self.__create_function_type( smbl ) + else: + my_type = declarations.unknown_t() + try: + my_type.byte_size = smbl.length + except AttributeError: + pass + if smbl.constType: + if isinstance( my_type, declarations.member_function_type_t ): + my_type.has_const = True + else: + if not isinstance( my_type, declarations.const_t ): + my_type = declarations.const_t( my_type ) + if smbl.volatileType: + if not isinstance( my_type, declarations.volatile_t ): + my_type = declarations.volatile_t( my_type ) + return my_type diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/config.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/config.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/config.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/config.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,191 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""This module contains the implementation of the L{config_t} class. +""" + +import os +import sys +import copy + +class parser_configuration_t(object): + """Configuration object to collect parameters for invoking C++ parser + + This class serves as a base class for the parameters that can be used + to customize the call to C++ parser. This class also allows users to work with + relative files paths. In this case files are searched in the following order: + + 1. current directory + + 2. working directory + + 3. additional include paths specified by the user + + """ + def __init__( self + , working_directory='.' + , include_paths=None + , define_symbols=None + , undefine_symbols=None + , cflags="" + , compiler=None): + """Constructor. + """ + object.__init__( self ) + self.__working_directory = working_directory + + if not include_paths: + include_paths = [] + self.__include_paths = include_paths + + if not define_symbols: + define_symbols = [] + self.__define_symbols = define_symbols + + if not undefine_symbols: + undefine_symbols = [] + self.__undefine_symbols = undefine_symbols + + self.__cflags = cflags + + self.__compiler = compiler + + def clone(self): + raise NotImplementedError( self.__class__.__name__ ) + + def __get_working_directory(self): + return self.__working_directory + def __set_working_directory(self, working_dir): + self.__working_directory=working_dir + working_directory = property( __get_working_directory, __set_working_directory ) + + @property + def include_paths(self): + """list of include paths to look for header files""" + return self.__include_paths + + @property + def define_symbols(self): + """list of "define" directives """ + return self.__define_symbols + + @property + def undefine_symbols(self): + """list of "undefine" directives """ + return self.__undefine_symbols + + @property + def compiler(self): + """compiler name to simulate""" + return self.__compiler + + def __get_cflags(self): + return self.__cflags + def __set_cflags(self, val): + self.__cflags = val + cflags = property( __get_cflags, __set_cflags + , doc="additional flags to pass to compiler" ) + + def __ensure_dir_exists( self, dir_path, meaning ): + if os.path.isdir( dir_path ): + return + msg = None + if os.path.exists( self.working_directory ): + raise RuntimeError( '%s("%s") does not exist!' % ( meaning, dir_path ) ) + else: + raise RuntimeError( '%s("%s") should be "directory", not a file.' % ( meaning, dir_path ) ) + + + def raise_on_wrong_settings( self ): + """validates the configuration settings and raises RuntimeError on error""" + self.__ensure_dir_exists( self.working_directory, 'working directory' ) + map( lambda idir: self.__ensure_dir_exists( idir, 'include directory' ) + , self.include_paths ) + + +class gccxml_configuration_t(parser_configuration_t): + """Configuration object to collect parameters for invoking gccxml. + + This class serves as a container for the parameters that can be used + to customize the call to gccxml. + """ + def __init__( self + , gccxml_path='' + , working_directory='.' + , include_paths=None + , define_symbols=None + , undefine_symbols=None + , start_with_declarations=None + , ignore_gccxml_output=False + , cflags="" + , compiler=None): + """Constructor. + """ + parser_configuration_t.__init__( self + , working_directory=working_directory + , include_paths=include_paths + , define_symbols=define_symbols + , undefine_symbols=undefine_symbols + , cflags=cflags + , compiler=compiler) + + self.__gccxml_path = gccxml_path + + if not start_with_declarations: + start_with_declarations = [] + self.__start_with_declarations = start_with_declarations + + self.__ignore_gccxml_output = ignore_gccxml_output + + def clone(self): + return copy.deepcopy( self ) + + def __get_gccxml_path(self): + return self.__gccxml_path + def __set_gccxml_path(self, new_path ): + self.__gccxml_path = new_path + gccxml_path = property( __get_gccxml_path, __set_gccxml_path + , doc="gccxml binary location" ) + + @property + def start_with_declarations(self): + """list of declarations gccxml should start with, when it dumps declaration tree""" + return self.__start_with_declarations + + def __get_ignore_gccxml_output(self): + return self.__ignore_gccxml_output + def __set_ignore_gccxml_output(self, val=True): + self.__ignore_gccxml_output = val + ignore_gccxml_output = property( __get_ignore_gccxml_output, __set_ignore_gccxml_output + , doc="set this property to True, if you want pygccxml to ignore any error\\warning that comes from gccxml" ) + + + def raise_on_wrong_settings( self ): + super( gccxml_configuration_t, self ).raise_on_wrong_settings() + if os.path.isfile( self.gccxml_path ): + return + if sys.platform == 'win32': + gccxml_name = 'gccxml' + '.exe' + environment_var_delimiter = ';' + elif sys.platform == 'linux2' or sys.platform == 'darwin': + gccxml_name = 'gccxml' + environment_var_delimiter = ':' + else: + raise RuntimeError( 'unable to find out location of gccxml' ) + may_be_gccxml = os.path.join( self.gccxml_path, gccxml_name ) + if os.path.isfile( may_be_gccxml ): + self.gccxml_path = may_be_gccxml + else: + for path in os.environ['PATH'].split( environment_var_delimiter ): + gccxml_path = os.path.join( path, gccxml_name ) + if os.path.isfile( gccxml_path ): + self.gccxml_path = gccxml_path + break + else: + msg = 'gccxml_path("%s") should exists or to be a valid file name.' \ + % self.gccxml_path + raise RuntimeError( msg ) + +config_t = gccxml_configuration_t #backward computability diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/declarations_cache.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/declarations_cache.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/declarations_cache.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/declarations_cache.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,237 @@ +#! /usr/bin/python +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import md5 +import time +import cPickle +from pygccxml import utils +import config as cxx_parsers_cfg + +def file_signature( filename ): + if not os.path.isfile( filename ): + return None + if not os.path.exists( filename ): + return None + # Extend here to use md5 hash for signature + # - This change allows duplicate autogenerated files to be recognized + #return os.path.getmtime( source ) + sig = md5.new() + f = file(filename,'r') + sig.update(f.read()) + f.close() + return sig.hexdigest() + +def configuration_signature( config ): + """ Return a signature for a configuration (config_t) + object. This can then be used as a key in the cache. + This method must take into account anything about + a configuration that could cause the declarations generated + to be different between runs. + """ + sig = md5.new() + if isinstance( config, cxx_parsers_cfg.gccxml_configuration_t ): + sig.update(str(config.gccxml_path)) + sig.update(str(config.working_directory)) + if isinstance( config, cxx_parsers_cfg.gccxml_configuration_t ): + sig.update(str(config.cflags)) + for p in config.include_paths: + sig.update(str(p)) + for s in config.define_symbols: + sig.update(str(s)) + for u in config.undefine_symbols: + sig.update(str(u)) + return sig.hexdigest() + +class cache_base_t( object ): + logger = utils.loggers.declarations_cache + + def __init__( self ): + object.__init__(self) + + def flush(self): + """ Flush (write out) the cache to disk if needed. """ + raise NotImplementedError() + + def update(self, source_file, configuration, declarations, included_files): + """ Update cache entry. + @param source_file: path to the C++ source file being parsed + @param configuration: configuration used in parsing (config_t) + @param declarations: declaration tree found when parsing + @param included_files: files included by parsing. + """ + raise NotImplementedError() + + def cached_value(self, source_file, configuration): + """ Return declarations we have cached for the source_file and configuration + given. + @param source_file: path to the C++ source file being parsed. + @param configuration: configuration to use for parsing (config_t) + """ + raise NotImplementedError() + +class record_t( object ): + def __init__( self + , source_signature + , config_signature + , included_files + , included_files_signature + , declarations ): + self.__source_signature = source_signature + self.__config_signature = config_signature + self.__included_files = included_files + self.__included_files_signature = included_files_signature + self.__declarations = declarations + self.__was_hit = True # Track if there was a cache hit + + def _get_was_hit(self): + return self.__was_hit + def _set_was_hit(self, was_hit): + self.__was_hit = was_hit + was_hit = property( _get_was_hit, _set_was_hit ) + + def key(self): + return ( self.__source_signature, self.__config_signature) + + @staticmethod + def create_key( source_file, configuration ): + return ( file_signature(source_file) + , configuration_signature(configuration)) + + def __source_signature(self): + return self.__source_signature + source_signature = property( __source_signature ) + + def __config_signature(self): + return self.__config_signature + config_signature = property( __config_signature ) + + def __included_files(self): + return self.__included_files + included_files = property( __included_files ) + + def __included_files_signature(self): + return self.__included_files_signature + included_files_signature = property( __included_files_signature ) + + def __declarations(self): + return self.__declarations + declarations = property( __declarations ) + +class file_cache_t( cache_base_t ): + """ Cache implementation to store data in a pickled form in a file. + This class contains some cache logic that keeps track of which entries + have been 'hit' in the cache and if an entry has not been hit then + it is deleted at the time of the flush(). This keeps the cache from + growing larger when files change and are not used again. + """ + + def __init__( self, name ): + """ + @param name: name of the cache file. + """ + cache_base_t.__init__( self ) + self.__name = name # Name of cache file + self.__cache = self.__load( self.__name ) # Map record_key to record_t + self.__needs_flushed = not bool( self.__cache ) # If empty then we need to flush + for entry in self.__cache.itervalues(): # Clear hit flags + entry.was_hit = False + + @staticmethod + def __load( file_name ): + " Load pickled cache from file and return the object. " + cache = None + if os.path.exists( file_name ) and not os.path.isfile( file_name ): + raise RuntimeError( 'Cache should be initialized with valid full file name' ) + if not os.path.exists( file_name ): + file( file_name, 'w+b' ).close() + return {} + cache_file_obj = file( file_name, 'rb' ) + try: + file_cache_t.logger.info( 'Loading cache file "%s".' % file_name ) + start_time = time.clock() + cache = cPickle.load( cache_file_obj ) + file_cache_t.logger.debug( "Cache file has been loaded in %.1f secs"%( time.clock() - start_time ) ) + file_cache_t.logger.debug( "Found cache in file: [%s] entries: %s" + % ( file_name, len( cache.keys() ) ) ) + except Exception, error: + file_cache_t.logger.exception( "Error occured while reading cache file: %s", error ) + cache_file_obj.close() + file_cache_t.logger.info( "Invalid cache file: [%s] Regenerating." % file_name ) + file(file_name, 'w+b').close() # Create empty file + cache = {} # Empty cache + return cache + + def flush(self): + # If not marked as needing flushed, then return immediately + if not self.__needs_flushed: + self.logger.debug("Cache did not change, ignoring flush.") + return + + # Remove entries that did not get a cache hit + num_removed = 0 + for key in self.__cache.keys(): + if not self.__cache[key].was_hit: + num_removed += 1 + del self.__cache[key] + if num_removed > 0: + self.logger.debug( "There are %s removed entries from cache." % num_removed ) + # Save out the cache to disk + cache_file = file( self.__name, 'w+b' ) + cPickle.dump( self.__cache, cache_file, cPickle.HIGHEST_PROTOCOL ) + cache_file.close() + + def update(self, source_file, configuration, declarations, included_files): + """ Update a cached record with the current key and value contents. """ + record = record_t( source_signature=file_signature(source_file) + , config_signature=configuration_signature(configuration) + , included_files=included_files + , included_files_signature=map( file_signature, included_files) + , declarations=declarations + ) + # Switched over to holding full record in cache so we don't have + # to keep creating records in the next method. + self.__cache[ record.key() ] = record + self.__cache[ record.key() ].was_hit = True + self.__needs_flushed = True + + def cached_value(self, source_file, configuration): + """ Attempt to lookup the cached decls for the given file and configuration. + If not found or signature check fails, returns None. + """ + key = record_t.create_key(source_file, configuration) + if not self.__cache.has_key( key ): + return None + record = self.__cache[key] + if self.__is_valid_signature( record ): + record.was_hit = True # Record cache hit + return record.declarations + else: #some file has been changed + del self.__cache[key] + return None + + def __is_valid_signature( self, record ): + # This is now part of key + #if self.__signature( record.source_file ) != record.source_file_signature: + # return False + for index, included_file in enumerate( record.included_files ): + if file_signature( included_file ) != record.included_files_signature[index]: + return False + return True + + +class dummy_cache_t( cache_base_t ): + def __init__( self ): + cache_base_t.__init__(self) + + def flush(self): + pass + + def update(self, source_file, configuration, declarations, included_files): + pass + + def cached_value(self, source_file, configuration): + return None \ No newline at end of file diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/directory_cache.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/directory_cache.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/directory_cache.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/directory_cache.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,528 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) +# +# The initial version of the directory_cache_t class was written +# by Matthias Baas (baas@ira.uka.de). + +"""Directory cache implementation. + +This module contains the implementation of a cache that uses individual +files stored in a dedicated cache directory to store the cached contents. +The cache class is L{directory_cache_t} which can be passed to the C{cache} +argument of the L{parse()} function. +""" + +import os, os.path, gzip, md5 +import cPickle +import declarations_cache + +class index_entry_t: + """Entry of the index table in the directory cache index. + + Each cached header file (i.e. each *.cache file) has a corresponding + index_entry_t object. This object is used to determine whether the + cache file with the declarations is still valid or not. + + This class is a helper class for the directory_cache_t class. + """ + + def __init__( self, filesigs, configsig ): + """Constructor. + + filesigs is a list of tuples (fileid, sig)... + configsig is the signature of the configuration object. + """ + self.filesigs = filesigs + self.configsig = configsig + + def __getstate__(self): + return (self.filesigs, self.configsig) + + def __setstate__(self, state): + self.filesigs, self.configsig = state + + +class directory_cache_t ( declarations_cache.cache_base_t ): + """Cache class that stores its data as multiple files inside a directory. + + The cache stores one index file called "index.dat" which is always + read by the cache when the cache object is created. Each header file + will have its corresponding *.cache file that stores the declarations + found in the header file. The index file is used to determine whether + a *.cache file is still valid or not (by checking if one of the dependent + files (i.e. the header file itself and all included files) have been + modified since the last run). + """ + + def __init__( self, dir="cache", compression=False, md5_sigs=True ): + """Constructor. + + dir is the cache directory (it is created if it does not exist). + If compression is set to True the cache files will be compressed + using gzip. + md5_sigs determines whether file modifications is checked by + computing a md5 digest or by checking the modification date. + """ + declarations_cache.cache_base_t.__init__(self) + + # Cache directory + self.__dir = os.path.abspath(dir) + + # Flag that determines whether the cache files will be compressed + self.__compression = compression + + # Flag that determines whether the signature is a md5 digest or + # the modification time + # (this flag is passed to the filename_repository_t class) + self.__md5_sigs = md5_sigs + + # Filename repository + self.__filename_rep = filename_repository_t(self.__md5_sigs) + + # Index dictionary (Key is the value returned by _create_cache_key() + # (which is based on the header file name) and value is an + # index_entry_t object) + self.__index = {} + + # Flag that indicates whether the index was modified + self.__modified_flag = False + + # Check if dir refers to an existing file... + if os.path.isfile(self.__dir): + raise ValueError, "Cannot use %s as cache directory. There is already a file with that name."%self.__dir + + # Load the cache or create the cache directory... + if os.path.isdir(self.__dir): + self._load() + else: + # Create the cache directory... + os.mkdir(self.__dir) + + def flush(self): + """Save the index table to disk.""" + + self._save() +# self.__filename_rep._dump() + + def update(self, source_file, configuration, declarations, included_files): + """Replace a cache entry by a new value. + + @param source_file: Header file name. + @type source_file: str + @param configuration: Configuration object. + @type configuration: L{config_t} + @param declarations: Declarations contained in the header file. + @type declarations: picklable object + @param included_files: Dependent files + @type included_files: list of str + """ + # Normlize all paths... + source_file = os.path.normpath(source_file) + included_files = map(lambda p: os.path.normpath(p), included_files) + + # Create the list of dependent files. This is the included_files list + # + the source file. Duplicate names are removed. + dependent_files = {} + for name in [source_file]+included_files: + dependent_files[name] = 1 + dependent_files = dependent_files.keys() + + key = self._create_cache_key(source_file) + # Remove an existing entry (if there is one) + # After calling this method, it is guaranteed that __index[key] + # does not exist anymore. + self._remove_entry(source_file, key) + + # Create a new entry... + + # Create the sigs of all dependent files... + filesigs = [] + for filename in dependent_files: + id_,sig = self.__filename_rep.acquire_filename(filename) + filesigs.append((id_,sig)) + + configsig = self._create_config_signature(configuration) + entry = index_entry_t(filesigs, configsig) + self.__index[key] = entry + self.__modified_flag = True + + # Write the declarations into the cache file... + cachefilename = self._create_cache_filename(source_file) + self._write_file(cachefilename, declarations) + + + def cached_value(self, source_file, configuration): + """Return the cached declarations or None. + + @param source_file: Header file name + @type source_file: str + @param configuration: Configuration object + @type configuration: L{config_t} + @return: Cached declarations or None + """ + + # Check if the cache contains an entry for source_file + key = self._create_cache_key(source_file) + entry = self.__index.get(key) + if entry==None: +# print "CACHE: %s: Not cached"%source_file + return None + + # Check if the entry is still valid. It is not valid if: + # - the source_file has been updated + # - the configuration object has changed (i.e. the header is parsed + # by gccxml with different settings which may influence the + # declarations) + # - the included files have been updated + # (this list is part of the cache entry as it cannot be known + # by the caller when cached_value() is called. It was instead + # passed to update()) + + # Check if the config is different... + configsig = self._create_config_signature(configuration) + if configsig!=entry.configsig: +# print "CACHE: %s: Config mismatch"%source_file + return None + + # Check if any of the dependent files has been modified... + for id_, sig in entry.filesigs: + if self.__filename_rep.is_file_modified(id_, sig): +# print "CACHE: %s: Entry not up to date"%source_file + return None + + # Load and return the cached declarations + cachefilename = self._create_cache_filename(source_file) + decls = self._read_file(cachefilename) + +# print "CACHE: Using cached decls for",source_file + return decls + + def _load(self): + """Load the cache. + + Loads the file index.dat which contains the index table and + the file name repository. + + This method is called by the constructor. + """ + + indexfilename = os.path.join(self.__dir, "index.dat") + if os.path.exists(indexfilename): + data = self._read_file(indexfilename) + self.__index = data[0] + self.__filename_rep = data[1] + if self.__filename_rep._md5_sigs!=self.__md5_sigs: + print "CACHE: Warning: md5_sigs stored in the cache is set to %s."%self.__filename_rep._md5_sigs + print " Please remove the cache to change this setting." + self.__md5_sigs = self.__filename_rep._md5_sigs + else: + self.__index = {} + self.__filename_rep = filename_repository_t(self.__md5_sigs) + + self.__modified_flag = False + + def _save(self): + """Save the cache index if it was modified. + + Saves the index table and the file name repository in the file + index.dat. + """ + if self.__modified_flag: + self.__filename_rep.update_id_counter() + indexfilename = os.path.join(self.__dir, "index.dat") + self._write_file(indexfilename, (self.__index,self.__filename_rep)) + self.__modified_flag = False + + def _read_file(self, filename): + """Read a Python object from a cache file. + + Reads a pickled object from disk and returns it. + + @param filename: Name of the file that should be read. + @type filename: str + @returns: Unpickled file contents + """ + if self.__compression: + f = gzip.GzipFile(filename, "rb") + else: + f = file(filename, "rb") + res = cPickle.load(f) + f.close() + return res + + def _write_file(self, filename, data): + """Write a data item into a file. + + The data object is written to a file using the pickle mechanism. + + @param filename: Output file name + @type filename: str + @param data: A Python object that will be pickled + @type data: picklable object + """ + if self.__compression: + f = gzip.GzipFile(filename, "wb") + else: + f = file(filename, "wb") + cPickle.dump(data, f, cPickle.HIGHEST_PROTOCOL) + f.close() + + def _remove_entry(self, source_file, key): + """Remove an entry from the cache. + + source_file is the name of the header and key is its corresponding + cache key (obtained by a call to L{_create_cache_key()}). + The entry is removed from the index table, any referenced file + name is released and the cache file is deleted. + + If key references a non-existing entry, the method returns + immediately. + + @param source_file: Header file name + @type source_file: str + @param key: Key value for the specified header file + @type key: hashable object + """ + + entry = self.__index.get(key) + if entry==None: + return + + # Release the referenced files... + for id_, sig in entry.filesigs: + self.__filename_rep.release_filename(id_) + + # Remove the cache entry... + del self.__index[key] + self.__modified_flag = True + + # Delete the corresponding cache file... + cachefilename = self._create_cache_filename(source_file) + try: + os.remove(cachefilename) + except OSError, e: + print "Could not remove cache file (%s)"%e + + + def _create_cache_key(self, source_file): + """Return the cache key for a header file. + + @param source_file: Header file name + @type source_file: str + @returns: Key for the given header file + @rtype: str + """ + path, name = os.path.split(source_file) + return name+str(hash(path)) + + def _create_cache_filename(self, source_file): + """Return the cache file name for a header file. + + @param source_file: Header file name + @type source_file: str + @returns: Cache file name (*.cache) + @rtype: str + """ + res = self._create_cache_key(source_file)+".cache" + return os.path.join(self.__dir, res) + + def _create_config_signature(self, config): + """Return the signature for a config object. + + The signature is computed as md5 digest of the contents of + working_directory, include_paths, define_symbols and + undefine_symbols. + + @param config: Configuration object + @type config: L{config_t} + @returns: Signature + @rtype: str + """ + m = md5.new() + m.update(config.working_directory) + map(lambda p: m.update(p), config.include_paths) + map(lambda p: m.update(p), config.define_symbols) + map(lambda p: m.update(p), config.undefine_symbols) + map(lambda p: m.update(p), config.cflags) + return m.digest() + + + + +class filename_entry_t: + """This is a record stored in the filename_repository_t class. + + The class is an internal class used in the implementation of the + filename_repository_t class and it just serves as a container for + the file name and the reference count. + """ + + def __init__( self, filename ): + """Constructor. + + The reference count is initially set to 0. + """ + # Filename + self.filename = filename + # Reference count + self.refcount = 0 + + # Cached signature value for the file. + # If sig_valid flag is False, the signature still has to be computed, + # otherwise the cached value can be used. + # These attributes must not be pickled! + self.sig_valid = False + self.signature = None + + def __getstate__(self): + # Only pickle filename and refcount + return (self.filename, self.refcount) + + def __setstate__(self, state): + self.filename, self.refcount = state + self.sig_valid = False + self.signature = None + + def inc_ref_count(self): + """Increase the reference count by 1.""" + self.refcount += 1 + + def dec_ref_count(self): + """Decrease the reference count by 1 and return the new count.""" + self.refcount -= 1 + return self.refcount + + +class filename_repository_t: + """File name repository. + + This class stores file names and can check whether a file has been + modified or not since a previous call. + A file name is stored by calling acquire_filename() which returns + an ID and a signature of the file. The signature can later be used + to check if the file was modified by calling is_file_modified(). + If the file name is no longer required release_filename() should be + called so that the entry can be removed from the repository. + """ + + def __init__( self, md5_sigs ): + """Constructor. + """ + + # Flag that determines whether the signature is a md5 digest or + # the modification time + # (this flag is passed to the filename_repository_t class) + self._md5_sigs = md5_sigs + + # ID lookup table (key: filename / value: id_) + self.__id_lut = {} + + # Entry dictionary (key: id_ / value: filename_entry_t) + # This dictionary contains the actual data. + # It must always hold that each entry in __entries has a corresponding + # entry in __id_lut (i.e. the keys in __id_lut must be the names + # stored in __entries) + self.__entries = {} + + # A counter for new ids + self.__next_id = 1 + + def acquire_filename(self, name): + """Acquire a file name and return its id and its signature. + """ + id_ = self.__id_lut.get(name) + # Is this a new entry? + if id_==None: + # then create one... + id_ = self.__next_id + self.__next_id += 1 + self.__id_lut[name] = id_ + entry = filename_entry_t(name) + self.__entries[id_] = entry + else: + # otherwise obtain the entry... + entry = self.__entries[id_] + + entry.inc_ref_count() + return id_, self._get_signature(entry) + + def release_filename(self, id_): + """Release a file name. + """ + entry = self.__entries.get(id_) + if entry==None: + raise ValueError, "Invalid filename id (%d)"%id_ + + # Decrease reference count and check if the entry has to be removed... + if entry.dec_ref_count()==0: + del self.__entries[id_] + del self.__id_lut[entry.filename] + + def is_file_modified(self, id_, signature): + """Check if the file referred to by id_ has been modified. + """ + entry = self.__entries.get(id_) + if entry==None: + raise ValueError, "Invalid filename id_ (%d)"%id_ + + # Is the signature already known? + if entry.sig_valid: + # use the cached signature + filesig = entry.signature + else: + # compute the signature and store it + filesig = self._get_signature(entry) + entry.signature = filesig + entry.sig_valid = True + + return filesig!=signature + + def update_id_counter(self): + """Update the id_ counter so that it doesn't grow forever. + """ + if len(self.__entries)==0: + self.__next_id = 1 + else: + self.__next_id = max(self.__entries.keys())+1 + + def _get_signature(self, entry): + """Return the signature of the file stored in entry. + """ + if self._md5_sigs: + # return md5 digest of the file content... + if not os.path.exists(entry.filename): + return None + try: + f = file(entry.filename) + except IOError, e: + print "Cannot determine md5 digest:",e + return None + data = f.read() + f.close() + return md5.new(data).digest() + else: + # return file modification date... + try: + return os.path.getmtime(entry.filename) + except OSError, e: + return None + + def _dump(self): + """Dump contents for debugging/testing. + """ + + print 70*"-" + print "ID lookup table:" + for name in self.__id_lut: + id_ = self.__id_lut[name] + print " %s -> %d"%(name, id_) + + print 70*"-" + print "%-4s %-60s %s"%("ID", "Filename", "Refcount") + print 70*"-" + for id_ in self.__entries: + entry = self.__entries[id_] + print "%04d %-60s %d"%(id_, entry.filename, entry.refcount) + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/etree_scanner.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/etree_scanner.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/etree_scanner.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/etree_scanner.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,47 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import scanner +import xml.etree.cElementTree as ElementTree + +class etree_saxifier_t(object): + def __init__(self, etree, handler): + self.__root_elem = etree.getroot() + self.__handler = handler + + def saxify(self): + self.__handler.startDocument() + self.__recursive_saxify( self.__root_elem ) + self.__handler.endDocument() + + def __recursive_saxify(self, element ): + self.__handler.startElement( element.tag, element.attrib ) + map( self.__recursive_saxify, element ) + self.__handler.endElement( element.tag ) + +class etree_scanner_t( scanner.scanner_t ): + def __init__(self, gccxml_file, decl_factory, *args ): + scanner.scanner_t.__init__( self, gccxml_file, decl_factory, *args ) + + def read( self ): + tree = ElementTree.parse( self.gccxml_file ) + saxifier = etree_saxifier_t( tree, self ) + saxifier.saxify() + +class ietree_scanner_t( scanner.scanner_t ): + def __init__(self, gccxml_file, decl_factory, *args ): + scanner.scanner_t.__init__( self, gccxml_file, decl_factory, *args ) + + def read( self ): + context = ElementTree.iterparse(self.gccxml_file, events=("start", "end")) + for event, elem in context: + if event == 'start': + self.startElement( elem.tag, elem.attrib ) + else: + self.endElement( elem.tag ) + elem.clear() + self.endDocument() + +etree_scanner_t = ietree_scanner_t diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/__init__.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/__init__.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/__init__.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,61 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +"""Parser sub-package. +""" + +from config import config_t +from config import gccxml_configuration_t + +from project_reader import COMPILATION_MODE +from project_reader import project_reader_t +from project_reader import file_configuration_t +from project_reader import create_text_fc +from project_reader import create_source_fc +from project_reader import create_gccxml_fc +from project_reader import create_cached_source_fc + +from source_reader import source_reader_t +from source_reader import gccxml_runtime_error_t +from declarations_cache import cache_base_t +from declarations_cache import file_cache_t +from declarations_cache import dummy_cache_t +from directory_cache import directory_cache_t +#shortcut +CONTENT_TYPE = file_configuration_t.CONTENT_TYPE + + +def parse( files + , config=None + , compilation_mode=COMPILATION_MODE.FILE_BY_FILE + , cache=None ): + """Parse header files. + + @param files: The header files that should be parsed + @type files: list of str + @param config: Configuration object or None + @type config: L{config_t} + @param compilation_mode: Determines whether the files are parsed individually or as one single chunk + @type compilation_mode: L{COMPILATION_MODE} + @param cache: Declaration cache (None=no cache) + @type cache: L{cache_base_t} or str + @returns: Declarations + """ + + if not config: + config = config_t() + parser = project_reader_t( config=config, cache=cache ) + answer = parser.read_files(files, compilation_mode) + return answer + +def parse_string(content, config=None): + if not config: + config = config_t() + parser = project_reader_t(config ) + return parser.read_string(content) + +def parse_xml_file( content, config=None ): + parser = source_reader_t( config ) + return parser.read_xml_file( content ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/linker.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/linker.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/linker.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/linker.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,272 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import types +from pygccxml.declarations import * + +class linker_t( decl_visitor_t, type_visitor_t, object ): + def __init__( self, decls, types, access, membership, files ): + decl_visitor_t.__init__(self) + type_visitor_t.__init__(self) + object.__init__(self) + + self.__decls = decls + self.__types = types + self.__access = access + self.__membership = membership + self.__files = files + self.__inst = None + + self.__compiler = None + if self.__decls: + for d in self.__decls.itervalues(): + self.__compiler = d.compiler + break + + def _get_inst(self): + return self.__inst + def _set_inst(self, inst): + self.__inst = inst + #use inst, to reduce attribute access time + if isinstance( inst, declaration_t ) and inst.location: + inst.location.file_name = self.__files[inst.location.file_name] + instance = property( _get_inst, _set_inst ) + + def __link_type(self, type_id): + if type_id is None: + return None #in some situations type_id is None, return_type of constructor or destructor + elif self.__types.has_key( type_id ): + return self.__types[type_id] + elif self.__decls.has_key( type_id ): + base = declarated_t( declaration=self.__decls[ type_id ] ) + self.__types[type_id] = base + return base + elif '...' == type_id: + return ellipsis_t() + else: + return unknown_t() + + def __link_compound_type(self): + self.__inst.base = self.__link_type( self.__inst.base ) + + def __link_members(self): + if not self.__membership.has_key( id(self.__inst) ): + return + for member in self.__membership[ id(self.__inst) ]: + if not self.__access.has_key( member ): + continue + access = self.__access[member] + if not self.__decls.has_key( member ): + continue + decl = self.__decls[member] + if isinstance( self.__inst, class_t ): + self.__inst.adopt_declaration( decl, access ) + else: + self.__inst.adopt_declaration( decl ) + + def __link_calldef(self): + self.__inst.return_type = self.__link_type( self.__inst.return_type ) + if isinstance( self.__inst, type_t ): + linked_args = [ self.__link_type( arg ) for arg in self.__inst.arguments_types ] + self.__inst.arguments_types = linked_args + else: + for arg in self.__inst.arguments: + arg.type = self.__link_type(arg.type) + for index in range( len( self.__inst.exceptions ) ): + try: + self.__inst.exceptions[index] = self.__decls[ self.__inst.exceptions[index] ] + except KeyError: + self.__inst.exceptions[index] = self.__link_type( self.__inst.exceptions[index] ) + + def visit_member_function( self ): + self.__link_calldef() + + def visit_constructor( self ): + self.__link_calldef() + + def visit_destructor( self ): + self.__link_calldef() + + def visit_member_operator( self ): + self.__link_calldef() + + def visit_casting_operator( self ): + self.__link_calldef() + #will be fixed by patcher. It is needed because of demangled name taken into account + #self.__inst._name = 'operator ' + self.__inst.return_type.decl_string + + def visit_free_function( self ): + self.__link_calldef() + + def visit_free_operator( self ): + self.__link_calldef() + + def visit_class_declaration(self ): + pass + + def visit_class(self ): + self.__link_members() + #GCC-XML sometimes generates constructors with names that does not match + #class name. I think this is because those constructors are compiler + #generated. I need to find out more about this and to talk with Brad + + new_name = self.__inst._name + if templates.is_instantiation( new_name ): + new_name = templates.name( new_name ) + + for decl in self.__inst.declarations: + if not isinstance( decl, constructor_t ): + continue + if '.' in decl._name or '$' in decl._name: + decl._name = new_name + + bases = self.__inst.bases.split() + self.__inst.bases = [] + for base in bases: + #it could be "_5" or "protected:_5" + data = base.split(':') + base_decl = self.__decls[ data[-1] ] + access = ACCESS_TYPES.PUBLIC + if 2 == len( data ): + access = data[0] + self.__inst.bases.append( hierarchy_info_t( base_decl, access ) ) + base_decl.derived.append( hierarchy_info_t( self.__inst, access ) ) + + def visit_enumeration(self ): + pass + + def visit_namespace(self ): + self.__link_members() + + def visit_typedef(self ): + self.__inst.type = self.__link_type(self.__inst.type) + + def visit_variable(self ): + self.__inst.type = self.__link_type(self.__inst.type) + + def visit_void( self ): + pass + + def visit_char( self ): + pass + + def visit_signed_char( self ): + pass + + def visit_unsigned_char( self ): + pass + + def visit_wchar( self ): + pass + + def visit_short_int( self ): + pass + + def visit_short_unsigned_int( self ): + pass + + def visit_bool( self ): + pass + + def visit_int( self ): + pass + + def visit_unsigned_int( self ): + pass + + def visit_long_int( self ): + pass + + def visit_long_unsigned_int( self ): + pass + + def visit_long_long_int( self ): + pass + + def visit_long_long_unsigned_int( self ): + pass + + def visit_float( self ): + pass + + def visit_double( self ): + pass + + def visit_long_double( self ): + pass + + def visit_complex_long_double(self): + pass + + def visit_complex_double(self): + pass + + def visit_complex_float(self): + pass + + def visit_jbyte(self): + pass + + def visit_jshort(self): + pass + + def visit_jint(self): + pass + + def visit_jlong(self): + pass + + def visit_jfloat(self): + pass + + def visit_jdouble(self): + pass + + def visit_jchar(self): + pass + + def visit_jboolean(self): + pass + + def visit_volatile( self ): + self.__link_compound_type() + + def visit_const( self ): + self.__link_compound_type() + + def visit_pointer( self ): + if '0.9' in self.__compiler and isinstance( self.__inst.base, member_variable_type_t ): + original_inst = self.__inst + self.__inst = self.__inst.base + self.visit_member_variable_type() + self.__inst = original_inst + else: + self.__link_compound_type() + + def visit_reference( self ): + self.__link_compound_type() + + def visit_array( self ): + self.__link_compound_type() + + def visit_free_function_type( self ): + self.__link_calldef() + + def visit_member_function_type( self ): + self.__link_calldef() + if isinstance( self.__inst, type_t ): + self.__inst.class_inst = self.__link_type( self.__inst.class_inst ) + + def visit_member_variable_type( self ): + self.__inst.variable_type = self.__link_type( self.__inst.variable_type ) + self.__link_compound_type() + + def visit_declarated( self ): + if isinstance( self.__inst.declaration, types.StringTypes ): + self.__inst.declaration = self.__decls[self.__inst.declaration] + + def visit_restrict( self ): + self.__link_compound_type() + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/patcher.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/patcher.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/patcher.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/patcher.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,189 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +from pygccxml import utils +from pygccxml import declarations + + +class default_argument_patcher_t( object ): + def __init__( self, enums ): + object.__init__( self ) + self.__enums = enums + + def __call__(self, decl): + for arg in decl.arguments: + if not arg.default_value: + continue + fixer = self.__find_fixer( decl, arg ) + if fixer: + arg.default_value = fixer( decl, arg ) + + def __find_fixer(self, func, arg): + if not arg.default_value: + return False + elif self.__is_unqualified_enum( func, arg ): + return self.__fix_unqualified_enum + elif self.__is_double_call( func, arg ): + return self.__fix_double_call + elif self.__is_invalid_integral( func, arg ): + return self.__fix_invalid_integral + elif self.__is_constructor_call( func, arg ): + return self.__fix_constructor_call + else: + return None + + def __join_names( self, prefix, suffix ): + if prefix == '::': + return '::' + suffix + else: + return prefix + '::' + suffix + + def __is_unqualified_enum(self, func, arg): + type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) + if not declarations.is_enum( type_ ): + return False + enum_type = declarations.enum_declaration( type_ ) + return enum_type.has_value_name( arg.default_value ) + + def __fix_unqualified_enum( self, func, arg): + type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) + enum_type = declarations.enum_declaration( type_ ) + return self.__join_names( enum_type.parent.decl_string, arg.default_value ) + + def __is_invalid_integral(self, func, arg): + type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) + if not declarations.is_integral( type_ ): + return False + try: + int( arg.default_value ) + return False + except: + return True + + def __fix_invalid_integral(self, func, arg): + try: + int( arg.default_value ) + return arg.default_value + except: + pass + + try: + int( arg.default_value, 16 ) + if 64 == utils.get_architecture(): + #on 64 bit architecture, gccxml reports 0fffff, which is valid number + #the problem is that in this case it is so buggy so pygccxml can not fix it + #users will have to fix the default value manually + return arg.default_value + default_value = arg.default_value.lower() + found_hex = filter( lambda ch: ch in 'abcdef', default_value ) + if found_hex and not default_value.startswith( '0x' ): + int( '0x' + default_value, 16 ) + return '0x' + default_value + except: + pass + + #may be we deal with enum + parent = func.parent + while parent: + found = self.__find_enum( parent, arg.default_value ) + if found: + if declarations.is_fundamental( arg.type ) and ' ' in arg.type.decl_string: + template = '(%s)(%s)' + else: + template = '%s(%s)' + return template % ( arg.type.decl_string + , self.__join_names( found.parent.decl_string, arg.default_value ) ) + else: + parent = parent.parent + return arg.default_value + + def __find_enum( self, scope, default_value ): + #this algorithm could be improved: it could take into account + #1. unnamed namespaced + #2. location within files + + for enum in self.__enums: + if enum.parent is scope and enum.has_value_name( default_value ): + return enum + return None + + def __is_double_call( self, func, arg ): + call_invocation = declarations.call_invocation + dv = arg.default_value + found1 = call_invocation.find_args( dv ) + if found1 == call_invocation.NOT_FOUND: + return False + found2 = call_invocation.find_args( dv, found1[1] + 1 ) + if found2 == call_invocation.NOT_FOUND: + return False + args1 = call_invocation.args( dv[ found1[0] : found1[1] + 1 ] ) + args2 = call_invocation.args( dv[ found2[0] : found2[1] + 1 ] ) + return len(args1) == len(args2) + + def __fix_double_call( self, func, arg ): + call_invocation = declarations.call_invocation + dv = arg.default_value + found1 = call_invocation.find_args( dv ) + found2 = call_invocation.find_args( dv, found1[1] + 1 ) + #args1 = call_invocation.args( dv[ found1[0] : found1[1] + 1 ] ) + args2 = call_invocation.args( dv[ found2[0] : found2[1] + 1 ] ) + return call_invocation.join( dv[:found1[0]], args2 ) + + def __is_constructor_call( self, func, arg ): + #if '0.9' in func.compiler: + # return False + call_invocation = declarations.call_invocation + dv = arg.default_value + if not call_invocation.is_call_invocation( dv ): + return False + name = call_invocation.name( dv ) + base_type = declarations.base_type( arg.type ) + if not isinstance( base_type, declarations.declarated_t ): + return False + decl = base_type.declaration + return decl.name == name \ + or ( isinstance( decl, declarations.class_t ) \ + and name in map( lambda typedef: typedef.name, decl.aliases ) ) + + def __fix_constructor_call( self, func, arg ): + call_invocation = declarations.call_invocation + dv = arg.default_value + if not call_invocation.is_call_invocation( dv ): + return False + base_type = declarations.base_type( arg.type ) + decl = base_type.declaration + name, args = call_invocation.split( dv ) + if decl.name != name: + #we have some alias to the class + relevant_typedefs = filter( lambda typedef: typedef.name == name + , decl.aliases ) + if 1 == len( relevant_typedefs ): + f_q_name = self.__join_names( declarations.full_name( relevant_typedefs[0].parent ) + , name ) + else:#in this case we can not say which typedef user uses: + f_q_name = self.__join_names( declarations.full_name( decl.parent ) + , decl.name ) + else: + f_q_name = self.__join_names( declarations.full_name( decl.parent ), name ) + + return call_invocation.join( f_q_name, args ) + +class casting_operator_patcher_t( object ): + def __init__( self ): + object.__init__( self ) + + def __call__(self, decl): + decl.name = 'operator ' + decl.return_type.decl_string + +_casting_oper_patcher_ = casting_operator_patcher_t() + +def fix_calldef_decls(decls, enums): + default_arg_patcher = default_argument_patcher_t(enums) + #decls should be flat list of all declarations, you want to apply patch on + for decl in decls: + default_arg_patcher( decl ) + if isinstance( decl, declarations.casting_operator_t): + _casting_oper_patcher_( decl ) + \ No newline at end of file diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/project_reader.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,477 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import time +import types +import source_reader +import declarations_cache +import pygccxml.declarations +from pygccxml import utils + +class COMPILATION_MODE: + ALL_AT_ONCE = 'all at once' + FILE_BY_FILE = 'file by file' + + +class file_configuration_t( object ): + """ + file_configuration_t - a class, that contains some data and description how + to treat the data. file_configuration_t can contain reference to the next types + of data: + + 1) path to C++ source file + + 2) path to `GCC-XML`_ generated XML file + + 3) path to C++ source file and path to `GCC-XML`_ generated XML file + + In this case, if XML file does not exists, it will be created. Next time + you will ask to parse the source file, the XML file will be used instead. + + Small tip: you can setup your makefile to delete XML files every time, + the relevant source file has changed. + + 4) Python string, that contains valid C++ code + + + There are few functions, that will help you to construct file_configuration_t + object: + + * L{create_source_fc} + + * L{create_gccxml_fc} + + * L{create_cached_source_fc} + + * L{create_text_fc} + + """ + class CONTENT_TYPE: + STANDARD_SOURCE_FILE = 'standard source file' + CACHED_SOURCE_FILE = 'cached source file' + GCCXML_GENERATED_FILE = 'gccxml generated file' + TEXT = 'text' + + def __init__( self + , data + , start_with_declarations=None + , content_type=CONTENT_TYPE.STANDARD_SOURCE_FILE + , cached_source_file=None ): + object.__init__( self ) + self.__data = data + if not start_with_declarations: + start_with_declarations = [] + self.__start_with_declarations = start_with_declarations + self.__content_type = content_type + self.__cached_source_file = cached_source_file + if not self.__cached_source_file \ + and self.__content_type == self.CONTENT_TYPE.CACHED_SOURCE_FILE: + self.__cached_source_file = self.__data + '.xml' + + @property + def data(self): + return self.__data + + @property + def start_with_declarations(self): + return self.__start_with_declarations + + @property + def content_type(self): + return self.__content_type + + @property + def cached_source_file(self): + return self.__cached_source_file + +def create_text_fc( text ): + """ + Creates L{file_configuration_t} instance, configured to contain Python string, + that contains valid C++ code + + @param text: C++ code + @type text: str + + @return: L{file_configuration_t} + """ + return file_configuration_t( data=text + , content_type=file_configuration_t.CONTENT_TYPE.TEXT ) + +def create_source_fc( header ): + """ + Creates L{file_configuration_t} instance, configured to contain path to + C++ source file + + @param header: path to C++ source file + @type header: str + + @return: L{file_configuration_t} + """ + return file_configuration_t( data=header + , content_type=file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE ) + +def create_gccxml_fc( xml_file ): + """ + Creates L{file_configuration_t} instance, configured to contain path to + GCC-XML generated XML file. + + @param xml_file: path to GCC-XML generated XML file + @type xml_file: str + + @return: L{file_configuration_t} + """ + return file_configuration_t( data=xml_file + , content_type=file_configuration_t.CONTENT_TYPE.GCCXML_GENERATED_FILE ) + +def create_cached_source_fc( header, cached_source_file ): + """ + Creates L{file_configuration_t} instance, configured to contain path to + GCC-XML generated XML file and C++ source file. If XML file does not exists, + it will be created and used for parsing. If XML file exists, it will be used + for parsing. + + @param header: path to C++ source file + @type header: str + + @param cached_source_file: path to GCC-XML generated XML file + @type cached_source_file: str + + @return: L{file_configuration_t} + """ + return file_configuration_t( data=header + , cached_source_file=cached_source_file + , content_type=file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE ) + +class project_reader_t: + """Parses header files and returns the contained declarations. + """ + def __init__( self, config, cache=None, decl_factory=None): + """Constructor. + + config is a configuration object that contains the parameters + for invoking gccxml. cache specifies the cache to use for + caching declarations between separate runs. By default, no + cache is used. decl_factory is an object that must provide + the same interface than + L{decl_factory_t}, i.e. there must + be a set of C{create_*} methods that return an instance of an + appropriate declaration class. By default, the declaration + classes defined in the L{declarations} package are used. + + @param config: Configuration object + @type config: L{config_t} + @param cache: Declaration cache (None=no cache) + @type cache: L{cache_base_t} or str + @param decl_factory: Custom declaration factory object or None + @type decl_factory: decl_factory_t + """ + self.__config = config + self.__dcache = None + if isinstance( cache, declarations_cache.cache_base_t ): + self.__dcache = cache + elif isinstance( cache, types.StringTypes ): + self.__dcache = declarations_cache.file_cache_t(cache) + else: + self.__dcache = declarations_cache.dummy_cache_t() + self.__decl_factory = decl_factory + if not decl_factory: + self.__decl_factory = pygccxml.declarations.decl_factory_t() + + self.logger = utils.loggers.gccxml + + @staticmethod + def get_os_file_names( files ): + """Returns a list of OS file names + + @param files: list of strings or L{file_configuration_t} instances. + files could contain a mix of them + @type files: list + """ + fnames = [] + for f in files: + if isinstance( f, types.StringTypes ): + fnames.append( f ) + elif isinstance( f, file_configuration_t ): + if f.content_type in ( file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE + , file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE ): + fnames.append( f.data ) + else: + pass + return fnames + + def read_files( self, files, compilation_mode=COMPILATION_MODE.FILE_BY_FILE): + """Parse header files. + + @param files: list of strings or L{file_configuration_t} instances. + files could contain a mix of them + @type files: list + @param compilation_mode: Determines whether the files are parsed individually or as one single chunk + @type compilation_mode: L{COMPILATION_MODE} + @returns: Declarations + """ + if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE \ + and len( files ) == len( self.get_os_file_names(files) ): + return self.__parse_all_at_once(files) + else: + if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE: + msg = ''.join([ + "Unable to parse files using ALL_AT_ONCE mode. " + , "There is some file configuration that is not file. " + , "pygccxml.parser.project_reader_t switches to FILE_BY_FILE mode." ]) + self.logger.warning( msg ) + return self.__parse_file_by_file(files) + + def __parse_file_by_file(self, files): + namespaces = [] + config = self.__config.clone() + self.logger.debug( "Reading project files: file by file" ) + for prj_file in files: + reader = None + header = None + content_type = None + if isinstance( prj_file, file_configuration_t ): + del config.start_with_declarations[:] + config.start_with_declarations.extend( prj_file.start_with_declarations ) + header = prj_file.data + content_type = prj_file.content_type + else: + config = self.__config + header = prj_file + content_type = file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE + reader = source_reader.source_reader_t( config + , self.__dcache + , self.__decl_factory ) + decls = None + if content_type == file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE: + self.logger.info( 'Parsing source file "%s" ... ' % header ) + decls = reader.read_file( header ) + elif content_type == file_configuration_t.CONTENT_TYPE.GCCXML_GENERATED_FILE: + self.logger.info( 'Parsing xml file "%s" ... ' % header ) + decls = reader.read_xml_file( header ) + elif content_type == file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE: + #TODO: raise error when header file does not exist + if not os.path.exists( prj_file.cached_source_file ): + dir_ = os.path.split( prj_file.cached_source_file )[0] + if dir_ and not os.path.exists( dir_ ): + os.makedirs( dir_ ) + self.logger.info( 'Creating xml file "%s" from source file "%s" ... ' + % ( prj_file.cached_source_file, header ) ) + reader.create_xml_file( header, prj_file.cached_source_file ) + self.logger.info( 'Parsing xml file "%s" ... ' % prj_file.cached_source_file ) + decls = reader.read_xml_file( prj_file.cached_source_file ) + else: + decls = reader.read_string( header ) + namespaces.append( decls ) + self.logger.debug( "Flushing cache... " ) + start_time = time.clock() + self.__dcache.flush() + self.logger.debug( "Cache has been flushed in %.1f secs" % ( time.clock() - start_time ) ) + answer = [] + self.logger.debug( "Joining namespaces ..." ) + for file_nss in namespaces: + answer = self._join_top_namespaces( answer, file_nss ) + self.logger.debug( "Joining declarations ..." ) + for ns in answer: + if isinstance( ns, pygccxml.declarations.namespace_t ): + self._join_declarations( ns ) + leaved_classes = self._join_class_hierarchy( answer ) + types = self.__declarated_types(answer) + self.logger.debug( "Relinking declared types ..." ) + self._relink_declarated_types( leaved_classes, types ) + source_reader.bind_aliases( pygccxml.declarations.make_flatten( answer ) ) + return answer + + def __parse_all_at_once(self, files): + config = self.__config.clone() + self.logger.debug( "Reading project files: all at once" ) + header_content = [] + for header in files: + if isinstance( header, file_configuration_t ): + del config.start_with_declarations[:] + config.start_with_declarations.extend( header.start_with_declarations ) + header_content.append( '#include "%s" %s' % ( header.data, os.linesep ) ) + else: + header_content.append( '#include "%s" %s' % ( header, os.linesep ) ) + return self.read_string( ''.join( header_content ) ) + + def read_string(self, content): + """Parse a string containing C/C++ source code. + + @param content: C/C++ source code. + @type content: str + @returns: Declarations + """ + reader = source_reader.source_reader_t( self.__config, None, self.__decl_factory ) + return reader.read_string( content ) + + def _join_top_namespaces(self, main_ns_list, other_ns_list): + answer = main_ns_list[:] + for other_ns in other_ns_list: + main_ns = pygccxml.declarations.find_declaration( answer + , type=pygccxml.declarations.namespace_t + , name=other_ns._name + , recursive=False ) + if main_ns: + main_ns.take_parenting( other_ns ) + else: + answer.append( other_ns ) + return answer + + def _join_namespaces( self, nsref ): + assert isinstance( nsref, pygccxml.declarations.namespace_t ) + ddhash = {} # decl.__class__ : { decl.name : [decls] } double declaration hash + decls = [] + + for decl in nsref.declarations: + if not ddhash.has_key( decl.__class__ ): + ddhash[ decl.__class__ ] = { decl._name : [ decl ] } + decls.append( decl ) + else: + joined_decls = ddhash[ decl.__class__ ] + if not joined_decls.has_key( decl._name ): + decls.append( decl ) + joined_decls[decl._name] = [ decl ] + else: + if isinstance( decl, pygccxml.declarations.calldef_t ): + if decl not in joined_decls[decl._name]: + #functions has overloading + decls.append( decl ) + joined_decls[decl._name].append( decl ) + elif isinstance( decl, pygccxml.declarations.enumeration_t ): + #unnamed enums + if not decl.name and decl not in joined_decls[decl._name]: + decls.append( decl ) + joined_decls[decl._name].append( decl ) + elif isinstance( decl, pygccxml.declarations.class_t ): + #unnamed classes + if not decl.name and decl not in joined_decls[decl._name]: + decls.append( decl ) + joined_decls[decl._name].append( decl ) + else: + assert 1 == len( joined_decls[ decl._name ] ) + if isinstance( decl, pygccxml.declarations.namespace_t ): + joined_decls[ decl._name ][0].take_parenting( decl ) + nsref.declarations = decls + + def _join_class_hierarchy( self, namespaces ): + create_key = lambda decl:( decl.location.as_tuple() + , tuple( pygccxml.declarations.declaration_path( decl ) ) ) + classes = filter( lambda decl: isinstance(decl, pygccxml.declarations.class_t ) + , pygccxml.declarations.make_flatten( namespaces ) ) + leaved_classes = {} + #selecting classes to leave + for class_ in classes: + key = create_key( class_ ) + if key not in leaved_classes: + leaved_classes[ key ] = class_ + #replacing base and derived classes with those that should be leave + #also this loop will add missing derived classes to the base + for class_ in classes: + leaved_class = leaved_classes[create_key( class_ )] + for base_info in class_.bases: + leaved_base = leaved_classes[ create_key( base_info.related_class ) ] + #treating base class hierarchy of leaved_class + leaved_base_info = pygccxml.declarations.hierarchy_info_t( + related_class=leaved_base + , access=base_info.access ) + if leaved_base_info not in leaved_class.bases: + leaved_class.bases.append( leaved_base_info ) + else: + index = leaved_class.bases.index( leaved_base_info ) + leaved_class.bases[index].related_class = leaved_base_info.related_class + #treating derived class hierarchy of leaved_base + leaved_derived_for_base_info = pygccxml.declarations.hierarchy_info_t( + related_class=leaved_class + , access=base_info.access ) + if leaved_derived_for_base_info not in leaved_base.derived: + leaved_base.derived.append( leaved_derived_for_base_info ) + else: + index = leaved_base.derived.index( leaved_derived_for_base_info ) + leaved_base.derived[index].related_class = leaved_derived_for_base_info.related_class + for derived_info in class_.derived: + leaved_derived = leaved_classes[ create_key( derived_info.related_class ) ] + #treating derived class hierarchy of leaved_class + leaved_derived_info = pygccxml.declarations.hierarchy_info_t( + related_class=leaved_derived + , access=derived_info.access ) + if leaved_derived_info not in leaved_class.derived: + leaved_class.derived.append( leaved_derived_info ) + #treating base class hierarchy of leaved_derived + leaved_base_for_derived_info = pygccxml.declarations.hierarchy_info_t( + related_class=leaved_class + , access=derived_info.access ) + if leaved_base_for_derived_info not in leaved_derived.bases: + leaved_derived.bases.append( leaved_base_for_derived_info ) + #this loops remove instance we from parent.declarations + for class_ in classes: + key = create_key( class_ ) + if id( leaved_classes[key] ) == id( class_ ): + continue + else: + declarations = None + if class_.parent: + declarations = class_.parent.declarations + else: + declarations = namespaces #yes, we are talking about global class that doesn't + #belong to any namespace. Usually is compiler generated top level classes + declarations_ids = [ id(decl) for decl in declarations ] + del declarations[ declarations_ids.index( id(class_) ) ] + return leaved_classes + + def _relink_declarated_types(self, leaved_classes, declarated_types): + create_key = lambda decl:( decl.location.as_tuple() + , tuple( pygccxml.declarations.declaration_path( decl ) ) ) + for decl_wrapper_type in declarated_types: + #it is possible, that cache contains reference to dropped class + #We need to clear it + decl_wrapper_type.cache.reset() + if isinstance( decl_wrapper_type.declaration, pygccxml.declarations.class_t ): + key = create_key(decl_wrapper_type.declaration) + if leaved_classes.has_key( key ): + decl_wrapper_type.declaration = leaved_classes[ create_key(decl_wrapper_type.declaration) ] + else: + if decl_wrapper_type.declaration._name.startswith( '__vmi_class_type_info_pseudo' ): + continue + msg = [] + msg.append( "Unable to find out actual class definition: '%s'." % decl_wrapper_type.declaration._name ) + msg.append( "Class definition has been changed from one compilation to an other." ) + msg.append( "Why did it happen to me? Here is a short list of reasons: " ) + msg.append( " 1. There are different preprocessor definitions applied on same file during compilation" ) + msg.append( " 2. Bug in pygccxml." ) + self.logger.error( os.linesep.join(msg) ) + + def _join_declarations( self, declref ): + self._join_namespaces( declref ) + for ns in declref.declarations: + if isinstance( ns, pygccxml.declarations.namespace_t ): + self._join_declarations( ns ) + + def __declarated_types(self, namespaces): + def get_from_type(cpptype): + if not cpptype: + return [] + elif isinstance( cpptype, pygccxml.declarations.fundamental_t ): + return [] + elif isinstance( cpptype, pygccxml.declarations.declarated_t ): + return [ cpptype ] + elif isinstance( cpptype, pygccxml.declarations.compound_t ): + return get_from_type( cpptype.base ) + elif isinstance( cpptype, pygccxml.declarations.calldef_type_t ): + types = get_from_type( cpptype.return_type ) + for arg in cpptype.arguments_types: + types.extend( get_from_type( arg ) ) + return types + else: + assert isinstance( cpptype, ( pygccxml.declarations.unknown_t + , pygccxml.declarations.ellipsis_t ) ) + return [] + types = [] + for decl in pygccxml.declarations.make_flatten( namespaces ): + if isinstance( decl, pygccxml.declarations.calldef_t ): + types.extend( get_from_type( decl.function_type() ) ) + elif isinstance( decl, (pygccxml.declarations.typedef_t, pygccxml.declarations.variable_t) ): + types.extend( get_from_type( decl.type ) ) + return types diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/scanner.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/scanner.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/scanner.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/scanner.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,539 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import types +import pprint +import xml.sax +import warnings +import xml.sax.handler +from pygccxml.declarations import * +from pygccxml import utils + +##convention +#XML_NN - XML Node Name +#XML_AN - XML Attribute Name +#also those constants are sorted for easy searching. +XML_AN_ABSTRACT = "abstract" +XML_AN_ACCESS = "access" +XML_AN_ALIGN = "align" +XML_AN_ARTIFICIAL = "artificial" +XML_AN_ATTRIBUTES = "attributes" +XML_AN_BASE_TYPE = "basetype" +XML_AN_BASES = "bases" +XML_AN_BITS = "bits" +XML_AN_CONST = "const" +XML_AN_CONTEXT = "context" +XML_AN_CVS_REVISION = "cvs_revision" +XML_AN_DEFAULT = "default" +XML_AN_DEMANGLED = "demangled" +XML_AN_EXTERN = "extern" +XML_AN_FILE = "file" +XML_AN_ID = "id" +XML_AN_INCOMPLETE = "incomplete" +XML_AN_INIT = "init" +XML_AN_LINE = "line" +XML_AN_MANGLED = "mangled" +XML_AN_MAX = "max" +XML_AN_MEMBERS = "members" +XML_AN_MUTABLE = "mutable" +XML_AN_NAME = "name" +XML_AN_OFFSET = "offset" +XML_AN_PURE_VIRTUAL = "pure_virtual" +XML_AN_RESTRICT = "restrict" +XML_AN_RETURNS = "returns" +XML_AN_SIZE = "size" +XML_AN_STATIC = "static" +XML_AN_THROW = "throw" +XML_AN_TYPE = "type" +XML_AN_VIRTUAL = "virtual" +XML_AN_VOLATILE = "volatile" +XML_NN_ARGUMENT = "Argument" +XML_NN_ARRAY_TYPE = "ArrayType" +XML_NN_CASTING_OPERATOR = "Converter" +XML_NN_CLASS = "Class" +XML_NN_CONSTRUCTOR = "Constructor" +XML_NN_CV_QUALIFIED_TYPE = "CvQualifiedType" +XML_NN_DESTRUCTOR = "Destructor" +XML_NN_ELLIPSIS = "Ellipsis" +XML_NN_ENUMERATION = "Enumeration" +XML_NN_ENUMERATION_VALUE = "EnumValue" +XML_NN_FIELD = "Field" +XML_NN_FILE = "File" +XML_NN_FUNCTION = "Function" +XML_NN_FUNCTION_TYPE = "FunctionType" +XML_NN_FUNDAMENTAL_TYPE = "FundamentalType" +XML_NN_FREE_OPERATOR = "OperatorFunction" +XML_NN_GCC_XML = "GCC_XML" +XML_NN_MEMBER_OPERATOR = "OperatorMethod" +XML_NN_METHOD = "Method" +XML_NN_METHOD_TYPE = "MethodType" +XML_NN_NAMESPACE = "Namespace" +XML_NN_OFFSET_TYPE = "OffsetType" +XML_NN_POINTER_TYPE = "PointerType" +XML_NN_REFERENCE_TYPE = "ReferenceType" +XML_NN_ROOT = "GCC_XML" +XML_NN_STRUCT = "Struct" +XML_NN_TYPEDEF = "Typedef" +XML_NN_UNION = "Union" +XML_NN_VARIABLE = "Variable" + +class scanner_t( xml.sax.handler.ContentHandler ): + def __init__(self, gccxml_file, decl_factory, *args ): + xml.sax.handler.ContentHandler.__init__(self, *args ) + self.logger = utils.loggers.gccxml + self.gccxml_file = gccxml_file + #defining parsing tables + self.__readers = { + XML_NN_FILE : self.__read_file + , XML_NN_NAMESPACE : self.__read_namespace + , XML_NN_ENUMERATION : self.__read_enumeration + , XML_NN_ENUMERATION_VALUE : self.__read_enumeration_value + , XML_NN_ARRAY_TYPE : self.__read_array_type + , XML_NN_CV_QUALIFIED_TYPE : self.__read_cv_qualified_type + , XML_NN_POINTER_TYPE : self.__read_pointer_type + , XML_NN_REFERENCE_TYPE : self.__read_reference_type + , XML_NN_FUNDAMENTAL_TYPE : self.__read_fundamental_type + , XML_NN_ARGUMENT : self.__read_argument + , XML_NN_FUNCTION_TYPE : self.__read_function_type + , XML_NN_METHOD_TYPE : self.__read_method_type + , XML_NN_OFFSET_TYPE : self.__read_offset_type + , XML_NN_TYPEDEF : self.__read_typedef + , XML_NN_VARIABLE : self.__read_variable + , XML_NN_CLASS : self.__read_class + , XML_NN_STRUCT : self.__read_struct + , XML_NN_UNION : self.__read_union + , XML_NN_FIELD : self.__read_field + , XML_NN_CASTING_OPERATOR : self.__read_casting_operator + , XML_NN_CONSTRUCTOR : self.__read_constructor + , XML_NN_DESTRUCTOR : self.__read_destructor + , XML_NN_FUNCTION : self.__read_function + , XML_NN_FREE_OPERATOR : self.__read_free_operator + , XML_NN_MEMBER_OPERATOR : self.__read_member_operator + , XML_NN_METHOD : self.__read_method + , XML_NN_GCC_XML : self.__read_version + , XML_NN_ELLIPSIS : self.__read_ellipsis + } + self.deep_declarations = [ + XML_NN_CASTING_OPERATOR + , XML_NN_CONSTRUCTOR + , XML_NN_DESTRUCTOR + , XML_NN_ENUMERATION + , XML_NN_FILE + , XML_NN_FUNCTION + , XML_NN_FREE_OPERATOR + , XML_NN_MEMBER_OPERATOR + , XML_NN_METHOD + , XML_NN_FUNCTION_TYPE + , XML_NN_METHOD_TYPE + ] + + assert isinstance( decl_factory, decl_factory_t ) + self.__decl_factory = decl_factory + + #mapping from id -> decl + self.__declarations = {} + #list of all read declarations + self.__calldefs = [] + #list of enums I need later + self.__enums = [] + #mapping from id -> type + self.__types = {} + #mapping from id -> file + self.__files = {} + #mapping between decl id -> access + self.__access = {} + #current object under construction + self.__inst = None + #mapping from id to members + self.__members = {} + + self.__compiler = None + + def read( self ): + xml.sax.parse( self.gccxml_file, self ) + + def endDocument( self ): + #updating membership + members_mapping = {} + for gccxml_id, members in self.__members.iteritems(): + decl = self.__declarations.get( gccxml_id, None ) + if not decl or not isinstance( decl, scopedef_t): + continue + members_mapping[ id( decl ) ] = members + self.__members = members_mapping + + def declarations(self): + return self.__declarations + + def calldefs( self ): + return self.__calldefs + + def enums(self): + return self.__enums + + def types(self): + return self.__types + + def files(self): + return self.__files + + def access(self): + return self.__access + + def members(self): + return self.__members + + def startElementNS(self, name, qname, attrs): + return self.startElement( name[1], attrs ) + + def endElementNS(self, name, qname): + return self.endElement( name[1] ) + + def startElement(self, name, attrs): + try: + if name not in self.__readers: + return + obj = self.__readers[name]( attrs ) + if not obj: + return #it means that we worked on internals + #for example EnumValue of function argument + if name in self.deep_declarations: + self.__inst = obj + self.__read_access( attrs ) + element_id = attrs.get(XML_AN_ID, None) + if isinstance( obj, declaration_t ): + obj.compiler = self.__compiler + self.__update_membership( attrs ) + self.__declarations[ element_id ] = obj + if not isinstance( obj, namespace_t ): + self.__read_location( obj, attrs ) + if isinstance( obj, class_t): + self.__read_bases( obj, attrs ) + self.__read_artificial(obj, attrs) + self.__read_mangled( obj, attrs) + self.__read_demangled( obj, attrs) + self.__read_attributes(obj, attrs) + + elif isinstance( obj, type_t ): + self.__types[ element_id ] = obj + self.__read_byte_size(obj, attrs) + self.__read_byte_align(obj, attrs) + elif isinstance( obj, types.StringTypes ): + self.__files[ element_id ] = obj + else: + self.logger.warning( 'Unknown object type has been found.' + + ' Please report this bug to pygccxml development team.' ) + except Exception, error: + msg = 'error occured, while parsing element with name "%s" and attrs "%s".' + msg = msg + os.linesep + 'Error: %s.' % str( error ) + self.logger.error( msg % ( name, pprint.pformat( attrs.keys() ) ) ) + raise + + def endElement(self, name): + if name in self.deep_declarations: + self.__inst = None + + def __read_location(self, decl, attrs): + decl.location = location_t( file_name=attrs[XML_AN_FILE], line=int(attrs[XML_AN_LINE])) + + def __update_membership(self, attrs): + parent = attrs.get( XML_AN_CONTEXT, None ) + if not parent: + return + if not self.__members.has_key( parent ): + self.__members[ parent ] = [] + self.__members[parent].append( attrs[XML_AN_ID] ) + + def __read_members(self, decl, attrs ): + decl.declarations = attrs.get(XML_AN_MEMBERS, "") + + def __read_bases(self, decl, attrs ): + decl.bases = attrs.get( XML_AN_BASES, "" ) + + def __read_artificial( self, decl, attrs ): + decl.is_artificial = attrs.get( XML_AN_ARTIFICIAL, False ) + + def __read_mangled( self, decl, attrs ): + decl.mangled = attrs.get( XML_AN_MANGLED, None ) + + def __read_demangled( self, decl, attrs ): + decl.demangled = attrs.get( XML_AN_DEMANGLED, None ) + + def __read_attributes( self, decl, attrs ): + decl.attributes = attrs.get( XML_AN_ATTRIBUTES, None ) + + def __read_access( self, attrs ): + self.__access[ attrs[XML_AN_ID] ] = attrs.get( XML_AN_ACCESS, ACCESS_TYPES.PUBLIC ) + + def __read_byte_size (self, decl, attrs): + "Using duck typing to set the size instead of in constructor" + size = attrs.get(XML_AN_SIZE, 0) + decl.byte_size = int(size)/8 # Make sure the size is in bytes instead of bits + + def __read_byte_offset (self, decl, attrs): + "Using duck typing to set the offset instead of in constructor" + offset = attrs.get(XML_AN_OFFSET, 0) + decl.byte_offset = int(offset)/8 # Make sure the size is in bytes instead of bits + + def __read_byte_align (self, decl, attrs): + "Using duck typing to set the alignment" + align = attrs.get(XML_AN_ALIGN, 0) + decl.byte_align = int(align)/8 # Make sure the size is in bytes instead of bits + + def __read_root(self, attrs): + pass + + def __read_file( self, attrs ): + return attrs.get( XML_AN_NAME, '' ) + + def __read_namespace(self, attrs): + ns_name = attrs.get( XML_AN_NAME, '' ) + if '.' in ns_name: + #if '.' in namespace then this is mangled namespace -> in c++ namespace{...} + #that is almost true: gcc mangale name using top file name. + #almost all files has '.' in name + ns_name = '' + return self.__decl_factory.create_namespace( name=ns_name ) + + def __read_enumeration(self, attrs): + enum_name = attrs.get( XML_AN_NAME, '' ) + if '$_' in enum_name or '._' in enum_name: + #it means that this is unnamed enum. in c++ enum{ x }; + enum_name = '' + decl = self.__decl_factory.create_enumeration( name=enum_name ) + self.__read_byte_size(decl, attrs) + self.__read_byte_align(decl, attrs) + self.__enums.append( decl ) + return decl + + def __read_enumeration_value( self, attrs ): + name = attrs.get( XML_AN_NAME, '' ) + num = int(attrs[XML_AN_INIT]) + self.__inst.append_value(name, num) + + def __guess_int_value( self, value_as_str ): + #returns instance of int or None + #if gcc compiled the code, than it is correct! + numeric_suffix_letters = 'UuLlFf' + for s in numeric_suffix_letters: + value_as_str = value_as_str.replace( s, '' ) + try: + return int( value_as_str ) + except ValueError: + try: + return int( value_as_str, 16 ) + except ValueError: + return None + + def __read_array_type( self, attrs ): + type_ = attrs[ XML_AN_TYPE ] + size = self.__guess_int_value( attrs.get(XML_AN_MAX, '' ) ) + if size is None: + size = array_t.SIZE_UNKNOWN + msg = 'unable to find out array size from expression "%s"' % attrs[ XML_AN_MAX ] + warnings.warn( msg ) + return array_t( type_, size + 1 ) + + def __read_cv_qualified_type( self, attrs ): + if attrs.has_key( XML_AN_CONST ): + return const_t( attrs[XML_AN_TYPE] ) + elif attrs.has_key( XML_AN_VOLATILE ): + return volatile_t( attrs[XML_AN_TYPE] ) + elif attrs.has_key( XML_AN_RESTRICT ): + return restrict_t( attrs[XML_AN_TYPE] ) + else: + assert 0 + + def __read_pointer_type( self, attrs ): + return pointer_t( attrs[XML_AN_TYPE] ) + + def __read_reference_type( self, attrs ): + return reference_t( attrs[XML_AN_TYPE] ) + + def __read_fundamental_type(self, attrs ): + try: + return FUNDAMENTAL_TYPES[ attrs.get( XML_AN_NAME, '' ) ] + except KeyError: + raise RuntimeError( "pygccxml error: unable to find fundamental type with name '%s'." + % attrs.get( XML_AN_NAME, '' ) ) + + def __read_offset_type( self,attrs ): + base = attrs[ XML_AN_BASE_TYPE ] + type_ = attrs[ XML_AN_TYPE ] + if '0.9' in self.__compiler: + return pointer_t( member_variable_type_t( class_inst=base, variable_type=type_ ) ) + else: + return member_variable_type_t( class_inst=base, variable_type=type_ ) + + def __read_argument( self, attrs ): + if isinstance( self.__inst, calldef_type_t ): + self.__inst.arguments_types.append( attrs[XML_AN_TYPE] ) + else: + argument = argument_t() + argument.name = attrs.get( XML_AN_NAME, 'arg%d' % len(self.__inst.arguments) ) + argument.type = attrs[XML_AN_TYPE] + argument.default_value = attrs.get( XML_AN_DEFAULT, None ) + self.__read_attributes( argument, attrs ) + if argument.default_value == '': + argument.default_value = None + self.__inst.arguments.append( argument ) + + def __read_ellipsis( self, attrs ): + if isinstance( self.__inst, calldef_type_t ): + self.__inst.arguments_types.append( '...' ) + else: + argument = argument_t( type='...' ) + self.__inst.arguments.append( argument ) + + def __read_calldef( self, calldef, attrs, is_declaration ): + #destructor for example doesn't have return type + calldef.return_type = attrs.get( XML_AN_RETURNS, None ) + if is_declaration: + self.__calldefs.append( calldef ) + calldef.name = attrs.get(XML_AN_NAME, '') + calldef.has_extern = attrs.get( XML_AN_EXTERN, False ) + throw_stmt = attrs.get( XML_AN_THROW, None ) + if None is throw_stmt: + calldef.does_throw = True + calldef.exceptions = [] + elif "" == throw_stmt: + calldef.does_throw = False + calldef.exceptions = [] + else: + calldef.does_throw = True + calldef.exceptions = throw_stmt.split() + + def __read_member_function( self, calldef, attrs, is_declaration ): + self.__read_calldef( calldef, attrs, is_declaration ) + calldef.has_const = attrs.get( XML_AN_CONST, False ) + if is_declaration: + calldef.has_static = attrs.get( XML_AN_STATIC, False ) + if attrs.has_key( XML_AN_PURE_VIRTUAL ): + calldef.virtuality = VIRTUALITY_TYPES.PURE_VIRTUAL + elif attrs.has_key( XML_AN_VIRTUAL ): + calldef.virtuality = VIRTUALITY_TYPES.VIRTUAL + else: + calldef.virtuality = VIRTUALITY_TYPES.NOT_VIRTUAL + else: + calldef.class_inst = attrs[XML_AN_BASE_TYPE] + + def __read_function_type(self, attrs): + answer = free_function_type_t() + self.__read_calldef( answer, attrs, False ) + return answer + + def __read_method_type(self, attrs): + answer = member_function_type_t() + self.__read_member_function( answer, attrs, False ) + return answer + + def __read_typedef(self, attrs ): + return self.__decl_factory.create_typedef( name=attrs.get( XML_AN_NAME, '' ), type=attrs[XML_AN_TYPE]) + + def __read_variable(self, attrs ): + type_qualifiers = type_qualifiers_t() + type_qualifiers.has_mutable = attrs.get(XML_AN_MUTABLE, False) + type_qualifiers.has_static = attrs.get(XML_AN_EXTERN, False) + bits = attrs.get( XML_AN_BITS, None ) + if bits: + bits = int( bits ) + decl = self.__decl_factory.create_variable( name=attrs.get( XML_AN_NAME, '' ) + , type=attrs[XML_AN_TYPE] + , type_qualifiers=type_qualifiers + , value=attrs.get( XML_AN_INIT, None ) + , bits=bits) + self.__read_byte_offset(decl, attrs) + return decl + + __read_field = __read_variable #just a synonim + + def __read_class_impl(self, class_type, attrs): + decl = None + name = attrs.get(XML_AN_NAME, '') + if '$' in name or '.' in name: + name = '' + if attrs.has_key( XML_AN_INCOMPLETE ): + decl = self.__decl_factory.create_class_declaration(name=name) + else: + decl = self.__decl_factory.create_class( name=name, class_type=class_type ) + if attrs.get( XML_AN_ABSTRACT, False ): + decl.is_abstract = True + else: + decl.is_abstract = False + self.__read_byte_size(decl, attrs) + self.__read_byte_align(decl, attrs) + return decl + + def __read_class( self, attrs ): + return self.__read_class_impl( CLASS_TYPES.CLASS, attrs ) + + def __read_struct( self, attrs ): + return self.__read_class_impl( CLASS_TYPES.STRUCT, attrs ) + + def __read_union( self, attrs ): + return self.__read_class_impl( CLASS_TYPES.UNION, attrs ) + + def __read_casting_operator(self, attrs ): + operator = self.__decl_factory.create_casting_operator() + self.__read_member_function( operator, attrs, True ) + return operator + + def __read_constructor( self, attrs ): + constructor = self.__decl_factory.create_constructor() + self.__read_member_function( constructor, attrs, True ) + return constructor + + def __read_function(self, attrs): + gfunction = self.__decl_factory.create_free_function() + self.__read_calldef( gfunction, attrs, True ) + return gfunction + + def __read_method(self, attrs): + mfunction = self.__decl_factory.create_member_function() + self.__read_member_function( mfunction, attrs, True ) + return mfunction + + def __read_destructor(self, attrs): + destructor = self.__decl_factory.create_destructor() + self.__read_member_function( destructor, attrs, True ) + destructor.name = '~' + destructor.name + return destructor + + def __read_free_operator(self, attrs ): + operator = self.__decl_factory.create_free_operator() + self.__read_member_function( operator, attrs, True ) + if 'new' in operator.name or 'delete' in operator.name: + operator.name = 'operator ' + operator.name + else: + operator.name = 'operator' + operator.name + return operator + + def __read_member_operator(self, attrs): + operator = self.__decl_factory.create_member_operator() + self.__read_member_function( operator, attrs, True ) + if 'new' in operator.name or 'delete' in operator.name: + operator.name = 'operator ' + operator.name + else: + operator.name = 'operator' + operator.name + return operator + + def __read_version(self, attrs): + logger = utils.loggers.cxx_parser + + version = float( attrs.get(XML_AN_CVS_REVISION, 0.6) ) + if version is None: + logger.info ( 'GCCXML version - 0.6' ) + self.__compiler = compilers.GCC_XML_06 + elif version <= 1.114: + logger.info ( 'GCCXML version - 0.7' ) + self.__compiler = compilers.GCC_XML_07 + elif version in ( 1.115, 1.116, 1.117, 1.118, 1.119, 1.120, 1.121 ): + logger.info ( 'GCCXML version - 0.9 BUGGY' ) + self.__compiler = compilers.GCC_XML_09_BUGGY + else: + logger.info ( 'GCCXML version - 0.9' ) + self.__compiler = compilers.GCC_XML_09 + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/source_reader.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/source_reader.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/source_reader.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/parser/source_reader.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,346 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +import sys +import linker +import config +import patcher +import pygccxml.utils + +try: #select the faster xml parser + from etree_scanner import etree_scanner_t as scanner_t +except: + from scanner import scanner_t + +import declarations_cache +from pygccxml import utils +from pygccxml.declarations import * + +class gccxml_runtime_error_t( RuntimeError ): + def __init__( self, msg ): + RuntimeError.__init__( self, msg ) + +def bind_aliases( decls ): + """ + This function binds between class and it's typedefs. + + @param decls: list of all declarations + @type all_classes: list of L{declaration_t} items + + @return: None + """ + visited = set() + typedefs = filter( lambda decl: isinstance( decl, typedef_t ), decls ) + for decl in typedefs: + type_ = remove_alias( decl.type ) + if not isinstance( type_, declarated_t ): + continue + cls_inst = type_.declaration + if not isinstance( cls_inst, class_types ): + continue + if id( cls_inst ) not in visited: + visited.add( id( cls_inst ) ) + del cls_inst.aliases[:] + cls_inst.aliases.append( decl ) + +class source_reader_t: + """ + This class reads C++ source code and returns declarations tree. + + This class is the only class that have an intime knowledge about GCC-XML. + It has only one responsibility: it calls GCC-XML with a source file specified + by user and creates declarations tree. The implementation of this class is split + to 2 classes: + + 1. L{scanner_t} - this class scans the "XML" file, generated by GCC-XML and + creates `pygccxml`_ declarations and types classes. After the xml file has + been processed declarations and type class instances keeps references to + each other using GCC-XML generated id's. + + 2. L{linker_t} - this class contains logic for replacing GCC-XML generated + ids with references to declarations or type class instances. + """ + def __init__( self, config, cache=None, decl_factory=None ): + """ + @param config: instance of L{config_t} class, that contains GCC-XML + configuration + @type config: L{config_t} + + @param cache: reference to cache object, that will be updated after + file has been parsed. + @param cache: instance of class, that derives from {cache_base_t} + + @param decl_factory: declarations factory, if not given default + declarations factory L{decl_factory_t} will be used + """ + self.logger = utils.loggers.cxx_parser + self.__search_directories = [] + self.__config = config + self.__search_directories.append( config.working_directory ) + self.__search_directories.extend( config.include_paths ) + if not cache: + cache = declarations_cache.dummy_cache_t() + self.__dcache = cache + self.__config.raise_on_wrong_settings() + self.__decl_factory = decl_factory + if not decl_factory: + self.__decl_factory = decl_factory_t() + + def __create_command_line(self, file, xmlfile): + assert isinstance( self.__config, config.config_t ) + #returns + cmd = [] + #first is gccxml executable + if 'win32' in sys.platform: + cmd.append( '"%s"' % os.path.normpath( self.__config.gccxml_path ) ) + else: + cmd.append( '%s' % os.path.normpath( self.__config.gccxml_path ) ) + + # Add all cflags passed + if self.__config.cflags != "": + cmd.append(" %s "%self.__config.cflags) + #second all additional includes directories + cmd.append( ''.join( [' -I"%s"' % search_dir for search_dir in self.__search_directories] ) ) + #third all additional defined symbols + cmd.append( ''.join( [' -D"%s"' % defined_symbol for defined_symbol in self.__config.define_symbols] ) ) + cmd.append( ''.join( [' -U"%s"' % undefined_symbol for undefined_symbol in self.__config.undefine_symbols] ) ) + #fourth source file + cmd.append( '"%s"' % file ) + #five destination file + cmd.append( '-fxml="%s"' % xmlfile ) + if self.__config.start_with_declarations: + cmd.append( '-fxml-start="%s"' % ','.join( self.__config.start_with_declarations ) ) + # Specify compiler if asked to + if self.__config.compiler: + cmd.append( " --gccxml-compiler %s" % self.__config.compiler ) + cmd_line = ' '.join(cmd) + if 'win32' in sys.platform : + cmd_line = '"%s"' % cmd_line + self.logger.info( 'gccxml cmd: %s' % cmd_line ) + return cmd_line + + def create_xml_file( self, header, destination=None ): + """ + This function will return the file name of the file, created by GCC-XML + for "header" file. If destination_file_path is not None, then this file + path will be used and returned. + + @param header: path to source file, that should be parsed + @type header: str + + @param destination: if given, will be used as target file/path for + GCC-XML generated file. + @type destination: str + + @return: path to GCC-XML generated file + """ + gccxml_file = destination + # If file specified, remove it to start else create new file name + if gccxml_file: + pygccxml.utils.remove_file_no_raise( gccxml_file ) + else: + gccxml_file = pygccxml.utils.create_temp_file_name( suffix='.xml' ) + try: + ffname = header + if not os.path.isabs( ffname ): + ffname = self.__file_full_name(header) + command_line = self.__create_command_line( ffname, gccxml_file ) + input_, output = os.popen4( command_line ) + input_.close() + gccxml_reports = [] + while True: + data = output.readline() + gccxml_reports.append( data ) + if not data: + break + exit_status = output.close() + gccxml_msg = ''.join(gccxml_reports) + if self.__config.ignore_gccxml_output: + if not os.path.isfile(gccxml_file): + raise gccxml_runtime_error_t( "Error occured while running GCC-XML: %s status:%s" % (gccxml_msg, exit_status) ) + else: + if gccxml_msg or exit_status or not os.path.isfile(gccxml_file): + raise gccxml_runtime_error_t( "Error occured while running GCC-XML: %s" % gccxml_msg ) + except Exception, error: + pygccxml.utils.remove_file_no_raise( gccxml_file ) + raise error + return gccxml_file + + def create_xml_file_from_string( self, content, destination=None ): + """ + Creates XML file from text. + + @param content: C++ source code + @type content: str + + @param destination: file name for GCC-XML generated file + @type destination: str + + @return: returns file name of GCC-XML generated file + """ + header_file = pygccxml.utils.create_temp_file_name( suffix='.h' ) + gccxml_file = None + try: + header_file_obj = file(header_file, 'w+') + header_file_obj.write( content ) + header_file_obj.close() + gccxml_file = self.create_xml_file( header_file, destination ) + finally: + pygccxml.utils.remove_file_no_raise( header_file ) + return gccxml_file + + def read_file( self, source_file ): + if isinstance( self.__config, config.gccxml_configuration_t ): + return self.read_gccxml_file( source_file ) + else: + return self.read_synopsis_file( source_file ) + + def read_gccxml_file(self, source_file): + """ + Reads C++ source file and returns declarations tree + + @param source_file: path to C++ source file + @type source_file: str + """ + declarations, types = None, None + gccxml_file = '' + try: + ffname = self.__file_full_name(source_file) + self.logger.debug( "Reading source file: [%s]." % ffname ) + declarations = self.__dcache.cached_value( ffname, self.__config ) + if not declarations: + self.logger.debug( "File has not been found in cache, parsing..." ) + gccxml_file = self.create_xml_file( ffname ) + declarations, files = self.__parse_gccxml_created_file( gccxml_file ) + self.__dcache.update( ffname, self.__config, declarations, files ) + else: + self.logger.debug( "File has not been changed, reading declarations from cache." ) + except Exception, error: + if gccxml_file: + pygccxml.utils.remove_file_no_raise( gccxml_file ) + raise error + if gccxml_file: + pygccxml.utils.remove_file_no_raise( gccxml_file ) + return declarations + + def read_xml_file(self, gccxml_created_file): + """ + Reads GCC-XML generated XML file. + + @param gccxml_created_file: path to GCC-XML generated file + @type gccxml_created_file: str + + @return: declarations tree + """ + assert(self.__config!=None) + + ffname = self.__file_full_name(gccxml_created_file) + self.logger.debug( "Reading xml file: [%s]" % gccxml_created_file ) + declarations = self.__dcache.cached_value( ffname, self.__config ) + if not declarations: + self.logger.debug( "File has not been found in cache, parsing..." ) + declarations, files = self.__parse_gccxml_created_file( ffname ) + self.__dcache.update( ffname, self.__config, declarations, [] ) + else: + self.logger.debug( "File has not been changed, reading declarations from cache." ) + + return declarations + + def read_string(self, content): + """ + Reads Python string, that contains valid C++ code, and returns + declarations tree. + """ + header_file = pygccxml.utils.create_temp_file_name( suffix='.h' ) + header_file_obj = file(header_file, 'w+') + header_file_obj.write( content ) + header_file_obj.close() + declarations = None + try: + declarations = self.read_file( header_file ) + except Exception, error: + pygccxml.utils.remove_file_no_raise( header_file ) + raise error + pygccxml.utils.remove_file_no_raise( header_file ) + return declarations + + def __file_full_name( self, file ): + if os.path.isfile( file ): + return file + for path in self.__search_directories: + file_path = os.path.join( path, file ) + if os.path.isfile( file_path ): + return file_path + raise RuntimeError( "pygccxml error: file '%s' does not exist" % file ) + + def __produce_full_file( self, file_path ): + if 'win' in sys.platform or 'linux' in sys.platform: + file_path = file_path.replace( r'\/', os.path.sep ) + if os.path.isabs( file_path ): + return file_path + try: + abs_file_path = os.path.realpath( os.path.join( self.__config.working_directory, file_path ) ) + if os.path.exists( abs_file_path ): + return os.path.normpath( abs_file_path ) + return file_path + except Exception: + return file_path + + def __parse_gccxml_created_file( self, gccxml_file ): + scanner_ = scanner_t( gccxml_file, self.__decl_factory ) + scanner_.read() + decls = scanner_.declarations() + types = scanner_.types() + files = {} + for file_id, file_path in scanner_.files().iteritems(): + files[file_id] = self.__produce_full_file(file_path) + linker_ = linker.linker_t( decls=decls + , types=types + , access=scanner_.access() + , membership=scanner_.members() + , files=files ) + for type_ in types.values(): + #I need this copy because internaly linker change types collection + linker_.instance = type_ + apply_visitor( linker_, type_ ) + for decl in decls.itervalues(): + linker_.instance = decl + apply_visitor( linker_, decl ) + bind_aliases( decls.itervalues() ) + #some times gccxml report typedefs defined in no namespace + #it happens for example in next situation + #template< typename X> + #void ddd(){ typedef typename X::Y YY;} + #if I will fail on this bug next time, the right way to fix it may be different + patcher.fix_calldef_decls( scanner_.calldefs(), scanner_.enums() ) + decls = filter( lambda inst: isinstance( inst, namespace_t ) and not inst.parent + , decls.itervalues() ) + return ( decls, files.values() ) + + def read_synopsis_file( self, source_file ): + import synopsis_scanner + from Synopsis import AST + from Synopsis.Parsers import Cxx + + ffname = self.__file_full_name(source_file) + + cppflags = [] + map( lambda dpath: cppflags.append( '-I %s' % dpath ) + , self.__config.include_paths ) + map( lambda define: cppflags.append( '-D %s' % define ) + , self.__config.define_symbols ) + map( lambda define: cppflags.append( '-U %s' % define ) + , self.__config.undefine_symbols ) + + cxx = Cxx.Parser( preprocess=True, cppflags=cppflags ) + ast = AST.AST() + cxx.process( ast, input=[source_file] ) + scanner = synopsis_scanner.scanner_t( ast, self.__decl_factory ) + scanner.visitAST( ast ) + declarations = [scanner.global_ns] + self.__dcache.update( ffname, self.__config, declarations, [] ) + return declarations + diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/fs_utils.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/fs_utils.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/fs_utils.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/fs_utils.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,136 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import os +from types import * + +##If you want include files that doesn't have extension then use filter like '*.' + +def _make_list( argument ): + if type(argument) in StringTypes: + if argument: + return [argument] + else: + return [] + elif type(argument) is ListType: + return argument + else: + raise TypeError( 'Argument "%s" must be or list of strings or string.' % argument ) + +class base_files_iterator: + def __init__(self, file_exts, is_include_exts = True): + self.__file_exts = _make_list( file_exts ) + self.__is_include_exts = is_include_exts + + def _is_to_skip(self, file_path): + if not self.__file_exts: + return 0 + file_ext = os.path.splitext( file_path )[1] + if not file_ext: + file_ext = '.' + file_ext + file_ext = '*' + file_ext + if file_ext.lower() in self.__file_exts: + return not self.__is_include_exts + else: + return self.__is_include_exts + + def _subdirectories_and_files(self, directory_path): + files, directories = [], [] + directory_contents = os.listdir(directory_path) + for object_name in directory_contents: + object_path = os.path.join(directory_path, object_name) + if os.path.isfile( object_path ) and not self._is_to_skip( object_path ): + files.append( object_path ) + elif os.path.isdir( object_path ): + directories.append( object_path ) + else: + pass + return directories, files + + def __iter__(self): + raise NotImplementedError + + def next(self): + raise NotImplementedError + + def restart(self): + raise NotImplementedError + +class files_walker(base_files_iterator): + def __init__(self, directories, file_ext_filter = '', is_include_filter = True, is_recursive = True): + base_files_iterator.__init__(self, file_ext_filter, is_include_filter) + self.__directories = _make_list( directories ) + self.__is_recursive = is_recursive + self.__file_generator = None + + def __walk(self): + directories = self.__directories[:] + while directories: + sub_directories, files = self._subdirectories_and_files( directories.pop(0) ) + if self.__is_recursive: + for directory in sub_directories: + directories.append( directory ) + for file_os in files: + yield file_os + + def __iter__(self): + self.__file_generator = self.__walk() + return self + + def next(self): + return self.__file_generator.next() + + def restart(self): + self.__file_generator = None + + +class directories_walker: + def __init__(self, directories, is_recursive = 1): + self.__directories = [] + for root in _make_list( directories ): + self.__directories.extend( self.__sub_directories( root ) ) + self.__is_recursive = is_recursive + self.__directory_generator = None + + def __sub_directories(self, directory_path): + sub_directories = [] + directory_contains = os.listdir(directory_path) + for object_in_directory in directory_contains: + full_path = os.path.join(directory_path, object_in_directory) + if os.path.isdir( full_path ): + sub_directories.append( full_path ) + return sub_directories + + def __walk(self): + directories = self.__directories[:] + for curr_directory in directories: + yield curr_directory + if self.__is_recursive: + for f in directories_walker( [curr_directory], True ): + yield f + + def __iter__(self): + self.__directory_generator = self.__walk() + return self + + def next(self): + return self.__directory_generator.next() + + def restart(self): + self.__directory_generator = None + + +if '__main__' == __name__: + pass + #lFileCount = 0 + #for file_os in files_iterator( r'C:\Program Files\Microsoft Visual Studio\VC98\Include\stlport', ['*.h', '*.'], True, False): + #print file_os + #lFileCount += 1 + #print lFileCount + + #~ for directory in directories_iterator( '/home/roman/language-binding', False ): + #~ print directory + #~ for directory in directories_iterator( '/home/roman/language-binding', True ): + #~ print directory diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/__init__.py otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/__init__.py --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/pygccxml/utils/__init__.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,156 @@ +# Copyright 2004-2008 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +""" +defines logger classes and few convinience methods, not related to the declarations +tree +""" + +import os +import sys +import logging +import tempfile +from fs_utils import files_walker +from fs_utils import directories_walker + +def _create_logger_( name ): + """implementation details""" + logger = logging.getLogger(name) + handler = logging.StreamHandler() + #handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s %(message)s' ) ) + handler.setFormatter( logging.Formatter( '%(levelname)s %(message)s' ) ) + logger.addHandler(handler) + logger.setLevel(logging.INFO) + return logger + +class loggers: + """class-namespace, defines few loggers classes, used in the project""" + + cxx_parser = _create_logger_( 'pygccxml.cxx_parser' ) + """logger for C++ parser functionality + + If you set this logger level to DEBUG, you will be able to see the exact + command line, used to invoke GCC-XML and errors that occures during XML parsing + """ + + gccxml = cxx_parser #backward compatability + + pdb_reader = _create_logger_( 'pygccxml.pdb_reader' ) + """logger for MS .pdb file reader functionality + """ + + + queries_engine = _create_logger_( 'pygccxml.queries_engine' ) + """logger for query engine functionality. + + If you set this logger level to DEBUG, you will be able to see what queries + you do against declarations tree, measure performance and may be even to improve it. + Query engine reports queries and whether they are optimized or not. + """ + + declarations_cache = _create_logger_( 'pygccxml.declarations_cache' ) + """logger for declarations tree cache functionality + + If you set this logger level to DEBUG, you will be able to see what is exactly + happens, when you read the declarations from cache file. You will be able to + decide, whether it worse for you to use this or that cache strategy. + """ + + root = logging.getLogger( 'pygccxml' ) + """root logger exists for your convinience only""" + + all = [ root, cxx_parser, queries_engine, declarations_cache, pdb_reader ] + """contains all logger classes, defined by the class""" + +def remove_file_no_raise(file_name ): + """removes file from disk, if exception is raised, it silently ignores it""" + try: + if os.path.exists(file_name): + os.remove( file_name ) + except Exception, error: + loggers.root.error( "Error ocured while removing temprorary created file('%s'): %s" + % ( file_name, str( error ) ) ) + +def create_temp_file_name(suffix, prefix=None, dir=None): + """small convinience function that creates temporal file. + + This function is a wrapper aroung Python built-in function - tempfile.mkstemp + """ + if not prefix: + prefix = tempfile.template + fd, name = tempfile.mkstemp( suffix=suffix, prefix=prefix, dir=dir ) + file_obj = os.fdopen( fd ) + file_obj.close() + return name + +def normalize_path( some_path ): + """return os.path.normpath( os.path.normcase( some_path ) )""" + return os.path.normpath( os.path.normcase( some_path ) ) + +def get_architecture(): + """returns computer architecture: 32 or 64. + + The guess is based on maxint. + """ + if sys.maxint == 2147483647: + return 32 + elif sys.maxint == 9223372036854775807: + return 64 + else: + raise RuntimeError( "Unknown architecture" ) + + +#The following code is cut-and-paste from this post: +#http://groups.google.com/group/comp.lang.python/browse_thread/thread/5b71896c06bd0f76/ +#Thanks to Michele Simionato, for it +class cached(property): + 'Convert a method into a cached attribute' + def __init__(self, method): + private = '_' + method.__name__ + def fget(s): + try: + return getattr(s, private) + except AttributeError: + value = method(s) + setattr(s, private, value) + return value + def fdel(s): + del s.__dict__[private] + super(cached, self).__init__(fget, fdel=fdel) + + @staticmethod + def reset(self): + cls = self.__class__ + for name in dir(cls): + attr = getattr(cls, name) + if isinstance(attr, cached): + delattr(self, name) + +class enum( object ): + """Usage example: + class fruits(enum): + apple = 0 + orange = 1 + + fruits.has_value( 1 ) + fruits.name_of( 1 ) + """ + + @classmethod + def has_value( cls, enum_numeric_value ): + for name, value in cls.__dict__.iteritems(): + if enum_numeric_value == value: + return True + else: + return False + + @classmethod + def name_of( cls, enum_numeric_value ): + for name, value in cls.__dict__.iteritems(): + if enum_numeric_value == value: + return name + else: + raise RuntimeError( 'Unable to find name for value(%d) in enumeration "%s"' + % ( enum_numeric_value, cls.__name__ ) ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/README-ITK.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/README-ITK.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/README-ITK.txt 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/pygccxml/src/README-ITK.txt 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,15 @@ +The Modules/ThirdParty/pygccxml/src/ +subdirectory contains a reduced distribution of the pygccxml source tree with +just the library source. + +This module is used by WrapITK to build the wrappings. We distribute our own +version so that the user does not have to install this dependency. +This module does not need to be compiled as it is a pure python module. +We do not allow (for the moment) the usage the systems pygccxml and rely +on the one shipped here. + +See Modules/ThirdParty/VNL/src/README-ITK.txt for update procedure of the +snapshot using a subtree merge. + +The last merged upstream snapshot commit hash is: +9f6f8dfecd74fdec274c1dbc273f785b529b5909 diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/config/cmake/config/vxl_shared_link_test/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/config/cmake/config/vxl_shared_link_test/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/config/cmake/config/vxl_shared_link_test/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/config/cmake/config/vxl_shared_link_test/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,8 +1,14 @@ # vxl/config/cmake/config/vxl_shared_link_test/CMakeLists.txt # - +cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) +IF(POLICY CMP0025) + CMAKE_POLICY(SET CMP0025 NEW) +ENDIF() +IF(POLICY CMP0042) + CMAKE_POLICY(SET CMP0042 NEW) +ENDIF() PROJECT(vxl_pic_compatible) ADD_LIBRARY(cmTryCompileStaticLib STATIC static_src.cxx) ADD_LIBRARY(cmTryCompileSharedLib SHARED shared_src.cxx) -TARGET_LINK_LIBRARIES(cmTryCompileSharedLib cmTryCompileStaticLib ${LINK_LIBRARIES}) \ No newline at end of file +TARGET_LINK_LIBRARIES(cmTryCompileSharedLib cmTryCompileStaticLib ${LINK_LIBRARIES}) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_sparse_lm.cxx otb-4.2.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_sparse_lm.cxx --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_sparse_lm.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/algo/tests/test_sparse_lm.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -630,7 +630,7 @@ // initial perturbed parameters, add random gaussian noise vnl_vector init_a(a_data,12), init_b(b_data,50); double sigma_pos = 1.0, sigma_ang = 0.1; - vnl_random rnd; + vnl_random rnd(1234); for (unsigned i=0; ifailure_code_ = CONVERGED_FTOL; } - else if (vcl_strncmp("CONVERGENCE: NORM OF PROJECTED GRADIENT <= PGTOL", + else if (vcl_strncmp("CONVERGENCE:_NORM_OF_PROJECTED_GRADIENT_<=_PGTOL", task, 48) == 0) { // gradient tolerance reached diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_diag_matrix.h otb-4.2.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_diag_matrix.h --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_diag_matrix.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_diag_matrix.h 2014-09-03 08:29:34.000000000 +0000 @@ -79,15 +79,8 @@ return (i != j) ? T(0) : diagonal_[i]; } - inline T& operator () (unsigned i, -//Need to avoid compiler bug by not supplying the value of j unless checking the assert. -#ifdef NDEBUG -unsigned -#else -unsigned j -#endif -) { - assert(i == j); + inline T& operator () (unsigned i, unsigned j) { + assert(i == j); (void)j; return diagonal_[i]; } inline T& operator() (unsigned i) { return diagonal_[i]; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/ZLIB/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/ZLIB/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/ZLIB/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/ZLIB/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -26,7 +26,7 @@ itk_module_impl() -if(NOT ITK_INSTALL_NO_DEVELOPMENT) - install(FILES ${ITKZLIB_BINARY_DIR}/src/itk_zlib.h - DESTINATION ${ITKZLIB_INSTALL_INCLUDE_DIR}) -endif(NOT ITK_INSTALL_NO_DEVELOPMENT) +install(FILES ${ITKZLIB_BINARY_DIR}/src/itk_zlib.h + DESTINATION ${ITKZLIB_INSTALL_INCLUDE_DIR} + COMPONENT Development + ) diff -Nru otb-4.0.0/Utilities/ITK/Modules/ThirdParty/ZLIB/src/itkzlib/CMakeLists.txt otb-4.2.0/Utilities/ITK/Modules/ThirdParty/ZLIB/src/itkzlib/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Modules/ThirdParty/ZLIB/src/itkzlib/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/ThirdParty/ZLIB/src/itkzlib/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -34,21 +34,17 @@ set_target_properties(itkzlib PROPERTIES ${ITK_LIBRARY_PROPERTIES}) endif(ITK_LIBRARY_PROPERTIES) -if(NOT ITK_INSTALL_NO_LIBRARIES) - install(TARGETS itkzlib - EXPORT ${ITK3P_INSTALL_EXPORT_NAME} - RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries - LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries - ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development - ) -endif(NOT ITK_INSTALL_NO_LIBRARIES) +install(TARGETS itkzlib + EXPORT ${ITK3P_INSTALL_EXPORT_NAME} + RUNTIME DESTINATION ${ITK3P_INSTALL_RUNTIME_DIR} COMPONENT RuntimeLibraries + LIBRARY DESTINATION ${ITK3P_INSTALL_LIBRARY_DIR} COMPONENT RuntimeLibraries + ARCHIVE DESTINATION ${ITK3P_INSTALL_ARCHIVE_DIR} COMPONENT Development + ) -if(NOT ITK_INSTALL_NO_DEVELOPMENT) - install(FILES - ${ITK3P_ZLIB_SOURCE_DIR}/zlib.h - ${ITK3P_ZLIB_SOURCE_DIR}/zconf.h - ${ITK3P_ZLIB_SOURCE_DIR}/itk_zlib_mangle.h - ${ITK3P_ZLIB_BINARY_DIR}/zlibDllConfig.h - DESTINATION ${ITK3P_INSTALL_INCLUDE_DIR}/itkzlib # itk_zlib.h #include "itkzlib/zlib.h" - COMPONENT Development) -endif(NOT ITK_INSTALL_NO_DEVELOPMENT) +install(FILES + ${ITK3P_ZLIB_SOURCE_DIR}/zlib.h + ${ITK3P_ZLIB_SOURCE_DIR}/zconf.h + ${ITK3P_ZLIB_SOURCE_DIR}/itk_zlib_mangle.h + ${ITK3P_ZLIB_BINARY_DIR}/zlibDllConfig.h + DESTINATION ${ITK3P_INSTALL_INCLUDE_DIR}/itkzlib # itk_zlib.h #include "itkzlib/zlib.h" + COMPONENT Development) diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.h otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.h --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.h 2014-09-03 08:29:34.000000000 +0000 @@ -95,7 +95,7 @@ /**-PROTECTED METHODS------------------------------------------------------*/ RingBuffer(); virtual ~RingBuffer(); - void PrintSelf(std::ostream &os, Indent indent) const; + virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE; /** Get the proper buffer index from an offset */ OffsetValueType GetOffsetBufferIndex(OffsetValueType offset); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.hxx otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.hxx --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkRingBuffer.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -183,7 +183,7 @@ { for (size_t i = 0; i < n - currentSize; ++i) { - ElementPointer newPointer = NULL; + ElementPointer newPointer = ITK_NULLPTR; this->m_PointerVector.insert( this->m_PointerVector.begin() + this->m_HeadIndex, newPointer ); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalDataObject.h otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalDataObject.h --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalDataObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalDataObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -85,23 +85,23 @@ * buffered region */ virtual const TemporalRegionType GetUnbufferedRequestedTemporalRegion(); - virtual void SetRequestedRegionToLargestPossibleRegion(); + virtual void SetRequestedRegionToLargestPossibleRegion() ITK_OVERRIDE; - virtual bool RequestedRegionIsOutsideOfTheBufferedRegion(); + virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() ITK_OVERRIDE; - virtual bool VerifyRequestedRegion(); + virtual bool VerifyRequestedRegion() ITK_OVERRIDE; - virtual void CopyInformation(const DataObject *); + virtual void CopyInformation(const DataObject *) ITK_OVERRIDE; - virtual void SetRequestedRegion(const DataObject *); + virtual void SetRequestedRegion(const DataObject *) ITK_OVERRIDE; - virtual void Graft(const DataObject *); + virtual void Graft(const DataObject *) ITK_OVERRIDE; protected: TemporalDataObject(); virtual ~TemporalDataObject(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Buffer for holding component data objects */ BufferType::Pointer m_DataObjectBuffer; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalProcessObject.h otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalProcessObject.h --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalProcessObject.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalProcessObject.h 2014-09-03 08:29:34.000000000 +0000 @@ -81,11 +81,11 @@ /** Override EnlargeOutputRequestedRegion, GenerateOutputRequestedRegion, and * GenerateInputRequestedRegion to handle temporal regions */ - virtual void EnlargeOutputRequestedRegion(DataObject* output); + virtual void EnlargeOutputRequestedRegion(DataObject* output) ITK_OVERRIDE; - virtual void GenerateOutputRequestedRegion(DataObject* output); + virtual void GenerateOutputRequestedRegion(DataObject* output) ITK_OVERRIDE; - virtual void GenerateInputRequestedRegion(); + virtual void GenerateInputRequestedRegion() ITK_OVERRIDE; /** Get the number of frames of input required to produce output. We don't * provide a Set method because we want some filters to be able to hold this @@ -102,7 +102,7 @@ * temporal region based on the largest possible temporal region of the input, * the unit input/output sizes for the process, and the number of frames * skipped per output*/ - virtual void UpdateOutputInformation(); + virtual void UpdateOutputInformation() ITK_OVERRIDE; /** Override ProcessObject's implementation of UpdateOutputData. This is * necessary because by default ProcessObject propagates the call to its @@ -115,7 +115,7 @@ * * Code: this->ProcessObject::UpdateOutputData( output ) */ - virtual void UpdateOutputData(DataObject* output); + virtual void UpdateOutputData(DataObject* output) ITK_OVERRIDE; /** Override GenerateData to do temporal region streaming. This is analogous * to the ThreadedGenerateData system implemented in ImageSource, but it @@ -127,7 +127,7 @@ * the requested temporal region of the input to each input requested * temporal sub-region (in sequence) and re-propagate the temporal region * request up the pipeline. */ - virtual void GenerateData(); + virtual void GenerateData() ITK_OVERRIDE; /** TemporalStreamingGenerateData is in charge of producing output for a * single portion of the output requested temporal region. This is where @@ -149,7 +149,7 @@ } /** ITK print mechanism */ - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Explicitly handle temporal regions in EnlargeRequestedRegion. The default * implementation makes sure that the output requested temporal region is diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalRegion.h otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalRegion.h --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalRegion.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkTemporalRegion.h 2014-09-03 08:29:34.000000000 +0000 @@ -68,7 +68,7 @@ FrameOffsetType GetFrameDuration() const; /** Return RegionType (SRUCTURED_REGION) */ - virtual RegionType GetRegionType() const; + virtual RegionType GetRegionType() const ITK_OVERRIDE; /** Constructor */ TemporalRegion(); @@ -89,7 +89,7 @@ protected: - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Time boundaries */ RealTimeStamp m_RealStart; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.h otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.h --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.h 2014-09-03 08:29:34.000000000 +0000 @@ -99,7 +99,7 @@ * multiple types of output must override this to return the proper type. */ typedef ProcessObject::DataObjectPointerArraySizeType DataObjectPointerArraySizeType; using Superclass::MakeOutput; - virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx); + virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx) ITK_OVERRIDE; protected: @@ -114,14 +114,14 @@ * mid-pipeline filters will always have their outputs' requested spatial * regions set by the GenerateInputRequestedRegion call from the filter one * further down the pipeline. */ - virtual void GenerateOutputRequestedTemporalRegion(TemporalDataObject* output); + virtual void GenerateOutputRequestedTemporalRegion(TemporalDataObject* output) ITK_OVERRIDE; /** We override the default implementation of TemporalStreamingGenerateData * from TemporalProcessObject to provide functionality for spatial streaming. * This implementation works exactly the same way as the implementation of * GenerateData in ImageSource. The filter-specific implementation of * ThreadedGenerateData will be responsible of accessing the correct frames. */ - virtual void TemporalStreamingGenerateData(); + virtual void TemporalStreamingGenerateData() ITK_OVERRIDE; /** ThreadedGenerateData here serves the same symnatic purpose as * ThreadedGenerateData in ProcessObjects that handle Images. This is to say @@ -173,7 +173,7 @@ VideoSource(); virtual ~VideoSource(); - virtual void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; private: diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.hxx otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.hxx --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkVideoSource.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -69,7 +69,7 @@ if (this->GetNumberOfOutputs() < 1) { itkWarningMacro("No outputs set"); - return NULL; + return ITK_NULLPTR; } // Return the output @@ -87,7 +87,7 @@ (this->TemporalProcessObject::GetOutput(idx) ); // Make sure there is at least 1 output - if (out == NULL) + if (out == ITK_NULLPTR) { itkWarningMacro("dynamic_cast to output type failed"); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkVideoStream.h otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkVideoStream.h --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/include/itkVideoStream.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/include/itkVideoStream.h 2014-09-03 08:29:34.000000000 +0000 @@ -273,7 +273,7 @@ * just copies the meta information using TemporalProcessObject's Graft then * sets the internal RingBuffer pointer to point to the same buffer used by * the other VideoStream. */ - virtual void Graft(const DataObject* data); + virtual void Graft(const DataObject* data) ITK_OVERRIDE; protected: @@ -281,7 +281,7 @@ } virtual ~VideoStream() { } - virtual void PrintSelf(std::ostream & os, Indent indent) const + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE { Superclass::Print(os, indent); } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Core/src/itkTemporalDataObject.cxx otb-4.2.0/Utilities/ITK/Modules/Video/Core/src/itkTemporalDataObject.cxx --- otb-4.0.0/Utilities/ITK/Modules/Video/Core/src/itkTemporalDataObject.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Core/src/itkTemporalDataObject.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -249,7 +249,6 @@ itkExceptionMacro( << "itk::TemporalDataObject::" << "RequestedRegionIsOutsideOfTheBufferedRegion() " << "Invalid Temporal Unit" ); - return true; } } @@ -283,7 +282,6 @@ default: itkExceptionMacro( << "itk::TemporalDataObject::VerifyRequestedRegion() " << "Invalid Temporal Unit" ); - return false; } } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/Filtering/include/itkImageFilterToVideoFilterWrapper.hxx otb-4.2.0/Utilities/ITK/Modules/Video/Filtering/include/itkImageFilterToVideoFilterWrapper.hxx --- otb-4.0.0/Utilities/ITK/Modules/Video/Filtering/include/itkImageFilterToVideoFilterWrapper.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/Filtering/include/itkImageFilterToVideoFilterWrapper.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ this->TemporalProcessObject::m_FrameSkipPerOutput = 1; // Initialize image filter to NULL - m_ImageFilter = NULL; + m_ImageFilter = ITK_NULLPTR; } // diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIOFactory.h otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIOFactory.h --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIOFactory.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIOFactory.h 2014-09-03 08:29:34.000000000 +0000 @@ -38,9 +38,9 @@ typedef SmartPointer< const Self > ConstPointer; /** Class methods used to interface with the registered factories. */ - virtual const char * GetITKSourceVersion(void) const; + virtual const char * GetITKSourceVersion(void) const ITK_OVERRIDE; - virtual const char * GetDescription(void) const; + virtual const char * GetDescription(void) const ITK_OVERRIDE; /** Method for class instantiation. */ itkFactorylessNewMacro(Self); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIO.h otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIO.h --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIO.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkFileListVideoIO.h 2014-09-03 08:29:34.000000000 +0000 @@ -50,7 +50,7 @@ itkTypeMacro(FileListVideoIO, Superclass); /** Close the reader and writer and reset members */ - virtual void FinishReadingOrWriting(); + virtual void FinishReadingOrWriting() ITK_OVERRIDE; /** Split up the input file names -- This is public so that places where * FileListVideoIO is used can access the individual file names. This is @@ -60,27 +60,27 @@ /*-------- This part of the interface deals with reading data. ------ */ /** Set to reading from file */ - virtual void SetReadFromFile(); + virtual void SetReadFromFile() ITK_OVERRIDE; /** Set to reading from a camera */ - virtual void SetReadFromCamera(); + virtual void SetReadFromCamera() ITK_OVERRIDE; /** Determine the file type. Returns true if this ImageIO can read the * file specified. */ - virtual bool CanReadFile(const char *); + virtual bool CanReadFile(const char *) ITK_OVERRIDE; /** Return whether or not the VideoIO can read from a camera */ - virtual bool CanReadCamera( CameraIDType cameraID )const; + virtual bool CanReadCamera( CameraIDType cameraID )const ITK_OVERRIDE; /** Set the spacing and dimension information for the set filename. */ - virtual void ReadImageInformation(); + virtual void ReadImageInformation() ITK_OVERRIDE; /** Reads the data from disk into the memory buffer provided. */ - virtual void Read(void *buffer); + virtual void Read(void *buffer) ITK_OVERRIDE; /** Set the next frame that should be read. Return true if you operation * successful */ - virtual bool SetNextFrameToRead(FrameOffsetType frameNumber); + virtual bool SetNextFrameToRead(FrameOffsetType frameNumber) ITK_OVERRIDE; /** Accessor functions for video specific information */ itkGetConstMacro(PositionInMSec,TemporalOffsetType); @@ -92,42 +92,42 @@ itkGetConstMacro(LastIFrame,FrameOffsetType); /** Override SetFileName to do parsing */ - virtual void SetFileName(const std::string& fileList); - virtual void SetFileName(const char* fileList); + virtual void SetFileName(const std::string& fileList) ITK_OVERRIDE; + virtual void SetFileName(const char* fileList) ITK_OVERRIDE; /** Override Accessors to pass through to internal image reader */ - virtual double GetSpacing(unsigned int i) const; + virtual double GetSpacing(unsigned int i) const ITK_OVERRIDE; - virtual double GetOrigin(unsigned int i) const; + virtual double GetOrigin(unsigned int i) const ITK_OVERRIDE; - virtual std::vector< double > GetDirection(unsigned int i) const; + virtual std::vector< double > GetDirection(unsigned int i) const ITK_OVERRIDE; /*-------- This part of the interfaces deals with writing data. ----- */ /** Determine the file type. Returns true if this ImageIO can write the * file specified. */ - virtual bool CanWriteFile(const char *); + virtual bool CanWriteFile(const char *) ITK_OVERRIDE; /** Writes the spacing and dimensions of the image. * Assumes SetFileName has been called with a valid file name. */ - virtual void WriteImageInformation(); + virtual void WriteImageInformation() ITK_OVERRIDE; /** Writes the data to disk from the memory buffer provided. Make sure * that the IORegion has been set properly. */ - virtual void Write(const void *buffer); + virtual void Write(const void *buffer) ITK_OVERRIDE; /** Set Writer Parameters */ virtual void SetWriterParameters( TemporalRatioType framesPerSecond, const std::vector& dim, const char* fourCC, unsigned int nChannels, - IOComponentType componentType ); + IOComponentType componentType ) ITK_OVERRIDE; protected: FileListVideoIO(); ~FileListVideoIO(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Reset member variables to empty state closed */ void ResetMembers(); diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileReader.hxx otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileReader.hxx --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileReader.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileReader.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -37,7 +37,7 @@ { // Initialize members m_FileName = ""; - m_VideoIO = NULL; + m_VideoIO = ITK_NULLPTR; m_PixelConversionNeeded = false; m_IFrameSafe = true; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.h otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.h --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.h 2014-09-03 08:29:34.000000000 +0000 @@ -100,11 +100,11 @@ /** Aliased to the Write() method to be consistent with the rest of the * pipeline. */ - virtual void Update(); + virtual void Update() ITK_OVERRIDE; /** Write the entire video to a file, if possible. This is the same as * calling write or update without setting an output temporal region. */ - virtual void UpdateLargestPossibleRegion(); + virtual void UpdateLargestPossibleRegion() ITK_OVERRIDE; protected: @@ -112,7 +112,7 @@ VideoFileWriter(); virtual ~VideoFileWriter(); - void PrintSelf(std::ostream &os, Indent indent) const; + virtual void PrintSelf(std::ostream &os, Indent indent) const ITK_OVERRIDE; /** Initialize output parameters */ bool InitializeOutputParameters(); @@ -123,7 +123,7 @@ bool InitializeVideoIO(); /** Override TemporalStreamingGenerateData to do the actual writing. */ - virtual void TemporalStreamingGenerateData(); + virtual void TemporalStreamingGenerateData() ITK_OVERRIDE; /**-PROTECTED MEMBERS------------------------------------------------------*/ diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.hxx otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.hxx --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoFileWriter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -34,14 +34,13 @@ // template< typename TInputVideoStream > VideoFileWriter< TInputVideoStream > -::VideoFileWriter() +::VideoFileWriter() : + m_FileName(""), + m_VideoIO(ITK_NULLPTR), + m_FramesPerSecond(24), + m_FourCC("MP42"), + m_NumberOfComponents(0) { - // Initialize members - m_FileName = ""; - m_VideoIO = NULL; - m_FramesPerSecond = 24; // Default to 24 fps - m_FourCC = "MP42"; // Default to Mpeg 4 v2 - // TemporalProcessObject inherited members this->TemporalProcessObject::m_UnitInputNumberOfFrames = 1; this->TemporalProcessObject::m_UnitOutputNumberOfFrames = 1; @@ -102,7 +101,7 @@ { if (this->GetNumberOfInputs() < 1) { - return NULL; + return ITK_NULLPTR; } return static_cast(this->ProcessObject::GetInput(0)); @@ -135,7 +134,7 @@ // Make sure input is available const VideoStreamType* input = this->GetInput(); - if (input == NULL) + if (input == ITK_NULLPTR) { itkExceptionMacro("No input to writer"); } @@ -272,7 +271,7 @@ ::UpdateLargestPossibleRegion() { const VideoStreamType* input = this->GetInput(); - if (input == NULL) + if (input == ITK_NULLPTR) { itkExceptionMacro("No input to writer"); } @@ -320,7 +319,7 @@ ::InitializeOutputParameters() { // InputImage and VideoIO must be valid - if (this->GetInput() == NULL) + if (this->GetInput() == ITK_NULLPTR) { return false; } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoIOBase.h otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoIOBase.h --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/include/itkVideoIOBase.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/include/itkVideoIOBase.h 2014-09-03 08:29:34.000000000 +0000 @@ -114,7 +114,7 @@ VideoIOBase(); virtual ~VideoIOBase(); - void PrintSelf(std::ostream & os, Indent indent) const; + virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE; /** Member Variables */ ReadType m_ReadType; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/src/itkFileListVideoIO.cxx otb-4.2.0/Utilities/ITK/Modules/Video/IO/src/itkFileListVideoIO.cxx --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/src/itkFileListVideoIO.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/src/itkFileListVideoIO.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -526,7 +526,7 @@ // void FileListVideoIO::ResetMembers() { - m_ImageIO = NULL; + m_ImageIO = ITK_NULLPTR; m_FileNames.clear(); m_WriterOpen = false; m_ReaderOpen = false; diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOBase.cxx otb-4.2.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOBase.cxx --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOBase.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOBase.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -24,7 +24,17 @@ namespace itk { -VideoIOBase::VideoIOBase() +VideoIOBase::VideoIOBase() : + m_ReadType(ReadFromFile), + m_FramesPerSecond(0.0), + m_FrameTotal(NumericTraits::Zero), + m_CurrentFrame(NumericTraits::Zero), + m_IFrameInterval(NumericTraits::Zero), + m_LastIFrame(NumericTraits::Zero), + m_Ratio(0.0), + m_PositionInMSec(0.0), + m_WriterOpen(false), + m_ReaderOpen(false) { } diff -Nru otb-4.0.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOFactory.cxx otb-4.2.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOFactory.cxx --- otb-4.0.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOFactory.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Modules/Video/IO/src/itkVideoIOFactory.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -83,7 +83,7 @@ } // Didn't find a usable VideoIO - return NULL; + return ITK_NULLPTR; } diff -Nru otb-4.0.0/Utilities/ITK/README.OTB.txt otb-4.2.0/Utilities/ITK/README.OTB.txt --- otb-4.0.0/Utilities/ITK/README.OTB.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/README.OTB.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -Update of ITK in OTB source tree -================================ - -#Perhpas better to update internal ITK using the archive .tar.gz - -# Remove old version -find Utilities/ITK -type f -not -name "README.OTB.txt" | xargs rm -find Utilities/ITK/* -type d | xargs rm -r - -# Copy new version -cp -R /home/jmalik/dev/src/ITK/* Utilities/ITK - -# git files -rm -rf Utilities/ITK/.git* -rm -rf Utilities/ITK/Modules/Remote/.gitignore -rm -rf Utilities/ITK/Modules/External/.gitignore -rm -rf Utilities/ITK/Modules/ThirdParty/.gitattributes - -# Remove ITK module test code -find Utilities/ITK -type d | grep -v vxl_shared_link_test | grep test$ | xargs rm -rf - -# Remove ThirdParty code we don't need -rm -rf Utilities/ITK/Modules/ThirdParty/DCMTK -rm -rf Utilities/ITK/Modules/ThirdParty/DICOMParser -rm -rf Utilities/ITK/Modules/ThirdParty/GDCM -rm -rf Utilities/ITK/Modules/ThirdParty/GIFTI -rm -rf Utilities/ITK/Modules/ThirdParty/HDF5 -rm -rf Utilities/ITK/Modules/ThirdParty/JPEG -rm -rf Utilities/ITK/Modules/ThirdParty/MINC -rm -rf Utilities/ITK/Modules/ThirdParty/NIFTI -rm -rf Utilities/ITK/Modules/ThirdParty/NrrdIO -rm -rf Utilities/ITK/Modules/ThirdParty/OpenJPEG -rm -rf Utilities/ITK/Modules/ThirdParty/PNG -rm -rf Utilities/ITK/Modules/ThirdParty/TIFF - -# Remove IO modules code we don't need -find Utilities/ITK/Modules/IO -maxdepth 1 -mindepth 1 -type d | grep -v ImageBase | xargs rm -rf - -rm -rf Utilities/ITK/Modules/Core/TestKernel -rm -rf Utilities/ITK/Modules/Bridge -rm -rf Utilities/ITK/Modules/Numerics/FEM -rm -rf Utilities/ITK/Modules/Nonunit/Review -rm -rf Utilities/ITK/Modules/Segmentation/LevelSetsv4Visualization -rm -rf Utilities/ITK/Modules/Registration/FEM -rm -rf Utilities/ITK/Modules/Compatibility/Deprecated - - -# Remaining ThirdParty : -DoubleConversion (needed by Common) -Expat (needed by MetaIO) -KWSys (needed by Common) -MetaIO (needed by SpatialObjects) -Netlib (needed by Statistics) -VNL (needed by VNLInstantiation Netlib) -VNLInstantiation (needed by Common) -ZLIB (needed by MetaIO) - - - -# Remove directory we don't use in OTB -rm -rf Utilities/ITK/Documentation -rm -rf Utilities/ITK/Examples -rm -rf Utilities/ITK/Testing -rm -rf Utilities/ITK/Utilities/Dart -rm -rf Utilities/ITK/Utilities/DevelopmentSetupScripts -rm -rf Utilities/ITK/Utilities/Git -rm -rf Utilities/ITK/Utilities/Hooks -rm -rf Utilities/ITK/Utilities/InstallTest -rm Utilities/ITK/Utilities/SetupForDevelopment.sh - -# Check that everything is working properly by compiling OTB with internal ITK -# and run some tests - -# Commit those changes in one commit. Use the -A option of hg commit to -# add/remove new/old files in ITK - - - - diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Doxygen/CMakeLists.txt otb-4.2.0/Utilities/ITK/Utilities/Doxygen/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Utilities/Doxygen/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Doxygen/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -135,25 +135,24 @@ DEPENDS "${ITK_SOURCE_DIR}/Examples" "${ITK_SOURCE_DIR}/Utilities/Doxygen/GenerateExamplesDox.cmake" ) + add_custom_target(Documentation ALL + COMMAND ${DOXYGEN_EXECUTABLE} ${ITK_BINARY_DIR}/Utilities/Doxygen/doxygen.config + MAIN_DEPENDENCY ${ITK_BINARY_DIR}/Utilities/Doxygen/doxygen.config + DEPENDS ${ITK_BINARY_DIR}/Utilities/Doxygen/itkdoxygen.pl + DEPENDS ${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox + WORKING_DIRECTORY ${ITK_BINARY_DIR}/Utilities/Doxygen + ) # Somehow the logo image is not copied into the html folder. # Here we ensure that the logo image ends up in the right directory # where html pages could find it. add_custom_command(TARGET Documentation + POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${ITK_SOURCE_DIR}/Documentation/Art/itkLogoSmall.jpg # logo ${ITK_DOXYGEN_OUTPUT_DIR}/html # output doxygen directory ) - add_custom_target(Documentation ALL - COMMAND ${DOXYGEN_EXECUTABLE} ${ITK_BINARY_DIR}/Utilities/Doxygen/doxygen.config - MAIN_DEPENDENCY ${ITK_BINARY_DIR}/Utilities/Doxygen/doxygen.config - DEPENDS ${ITK_BINARY_DIR}/Utilities/Doxygen/itkdoxygen.pl - DEPENDS ${ITK_BINARY_DIR}/Documentation/Doxygen/Examples.dox - WORKING_DIRECTORY ${ITK_BINARY_DIR}/Utilities/Doxygen - ) - - message( STATUS "To generate Doxygen's documentation, you need to build the Documentation target" ) diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Doxygen/doxygen.config.in otb-4.2.0/Utilities/ITK/Utilities/Doxygen/doxygen.config.in --- otb-4.0.0/Utilities/ITK/Utilities/Doxygen/doxygen.config.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Doxygen/doxygen.config.in 2014-09-03 08:29:34.000000000 +0000 @@ -1972,11 +1972,12 @@ "itkSetConstObjectMacro(name,type)= virtual void Set##name ( const type* _arg);" \ "itkGetConstObjectMacro(name,type)= virtual const type* Get##name () const;" \ "itkGetModifiableObjectMacro(name,type)= virtual type* GetModifiable##name (); virtual const type* Get##name () const;" \ - "itkGetConstReferenceMacro(name,type)= virtual const type& Get##name ();" \ + "itkGetConstReferenceMacro(name,type)= virtual const type& Get##name () const;" \ "itkSetEnumMacro(name,type)= virtual void Set##name (const type _arg);" \ "itkGetEnumMacro(name,type)= virtual type Get##name () const;" \ "itkGetConstReferenceObjectMacro(name,type)= virtual const type::Pointer& Get##name () const;" \ "itkSetDecoratedInputMacro(name, type, number)= virtual void Set##name##Input(const SimpleDataObjectDecorator *_arg); virtual void SetInput##number(const SimpleDataObjectDecorator *_arg); virtual const SimpleDataObjectDecorator * Get##name##Input() const; virtual const SimpleDataObjectDecorator * GetInput##number() const; virtual void Set##name(const type &_arg);" \ + "itkSetGetDecoratedInputMacro(name, type, number)= virtual void Set##name##Input(const SimpleDataObjectDecorator< type > *_arg); virtual void Set##name(const type &_arg); virtual const SimpleDataObjectDecorator< type > * Get##name##Input() const; virtual const type & Get##name() const; " \ "itkSetDecoratedObjectInputMacro(name, type, number)= virtual void Set##name##Input(const DataObjectDecorator *_arg); virtual void SetInput##number(const DataObjectDecorator *_arg); virtual const DataObjectDecorator * Get##name##Input() const; virtual const DataObjectDecorator * GetInput##number() const; virtual void Set##name(const type *_arg);" \ "itkBooleanMacro(name)= virtual void name##On (); virtual void name##Off ();" \ "itkSetVector2Macro(name,type)= virtual void Set##name (type _arg1, type _arg2) virtual void Set##name (type _arg[2]);" \ @@ -1999,7 +2000,7 @@ "itkEventMacro(thisClass,superclass)= class thisClass : public superclass {};" \ "itkDeclareExceptionMacro(newexcp,parentexcp,whatmessage)= namespace itk { class newexcp : public parentexcp { public: newexcp( const char *file, unsigned int lineNumber ) : parentexcp( file, lineNumber ) { this->SetDescription( whatmessage ); } newexcp( const std::string & file, unsigned int lineNumber ) : parentexcp( file, lineNumber ) { this->SetDescription( whatmessage ); } itkTypeMacro( newexcp, , parentexcp); }; }" \ "itkConceptMacro(thisName,thisConcept)= /** This class requires thisName in the form of thisConcept */ typedef thisConcept thisName;" \ - "vcl_numeric_limits= std::numeric_limits" \ + "std::numeric_limits= std::numeric_limits" \ "ITK_TYPENAME= typename" \ "itkTemplateFloatingToIntegerMacro(name)= template name( TInput x )" \ "FEM_ABSTRACT_CLASS(thisClass,parentClass)= public: /** Standard Self typedef.*/ typedef thisClass Self; /** Standard Superclass typedef. */ typedef parentClass Superclass; /** Pointer or SmartPointer to an object. */ typedef Self* Pointer; /** Const pointer or SmartPointer to an object. */ typedef const Self* ConstPointer; private:" \ @@ -2016,7 +2017,8 @@ "ITK_USE_FFTWF" \ "ITK_USE_CONCEPT_CHECKING" \ "__itkMacro_h" \ - "ITK_LEGACY_REMOVE" + "ITK_LEGACY_REMOVE" \ + "ITKCommon_EXPORT_EXPLICIT" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff -Nru otb-4.0.0/Utilities/ITK/Utilities/KWStyle/KWStyle.cmake otb-4.2.0/Utilities/ITK/Utilities/KWStyle/KWStyle.cmake --- otb-4.0.0/Utilities/ITK/Utilities/KWStyle/KWStyle.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/KWStyle/KWStyle.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,12 +1,13 @@ - -find_package(KWStyle 1.0.1 - QUIET - ) -option(ITK_USE_KWSTYLE - "Enable the use of KWStyle for checking coding style." - ${KWSTYLE_FOUND} # default - ) -mark_as_advanced(ITK_USE_KWSTYLE) +if(NOT DEFINED ITK_USE_KWSTYLE) + find_package(KWStyle 1.0.1 + QUIET + ) + option(ITK_USE_KWSTYLE + "Enable the use of KWStyle for checking coding style." + ${KWSTYLE_FOUND} # default + ) + mark_as_advanced(ITK_USE_KWSTYLE) +endif(NOT DEFINED ITK_USE_KWSTYLE) if(ITK_USE_KWSTYLE) find_package(KWStyle 1.0.1 @@ -15,24 +16,24 @@ ) # Define and configure configuration files - set(KWSTYLE_ITK_CONFIGURATION_FILE + set(kwstyle_itk_configuration_file ${ITK_SOURCE_DIR}/Utilities/KWStyle/ITK.kws.xml ) - set(KWSTYLE_ITK_CODE_FILES_LIST_FILE + set(kwstyle_itk_code_files_list_file ${ITK_BINARY_DIR}/Utilities/KWStyle/ITKCodeFiles.txt ) configure_file( # KWStyle requires that the files list be absolute paths ${ITK_SOURCE_DIR}/Utilities/KWStyle/ITKCodeFiles.txt.in - ${KWSTYLE_ITK_CODE_FILES_LIST_FILE} + ${kwstyle_itk_code_files_list_file} ) - set(KWSTYLE_ITK_EXAMPLES_FILES_LIST_FILE + set(kwstyle_itk_examples_files_list_file ${ITK_BINARY_DIR}/Utilities/KWStyle/ITKExamplesFiles.txt ) configure_file( # KWStyle requires that the files list be absolute paths ${ITK_SOURCE_DIR}/Utilities/KWStyle/ITKExamplesFiles.txt.in - ${KWSTYLE_ITK_EXAMPLES_FILES_LIST_FILE} + ${kwstyle_itk_examples_files_list_file} ) - set(KWSTYLE_ITK_OVERWRITE_FILE + set(kwstyle_itk_overwrite_file ${ITK_SOURCE_DIR}/Utilities/KWStyle/ITKOverwrite.txt ) @@ -54,61 +55,61 @@ mark_as_advanced(KWSTYLE_USE_GCC_FORMAT) mark_as_advanced(KWSTYLE_USE_MSVC_FORMAT) - set(KWSTYLE_EDITOR_FORMAT "") + set(kwstyle_editor_format "") if(KWSTYLE_USE_VIM_FORMAT) - list(APPEND KWSTYLE_EDITOR_FORMAT -vim) + list(APPEND kwstyle_editor_format -vim) endif() if(KWSTYLE_USE_GCC_FORMAT) - list(APPEND KWSTYLE_EDITOR_FORMAT -gcc) + list(APPEND kwstyle_editor_format -gcc) endif() if(KWSTYLE_USE_MSVC_FORMAT) - list(APPEND KWSTYLE_EDITOR_FORMAT -msvc) + list(APPEND kwstyle_editor_format -msvc) endif() list(LENGTH - KWSTYLE_EDITOR_FORMAT - KWSTYLE_EDITOR_FORMAT_LENGTH + kwstyle_editor_format + kwstyle_editor_format_length ) - if(KWSTYLE_EDITOR_FORMAT_LENGTH GREATER 1) + if(kwstyle_editor_format_length GREATER 1) message(FATAL_ERROR "At most, only one of KWSTYLE_USE_*_FORMAT can be set to TRUE.") endif() # Add build target and CTest test - set(KWSTYLE_COMMON_ARGUMENTS - -xml ${KWSTYLE_ITK_CONFIGURATION_FILE} + set(kwstyle_common_arguments + -xml ${kwstyle_itk_configuration_file} -v - -o ${KWSTYLE_ITK_OVERWRITE_FILE} + -o ${kwstyle_itk_overwrite_file} ) add_custom_target(StyleCheckCode COMMAND ${KWSTYLE_EXECUTABLE} - ${KWSTYLE_COMMON_ARGUMENTS} - -D ${KWSTYLE_ITK_CODE_FILES_LIST_FILE} - ${KWSTYLE_EDITOR_FORMAT} + ${kwstyle_common_arguments} + -D ${kwstyle_itk_code_files_list_file} + ${kwstyle_editor_format} COMMENT "Coding Style Checker" - WORKING_DIRECTORY ${ITK_SOURCE_DIR} # the paths in KWSTYLE_CONFIGURATION_FILE are relative + WORKING_DIRECTORY ${ITK_SOURCE_DIR} # the paths in kwstyle_itk_configuration_file are relative ) add_custom_target(StyleCheckExamples COMMAND ${KWSTYLE_EXECUTABLE} - ${KWSTYLE_COMMON_ARGUMENTS} - -D ${KWSTYLE_ITK_EXAMPLES_FILES_LIST_FILE} - ${KWSTYLE_EDITOR_FORMAT} + ${kwstyle_common_arguments} + -D ${kwstyle_itk_examples_files_list_file} + ${kwstyle_editor_format} COMMENT "Examples Style Checker" - WORKING_DIRECTORY ${ITK_SOURCE_DIR} # the paths in KWSTYLE_CONFIGURATION_FILE are relative + WORKING_DIRECTORY ${ITK_SOURCE_DIR} # the paths in kwstyle_itk_configuration_file are relative ) if(BUILD_TESTING) set(itk-module KWStyle) # for uniformity and brevity, test will always output GCC-style itk_add_test(NAME KWStyleCodeTest COMMAND ${KWSTYLE_EXECUTABLE} - ${KWSTYLE_COMMON_ARGUMENTS} - -D ${KWSTYLE_ITK_CODE_FILES_LIST_FILE} + ${kwstyle_common_arguments} + -D ${kwstyle_itk_code_files_list_file} -gcc WORKING_DIRECTORY ${ITK_SOURCE_DIR} ) itk_add_test(NAME KWStyleExamplesTest COMMAND ${KWSTYLE_EXECUTABLE} - ${KWSTYLE_COMMON_ARGUMENTS} - -D ${KWSTYLE_ITK_EXAMPLES_FILES_LIST_FILE} + ${kwstyle_common_arguments} + -D ${kwstyle_itk_examples_files_list_file} -gcc WORKING_DIRECTORY ${ITK_SOURCE_DIR} ) diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/ArchiveTestingData.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/ArchiveTestingData.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/ArchiveTestingData.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/ArchiveTestingData.py 2014-09-03 08:29:34.000000000 +0000 @@ -10,6 +10,8 @@ Requires pydas: https://github.com/midasplatform/pydas """ +from __future__ import print_function + import argparse import fnmatch import os diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/BuildHeaderTest.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/BuildHeaderTest.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/BuildHeaderTest.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/BuildHeaderTest.py 2014-09-03 08:29:34.000000000 +0000 @@ -18,6 +18,8 @@ # #==========================================================================*/ +from __future__ import print_function + usage = """usage: BuildHeaderTest.py This script generates a a source file designed to check the headers in each diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/BuildKWStyle/CMakeLists.txt otb-4.2.0/Utilities/ITK/Utilities/Maintenance/BuildKWStyle/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/BuildKWStyle/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/BuildKWStyle/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -3,6 +3,7 @@ include(ExternalProject) +itk_download_attempt_check(KWStyle) ExternalProject_add(KWStyle GIT_REPOSITORY "http://public.kitware.com/KWStyle.git" # GIT_TAG -- shouldn't there be a release tag? the GIT repo just diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/FindRedundantHeaderIncludes.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/FindRedundantHeaderIncludes.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/FindRedundantHeaderIncludes.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/FindRedundantHeaderIncludes.py 2014-09-03 08:29:34.000000000 +0000 @@ -25,6 +25,8 @@ ## you can remove the sibling include. ## in the ITK/Code directory issue the following command +from __future__ import print_function + import os import sys import re @@ -47,7 +49,7 @@ curr_dir=os.path.dirname(testfile) if not os.path.isfile(testfile): continue - #print testfile + #print(testfile) ff=open(testfile) search_string=r'^#include *([<"])(itk[^<"]*h)([>"])' myregexp=re.compile(search_string) @@ -79,14 +81,14 @@ ## Pocess all children isdone=donenode.get((starting_child,dupcandidate),None) if isdone != None: - #print "found {0} {1}".format(starting_child,dupcandidate) + #print("found {0} {1}".format(starting_child,dupcandidate)) return False else: - #print "adding {0} {1}".format(starting_child,dupcandidate) + #print("adding {0} {1}".format(starting_child,dupcandidate)) donenode[(starting_child,dupcandidate)]=True nodeEdges=myDependTree[node] - #print nodeEdges + #print(nodeEdges) if ( dupcandidate not in nodeEdges): # Nothing to do print("-") return False @@ -125,7 +127,7 @@ # print(parentFiles) # for childFiles in myDependTree[parentFiles]: # print(" "*3+childFiles) -#print mymapper.filePathBaseDirs +#print(mymapper.filePathBaseDirs) donenode=dict() diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/JREUpdate.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/JREUpdate.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/JREUpdate.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/JREUpdate.py 2014-09-03 08:29:34.000000000 +0000 @@ -14,6 +14,8 @@ In the future, pydas can be used for automatic upload. """ +from __future__ import print_function + import os import subprocess import tarfile diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/StripIncludes.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/StripIncludes.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/StripIncludes.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/StripIncludes.py 2014-09-03 08:29:34.000000000 +0000 @@ -35,6 +35,7 @@ includesToSkip = ["itkVersion.h","", "", "","vnl/vnl_math.h","","itkConfigure.h","",""] #keep those headers ####################################################################### +from __future__ import print_function import os @@ -81,7 +82,7 @@ if line.startswith('#include'): if shouldSkipInclude(line): continue - print "Try remove:", line + print("Try remove:", line) lines[i] = "" writeFile(lines, absFileName) @@ -89,7 +90,7 @@ if returnCode == 0: removedLines.append(i) else: - print "Restoring:", line + print("Restoring:", line) lines[i] = line # Write final changes to file diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/UpdateCopyrightStatementsInITK.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/UpdateCopyrightStatementsInITK.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/UpdateCopyrightStatementsInITK.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/UpdateCopyrightStatementsInITK.py 2014-09-03 08:29:34.000000000 +0000 @@ -22,6 +22,9 @@ # # This script is designed to help change the copyright notices in all ITK files to a common format. # For files that are .h, .cxx, .hxx, .c, if there is no other copyright information, add the itkCopyright. + +from __future__ import print_function + import re import sys import os @@ -108,10 +111,10 @@ continue if ff[0] == '.': #Skip all files that begin with '.' files.remove(ff) - #print "@@@@@@@",ff + #print("@@@@@@@",ff) continue currFile=os.path.join(top,ff) - print currFile + print(currFile) infile=open(currFile,'r') file_text=infile.read() diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/VerifyURLs.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/VerifyURLs.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/VerifyURLs.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/VerifyURLs.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import print_function + import sys import re import httplib @@ -22,7 +24,7 @@ f.close() if len( http_dict ) > 1: - print "Found ", len( http_dict ), " unique URLS." + print("Found ", len( http_dict ), " unique URLS.") # compile regular expression to pull out the server address and path server_re = re.compile( "http://([^/]+)(/?[^\s]*)" ) @@ -33,7 +35,7 @@ path = mo.group( 2 ) try: - #print "Verifying URL: ", url, + #print("Verifying URL: ", url,) # connect to server and get the path conn = httplib.HTTPConnection( server ) @@ -43,31 +45,31 @@ if r1.status == httplib.OK: # URL is OK do nothing - #print " URL: ", url, r1.status, r1.reason + #print(" URL: ", url, r1.status, r1.reason) pass elif r1.status == httplib.MOVED_PERMANENTLY: - print filename,": ERROR (URL needs update): ", url, - print r1.status, r1.reason, " to: ", r1.getheader("location") + print(filename,": ERROR (URL needs update): ", url) + print(r1.status, r1.reason, " to: ", r1.getheader("location")) elif r1.status == httplib.FOUND: - print filename,": INFO URL: ", url, r1.status, r1.reason, " to: ", r1.getheader("location") + print(filename,": INFO URL: ", url, r1.status, r1.reason, " to: ", r1.getheader("location")) pass elif r1.status == httplib.FORBIDDEN: - print filename,": INFO URL: ", url, r1.status, r1.reason + print(filename,": INFO URL: ", url, r1.status, r1.reason) pass elif r1.status == httplib.NOT_FOUND: - print filename,": ERROR URL: ", url, r1.status, r1.reason + print(filename,": ERROR URL: ", url, r1.status, r1.reason) else: - print filename, ": UNKNOWN URL: ", url, "\"", r1.status, "\"", r1.reason + print(filename, ": UNKNOWN URL: ", url, "\"", r1.status, "\"", r1.reason) pass except Exception as e: - print - print filename,": ERROR (exception): ", url, - print e + print() + print(filename,": ERROR (exception): ", url) + print(e) except: - print filename,": ERROR (exception): ", url, - print "Unexpected error:", sys.exc_info()[0] + print(filename,": ERROR (exception): ", url) + print("Unexpected error:", sys.exc_info()[0]) raise finally: conn.close() diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/VisualizeTestTimes.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/VisualizeTestTimes.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/VisualizeTestTimes.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/VisualizeTestTimes.py 2014-09-03 08:29:34.000000000 +0000 @@ -8,6 +8,8 @@ Pass the --modular-grouping flag to group by module.""" +from __future__ import print_function + import os import pprint import subprocess diff -Nru otb-4.0.0/Utilities/ITK/Utilities/Maintenance/WhatModulesITK.py otb-4.2.0/Utilities/ITK/Utilities/Maintenance/WhatModulesITK.py --- otb-4.0.0/Utilities/ITK/Utilities/Maintenance/WhatModulesITK.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Utilities/Maintenance/WhatModulesITK.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,10 +1,13 @@ #!/usr/bin/env python + +from __future__ import print_function + import os, sys import re program = sys.argv[0] if len(sys.argv) < 3: - print """ + print(""" Usage: WhatModulesITK.py itkSourceTree applicationFiles... Generate a FindPackage(ITK COMPONENTS) that lists all modules referenced by a set of files @@ -32,7 +35,7 @@ unless their include file is present in the application code. If ITKIOImageBase is present, a cmake variable ITK_IO_MODULES_USED is created and added to the module list. -""" +""") exit(0) # Build a dict that maps include files to paths @@ -85,7 +88,7 @@ # Test to see if ITK source is provided if len(pathsToModules) == 0: - print program + ": " + sys.argv[1] + " is not an ITK source directory. It does not contain any itk-module.cmake files." + print(program + ": " + sys.argv[1] + " is not an ITK source directory. It does not contain any itk-module.cmake files.") exit(1) # Build a set of includes for all command line files @@ -97,7 +100,7 @@ if os.path.isfile(f): allIncludes.update(FindIncludes(f)) else: - print program + ": " + f + " is a directory and is ignored" + print(program + ": " + f + " is a directory and is ignored") # Build a set that contains all modules referenced in command line files allModules = set() @@ -107,12 +110,12 @@ allModules.add(pathsToModules[includesToPaths[inc]]) # Print a useful cmake command -print r'set(ITK_IO_MODULES_USED "")' -print "find_package(ITK COMPONENTS" +print(r'set(ITK_IO_MODULES_USED "")') +print("find_package(ITK COMPONENTS") for module in sorted(allModules): - print " " + module + print(" " + module) if "ITKIOImageBase" in allModules: - print r" ${ITK_IO_MODULES_USED}" -print ")" + print(r" ${ITK_IO_MODULES_USED}") +print(")") -print "Your application code includes " + str(len(allModules)) + " of " + str(len(pathsToModules)) + " itk modules." +print("Your application code includes " + str(len(allModules)) + " of " + str(len(pathsToModules)) + " itk modules.") diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/CMakeLists.txt otb-4.2.0/Utilities/ITK/Wrapping/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Wrapping/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -16,29 +16,21 @@ # #==========================================================================*/ +cmake_minimum_required(VERSION 2.8.6 FATAL_ERROR) +if(POLICY CMP0025) + cmake_policy(SET CMP0025 NEW) +endif() +if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) +endif() + project(WrapITK) # set an internal cache to mark when this file is parsed set(ITK_WRAPPING_REACHED ON CACHE INTERNAL "Wrapping folder has been reached") -# check cmake version -# Require 2.4.2 for MATH and LIST commands (REMOVE_ITEM is not the same in -# 2.4.1) -# 2.4.5 is required to parse the if(POLICY) command. -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) -if(COMMAND CMAKE_POLICY) - cmake_policy(SET CMP0003 NEW) - if(POLICY CMP0011) - cmake_policy(SET CMP0011 NEW) - endif() -endif() include("CMakeUtilityFunctions.cmake") -set(ITK_VERSION "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}") -if(NOT "${CMAKE_VERSION}" STRLESS "2.6.3") - cmake_policy(SET CMP0011 OLD) -endif() - enable_testing() ############################################################################### @@ -47,12 +39,6 @@ # Set up options needed for ConfigureWrapping -# set WrapITK version -set(WrapITK_VERSION_MAJOR 0) -set(WrapITK_VERSION_MINOR 4) -set(WrapITK_VERSION_PATCH 0) - - option(ITK_WRAP_unsigned_char "Wrap unsigned char type" ON) option(ITK_WRAP_unsigned_short "Wrap unsigned short type" OFF) option(ITK_WRAP_unsigned_long "Wrap unsigned long type" OFF) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/ConfigureWrapping.cmake otb-4.2.0/Utilities/ITK/Wrapping/ConfigureWrapping.cmake --- otb-4.0.0/Utilities/ITK/Wrapping/ConfigureWrapping.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/ConfigureWrapping.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -38,8 +38,6 @@ # only used by the macros defined in a given cmake file. ############################################################################### -cmake_minimum_required(VERSION 2.8 FATAL_ERROR) - ############################################################################### # Find Required Packages @@ -50,16 +48,6 @@ #----------------------------------------------------------------------------- find_package(ITK REQUIRED) include(${ITK_USE_FILE}) -# we must be sure we have the right ITK version; WrapITK can't build with -# an old version of ITK because some classes will not be there. -# newer version should only cause some warnings -set(ITK_REQUIRED_VERSION "4.0.0") -set(ITK_VERSION "${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}.${ITK_VERSION_PATCH}") -if("${ITK_VERSION}" VERSION_LESS "${ITK_REQUIRED_VERSION}") - message(FATAL_ERROR "ITK ${ITK_REQUIRED_VERSION} is required to build this version of WrapITK, and you are trying to use version ${ITK_VERSION}. Set ITK_DIR to point to the directory of ITK ${ITK_REQUIRED_VERSION}.") -endif() - -cmake_policy(SET CMP0003 NEW) ############################################################################### # Set various variables in order @@ -114,10 +102,6 @@ set(WRAP_ITK_LIBNAME_PREFIX "") endif() -# 467 is for warnings caused by typemap on overloaded methods -set(CSWIG_IGNORE_WARNINGS -w362 -w389 -w467 -w503 -w508 -w509 -w516) -add_definitions(-DSWIG_GLOBAL) - # generators dir set(GENERATORS_SRC_DIR "${WRAP_ITK_CMAKE_DIR}/Generators" CACHE INTERNAL "generators source directory") diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Doc/doxy2swig.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Doc/doxy2swig.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Doc/doxy2swig.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Doc/doxy2swig.py 2014-09-03 08:29:34.000000000 +0000 @@ -21,6 +21,7 @@ # Author: Prabhu Ramachandran # License: BSD style +from __future__ import print_function from xml.dom import minidom import re @@ -309,7 +310,7 @@ fname = refid + '.xml' if not os.path.exists(fname): fname = os.path.join(self.my_dir, fname) - print "parsing file: %s"%fname + print("parsing file: %s"%fname) p = Doxy2SWIG(fname) p.generate() self.pieces.extend(self.clean_pieces(p.pieces)) @@ -366,6 +367,6 @@ if __name__ == '__main__': if len(sys.argv) != 3: - print __doc__ + print(__doc__) sys.exit(1) main(sys.argv[1], sys.argv[2]) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Doc/doxygen.config.in otb-4.2.0/Utilities/ITK/Wrapping/Generators/Doc/doxygen.config.in --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Doc/doxygen.config.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Doc/doxygen.config.in 2014-09-03 08:29:34.000000000 +0000 @@ -420,7 +420,7 @@ class thisClass : public superclass {};" \ "itkConceptMacro(name,concept)= \ enum { name = 0 };" \ - "vcl_numeric_limits= \ + "std::numeric_limits= \ std::numeric_limits" \ "ITK_TYPENAME= \ typename" \ diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Doc/itk_doxy2swig.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Doc/itk_doxy2swig.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Doc/itk_doxy2swig.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Doc/itk_doxy2swig.py 2014-09-03 08:29:34.000000000 +0000 @@ -7,12 +7,7 @@ """ -# silently import psyco -try: - import psyco - psyco.full() -except ImportError: - pass +from __future__ import print_function import sys import os @@ -40,7 +35,7 @@ def do_compoundname(self, node): self.add_text('\n\n') data = self.cpp_to_swig_name(node.firstChild.data) - # print "=================", data + # print("=================", data) self.add_text('%%feature("docstring") %s "\n'%data) def do_memberdef(self, node): @@ -80,7 +75,7 @@ cname = self.cpp_to_swig_name(anc_node[0].firstChild.data) # self.add_text(' %s::%s "\n%s'%(cname, name, defn)) self.add_text(' %s::%s "'%(cname, name)) - # print "***", name, defn + # print("***", name, defn) # make sure that the docstring won't be empty before writing any text current_length = len(self.pieces) @@ -118,7 +113,7 @@ for swig_name in ls[2:]: output.write(tpl.replace("@[{(]})@", swig_name)) else: - print >> sys.stderr, "Warning: %s does not exist. Ignore it." % xfn + print("Warning: %s does not exist. Ignore it." % xfn, file=sys.stderr) f = open(out_swig_i, 'w') f.write(output.getvalue()) f.close() @@ -128,6 +123,6 @@ if __name__ == '__main__': if len(sys.argv) != 3: - print __doc__ + print(__doc__) sys.exit(1) main(sys.argv[1], sys.argv[2]) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/GccXML/CMakeLists.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/GccXML/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/GccXML/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/GccXML/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -2,6 +2,9 @@ option(ITK_USE_SYSTEM_GCCXML "Use system gccxml. If OFF, gccxml is built as an external project." OFF) mark_as_advanced(ITK_USE_SYSTEM_GCCXML) +set(gccxml_url http://itk.org/files/gccxml/gccxml-2014-06-10.tar.gz) +set(gccxml_md5 3ca85731d1d95a9d433eed865d2079c0) + set(gccxml_ep ${CMAKE_CURRENT_BINARY_DIR}/gccxml/bin/gccxml) if(WIN32) set(gccxml_ep "${gccxml_ep}.exe") @@ -25,9 +28,10 @@ else() set(test ) endif() - ExternalProject_add(GCC_XML - URL http://itk.org/files/gccxml/gccxml-2013-11-18.tar.bz2 - URL_MD5 3b8f72ae76c6946a954bddf3222c201b + itk_download_attempt_check(GCC_XML) + ExternalProject_Add(GCC_XML + URL ${gccxml_url} + URL_MD5 ${gccxml_md5} PREFIX gccxml CMAKE_ARGS -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} @@ -129,7 +133,6 @@ -fxml-start=_cable_ -o ${xml_file} ${CONFIG_GCCXML_INC_CONTENTS} - -DCSWIG -DCABLE_CONFIGURATION -DITK_MANUAL_INSTANTIATION ${cxx_file} @@ -142,7 +145,6 @@ -fxml-start=_cable_ -fxml=${xml_file} --gccxml-gcc-options ${gccxml_inc_file} - -DCSWIG -DCABLE_CONFIGURATION -DITK_MANUAL_INSTANTIATION ${ADDITIONAL_GCC_XML_FLAGS} diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Java/itkCommand.i otb-4.2.0/Utilities/ITK/Wrapping/Generators/Java/itkCommand.i --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Java/itkCommand.i 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Java/itkCommand.i 2014-09-03 08:29:34.000000000 +0000 @@ -1,6 +1,6 @@ // This is needed for a reference in SwigExtras.i // The actuall itkCommand wrapping is done in wrap_ITKCommonBase.cxx by -// CableSwig +// Swig class itkCommand { public: diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Java/itkJavaCommand.i otb-4.2.0/Utilities/ITK/Wrapping/Generators/Java/itkJavaCommand.i --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Java/itkJavaCommand.i 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Java/itkJavaCommand.i 2014-09-03 08:29:34.000000000 +0000 @@ -77,7 +77,7 @@ %} // import fake itk command -// because itkCommand will be wrapped elsewhere by cableswig +// because itkCommand will be wrapped elsewhere by Swig %import "itkCommand.i" // create an itkJavaCommand that has an Execute method that diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/CMakeLists.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,8 +1,19 @@ - ############################################################################### -# configure python -find_package(PythonLibs) +# configure python (find PythonInterp first, as of cmake 3.1) find_package(PythonInterp) +find_package(PythonLibs) + +# require at least python 2.6 +if(PYTHON_VERSION_STRING VERSION_LESS 2.6) + message(WARNING "Python version less than 2.6: \"${PYTHON_VERSION_STRING}\".") +endif() + +# check for version mismatch. +if(PYTHONLIBS_FOUND AND PYTHONINTERP_FOUND + AND NOT(PYTHON_VERSION_STRING VERSION_EQUAL PYTHONLIBS_VERSION_STRING)) + message(WARNING "Python executable (\"${PYTHON_VERSION_STRING}\") and library (\"${PYTHONLIBS_VERSION_STRING}\") version mismatch.") +endif() + mark_as_advanced(PYTHON_EXECUTABLE) include_directories(${PYTHON_INCLUDE_PATH}) @@ -18,15 +29,6 @@ file(MAKE_DIRECTORY ${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python) ############################################################################### -# should we use autodoc? swig 1.3.37 produce invalid code with autodoc. -# see https://sourceforge.net/tracker/index.php?func=detail&aid=2552048&group_id=1645&atid=101645 -if("${SWIG_VERSION}" STREQUAL "1.3.37") - set(ITK_WRAP_PYTHON_AUTODOC "" CACHE INTERNAL "python autodoc option") -else() - set(ITK_WRAP_PYTHON_AUTODOC -features autodoc=1 CACHE INTERNAL "python autodoc option") -endif() - -############################################################################### # python 2.6 search for the modules in a "64" subdirectory, and don't provide # any obvious way to find that. Create a link 64 -> . to make it find its # files. @@ -121,21 +123,6 @@ ############################################################################### -# Configure the old style module - -if(NOT EXTERNAL_WRAP_ITK_PROJECT) - set(ITK_WRAP_PYTHON_OLD_STYLE_IMPORTS ) - foreach(lib ${WRAP_ITK_MODULES}) - set(ITK_WRAP_PYTHON_OLD_STYLE_IMPORTS "${ITK_WRAP_PYTHON_OLD_STYLE_IMPORTS}from ${lib}Python import *\n") - endforeach() - configure_file("${ITK_WRAP_PYTHON_SOURCE_DIR}/InsightToolkit.py.in" - "${ITK_WRAP_PYTHON_BINARY_DIR}/InsightToolkit.py" - @ONLY) - WRAP_ITK_BINDINGS_INSTALL(/Python "${ITK_WRAP_PYTHON_BINARY_DIR}/InsightToolkit.py") -endif() - - -############################################################################### # Copy python files for out-of-source builds, and set up install of same. if(NOT EXTERNAL_WRAP_ITK_PROJECT) @@ -147,7 +134,7 @@ itkBase itkTemplate itkTypes - # itkExtras/__init__ + itkExtras itkLazy ) # Done listing files. @@ -162,7 +149,6 @@ endforeach() else() set(ITK_WRAP_PYTHON_FILES) - add_custom_target(copy_python_files ALL) foreach(file ${ITK_PYTHON_FILES}) set(src "${CMAKE_CURRENT_SOURCE_DIR}/${file}.py") # recall that WRAP_ITK_BUILD_INTDIR expands to nothing if no config types are set, @@ -176,19 +162,13 @@ # create the directory to avoid loosing case on windows file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${WRAP_ITK_INSTALL_INTDIR}${path}) - add_custom_command(SOURCE ${src} - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${src} ${copy_tgt} - OUTPUTS ${copy_tgt} - TARGET copy_python_files + add_custom_command(OUTPUT ${copy_tgt} + COMMAND ${CMAKE_COMMAND} -E copy ${src} ${copy_tgt} + DEPENDS ${src} COMMENT "Copying ${file}.py to build dir.") endforeach() + add_custom_target(copy_python_files ALL DEPENDS ${ITK_WRAP_PYTHON_FILES}) - # driver command to make the copy happen. - add_custom_command( - SOURCE copy_python_files - DEPENDS ${ITK_WRAP_PYTHON_FILES} - TARGET copy_python_files) endif() # Install the package python files. @@ -204,6 +184,7 @@ foreach(config ${CMAKE_CONFIGURATION_TYPES}) set(CONFIG_ITK_WRAP_PYTHON_DIR "${CMAKE_CURRENT_BINARY_DIR}/${config}") + set(CONFIG_ITK_WRAP_LIBRARY_DIR "${ITK_BINARY_DIR}/${ITK_INSTALL_LIBRARY_DIR}/${config}") # SWIG-generated libs and *.py files are sent to ${config} subdir # This assumes that CMAKE_LIBRARY_OUTPUT_DIRECTORY is WrapITK_BINARY_DIR/bin (bad!) @@ -214,6 +195,7 @@ endforeach() else() set(CONFIG_ITK_WRAP_PYTHON_DIR "${CMAKE_CURRENT_BINARY_DIR}") + set(CONFIG_ITK_WRAP_LIBRARY_DIR "${ITK_BINARY_DIR}/${ITK_INSTALL_LIBRARY_DIR}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/WrapITK.pth.in" "${CMAKE_CURRENT_BINARY_DIR}/WrapITK.pth" @@ -222,48 +204,28 @@ endif() set(CONFIG_ITK_WRAP_PYTHON_DIR "${CMAKE_INSTALL_PREFIX}/lib/ITK-${ITK_VERSION_MAJOR}.${ITK_VERSION_MINOR}/Python") +set(CONFIG_ITK_WRAP_LIBRARY_DIR "${CMAKE_INSTALL_PREFIX}/${ITK_INSTALL_LIBRARY_DIR}") configure_file("${CMAKE_CURRENT_SOURCE_DIR}/WrapITK.pth.in" "${CMAKE_CURRENT_BINARY_DIR}/InstallOnly/WrapITK.pth" @ONLY) if(PYTHON_EXECUTABLE) - file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/det_spp.py "try:\n import distutils.sysconfig; print distutils.sysconfig.get_python_lib(1)\nexcept: pass") + set(python_check "from __future__ import print_function\ntry:\n import distutils.sysconfig\n print(distutils.sysconfig.get_python_lib(1))\nexcept:\n pass") + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/det_spp.py ${python_check}) execute_process(COMMAND "${PYTHON_EXECUTABLE}" "${CMAKE_CURRENT_BINARY_DIR}/det_spp.py" OUTPUT_VARIABLE py_spp ERROR_VARIABLE py_spp ) endif() -string(REGEX REPLACE "\\\\" "/" py_spp_nobackslashes "${py_spp}") +string(REGEX REPLACE "\n" "" py_spp_no_newline "${py_spp}") +string(REGEX REPLACE "\\\\" "/" py_spp_nobackslashes "${py_spp_no_newline}") set(PY_SITE_PACKAGES_PATH "${py_spp_nobackslashes}" CACHE PATH "Python site-packages directory to install a .pth file pointing at WrapITK Python modules.") mark_as_advanced(PY_SITE_PACKAGES_PATH) if(PY_SITE_PACKAGES_PATH) INSTALL_AT_ABSOLUTE_PATH(install_wrapitk_compatibility "${PY_SITE_PACKAGES_PATH}" "${CMAKE_CURRENT_BINARY_DIR}/InstallOnly/WrapITK.pth") endif() - - -# # compile python files -# set(PYTHON_MODULES "") -# foreach(m ${WRAP_ITK_MODULES}) -# set(PYTHON_MODULES ${PYTHON_MODULES} _${m}Python) -# endforeach() -# -# add_custom_target(PythonCompile ALL -# ${PYTHON_EXECUTABLE} -# ${PY_SITE_PACKAGES_PATH}/../compileall.py -l -# -d "${CMAKE_INSTALL_PREFIX}/${WRAP_ITK_INSTALL_PREFIX}/lib" -# ${WrapITK_BINARY_DIR}/lib -# -# COMMAND ${PYTHON_EXECUTABLE} -# ${PY_SITE_PACKAGES_PATH}/../compileall.py -l -# -d "${CMAKE_INSTALL_PREFIX}/${WRAP_ITK_INSTALL_PREFIX}/Python" -# ${WrapITK_BINARY_DIR}/Python -# -# DEPENDS SwigRuntimePython ${PYTHON_MODULES} -# ) - - ############################################################################### # Install python stuff for external projects if(NOT EXTERNAL_WRAP_ITK_PROJECT) @@ -280,9 +242,8 @@ ) endif() - - - +############################################################################### +# Define the wrapping macros macro(itk_wrap_module_python library_name) set(ITK_WRAP_PYTHON_CONFIGURATION_TEMPLATES "") @@ -294,6 +255,77 @@ endmacro() +macro(itk_setup_swig_python type base_name interface_file python_file cpp_file doc_file) + + ############################################################################# + # Runs swig to produce the .so and the .py file + # Called by itk_end_wrap_module_python and by itk_end_wrap_submodule_python + # Type will then be either "module" or "submodule" + ############################################################################# + + set(swig_command ${SWIG_EXECUTABLE}) + if(ITK_USE_CCACHE) + set(swig_command ${CCACHE_EXECUTABLE} ${swig_command}) + endif() + + set(_swig_depend) + if(NOT ITK_USE_SYSTEM_SWIG) + # The ExternalProject SWIG install. + set(_swig_depend swig) + endif() + + set(dependencies + "${DEPS}" + "${interface_file}" + "${WRAP_ITK_TYPEDEFS_DIRECTORY}/pyBase.i" + "${_swig_depend}") + + if("${type}" STREQUAL "module") + # Module + set(dependencies ${dependencies} + "${ITK_WRAP_PYTHON_LIBRARY_DEPS}" + "${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python/${WRAPPER_LIBRARY_NAME}_ext.i") + else() + # Submodule + set(dependencies ${dependencies} + "${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python/${base_name}_ext.i" + "${doc_file}") + endif() + + add_custom_command( + OUTPUT ${cpp_file} ${python_file} + COMMAND ${swig_command} -c++ -python -O -features autodoc=1 + -Werror + -w302 # Identifier 'name' redefined (ignored) + -w303 # %extend defined for an undeclared class 'name' (to avoid warning about customization in pyBase.i) + -w312 # Unnamed nested class not currently supported (ignored) + -w314 # 'identifier' is a lang keyword + -w361 # operator! ignored + -w362 # operator= ignored + -w350 # operator new ignored + -w383 # operator++ ignored + -w384 # operator-- ignored + -w389 # operator[] ignored + -w394 # operator new[] ignored + -w395 # operator delete[] ignored + -w467 # Overloaded declaration not supported (no type checking rule for 'type') + -w508 # Declaration of 'name' shadows declaration accessible via operator->(), previous declaration of'declaration' + -w509 # Overloaded method declaration effectively ignored, as it is shadowed by declaration + -o ${cpp_file} + -I${GENERATORS_SRC_DIR} + -I${WRAP_ITK_TYPEDEFS_DIRECTORY}/python + -I${WRAP_ITK_TYPEDEFS_DIRECTORY} + ${WRAP_ITK_SWIG_ARGS_PYTHON} + -outdir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} + ${interface_file} + WORKING_DIRECTORY ${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python + DEPENDS ${dependencies} + ) + WRAP_ITK_BINDINGS_INSTALL("/Python" "${python_file}") + +endmacro() + + macro(itk_end_wrap_module_python) # Loop over the extra swig input files and add them to the generated files @@ -333,7 +365,6 @@ "${ITK_WRAP_PYTHON_BINARY_DIR}/Configuration/${WRAPPER_LIBRARY_NAME}Config.py" ) - # create the advanced lib module python file # this file let the final user _not_ use the itk module, but rather # something like "import Base" @@ -343,9 +374,6 @@ @ONLY) WRAP_ITK_BINDINGS_INSTALL("/Python" "${ITK_WRAP_PYTHON_BINARY_DIR}/${WRAPPER_LIBRARY_NAME}.py") -# add_custom_target(${WRAPPER_LIBRARY_NAME}SwigPython DEPENDS ${cpp_files} ${python_files}) -# add_custom_target(${WRAPPER_LIBRARY_NAME}Python DEPENDS ${modules}) - # create the python customization stuff in the main module # it allow to group the pythons module in a single shared lib, by loading the int # functions of the module. I also import the objects from the submodules in the @@ -360,7 +388,6 @@ "${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python/${WRAPPER_LIBRARY_NAME}_ext.i" ) - # set some var reused later set(interface_file "${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/${WRAPPER_LIBRARY_NAME}.i") set(lib ${WRAPPER_LIBRARY_NAME}Python) @@ -372,44 +399,10 @@ set(WRAP_ITK_SWIG_ARGS_PYTHON "" CACHE STRING "Extra user-defined swig arguments to be to the swig executable.") endif() - # and generate c++ code from the main module swig interface. - set(swig_command ${SWIG_EXECUTABLE}) - if(ITK_USE_CCACHE) - set(swig_command ${CCACHE_EXECUTABLE} ${swig_command}) - endif() - - set(_swig_depend) - if(NOT ITK_USE_SYSTEM_SWIG) - # The ExternalProject SWIG install. - set(_swig_depend swig) - endif() - add_custom_command( - OUTPUT ${cpp_file} ${python_file} - COMMAND ${swig_command} -c++ -python -O ${ITK_WRAP_PYTHON_AUTODOC} -Werror -# -fcompact - -w508 -w312 -w314 -w509 -w302 -w362 - -w389 # operator[], to be suppressed later... - -w384 -w383 # operator++ ane operator-- - -w361 # operator! - -w467 # overloaded functions (with typemaps) - -w350 -w394 -w395 # operator new/new[]/delete[] ignored - -w303 # to avoid warning about customization in pyBase.i - -o ${cpp_file} - -I${GENERATORS_SRC_DIR} - -I${WRAP_ITK_TYPEDEFS_DIRECTORY}/python - -I${WRAP_ITK_TYPEDEFS_DIRECTORY} - ${WRAP_ITK_SWIG_ARGS_PYTHON} - -outdir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - ${interface_file} - WORKING_DIRECTORY ${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python - DEPENDS ${DEPS} ${ITK_WRAP_PYTHON_LIBRARY_DEPS} ${interface_file} - ${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python/${WRAPPER_LIBRARY_NAME}_ext.i - ${WRAP_ITK_TYPEDEFS_DIRECTORY}/pyBase.i ${_swig_depend} - ) - WRAP_ITK_BINDINGS_INSTALL("/Python" "${python_file}") + # Run swig to produce the .so and the .py file + itk_setup_swig_python("module" ${base_name} ${interface_file} ${python_file} ${cpp_file} "") # build all the c++ files from this module in a common lib - set(lib ${WRAPPER_LIBRARY_NAME}Python) add_library(${lib} MODULE ${cpp_file} ${ITK_WRAP_PYTHON_CXX_FILES} ${WRAPPER_LIBRARY_CXX_SOURCES}) set_target_properties(${lib} PROPERTIES PREFIX "_") # gcc 4.4 complains a lot without this flag when building in release mode @@ -489,7 +482,6 @@ set(ITK_WRAP_PYTHON_SWIG_EXT "%import pyBase.i\n\n${ITK_WRAP_PYTHON_SWIG_EXT}") # create the swig interface for all the groups in the module - # set(interface_file "${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/${base_name}.i") set(lib ${group_name}Python) set(python_file "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${lib}.py") @@ -508,48 +500,8 @@ set(DEPS ${DEPS} ${${dep}SwigFiles}) endforeach() - # and run swig to produce the c++ file and the .py file - set(swig_command ${SWIG_EXECUTABLE}) - if(ITK_USE_CCACHE) - set(swig_command ${CCACHE_EXECUTABLE} ${swig_command}) - endif() - - if(NOT ITK_USE_SYSTEM_SWIG) - # The ExternalProject SWIG install. - set(_swig_depend swig) - endif() - add_custom_command( - OUTPUT ${cpp_file} ${python_file} - COMMAND ${swig_command} -c++ -python -O ${ITK_WRAP_PYTHON_AUTODOC} -Werror -# -fcompact - -w508 -w312 -w314 -w509 -w302 -w362 - -w389 # operator[], to be suppressed later... - -w384 -w383 # operator++ ane operator-- - -w361 # operator! - -w467 # overloaded functions (with typemaps) - -w350 -w394 -w395 # operator new/new[]/delete[] ignored - -w303 # to avoid warning about customization in pyBase.i - -o ${cpp_file} - -I${GENERATORS_SRC_DIR} - -I${WRAP_ITK_TYPEDEFS_DIRECTORY}/python - -I${WRAP_ITK_TYPEDEFS_DIRECTORY} - ${WRAP_ITK_SWIG_ARGS_PYTHON} - -outdir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY} - ${interface_file} - WORKING_DIRECTORY ${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python - DEPENDS ${DEPS} ${interface_file} - ${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/python/${base_name}_ext.i - ${WRAP_ITK_TYPEDEFS_DIRECTORY}/pyBase.i ${doc_file} ${_swig_depend} - # ${ITK_WRAP_PYTHON_LIBRARY_DEPS} - ) - WRAP_ITK_BINDINGS_INSTALL("/Python" "${python_file}") - -# gcc visibility can't be used without getting errors when passing objects -# from one module to an other -# -# if(CMAKE_COMPILER_IS_GNUCC) -# set_target_properties(${lib} PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") -# endif() + # Run swig to produce the .so and the .py file + itk_setup_swig_python("submodule" ${base_name} ${interface_file} ${python_file} ${cpp_file} "${doc_file}") # add the c++ files which will be generated by the swig command to the # list of python related c++ files, so they can be built at the end @@ -675,8 +627,6 @@ set(ext_def "") endif() string(REGEX REPLACE ".*::" "" simple_name "${cpp_name}") -# message("${wrap_class} -- ${swig_name}") -# message("${cpp_name} -- ${template_params} -- ${ext_def}") # must be done first so the typemap are used in the %template commands if("${swig_name}" MATCHES "_Pointer$") @@ -897,7 +847,6 @@ if(NOT EXTERNAL_WRAP_ITK_PROJECT) add_subdirectory(Tests) - add_subdirectory(itkExtras) macro(itk_end_wrap_modules_python) add_subdirectory(${ITK_WRAP_PYTHON_SOURCE_DIR}/PyUtils) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/InsightToolkit.py.in otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/InsightToolkit.py.in --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/InsightToolkit.py.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/InsightToolkit.py.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -import sys, os -sys.path.append(__file__+os.sep+"../lib") -del sys, os - -from ITKPyBase import * -@ITK_WRAP_PYTHON_OLD_STYLE_IMPORTS@ diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkBase.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkBase.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkBase.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkBase.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,213 +16,221 @@ # #==========================================================================*/ -import os, os.path, sys, imp, inspect, itkConfig, itkTemplate +from __future__ import print_function -def LoadModule(name, namespace = None): - """This function causes a SWIG module to be loaded into memory after its dependencies - are satisfied. Information about the templates defined therein is looked up from - a config file, and PyTemplate instances for each are created. These template - instances are placed in a module with the given name that is either looked up - from sys.modules or created and placed there if it does not already exist. - Optionally, a 'namespace' parameter can be provided. If it is provided, this - namespace will be updated with the new template instantiations. - The raw classes loaded from the named module's SWIG interface are placed in a - 'swig' sub-module. If the namespace parameter is provided, this information will - be placed in a sub-module named 'swig' therein as well. This latter submodule - will be created if it does not already exist.""" - - # find the module's name in sys.modules, or create a new module so named - this_module = sys.modules.setdefault(name, imp.new_module(name)) - - # if this library and it's template instantiations have already been loaded - # into sys.modules, bail out after loading the defined symbols into 'namespace' - if hasattr(this_module, '__templates_loaded'): - if namespace is not None: - swig = namespace.setdefault('swig', imp.new_module('swig')) - swig.__dict__.update(this_module.swig.__dict__) - - # don't worry about overwriting the symbols in namespace -- any common - # symbols should be of type itkTemplate, which is a singleton type. That - # is, they are all identical, so replacing one with the other isn't a - # problem. - for k, v in this_module.__dict__.items(): - if not (k.startswith('_') or k == 'swig'): namespace[k] = v - return - - # We're definitely going to load the templates. We set templates_loaded here - # instead of at the end of the file to protect against cyclical dependencies - # that could kill the recursive lookup below. - this_module.__templates_loaded = True - - # For external projects : - # If this_module name (variable name) is in the module_data dictionnary, then - # this_module is an installed module (or a previously loaded module). - # Otherwise, it may come from an external project. In this case, we must - # search the Configuration/Config.py file of this project. - try: - module_data[name] - except: - file = inspect.getfile(this_module) - path = os.path.dirname(file) - - data = {} +import os +import os.path +import sys +import imp +import inspect +import itkConfig +import itkTemplate + + +def LoadModule(name, namespace=None): + """This function causes a SWIG module to be loaded into memory after its + dependencies are satisfied. Information about the templates defined therein + is looked up from a config file, and PyTemplate instances for each are + created. These template instances are placed in a module with the given + name that is either looked up from sys.modules or created and placed there + if it does not already exist. + Optionally, a 'namespace' parameter can be provided. If it is provided, + this namespace will be updated with the new template instantiations. + The raw classes loaded from the named module's SWIG interface are placed in + a 'swig' sub-module. If the namespace parameter is provided, this + information will be placed in a sub-module named 'swig' therein as well. + This later submodule will be created if it does not already exist.""" + + # find the module's name in sys.modules, or create a new module so named + this_module = sys.modules.setdefault(name, imp.new_module(name)) + + # if this library and it's template instantiations have already been loaded + # into sys.modules, bail out after loading the defined symbols into + # 'namespace' + if hasattr(this_module, '__templates_loaded'): + if namespace is not None: + swig = namespace.setdefault('swig', imp.new_module('swig')) + swig.__dict__.update(this_module.swig.__dict__) + + # don't worry about overwriting the symbols in namespace -- any + # common symbols should be of type itkTemplate, which is a + # singleton type. That is, they are all identical, so replacing one + # with the other isn't a problem. + for k, v in this_module.__dict__.items(): + if not (k.startswith('_') or k == 'swig'): + namespace[k] = v + return + + # We're definitely going to load the templates. We set templates_loaded + # here instead of at the end of the file to protect against cyclical + # dependencies that could kill the recursive lookup below. + this_module.__templates_loaded = True + + # For external projects : + # If this_module name (variable name) is in the module_data dictionnary, + # then this_module is an installed module (or a previously loaded module). + # Otherwise, it may come from an external project. In this case, we must + # search the Configuration/Config.py file of this project. try: - # for a linux tree - execfile(os.path.join(path, 'Configuration', name + 'Config.py'), data) + module_data[name] except: - try: - # for a windows tree - execfile(os.path.join(path, '..', 'Configuration', name + 'Config.py'), data) - except: - data=None - if(data): - module_data[name] = data - - # Now, we we definitely need to load the template instantiations from the - # named module, and possibly also load the underlying SWIG module. Before we - # can load the template instantiations of this module, we need to load those - # of the modules on which this one depends. Ditto for the SWIG modules. - # So, we recursively satisfy the dependencies of named module and create the - # template instantiations. - # Dependencies are looked up from the auto-generated configuration files, via - # the module_data instance defined at the bottom of this file, which knows how - # to find those configuration files. - data = module_data[name] - if data: - deps = list(data['depends']) - deps.sort() - for dep in deps: - LoadModule(dep, namespace) - - if itkConfig.ImportCallback: itkConfig.ImportCallback(name, 0) - - # SWIG-generated modules have 'Python' appended. Only load the SWIG module if - # we haven't already. - swigModuleName = name + "Python" - loader = LibraryLoader() - if not swigModuleName in sys.modules: module = loader.load(swigModuleName) - - # OK, now the modules on which this one depends are loaded and template-instantiated, - # and the SWIG module for this one is also loaded. - # We're going to put the things we load and create in two places: the optional - # 'namespace' parameter, and the this_module variable's namespace. - - # make a new 'swig' sub-module for this_module. Also look up or create a - # different 'swig' module for 'namespace'. Since 'namespace' may be used to - # collect symbols from multiple different ITK modules, we don't want to - # stomp on an existing 'swig' module, nor do we want to share 'swig' modules - # between this_module and namespace. - - this_module.swig = imp.new_module('swig') - if namespace is not None: swig = namespace.setdefault('swig', imp.new_module('swig')) - for k, v in module.__dict__.items(): - if not k.startswith('__'): setattr(this_module.swig, k, v) - if namespace is not None and not k.startswith('__'): setattr(swig, k, v) - - data = module_data[name] - if data: - for template in data['templates']: - if len(template) == 4: - # this is a template description - pyClassName, cppClassName, swigClassName, templateParams = template - # It doesn't matter if an itkTemplate for this class name already exists - # since every instance of itkTemplate with the same name shares the same - # state. So we just make a new instance and add the new templates. - templateContainer = itkTemplate.itkTemplate(cppClassName) - try: - templateContainer.__add__(templateParams, getattr(module, swigClassName)) - setattr(this_module, pyClassName, templateContainer) - if namespace is not None: - current_value = namespace.get(pyClassName) - if current_value != None and current_value != templateContainer: - DebugPrintError("Namespace already has a value for %s, which is not an itkTemplate instance for class %s. Overwriting old value." %(pyClassName, cppClassName)) - namespace[pyClassName] = templateContainer - except Exception, e: - DebugPrintError("%s not loaded from module %s because of exception:\n %s" %(swigClassName, name, e)) - - else: - # this is a description of a non-templated class - pyClassName, cppClassName, swigClassName = template + file = inspect.getfile(this_module) + path = os.path.dirname(file) + + data = {} + conf = name + 'Config.py' try: - swigClass = getattr(module, swigClassName) - itkTemplate.registerNoTpl(cppClassName, swigClass) - setattr(this_module, pyClassName, swigClass) - if namespace is not None: - current_value = namespace.get(pyClassName) - if current_value != None and current_value != swigClass: - DebugPrintError("Namespace already has a value for %s, which is not class %s. Overwriting old value." %(pyClassName, cppClassName)) - namespace[pyClassName] = swigClass - except Exception, e: - DebugPrintError("%s not found in module %s because of exception:\n %s" %(swigClassName, name, e)) + # for a linux tree + execfile(os.path.join(path, 'Configuration', conf), data) + except: + try: + # for a windows tree + execfile(os.path.join(path, '..', 'Configuration', conf), data) + except: + data = None + if(data): + module_data[name] = data + + # Now, we definitely need to load the template instantiations from the + # named module, and possibly also load the underlying SWIG module. Before + # we can load the template instantiations of this module, we need to load + # those of the modules on which this one depends. Ditto for the SWIG + # modules. + # So, we recursively satisfy the dependencies of named module and create + # the template instantiations. + # Dependencies are looked up from the auto-generated configuration files, + # via the module_data instance defined at the bottom of this file, which + # knows how to find those configuration files. + data = module_data[name] + if data: + deps = sorted(data['depends']) + for dep in deps: + LoadModule(dep, namespace) + + if itkConfig.ImportCallback: + itkConfig.ImportCallback(name, 0) + + # SWIG-generated modules have 'Python' appended. Only load the SWIG module + # if we haven't already. + swigModuleName = name + "Python" + loader = LibraryLoader() + if not swigModuleName in sys.modules: + module = loader.load(swigModuleName) + + # OK, now the modules on which this one depends are loaded and + # template-instantiated, and the SWIG module for this one is also loaded. + # We're going to put the things we load and create in two places: the + # optional 'namespace' parameter, and the this_module variable's namespace. + + # make a new 'swig' sub-module for this_module. Also look up or create a + # different 'swig' module for 'namespace'. Since 'namespace' may be used to + # collect symbols from multiple different ITK modules, we don't want to + # stomp on an existing 'swig' module, nor do we want to share 'swig' + # modules between this_module and namespace. + + this_module.swig = imp.new_module('swig') + if namespace is not None: + swig = namespace.setdefault('swig', imp.new_module('swig')) + for k, v in module.__dict__.items(): + if not k.startswith('__'): + setattr(this_module.swig, k, v) + if namespace is not None and not k.startswith('__'): + setattr(swig, k, v) + + data = module_data[name] + if data: + for template in data['templates']: + if len(template) == 4: + # This is a template description + pyClassName, cppClassName, swigClassName, templateParams = \ + template + # It doesn't matter if an itkTemplate for this class name + # already exists since every instance of itkTemplate with the + # same name shares the same state. So we just make a new + # instance and add the new templates. + templateContainer = itkTemplate.itkTemplate(cppClassName) + try: + templateContainer.__add__( + templateParams, getattr(module, swigClassName)) + setattr(this_module, pyClassName, templateContainer) + if namespace is not None: + curval = namespace.get(pyClassName) + if curval is not None and curval != templateContainer: + DebugPrintError("Namespace already has a value for" + " %s, which is not an itkTemplate" + "instance for class %s. " + "Overwriting old value." + % (pyClassName, cppClassName)) + namespace[pyClassName] = templateContainer + except Exception as e: + DebugPrintError("%s not loaded from module %s because of " + "exception:\n %s" + % (swigClassName, name, e)) + + else: + # this is a description of a non-templated class + pyClassName, cppClassName, swigClassName = template + try: + swigClass = getattr(module, swigClassName) + itkTemplate.registerNoTpl(cppClassName, swigClass) + setattr(this_module, pyClassName, swigClass) + if namespace is not None: + curval = namespace.get(pyClassName) + if curval is not None and curval != swigClass: + DebugPrintError("Namespace already has a value for" + " %s, which is not class %s. " + "Overwriting old value." + % (pyClassName, cppClassName)) + namespace[pyClassName] = swigClass + except Exception as e: + DebugPrintError("%s not found in module %s because of " + "exception:\n %s" + % (swigClassName, name, e)) + + if itkConfig.ImportCallback: + itkConfig.ImportCallback(name, 1) - if itkConfig.ImportCallback: itkConfig.ImportCallback(name, 1) def DebugPrintError(error): - if itkConfig.DebugLevel == itkConfig.WARN: - print >> sys.stderr, error - elif itkConfig.DebugLevel == itkConfig.ERROR: - raise RuntimeError(error) + if itkConfig.DebugLevel == itkConfig.WARN: + print(error, file=sys.stderr) + elif itkConfig.DebugLevel == itkConfig.ERROR: + raise RuntimeError(error) -class LibraryLoader(object): - """Do all the work to set up the environment so that a SWIG-generated library - can be properly loaded. This invloves setting paths, etc., defined in itkConfig.""" - # To share symbols across extension modules, we must set - # sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL) - # - # Since RTLD_NOW==0x002 and RTLD_GLOBAL==0x100 very commonly - # we will just guess that the proper flags are 0x102 when there - # is no dl module. On darwin (where there is not yet a dl module) - # we need different flags because RTLD_GLOBAL = 0x008. - darwin_dlopenflags = 0xA - generic_dlopenflags = 0x102 - - if sys.platform.startswith('darwin'): - dlopenflags = darwin_dlopenflags - elif sys.platform.startswith('win'): - dlopenflags = None - else: - dlopenflags = generic_dlopenflags - # now try to refine the dlopenflags if we have a dl module. - try: - import dl - dlopenflags = dl.RTLD_NOW|dl.RTLD_GLOBAL - except: - pass +class LibraryLoader(object): + """Do all the work to set up the environment so that a SWIG-generated + library can be properly loaded. This invloves setting paths defined in + itkConfig.""" - def setup(self): - self.old_cwd = os.getcwd() - try: - os.chdir(itkConfig.swig_lib) - except OSError: - # silently pass to avoid the case where the dir is not there - pass - self.old_path = sys.path - sys.path = [itkConfig.swig_lib, itkConfig.swig_py] + sys.path - try: - self.old_dlopenflags = sys.getdlopenflags() - sys.setdlopenflags(self.dlopenflags) - except: - self.old_dlopenflags = None + def setup(self): + self.old_cwd = os.getcwd() + try: + os.chdir(itkConfig.swig_lib) + except OSError: + # silently pass to avoid the case where the dir is not there + pass + self.old_path = sys.path + sys.path = [itkConfig.swig_lib, itkConfig.swig_py] + sys.path - def load(self, name): - self.setup() - try: - fp = None # needed in case next line raises exception, so that finally block works - fp, pathname, description = imp.find_module(name) - return imp.load_module(name, fp, pathname, description) - finally: - # Since we may exit via an exception, close fp explicitly. - if fp: fp.close() - self.cleanup() - - def cleanup(self): - os.chdir(self.old_cwd) - sys.path = self.old_path - if self.old_dlopenflags: - try: sys.setdlopenflags(self.old_dlopenflags) - except: pass + def load(self, name): + self.setup() + try: + # needed in case next line raises exception, so that finally block + # works + fp = None + fp, pathname, description = imp.find_module(name) + return imp.load_module(name, fp, pathname, description) + finally: + # Since we may exit via an exception, close fp explicitly. + if fp: + fp.close() + self.cleanup() + + def cleanup(self): + os.chdir(self.old_cwd) + sys.path = self.old_path # Make a list of all know modules (described in *Config.py files in the @@ -231,12 +239,13 @@ dirs = [p for p in itkConfig.path if os.path.isdir(p)] module_data = {} for d in dirs: - known_modules = [f[:-9] for f in os.listdir(d+os.sep+"Configuration") if f.endswith('Config.py')] - known_modules.sort() - sys.path.append(d) - sys.path.append(d+os.sep+".."+os.sep+"lib") - - for module in known_modules: - data = {} - execfile(os.path.join(d+os.sep+"Configuration", module + 'Config.py'), data) - module_data[module] = data + files = os.listdir(d + os.sep + "Configuration") + known_modules = sorted([f[:-9] for f in files if f.endswith('Config.py')]) + sys.path.append(d) + sys.path.append(d + os.sep + ".." + os.sep + "lib") + + for module in known_modules: + data = {} + conf = module + 'Config.py' + execfile(os.path.join(d + os.sep + "Configuration", conf), data) + module_data[module] = data diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkdata.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkdata.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkdata.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkdata.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ - -import itkbase -import sys -import os - -# Put the ITK_DATA_ROOT setting in the global namespace. This -# package is only used for testing, so this is okay. - -ITK_DATA_ROOT = "" - -# Look for the -D command line option. -if not ITK_DATA_ROOT: - for a in range(len(sys.argv)): - if sys.argv[a] == "-D" and a < len(sys.argv): - ITK_DATA_ROOT = sys.argv[a+1] - break - -# Check for the environment variable ::ITK_DATA_ROOT. -if not ITK_DATA_ROOT and os.environ.has_key('ITK_DATA_ROOT'): - ITK_DATA_ROOT = os.environ['ITK_DATA_ROOT'] - - -# Use the default output directory. -if not ITK_DATA_ROOT: - ITK_DATA_ROOT = itkbase.defaultDataRoot diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkData.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkData.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkData.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkData.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,42 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + +import itkBase +import sys +import os + +# Put the ITK_DATA_ROOT setting in the global namespace. This +# package is only used for testing, so this is okay. + +ITK_DATA_ROOT = "" + +# Look for the -D command line option. +if not ITK_DATA_ROOT: + for a in range(len(sys.argv)): + if sys.argv[a] == "-D" and a < len(sys.argv): + ITK_DATA_ROOT = sys.argv[a + 1] + break + +# Check for the environment variable ::ITK_DATA_ROOT. +if not ITK_DATA_ROOT and 'ITK_DATA_ROOT' in os.environ: + ITK_DATA_ROOT = os.environ['ITK_DATA_ROOT'] + + +# Use the default output directory. +if not ITK_DATA_ROOT: + ITK_DATA_ROOT = itkBase.defaultDataRoot diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/CMakeLists.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ -# Copy python files for out-of-source builds, and set up install of same. - -# Create a list of Python files. -# WrapITK/Python/itkExtras/*.py -set(ITK_PYTHON_EXTRAS_FILES - __init__ - ) -# Done listing files. - -# Now copy these files if necessary. -set(ITK_WRAP_PYTHON_EXTRAS_INSTALL_FILES "") -if("${WrapITK_BINARY_DIR}" MATCHES "^${WrapITK_SOURCE_DIR}$") - # In source build -- no need to copy Python file. Do need to set up the install. - foreach(file ${ITK_PYTHON_EXTRAS_FILES}) - set(install_tgt "${CMAKE_CURRENT_SOURCE_DIR}/${file}.py") - set(ITK_WRAP_PYTHON_EXTRAS_INSTALL_FILES ${ITK_WRAP_PYTHON_EXTRAS_FILES} "${install_tgt}") - endforeach() -else() - set(ITK_WRAP_PYTHON_EXTRAS_FILES) - add_custom_target(copy_python_extras_files ALL) - foreach(file ${ITK_PYTHON_EXTRAS_FILES}) - set(src "${CMAKE_CURRENT_SOURCE_DIR}/${file}.py") - # recall that WRAP_ITK_BUILD_INTDIR expands to nothing if no config types are set, - # or to "CMAKE_CONFIG_INTDIR/" if there are such. Likewise, WRAP_ITK_INSTALL_INTDIR - # expands to ${BUILD_TYPE}/ or nothing. - set(copy_tgt "${CMAKE_CURRENT_BINARY_DIR}/${file}.py") - set(ITK_WRAP_PYTHON_EXTRAS_FILES ${ITK_WRAP_PYTHON_EXTRAS_FILES} "${copy_tgt}") - set(install_tgt "${CMAKE_CURRENT_BINARY_DIR}/${file}.py") - set(ITK_WRAP_PYTHON_EXTRAS_INSTALL_FILES ${ITK_WRAP_PYTHON_EXTRAS_INSTALL_FILES} "${install_tgt}") - - # create the directory to avoid loosing case on windows - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${WRAP_ITK_INSTALL_INTDIR}${path}) - - add_custom_command(SOURCE ${src} - COMMAND ${CMAKE_COMMAND} - ARGS -E copy ${src} ${copy_tgt} - OUTPUTS ${copy_tgt} - TARGET copy_python_extras_files - COMMENT "source copy") - endforeach() - - # driver command to make the copy happen. - add_custom_command( - SOURCE copy_python_extras_files - DEPENDS ${ITK_WRAP_PYTHON_EXTRAS_FILES} - TARGET copy_python_extras_files) -endif() - -# Install the package python files. -WRAP_ITK_BINDINGS_INSTALL(/Python/itkExtras ${ITK_WRAP_PYTHON_EXTRAS_INSTALL_FILES}) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/__init__.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/__init__.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/__init__.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1029 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ - -# new features introduced by itk module -# each new feature use a name in lower case -clrLine = "\033[2000D\033[K" - -def auto_not_in_place( v=True ) : - """Force it to not run in place - """ - import itkConfig - itkConfig.NotInPlace = v - -def auto_progress( progressType = 1 ): - """Set up auto progress report - - progressType: - 1 or True -> auto progress be used in a terminal - 2 -> simple auto progress (without special characters) - 0 or False -> disable auto progress - """ - import itkConfig - - if progressType == True or progressType == 1 : - itkConfig.ImportCallback = terminal_import_callback - itkConfig.ProgressCallback = terminal_progress_callback - - elif progressType == 2 : - itkConfig.ImportCallback = simple_import_callback - itkConfig.ProgressCallback = simple_progress_callback - - elif progressType == False or progressType == 0 : - itkConfig.ImportCallback = None - itkConfig.ProgressCallback = None - - else: - raise ValueError("Invalid auto progress type: "+repr(progressType)) - -def terminal_progress_callback(name, p): - """Display the progress of an object and clean the display once complete - - This function can be used with itkConfig.ProgressCallback - """ - import sys - print >> sys.stderr, clrLine+"%s: %f" % (name, p), - if p == 1 : - print >> sys.stderr, clrLine, - -def terminal_import_callback(name, p): - """Display the loading of a module and clean the display once complete - - This function can be used with itkConfig.ImportCallback - """ - import sys - print >> sys.stderr, clrLine+"Loading %s..." % name, - if p == 1 : - print >> sys.stderr, clrLine, - -def simple_import_callback(name, p): - """Print a message when a module is loading - - This function can be used with itkConfig.ImportCallback - """ - import sys - if p == 0: - print >> sys.stderr, "Loading %s..." % name, - elif p == 1 : - print >> sys.stderr, "done" - -def simple_progress_callback(name, p): - """Print a message when an object is running - - This function can be used with itkConfig.ProgressCallback - """ - import sys - if p == 0 : - print >> sys.stderr, "Running %s..." % name, - elif p == 1 : - print >> sys.stderr, "done" - - -def force_load(): - """force itk to load all the submodules""" - import itk - for k in dir(itk): - getattr(itk, k) - - -import sys -def echo(object, f=sys.stderr) : - """Print an object is f - - If the object has a method Print(), this method is used. - repr(object) is used otherwise - """ - print >> f, object -del sys - - -def size(imageOrFilter) : - """Return the size of an image, or of the output image of a filter - - This method take care of updating the needed informations - """ - # we don't need the entire output, only its size - imageOrFilter.UpdateOutputInformation() - img = output(imageOrFilter) - return img.GetLargestPossibleRegion().GetSize() - - -def physical_size(imageOrFilter) : - """Return the physical size of an image, or of the output image of a filter - - This method take care of updating the needed informations - """ - from __builtin__ import range # required because range is overladed in this module - spacing_ = spacing(imageOrFilter) - size_ = size(imageOrFilter) - result = [] - for i in range(0, spacing_.Size()): - result.append( spacing_.GetElement(i) * size_.GetElement(i) ) - return result - - -def spacing(imageOrFilter) : - """Return the spacing of an image, or of the output image of a filter - - This method take care of updating the needed informations - """ - # we don't need the entire output, only its size - imageOrFilter.UpdateOutputInformation() - img = output(imageOrFilter) - return img.GetSpacing() - - -def origin(imageOrFilter) : - """Return the origin of an image, or of the output image of a filter - - This method take care of updating the needed informations - """ - # we don't need the entire output, only its size - imageOrFilter.UpdateOutputInformation() - img = output(imageOrFilter) - return img.GetOrigin() - - -def index(imageOrFilter) : - """Return the index of an image, or of the output image of a filter - - This method take care of updating the needed informations - """ - # we don't need the entire output, only its size - imageOrFilter.UpdateOutputInformation() - img = output(imageOrFilter) - return img.GetLargestPossibleRegion().GetIndex() - - -def region(imageOrFilter) : - """Return the region of an image, or of the output image of a filter - - This method take care of updating the needed informations - """ - # we don't need the entire output, only its size - imageOrFilter.UpdateOutputInformation() - img = output(imageOrFilter) - return img.GetLargestPossibleRegion() - - -def strel(dim, radius=1) : - """A method to create a ball structuring element - """ - import itk - import sys - # print >> sys.stderr, "strel() is deprecated and will be removed in the next release" - return itk.FlatStructuringElement[dim].Ball(radius) - -# return an image -from itkTemplate import image, output - - -def template(cl) : - """Return the template of a class (or of the class of an object) and its parameters - - template() returns a tuple with 2 elements: - - the first one is the itkTemplate object - - the second is a tuple containing the template parameters - """ - from itkTemplate import itkTemplate - return itkTemplate.__class_to_template__[class_(cl)] - - -def ctype(s) : - """Return the c type corresponding to the string passed in parameter - - The string can contain some extra spaces. - see also itkCType - """ - from itkTypes import itkCType - ret = itkCType.GetCType(" ".join(s.split())) - if ret == None : - raise KeyError("Unrecognized C type '%s'" % s) - return ret - - -def class_(obj) : - """Return a class from an object - - Often in itk, the __class__ is not what the user is expecting. - class_() should do a better job - """ - import inspect - if inspect.isclass(obj) : - # obj is already a class ! - return obj - else : - return obj.__class__ - - -def range(imageOrFilter) : - """Return the range of values in a image of in the output image of a filter - - The minimum and maximum values are returned in a tuple: (min, max) - range() take care of updating the pipeline - """ - import itk - img = output(imageOrFilter) - img.UpdateOutputInformation() - img.Update() - # don't put that calculator in the automatic pipeline - tmp_auto_pipeline = auto_pipeline.current - auto_pipeline.current = None - comp = itk.MinimumMaximumImageCalculator[img].New(Image=img) - auto_pipeline.current = tmp_auto_pipeline - comp.Compute() - return (comp.GetMinimum(), comp.GetMaximum()) - - -def write(imageOrFilter, fileName, compression=False): - """Write a image or the output image of a filter to filename - - The writer is instantiated with the image type of the image in - parameter (or, again, with the output image of the filter in parameter) - """ - import itk - img = output(imageOrFilter) - img.UpdateOutputInformation() - # don't put that writer in the automatic pipeline - tmp_auto_pipeline = auto_pipeline.current - auto_pipeline.current = None - writer = itk.ImageFileWriter[img].New(Input=img, FileName=fileName, UseCompression=compression) - auto_pipeline.current = tmp_auto_pipeline - writer.Update() - - -def index_to_physical_point( imageOrFilter, idx ): - """Get the pysical point in an image from an index - - imageOrFilter is the image where the physical point must be computed - idx is the index used to compute the physical point. It can be a continuous index. - """ - import sys - print >> sys.stderr, "WrapITK warning: itk.index_to_physical_point() is deprecated. The coresponding templated method is now available in itk::ImageBase." - from __builtin__ import range # required because range is overladed in this module - # get the image if needed - img = output( imageOrFilter ) - dim = img.GetImageDimension() - o = origin( img ) - s = spacing( img ) - - # use the typemaps to really get a continuous index - import itk - idx = itk.ContinuousIndex[ itk.D, dim ]( idx ) - - # create the output object - p = itk.Point[ itk.D, dim ]() - for i in range( 0, dim ): - p[i] = s[i] * idx[i] + o[i] - return p - - -def physical_point_to_continuous_index( imageOrFilter, p ): - """Get the continuous index in an image from the physical point - - imageOrFilter is the image where the physical point must be computed - p is the point used to compute the index - """ - import sys - print >> sys.stderr, "WrapITK warning: itk.index_to_physical_point() is deprecated. The coresponding templated method is now available in itk::ImageBase." - from __builtin__ import range # required because range is overladed in this module - # get the image if needed - img = output( imageOrFilter ) - dim = img.GetImageDimension() - o = origin( img ) - s = spacing( img ) - - # use the typemaps to really get a point - import itk - p = itk.Point[ itk.D, dim ]( p ) - - # create the output object - idx = itk.ContinuousIndex[ itk.D, dim ]() - for i in range( 0, dim ): - idx.SetElement( i, ( p[i] - o[i] ) / s[i] ) - return idx - - -def physical_point_to_index( imageOrFilter, p ): - """Get the index in an image from the physical point - - image is the image where the physical point must be computed - p is the point used to compute the index - """ - import sys - print >> sys.stderr, "WrapITK warning: itk.physical_point_to_index() is deprecated. The coresponding templated method is now available in itk::ImageBase." - from __builtin__ import range # required because range is overladed in this module - # get the image if needed - img = output( imageOrFilter ) - dim = img.GetImageDimension() - o = origin( img ) - s = spacing( img ) - - # use the typemaps to really get a point - import itk - p = itk.Point[ itk.D, dim ]( p ) - - # create the output object - idx = itk.Index[ dim ]() - for i in range( 0, dim ): - idx.SetElement( i, int( round( ( p[i] - o[i] ) / s[i] ) ) ) - return idx - - -def search( s, case_sensitive=False): #, fuzzy=True): - """Search for a class name in the itk module. - """ - s = s.replace(" ", "") - if not case_sensitive: - s = s.lower() - import itk - names = dir(itk) - names.sort() - # exact match first - if case_sensitive: - res = [n for n in names if s == n] - else: - res = [n for n in names if s == n.lower()] - # then exact match inside the name - if case_sensitive: - res += [n for n in names if s in n and s != n] - else: - res += [n for n in names if s in n.lower() and s != n.lower()] -# if fuzzy: -# try: -# # everything now requires editdist -# import editdist -# if case_sensitive: -# res.sort(key=lambda x: editdist.distance(x, s)) -# else: -# res.sort(key=lambda x: (editdist.distance(x.lower(), s), x)) -# except: -# pass - return res - - -def set_inputs( newItkObject, args=[], kargs={} ): - """Set the inputs of the given objects, according to the non named or the named parameters in args and kargs - - This function tries to assign all the non named parameters in the input of the newItkObject - - the first non named parameter in the first input, etc. - - The named parameters are used by calling the method with the same name prefixed by 'Set'. - set_inputs( obj, kargs={'Threshold': 10} ) calls obj.SetThreshold(10) - - This is the function use in the enhanced New() method to manage the inputs. - It can be used to produce a similar behavior: - - def SetInputs(self, *args, **kargs): - import itk - itk.set_inputs(self, *args, **kargs) - """ - # try to get the images from the filters in args - args = [output(arg) for arg in args] - - # args without name are filter used to set input image - # - # count SetInput calls to call SetInput, SetInput2, SetInput3, ... - # usefull with filter which take 2 input (or more) like SubstractImageFiler - # Ex: substract image2.png to image1.png and save the result in result.png - # r1 = itk.ImageFileReader.US2.New(FileName='image1.png') - # r2 = itk.ImageFileReader.US2.New(FileName='image2.png') - # s = itk.SubtractImageFilter.US2US2US2.New(r1, r2) - # itk.ImageFileWriter.US2.New(s, FileName='result.png').Update() - try : - for setInputNb, arg in enumerate(args) : - methodName = 'SetInput%i' % (setInputNb+1) - if methodName in dir(newItkObject) : - # first try to use methods called SetInput1, SetInput2, ... - # those method should have more chances to work in case of multiple - # input types - getattr(newItkObject, methodName)(arg) - else : - # no method called SetInput? - # try with the standard SetInput(nb, input) - newItkObject.SetInput(setInputNb, arg) - except TypeError, e : - # the exception have (at least) to possible reasons: - # + the filter don't take the input number as first argument - # + arg is an object of wrong type - # - # if it's not the first input, re-raise the exception - if setInputNb != 0 : - raise e - # it's the first input, try to use the SetInput() method without input number - newItkObject.SetInput(args[0]) - # but raise an exception if there is more than 1 argument - if len(args) > 1 : - raise TypeError('Object accept only 1 input.') - except AttributeError : - # There is no SetInput() method, try SetImage - # but before, check the number of inputs - if len(args) > 1 : - raise TypeError('Object accept only 1 input.') - methodList = ['SetImage', 'SetInputImage'] - methodName = None - for m in methodList: - if m in dir(newItkObject): - methodName = m - if methodName : - getattr(newItkObject, methodName)(args[0]) - else: - raise AttributeError('No method found to set the input.') - - # named args : name is the function name, value is argument(s) - for attribName, value in kargs.iteritems() : - # use Set as prefix. It allow to use a shorter and more intuitive - # call (Ex: itk.ImageFileReader.UC2.New(FileName='image.png')) than with the - # full name (Ex: itk.ImageFileReader.UC2.New(SetFileName='image.png')) - if attribName not in ["auto_progress", "template_parameters"] : - attrib = getattr(newItkObject, 'Set' + attribName) - attrib(value) - - -def show(input, **kargs) : - """display an image - """ - import itk - img = output(input) - if img.GetImageDimension() == 3 and "show3D" in dir(itk): - return itk.show3D(input, **kargs) - else : - # print "2D not supported yet, use the 3D viewer." - return show2D(input, **kargs) - -class show2D : - """Display a 2D image - """ - def __init__(self, imageOrFilter, Label=False, Title=None) : - import tempfile, itk, os, platform - # get some data from the environment - command = os.environ.get("WRAPITK_SHOW2D_COMMAND") - if command==None: - if platform.system() == "Darwin": - command = "open -a ImageJ -n --args -eval 'open(\"%(image)s\"); run (\"View 100%%\"); rename(\"%(title)s\");'" - else: - command = "imagej %(image)s -run 'View 100%%' -eval 'rename(\"%(title)s\")' &" - - label_command = os.environ.get("WRAPITK_SHOW2D_LABEL_COMMAND") - if label_command==None: - if platform.system() == "Darwin": - label_command = "open -a ImageJ -n --args -eval 'open(\"%(image)s\"); run (\"View 100%%\"); rename(\"%(title)s\"); run(\"3-3-2 RGB\");'" - else: - label_command = "imagej %(image)s -run 'View 100%%' -eval 'rename(\"%(title)s\")' -run '3-3-2 RGB' &" - - compress = os.environ.get("WRAPITK_SHOW2D_COMPRESS", "true").lower() in ["on", "true", "yes", "1"] - extension = os.environ.get("WRAPITK_SHOW2D_EXTENSION", ".tif") - - # use the tempfile module to get a non used file name and to put - # the file at the rignt place - self.__tmpFile__ = tempfile.NamedTemporaryFile(suffix=extension) - # get an updated image - img = output(imageOrFilter) - img.UpdateOutputInformation() - img.Update() - if Title == None: - # try to generate a title - s = img.GetSource() - if s: - s = itk.down_cast(s) - if hasattr(img, "GetSourceOutputIndex"): - o = '[%s]' % img.GetSourceOutputIndex() - elif hasattr(img, "GetSourceOutputName"): - o = '[%s]' % img.GetSourceOutputName() - else: - o = "" - Title = "%s%s" % (s.__class__.__name__, o) - else: - Title = img.__class__.__name__ - try: - import IPython.ipapi - ip = IPython.ipapi.get() - if ip != None: - names = [] - ref = imageOrFilter - if s: - ref = s - for n, v in ip.user_ns.iteritems(): - if isinstance(v, itk.LightObject) and v == ref: - names.append(n) - if names != []: - Title = ", ".join(names)+" - "+Title - except ImportError: - # just do nothing - pass - # change the LabelMaps to an Image, so we can look at them easily - if 'LabelMap' in dir(itk) and img.GetNameOfClass() == 'LabelMap': - # retreive the biggest label in the label map - maxLabel = img.GetNthLabelObject( img.GetNumberOfLabelObjects() - 1 ).GetLabel() - # search for a filter to convert the label map - label_image_type = sorted( [params[1] for params in itk.LabelMapToLabelImageFilter.keys() if params[0] == class_(img) and itk.NumericTraits[itk.template(params[1])[1][0]].max() >= maxLabel ] )[0] - convert = itk.LabelMapToLabelImageFilter[ img, label_image_type ].New( img ) - convert.Update() - img = convert.GetOutput() - # this is a label image - force the parameter - Label = True - write(img, self.__tmpFile__.name, compress) - # now run imview - import os - if Label: - os.system( label_command % {"image":self.__tmpFile__.name, "title": Title} ) - else: - os.system( command % {"image":self.__tmpFile__.name, "title": Title} ) - #tmpFile.close() - - -class templated_class: - """This class is used to mimic the behavior of the templated C++ classes. - - It is used that way: - - class CustomClass: - # class definition here - CustomClass = templated_class(CustomClass) - - customObject = CustomClass[template, parameters].New() - - The template parameters are passed to the custom class constructor as a named parameter - 'template_parameters' in a tuple. - - The custom class may implement a static method check_template_parameters(parameters) - which should raise an exception if the template parameters provided are not suitable - to instantiate the custom class. - """ - def __init__(self, cls): - """cls is the custom class - """ - self.__cls__ = cls - self.__templates__ = {} - - def New(self, *args, **kargs): - """Use the parameters to infer the types of the template parameters. - """ - # extract the types from the arguments to instantiate the class - import itk - types = tuple(itk.class_(o) for o in args) - return self[types].New(*args, **kargs) - - def __getitem__(self, template_parameters): - """Return a pair class-template parameters ready to be instantiated. - - The template parameters may be validated if the custom class provide the static - method check_template_parameters(parameters). - """ - if not isinstance(template_parameters, tuple): - template_parameters = (template_parameters,) - return templated_class.__templated_class_and_parameters__(self, template_parameters) - - def check_template_parameters(self, template_parameters): - """Check the template parameters passed in parameter. - """ - # this method is there mainly to make possible to reuse it in the custom class - # constructor after having used templated_class(). Without that, the following - # example doesn't work: - # - # class CustomClass: - # def __init__(self, *args, **kargs): - # template_parameters = kargs["template_parameters"] - # CustomClass.check_template_parameters(template_parameters) - # # other init stuff - # def check_template_parameters(template_parameters): - # # check, really - # pass - # CustomClass = templated_class(CustomClass) - # - self.__cls__.check_template_parameters(template_parameters) - - def add_template(self, name, params): - if not isinstance(params, list) and not isinstance(params, tuple): - params = (params,) - params = tuple(params) - val = self[params] - self.__templates__[params] = val - setattr(self, name, val) - - def add_image_templates(self, *args): - import itk - if args == []: - return - combinations = [[t] for t in args[0]] - for types in args[1:]: - temp = [] - for t in types: - for c in combinations: - temp.append(c+[t]) - combinations = temp - for d in itk.DIMS: - for c in combinations: - parameters = [] - name = "" - for t in c: - parameters.append( itk.Image[t, d] ) - name += "I"+t.short_name+str(d) - self.add_template(name, tuple(parameters)) - - class __templated_class_and_parameters__: - """Inner class used to store the pair class-template parameters ready to instantiate. - """ - def __init__(self, templated_class, template_parameters): - self.__templated_class__ = templated_class - self.__template_parameters__ = template_parameters - if "check_template_parameters" in dir(templated_class.__cls__): - templated_class.__cls__.check_template_parameters(template_parameters) - - def New(self, *args, **kargs): - """A New() method to mimic the ITK default behavior, even if the class doesn't provide any New() method. - """ - kargs["template_parameters"] = self.__template_parameters__ - if "New" in dir(self.__templated_class__.__cls__): - obj = self.__templated_class__.__cls__.New(*args, **kargs) - else: - obj = self.__templated_class__.__cls__(*args, **kargs) - setattr(obj, "__template_parameters__", self.__template_parameters__) - setattr(obj, "__templated_class__", self.__templated_class__) - return obj - - def __call__(self, *args, **kargs): - return self.New(*args, **kargs) - - def keys(self): - return self.__templates__.keys() - - # everything after this comment is for dict interface - # and is a copy/paste from DictMixin - # only methods to edit dictionary are not there - def __iter__(self): - for k in self.keys(): - yield k - - def has_key(self,key): - try: - value=self[key] - except KeyError: - return False - return True - - def __contains__(self,key): - return self.has_key(key) - - # third level takes advantage of second level definitions - def iteritems(self): - for k in self: - yield (k,self[k]) - - def iterkeys(self): - return self.__iter__() - - # fourth level uses definitions from lower levels - def itervalues(self): - for _,v in self.iteritems(): - yield v - - def values(self): - return [v for _,v in self.iteritems()] - - def items(self): - return list(self.iteritems()) - - def get(self,key,default=None): - try: - return self[key] - except KeyError: - return default - - def __len__(self): - return len(self.keys()) - - -class pipeline: - """A convenient class to store the reference to the filters of a pipeline - - With this class, a method can create a pipeline of several filters and return - it without losing the references to the filters in this pipeline. The pipeline - object act almost like a filter (it has a GetOutput() method) and thus can - be simply integrated in another pipeline. - """ - def __init__( self, *args, **kargs ): - self.clear() - self.input = None - set_inputs( self, args, kargs ) - - def connect( self, filter ): - """Connect a new filter to the pipeline - - The output of the first filter will be used as the input of this - one and the filter passed as parameter will be added to the list - """ - if self.GetOutput() != None: - set_inputs(filter, [self.GetOutput()] ) - self.append( filter ) - - def append( self, filter ): - """Add a new filter to the pipeline - - The new filter will not be connected. The user must connect it. - """ - self.filters.append( filter ) - - def clear( self ): - """Clear the filter list - """ - self.filters = [] - - def GetOutput( self, index=0 ): - """Return the output of the pipeline - - If another output is needed, use - pipeline.filters[-1].GetAnotherOutput() instead of this method, subclass - pipeline to implement another GetOutput() method, or use expose() - """ - if len(self.filters) == 0: - return self.GetInput() - else : - filter = self.filters[-1] - if hasattr(filter, "__getitem__"): - return filter[index] - try: - return filter.GetOutput(index) - except: - if index == 0: - return filter.GetOutput() - else: - raise ValueError("Index can only be 0 on that object") - - def SetInput( self, input ): - """Set the input of the pipeline - """ - if len(self.filters) != 0: - set_inputs(self.filters[0], [input]) - self.input = input - - def GetInput( self ): - """Get the input of the pipeline - """ - return self.input - - def Update( self ): - """Update the pipeline - """ - if len(self.filters) > 0: - return self.filters[-1].Update() - - def UpdateLargestPossibleRegion( self ): - """Update the pipeline - """ - if len(self.filters) > 0: - return self.filters[-1].UpdateLargestPossibleRegion() - - def UpdateOutputInformation( self ): - if "UpdateOutputInformation" in dir(self.filters[-1]): - self.filters[-1].UpdateOutputInformation() - else: - self.Update() - - def __len__(self): - if len(self.filters) == 0: - return 1 - else: - return self.filters[-1].GetNumberOfOutputs() - - def __getitem__(self, item): - return self.GetOutput( item ) - - def __call__(self, *args, **kargs): - set_inputs( self, args, kargs ) - self.UpdateLargestPossibleRegion() - return self - - def expose(self, name, new_name=None, position=-1): - """Expose an attribute from a filter of the minipeline. - - Once called, the pipeline instance has a new Set/Get set of methods to access - directly the corresponding method of one of the filter of the pipeline. - Ex: p.expose( "Radius" ) - p.SetRadius( 5 ) - p.GetRadius( 5 ) - By default, the attribute usable on the pipeline instance has the same name than - the one of the filter, but it can be changed by providing a value to new_name. - The last filter of the pipeline is used by default, but another one may be used - by giving its position. - Ex: p.expose("Radius", "SmoothingNeighborhood", 2) - p.GetSmoothingNeighborhood() - """ - if new_name == None: - new_name = name - src = self.filters[position] - ok = False - set_name = "Set" + name - if set_name in dir(src): - setattr(self, "Set" + new_name, getattr(src, set_name)) - ok = True - get_name = "Get" + name - if get_name in dir(src): - setattr(self, "Get" + new_name, getattr(src, get_name)) - ok = True - if not ok: - raise RuntimeError("No attribute %s at position %s." % (name, position)) - - -class auto_pipeline(pipeline): - current = None - - def __init__(self, *args, **kargs): - pipeline.__init__(self, *args, **kargs) - self.Start() - - def Start(self): - auto_pipeline.current = self - - def Stop(self): - auto_pipeline.current = None - - -def down_cast(obj): - """Down cast an itkLightObject (or a object of a subclass) to its most specialized type. - """ - import itk, itkTemplate - className = obj.GetNameOfClass() - t = getattr(itk, className) - if isinstance(t, itkTemplate.itkTemplate): - for c in t.values(): - try: - return c.cast(obj) - except: - # fail silently for now - pass - raise RuntimeError("Can't downcast to a specialization of %s" % className) - else: - return t.cast(obj) - -def attribute_list( i, name ): - """Returns a list of the specified attributes for the objects in the image. - - i: the input LabelImage - name: the attribute name - """ - import itk - i = itk.output(i) - relabel = itk.StatisticsRelabelLabelMapFilter[i].New(i, Attribute=name, ReverseOrdering=True, InPlace=False) - relabel.UpdateLargestPossibleRegion() - r = relabel.GetOutput() - l = [] - for i in range(1, r.GetNumberOfLabelObjects()+1): - l.append( r.GetLabelObject(i).__getattribute__("Get"+name)() ) - return l - - -def attributes_list( i, names ): - """Returns a list of the specified attributes for the objects in the image. - - i: the input LabelImage - name: the attribute name - """ - import itk - i = itk.output(i) - relabel = itk.StatisticsRelabelLabelMapFilter[i].New(i, Attribute=names[0], ReverseOrdering=True, InPlace=False) - relabel.UpdateLargestPossibleRegion() - r = relabel.GetOutput() - l = [] - for i in range(1, r.GetNumberOfLabelObjects()+1): - attrs = [] - for name in names : - attrs.append( r.GetLabelObject(i).__getattribute__("Get"+name)() ) - l.append( tuple( attrs ) ) - return l - - -def attribute_dict( i, name ): - """Returns a dict with the attribute values in keys and a list of the corresponding objects in value - - i: the input LabelImage - name: the name of the attribute - """ - import itk - i = itk.output(i) - relabel = itk.StatisticsRelabelLabelMapFilter[i].New(i, Attribute=name, ReverseOrdering=True, InPlace=False) - relabel.UpdateLargestPossibleRegion() - r = relabel.GetOutput() - d = {} - for i in range(1, r.GetNumberOfLabelObjects()+1): - lo = r.GetLabelObject(i) - v = lo.__getattribute__("Get"+name)() - l = d.get( v, [] ) - l.append( lo ) - d[v] = l - return d - - -def number_of_objects( i ): - """Returns the number of objets in the image. - - i: the input LabelImage - """ - import itk - i.UpdateLargestPossibleRegion() - i = itk.output(i) - return i.GetNumberOfLabelObjects() - -def ipython_kw_matches(text): - """Match named ITK object's named parameters""" - import IPython.ipapi, itk, re, inspect, itkTemplate - regexp = re.compile(r''' - '.*?' | # single quoted strings or - ".*?" | # double quoted strings or - \w+ | # identifier - \S # other characters - ''', re.VERBOSE | re.DOTALL) - ip = IPython.ipapi.get() - if "." in text: # a parameter cannot be dotted - return [] - # 1. find the nearest identifier that comes before an unclosed - # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo". - # Use get_endidx() to find the indentifier at the cursor position - tokens = regexp.findall(ip.IP.Completer.get_line_buffer()[:ip.IP.Completer.get_endidx()]) - tokens.reverse() - iterTokens = iter(tokens); openPar = 0 - for token in iterTokens: - if token == ')': - openPar -= 1 - elif token == '(': - openPar += 1 - if openPar > 0: - # found the last unclosed parenthesis - break - else: - return [] - # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" ) - ids = [] - isId = re.compile(r'\w+$').match - while True: - try: - ids.append(iterTokens.next()) - if not isId(ids[-1]): - ids.pop(); break - if not iterTokens.next() == '.': - break - except StopIteration: - break - # lookup the candidate callable matches either using global_matches - # or attr_matches for dotted names - if len(ids) == 1: - callableMatches = ip.IP.Completer.global_matches(ids[0]) - else: - callableMatches = ip.IP.Completer.attr_matches('.'.join(ids[::-1])) - argMatches = [] - for callableMatch in callableMatches: - # drop the .New at this end, so we can search in the class members - if callableMatch.endswith(".New"): - callableMatch = callableMatch[:-4] - try: - object = eval(callableMatch, ip.IP.Completer.namespace) - if isinstance(object, itkTemplate.itkTemplate): - # this is a template - lets grab the first entry to search for the methods - object = object.values()[0] - namedArgs = [] - if isinstance(object, itk.LightObject) or (inspect.isclass(object) and issubclass(object, itk.LightObject)): - namedArgs = [n[3:] for n in dir(object) if n.startswith("Set")] - except Exception, e: - print e - continue - for namedArg in namedArgs: - if namedArg.startswith(text): - argMatches.append("%s=" %namedArg) - return argMatches - -# install progress callback and custom completer if we are in ipython interpreter -try: - import itkConfig, IPython.ipapi - if IPython.ipapi.get(): - IPython.ipapi.get().IP.Completer.matchers.insert(0, ipython_kw_matches) - itkConfig.ProgressCallback = terminal_progress_callback - # some cleanup - del itkConfig, IPython -except ImportError: - # fail silently - pass - -# now loads the other modules we may found in the same directory -import os.path, sys -directory = os.path.dirname(__file__) -moduleNames = [name[:-len('.py')] for name in os.listdir(directory) if name.endswith('.py') and name != '__init__.py'] -for name in moduleNames: - # there should be another way - I don't like to much exec -, but the which one ?? - exec "from %s import *" % name -# some cleaning -del directory, os, sys, moduleNames, name diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkExtras.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,1035 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + +from __future__ import print_function + +# The following line defines an ascii string used for dynamically refreshing +# the import and progress callbacks on the same terminal line. +# See http://www.termsys.demon.co.uk/vtansi.htm +# \033 is the C-style octal code for an escape character +# [2000D moves the cursor back 2000 columns, this is a brute force way of +# getting to the start of the line. +# [K erases the end of the line +clrLine = "\033[2000D\033[K" + + +def auto_not_in_place(v=True): + """Force it to not run in place + """ + import itkConfig + itkConfig.NotInPlace = v + + +def auto_progress(progressType=1): + """Set up auto progress report + + progressType: + 1 or True -> auto progress be used in a terminal + 2 -> simple auto progress (without special characters) + 0 or False -> disable auto progress + """ + import itkConfig + + if progressType is True or progressType == 1: + itkConfig.ImportCallback = terminal_import_callback + itkConfig.ProgressCallback = terminal_progress_callback + + elif progressType == 2: + itkConfig.ImportCallback = simple_import_callback + itkConfig.ProgressCallback = simple_progress_callback + + elif progressType is False or progressType == 0: + itkConfig.ImportCallback = None + itkConfig.ProgressCallback = None + + else: + raise ValueError("Invalid auto progress type: " + repr(progressType)) + + +def terminal_progress_callback(name, p): + """Display the progress of an object and clean the display once complete + + This function can be used with itkConfig.ProgressCallback + """ + import sys + print(clrLine + "%s: %f" % (name, p), file=sys.stderr) + if p == 1: + print(clrLine, file=sys.stderr) + + +def terminal_import_callback(name, p): + """Display the loading of a module and clean the display once complete + + This function can be used with itkConfig.ImportCallback + """ + import sys + print(clrLine + "Loading %s..." % name, file=sys.stderr) + if p == 1: + print(clrLine, file=sys.stderr) + + +def simple_import_callback(name, p): + """Print a message when a module is loading + + This function can be used with itkConfig.ImportCallback + """ + import sys + if p == 0: + print("Loading %s..." % name, file=sys.stderr) + elif p == 1: + print("done", file=sys.stderr) + + +def simple_progress_callback(name, p): + """Print a message when an object is running + + This function can be used with itkConfig.ProgressCallback + """ + import sys + if p == 0: + print("Running %s..." % name, file=sys.stderr) + elif p == 1: + print("done", file=sys.stderr) + + +def force_load(): + """force itk to load all the submodules""" + import itk + for k in dir(itk): + getattr(itk, k) + + +import sys + + +def echo(object, f=sys.stderr): + """Print an object is f + + If the object has a method Print(), this method is used. + repr(object) is used otherwise + """ + print(f, object) +del sys + + +def size(imageOrFilter): + """Return the size of an image, or of the output image of a filter + + This method take care of updating the needed informations + """ + # we don't need the entire output, only its size + imageOrFilter.UpdateOutputInformation() + img = output(imageOrFilter) + return img.GetLargestPossibleRegion().GetSize() + + +def physical_size(imageOrFilter): + """Return the physical size of an image, or of the output image of a filter + + This method take care of updating the needed informations + """ + # required because range is overladed in this module + from __builtin__ import range + spacing_ = spacing(imageOrFilter) + size_ = size(imageOrFilter) + result = [] + for i in range(0, spacing_.Size()): + result.append(spacing_.GetElement(i) * size_.GetElement(i)) + return result + + +def spacing(imageOrFilter): + """Return the spacing of an image, or of the output image of a filter + + This method take care of updating the needed informations + """ + # we don't need the entire output, only its size + imageOrFilter.UpdateOutputInformation() + img = output(imageOrFilter) + return img.GetSpacing() + + +def origin(imageOrFilter): + """Return the origin of an image, or of the output image of a filter + + This method take care of updating the needed informations + """ + # we don't need the entire output, only its size + imageOrFilter.UpdateOutputInformation() + img = output(imageOrFilter) + return img.GetOrigin() + + +def index(imageOrFilter): + """Return the index of an image, or of the output image of a filter + + This method take care of updating the needed informations + """ + # we don't need the entire output, only its size + imageOrFilter.UpdateOutputInformation() + img = output(imageOrFilter) + return img.GetLargestPossibleRegion().GetIndex() + + +def region(imageOrFilter): + """Return the region of an image, or of the output image of a filter + + This method take care of updating the needed informations + """ + # we don't need the entire output, only its size + imageOrFilter.UpdateOutputInformation() + img = output(imageOrFilter) + return img.GetLargestPossibleRegion() + + +# return an image +from itkTemplate import image, output + + +def template(cl): + """Return the template of a class (or of the class of an object) and + its parameters + + template() returns a tuple with 2 elements: + - the first one is the itkTemplate object + - the second is a tuple containing the template parameters + """ + from itkTemplate import itkTemplate + return itkTemplate.__class_to_template__[class_(cl)] + + +def ctype(s): + """Return the c type corresponding to the string passed in parameter + + The string can contain some extra spaces. + see also itkCType + """ + from itkTypes import itkCType + ret = itkCType.GetCType(" ".join(s.split())) + if ret is None: + raise KeyError("Unrecognized C type '%s'" % s) + return ret + + +def class_(obj): + """Return a class from an object + + Often in itk, the __class__ is not what the user is expecting. + class_() should do a better job + """ + import inspect + if inspect.isclass(obj): + # obj is already a class ! + return obj + else: + return obj.__class__ + + +def range(imageOrFilter): + """Return the range of values in a image of in the output image of a filter + + The minimum and maximum values are returned in a tuple: (min, max) + range() take care of updating the pipeline + """ + import itk + img = output(imageOrFilter) + img.UpdateOutputInformation() + img.Update() + # don't put that calculator in the automatic pipeline + tmp_auto_pipeline = auto_pipeline.current + auto_pipeline.current = None + comp = itk.MinimumMaximumImageCalculator[img].New(Image=img) + auto_pipeline.current = tmp_auto_pipeline + comp.Compute() + return (comp.GetMinimum(), comp.GetMaximum()) + + +def write(imageOrFilter, fileName, compression=False): + """Write a image or the output image of a filter to filename + + The writer is instantiated with the image type of the image in + parameter (or, again, with the output image of the filter in parameter) + """ + import itk + img = output(imageOrFilter) + img.UpdateOutputInformation() + # don't put that writer in the automatic pipeline + tmp_auto_pipeline = auto_pipeline.current + auto_pipeline.current = None + writer = itk.ImageFileWriter[img].New( + Input=img, + FileName=fileName, + UseCompression=compression) + auto_pipeline.current = tmp_auto_pipeline + writer.Update() + + +def search(s, case_sensitive=False): # , fuzzy=True): + """Search for a class name in the itk module. + """ + s = s.replace(" ", "") + if not case_sensitive: + s = s.lower() + import itk + names = sorted(dir(itk)) + # exact match first + if case_sensitive: + res = [n for n in names if s == n] + else: + res = [n for n in names if s == n.lower()] + # then exact match inside the name + if case_sensitive: + res += [n for n in names if s in n and s != n] + else: + res += [n for n in names if s in n.lower() and s != n.lower()] +# if fuzzy: +# try: +# everything now requires editdist +# import editdist +# if case_sensitive: +# res.sort(key=lambda x: editdist.distance(x, s)) +# else: +# res.sort(key=lambda x: (editdist.distance(x.lower(), s), x)) +# except: +# pass + return res + + +def set_inputs(newItkObject, args=[], kargs={}): + """Set the inputs of the given objects, according to the non named or the + named parameters in args and kargs + + This function tries to assign all the non named parameters in the input of + the newItkObject + - the first non named parameter in the first input, etc. + + The named parameters are used by calling the method with the same name + prefixed by 'Set'. + set_inputs( obj, kargs={'Threshold': 10} ) calls obj.SetThreshold(10) + + This is the function use in the enhanced New() method to manage the inputs. + It can be used to produce a similar behavior: + + def SetInputs(self, *args, **kargs): + import itk + itk.set_inputs(self, *args, **kargs) + """ + # try to get the images from the filters in args + args = [output(arg) for arg in args] + + # args without name are filter used to set input image + # + # count SetInput calls to call SetInput, SetInput2, SetInput3, ... + # usefull with filter which take 2 input (or more) like SubstractImageFiler + # Ex: substract image2.png to image1.png and save the result in result.png + # r1 = itk.ImageFileReader.US2.New(FileName='image1.png') + # r2 = itk.ImageFileReader.US2.New(FileName='image2.png') + # s = itk.SubtractImageFilter.US2US2US2.New(r1, r2) + # itk.ImageFileWriter.US2.New(s, FileName='result.png').Update() + try: + for setInputNb, arg in enumerate(args): + methodName = 'SetInput%i' % (setInputNb + 1) + if methodName in dir(newItkObject): + # first try to use methods called SetInput1, SetInput2, ... + # those method should have more chances to work in case of + # multiple input types + getattr(newItkObject, methodName)(arg) + else: + # no method called SetInput? + # try with the standard SetInput(nb, input) + newItkObject.SetInput(setInputNb, arg) + except TypeError as e: + # the exception have (at least) to possible reasons: + # + the filter don't take the input number as first argument + # + arg is an object of wrong type + # + # if it's not the first input, re-raise the exception + if setInputNb != 0: + raise e + # it's the first input, try to use the SetInput() method without input + # number + newItkObject.SetInput(args[0]) + # but raise an exception if there is more than 1 argument + if len(args) > 1: + raise TypeError('Object accept only 1 input.') + except AttributeError: + # There is no SetInput() method, try SetImage + # but before, check the number of inputs + if len(args) > 1: + raise TypeError('Object accept only 1 input.') + methodList = ['SetImage', 'SetInputImage'] + methodName = None + for m in methodList: + if m in dir(newItkObject): + methodName = m + if methodName: + getattr(newItkObject, methodName)(args[0]) + else: + raise AttributeError('No method found to set the input.') + + # named args : name is the function name, value is argument(s) + for attribName, value in kargs.iteritems(): + # use Set as prefix. It allow to use a shorter and more intuitive + # call (Ex: itk.ImageFileReader.UC2.New(FileName='image.png')) than + # with the full name + # (Ex: itk.ImageFileReader.UC2.New(SetFileName='image.png')) + if attribName not in ["auto_progress", "template_parameters"]: + attrib = getattr(newItkObject, 'Set' + attribName) + attrib(value) + + +def show(input, **kargs): + """display an image + """ + import itk + img = output(input) + if img.GetImageDimension() == 3 and "show3D" in dir(itk): + return itk.show3D(input, **kargs) + else: + # print("2D not supported yet, use the 3D viewer.") + return show2D(input, **kargs) + + +class show2D: + + """Display a 2D image + """ + + def __init__(self, imageOrFilter, Label=False, Title=None): + import tempfile + import itk + import os + import platform + # get some data from the environment + command = os.environ.get("WRAPITK_SHOW2D_COMMAND") + if command is None: + if platform.system() == "Darwin": + command = ( + "open -a ImageJ -n --args -eval 'open(\"%(image)s\"); " + "run (\"View 100%%\"); rename(\"%(title)s\");'") + else: + command = ( + "imagej %(image)s -run 'View 100%%' -eval " + "'rename(\"%(title)s\")' &") + + label_command = os.environ.get("WRAPITK_SHOW2D_LABEL_COMMAND") + if label_command is None: + if platform.system() == "Darwin": + label_command = ( + "open -a ImageJ -n --args -eval 'open(\"%(image)s\"); " + "run (\"View 100%%\"); rename(\"%(title)s\"); " + "run(\"3-3-2 RGB\");'") + else: + label_command = ( + "imagej %(image)s -run 'View 100%%' -eval " + "'rename(\"%(title)s\")' -run '3-3-2 RGB' &") + + compress = os.environ.get( + "WRAPITK_SHOW2D_COMPRESS", + "true").lower() in ["on", "true", "yes", "1"] + extension = os.environ.get("WRAPITK_SHOW2D_EXTENSION", ".tif") + + # use the tempfile module to get a non used file name and to put + # the file at the rignt place + self.__tmpFile__ = tempfile.NamedTemporaryFile(suffix=extension) + # get an updated image + img = output(imageOrFilter) + img.UpdateOutputInformation() + img.Update() + if Title is None: + # try to generate a title + s = img.GetSource() + if s: + s = itk.down_cast(s) + if hasattr(img, "GetSourceOutputIndex"): + o = '[%s]' % img.GetSourceOutputIndex() + elif hasattr(img, "GetSourceOutputName"): + o = '[%s]' % img.GetSourceOutputName() + else: + o = "" + Title = "%s%s" % (s.__class__.__name__, o) + else: + Title = img.__class__.__name__ + try: + import IPython.ipapi + ip = IPython.ipapi.get() + if ip is not None: + names = [] + ref = imageOrFilter + if s: + ref = s + for n, v in ip.user_ns.iteritems(): + if isinstance(v, itk.LightObject) and v == ref: + names.append(n) + if names != []: + Title = ", ".join(names) + " - " + Title + except ImportError: + # just do nothing + pass + # change the LabelMaps to an Image, so we can look at them easily + if 'LabelMap' in dir(itk) and img.GetNameOfClass() == 'LabelMap': + # retreive the biggest label in the label map + maxLabel = img.GetNthLabelObject( + img.GetNumberOfLabelObjects() - 1).GetLabel() + # search for a filter to convert the label map + lab = itk.LabelMapToLabelImageFilter.keys() + maxVal = itk.NumericTraits[itk.template(params[1])[1][0]].max() + cond = params[0] == class_(img) and maxVal >= maxLabel + label_image_type = sorted([params[1] for params in lab if cond])[0] + convert = itk.LabelMapToLabelImageFilter[ + img, label_image_type].New(img) + convert.Update() + img = convert.GetOutput() + # this is a label image - force the parameter + Label = True + write(img, self.__tmpFile__.name, compress) + # now run imview + import os + if Label: + os.system( + label_command % + {"image": self.__tmpFile__.name, "title": Title}) + else: + os.system( + command % + {"image": self.__tmpFile__.name, "title": Title}) + + +class templated_class: + + """This class is used to mimic the behavior of the templated C++ classes. + + It is used that way: + + class CustomClass: + # class definition here + CustomClass = templated_class(CustomClass) + + customObject = CustomClass[template, parameters].New() + + The template parameters are passed to the custom class constructor as a + named parameter 'template_parameters' in a tuple. + + The custom class may implement a static method + check_template_parameters(parameters) which should raise an exception if + the template parameters provided are not suitable to instantiate the custom + class. + """ + + def __init__(self, cls): + """cls is the custom class + """ + self.__cls__ = cls + self.__templates__ = {} + + def New(self, *args, **kargs): + """Use the parameters to infer the types of the template parameters. + """ + # extract the types from the arguments to instantiate the class + import itk + types = tuple(itk.class_(o) for o in args) + return self[types].New(*args, **kargs) + + def __getitem__(self, template_parameters): + """Return a pair class-template parameters ready to be instantiated. + + The template parameters may be validated if the custom class provide + the static method check_template_parameters(parameters). + """ + if not isinstance(template_parameters, tuple): + template_parameters = (template_parameters,) + return ( + templated_class.__templated_class_and_parameters__( + self, + template_parameters) + ) + + def check_template_parameters(self, template_parameters): + """Check the template parameters passed in parameter. + """ + # this method is there mainly to make possible to reuse it in the + # custom class constructor after having used templated_class(). + # Without that, the following example doesn't work: + # + # class CustomClass: + # def __init__(self, *args, **kargs): + # template_parameters = kargs["template_parameters"] + # CustomClass.check_template_parameters(template_parameters) + # other init stuff + # def check_template_parameters(template_parameters): + # check, really + # pass + # CustomClass = templated_class(CustomClass) + # + self.__cls__.check_template_parameters(template_parameters) + + def add_template(self, name, params): + if not isinstance(params, list) and not isinstance(params, tuple): + params = (params,) + params = tuple(params) + val = self[params] + self.__templates__[params] = val + setattr(self, name, val) + + def add_image_templates(self, *args): + import itk + if args == []: + return + combinations = [[t] for t in args[0]] + for types in args[1:]: + temp = [] + for t in types: + for c in combinations: + temp.append(c + [t]) + combinations = temp + for d in itk.DIMS: + for c in combinations: + parameters = [] + name = "" + for t in c: + parameters.append(itk.Image[t, d]) + name += "I" + t.short_name + str(d) + self.add_template(name, tuple(parameters)) + + class __templated_class_and_parameters__: + + """Inner class used to store the pair class-template parameters ready + to instantiate. + """ + + def __init__(self, templated_class, template_parameters): + self.__templated_class__ = templated_class + self.__template_parameters__ = template_parameters + if "check_template_parameters" in dir(templated_class.__cls__): + templated_class.__cls__.check_template_parameters( + template_parameters) + + def New(self, *args, **kargs): + """A New() method to mimic the ITK default behavior, even if the + class doesn't provide any New() method. + """ + kargs["template_parameters"] = self.__template_parameters__ + if "New" in dir(self.__templated_class__.__cls__): + obj = self.__templated_class__.__cls__.New(*args, **kargs) + else: + obj = self.__templated_class__.__cls__(*args, **kargs) + setattr( + obj, + "__template_parameters__", + self.__template_parameters__) + setattr(obj, "__templated_class__", self.__templated_class__) + return obj + + def __call__(self, *args, **kargs): + return self.New(*args, **kargs) + + def keys(self): + return self.__templates__.keys() + + # everything after this comment is for dict interface + # and is a copy/paste from DictMixin + # only methods to edit dictionary are not there + def __iter__(self): + for k in self.keys(): + yield k + + def has_key(self, key): + try: + value = self[key] + except KeyError: + return False + return True + + def __contains__(self, key): + return key in self + + # third level takes advantage of second level definitions + def iteritems(self): + for k in self: + yield (k, self[k]) + + def iterkeys(self): + return self.__iter__() + + # fourth level uses definitions from lower levels + def itervalues(self): + for _, v in self.iteritems(): + yield v + + def values(self): + return [v for _, v in self.iteritems()] + + def items(self): + return list(self.iteritems()) + + def get(self, key, default=None): + try: + return self[key] + except KeyError: + return default + + def __len__(self): + return len(self.keys()) + + +class pipeline: + + """A convenient class to store the reference to the filters of a pipeline + + With this class, a method can create a pipeline of several filters and + return it without losing the references to the filters in this pipeline. + The pipeline object act almost like a filter (it has a GetOutput() method) + and thus can be simply integrated in another pipeline. + """ + + def __init__(self, *args, **kargs): + self.clear() + self.input = None + set_inputs(self, args, kargs) + + def connect(self, filter): + """Connect a new filter to the pipeline + + The output of the first filter will be used as the input of this + one and the filter passed as parameter will be added to the list + """ + if self.GetOutput() is not None: + set_inputs(filter, [self.GetOutput()]) + self.append(filter) + + def append(self, filter): + """Add a new filter to the pipeline + + The new filter will not be connected. The user must connect it. + """ + self.filters.append(filter) + + def clear(self): + """Clear the filter list + """ + self.filters = [] + + def GetOutput(self, index=0): + """Return the output of the pipeline + + If another output is needed, use + pipeline.filters[-1].GetAnotherOutput() instead of this method, + subclass pipeline to implement another GetOutput() method, or use + expose() + """ + if len(self.filters) == 0: + return self.GetInput() + else: + filter = self.filters[-1] + if hasattr(filter, "__getitem__"): + return filter[index] + try: + return filter.GetOutput(index) + except: + if index == 0: + return filter.GetOutput() + else: + raise ValueError("Index can only be 0 on that object") + + def SetInput(self, input): + """Set the input of the pipeline + """ + if len(self.filters) != 0: + set_inputs(self.filters[0], [input]) + self.input = input + + def GetInput(self): + """Get the input of the pipeline + """ + return self.input + + def Update(self): + """Update the pipeline + """ + if len(self.filters) > 0: + return self.filters[-1].Update() + + def UpdateLargestPossibleRegion(self): + """Update the pipeline + """ + if len(self.filters) > 0: + return self.filters[-1].UpdateLargestPossibleRegion() + + def UpdateOutputInformation(self): + if "UpdateOutputInformation" in dir(self.filters[-1]): + self.filters[-1].UpdateOutputInformation() + else: + self.Update() + + def __len__(self): + if len(self.filters) == 0: + return 1 + else: + return self.filters[-1].GetNumberOfOutputs() + + def __getitem__(self, item): + return self.GetOutput(item) + + def __call__(self, *args, **kargs): + set_inputs(self, args, kargs) + self.UpdateLargestPossibleRegion() + return self + + def expose(self, name, new_name=None, position=-1): + """Expose an attribute from a filter of the minipeline. + + Once called, the pipeline instance has a new Set/Get set of methods to + access directly the corresponding method of one of the filter of the + pipeline. + Ex: p.expose( "Radius" ) + p.SetRadius( 5 ) + p.GetRadius( 5 ) + By default, the attribute usable on the pipeline instance has the same + name than the one of the filter, but it can be changed by providing a + value to new_name. + The last filter of the pipeline is used by default, but another one may + be used by giving its position. + Ex: p.expose("Radius", "SmoothingNeighborhood", 2) + p.GetSmoothingNeighborhood() + """ + if new_name is None: + new_name = name + src = self.filters[position] + ok = False + set_name = "Set" + name + if set_name in dir(src): + setattr(self, "Set" + new_name, getattr(src, set_name)) + ok = True + get_name = "Get" + name + if get_name in dir(src): + setattr(self, "Get" + new_name, getattr(src, get_name)) + ok = True + if not ok: + raise RuntimeError( + "No attribute %s at position %s." % + (name, position)) + + +class auto_pipeline(pipeline): + current = None + + def __init__(self, *args, **kargs): + pipeline.__init__(self, *args, **kargs) + self.Start() + + def Start(self): + auto_pipeline.current = self + + def Stop(self): + auto_pipeline.current = None + + +def down_cast(obj): + """Down cast an itkLightObject (or a object of a subclass) to its most + specialized type. + """ + import itk + import itkTemplate + className = obj.GetNameOfClass() + t = getattr(itk, className) + if isinstance(t, itkTemplate.itkTemplate): + for c in t.values(): + try: + return c.cast(obj) + except: + # fail silently for now + pass + raise RuntimeError( + "Can't downcast to a specialization of %s" % + className) + else: + return t.cast(obj) + + +def attribute_list(i, name): + """Returns a list of the specified attributes for the objects in the image. + + i: the input LabelImage + name: the attribute name + """ + import itk + i = itk.output(i) + relabel = itk.StatisticsRelabelLabelMapFilter[i].New( + i, + Attribute=name, + ReverseOrdering=True, + InPlace=False) + relabel.UpdateLargestPossibleRegion() + r = relabel.GetOutput() + l = [] + for i in range(1, r.GetNumberOfLabelObjects() + 1): + l.append(r.GetLabelObject(i).__getattribute__("Get" + name)()) + return l + + +def attributes_list(i, names): + """Returns a list of the specified attributes for the objects in the image. + + i: the input LabelImage + name: the attribute name + """ + import itk + i = itk.output(i) + relabel = itk.StatisticsRelabelLabelMapFilter[i].New( + i, + Attribute=names[0], + ReverseOrdering=True, + InPlace=False) + relabel.UpdateLargestPossibleRegion() + r = relabel.GetOutput() + l = [] + for i in range(1, r.GetNumberOfLabelObjects() + 1): + attrs = [] + for name in names: + attrs.append(r.GetLabelObject(i).__getattribute__("Get" + name)()) + l.append(tuple(attrs)) + return l + + +def attribute_dict(i, name): + """Returns a dict with the attribute values in keys and a list of the + corresponding objects in value + + i: the input LabelImage + name: the name of the attribute + """ + import itk + i = itk.output(i) + relabel = itk.StatisticsRelabelLabelMapFilter[i].New( + i, + Attribute=name, + ReverseOrdering=True, + InPlace=False) + relabel.UpdateLargestPossibleRegion() + r = relabel.GetOutput() + d = {} + for i in range(1, r.GetNumberOfLabelObjects() + 1): + lo = r.GetLabelObject(i) + v = lo.__getattribute__("Get" + name)() + l = d.get(v, []) + l.append(lo) + d[v] = l + return d + + +def number_of_objects(i): + """Returns the number of objets in the image. + + i: the input LabelImage + """ + import itk + i.UpdateLargestPossibleRegion() + i = itk.output(i) + return i.GetNumberOfLabelObjects() + + +def ipython_kw_matches(text): + """Match named ITK object's named parameters""" + import IPython.ipapi + import itk + import re + import inspect + import itkTemplate + regexp = re.compile(r''' + '.*?' | # single quoted strings or + ".*?" | # double quoted strings or + \w+ | # identifier + \S # other characters + ''', re.VERBOSE | re.DOTALL) + ip = IPython.ipapi.get() + if "." in text: # a parameter cannot be dotted + return [] + # 1. find the nearest identifier that comes before an unclosed + # parenthesis e.g. for "foo (1+bar(x), pa", the candidate is "foo". + # Use get_endidx() to find the indentifier at the cursor position + tokens = regexp.findall( + ip.IP.Completer.get_line_buffer()[:ip.IP.Completer.get_endidx()]) + tokens.reverse() + iterTokens = iter(tokens) + openPar = 0 + for token in iterTokens: + if token == ')': + openPar -= 1 + elif token == '(': + openPar += 1 + if openPar > 0: + # found the last unclosed parenthesis + break + else: + return [] + # 2. Concatenate dotted names ("foo.bar" for "foo.bar(x, pa" ) + ids = [] + isId = re.compile(r'\w+$').match + while True: + try: + ids.append(iterTokens.next()) + if not isId(ids[-1]): + ids.pop() + break + if not iterTokens.next() == '.': + break + except StopIteration: + break + # lookup the candidate callable matches either using global_matches + # or attr_matches for dotted names + if len(ids) == 1: + callableMatches = ip.IP.Completer.global_matches(ids[0]) + else: + callableMatches = ip.IP.Completer.attr_matches('.'.join(ids[::-1])) + argMatches = [] + for callableMatch in callableMatches: + # drop the .New at this end, so we can search in the class members + if callableMatch.endswith(".New"): + callableMatch = callableMatch[:-4] + try: + object = eval(callableMatch, ip.IP.Completer.namespace) + if isinstance(object, itkTemplate.itkTemplate): + # this is a template - lets grab the first entry to search for + # the methods + object = object.values()[0] + namedArgs = [] + isin = isinstance(object, itk.LightObject) + issub = issubclass(object, itk.LightObject) + if isin or (inspect.isclass(object) and issub): + namedArgs = [n[3:] for n in dir(object) if n.startswith("Set")] + except Exception as e: + print(e) + continue + for namedArg in namedArgs: + if namedArg.startswith(text): + argMatches.append("%s=" % namedArg) + return argMatches + +# install progress callback and custom completer if we are in ipython +# interpreter +try: + import itkConfig + import IPython.ipapi + if IPython.ipapi.get(): + IPython.ipapi.get().IP.Completer.matchers.insert(0, ipython_kw_matches) + itkConfig.ProgressCallback = terminal_progress_callback + # some cleanup + del itkConfig, IPython +except ImportError: + # fail silently + pass diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkLazy.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkLazy.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkLazy.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkLazy.py 2014-09-03 08:29:34.000000000 +0000 @@ -17,29 +17,34 @@ #==========================================================================*/ -import types, itkBase +import types +import itkBase not_loaded = 'not loaded' + class LazyITKModule(types.ModuleType): - """Subclass of ModuleType that implements a custom __getattribute__ method - to allow lazy-loading of attributes from ITK sub-modules.""" - def __init__(self, name, lazy_attributes): - types.ModuleType.__init__(self, name) - self.__lazy_attributes = lazy_attributes - for k in lazy_attributes: - setattr(self, k, not_loaded) - def __getattribute__(self, attr): - value = types.ModuleType.__getattribute__(self, attr) - if value is not_loaded: - module = self.__lazy_attributes[attr] - namespace = {} - itkBase.LoadModule(module, namespace) - # Load into 'namespace' first, then self.__dict__ (via setattr) to - # prevent the warnings about overwriting the 'NotLoaded' values already - # in in self.__dict__ we would get if we just passed self.__dict__ to - # itkBase.LoadModule. - for k, v in namespace.items(): - setattr(self, k, v) - value = namespace[attr] - return value + + """Subclass of ModuleType that implements a custom __getattribute__ method + to allow lazy-loading of attributes from ITK sub-modules.""" + + def __init__(self, name, lazy_attributes): + types.ModuleType.__init__(self, name) + self.__lazy_attributes = lazy_attributes + for k in lazy_attributes: + setattr(self, k, not_loaded) + + def __getattribute__(self, attr): + value = types.ModuleType.__getattribute__(self, attr) + if value is not_loaded: + module = self.__lazy_attributes[attr] + namespace = {} + itkBase.LoadModule(module, namespace) + # Load into 'namespace' first, then self.__dict__ (via setattr) to + # prevent the warnings about overwriting the 'NotLoaded' values + # already in self.__dict__ we would get if we just passed + # self.__dict__ to itkBase.LoadModule. + for k, v in namespace.items(): + setattr(self, k, v) + value = namespace[attr] + return value diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itk.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itk.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itk.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itk.py 2014-09-03 08:29:34.000000000 +0000 @@ -17,56 +17,56 @@ #==========================================================================*/ """itk.py : Top-level container module for ITK wrappers.""" -import itkBase, itkConfig, itkLazy, itkTypes, itkExtras, os, sys - -# silently import psyco -try: - import psyco - psyco.profile() -except ImportError: - pass +import itkBase +import itkConfig +import itkLazy +import itkTypes +import itkExtras +import os +import sys thisModule = sys.modules[__name__] if itkConfig.LazyLoading: - # If we are loading lazily (on-demand), make a dict mapping the available - # classes/functions/etc. (read from the configuration modules) to the - # modules they are declared in. Then pass that dict to a LazyITKModule - # instance and (later) do some surgery on sys.modules so that the 'itk' - # module becomes that new instance instead of what is executed from this file. - lazyAttributes = {} - for module, data in itkBase.module_data.items(): - templateNames = [ t[0] for t in data['templates'] ] - attributes = dict( [(n, module) for n in templateNames] ) - lazyAttributes.update(attributes) - if isinstance(thisModule, itkLazy.LazyITKModule): - # Handle reload case where we've already done this once. - # If we made a new module every time, multiple reload()s would fail - # because the identity of sys.modules['itk'] would always be changing. - thisModule.__init__(__name__, lazyAttributes) - del lazyAttributes - else: - thisModule = itkLazy.LazyITKModule(__name__, lazyAttributes) + # If we are loading lazily (on-demand), make a dict mapping the available + # classes/functions/etc. (read from the configuration modules) to the + # modules they are declared in. Then pass that dict to a LazyITKModule + # instance and (later) do some surgery on sys.modules so that the 'itk' + # module becomes that new instance instead of what is executed from this + # file. + lazyAttributes = {} + for module, data in itkBase.module_data.items(): + templateNames = [t[0] for t in data['templates']] + attributes = dict([(n, module) for n in templateNames]) + lazyAttributes.update(attributes) + if isinstance(thisModule, itkLazy.LazyITKModule): + # Handle reload case where we've already done this once. + # If we made a new module every time, multiple reload()s would fail + # because the identity of sys.modules['itk'] would always be changing. + thisModule.__init__(__name__, lazyAttributes) + del lazyAttributes + else: + thisModule = itkLazy.LazyITKModule(__name__, lazyAttributes) else: - # We're not lazy-loading. Just load the modules in the order specified in - # the known_modules list for consistency. - for module in itkBase.known_modules: - itkBase.LoadModule(module, thisModule.__dict__) + # We're not lazy-loading. Just load the modules in the order specified in + # the known_modules list for consistency. + for module in itkBase.known_modules: + itkBase.LoadModule(module, thisModule.__dict__) # Regardless of how it was loaded, fill up the itk module with the ITK types # and extras. for k, v in itkTypes.__dict__.items(): - if k != 'itkCType' and not k.startswith('_'): - setattr(thisModule, k, v) + if k != 'itkCType' and not k.startswith('_'): + setattr(thisModule, k, v) for k, v in itkExtras.__dict__.items(): - if not k.startswith('_'): - setattr(thisModule, k, v) + if not k.startswith('_'): + setattr(thisModule, k, v) if itkConfig.LazyLoading: - # this has to be the last step, else python gets confused about itkTypes - # and itkExtras above. I'm not sure why... - sys.modules[__name__] = thisModule + # this has to be the last step, else python gets confused about itkTypes + # and itkExtras above. I'm not sure why... + sys.modules[__name__] = thisModule else: - # do some cleanup - del module, thisModule - del itkBase, itkConfig, itkLazy, itkTypes, itkExtras, os, sys + # do some cleanup + del module, thisModule + del itkBase, itkConfig, itkLazy, itkTypes, itkExtras, os, sys diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkTemplate.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkTemplate.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkTemplate.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkTemplate.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,364 +16,411 @@ # #==========================================================================*/ +from __future__ import print_function + import types import inspect import sys import os +import warnings import itkConfig from itkTypes import itkCType -def registerNoTpl(name, cl): - """Register a class without template +def itkFormatWarning(msg, *a): + """"Format the warnings issued by itk to display only the message. - It can seem not useful to register classes without template (and it wasn't - useful until the SmartPointer template was generated), but those classes - can be used as template argument of classes with template. - """ - itkTemplate.__templates__[normalizeName(name)] = cl + This will ignore the filename and the linenumber where the warning was + triggered. The message is returned to the warnings module. + """ + return str(msg) + '\n' -def normalizeName(name): - """Normalize the class name to remove ambiguity +# Redefine the format of the warnings +warnings.formatwarning = itkFormatWarning - This function removes the white spaces in the name, and also - remove the pointer declaration "*" (it have no sense in python) """ - name = name.replace(" ","") - name = name.replace("*","") +def registerNoTpl(name, cl): + """Register a class without template - return name + It can seem not useful to register classes without template (and it wasn't + useful until the SmartPointer template was generated), but those classes + can be used as template argument of classes with template. + """ + itkTemplate.__templates__[normalizeName(name)] = cl -class itkTemplate(object): - """This class manage access to avaible template arguments of C++ class - - There is 2 ways to access types: - - with a dict interface. The user can manipulate template parameters nearly - as it do in c++, excepted that the available parameters sets are choosed at - build time. It is also possible, with the dict interface, to explore the - available parameters sets. - - with object attributes. The user can easily find the available parameters - sets by pressing tab in interperter like ipython - """ - __templates__ = {} - __class_to_template__ = {} - __named_templates__ = {} - __doxygen_root__ = itkConfig.doxygen_root - - def __new__(cls, name): - # Singleton pattern: we only make a single instance of any Template of a - # given name. If we have already made the instance, just return it as-is. - if not cls.__named_templates__.has_key(name): - new_instance = object.__new__(cls) - new_instance.__name__ = name - new_instance.__template__ = {} - cls.__named_templates__[name] = new_instance - return cls.__named_templates__[name] +def normalizeName(name): + """Normalize the class name to remove ambiguity - def __add__(self, paramSetString, cl): - """add a new argument set and the resulting class to the template + This function removes the white spaces in the name, and also + remove the pointer declaration "*" (it have no sense in python) """ - paramSetString is the c++ string which define the parameters set - cl is the class which correspond to the couple template-argument set - """ - # recreate the full name and normalize it to avoid ambiguity - normalizedFullName = normalizeName(self.__name__+"<"+paramSetString+">") + name = name.replace(" ", "") + name = name.replace("*", "") - # the full class should not be already registered. If it is, there is a problem - # somewhere so warn the user so he can fix the problem - if itkTemplate.__templates__.has_key( normalizedFullName ) : - print >>sys.stderr,"Warning: template %s\n already defined as %s\n is redefined as %s" % (normalizedFullName, self.__templates__[normalizedFullName], cl) - # register the class - itkTemplate.__templates__[normalizedFullName] = cl - - # __find_param__ will parse the paramSetString and produce a list of the same - # parameters transformed in corresponding python classes. - # we transform this list in tuple to make it usable as key of the dict - param = tuple( self.__find_param__( paramSetString ) ) - - # once again, warn the user if the tuple of parameter is already defined - # so he can fix the problem - if self.__template__.has_key( param ) : - print >>sys.stderr,"Warning: template already defined '%s'" % normalizedFullName - # and register the parameter tuple - self.__template__[param] = cl - - # add in __class_to_template__ dictionary - itkTemplate.__class_to_template__[cl] = (self, param) - - # now populate the template - # 2 cases: - # - the template is a SmartPointer. In that case, the attribute name will be the - # full real name of the class without the itk prefix and _Pointer suffix - # - the template is not a SmartPointer. In that case, we keep only the end of the - # real class name which is a short string discribing the template arguments - # (for example IUC2) - if cl.__name__.startswith("itk"): - if cl.__name__.endswith("_Pointer") : - # it's a SmartPointer - attributeName = cl.__name__[len("itk"):-len("_Pointer")] - else : - # it's not a SmartPointer - # we need to now the size of the name to keep only the suffix - # short name does not contain :: and nested namespace - # itk::Numerics::Sample -> itkSample - import re - shortNameSize = len(re.sub(r':.*:', '', self.__name__)) - attributeName = cl.__name__[shortNameSize:] - elif cl.__name__.startswith("vcl_complex"): - # C++ name is likely to be std::complex here, instead of the expected vcl_complex - attributeName = cl.__name__[len("vcl_complex"):] - else: - import re - shortNameSize = len(re.sub(r'.*::', '', self.__name__)) - attributeName = cl.__name__[shortNameSize:] + return name - if attributeName.isdigit() : - # the attribute name can't be a number - # add a single undescore before it to build a valid name - attributeName = "_" + attributeName +class itkTemplate(object): - # add the attribute to this object - self.__dict__[attributeName] = cl + """This class manage access to avaible template arguments of C++ class + There is 2 ways to access types: + - with a dict interface. The user can manipulate template parameters nearly + as it do in c++, excepted that the available parameters sets are choosed at + build time. It is also possible, with the dict interface, to explore the + available parameters sets. + - with object attributes. The user can easily find the available parameters + sets by pressing tab in interperter like ipython + """ + __templates__ = {} + __class_to_template__ = {} + __named_templates__ = {} + __doxygen_root__ = itkConfig.doxygen_root + + def __new__(cls, name): + # Singleton pattern: we only make a single instance of any Template of + # a given name. If we have already made the instance, just return it + # as-is. + if name not in cls.__named_templates__: + new_instance = object.__new__(cls) + new_instance.__name__ = name + new_instance.__template__ = {} + cls.__named_templates__[name] = new_instance + return cls.__named_templates__[name] + + def __add__(self, paramSetString, cl): + """add a new argument set and the resulting class to the template + + paramSetString is the c++ string which define the parameters set + cl is the class which correspond to the couple template-argument set + """ + # recreate the full name and normalize it to avoid ambiguity + normFullName = normalizeName( + self.__name__ + "<" + paramSetString + ">") + + # the full class should not be already registered. If it is, there is a + # problem somewhere so warn the user so he can fix the problem + if normFullName in itkTemplate.__templates__: + message = ( + "Template %s\n already defined as %s\n is redefined " + "as %s") % (normFullName, self.__templates__[normFullName], cl) + warnings.warn(message) + # register the class + itkTemplate.__templates__[normFullName] = cl + + # __find_param__ will parse the paramSetString and produce a list of + # the same parameters transformed in corresponding python classes. + # we transform this list in tuple to make it usable as key of the dict + param = tuple(self.__find_param__(paramSetString)) + + # once again, warn the user if the tuple of parameter is already + # defined so he can fix the problem + if param in self.__template__: + message = "Warning: template already defined '%s'" % normFullName + warnings.warn(message) + # and register the parameter tuple + self.__template__[param] = cl + + # add in __class_to_template__ dictionary + itkTemplate.__class_to_template__[cl] = (self, param) + + # now populate the template + # 2 cases: + # - the template is a SmartPointer. In that case, the attribute name + # will be the full real name of the class without the itk prefix and + # _Pointer suffix + # - the template is not a SmartPointer. In that case, we keep only the + # end of the real class name which is a short string discribing the + # template arguments (for example IUC2) + if cl.__name__.startswith("itk"): + if cl.__name__.endswith("_Pointer"): + # it's a SmartPointer + attributeName = cl.__name__[len("itk"):-len("_Pointer")] + else: + # it's not a SmartPointer + # we need to now the size of the name to keep only the suffix + # short name does not contain :: and nested namespace + # itk::Numerics::Sample -> itkSample + import re + shortNameSize = len(re.sub(r':.*:', '', self.__name__)) + attributeName = cl.__name__[shortNameSize:] + elif cl.__name__.startswith("vcl_complex"): + # C++ name is likely to be std::complex here, instead of the + # expected vcl_complex + attributeName = cl.__name__[len("vcl_complex"):] + else: + import re + shortNameSize = len(re.sub(r'.*::', '', self.__name__)) + attributeName = cl.__name__[shortNameSize:] + + if attributeName.isdigit(): + # the attribute name can't be a number + # add a single undescore before it to build a valid name + attributeName = "_" + attributeName + + # add the attribute to this object + self.__dict__[attributeName] = cl + + def __find_param__(self, paramSetString): + """find the parameters of the template + + paramSetString is the c++ string which define the parameters set + + __find_param__ returns a list of itk classes, itkCType, and/or numbers + which correspond to the parameters described in paramSetString. + The parameters MUST have been registered before calling this method, + or __find_param__ will return a string and not the wanted object, and + will display a warning. Registration order is important. + + This method is not static only to be able to display the template name + in the warning + """ + # split the string in a list of parameters + paramStrings = [] + inner = 0 + part = paramSetString.split(",") + for elt in part: + if inner == 0: + paramStrings.append(elt) + else: + paramStrings[-1] += "," + elt + inner += elt.count("<") - elt.count(">") + + # convert all string parameters into classes (if possible) + parameters = [] + for param in paramStrings: + # the parameter need to be normalized several time below + # do it once here + param = param.strip() + paramNorm = normalizeName(param) + + if paramNorm in itkTemplate.__templates__: + # the parameter is registered. + # just get the really class form the dictionary + param = itkTemplate.__templates__[paramNorm] + + elif itkCType.GetCType(param): + # the parameter is a c type + # just get the itkCtype instance + param = itkCType.GetCType(param) + + elif paramNorm.isdigit(): + # the parameter is a number + # convert the string to a number ! + param = int(param) + + elif paramNorm == "true": + param = True + elif paramNorm == "false": + param = False + + else: + # unable to convert the parameter + # use it without changes, but display a warning message, to + # incite developer to fix the problem + message = ( + "Warning: Unknown parameter '%s' in " + "template '%s'" % (param, self.__name__)) + warnings.warn(message) + + parameters.append(param) + + return parameters + + def __getitem__(self, parameters): + """return the class which correspond to the given template parameters + + parameters can be: + - a single parameter (Ex: itk.Index[2]) + - a list of element (Ex: itk.Image[itk.UC, 2]) + """ + + isin = isinstance(parameters, types.TupleType) + if not isin and not isinstance(parameters, types.ListType): + # parameters is a single element. + # include it in a list to manage the 2 cases in the same way + parameters = [parameters] + + cleanParameters = [] + for param in parameters: + # In the case of itk class instance, get the class + name = param.__class__.__name__ + isclass = inspect.isclass(param) + if not isclass and name[:3] == 'itk' and name != "itkCType": + param = param.__class__ + + # append the parameter to the list. If it's not a supported type, + # it is not in the dictionary and we will raise an exception below + cleanParameters.append(param) + + try: + return(self.__template__[tuple(cleanParameters)]) + except: + raise KeyError( + 'itkTemplate : No template %s for the %s class' % + (str(parameters), self.__name__)) + + def __repr__(self): + return '' % self.__name__ + + def __getattribute__(self, attr): + """Support for reading doxygen man pages to produce __doc__ strings""" + root = itkTemplate.__doxygen_root__ + indoc = (attr == '__doc__') + if indoc and root != "" and self.__name__.startswith('itk'): + try: + import commands + doxyname = self.__name__.replace("::", "_") + man_path = "%s/man3/%s.3" % (root, doxyname) + bzman_path = "%s/man3/%s.3.bz2" % (root, doxyname) + if os.path.exists(bzman_path): + return ( + commands.getoutput( + "bunzip2 --stdout '" + bzman_path + + "' | groff -mandoc -Tascii -c")) + elif os.path.exists(man_path): + # Use groff here instead of man because man dies when it is + # passed paths with spaces (!) groff does not. + return ( + commands.getoutput( + "groff -mandoc -Tascii -c '" + + man_path + "'")) + else: + return ( + "Cannot find man page for %s: %s" + % (self.__name__, man_path + "[.bz2]")) + except Exception as e: + return ( + "Cannot display man page for %s due to exception: %s." + % (self.__name__, e)) + else: + return object.__getattribute__(self, attr) - def __find_param__(self, paramSetString): - """find the parameters of the template + def New(self, *args, **kargs): + """TODO: some doc! Don't call it __call__ as it break the __doc__ + attribute feature in ipython""" + import itk + keys = self.keys() + if len(args) != 0: + # try to find a type suitable for the input provided + input_types = [output(f).__class__ for f in args] + keys = [k for k in self.keys() if k[0] == input_types[0]] + cur = itk.auto_pipeline.current + if cur is not None and len(cur) != 0: + # try to find a type suitable for the input provided + input_type = output(cur).__class__ + keys = [k for k in self.keys() if k[0] == input_type] + if len(keys) == 0: + raise RuntimeError("No suitable template parameter can be found.") + return self[keys[0]].New(*args, **kargs) + + def keys(self): + return self.__template__.keys() + + # everything after this comment is for dict interface + # and is a copy/paste from DictMixin + # only methods to edit dictionary are not there + def __iter__(self): + for k in self.keys(): + yield k + + def has_key(self, key): + try: + value = self[key] + except KeyError: + return False + return True + + def __contains__(self, key): + return key in self + + # third level takes advantage of second level definitions + def iteritems(self): + for k in self: + yield (k, self[k]) + + def iterkeys(self): + return self.__iter__() + + # fourth level uses definitions from lower levels + def itervalues(self): + for _, v in self.iteritems(): + yield v + + def values(self): + return [v for _, v in self.iteritems()] + + def items(self): + return list(self.iteritems()) + + def get(self, key, default=None): + try: + return self[key] + except KeyError: + return default - paramSetString is the c++ string which define the parameters set + def __len__(self): + return len(self.keys()) - __find_param__ returns a list of itk classes, itkCType, and/or numbers - which correspond to the parameters described in paramSetString. - The parameters MUST have been registered before calling this method, - or __find_param__ will return a string and not the wanted object, and - will display a warning. Registration order is important. - This method is not static only to be able to display the template name - in the warning - """ - # split the string in a list of parameters - paramStrings = [] - inner = 0 - part = paramSetString.split(",") - for elt in part : - if inner == 0 : - paramStrings.append( elt ) - else: - paramStrings[-1] += "," + elt - inner += elt.count("<") - elt.count(">") - - # convert all string parameters into classes (if possible) - parameters = [] - for param in paramStrings: - # the parameter need to be normalized several time below - # do it once here - param = param.strip() - paramNorm = normalizeName(param) - - if itkTemplate.__templates__.has_key( paramNorm ) : - # the parameter is registered. - # just get the really class form the dictionary - param = itkTemplate.__templates__[paramNorm] - - elif itkCType.GetCType( param ) : - # the parameter is a c type - # just get the itkCtype instance - param = itkCType.GetCType( param ) - - elif paramNorm.isdigit() : - # the parameter is a number - # convert the string to a number ! - param = int(param) - - elif paramNorm == "true": - param = True - elif paramNorm == "false": - param = False - - else : - # unable to convert the parameter - # use it without changes, but display a warning message, to incite - # developer to fix the problem - print >>sys.stderr,"Warning: Unknown parameter '%s' in template '%s'" % (param, self.__name__) - - parameters.append( param ) - - return parameters - - - def __getitem__(self, parameters): - """return the class which correspond to the given template parameters - - parameters can be: - - a single parameter (Ex: itk.Index[2]) - - a list of element (Ex: itk.Image[itk.UC, 2]) - """ +# create a new New function which accepts parameters +def New(self, *args, **kargs): + import sys + import itk - if type(parameters) != types.TupleType and type(parameters) != types.ListType : - # parameters is a single element. - # include it in a list to manage the 2 cases in the same way - parameters = [parameters] - - cleanParameters = [] - for param in parameters: - # In the case of itk class instance, get the class - if not inspect.isclass( param ) and param.__class__.__name__[:3] == 'itk' and param.__class__.__name__!= "itkCType" : - param = param.__class__ - - # append the parameter to the list. If it's not a supported type, it is - # not in the dictionary and we will raise an exception below - cleanParameters.append( param ) + itk.set_inputs(self, args, kargs) - try: - return(self.__template__[tuple(cleanParameters)]) - except: - raise KeyError, 'itkTemplate : No template %s for the %s class' % (str(parameters), self.__name__) - - - def __repr__(self): - return '' % self.__name__ - - # support for reading doxygen man pages to produce __doc__ strings - def __getattribute__(self, attr): - if attr == '__doc__' and itkTemplate.__doxygen_root__ != "" and self.__name__.startswith('itk'): - try: - import commands - doxyname = self.__name__.replace("::", "_") - man_path = "%s/man3/%s.3" %(itkTemplate.__doxygen_root__, doxyname) - bzman_path = "%s/man3/%s.3.bz2" %(itkTemplate.__doxygen_root__, doxyname) - if os.path.exists(bzman_path): - return commands.getoutput("bunzip2 --stdout '"+bzman_path+"' | groff -mandoc -Tascii -c") - elif os.path.exists(man_path): - # Use groff here instead of man because man dies when it is passed paths with spaces (!) - # groff does not. - return commands.getoutput("groff -mandoc -Tascii -c '" + man_path +"'") + # now, try to add observer to display progress + if "auto_progress" in kargs.keys(): + if kargs["auto_progress"] in [True, 1]: + callback = itk.terminal_progress_callback + elif kargs["auto_progress"] == 2: + callback = itk.simple_progress_callback else: - return "Cannot find man page for %s: %s" %(self.__name__, man_path+"[.bz2]") - except Exception, e: - return "Cannot display man page for %s due to exception: %s." %(self.__name__, e) + callback = None + elif itkConfig.ProgressCallback: + callback = itkConfig.ProgressCallback else: - return object.__getattribute__(self, attr) + callback = None - def New(self, *args, **kargs): - """TODO: some doc! Don't call it __call__ as it break the __doc__ attribute feature in - ipython""" - import itk - keys = self.keys() - if len(args) != 0: - # try to find a type suitable for the input provided - input_types = [output(f).__class__ for f in args] - keys = [k for k in self.keys() if k[0] == input_types[0]] - if itk.auto_pipeline.current != None and len(itk.auto_pipeline.current) != 0: - # try to find a type suitable for the input provided - input_type = output(itk.auto_pipeline.current).__class__ - keys = [k for k in self.keys() if k[0] == input_type] - if len(keys) == 0: - raise RuntimeError("No suitable template parameter can be found.") - return self[keys[0]].New(*args, **kargs) - - def keys(self): - return self.__template__.keys() - - # everything after this comment is for dict interface - # and is a copy/paste from DictMixin - # only methods to edit dictionary are not there - def __iter__(self): - for k in self.keys(): - yield k - - def has_key(self,key): - try: - value=self[key] - except KeyError: - return False - return True - - def __contains__(self,key): - return self.has_key(key) - - # third level takes advantage of second level definitions - def iteritems(self): - for k in self: - yield (k,self[k]) - - def iterkeys(self): - return self.__iter__() - - # fourth level uses definitions from lower levels - def itervalues(self): - for _,v in self.iteritems(): - yield v + if callback: + try: + name = self.__class__.__name__ - def values(self): - return [v for _,v in self.iteritems()] + def progress(): + # self and callback are kept referenced with a closure + callback(name, self.GetProgress()) - def items(self): - return list(self.iteritems()) + self.AddObserver(itk.ProgressEvent(), progress) + except: + # it seems that something goes wrong... + # as this feature is designed for prototyping, it's not really a + # problem if an object doesn't have progress reporter, so adding + # reporter can silently fail + pass - def get(self,key,default=None): - try: - return self[key] - except KeyError: - return default + if itkConfig.NotInPlace and "SetInPlace" in dir(self): + self.SetInPlace(False) - def __len__(self): - return len(self.keys()) + if itk.auto_pipeline.current is not None: + itk.auto_pipeline.current.connect(self) + return self -# create a new New function which accepts parameters -def New(self, *args, **kargs) : - import sys, itk +def output(input): + try: + img = input.GetOutput() + except AttributeError: + img = input + return img - itk.set_inputs( self, args, kargs ) - # now, try to add observer to display progress - if "auto_progress" in kargs.keys() : - if kargs["auto_progress"] in [True, 1] : - callback = itk.terminal_progress_callback - elif kargs["auto_progress"] == 2 : - callback = itk.simple_progress_callback - else : - callback = None - elif itkConfig.ProgressCallback : - callback = itkConfig.ProgressCallback - else : - callback = None - - if callback : - try : - name = self.__class__.__name__ - def progress() : - # self and callback are kept referenced with a closure - callback(name, self.GetProgress()) - - self.AddObserver(itk.ProgressEvent(), progress) - except : - # it seems that something goes wrong... - # as this feature is designed for prototyping, it's not really a problem - # if an object don't have progress reporter, so adding reporter can silently fail - pass - - if itkConfig.NotInPlace and "SetInPlace" in dir(self) : - self.SetInPlace( False ) - - if itk.auto_pipeline.current != None: - itk.auto_pipeline.current.connect(self) - - return self - - -def output(input) : - try : - img = input.GetOutput() - except AttributeError : - img = input - return img - -def image(input) : - import sys - print >> sys.stderr, "WrapITK warning: itk.image() is deprecated. Use itk.output() instead." - return output(input) +def image(input): + import sys + print( + ("WrapITK warning: itk.image() is deprecated. " + "Use itk.output() instead."), file=sys.stderr) + return output(input) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itktesting.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itktesting.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itktesting.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itktesting.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -#========================================================================== -# -# Copyright Insight Software Consortium -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0.txt -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#==========================================================================*/ - -import itkbase -import sys -import os -import stat - -import itkdata - -# Put the ITK_TEST_ROOT setting in the global namespace. This -# package is only used for testing, so this is okay. - -ITK_TEST_ROOT = "" - -# Look for the -T command line option. -if not ITK_TEST_ROOT: - for a in range(len(sys.argv)): - if sys.argv[a] == "-T" and a < len(sys.argv): - ITK_TEST_ROOT = sys.argv[a+1] - break - -# Check for the environment variable ::ITK_TEST_ROOT. -if not ITK_TEST_ROOT and os.environ.has_key('ITK_TEST_ROOT'): - ITK_TEST_ROOT = os.environ['ITK_TEST_ROOT'] - - -# Use the default output directory. -if not ITK_TEST_ROOT: - ITK_TEST_ROOT = itkbase.defaultTestRoot - if ITK_TEST_ROOT == "": - sys.stderr.write("Set ITK_TEST_ROOT or use -T option to specify.\n") - sys.exit(1) - -# Setup testing directories. -ITK_TEST_BASELINE = "%s/Baseline" % itkdata.ITK_DATA_ROOT -ITK_TEST_INPUT = "%s/Input" % itkdata.ITK_DATA_ROOT -ITK_TEST_OUTPUT = "%s/Output" % ITK_TEST_ROOT - -try: - if not os.path.exists(ITK_TEST_ROOT): - os.mkdir(ITK_TEST_OUTPUT) -except: - sys.stderr.write("Bla: %s\n" % `sys.exc_info()[0]`) - sys.stderr.write("Unable to create testing output directory with name: %s\n" % ITK_TEST_OUTPUT) - sys.exit(1) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkTesting.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkTesting.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkTesting.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkTesting.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,63 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + +import itkBase +import sys +import os +import stat + +import itkData + +# Put the ITK_TEST_ROOT setting in the global namespace. This +# package is only used for testing, so this is okay. + +ITK_TEST_ROOT = "" + +# Look for the -T command line option. +if not ITK_TEST_ROOT: + for a in range(len(sys.argv)): + if sys.argv[a] == "-T" and a < len(sys.argv): + ITK_TEST_ROOT = sys.argv[a + 1] + break + +# Check for the environment variable ::ITK_TEST_ROOT. +if not ITK_TEST_ROOT and 'ITK_TEST_ROOT' in os.environ: + ITK_TEST_ROOT = os.environ['ITK_TEST_ROOT'] + + +# Use the default output directory. +if not ITK_TEST_ROOT: + ITK_TEST_ROOT = itkBase.defaultTestRoot + if ITK_TEST_ROOT == "": + sys.stderr.write("Set ITK_TEST_ROOT or use -T option to specify.\n") + sys.exit(1) + +# Setup testing directories. +ITK_TEST_BASELINE = "%s/Baseline" % itkData.ITK_DATA_ROOT +ITK_TEST_INPUT = "%s/Input" % itkData.ITK_DATA_ROOT +ITK_TEST_OUTPUT = "%s/Output" % ITK_TEST_ROOT + +try: + if not os.path.exists(ITK_TEST_ROOT): + os.mkdir(ITK_TEST_OUTPUT) +except: + sys.stderr.write("Bla: %s\n" % repr(sys.exc_info()[0])) + sys.stderr.write( + "Unable to create testing output directory with name: %s\n" % + ITK_TEST_OUTPUT) + sys.exit(1) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkTypes.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkTypes.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/itkTypes.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/itkTypes.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,41 +16,42 @@ # #==========================================================================*/ -class itkCType : - __cTypes__ = {} - def __init__(self,name,shortName): - self.name=name - self.short_name=shortName - - itkCType.__cTypes__[self.name]=self - - def __del__(self): - try: - del itkCType.__cTypes__[self.name] - except: - pass - - def __repr__(self): - return "" % self.name - - def GetCType(name): - try: - return(itkCType.__cTypes__[name]) - except KeyError: - return(None) - GetCType=staticmethod(GetCType) - - -F = itkCType("float", "F") -D = itkCType("double", "D") -LD = itkCType("long double", "LD") +class itkCType: + __cTypes__ = {} + + def __init__(self, name, shortName): + self.name = name + self.short_name = shortName + + itkCType.__cTypes__[self.name] = self + + def __del__(self): + try: + del itkCType.__cTypes__[self.name] + except: + pass + + def __repr__(self): + return "" % self.name + + def GetCType(name): + try: + return(itkCType.__cTypes__[name]) + except KeyError: + return(None) + GetCType = staticmethod(GetCType) + + +F = itkCType("float", "F") +D = itkCType("double", "D") +LD = itkCType("long double", "LD") UC = itkCType("unsigned char", "UC") -US = itkCType("unsigned short","US") -UI = itkCType("unsigned int", "UI") +US = itkCType("unsigned short", "US") +UI = itkCType("unsigned int", "UI") UL = itkCType("unsigned long", "UL") -SC = itkCType("signed char", "SC") -SS = itkCType("signed short", "SS") -SI = itkCType("signed int", "SI") -SL = itkCType("signed long", "SL") -B = itkCType("bool", "B") +SC = itkCType("signed char", "SC") +SS = itkCType("signed short", "SS") +SI = itkCType("signed int", "SI") +SL = itkCType("signed long", "SL") +B = itkCType("bool", "B") diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/module_ext.i.in otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/module_ext.i.in --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/module_ext.i.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/module_ext.i.in 2014-09-03 08:29:34.000000000 +0000 @@ -1,8 +1,7 @@ %{ -// workaround for undefined ptrdiff_t with swig 1.3.40 -#include - -// workaround for undefined SWIGPY_SLICE_ARG with swig 2.0.3 and 2.0.4 +// Workaround for undefined SWIGPY_SLICE_ARG with swig 2.0.3 and 2.0.4 +// If removed, fails also with swig 3.0, so this has not been fixed ? +// Needs to be investigated #include #if PY_VERSION_HEX >= 0x03020000 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyCommand.cxx otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyCommand.cxx --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyCommand.cxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyCommand.cxx 2014-09-03 08:29:34.000000000 +0000 @@ -80,7 +80,7 @@ if (!PyCallable_Check(this->m_Object)) { // we throw a standard ITK exception: this makes it possible for - // our standard CableSwig exception handling logic to take this + // our standard Swig exception handling logic to take this // through to the invoking Python process itkExceptionMacro(<<"CommandCallable is not a callable Python object, " <<"or it has not been set."); diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyImageFilter.hxx otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyImageFilter.hxx --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyImageFilter.hxx 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/PyUtils/itkPyImageFilter.hxx 2014-09-03 08:29:34.000000000 +0000 @@ -77,7 +77,7 @@ if (!PyCallable_Check(this->m_Object)) { // we throw a standard ITK exception: this makes it possible for - // our standard CableSwig exception handling logic to take this + // our standard Swig exception handling logic to take this // through to the invoking Python process itkExceptionMacro(<<"CommandCallable is not a callable Python object, " <<"or it has not been set."); diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/AntiAliasBinaryImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/AntiAliasBinaryImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/AntiAliasBinaryImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/AntiAliasBinaryImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,26 +16,29 @@ # #==========================================================================*/ +from __future__ import print_function + import itk from sys import argv, stderr, exit itk.auto_progress(2) -if len(argv) < 3 : - print >> stderr, """Missing Parameters -Usage: AntiAliasBinaryImageFilter inputImage outputImage [RMS] [numberOfIterations]""" - exit(1) +if len(argv) < 3: + print(( + "Missing Parameters \n Usage: AntiAliasBinaryImageFilter" + " inputImage outputImage [RMS] [numberOfIterations]"), file=stderr) + exit(1) -inputFilename = argv[1] +inputFilename = argv[1] outputFilename = argv[2] maximumRMSError = 0.01 numberOfIterations = 50 -if len(argv) > 3 : - maximumRMSError = float( argv[3] ) +if len(argv) > 3: + maximumRMSError = float(argv[3]) -if len(argv) > 4 : - numberOfIterations = int( argv[4] ) +if len(argv) > 4: + numberOfIterations = int(argv[4]) CharPixelType = itk.UC @@ -45,18 +48,16 @@ CharImageType = itk.Image[CharPixelType, Dimension] RealImageType = itk.Image[RealPixelType, Dimension] -ReaderType = itk.ImageFileReader[ CharImageType ] -WriterType = itk.ImageFileWriter[ CharImageType ] - - +ReaderType = itk.ImageFileReader[CharImageType] +WriterType = itk.ImageFileWriter[CharImageType] -CastToRealFilterType = itk.CastImageFilter[ CharImageType, RealImageType] +CastToRealFilterType = itk.CastImageFilter[CharImageType, RealImageType] -RescaleFilter = itk.RescaleIntensityImageFilter[RealImageType, CharImageType ] +RescaleFilter = itk.RescaleIntensityImageFilter[RealImageType, CharImageType] - -AntiAliasFilterType = itk.AntiAliasBinaryImageFilter[RealImageType, RealImageType] +antiAliasFilter = itk.AntiAliasBinaryImageFilter[RealImageType, RealImageType] +antiAliasFilter = antiAliasFilter.New() reader = ReaderType.New() writer = WriterType.New() @@ -64,23 +65,21 @@ toReal = CastToRealFilterType.New() rescale = RescaleFilter.New() -antiAliasFilter = AntiAliasFilterType.New() - -reader.SetFileName( inputFilename ) -writer.SetFileName( outputFilename ) +reader.SetFileName(inputFilename) +writer.SetFileName(outputFilename) -rescale.SetOutputMinimum( 0 ) -rescale.SetOutputMaximum( 255 ) +rescale.SetOutputMinimum(0) +rescale.SetOutputMaximum(255) -toReal.SetInput( reader.GetOutput() ) +toReal.SetInput(reader.GetOutput()) -antiAliasFilter.SetInput( toReal.GetOutput() ) +antiAliasFilter.SetInput(toReal.GetOutput()) -antiAliasFilter.SetMaximumRMSError( maximumRMSError ) -antiAliasFilter.SetNumberOfIterations( numberOfIterations ) -antiAliasFilter.SetNumberOfLayers( 2 ) +antiAliasFilter.SetMaximumRMSError(maximumRMSError) +antiAliasFilter.SetNumberOfIterations(numberOfIterations) +antiAliasFilter.SetNumberOfLayers(2) -rescale.SetInput( antiAliasFilter.GetOutput() ) -writer.SetInput( rescale.GetOutput() ) +rescale.SetInput(antiAliasFilter.GetOutput()) +writer.SetInput(rescale.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/auto_pipeline.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/auto_pipeline.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/auto_pipeline.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/auto_pipeline.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,14 +1,32 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + import itk from sys import argv # instantiate an auto pipeline p = itk.auto_pipeline() -# from now, and until we call p.Stop(), all the new objects will be connected to -# the pipeline p, without having to give a name to any filter +# from now, and until we call p.Stop(), all the new objects will be connected +# to the pipeline p, without having to give a name to any filter -itk.ImageFileReader.IUC2.New( FileName=argv[1] ) -itk.MedianImageFilter.IUC2IUC2.New( Radius=eval( argv[3] ) ) +itk.ImageFileReader.IUC2.New(FileName=argv[1]) +itk.MedianImageFilter.IUC2IUC2.New(Radius=eval(argv[3])) itk.CastImageFilter.IUC2IUC2.New() # stop the auto_pipeline and test that the next (imcompatible) filter is not @@ -17,5 +35,5 @@ itk.CastImageFilter.IF2IF2.New() p.Start() -itk.ImageFileWriter.IUC2.New( FileName=argv[2] ) +itk.ImageFileWriter.IUC2.New(FileName=argv[2]) p.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryDilateImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryDilateImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryDilateImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryDilateImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,5 @@ +#!/usr/bin/env python + #========================================================================== # # Copyright Insight Software Consortium @@ -17,21 +19,39 @@ #==========================================================================*/ # -# Example on the use of the BinaryDilateImageFilter +# Test BinaryDilateImageFilter # +import sys import itk -from sys import argv itk.auto_progress(2) -dim = 2 -IType = itk.Image[itk.UC, dim] +inputImage = sys.argv[1] +outputImage = sys.argv[2] +radiusValue = int(sys.argv[3]) + +PixelType = itk.UC +Dimension = 2 + +ImageType = itk.Image[PixelType, Dimension] + +ReaderType = itk.ImageFileReader[ImageType] +reader = ReaderType.New() +reader.SetFileName(inputImage) + +StructuringElementType = itk.FlatStructuringElement[Dimension] +structuringElement = StructuringElementType.Ball(radiusValue) + +DilateFilterType = itk.BinaryDilateImageFilter[ + ImageType, ImageType, StructuringElementType] +dilateFilter = DilateFilterType.New() +dilateFilter.SetInput(reader.GetOutput()) +dilateFilter.SetKernel(structuringElement) +dilateFilter.SetDilateValue(200) -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -kernel = itk.strel(dim, 5) -filter = itk.BinaryDilateImageFilter[IType, IType, kernel].New( reader, - DilateValue=200, - Kernel=kernel ) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +WriterType = itk.ImageFileWriter[ImageType] +writer = WriterType.New() +writer.SetFileName(outputImage) +writer.SetInput(dilateFilter.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryErodeImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryErodeImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryErodeImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryErodeImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,5 @@ +#!/usr/bin/env python + #========================================================================== # # Copyright Insight Software Consortium @@ -17,21 +19,39 @@ #==========================================================================*/ # -# Example on the use of the BinaryErodeImageFilter +# Test BinaryDilateImageFilter # +import sys import itk -from sys import argv itk.auto_progress(2) -dim = 2 -IType = itk.Image[itk.UC, dim] +inputImage = sys.argv[1] +outputImage = sys.argv[2] +radiusValue = int(sys.argv[3]) + +PixelType = itk.UC +Dimension = 2 + +ImageType = itk.Image[PixelType, Dimension] + +ReaderType = itk.ImageFileReader[ImageType] +reader = ReaderType.New() +reader.SetFileName(inputImage) + +StructuringElementType = itk.FlatStructuringElement[Dimension] +structuringElement = StructuringElementType.Ball(radiusValue) + +ErodeFilterType = itk.BinaryErodeImageFilter[ + ImageType, ImageType, StructuringElementType] +erodeFilter = ErodeFilterType.New() +erodeFilter.SetInput(reader.GetOutput()) +erodeFilter.SetKernel(structuringElement) +erodeFilter.SetErodeValue(200) -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -kernel = itk.strel(dim, 5) -filter = itk.BinaryErodeImageFilter[IType, IType, kernel].New( reader, - ErodeValue=200, - Kernel=kernel ) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +WriterType = itk.ImageFileWriter[ImageType] +writer = WriterType.New() +writer.SetFileName(outputImage) +writer.SetInput(erodeFilter.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryThresholdImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryThresholdImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryThresholdImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BinaryThresholdImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -17,22 +17,42 @@ #==========================================================================*/ # -# Example on the use of the BinaryThresholdImageFilter +# Test BinaryThresholdImageFilter # +import sys import itk -from sys import argv itk.auto_progress(2) -dim = 2 -IType = itk.Image[itk.UC, dim] +inputImage = sys.argv[1] +outputImage = sys.argv[2] +lowerThreshold = int(sys.argv[3]) +upperThreshold = int(sys.argv[4]) +outsideValue = int(sys.argv[5]) +insideValue = int(sys.argv[6]) -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.BinaryThresholdImageFilter[IType, IType].New( reader, - LowerThreshold=eval( argv[3] ), - UpperThreshold=eval( argv[4] ), - OutsideValue=eval( argv[5] ), - InsideValue=eval( argv[6] )) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +PixelType = itk.UC +Dimension = 2 + +ImageType = itk.Image[PixelType, Dimension] + +ReaderType = itk.ImageFileReader[ImageType] +reader = ReaderType.New() +reader.SetFileName(inputImage) + +FilterType = itk.BinaryThresholdImageFilter[ImageType, ImageType] +thresholdFilter = FilterType.New() + +thresholdFilter.SetInput(reader.GetOutput()) + +thresholdFilter.SetLowerThreshold(lowerThreshold) +thresholdFilter.SetUpperThreshold(upperThreshold) +thresholdFilter.SetOutsideValue(outsideValue) +thresholdFilter.SetInsideValue(insideValue) + +WriterType = itk.ImageFileWriter[ImageType] +writer = WriterType.New() +writer.SetFileName(outputImage) +writer.SetInput(thresholdFilter.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BoxGrayscaleDilateImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BoxGrayscaleDilateImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BoxGrayscaleDilateImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/BoxGrayscaleDilateImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -28,10 +28,10 @@ dim = 2 IType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) kernel = itk.FlatStructuringElement[dim].Box(5) -filter = itk.GrayscaleDilateImageFilter[IType, IType, kernel].New( reader, - Kernel=kernel ) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +grayscaleFilter = itk.GrayscaleDilateImageFilter[IType, IType, kernel] +grayscaleFilter = grayscaleFilter.New(reader, Kernel=kernel) +writer = itk.ImageFileWriter[IType].New(grayscaleFilter, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CannyEdgeDetectionImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CannyEdgeDetectionImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CannyEdgeDetectionImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CannyEdgeDetectionImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -20,20 +20,29 @@ # Example on the use of the CannyEdgeDetectionImageFilter # +from __future__ import print_function + import itk from sys import argv, stderr, exit itk.auto_progress(2) if len(argv) < 3: - print >> stderr, "Usage: CannyEdgeDetectionImageFilter.py inputImage outputImage [variance]" - exit(1) + print(( + "Usage: CannyEdgeDetectionImageFilter.py inputImage outputImage " + "[variance]"), file=stderr) + exit(1) variance = 2.0 if len(argv) > 3: - variance = float( argv[3] ) - print variance + variance = float(argv[3]) + print(variance) -reader = itk.ImageFileReader.IF2.New( FileName=argv[1] ) -filter = itk.CannyEdgeDetectionImageFilter.IF2IF2.New( reader, Variance=variance ) -outputCast = itk.RescaleIntensityImageFilter.IF2IUC2.New( filter, OutputMinimum=0, OutputMaximum=255 ) -itk.write( outputCast, argv[2] ) +reader = itk.ImageFileReader.IF2.New(FileName=argv[1]) +filter = itk.CannyEdgeDetectionImageFilter.IF2IF2.New( + reader, + Variance=variance) +outputCast = itk.RescaleIntensityImageFilter.IF2IUC2.New( + filter, + OutputMinimum=0, + OutputMaximum=255) +itk.write(outputCast, argv[2]) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CastImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CastImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CastImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CastImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -28,8 +28,8 @@ IType = itk.Image[itk.F, dim] OIType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.CastImageFilter[IType, OIType].New( reader ) -writer = itk.ImageFileWriter[OIType].New( filter, FileName=argv[2] ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +filter = itk.CastImageFilter[IType, OIType].New(reader) +writer = itk.ImageFileWriter[OIType].New(filter, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CMakeLists.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -77,12 +77,14 @@ add_python_test(PythonModuleToModule ${CMAKE_CURRENT_SOURCE_DIR}/module2module.py DATA{${WrapITK_SOURCE_DIR}/images/cthead1.png} + 5 ) add_python_test(PythonBinaryDilateImageFilter ${CMAKE_CURRENT_SOURCE_DIR}/BinaryDilateImageFilter.py DATA{${WrapITK_SOURCE_DIR}/images/2th_cthead1.png} BinaryDilateImageFilter.png + 5 --compare BinaryDilateImageFilter.png DATA{${WrapITK_SOURCE_DIR}/images/BinaryDilateImageFilter.png} ) @@ -90,6 +92,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/BinaryErodeImageFilter.py DATA{${WrapITK_SOURCE_DIR}/images/2th_cthead1.png} BinaryErodeImageFilter.png + 5 --compare BinaryErodeImageFilter.png DATA{${WrapITK_SOURCE_DIR}/images/BinaryErodeImageFilter.png} ) @@ -113,6 +116,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/GrayscaleDilateImageFilter.py DATA{${WrapITK_SOURCE_DIR}/images/cthead1.png} GrayscaleDilateImageFilter.png + 5 --compare GrayscaleDilateImageFilter.png DATA{${WrapITK_SOURCE_DIR}/images/GrayscaleDilateImageFilter.png} ) @@ -135,6 +139,7 @@ ${CMAKE_CURRENT_SOURCE_DIR}/GrayscaleErodeImageFilter.py DATA{${WrapITK_SOURCE_DIR}/images/cthead1.png} GrayscaleErodeImageFilter.png + 5 --compare GrayscaleErodeImageFilter.png DATA{${WrapITK_SOURCE_DIR}/images/GrayscaleErodeImageFilter.png} ) @@ -417,6 +422,11 @@ SpatialObject.png ) + add_python_test(PythonReadDicomAndReadTag + ${CMAKE_CURRENT_SOURCE_DIR}/ReadDicomAndReadTag.py + DATA{${ITK_DATA_ROOT}/Input/DicomSeries/,REGEX:Image[0-9]+.dcm} + ) + endif() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureAnisotropicDiffusionImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureAnisotropicDiffusionImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureAnisotropicDiffusionImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureAnisotropicDiffusionImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -29,14 +29,17 @@ IType = itk.Image[itk.F, dim] OIType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.CurvatureAnisotropicDiffusionImageFilter[IType, IType].New( reader, - NumberOfIterations=eval( argv[3] ), - TimeStep=eval( argv[4] ), - ConductanceParameter=eval( argv[5] ) ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +filter = itk.CurvatureAnisotropicDiffusionImageFilter[IType, IType].New( + reader, + NumberOfIterations=eval( + argv[ + 3]), + TimeStep=eval(argv[4]), + ConductanceParameter=eval(argv[5])) cast = itk.RescaleIntensityImageFilter[IType, OIType].New(filter, - OutputMinimum=0, - OutputMaximum=255) -writer = itk.ImageFileWriter[OIType].New( cast, FileName=argv[2] ) + OutputMinimum=0, + OutputMaximum=255) +writer = itk.ImageFileWriter[OIType].New(cast, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureFlowImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureFlowImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureFlowImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/CurvatureFlowImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -21,7 +21,6 @@ # - import itk from sys import argv itk.auto_progress(2) @@ -30,13 +29,11 @@ IType = itk.Image[itk.F, dim] OIType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.CurvatureFlowImageFilter[IType, IType].New( reader, - NumberOfIterations=eval( argv[3] ), - TimeStep=eval( argv[4] ) ) -cast = itk.RescaleIntensityImageFilter[IType, OIType].New(filter, - OutputMinimum=0, - OutputMaximum=255) -writer = itk.ImageFileWriter[OIType].New( cast, FileName=argv[2] ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +filt = itk.CurvatureFlowImageFilter[IType, IType].New( + reader, NumberOfIterations=eval(argv[3]), TimeStep=eval(argv[4])) +cast = itk.RescaleIntensityImageFilter[IType, OIType].New( + filt, OutputMinimum=0, OutputMaximum=255) +writer = itk.ImageFileWriter[OIType].New(cast, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/extras.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/extras.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/extras.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/extras.py 2014-09-03 08:29:34.000000000 +0000 @@ -17,15 +17,20 @@ #==========================================================================*/ # also test the import callback feature + +from __future__ import print_function + + def custom_callback(name, progress): - if progress == 0: - print >> sys.stderr, "Loading %s..." % name, - if progress == 1: - print >> sys.stderr, "done" + if progress == 0: + print("Loading %s..." % name, file=sys.stderr) + if progress == 1: + print("done", file=sys.stderr) import itkConfig itkConfig.ImportCallback = custom_callback -import itk, sys +import itk +import sys # test the force load function itk.force_load() @@ -51,19 +56,19 @@ assert itk.template(ReaderType) == (itk.ImageFileReader, (IType,)) assert itk.template(reader) == (itk.ImageFileReader, (IType,)) try: - itk.template(str) - raise Exception("unknown class should send an exception") + itk.template(str) + raise Exception("unknown class should send an exception") except KeyError: - pass + pass # test ctype assert itk.ctype("unsigned short") == itk.US assert itk.ctype(" unsigned \n short \t ") == itk.US try: - itk.ctype("dummy") - raise Exception("unknown C type should send an exception") + itk.ctype("dummy") + raise Exception("unknown C type should send an exception") except KeyError: - pass + pass # test output @@ -73,18 +78,6 @@ assert itk.image(reader) == reader.GetOutput() assert itk.image(1) == 1 - -# test strel -# should work with the image type, an image instance or a filter -# and should work with a list, a tuple, an int or an itk.Size -for s in [2, (2, 2), [2, 2], itk.Size[2](2)] : - st = itk.strel(dim, s) - - (tpl, param) = itk.template(st) - assert tpl == itk.FlatStructuringElement - assert param[0] == dim - assert st.GetRadius()[0] == st.GetRadius()[1] == 2 - # test size s = itk.size(reader) assert s[0] == s[1] == 256 @@ -145,7 +138,8 @@ # test down_cast obj = itk.Object.cast(reader) -assert obj.__class__ == itk.Object # be sure that the reader is casted to itk::Object +# be sure that the reader is casted to itk::Object +assert obj.__class__ == itk.Object down_casted = itk.down_cast(obj) assert down_casted == reader assert down_casted.__class__ == ReaderType diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FastMarchingImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FastMarchingImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FastMarchingImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FastMarchingImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -35,111 +35,116 @@ # OUTPUTS: {FastMarchingFilterOutput3.png} # ARGUMENTS: 40 90 0.5 -0.3 2.0 200 100 +from __future__ import print_function + import itk from sys import argv, stderr, exit -if( len(argv) < 10 ): - print >> stderr, """Missing Parameters -Usage: FastMarchingImageFilter.py inputImage outputImage seedX seedY Sigma SigmoidAlpha SigmoidBeta TimeThreshold StoppingValue""" - exit(1) +if(len(argv) < 10): + print(( + "Missing Parameters \n Usage: FastMarchingImageFilter.py inputImage " + "outputImage seedX seedY Sigma SigmoidAlpha SigmoidBeta TimeThreshold " + "StoppingValue"), file=stderr) + exit(1) itk.auto_progress(2) InternalPixelType = itk.F Dimension = 2 -InternalImageType = itk.Image[ InternalPixelType, Dimension ] +InternalImageType = itk.Image[InternalPixelType, Dimension] OutputPixelType = itk.UC -OutputImageType = itk.Image[ OutputPixelType, Dimension ] +OutputImageType = itk.Image[OutputPixelType, Dimension] -thresholder = itk.BinaryThresholdImageFilter[ InternalImageType, OutputImageType ].New(); +thresholder = itk.BinaryThresholdImageFilter[ + InternalImageType, OutputImageType].New() -timeThreshold = float( argv[8] ) -thresholder.SetLowerThreshold( 0.0 ) -thresholder.SetUpperThreshold( timeThreshold ) +timeThreshold = float(argv[8]) +thresholder.SetLowerThreshold(0.0) +thresholder.SetUpperThreshold(timeThreshold) -thresholder.SetOutsideValue( 0 ) -thresholder.SetInsideValue( 255 ) +thresholder.SetOutsideValue(0) +thresholder.SetInsideValue(255) -ReaderType = itk.ImageFileReader[ InternalImageType ] -WriterType = itk.ImageFileWriter[ OutputImageType ] +ReaderType = itk.ImageFileReader[InternalImageType] +WriterType = itk.ImageFileWriter[OutputImageType] reader = ReaderType.New() writer = WriterType.New() -reader.SetFileName( argv[1] ) -writer.SetFileName( argv[2] ) +reader.SetFileName(argv[1]) +writer.SetFileName(argv[2]) CastFilterType = itk.RescaleIntensityImageFilter[ - InternalImageType, - OutputImageType ] + InternalImageType, + OutputImageType] SmoothingFilterType = itk.CurvatureAnisotropicDiffusionImageFilter[ - InternalImageType, - InternalImageType ] + InternalImageType, + InternalImageType] smoothing = SmoothingFilterType.New() GradientFilterType = itk.GradientMagnitudeRecursiveGaussianImageFilter[ - InternalImageType, - InternalImageType ] + InternalImageType, + InternalImageType] SigmoidFilterType = itk.SigmoidImageFilter[ - InternalImageType, - InternalImageType ] + InternalImageType, + InternalImageType] -gradientMagnitude = GradientFilterType.New(); +gradientMagnitude = GradientFilterType.New() sigmoid = SigmoidFilterType.New() -sigmoid.SetOutputMinimum( 0.0 ) -sigmoid.SetOutputMaximum( 1.0 ) +sigmoid.SetOutputMinimum(0.0) +sigmoid.SetOutputMaximum(1.0) -FastMarchingFilterType = itk.FastMarchingImageFilter[ InternalImageType, - InternalImageType ] +FastMarchingFilterType = itk.FastMarchingImageFilter[InternalImageType, + InternalImageType] fastMarching = FastMarchingFilterType.New() -smoothing.SetInput( reader.GetOutput() ) -gradientMagnitude.SetInput( smoothing.GetOutput() ) -sigmoid.SetInput( gradientMagnitude.GetOutput() ) -fastMarching.SetInput( sigmoid.GetOutput() ) -thresholder.SetInput( fastMarching.GetOutput() ) -writer.SetInput( thresholder.GetOutput() ) - -smoothing.SetTimeStep( 0.125 ) -smoothing.SetNumberOfIterations( 5 ) -smoothing.SetConductanceParameter( 9.0 ) - -sigma = float( argv[5] ) +smoothing.SetInput(reader.GetOutput()) +gradientMagnitude.SetInput(smoothing.GetOutput()) +sigmoid.SetInput(gradientMagnitude.GetOutput()) +fastMarching.SetInput(sigmoid.GetOutput()) +thresholder.SetInput(fastMarching.GetOutput()) +writer.SetInput(thresholder.GetOutput()) + +smoothing.SetTimeStep(0.125) +smoothing.SetNumberOfIterations(5) +smoothing.SetConductanceParameter(9.0) + +sigma = float(argv[5]) -gradientMagnitude.SetSigma( sigma ) +gradientMagnitude.SetSigma(sigma) -alpha = float( argv[6] ) -beta = float( argv[7] ) +alpha = float(argv[6]) +beta = float(argv[7]) -sigmoid.SetAlpha( alpha ) -sigmoid.SetBeta( beta ) +sigmoid.SetAlpha(alpha) +sigmoid.SetBeta(beta) NodeType = itk.LevelSetNode[InternalPixelType, Dimension] NodeContainer = itk.VectorContainer[itk.UI, NodeType] seeds = NodeContainer.New() -seedPosition = [int( argv[3] ), int( argv[4] )] +seedPosition = [int(argv[3]), int(argv[4])] node = NodeType() seedValue = 0.0 -node.SetValue( seedValue ) -node.SetIndex( seedPosition ) +node.SetValue(seedValue) +node.SetIndex(seedPosition) -seeds.Initialize(); -seeds.InsertElement( 0, node ) +seeds.Initialize() +seeds.InsertElement(0, node) -fastMarching.SetTrialPoints( seeds ); +fastMarching.SetTrialPoints(seeds) caster1 = CastFilterType.New() caster2 = CastFilterType.New() @@ -151,40 +156,40 @@ writer3 = WriterType.New() writer4 = WriterType.New() -caster1.SetInput( smoothing.GetOutput() ) -writer1.SetInput( caster1.GetOutput() ) +caster1.SetInput(smoothing.GetOutput()) +writer1.SetInput(caster1.GetOutput()) writer1.SetFileName("FastMarchingFilterOutput1.png") -caster1.SetOutputMinimum( 0 ) -caster1.SetOutputMaximum( 255 ) +caster1.SetOutputMinimum(0) +caster1.SetOutputMaximum(255) writer1.Update() -caster2.SetInput( gradientMagnitude.GetOutput() ) -writer2.SetInput( caster2.GetOutput() ) +caster2.SetInput(gradientMagnitude.GetOutput()) +writer2.SetInput(caster2.GetOutput()) writer2.SetFileName("FastMarchingFilterOutput2.png") -caster2.SetOutputMinimum( 0 ) -caster2.SetOutputMaximum( 255 ) +caster2.SetOutputMinimum(0) +caster2.SetOutputMaximum(255) writer2.Update() -caster3.SetInput( sigmoid.GetOutput() ) -writer3.SetInput( caster3.GetOutput() ) +caster3.SetInput(sigmoid.GetOutput()) +writer3.SetInput(caster3.GetOutput()) writer3.SetFileName("FastMarchingFilterOutput3.png") -caster3.SetOutputMinimum( 0 ) -caster3.SetOutputMaximum( 255 ) +caster3.SetOutputMinimum(0) +caster3.SetOutputMaximum(255) writer3.Update() -caster4.SetInput( fastMarching.GetOutput() ) -writer4.SetInput( caster4.GetOutput() ) +caster4.SetInput(fastMarching.GetOutput()) +writer4.SetInput(caster4.GetOutput()) writer4.SetFileName("FastMarchingFilterOutput4.png") -caster4.SetOutputMinimum( 0 ) -caster4.SetOutputMaximum( 255 ) +caster4.SetOutputMinimum(0) +caster4.SetOutputMaximum(255) fastMarching.SetOutputSize( - reader.GetOutput().GetBufferedRegion().GetSize() ) + reader.GetOutput().GetBufferedRegion().GetSize()) -stoppingTime = float( argv[9] ) +stoppingTime = float(argv[9]) -fastMarching.SetStoppingValue( stoppingTime ) +fastMarching.SetStoppingValue(stoppingTime) writer.Update() @@ -192,19 +197,19 @@ writer4.Update() -InternalWriterType = itk.ImageFileWriter[ InternalImageType ] +InternalWriterType = itk.ImageFileWriter[InternalImageType] mapWriter = InternalWriterType.New() -mapWriter.SetInput( fastMarching.GetOutput() ) +mapWriter.SetInput(fastMarching.GetOutput()) mapWriter.SetFileName("FastMarchingFilterOutput4.mha") mapWriter.Update() speedWriter = InternalWriterType.New() -speedWriter.SetInput( sigmoid.GetOutput() ) +speedWriter.SetInput(sigmoid.GetOutput()) speedWriter.SetFileName("FastMarchingFilterOutput3.mha") speedWriter.Update() gradientWriter = InternalWriterType.New() -gradientWriter.SetInput( gradientMagnitude.GetOutput() ) +gradientWriter.SetInput(gradientMagnitude.GetOutput()) gradientWriter.SetFileName("FastMarchingFilterOutput2.mha") gradientWriter.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FFTImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FFTImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FFTImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FFTImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -27,26 +27,37 @@ dim = 2 PixelType = itk.F ImageType = itk.Image[PixelType, dim] -ComplexImageType = itk.Image[itk.complex[PixelType], dim] +ComplexImageType = itk.Image[itk.complex[PixelType], dim] -reader = itk.ImageFileReader[ImageType].New( FileName=argv[1] ) +reader = itk.ImageFileReader[ImageType].New(FileName=argv[1]) fftFilter = itk.ForwardFFTImageFilter[ImageType, ComplexImageType].New(reader) # why this Update() ? fftFilter.Update() -complexWriter = itk.ImageFileWriter[ComplexImageType].New( fftFilter, FileName="complexImage.mhd" ) +complexWriter = itk.ImageFileWriter[ComplexImageType].New( + fftFilter, + FileName="complexImage.mhd") complexWriter.Update() -realFilter = itk.ComplexToRealImageFilter[ComplexImageType, ImageType].New( fftFilter ) +realFilter = itk.ComplexToRealImageFilter[ + ComplexImageType, ImageType].New(fftFilter) WritePixelType = itk.UC WriteImageType = itk.Image[WritePixelType, dim] -intensityRescaler = itk.RescaleIntensityImageFilter[ImageType, WriteImageType].New( realFilter, OutputMinimum=0, OutputMaximum=255 ) -writer = itk.ImageFileWriter[WriteImageType].New( intensityRescaler, FileName=argv[2] ) +intensityRescaler = itk.RescaleIntensityImageFilter[ + ImageType, + WriteImageType].New( + realFilter, + OutputMinimum=0, + OutputMaximum=255) +writer = itk.ImageFileWriter[WriteImageType].New( + intensityRescaler, + FileName=argv[2]) writer.Update() -imaginaryFilter = itk.ComplexToImaginaryImageFilter[ComplexImageType, ImageType].New( fftFilter ) -intensityRescaler.SetInput( imaginaryFilter.GetOutput() ) -writer.SetFileName( argv[3] ) +imaginaryFilter = itk.ComplexToImaginaryImageFilter[ + ComplexImageType, ImageType].New(fftFilter) +intensityRescaler.SetInput(imaginaryFilter.GetOutput()) +writer.SetFileName(argv[3]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findEmptyClasses.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findEmptyClasses.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findEmptyClasses.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findEmptyClasses.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,7 +16,11 @@ # #==========================================================================*/ -import itk, re, sys +from __future__ import print_function + +import itk +import re +import sys # itk.auto_progress(True) from itkTemplate import itkTemplate @@ -28,93 +32,97 @@ # dirty but easier: a global var to count the empty classes empty = set() + def exploreTpl(tpl): for cl in tpl.itervalues(): - print cl + print(cl) exploreMethods(cl) # try to instanciate the class - try : + try: obj = cl.New() exploreMethods(obj) except: pass - try : + try: exploreMethods(cl()) except: pass + def exploreMethods(obj): global count excludeList = ['this', 'thisown'] - attrNameList = [i for i in dir(obj) if isinstance(i, str) and i[0].isupper() and i not in excludeList] - if attrNameList == [] : - empty.add(obj) + attrNameList = [i for i in dir( + obj) if isinstance(i, str) and i[0].isupper() and i not in excludeList] + if attrNameList == []: + empty.add(obj) excluded = set([ - "PeriodicBoundaryCondition", - "BandNode", - "DefaultDynamicMeshTraits", - "DefaultStaticMeshTraits", - "NormalBandNode", - "ZeroFluxNeumannBoundaryCondition", - "SparseFieldLevelSetNode", - "ParallelSparseFieldLevelSetNode", - "PySwigIterator", - "SwigPyIterator", - "COLORS", - "VECTOR_REALS", - "SCALARS", - "ALL_TYPES", - "COMPLEX_REALS", - "RGBS", - "RGBAS", - "REALS", - "USIGN_INTS", - "DIMS", - "SIGN_INTS", - "VECTORS", - "INTS", - "COV_VECTOR_REALS", - "FFTComplexToComplexImageFilter", - "QuadEdgeMeshCellTraitsInfo", - "QuadEdgeMeshTraits", - "OnesMatrixCoefficients", - "ConformalMatrixCoefficients", - "InverseEuclideanDistanceMatrixCoefficients", - "AuthalicMatrixCoefficients", - "IntrinsicMatrixCoefficients", - "InverseEuclideanDistanceMatrixCoefficients", - "OnesMatrixCoefficients", - "ConformalMatrixCoefficients", - "AuthalicMatrixCoefficients", - "MatrixCoefficients", - ]) + "PeriodicBoundaryCondition", + "BandNode", + "DefaultDynamicMeshTraits", + "DefaultStaticMeshTraits", + "NormalBandNode", + "ZeroFluxNeumannBoundaryCondition", + "SparseFieldLevelSetNode", + "ParallelSparseFieldLevelSetNode", + "PySwigIterator", + "SwigPyIterator", + "COLORS", + "VECTOR_REALS", + "SCALARS", + "ALL_TYPES", + "COMPLEX_REALS", + "RGBS", + "RGBAS", + "REALS", + "USIGN_INTS", + "DIMS", + "SIGN_INTS", + "VECTORS", + "INTS", + "COV_VECTOR_REALS", + "FFTComplexToComplexImageFilter", + "QuadEdgeMeshCellTraitsInfo", + "QuadEdgeMeshTraits", + "OnesMatrixCoefficients", + "ConformalMatrixCoefficients", + "InverseEuclideanDistanceMatrixCoefficients", + "AuthalicMatrixCoefficients", + "IntrinsicMatrixCoefficients", + "InverseEuclideanDistanceMatrixCoefficients", + "OnesMatrixCoefficients", + "ConformalMatrixCoefficients", + "AuthalicMatrixCoefficients", + "MatrixCoefficients", +]) -attrNameList = set([i for i in dir(itk) if i[0].isupper() and len(i) > 2]) - excluded +attrNameList = set( + [i for i in dir(itk) if i[0].isupper() and len(i) > 2]) - excluded for name in attrNameList: # use it because of lazy loading - exec "attr = itk."+name - print "-----------", name, "-----------" - if isinstance(attr, itkTemplate) : + exec "attr = itk." + name + print("-----------", name, "-----------") + if isinstance(attr, itkTemplate): exploreTpl(attr) - else : + else: exploreMethods(attr) - try : + try: exploreMethods(cl.New()) except: pass - try : + try: exploreMethods(cl()) except: pass -print -print -print len(empty), "empty classes found" +print() +print() +print(len(empty), "empty classes found") for c in empty: - print c + print(c) sys.exit(len(empty)) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findSegfaults.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findSegfaults.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findSegfaults.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/findSegfaults.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,20 +16,40 @@ # #==========================================================================*/ +from __future__ import print_function -import sys, commands, tempfile +import sys +import commands +import tempfile from optparse import OptionParser parser = OptionParser(usage="usage: %prog") -parser.add_option("--start-from", dest="startFrom", default=None, metavar="CLASS", help="") -parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="") -parser.add_option("-k", "--keep", action="store_true", dest="keep", default=False, help="") +parser.add_option( + "--start-from", + dest="startFrom", + default=None, + metavar="CLASS", + help="") +parser.add_option( + "-v", + "--verbose", + action="store_true", + dest="verbose", + default=False, + help="") +parser.add_option( + "-k", + "--keep", + action="store_true", + dest="keep", + default=False, + help="") (options, args) = parser.parse_args() -if options.keep : - mode = "a" +if options.keep: + mode = "a" else: - mode = "w" + mode = "w" segfaultFile = file(args[0], mode) logs = tempfile.NamedTemporaryFile() @@ -37,25 +57,26 @@ lastClass = options.startFrom ret = 1 while ret != 0: - command = "python returnedTypeCoverage.py -v5 --exclude "+sys.argv[1]+" --log-file '"+logs.name+"'" - if lastClass: - command += " --start-from "+lastClass - if options.verbose: - print command - (ret, output) = commands.getstatusoutput( command ) - if ret != 0: - # find last args (the ones which caused the segfault) - faultyArgs = None - logs.file.seek(0) - for l in reversed(logs.file.readlines()): - l = l.strip() - if faultyArgs == None and l.startswith('('): - faultyArgs = l - if faultyArgs != None : - # find the last class - if len(l) != 0 and l[0].isupper(): - lastClass = l - break - print repr(faultyArgs) - segfaultFile.write(faultyArgs+"\n") - segfaultFile.flush() + command = "python returnedTypeCoverage.py -v5 --exclude " + \ + sys.argv[1] + " --log-file '" + logs.name + "'" + if lastClass: + command += " --start-from " + lastClass + if options.verbose: + print(command) + (ret, output) = commands.getstatusoutput(command) + if ret != 0: + # find last args (the ones which caused the segfault) + faultyArgs = None + logs.file.seek(0) + for l in reversed(logs.file.readlines()): + l = l.strip() + if faultyArgs is None and l.startswith('('): + faultyArgs = l + if faultyArgs is not None: + # find the last class + if len(l) != 0 and l[0].isupper(): + lastClass = l + break + print(repr(faultyArgs)) + segfaultFile.write(faultyArgs + "\n") + segfaultFile.flush() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FlatStructuringElement.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FlatStructuringElement.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FlatStructuringElement.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/FlatStructuringElement.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,35 +16,37 @@ # #==========================================================================*/ +from __future__ import print_function + import itk from sys import argv, exit itk.auto_progress(2) if argv[2] == "Ball": - print "Ball" - strel = itk.FlatStructuringElement[2].Ball( int( argv[3] ) ) + print("Ball") + strel = itk.FlatStructuringElement[2].Ball(int(argv[3])) elif argv[2] == "Box": - print "Box" - strel = itk.FlatStructuringElement[2].Box( int( argv[3] ) ) + print("Box") + strel = itk.FlatStructuringElement[2].Box(int(argv[3])) elif argv[2] == "FromImage": - print "FromImage" - reader = itk.ImageFileReader.IUC2.New( FileName=argv[3] ) - strel = itk.FlatStructuringElement[2].FromImageUC( reader.GetOutput() ) + print("FromImage") + reader = itk.ImageFileReader.IUC2.New(FileName=argv[3]) + strel = itk.FlatStructuringElement[2].FromImageUC(reader.GetOutput()) else: - print "invalid arguement: " + argv[2] - exit(1) + print("invalid arguement: " + argv[2]) + exit(1) img = strel.GetImageUC() -size = itk.size( img ) +size = itk.size(img) for y in range(0, size.GetElement(1)): - for x in range(0, size.GetElement(0)): - if img.GetPixel( [x, y] ): - print "X", - else: - print " ", - print "\n", + for x in range(0, size.GetElement(0)): + if img.GetPixel([x, y]): + print("X") + else: + print(" ") + print("\n") -itk.write( img, argv[1] ) +itk.write(img, argv[1]) # writer = itk.ImageFileWriter.IUC2.New(FileName=argv[1], Input=img ) # itk.echo(writer) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GeodesicActiveContourImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GeodesicActiveContourImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GeodesicActiveContourImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GeodesicActiveContourImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -18,7 +18,8 @@ # GeodesicActiveContourImageFilter.py # Translated by Charl P. Botha from the cxx original. -# $Id: GeodesicActiveContourImageFilter.py,v 1.1 2006/09/06 20:58:42 glehmann Exp $ +# $Id: GeodesicActiveContourImageFilter.py,v 1.1 2006/09/06 20:58:42 glehmann +# Exp $ # example runs: # ------------ @@ -35,10 +36,13 @@ # See the ITK Software Guide, section 9.3.3 "Geodesic Active Contours # Segmentation" as well as the CXX example for more comments. +from __future__ import print_function + import itk from sys import argv, stderr itk.auto_progress(2) + def main(): if len(argv) < 10: errMsg = "Missing parameters\n" \ @@ -48,7 +52,7 @@ " Sigma SigmoidAlpha SigmoidBeta\n" \ " PropagationScaling\n" - print >> stderr, errMsg + print(errMsg, file=stderr) return # We're going to build the following pipelines: @@ -72,19 +76,26 @@ # needed to give the size to the fastmarching filter reader.Update() - smoothing = itk.CurvatureAnisotropicDiffusionImageFilter[InternalImageType, InternalImageType].New(reader, - TimeStep=0.125, - NumberOfIterations=5, - ConductanceParameter=9.0) - - gradientMagnitude = itk.GradientMagnitudeRecursiveGaussianImageFilter[InternalImageType, InternalImageType].New(smoothing, - Sigma=float(argv[6])) - - sigmoid = itk.SigmoidImageFilter[InternalImageType, InternalImageType].New(gradientMagnitude, - OutputMinimum=0.0, - OutputMaximum=1.1, - Alpha=float(argv[7]), - Beta=float(argv[8])) + smoothing = itk.CurvatureAnisotropicDiffusionImageFilter[ + InternalImageType, + InternalImageType].New( + reader, + TimeStep=0.125, + NumberOfIterations=5, + ConductanceParameter=9.0) + + gradientMagnitude = itk.GradientMagnitudeRecursiveGaussianImageFilter[ + InternalImageType, + InternalImageType].New( + smoothing, + Sigma=float(argv[6])) + + sigmoid = itk.SigmoidImageFilter[InternalImageType, InternalImageType].New( + gradientMagnitude, + OutputMinimum=0.0, + OutputMaximum=1.1, + Alpha=float(argv[7]), + Beta=float(argv[8])) seedPosition = itk.Index[2]() seedPosition.SetElement(0, int(argv[3])) @@ -94,67 +105,83 @@ node.SetValue(-float(argv[5])) node.SetIndex(seedPosition) - seeds = itk.VectorContainer[itk.UI, itk.LevelSetNode[InternalPixelType, Dimension]].New() + seeds = itk.VectorContainer[ + itk.UI, itk.LevelSetNode[InternalPixelType, Dimension]].New() seeds.Initialize() seeds.InsertElement(0, node) - fastMarching = itk.FastMarchingImageFilter[InternalImageType, InternalImageType].New(sigmoid, - TrialPoints=seeds, - SpeedConstant=1.0, - OutputSize=reader.GetOutput().GetBufferedRegion().GetSize() ) - - - geodesicActiveContour = itk.GeodesicActiveContourLevelSetImageFilter[InternalImageType, InternalImageType, InternalPixelType].New(fastMarching, - FeatureImage=sigmoid.GetOutput(), # it is required to use the explicitly the FeatureImage - itk segfault without that :-( - PropagationScaling=float(argv[9]), - CurvatureScaling=1.0, - AdvectionScaling=1.0, - MaximumRMSError=0.02, - NumberOfIterations=800 - ) - - thresholder = itk.BinaryThresholdImageFilter[InternalImageType, OutputImageType].New(geodesicActiveContour, - LowerThreshold=-1000, - UpperThreshold=0, - OutsideValue=0, - InsideValue=255) - - writer = itk.ImageFileWriter[OutputImageType].New(thresholder, FileName=argv[2]) - - - + fastMarching = itk.FastMarchingImageFilter[ + InternalImageType, + InternalImageType].New( + sigmoid, + TrialPoints=seeds, + SpeedConstant=1.0, + OutputSize=reader.GetOutput().GetBufferedRegion().GetSize()) + + geodesicActiveContour = itk.GeodesicActiveContourLevelSetImageFilter[ + InternalImageType, + InternalImageType, + InternalPixelType].New( + fastMarching, + # it is required to use the explicitly the FeatureImage + # - itk segfault without that :-( + FeatureImage=sigmoid.GetOutput(), + PropagationScaling=float(argv[9]), + CurvatureScaling=1.0, + AdvectionScaling=1.0, + MaximumRMSError=0.02, + NumberOfIterations=800) + + thresholder = itk.BinaryThresholdImageFilter[ + InternalImageType, + OutputImageType].New( + geodesicActiveContour, + LowerThreshold=-1000, + UpperThreshold=0, + OutsideValue=0, + InsideValue=255) + + writer = itk.ImageFileWriter[OutputImageType].New( + thresholder, + FileName=argv[2]) def rescaleAndWrite(filter, fileName): - caster = itk.RescaleIntensityImageFilter[InternalImageType, OutputImageType].New(filter, - OutputMinimum=0, - OutputMaximum=255) + caster = itk.RescaleIntensityImageFilter[ + InternalImageType, + OutputImageType].New( + filter, + OutputMinimum=0, + OutputMaximum=255) itk.write(caster, fileName) - rescaleAndWrite(smoothing, "GeodesicActiveContourImageFilterOutput1.png") - rescaleAndWrite(gradientMagnitude, "GeodesicActiveContourImageFilterOutput2.png") + rescaleAndWrite( + gradientMagnitude, + "GeodesicActiveContourImageFilterOutput2.png") rescaleAndWrite(sigmoid, "GeodesicActiveContourImageFilterOutput3.png") - rescaleAndWrite(fastMarching, "GeodesicActiveContourImageFilterOutput4.png") + rescaleAndWrite( + fastMarching, + "GeodesicActiveContourImageFilterOutput4.png") writer.Update() - - print - print "Max. no. iterations: %d" % (geodesicActiveContour.GetNumberOfIterations()) - print "Max. RMS error: %.3f" % (geodesicActiveContour.GetMaximumRMSError()) - print - print "No. elapsed iterations: %d" % (geodesicActiveContour.GetElapsedIterations()) - print "RMS change: %.3f" % (geodesicActiveContour.GetRMSChange()) - + print("") + print( + "Max. no. iterations: %d" % + (geodesicActiveContour.GetNumberOfIterations())) + print( + "Max. RMS error: %.3f" % + (geodesicActiveContour.GetMaximumRMSError())) + print("") + print( + "No. elapsed iterations: %d" + % (geodesicActiveContour.GetElapsedIterations())) + print("RMS change: %.3f" % (geodesicActiveContour.GetRMSChange())) itk.write(fastMarching, "GeodesicActiveContourImageFilterOutput4.mha") itk.write(sigmoid, "GeodesicActiveContourImageFilterOutput3.mha") itk.write(gradientMagnitude, "GeodesicActiveContourImageFilterOutput2.mha") - - - - if __name__ == "__main__": main() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/getNameOfClass.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/getNameOfClass.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/getNameOfClass.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/getNameOfClass.py 2014-09-03 08:29:34.000000000 +0000 @@ -18,51 +18,63 @@ # a short program to check the value returned by the GetNameOfClass() methods -import itk, sys +from __future__ import print_function + +import itk +import sys itk.auto_progress(2) # must force the load to return all the names with dir(itk) itk.force_load() # itk.ImageToImageFilter -# a list of classes to exclude. Typically, the classes with a custom New() method, which return a subclass -# of the current class -exclude = ["ForwardFFTImageFilter", "InverseFFTImageFilter", "OutputWindow", "FFTComplexToComplexImageFilter", "templated_class", "HalfHermitianToRealInverseFFTImageFilter", "RealToHalfHermitianForwardFFTImageFilter"] +# a list of classes to exclude. Typically, the classes with a custom New() +# method, which return a subclass of the current class +exclude = ["ForwardFFTImageFilter", + "InverseFFTImageFilter", + "OutputWindow", + "FFTComplexToComplexImageFilter", + "templated_class", + "HalfHermitianToRealInverseFFTImageFilter", + "RealToHalfHermitianForwardFFTImageFilter"] wrongName = False for t in dir(itk): - if t not in exclude: - T = itk.__dict__[t] - # first case - that's a templated class - if isinstance(T, itk.Vector.__class__) and len(T)>0: - # use only the first specialization - all of them return the same name - i = T.values()[0] - # GetNameOfClass() is a virtual method of the LightObject class, so we must - # instantiate an object with the New() method - if 'New' in dir(i): - I = i.New() - # be sure that the type of the instantiated object is the same than the - # one of the class. It can be different if the class is an "abstract" one - # and don't provide any New() method. In that case, the one of the superclass - # is used. - if 'GetNameOfClass' in dir(I): - # print "Checking", t - n = I.GetNameOfClass() - if n != t and itk.class_(I) == i: - print >> sys.stderr, t, "doesn't provide the right name." - wrongName = True - else: - if 'New' in dir(T): - I = T.New() - if 'GetNameOfClass' in dir(I): - # print "Checking", t - n = I.GetNameOfClass() - if n != t and itk.class_(I) == T: - print >> sys.stderr, t, "doesn't provide the right name." - wrongName = True + if t not in exclude: + T = itk.__dict__[t] + # first case - that's a templated class + if isinstance(T, itk.Vector.__class__) and len(T) > 0: + # use only the first specialization - all of them return the same + # name + i = T.values()[0] + # GetNameOfClass() is a virtual method of the LightObject class, + # so we must instantiate an object with the New() method + if 'New' in dir(i): + I = i.New() + # be sure that the type of the instantiated object is the same + # than the one of the class. It can be different if the class + # is an "abstract" one and don't provide any New() method. + # In that case, the one of the superclass is used. + if 'GetNameOfClass' in dir(I): + # print("Checking", t) + n = I.GetNameOfClass() + if n != t and itk.class_(I) == i: + msg = "doesn't provide the right name." + print(t, msg, file=sys.stderr) + wrongName = True + else: + if 'New' in dir(T): + I = T.New() + if 'GetNameOfClass' in dir(I): + # print("Checking", t) + n = I.GetNameOfClass() + if n != t and itk.class_(I) == T: + msg = "doesn't provide the right name." + print(t, msg, file=sys.stderr) + wrongName = True if wrongName: - print >> sys.stderr, "Some classes are not providing the correct name." - sys.exit(1) + print("Some classes are not providing the correct name.", file=sys.stderr) + sys.exit(1) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientAnisotropicDiffusionImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientAnisotropicDiffusionImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientAnisotropicDiffusionImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientAnisotropicDiffusionImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -26,17 +26,24 @@ InputImageType = itk.Image[InputPixelType, 2] OutputImageType = itk.Image[OutputPixelType, 2] -reader = itk.ImageFileReader[InputImageType].New( FileName=argv[1] ) +reader = itk.ImageFileReader[InputImageType].New(FileName=argv[1]) -filter = itk.GradientAnisotropicDiffusionImageFilter[InputImageType, OutputImageType].New( reader, - NumberOfIterations=int(argv[3]), - TimeStep=float(argv[4]), - ConductanceParameter=float(argv[5])) -filter.Update(); +filter = itk.GradientAnisotropicDiffusionImageFilter[ + InputImageType, OutputImageType].New( + reader, + NumberOfIterations=int(argv[3]), + TimeStep=float(argv[4]), + ConductanceParameter=float(argv[5])) +filter.Update() WritePixelType = itk.UC WriteImageType = itk.Image[WritePixelType, 2] -rescaler = itk.RescaleIntensityImageFilter[OutputImageType, WriteImageType].New( filter, OutputMinimum=0, OutputMaximum=255 ) -writer = itk.ImageFileWriter[WriteImageType].New( rescaler, FileName=argv[2] ) -writer.Update(); +rescaler = itk.RescaleIntensityImageFilter[ + OutputImageType, + WriteImageType].New( + filter, + OutputMinimum=0, + OutputMaximum=255) +writer = itk.ImageFileWriter[WriteImageType].New(rescaler, FileName=argv[2]) +writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientMagnitudeRecursiveGaussianImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientMagnitudeRecursiveGaussianImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientMagnitudeRecursiveGaussianImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GradientMagnitudeRecursiveGaussianImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -26,14 +26,20 @@ InputImageType = itk.Image[InputPixelType, 2] OutputImageType = itk.Image[OutputPixelType, 2] -reader = itk.ImageFileReader[InputImageType].New( FileName=argv[1] ) +reader = itk.ImageFileReader[InputImageType].New(FileName=argv[1]) -filter = itk.GradientMagnitudeRecursiveGaussianImageFilter[InputImageType, OutputImageType].New( reader, Sigma=float(argv[3]) ) -filter.Update(); +filter = itk.GradientMagnitudeRecursiveGaussianImageFilter[ + InputImageType, OutputImageType].New(reader, Sigma=float(argv[3])) +filter.Update() WritePixelType = itk.UC WriteImageType = itk.Image[WritePixelType, 2] -rescaler = itk.RescaleIntensityImageFilter[OutputImageType, WriteImageType].New( filter, OutputMinimum=0, OutputMaximum=255 ) -writer = itk.ImageFileWriter[WriteImageType].New( rescaler, FileName=argv[2] ) -writer.Update(); +rescaler = itk.RescaleIntensityImageFilter[ + OutputImageType, + WriteImageType].New( + filter, + OutputMinimum=0, + OutputMaximum=255) +writer = itk.ImageFileWriter[WriteImageType].New(rescaler, FileName=argv[2]) +writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleDilateImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleDilateImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleDilateImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleDilateImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,5 @@ +#!/usr/bin/env python + #========================================================================== # # Copyright Insight Software Consortium @@ -17,20 +19,38 @@ #==========================================================================*/ # -# Example on the use of the GrayscaleDilateImageFilter +# Test GrayscaleDilateImageFilter # +import sys import itk -from sys import argv itk.auto_progress(2) -dim = 2 -IType = itk.Image[itk.UC, dim] +inputImage = sys.argv[1] +outputImage = sys.argv[2] +radiusValue = int(sys.argv[3]) + +PixelType = itk.UC +Dimension = 2 + +ImageType = itk.Image[PixelType, Dimension] + +ReaderType = itk.ImageFileReader[ImageType] +reader = ReaderType.New() +reader.SetFileName(inputImage) + +StructuringElementType = itk.FlatStructuringElement[Dimension] +structuringElement = StructuringElementType.Ball(radiusValue) + +GrayscaleFilterType = itk.GrayscaleDilateImageFilter[ + ImageType, ImageType, StructuringElementType] +grayscaleFilter = GrayscaleFilterType.New() +grayscaleFilter.SetInput(reader.GetOutput()) +grayscaleFilter.SetKernel(structuringElement) -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -kernel = itk.strel(dim, 5) -filter = itk.GrayscaleDilateImageFilter[IType, IType, kernel].New( reader, - Kernel=kernel ) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +WriterType = itk.ImageFileWriter[ImageType] +writer = WriterType.New() +writer.SetFileName(outputImage) +writer.SetInput(grayscaleFilter.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleErodeImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleErodeImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleErodeImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/GrayscaleErodeImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,5 @@ +#!/usr/bin/env python + #========================================================================== # # Copyright Insight Software Consortium @@ -17,20 +19,38 @@ #==========================================================================*/ # -# Example on the use of the GrayscaleErodeImageFilter +# Test GrayscaleErodeImageFilter # +import sys import itk -from sys import argv itk.auto_progress(2) -dim = 2 -IType = itk.Image[itk.UC, dim] +inputImage = sys.argv[1] +outputImage = sys.argv[2] +radiusValue = int(sys.argv[3]) + +PixelType = itk.UC +Dimension = 2 + +ImageType = itk.Image[PixelType, Dimension] + +ReaderType = itk.ImageFileReader[ImageType] +reader = ReaderType.New() +reader.SetFileName(inputImage) + +StructuringElementType = itk.FlatStructuringElement[Dimension] +structuringElement = StructuringElementType.Ball(radiusValue) + +GrayscaleFilterType = itk.GrayscaleErodeImageFilter[ + ImageType, ImageType, StructuringElementType] +grayscaleFilter = GrayscaleFilterType.New() +grayscaleFilter.SetInput(reader.GetOutput()) +grayscaleFilter.SetKernel(structuringElement) -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -kernel = itk.strel(dim, 5) -filter = itk.GrayscaleErodeImageFilter[IType, IType, kernel].New( reader, - Kernel=kernel ) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +WriterType = itk.ImageFileWriter[ImageType] +writer = WriterType.New() +writer.SetFileName(outputImage) +writer.SetInput(grayscaleFilter.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/LaplacianImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/LaplacianImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/LaplacianImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/LaplacianImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -28,11 +28,11 @@ IType = itk.Image[itk.F, dim] OIType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.LaplacianImageFilter[IType, IType].New( reader ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +filter = itk.LaplacianImageFilter[IType, IType].New(reader) cast = itk.RescaleIntensityImageFilter[IType, OIType].New(filter, - OutputMinimum=0, - OutputMaximum=255) -writer = itk.ImageFileWriter[OIType].New( cast, FileName=argv[2] ) + OutputMinimum=0, + OutputMaximum=255) +writer = itk.ImageFileWriter[OIType].New(cast, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MeanImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MeanImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MeanImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MeanImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,20 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ # # Example on the use of the MeanImageFilter @@ -9,11 +26,11 @@ dim = 2 IType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.MeanImageFilter[IType, IType].New( reader, Radius=eval( argv[3] ) ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +filter = itk.MeanImageFilter[IType, IType].New(reader, Radius=eval(argv[3])) -watcher = itk.SimpleFilterWatcher( filter, "filter" ) +watcher = itk.SimpleFilterWatcher(filter, "filter") -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +writer = itk.ImageFileWriter[IType].New(filter, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MedianImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MedianImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MedianImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/MedianImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -23,15 +23,15 @@ import itk from sys import argv -reader = itk.ImageFileReader.IUC2.New( FileName=argv[1] ) +reader = itk.ImageFileReader.IUC2.New(FileName=argv[1]) # test the deduction of the template parameter from the input -filter = itk.MedianImageFilter.New( reader ) -watcher = itk.XMLFilterWatcher( filter, "filter" ) +filter = itk.MedianImageFilter.New(reader) +watcher = itk.XMLFilterWatcher(filter, "filter") # test the update of the filter with the __call__ operator # and the setting of parameter inside it -filter( Radius=eval(argv[3]) ) +filter(Radius=eval(argv[3])) # test the write method -itk.write( filter, argv[2] ) +itk.write(filter, argv[2]) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/module2module.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/module2module.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/module2module.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/module2module.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,12 +16,10 @@ # #==========================================================================*/ -# def custom_callback(name): -# print "loading %s submodule..." % name -# import itkConfig -# itkConfig.ImportCallback = custom_callback +from __future__ import print_function -import itk, sys +import itk +import sys import ITKCommon import ITKBinaryMathematicalMorphology @@ -29,112 +27,109 @@ import ITKSmoothing import ITKDistanceMap import ITKImageIntensity -import ITKIOImageBase import ITKThresholding import ITKImageGrid -PType = itk.UC -dim = 2 -IType = itk.Image[PType, dim] +inputImage = sys.argv[1] +radiusValue = int(sys.argv[2]) -kernel = itk.strel(2, 1) +PixelType = itk.UC +Dimension = 2 +ImageType = itk.Image[PixelType, Dimension] + +StructuringElementType = itk.FlatStructuringElement[Dimension] +radius = (radiusValue, radiusValue) +structuringElement = StructuringElementType.Ball(radius) # create the reader -reader = itk.ImageFileReader[IType].New(FileName=sys.argv[1]) +reader = itk.ImageFileReader[ImageType].New(FileName=inputImage) sources = [] -image = ITKCommon.Image[PType, dim].New() -r = itk.ImageRegion._2() -r.SetSize((10, 10)) -image.SetRegions(r) +image = ITKCommon.Image[PixelType, Dimension].New() +region = itk.ImageRegion._2() +region.SetSize((10, 10)) +image.SetRegions(region) image.Allocate() sources.append(("ITKCommon", image)) sources.append(("ITKIOImageBase", reader.GetOutput())) -otsu = ITKThresholding.OtsuThresholdImageFilter[IType, IType].New(reader) +OtsuType = ITKThresholding.OtsuThresholdImageFilter[ImageType, ImageType] +otsu = OtsuType.New(reader) sources.append(("ITKThresholding", otsu.GetOutput())) -flip = ITKImageGrid.FlipImageFilter[IType].New(reader) +flip = ITKImageGrid.FlipImageFilter[ImageType].New(reader) sources.append(("ITKImageGrid", flip.GetOutput())) -abs = ITKImageIntensity.AbsImageFilter[IType, IType].New(reader) -sources.append(("ITKImageIntensity", abs.GetOutput())) +absFilter = ITKImageIntensity.AbsImageFilter[ImageType, ImageType].New(reader) +sources.append(("ITKImageIntensity", absFilter.GetOutput())) +absFilter.InPlaceOff() + +BinaryDilateType = ITKBinaryMathematicalMorphology.BinaryDilateImageFilter[ + ImageType, ImageType, StructuringElementType] +binaryDilateFilter = BinaryDilateType.New() +binaryDilateFilter.SetInput(reader.GetOutput()) +binaryDilateFilter.SetKernel(structuringElement) -bdilate = ITKBinaryMathematicalMorphology.BinaryDilateImageFilter[IType, IType, kernel].New(reader, Kernel=kernel) -sources.append(("ITKBinaryMathematicalMorphology", bdilate.GetOutput())) +output = binaryDilateFilter.GetOutput() +sources.append(("ITKBinaryMathematicalMorphology", output)) -minmax = ITKImageStatistics.MinimumMaximumImageFilter[IType].New(reader) +minmax = ITKImageStatistics.MinimumMaximumImageFilter[ImageType].New(reader) sources.append(("ITKImageStatistics", minmax.GetOutput())) -median = ITKSmoothing.MedianImageFilter[IType, IType].New(reader) +median = ITKSmoothing.MedianImageFilter[ImageType, ImageType].New(reader) sources.append(("ITKSmoothing", median.GetOutput())) -distance = ITKDistanceMap.DanielssonDistanceMapImageFilter[IType, IType].New(reader) +distance = ITKDistanceMap.DanielssonDistanceMapImageFilter[ + ImageType, ImageType].New(reader) sources.append(("ITKDistanceMap", distance.GetOutput())) -# sobel = EdgesAndContours.SobelEdgeDetectionImageFilter[IType, IType].New(reader) -# sources.append(("EdgesAndContours", sobel.GetOutput())) - -# laplacian = Filtering.LaplacianImageFilter[IType, IType].New(reader) -# sources.append(("Filtering", laplacian.GetOutput())) - - - - - - dests = [] -dotsu = ITKThresholding.OtsuThresholdImageFilter[IType, IType].New(reader) +dotsu = OtsuType.New() dests.append(("ITKThresholding", dotsu)) -dflip = ITKImageGrid.FlipImageFilter[IType].New() +dflip = ITKImageGrid.FlipImageFilter[ImageType].New() dests.append(("ITKImageGrid", dflip)) -dabs = ITKImageIntensity.AbsImageFilter[IType, IType].New() +dabs = ITKImageIntensity.AbsImageFilter[ImageType, ImageType].New() dests.append(("ITKImageIntensity", dabs)) -dbdilate = ITKBinaryMathematicalMorphology.BinaryDilateImageFilter[IType, IType, kernel].New(Kernel=kernel) -dests.append(("ITKBinaryMathematicalMorphology", dbdilate)) +dbinaryDilateFilter = BinaryDilateType.New() +dbinaryDilateFilter.SetKernel(structuringElement) +dests.append(("ITKBinaryMathematicalMorphology", dbinaryDilateFilter)) -dminmax = ITKImageStatistics.MinimumMaximumImageFilter[IType].New() +dminmax = ITKImageStatistics.MinimumMaximumImageFilter[ImageType].New() dests.append(("ITKImageStatistics", dminmax)) -dmedian = ITKSmoothing.MedianImageFilter[IType, IType].New() +dmedian = ITKSmoothing.MedianImageFilter[ImageType, ImageType].New() dests.append(("ITKSmoothing", dmedian)) -ddistance = ITKDistanceMap.DanielssonDistanceMapImageFilter[IType, IType].New() +DistanceMapType = ITKDistanceMap.DanielssonDistanceMapImageFilter[ImageType, + ImageType] +ddistance = DistanceMapType.New() dests.append(("ITKDistanceMap", ddistance)) -# dsobel = EdgesAndContours.SobelEdgeDetectionImageFilter[IType, IType].New() -# dests.append(("EdgesAndContours", dsobel)) - -# dlaplacian = Filtering.LaplacianImageFilter[IType, IType].New() -# dests.append(("Filtering", dlaplacian)) - -writer = ITKIOImageBase.ImageFileWriter[IType].New(FileName='out.png') -dests.append(("ITKIOImageBase", writer)) - nb = 0 failList = [] -for sname, s in sources: - for dname, d in dests: - nb += 1 - d.SetInput( s ) - try: - d.Update() - print "%s -> %s pass" % (sname, dname) - except RuntimeError, e: - print "%s -> %s fail" % (sname, dname) - failList.append((sname, dname)) - - -print -print "%i tests succeed" % (nb - len(failList)) -print "%i tests failed" % len(failList) +for sourceName, source in sources: + for destinationName, destination in dests: + nb += 1 + destination.SetInput(source) + try: + destination.UpdateLargestPossibleRegion() + print("%s -> %s pass" % (sourceName, destinationName)) + except RuntimeError as e: + print("%s -> %s fail" % (sourceName, destinationName)) + print(e) + failList.append((sourceName, destinationName)) + + +print() +print("%i tests succeed" % (nb - len(failList))) +print("%i tests failed" % len(failList)) sys.exit(len(failList)) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/DicomSliceRead.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/DicomSliceRead.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/DicomSliceRead.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/DicomSliceRead.py 2014-09-03 08:29:34.000000000 +0000 @@ -34,17 +34,17 @@ dicomIO = itkDicomImageIO_New() -reader.SetImageIO( dicomIO.GetPointer() ) +reader.SetImageIO(dicomIO.GetPointer()) -filter = itkRescaleIntensityImageFilterUS2UC2_New() +filter = itkRescaleIntensityImageFilterUS2UC2_New() -filter.SetOutputMinimum( 0 ) +filter.SetOutputMinimum(0) filter.SetOutputMaximum(255) -filter.SetInput( reader.GetOutput() ) -writer.SetInput( filter.GetOutput() ) +filter.SetInput(reader.GetOutput()) +writer.SetInput(filter.GetOutput()) -reader.SetFileName( argv[1] ) -writer.SetFileName( argv[2] ) +reader.SetFileName(argv[1]) +writer.SetFileName(argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration3.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration3.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration3.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration3.py 2014-09-03 08:29:34.000000000 +0000 @@ -21,71 +21,69 @@ from sys import argv - # # Read the fixed and moving images using filenames # from the command line arguments # -fixedImageReader = itkImageFileReaderF2_New() +fixedImageReader = itkImageFileReaderF2_New() movingImageReader = itkImageFileReaderF2_New() -fixedImageReader.SetFileName( argv[1] ) -movingImageReader.SetFileName( argv[2] ) +fixedImageReader.SetFileName(argv[1]) +movingImageReader.SetFileName(argv[2]) fixedImageReader.Update() movingImageReader.Update() -fixedImage = fixedImageReader.GetOutput() +fixedImage = fixedImageReader.GetOutput() movingImage = movingImageReader.GetOutput() - - # # Instantiate the classes for the registration framework # registration = itkImageRegistrationMethodF2F2_New() -imageMetric = itkMeanSquaresImageToImageMetricF2F2_New() -transform = itkTranslationTransform2_New() -optimizer = itkRegularStepGradientDescentOptimizer_New() +imageMetric = itkMeanSquaresImageToImageMetricF2F2_New() +transform = itkTranslationTransform2_New() +optimizer = itkRegularStepGradientDescentOptimizer_New() interpolator = itkLinearInterpolateImageFunctionF2D_New() -registration.SetOptimizer( optimizer.GetPointer() ) -registration.SetTransform( transform.GetPointer() ) -registration.SetInterpolator( interpolator.GetPointer() ) -registration.SetMetric( imageMetric.GetPointer() ) -registration.SetFixedImage( fixedImage ) -registration.SetMovingImage( movingImage ) +registration.SetOptimizer(optimizer.GetPointer()) +registration.SetTransform(transform.GetPointer()) +registration.SetInterpolator(interpolator.GetPointer()) +registration.SetMetric(imageMetric.GetPointer()) +registration.SetFixedImage(fixedImage) +registration.SetMovingImage(movingImage) -registration.SetFixedImageRegion( fixedImage.GetBufferedRegion() ) +registration.SetFixedImageRegion(fixedImage.GetBufferedRegion()) transform.SetIdentity() initialParameters = transform.GetParameters() -registration.SetInitialTransformParameters( initialParameters ) +registration.SetInitialTransformParameters(initialParameters) # # Iteration Observer # + + def iterationUpdate(): currentParameter = transform.GetParameters() - print "M: %f P: %f %f " % ( optimizer.GetValue(), - currentParameter.GetElement(0), - currentParameter.GetElement(1) ) + print "M: %f P: %f %f " % (optimizer.GetValue(), + currentParameter.GetElement(0), + currentParameter.GetElement(1)) iterationCommand = itkPyCommand_New() -iterationCommand.SetCommandCallable( iterationUpdate ) -optimizer.AddObserver( itkIterationEvent(), iterationCommand.GetPointer() ) - +iterationCommand.SetCommandCallable(iterationUpdate) +optimizer.AddObserver(itkIterationEvent(), iterationCommand.GetPointer()) # # Define optimizer parameters # -optimizer.SetMaximumStepLength( 4.00 ) -optimizer.SetMinimumStepLength( 0.01 ) -optimizer.SetNumberOfIterations( 200 ) +optimizer.SetMaximumStepLength(4.00) +optimizer.SetMinimumStepLength(0.01) +optimizer.SetNumberOfIterations(200) print "Starting registration" @@ -107,27 +105,25 @@ print "Translation Y = %f" % (finalParameters.GetElement(1),) - - # # Now, we use the final transform for resampling the # moving image. # resampler = itkResampleImageFilterF2F2_New() -resampler.SetTransform( transform.GetPointer() ) -resampler.SetInput( movingImage ) +resampler.SetTransform(transform.GetPointer()) +resampler.SetInput(movingImage) region = fixedImage.GetLargestPossibleRegion() -resampler.SetSize( region.GetSize() ) +resampler.SetSize(region.GetSize()) -resampler.SetOutputSpacing( fixedImage.GetSpacing() ) -resampler.SetOutputOrigin( fixedImage.GetOrigin() ) -resampler.SetDefaultPixelValue( 100 ) +resampler.SetOutputSpacing(fixedImage.GetSpacing()) +resampler.SetOutputOrigin(fixedImage.GetOrigin()) +resampler.SetDefaultPixelValue(100) outputCast = itkRescaleIntensityImageFilterF2US2_New() -outputCast.SetOutputMinimum( 0 ) -outputCast.SetOutputMaximum( 65535 ) +outputCast.SetOutputMinimum(0) +outputCast.SetOutputMaximum(65535) outputCast.SetInput(resampler.GetOutput()) # @@ -135,6 +131,6 @@ # writer = itkImageFileWriterUS2_New() -writer.SetFileName( argv[3] ) -writer.SetInput( outputCast.GetOutput() ) +writer.SetFileName(argv[3]) +writer.SetInput(outputCast.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration4.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration4.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration4.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration4.py 2014-09-03 08:29:34.000000000 +0000 @@ -21,74 +21,72 @@ from sys import argv - # # Read the fixed and moving images using filenames # from the command line arguments # -fixedImageReader = itkImageFileReaderF2_New() +fixedImageReader = itkImageFileReaderF2_New() movingImageReader = itkImageFileReaderF2_New() -fixedImageReader.SetFileName( argv[1] ) -movingImageReader.SetFileName( argv[2] ) +fixedImageReader.SetFileName(argv[1]) +movingImageReader.SetFileName(argv[2]) fixedImageReader.Update() movingImageReader.Update() -fixedImage = fixedImageReader.GetOutput() +fixedImage = fixedImageReader.GetOutput() movingImage = movingImageReader.GetOutput() - - # # Instantiate the classes for the registration framework # registration = itkImageRegistrationMethodF2F2_New() -imageMetric = itkMattesMutualInformationImageToImageMetricF2F2_New() -transform = itkTranslationTransform2_New() -optimizer = itkRegularStepGradientDescentOptimizer_New() +imageMetric = itkMattesMutualInformationImageToImageMetricF2F2_New() +transform = itkTranslationTransform2_New() +optimizer = itkRegularStepGradientDescentOptimizer_New() interpolator = itkLinearInterpolateImageFunctionF2D_New() -imageMetric.SetNumberOfHistogramBins( 20 ); -imageMetric.SetNumberOfSpatialSamples( 10000 ); +imageMetric.SetNumberOfHistogramBins(20) +imageMetric.SetNumberOfSpatialSamples(10000) -registration.SetOptimizer( optimizer.GetPointer() ) -registration.SetTransform( transform.GetPointer() ) -registration.SetInterpolator( interpolator.GetPointer() ) -registration.SetMetric( imageMetric.GetPointer() ) -registration.SetFixedImage( fixedImage ) -registration.SetMovingImage( movingImage ) +registration.SetOptimizer(optimizer.GetPointer()) +registration.SetTransform(transform.GetPointer()) +registration.SetInterpolator(interpolator.GetPointer()) +registration.SetMetric(imageMetric.GetPointer()) +registration.SetFixedImage(fixedImage) +registration.SetMovingImage(movingImage) -registration.SetFixedImageRegion( fixedImage.GetBufferedRegion() ) +registration.SetFixedImageRegion(fixedImage.GetBufferedRegion()) transform.SetIdentity() initialParameters = transform.GetParameters() -registration.SetInitialTransformParameters( initialParameters ) +registration.SetInitialTransformParameters(initialParameters) # # Iteration Observer # + + def iterationUpdate(): currentParameter = transform.GetParameters() - print "M: %f P: %f %f " % ( optimizer.GetValue(), - currentParameter.GetElement(0), - currentParameter.GetElement(1) ) + print "M: %f P: %f %f " % (optimizer.GetValue(), + currentParameter.GetElement(0), + currentParameter.GetElement(1)) iterationCommand = itkPyCommand_New() -iterationCommand.SetCommandCallable( iterationUpdate ) -optimizer.AddObserver( itkIterationEvent(), iterationCommand.GetPointer() ) - +iterationCommand.SetCommandCallable(iterationUpdate) +optimizer.AddObserver(itkIterationEvent(), iterationCommand.GetPointer()) # # Define optimizer parameters # -optimizer.SetMaximumStepLength( 4.00 ) -optimizer.SetMinimumStepLength( 0.01 ) -optimizer.SetNumberOfIterations( 200 ) +optimizer.SetMaximumStepLength(4.00) +optimizer.SetMinimumStepLength(0.01) +optimizer.SetNumberOfIterations(200) print "Starting registration" @@ -110,27 +108,25 @@ print "Translation Y = %f" % (finalParameters.GetElement(1),) - - # # Now, we use the final transform for resampling the # moving image. # resampler = itkResampleImageFilterF2F2_New() -resampler.SetTransform( transform.GetPointer() ) -resampler.SetInput( movingImage ) +resampler.SetTransform(transform.GetPointer()) +resampler.SetInput(movingImage) region = fixedImage.GetLargestPossibleRegion() -resampler.SetSize( region.GetSize() ) +resampler.SetSize(region.GetSize()) -resampler.SetOutputSpacing( fixedImage.GetSpacing() ) -resampler.SetOutputOrigin( fixedImage.GetOrigin() ) -resampler.SetDefaultPixelValue( 100 ) +resampler.SetOutputSpacing(fixedImage.GetSpacing()) +resampler.SetOutputOrigin(fixedImage.GetOrigin()) +resampler.SetDefaultPixelValue(100) outputCast = itkRescaleIntensityImageFilterF2US2_New() -outputCast.SetOutputMinimum( 0 ) -outputCast.SetOutputMaximum( 65535 ) +outputCast.SetOutputMinimum(0) +outputCast.SetOutputMaximum(65535) outputCast.SetInput(resampler.GetOutput()) # @@ -138,6 +134,6 @@ # writer = itkImageFileWriterUS2_New() -writer.SetFileName( argv[3] ) -writer.SetInput( outputCast.GetOutput() ) +writer.SetFileName(argv[3]) +writer.SetInput(outputCast.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration5.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration5.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration5.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageRegistration5.py 2014-09-03 08:29:34.000000000 +0000 @@ -29,8 +29,8 @@ fixedImageReader = itkImageFileReaderF2_New() movingImageReader = itkImageFileReaderF2_New() -fixedImageReader.SetFileName( argv[1] ) -movingImageReader.SetFileName( argv[2] ) +fixedImageReader.SetFileName(argv[1]) +movingImageReader.SetFileName(argv[2]) fixedImageReader.Update() movingImageReader.Update() @@ -41,60 +41,68 @@ # # Instantiate the classes for the registration framework # -registration = itkImageRegistrationMethodF2F2_New() -imageMetric = itkMeanSquaresImageToImageMetricF2F2_New() -transform = itkCenteredRigid2DTransform_New() -optimizer = itkRegularStepGradientDescentOptimizer_New() -interpolator = itkLinearInterpolateImageFunctionF2D_New() - -registration.SetOptimizer( optimizer.GetPointer() ) -registration.SetTransform( transform.GetPointer() ) -registration.SetInterpolator( interpolator.GetPointer() ) -registration.SetMetric( imageMetric.GetPointer() ) -registration.SetFixedImage( fixedImage ) -registration.SetMovingImage( movingImage ) -registration.SetFixedImageRegion( fixedImage.GetBufferedRegion() ) +registration = itkImageRegistrationMethodF2F2_New() +imageMetric = itkMeanSquaresImageToImageMetricF2F2_New() +transform = itkCenteredRigid2DTransform_New() +optimizer = itkRegularStepGradientDescentOptimizer_New() +interpolator = itkLinearInterpolateImageFunctionF2D_New() + +registration.SetOptimizer(optimizer.GetPointer()) +registration.SetTransform(transform.GetPointer()) +registration.SetInterpolator(interpolator.GetPointer()) +registration.SetMetric(imageMetric.GetPointer()) +registration.SetFixedImage(fixedImage) +registration.SetMovingImage(movingImage) +registration.SetFixedImageRegion(fixedImage.GetBufferedRegion()) # # Initial transform parameters # -transform.SetAngle( 0.0 ); +transform.SetAngle(0.0) # center of the fixed image fixedSpacing = fixedImage.GetSpacing() fixedOrigin = fixedImage.GetOrigin() fixedSize = fixedImage.GetLargestPossibleRegion().GetSize() -centerFixed = ( fixedOrigin.GetElement(0) + fixedSpacing.GetElement(0) * fixedSize.GetElement(0) / 2.0, - fixedOrigin.GetElement(1) + fixedSpacing.GetElement(1) * fixedSize.GetElement(1) / 2.0 ) +centerFixed = ( + fixedOrigin.GetElement(0) + fixedSpacing.GetElement(0) * + fixedSize.GetElement(0) / 2.0, + fixedOrigin.GetElement(1) + fixedSpacing.GetElement(1) * + fixedSize.GetElement(1) / 2.0) # center of the moving image movingSpacing = movingImage.GetSpacing() movingOrigin = movingImage.GetOrigin() movingSize = movingImage.GetLargestPossibleRegion().GetSize() -centerMoving = ( movingOrigin.GetElement(0) + movingSpacing.GetElement(0) * movingSize.GetElement(0) / 2.0, - movingOrigin.GetElement(1) + movingSpacing.GetElement(1) * movingSize.GetElement(1) / 2.0 ) +centerMoving = ( + movingOrigin.GetElement(0) + movingSpacing.GetElement(0) * + movingSize.GetElement(0) / 2.0, + movingOrigin.GetElement(1) + movingSpacing.GetElement(1) * + movingSize.GetElement(1) / 2.0) # transform center center = transform.GetCenter() -center.SetElement( 0, centerFixed[0] ) -center.SetElement( 1, centerFixed[1] ) +center.SetElement(0, centerFixed[0]) +center.SetElement(1, centerFixed[1]) # transform translation translation = transform.GetTranslation() -translation.SetElement( 0, centerMoving[0] - centerFixed[0] ) -translation.SetElement( 1, centerMoving[1] - centerFixed[1] ) +translation.SetElement(0, centerMoving[0] - centerFixed[0]) +translation.SetElement(1, centerMoving[1] - centerFixed[1]) initialParameters = transform.GetParameters() print "Initial Parameters: " print "Angle: %f" % (initialParameters.GetElement(0), ) -print "Center: %f, %f" % ( initialParameters.GetElement(1), initialParameters.GetElement(2) ) -print "Translation: %f, %f" % (initialParameters.GetElement(3), initialParameters.GetElement(4)) +print "Center: %f, %f" % (initialParameters.GetElement(1), + initialParameters.GetElement(2)) +print "Translation: %f, %f" % (initialParameters.GetElement(3), + initialParameters.GetElement(4)) -registration.SetInitialTransformParameters( initialParameters ) +registration.SetInitialTransformParameters(initialParameters) # # Define optimizer parameters @@ -103,33 +111,35 @@ # optimizer scale translationScale = 1.0 / 1000.0 -optimizerScales = itkArrayD( transform.GetNumberOfParameters() ) +optimizerScales = itkArrayD(transform.GetNumberOfParameters()) optimizerScales.SetElement(0, 1.0) optimizerScales.SetElement(1, translationScale) optimizerScales.SetElement(2, translationScale) optimizerScales.SetElement(3, translationScale) optimizerScales.SetElement(4, translationScale) -optimizer.SetScales( optimizerScales ) -optimizer.SetMaximumStepLength( 0.1 ) -optimizer.SetMinimumStepLength( 0.001 ) -optimizer.SetNumberOfIterations( 200 ) +optimizer.SetScales(optimizerScales) +optimizer.SetMaximumStepLength(0.1) +optimizer.SetMinimumStepLength(0.001) +optimizer.SetNumberOfIterations(200) # # Iteration Observer # + + def iterationUpdate(): currentParameter = transform.GetParameters() - print "M: %f P: %f %f %f %f %f " % ( optimizer.GetValue(), - currentParameter.GetElement(0), - currentParameter.GetElement(1), - currentParameter.GetElement(2), - currentParameter.GetElement(3), - currentParameter.GetElement(4) ) + print "M: %f P: %f %f %f %f %f " % (optimizer.GetValue(), + currentParameter.GetElement(0), + currentParameter.GetElement(1), + currentParameter.GetElement(2), + currentParameter.GetElement(3), + currentParameter.GetElement(4)) iterationCommand = itkPyCommand_New() -iterationCommand.SetCommandCallable( iterationUpdate ) -optimizer.AddObserver( itkIterationEvent(), iterationCommand.GetPointer() ) +iterationCommand.SetCommandCallable(iterationUpdate) +optimizer.AddObserver(itkIterationEvent(), iterationCommand.GetPointer()) print "Starting registration" @@ -154,26 +164,26 @@ # Now, we use the final transform for resampling the moving image. resampler = itkResampleImageFilterF2F2_New() -resampler.SetTransform( transform.GetPointer() ) -resampler.SetInput( movingImage ) +resampler.SetTransform(transform.GetPointer()) +resampler.SetInput(movingImage) region = fixedImage.GetLargestPossibleRegion() -resampler.SetSize( region.GetSize() ) -resampler.SetOutputSpacing( fixedImage.GetSpacing() ) -resampler.SetOutputOrigin( fixedImage.GetOrigin() ) -resampler.SetDefaultPixelValue( 100 ) +resampler.SetSize(region.GetSize()) +resampler.SetOutputSpacing(fixedImage.GetSpacing()) +resampler.SetOutputOrigin(fixedImage.GetOrigin()) +resampler.SetDefaultPixelValue(100) # # Cast for output # outputCast = itkRescaleIntensityImageFilterF2US2_New() -outputCast.SetInput( resampler.GetOutput() ) -outputCast.SetOutputMinimum( 0 ) -outputCast.SetOutputMaximum( 65535 ) +outputCast.SetInput(resampler.GetOutput()) +outputCast.SetOutputMinimum(0) +outputCast.SetOutputMaximum(65535) writer = itkImageFileWriterUS2_New() -writer.SetFileName( argv[3] ) -writer.SetInput( outputCast.GetOutput() ) +writer.SetFileName(argv[3]) +writer.SetInput(outputCast.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageToArray.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageToArray.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageToArray.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/ImageToArray.py 2014-09-03 08:29:34.000000000 +0000 @@ -24,20 +24,20 @@ connector = itkPyBufferUC2_New() -reader.SetFileName( argv[1] ) +reader.SetFileName(argv[1]) reader.Update() print "ready to convert image into array" -buffer = connector.GetArrayFromImage( reader.GetOutput() ) +buffer = connector.GetArrayFromImage(reader.GetOutput()) writer = itkImageFileWriterUC2_New() -writer.SetFileName( argv[2] ) +writer.SetFileName(argv[2]) print "ready to convert array into image" -writer.SetInput( connector.GetImageFromArray( buffer ) ) +writer.SetInput(connector.GetImageFromArray(buffer)) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/itkCurvatureFlowTestPython2.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/itkCurvatureFlowTestPython2.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/itkCurvatureFlowTestPython2.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/itkCurvatureFlowTestPython2.py 2014-09-03 08:29:34.000000000 +0000 @@ -17,95 +17,112 @@ #==========================================================================*/ from InsightToolkit import * -import itktesting +import itkTesting import sys import os import shutil -basename = os.path.basename( sys.argv[0] ) -name = os.path.splitext( basename )[0] -dir = "Algorithms" +basename = os.path.basename(sys.argv[0]) +name = os.path.splitext(basename)[0] +dir = "Algorithms" -testInput = itktesting.ITK_TEST_INPUT -testOutput = itktesting.ITK_TEST_OUTPUT -baseLine = itktesting.ITK_TEST_BASELINE +testInput = itkTesting.ITK_TEST_INPUT +testOutput = itkTesting.ITK_TEST_OUTPUT +baseLine = itkTesting.ITK_TEST_BASELINE reader = itkImageFileReaderF2_New() -reader.SetFileName( testInput+"/cthead1.png") +reader.SetFileName(testInput + "/cthead1.png") -cf = itkCurvatureFlowImageFilterF2F2_New() -cf.SetInput( reader.GetOutput() ) -cf.SetTimeStep( 0.25 ) -cf.SetNumberOfIterations( 10 ) +cf = itkCurvatureFlowImageFilterF2F2_New() +cf.SetInput(reader.GetOutput()) +cf.SetTimeStep(0.25) +cf.SetNumberOfIterations(10) -cfss = itkShiftScaleImageFilterF2US2_New() -cfss.SetInput( cf.GetOutput() ) -cfss.SetShift( 0.7 ) -cfss.SetScale( 0.9 ) +cfss = itkShiftScaleImageFilterF2US2_New() +cfss.SetInput(cf.GetOutput()) +cfss.SetShift(0.7) +cfss.SetScale(0.9) -valid = itkImageFileReaderUS2_New() -valid.SetFileName( baseLine+"/"+dir+"/"+name+".png") +valid = itkImageFileReaderUS2_New() +valid.SetFileName(baseLine + "/" + dir + "/" + name + ".png") -diff = itkDifferenceImageFilterUS2_New() -diff.SetValidInput( valid.GetOutput() ) -diff.SetTestInput( cfss.GetOutput() ) -diff.SetToleranceRadius( 1 ) -diff.SetDifferenceThreshold( 0 ) +diff = itkDifferenceImageFilterUS2_New() +diff.SetValidInput(valid.GetOutput()) +diff.SetTestInput(cfss.GetOutput()) +diff.SetToleranceRadius(1) +diff.SetDifferenceThreshold(0) diff.Update() -meanDiff = diff.GetMeanDifference() +meanDiff = diff.GetMeanDifference() totalDiff = diff.GetTotalDifference() -print "MeanDifference = ", meanDiff -print "TotalDifference = ", totalDiff +print("MeanDifference = ", meanDiff) +print("TotalDifference = ", totalDiff) -print "",meanDiff,"" -print "",totalDiff,"" - -if ( meanDiff > 0.1 ) : - convert = itkCastImageFilterUS2UC2_New() - rescale = itkRescaleIntensityImageFilterUS2UC2_New() - rescale.SetInput( diff.GetOutput() ) - rescale.SetOutputMinimum( 0 ) - rescale.SetOutputMaximum( 255 ) - - io = itkPNGImageIO_New() - io.SetUseCompression( 1 ) - io.SetCompressionLevel( 9 ) - - writer = itkImageFileWriterUC2_New() - writer.SetImageIO( io.GetPointer() ) - writer.SetInput( convert.GetOutput() ) - - writer.SetFileName( testOutput+"/"+name+".test.png" ) - convert.SetInput( cfss.GetOutput() ) - writer.Write() - - writer.SetFileName( testOutput+"/"+name+".diff.png" ) - writer.SetInput( rescale.GetOutput() ) - writer.Write() - - shutil.copyfile( baseLine+"/"+dir+"/"+name+".png", testOutput+"/"+name+".valid.png" ) - - print ""+testOutput+"/"+name+".test.png" - print ""+testOutput+"/"+name+".diff.png" - print ""+testOutput+"/"+name+".valid.png" - print "",rescale.GetShift(),"" - print "",rescale.GetScale(),"" +print ("", + meanDiff, "") +print ("", + totalDiff, "") + +if (meanDiff > 0.1): + convert = itkCastImageFilterUS2UC2_New() + rescale = itkRescaleIntensityImageFilterUS2UC2_New() + rescale.SetInput(diff.GetOutput()) + rescale.SetOutputMinimum(0) + rescale.SetOutputMaximum(255) + + io = itkPNGImageIO_New() + io.SetUseCompression(1) + io.SetCompressionLevel(9) + + writer = itkImageFileWriterUC2_New() + writer.SetImageIO(io.GetPointer()) + writer.SetInput(convert.GetOutput()) + + writer.SetFileName(testOutput + "/" + name + ".test.png") + convert.SetInput(cfss.GetOutput()) + writer.Write() + + writer.SetFileName(testOutput + "/" + name + ".diff.png") + writer.SetInput(rescale.GetOutput()) + writer.Write() + + shutil.copyfile( + baseLine + + "/" + + dir + + "/" + + name + + ".png", + testOutput + + "/" + + name + + ".valid.png") + + print ("" + + testOutput + "/" + name + ".test.png") + print ("" + + testOutput + "/" + name + ".diff.png") + print ("" + + testOutput + "/" + name + ".valid.png") + pr = "" + print (pr, rescale.GetShift(), "") + pr = "" + print (pr, rescale.GetScale(), "") # return 1 -#return 0 +# return 0 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/VoronoiSegmentation.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/VoronoiSegmentation.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/VoronoiSegmentation.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/notYetUsable/VoronoiSegmentation.py 2014-09-03 08:29:34.000000000 +0000 @@ -28,22 +28,22 @@ readerInput = itkImageFileReaderUC2_New() readerPrior = itkImageFileReaderUC2_New() -readerInput.SetFileName( argv[1] ) -readerPrior.SetFileName( argv[2] ) +readerInput.SetFileName(argv[1]) +readerPrior.SetFileName(argv[2]) readerInput.Update() readerPrior.Update() -filter = itkVoronoiSegmentationImageFilterUC2UC2UC2_New() +filter = itkVoronoiSegmentationImageFilterUC2UC2UC2_New() -filter.SetInput( readerInput.GetOutput() ) -filter.TakeAPrior( readerPrior.GetOutput() ) +filter.SetInput(readerInput.GetOutput()) +filter.TakeAPrior(readerPrior.GetOutput()) -filter.SetMeanPercentError( eval( argv[4] ) ) -filter.SetSTDPercentError( eval( argv[5] ) ) +filter.SetMeanPercentError(eval(argv[4])) +filter.SetSTDPercentError(eval(argv[5])) writer = itkImageFileWriterUC2_New() -writer.SetFileName( argv[3] ) -writer.SetInput( filter.GetOutput() ) +writer.SetFileName(argv[3]) +writer.SetInput(filter.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/OldStyleBinaryDilateImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/OldStyleBinaryDilateImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/OldStyleBinaryDilateImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/OldStyleBinaryDilateImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,3 +1,21 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + # # Example on the use of the BinaryDilateImageFilter # @@ -6,14 +24,14 @@ from sys import argv reader = itkImageFileReaderIUC2.New() -reader.SetFileName( argv[1] ) -kernel = itkFlatStructuringElement2.Ball( 5 ) -filter = itkBinaryDilateImageFilterIUC2IUC2SE2.New() -filter.SetInput( reader.GetOutput() ) -filter.SetDilateValue( 200 ) -filter.SetKernel( kernel ) +reader.SetFileName(argv[1]) +kernel = itkFlatStructuringElement2.Ball(5) +filter = itkBinaryDilateImageFilterIUC2IUC2SE2.New() +filter.SetInput(reader.GetOutput()) +filter.SetDilateValue(200) +filter.SetKernel(kernel) writer = itkImageFileWriterIUC2.New() writer.SetInput(filter.GetOutput()) -writer.SetFileName( argv[2] ) +writer.SetFileName(argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/pythonTestDriver.py.in otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/pythonTestDriver.py.in --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/pythonTestDriver.py.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/pythonTestDriver.py.in 2014-09-03 08:29:34.000000000 +0000 @@ -2,6 +2,8 @@ # set environment variables +from __future__ import print_function + import os, subprocess, sys from optparse import OptionParser @@ -57,7 +59,7 @@ command = ["@PYTHON_EXECUTABLE@"] + args if options.verbose: - print >> sys.stderr, "+", " ".join(command) + print(sys.stderr, "+", " ".join(command)) returnValue = subprocess.call( command ) if returnValue != 0 : sys.exit( returnValue ) @@ -66,7 +68,7 @@ for imageFile1, imageFile2 in options.compare : command = ["@IMAGE_COMPARE@", imageFile1, imageFile2] if options.verbose: - print >> sys.stderr, "+", " ".join(command) + print(sys.stderr, "+", " ".join(command)) returnValue = subprocess.call( command ) if returnValue != 0 : sys.exit( returnValue ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ReadDicomAndReadTag.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ReadDicomAndReadTag.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ReadDicomAndReadTag.py 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ReadDicomAndReadTag.py 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,68 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + +# Tests: +# - Reading dicom files from a directory +# - Read a tag (patient's name) through the MetaDataDictionary +# - Read a tag (patient's name) directly with the GetValueFromTag() method +# - Compare the two tags if they are the same + +from __future__ import print_function + +import itk +import sys + +imdir = sys.argv[1] +image_t = itk.Image[itk.F, 3] + +# Set up reader +reader = itk.ImageSeriesReader[image_t].New() +dicomIO = itk.GDCMImageIO.New() +dicomFN = itk.GDCMSeriesFileNames.New() +reader.SetImageIO(dicomIO) + +# Get file names +dicomFN.SetUseSeriesDetails(True) +dicomFN.SetDirectory(imdir) + +# Get the first image series +uids = dicomFN.GetSeriesUIDs() +fnames = dicomFN.GetFileNames(uids[0]) + +# Read in the files +reader.SetFileNames(fnames) +reader.Update() +image = reader.GetOutput() + +# Now access the meta data dictionary +metad = dicomIO.GetMetaDataDictionary() + +# Get the patient's name +name1 = metad["0010|0010"] + +# Other way to get the tag +# GetValueFromTag(tagkey, tagvalue) +# tagvalue is an empty string, in C++ it is passed by +# reference. Here we pass an empty string, and the +# actual value is returned as the second variable. +found, name2 = dicomIO.GetValueFromTag("0010|0010", "") +assert(name1 == name2) + +# Check also if we returned the right tag +found, name3 = dicomIO.GetLabelFromTag("0010|0010", "") +assert(name3 == "Patient's Name") diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ResampleImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ResampleImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ResampleImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ResampleImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -33,89 +33,91 @@ # OUTPUTS: {ResampleImageFilterOutput4.png} # 3 +from __future__ import print_function + import itk from sys import argv, stderr, exit itk.auto_progress(2) -if( len(argv) < 3 ): - print >> stderr, """Missing Parameters -Usage: ResampleImageFilter.py inputImageFile outputImageFile [exampleAction={0,1,2,3}]""" - exit(1) +if(len(argv) < 3): + print(( + "Missing Parameters \n Usage: ResampleImageFilter.py inputImageFile " + "outputImageFile [exampleAction={0,1,2,3}]"), file=stderr) + exit(1) exampleAction = 0 -if( len(argv) >= 4 ): - exampleAction = int( argv[3] ) +if(len(argv) >= 4): + exampleAction = int(argv[3]) Dimension = 2 InputPixelType = itk.UC OutputPixelType = itk.UC -InputImageType = itk.Image[ InputPixelType, Dimension ] -OutputImageType = itk.Image[ OutputPixelType, Dimension ] +InputImageType = itk.Image[InputPixelType, Dimension] +OutputImageType = itk.Image[OutputPixelType, Dimension] -ReaderType = itk.ImageFileReader[ InputImageType ] -CastType = itk.CastImageFilter[ InputImageType, OutputImageType ] -WriterType = itk.ImageFileWriter[ OutputImageType ] +ReaderType = itk.ImageFileReader[InputImageType] +CastType = itk.CastImageFilter[InputImageType, OutputImageType] +WriterType = itk.ImageFileWriter[OutputImageType] reader = ReaderType.New() cast = CastType.New() writer = WriterType.New() -reader.SetFileName( argv[1] ) -writer.SetFileName( argv[2] ) +reader.SetFileName(argv[1]) +writer.SetFileName(argv[2]) -FilterType = itk.ResampleImageFilter[InputImageType,InputImageType] +FilterType = itk.ResampleImageFilter[InputImageType, InputImageType] filter = FilterType.New() -TransformType = itk.AffineTransform[ itk.D, Dimension ] +TransformType = itk.AffineTransform[itk.D, Dimension] transform = TransformType.New() -filter.SetTransform( transform ) +filter.SetTransform(transform) InterpolatorType = itk.NearestNeighborInterpolateImageFunction[ - InputImageType, itk.D ] + InputImageType, itk.D] interpolator = InterpolatorType.New() -filter.SetInterpolator( interpolator ) +filter.SetInterpolator(interpolator) -filter.SetDefaultPixelValue( 0 ) +filter.SetDefaultPixelValue(0) # spacing = itk.Vector[itk.D, Dimension]() # spacing.SetElement(0, 1.0) # spacing.SetElement(1, 1.0) # filter.SetOutputSpacing( spacing ) -filter.SetOutputSpacing( 1.0 ) +filter.SetOutputSpacing(1.0) # origin = itk.Point[itk.D, Dimension]() # origin.SetElement(0, 0.0) # origin.SetElement(1, 0.0) # filter.SetOutputOrigin( origin ) -filter.SetOutputOrigin( [0.0, 0.0] ) +filter.SetOutputOrigin([0.0, 0.0]) # size = itk.Size[Dimension]() # size.SetElement(0, 300) # size.SetElement(1, 300) # filter.SetSize( size ) -filter.SetSize( 300 ) +filter.SetSize(300) -filter.SetInput( reader.GetOutput() ) -cast.SetInput( filter.GetOutput() ) -writer.SetInput( cast.GetOutput() ) +filter.SetInput(reader.GetOutput()) +cast.SetInput(filter.GetOutput()) +writer.SetInput(cast.GetOutput()) writer.Update() # translation = itk.Vector[itk.D, Dimension]() # translation.SetElement(0, -30) # translation.SetElement(1, -50) # transform.Translate( translation, 0 ) -transform.Translate( [-30, -50], 0 ) - -if( exampleAction == 1 ): - writer.Update() +transform.Translate([-30, -50], False) +if(exampleAction == 1): + writer.Update() -filter.SetDefaultPixelValue( 100 ) +filter.SetDefaultPixelValue(100) -if( exampleAction == 2 ): - writer.Update() +if(exampleAction == 2): + writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/returnedTypeCoverage.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/returnedTypeCoverage.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/returnedTypeCoverage.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/returnedTypeCoverage.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,7 +16,11 @@ # #==========================================================================*/ -import itk, re, sys +from __future__ import print_function + +import itk +import re +import sys try: import itkvtk except: @@ -26,241 +30,264 @@ ctypes = [ - 'double', - 'float', - 'signed_char', - 'signed_short', - 'signed_long', - 'unsigned_char', - 'unsigned_short', - 'unsigned_long', - 'char', - 'short', - 'long', - 'bool', - 'int', - 'unsigned_int', - 'void' + 'double', + 'float', + 'signed_char', + 'signed_short', + 'signed_long', + 'unsigned_char', + 'unsigned_short', + 'unsigned_long', + 'char', + 'short', + 'long', + 'bool', + 'int', + 'unsigned_int', + 'void' ] excludedMethodsList = [ - 'Delete', - 'Unregister', - 'SetReferenceCount', - - # the method broken for all filters - 'PushBackInput', - 'PushFrontInput', - 'GraftOutput', - 'SetInput', - 'UpdateOutputData', - 'PropagateRequestedRegion', - 'EnlargeOutputRequestedRegion', - - # functor are not wrapped so exclude GetFunctor - 'GetFunctor', - - #'UnCreateAllInstanceRegister', - #'Update', - #'UpdateLargestPossibleRegion', - #'GenerateInputRequestedRegion', - #'GenerateOutputInformation', - #'GenerateData', - #'GetImageIO', - #'UpdateOutputData', - #'UpdateOutputInformation', - #'GraftOutput', - #'AddSeed', - #'GetInputs', - #'GetOutputs', - #'CreateAllInstance' + 'Delete', + 'Unregister', + 'SetReferenceCount', + + # the method broken for all filters + 'PushBackInput', + 'PushFrontInput', + 'GraftOutput', + 'SetInput', + 'UpdateOutputData', + 'PropagateRequestedRegion', + 'EnlargeOutputRequestedRegion', + + # functor are not wrapped so exclude GetFunctor + 'GetFunctor', + + #'UnCreateAllInstanceRegister', + #'Update', + #'UpdateLargestPossibleRegion', + #'GenerateInputRequestedRegion', + #'GenerateOutputInformation', + #'GenerateData', + #'GetImageIO', + #'UpdateOutputData', + #'UpdateOutputInformation', + #'GraftOutput', + #'AddSeed', + #'GetInputs', + #'GetOutputs', + #'CreateAllInstance' ] excludedMethodsWithParamList = [ - #'GetElement', - #'RegisterFactory', - #'UnRegisterFactory', - #'PropagateRequestedRegion', - #'Resize', - #'PadByRadius' + #'GetElement', + #'RegisterFactory', + #'UnRegisterFactory', + #'PropagateRequestedRegion', + #'Resize', + #'PadByRadius' ] excludedClasses = [ - #'BinaryBallStructuringElement', - #'Neighborhood', - #'BSplineDecompositionImageFilter', - #'AtanImageFilter', - #'Atan2ImageFilter', - #'ChangeInformationImageFilter', - #'GeodesicActiveContourLevelSetImageFilter', - #'Image', - #'ImageBase', - #'ImageFileReader', - #'ImageFileWriter', - #'ImageRegistrationMethod', - #'BSplineDownsampleImageFilter', - #'BSplineUpsampleImageFilter', - #'CropImageFilter', - #'LevelSetFunction', - #'MattesMutualInformationImageToImageMetric', - #'MeanReciprocalSquareDifferenceImageToImageMetric', - #'MeanSquaresImageToImageMetric', - #'MultiResolutionImageRegistrationMethod', - #'MultiResolutionPyramidImageFilter', - #'MutualInformationImageToImageMetric', - #'NormalizedCorrelationImageToImageMetric', - #'ParallelSparseFieldLevelSetImageFilter', - #'PyBuffer', - #'RawImageIO', - #'RecursiveMultiResolutionPyramidImageFilter', - #'ResampleImageFilter', - #'RescaleIntensityImageFilter', - #'SegmentationLevelSetImageFilter', - #'ShapeDetectionLevelSetImageFilter', - #'SparseFieldFourthOrderLevelSetImageFilter', - #'SparseFieldLevelSetImageFilter', - #'SpatialObject', - #'SpatialObjectTreeNode', - #'WatershedImageFilter', - #'TreeNode', - #'ThresholdSegmentationLevelSetImageFilter', - #'PointSet', - #'ImageConstIterator', - #'ImageConstIteratorWithIndex', - #'ImageIterator', - #'ImageIteratorWithIndex', - #'ImageLinearConstIteratorWithIndex', - #'ImageLinearIteratorWithIndex', - #'ImageRandomConstIteratorWithIndex', - #'ImageRandomIteratorWithIndex', - #'ImageRandomNonRepeatingConstIteratorWithIndex', - #'ImageRandomNonRepeatingIteratorWithIndex', - #'ImageRegionConstIterator', - #'ImageRegionIterator', - #'ImageRegionConstIteratorWithIndex', - #'ImageRegionIteratorWithIndex', - #'InterpolateImageFilter', - #'IsolatedConnectedImageFilter', - 'SmartPointer', - 'BMPImageIO', + #'BinaryBallStructuringElement', + #'Neighborhood', + #'BSplineDecompositionImageFilter', + #'AtanImageFilter', + #'Atan2ImageFilter', + #'ChangeInformationImageFilter', + #'GeodesicActiveContourLevelSetImageFilter', + #'Image', + #'ImageBase', + #'ImageFileReader', + #'ImageFileWriter', + #'ImageRegistrationMethod', + #'BSplineDownsampleImageFilter', + #'BSplineUpsampleImageFilter', + #'CropImageFilter', + #'LevelSetFunction', + #'MattesMutualInformationImageToImageMetric', + #'MeanReciprocalSquareDifferenceImageToImageMetric', + #'MeanSquaresImageToImageMetric', + #'MultiResolutionImageRegistrationMethod', + #'MultiResolutionPyramidImageFilter', + #'MutualInformationImageToImageMetric', + #'NormalizedCorrelationImageToImageMetric', + #'ParallelSparseFieldLevelSetImageFilter', + #'PyBuffer', + #'RawImageIO', + #'RecursiveMultiResolutionPyramidImageFilter', + #'ResampleImageFilter', + #'RescaleIntensityImageFilter', + #'SegmentationLevelSetImageFilter', + #'ShapeDetectionLevelSetImageFilter', + #'SparseFieldFourthOrderLevelSetImageFilter', + #'SparseFieldLevelSetImageFilter', + #'SpatialObject', + #'SpatialObjectTreeNode', + #'WatershedImageFilter', + #'TreeNode', + #'ThresholdSegmentationLevelSetImageFilter', + #'PointSet', + #'ImageConstIterator', + #'ImageConstIteratorWithIndex', + #'ImageIterator', + #'ImageIteratorWithIndex', + #'ImageLinearConstIteratorWithIndex', + #'ImageLinearIteratorWithIndex', + #'ImageRandomConstIteratorWithIndex', + #'ImageRandomIteratorWithIndex', + #'ImageRandomNonRepeatingConstIteratorWithIndex', + #'ImageRandomNonRepeatingIteratorWithIndex', + #'ImageRegionConstIterator', + #'ImageRegionIterator', + #'ImageRegionConstIteratorWithIndex', + #'ImageRegionIteratorWithIndex', + #'InterpolateImageFilter', + #'IsolatedConnectedImageFilter', + 'SmartPointer', + 'BMPImageIO', ] + def log(s, level): - if level <= options.verbose: - print >> logFile, s - logFile.flush() + if level <= options.verbose: + print(logFile, s) + logFile.flush() def cleanType(s): - i = s.index('_', 1) - return s[i+1:] + i = s.index('_', 1) + return s[i + 1:] def addUnwrappedType(s): - s = cleanType(s) - if not s in unwrappedTypes: - unwrappedTypes.add(s) - log(s, 0) + s = cleanType(s) + if not s in unwrappedTypes: + unwrappedTypes.add(s) + log(s, 0) def exploreTpl(tpl): for cl in tpl.itervalues(): exploreMethods(cl, cl) # try to instanciate the class - try : + try: obj = cl.New() exploreMethods(obj, cl) except: pass - try : + try: exploreMethods(cl(), cl) except: pass + def exploreMethods(obj, cl): - attrNameList = [i for i in dir(obj) if isinstance(i, str) and i[0].isupper() and i not in excludedMethodsList] - attrNameList.sort() + isin = isinstance(i, str) + ls = excludedMethodsList + attrNameList = sorted( + [i for i in dir(obj) if isin and i[0].isupper() and i not in ls]) for attrName in attrNameList: log(" + " + attrName, 2) - try : + try: parameters = repr((cl.__name__, attrName)) - if parameters not in exclude : - log(parameters, 4) - exec "s = obj.%s()" % attrName - if isUnwrappedTypeString(s): - addUnwrappedType(s) - log(" - " + cleanType(s), 5) - except : + if parameters not in exclude: + log(parameters, 4) + exec "s = obj.%s()" % attrName + if isUnwrappedTypeString(s): + addUnwrappedType(s) + log(" - " + cleanType(s), 5) + except: # try with some parameters - if attrName not in excludedMethodsWithParamList : - for param in [0, '', False, None] : - parameters = repr((cl.__name__, attrName, param)) - if parameters not in exclude : - log(' * ' + repr(param), 3) - log(parameters, 4) - try : - exec "s = obj.%s(param)" % attrName - if isUnwrappedTypeString(s): - addUnwrappedType(s) - log(" - " + cleanType(s), 5) - except : - pass + if attrName not in excludedMethodsWithParamList: + for param in [0, '', False, None]: + parameters = repr((cl.__name__, attrName, param)) + if parameters not in exclude: + log(' * ' + repr(param), 3) + log(parameters, 4) + try: + exec "s = obj.%s(param)" % attrName + if isUnwrappedTypeString(s): + addUnwrappedType(s) + log(" - " + cleanType(s), 5) + except: + pass + def isUnwrappedTypeString(s): if not isinstance(s, str): return False if not s[0] == "_": return False - for t in ctypes : - if re.match('^_[0-9a-z]+_p_%s$' % t, s) : + for t in ctypes: + if re.match('^_[0-9a-z]+_p_%s$' % t, s): return False return True - - parser = OptionParser(usage="usage: %prog") -parser.add_option("--exclude", dest="exclude", default=None, metavar="FILE", help="") -parser.add_option("--log-file", dest="logFile", default="-", metavar="FILE", help="") -parser.add_option("--start-from", dest="startFrom", default=None, metavar="CLASS", help="") -parser.add_option("-v", "--verbose", dest="verbose", default=0, type="int", help="") +parser.add_option( + "--exclude", + dest="exclude", + default=None, + metavar="FILE", + help="") +parser.add_option( + "--log-file", + dest="logFile", + default="-", + metavar="FILE", + help="") +parser.add_option( + "--start-from", + dest="startFrom", + default=None, + metavar="CLASS", + help="") +parser.add_option( + "-v", + "--verbose", + dest="verbose", + default=0, + type="int", + help="") (options, args) = parser.parse_args() if options.logFile == "-": - logFile = sys.stdout + logFile = sys.stdout else: - logFile = file(options.logFile, "w") + logFile = file(options.logFile, "w") exclude = set() -if options.exclude : - exclude = set(file(options.exclude).read().splitlines()) - - +if options.exclude: + exclude = set(file(options.exclude).read().splitlines()) -attrNameList = sorted(set([i for i in dir(itk) if i[0].isupper() and len(i) > 2]) - set(excludedClasses)) +val = [i for i in dir(itk) if i[0].isupper() and len(i) > 2] +attrNameList = sorted(set(val) - set(excludedClasses)) -if options.startFrom : +if options.startFrom: attrNameList = attrNameList[attrNameList.index(options.startFrom):] unwrappedTypes = set() for name in attrNameList: - exec "attr = itk."+name + exec "attr = itk." + name # attr = itk.__dict__[name] log(name, 1) - if isinstance(attr, itkTemplate) : + if isinstance(attr, itkTemplate): exploreTpl(attr) - else : + else: exploreMethods(attr, attr) - try : + try: exploreMethods(attr.New(), attr) except: pass - try : + try: exploreMethods(attr(), attr) except: pass diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SigmoidImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SigmoidImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SigmoidImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SigmoidImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -27,13 +27,13 @@ dim = 2 IType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.SigmoidImageFilter[IType, IType].New( reader, - OutputMinimum=eval( argv[3] ), - OutputMaximum=eval( argv[4] ), - Alpha=eval( argv[5] ), - Beta=eval( argv[6] ), - ) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +filter = itk.SigmoidImageFilter[IType, IType].New(reader, + OutputMinimum=eval(argv[3]), + OutputMaximum=eval(argv[4]), + Alpha=eval(argv[5]), + Beta=eval(argv[6]), + ) +writer = itk.ImageFileWriter[IType].New(filter, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/simple_pipeline.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/simple_pipeline.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/simple_pipeline.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/simple_pipeline.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,7 +16,8 @@ # #==========================================================================*/ -import itk, sys +import itk +import sys itk.auto_progress(2) # first argument is the pixel type diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SmoothingRecursiveGaussianImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SmoothingRecursiveGaussianImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SmoothingRecursiveGaussianImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SmoothingRecursiveGaussianImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -24,6 +24,8 @@ from sys import argv itk.auto_progress(2) -reader = itk.ImageFileReader.IUC2.New( FileName=argv[1] ) -filter = itk.SmoothingRecursiveGaussianImageFilter.New( reader, Sigma=eval( argv[3] ) ) -itk.write( filter, argv[2] ) +reader = itk.ImageFileReader.IUC2.New(FileName=argv[1]) +filter = itk.SmoothingRecursiveGaussianImageFilter.New( + reader, + Sigma=eval(argv[3])) +itk.write(filter, argv[2]) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SpatialObjectTest.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SpatialObjectTest.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SpatialObjectTest.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/SpatialObjectTest.py 2014-09-03 08:29:34.000000000 +0000 @@ -32,14 +32,17 @@ # OUTPUTS: {ResampleImageFilterOutput4.png} # 3 +from __future__ import print_function + import itk from sys import argv, stderr, exit itk.auto_progress(2) # if( len(argv) < 3 ): -# print >> stderr, """Missing Parameters -# Usage: ResampleImageFilter.py inputImageFile outputImageFile [exampleAction={0,1,2,3}]""" +# print("""Missing Parameters +# Usage: ResampleImageFilter.py inputImageFile outputImageFile +# [exampleAction={0,1,2,3}]""", file=stderr) # exit(1) dim = 2 @@ -48,27 +51,33 @@ OutputPixelType = itk.UC OutputImageType = itk.Image[OutputPixelType, dim] -ellipse = itk.EllipseSpatialObject[dim].New( Radius=[10,5] ) -ellipse.GetObjectToParentTransform().SetOffset( [20,20] ) +ellipse = itk.EllipseSpatialObject[dim].New(Radius=[10, 5]) +ellipse.GetObjectToParentTransform().SetOffset([20, 20]) ellipse.ComputeObjectToWorldTransform() -box = itk.BoxSpatialObject[dim].New( Size=20 ) -box.GetObjectToParentTransform().SetOffset( [20,40] ) +box = itk.BoxSpatialObject[dim].New(Size=20) +box.GetObjectToParentTransform().SetOffset([20, 40]) box.ComputeObjectToWorldTransform() -gaussian = itk.GaussianSpatialObject[dim].New( Radius=100 ) -gaussian.GetObjectToParentTransform().SetOffset( [60,60] ) -gaussian.GetObjectToParentTransform().SetScale( 10 ) +gaussian = itk.GaussianSpatialObject[dim].New(Radius=100) +gaussian.GetObjectToParentTransform().SetOffset([60, 60]) +gaussian.GetObjectToParentTransform().SetScale(10) gaussian.ComputeObjectToWorldTransform() group = itk.GroupSpatialObject[dim].New() -group.AddSpatialObject( ellipse ) -group.AddSpatialObject( box ) -group.AddSpatialObject( gaussian ) - -filter = itk.SpatialObjectToImageFilter[SOType, InternalImageType].New( group, Size=[100,100], UseObjectValue=True ) -filter.Update() # required ?! - -rescale = itk.RescaleIntensityImageFilter[InternalImageType, OutputImageType].New( filter, OutputMinimum=itk.NumericTraits[OutputPixelType].NonpositiveMin(), OutputMaximum=itk.NumericTraits[OutputPixelType].max() ) +group.AddSpatialObject(ellipse) +group.AddSpatialObject(box) +group.AddSpatialObject(gaussian) + +filter = itk.SpatialObjectToImageFilter[SOType, InternalImageType].New( + group, Size=[100, 100], UseObjectValue=True) +filter.Update() # required ?! + +rescale = itk.RescaleIntensityImageFilter[ + InternalImageType, + OutputImageType].New( + filter, + OutputMinimum=itk.NumericTraits[OutputPixelType].NonpositiveMin(), + OutputMaximum=itk.NumericTraits[OutputPixelType].max()) itk.write(rescale, argv[1]) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/StrelFromImageGrayscaleDilateImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/StrelFromImageGrayscaleDilateImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/StrelFromImageGrayscaleDilateImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/StrelFromImageGrayscaleDilateImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -29,12 +29,12 @@ IType = itk.Image[itk.US, dim] OIType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -reader2 = itk.ImageFileReader[OIType].New( FileName=argv[3] ) -kernel = itk.FlatStructuringElement[dim].FromImageUC( reader2.GetOutput() ) -filter = itk.GrayscaleDilateImageFilter[IType, IType, kernel].New( reader, - Kernel=kernel ) -cast = itk.CastImageFilter[IType, OIType].New(filter) -writer = itk.ImageFileWriter[OIType].New( cast, FileName=argv[2] ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +reader2 = itk.ImageFileReader[OIType].New(FileName=argv[3]) +kernel = itk.FlatStructuringElement[dim].FromImageUC(reader2.GetOutput()) +grayscaleFilter = itk.GrayscaleDilateImageFilter[IType, IType, kernel] +grayscaleFilter = grayscaleFilter.New(reader, Kernel=kernel) +cast = itk.CastImageFilter[IType, OIType].New(grayscaleFilter) +writer = itk.ImageFileWriter[OIType].New(cast, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/templated_pipeline.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/templated_pipeline.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/templated_pipeline.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/templated_pipeline.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,41 +1,73 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + import itk from sys import argv itk.auto_progress(2) # define a custom templated pipeline + class LabelDilateImageFilter(itk.pipeline): - def __init__(self, *args, **kargs): - # call the constructor of the superclass but without args and kargs, because the attributes - # are not all already there! - # Set/GetRadius() is created in the constructor for example, with the expose() method - itk.pipeline.__init__(self) - - # get the template parameters - template_parameters = kargs["template_parameters"] - # check the template parameters validity. Not really useful in that case, because we do the same - # here, but a good habit - LabelDilateImageFilter.check_template_parameters(template_parameters) - - # and store them in an easier way - ImageType, DistanceMapType = template_parameters - - # build the minipipeline - self.connect(itk.DanielssonDistanceMapImageFilter[ImageType, DistanceMapType].New(UseImageSpacing=True, SquaredDistance=False)) - self.connect(itk.BinaryThresholdImageFilter[DistanceMapType, ImageType].New()) - self.expose("UpperThreshold", "Radius") - self.append(itk.MaskImageFilter[ImageType, ImageType, ImageType].New(self.filters[0].GetVoronoiMap(), Input2=self.filters[1])) - - # now we can parse the inputs - itk.set_inputs(self, args, kargs) - - def check_template_parameters(template_parameters): - ImageType, DistanceMapType = template_parameters - itk.DanielssonDistanceMapImageFilter[ImageType, DistanceMapType] - itk.BinaryThresholdImageFilter[DistanceMapType, ImageType] - itk.CastImageFilter[DistanceMapType, ImageType] - itk.MaskImageFilter[ImageType, ImageType, ImageType] - check_template_parameters = staticmethod(check_template_parameters) + + def __init__(self, *args, **kargs): + # call the constructor of the superclass but without args and kargs, + # because the attributes are not all already there! + # Set/GetRadius() is created in the constructor for example, with the + # expose() method + itk.pipeline.__init__(self) + + # get the template parameters + template_parameters = kargs["template_parameters"] + # check the template parameters validity. Not really useful in that + # case, because we do the same here, but a good habit + LabelDilateImageFilter.check_template_parameters(template_parameters) + + # and store them in an easier way + ImageType, DistanceMapType = template_parameters + + # build the minipipeline + self.connect( + itk.DanielssonDistanceMapImageFilter[ + ImageType, + DistanceMapType].New( + UseImageSpacing=True, + SquaredDistance=False)) + self.connect( + itk.BinaryThresholdImageFilter[DistanceMapType, + ImageType].New()) + self.expose("UpperThreshold", "Radius") + self.append( + itk.MaskImageFilter[ImageType, + ImageType, + ImageType].New(self.filters[0].GetVoronoiMap(), + Input2=self.filters[1])) + + # now we can parse the inputs + itk.set_inputs(self, args, kargs) + + def check_template_parameters(template_parameters): + ImageType, DistanceMapType = template_parameters + itk.DanielssonDistanceMapImageFilter[ImageType, DistanceMapType] + itk.BinaryThresholdImageFilter[DistanceMapType, ImageType] + itk.CastImageFilter[DistanceMapType, ImageType] + itk.MaskImageFilter[ImageType, ImageType, ImageType] + check_template_parameters = staticmethod(check_template_parameters) LabelDilateImageFilter = itk.templated_class(LabelDilateImageFilter) @@ -46,8 +78,9 @@ OIType = itk.Image[itk.UC, dim] DIType = itk.Image[itk.F, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -dilate = LabelDilateImageFilter[IType, DIType].New(reader, Radius=eval(argv[3])) -writer = itk.ImageFileWriter[OIType].New( dilate, FileName=argv[2] ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +val = argv[3] +dilate = LabelDilateImageFilter[IType, DIType].New(reader, Radius=eval(val)) +writer = itk.ImageFileWriter[OIType].New(dilate, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/template.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/template.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/template.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/template.py 2014-09-03 08:29:34.000000000 +0000 @@ -42,17 +42,17 @@ assert readerType == readerType2 == readerType3 # we should be able to get the template and its parameters from the class -(tpl, parameters) = itk.template( IType ) +(tpl, parameters) = itk.template(IType) assert tpl == itk.Image assert parameters == (PType, dim) # the template must raise a KeyError exception if the template parameter # is unknown -try : - itk.ImageFileReader['unknown parameter'] - raise Exception('no exception sent for unknown parameter') +try: + itk.ImageFileReader['unknown parameter'] + raise Exception('no exception sent for unknown parameter') except KeyError: - pass + pass # TODO: test the rest of the dict interface # TODO: test __eq__, __ne__ and __hash__ @@ -60,10 +60,7 @@ # something else ? - - # now test the New method - # without parameter reader = readerType.New() reader2 = readerType.New() @@ -73,18 +70,18 @@ assert reader.GetFileName() == 'test.png' # wwith a wrong attribute name -try : - reader = readerType.New(WrongName='test.png') - raise Exception('no exception sent for wrong attribute name') +try: + reader = readerType.New(WrongName='test.png') + raise Exception('no exception sent for wrong attribute name') except AttributeError: - pass + pass # wwith a wrong attribute type -try : - reader = readerType.New(FileName=1) - raise Exception('no exception sent for wrong attribute type') -except : - pass +try: + reader = readerType.New(FileName=1) + raise Exception('no exception sent for wrong attribute type') +except: + pass # pass filter as argument for input # to a filter with SetInput method @@ -118,31 +115,32 @@ # pass invalid input try: - itk.MedianImageFilter[IType, IType].New(1) - raise Exception('no exception sent for wrong input type') + itk.MedianImageFilter[IType, IType].New(1) + raise Exception('no exception sent for wrong input type') except: - pass + pass try: - itk.SubtractImageFilter[IType, IType, IType].New(im, "wrong") - raise Exception('no exception sent for wrong 2nd input type') + itk.SubtractImageFilter[IType, IType, IType].New(im, "wrong") + raise Exception('no exception sent for wrong 2nd input type') except TypeError: - pass + pass # pass both input and attribute -recons = itk.ReconstructionByDilationImageFilter[IType, IType].New(reader.GetOutput(), im, FullyConnected=True) +recons = itk.ReconstructionByDilationImageFilter[ + IType, IType].New(reader.GetOutput(), im, FullyConnected=True) assert reader.GetOutput() == recons.GetInput(0) assert im == recons.GetInput(1) -assert recons.GetFullyConnected() == True +assert recons.GetFullyConnected() # pass input to object which do not take one try: - IType.New(im) - raise Exception('no exception sent for object without input') + IType.New(im) + raise Exception('no exception sent for object without input') except AttributeError: - pass + pass # TODO: test auto_progress # but how ? diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestDirectory.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestDirectory.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestDirectory.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestDirectory.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,6 +16,8 @@ # #==========================================================================*/ +from __future__ import print_function + import itk itk.auto_progress(2) @@ -24,5 +26,5 @@ n = d.GetNumberOfFiles() i = 0 while i < n: - print d.GetFile(i) - i = i +1 + print(d.GetFile(i)) + i = i + 1 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestMetaDataDictionary.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestMetaDataDictionary.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestMetaDataDictionary.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/TestMetaDataDictionary.py 2014-09-03 08:29:34.000000000 +0000 @@ -15,6 +15,9 @@ # limitations under the License. # #==========================================================================*/ + +from __future__ import print_function + import itk from sys import argv @@ -23,7 +26,8 @@ dv = itk.MetaDataObject.D.New() dv.SetMetaDataObjectValue(10.0) md.Set("double", dv) -print md.Get("double") -# other way of setting and retrieving double value (levereges on Python's weak type system) +print(md.Get("double")) +# other way of setting and retrieving double value (levereges on Python's +# weak type system) md['double'] = 10.0 -print md['double'] +print(md['double']) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -27,13 +27,13 @@ dim = 2 IType = itk.Image[itk.UC, dim] -reader = itk.ImageFileReader[IType].New( FileName=argv[1] ) -filter = itk.ThresholdImageFilter[IType].New( reader, - OutsideValue=eval( argv[3] ) ) +reader = itk.ImageFileReader[IType].New(FileName=argv[1]) +filter = itk.ThresholdImageFilter[IType].New(reader, + OutsideValue=eval(argv[3])) # this method can't be called in the New() method because it doesn't # use the Set notation -filter.ThresholdAbove( eval( argv[4] ) ) +filter.ThresholdAbove(eval(argv[4])) -writer = itk.ImageFileWriter[IType].New( filter, FileName=argv[2] ) +writer = itk.ImageFileWriter[IType].New(filter, FileName=argv[2]) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdSegmentationLevelSetImageFilter.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdSegmentationLevelSetImageFilter.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdSegmentationLevelSetImageFilter.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/ThresholdSegmentationLevelSetImageFilter.py 2014-09-03 08:29:34.000000000 +0000 @@ -28,103 +28,114 @@ # OUTPUTS: {ThresholdSegmentationLevelSetImageFilterGrayMatter.png} # 107 69 5 180 210 +from __future__ import print_function + import itk from sys import argv, stderr, exit itk.auto_progress(2) # itk.auto_progress(1) -if len(argv) < 8 : - print >> stderr, """Missing Parameters -Usage: ThresholdSegmentationLevelSetImageFilter.py inputImage outputImage seedX seedY InitialDistance LowerThreshold UpperThreshold [CurvatureScaling == 1.0]""" - exit(1) +if len(argv) < 8: + print(( + "Missing Parameters \n Usage: " + "ThresholdSegmentationLevelSetImageFilter.py inputImage outputImage " + "seedX seedY InitialDistance LowerThreshold UpperThreshold " + "[CurvatureScaling == 1.0]"), file=stderr) + exit(1) InternalPixelType = itk.F Dimension = 2 -InternalImageType = itk.Image[ InternalPixelType, Dimension ] +InternalImageType = itk.Image[InternalPixelType, Dimension] OutputPixelType = itk.UC -OutputImageType = itk.Image[ OutputPixelType, Dimension ] +OutputImageType = itk.Image[OutputPixelType, Dimension] -thresholder = itk.BinaryThresholdImageFilter[ InternalImageType, OutputImageType ].New() +thresholder = itk.BinaryThresholdImageFilter[ + InternalImageType, OutputImageType].New() -thresholder.SetLowerThreshold( -1000.0 ) -thresholder.SetUpperThreshold( 0.0 ) +thresholder.SetLowerThreshold(-1000.0) +thresholder.SetUpperThreshold(0.0) -thresholder.SetOutsideValue( 0 ) -thresholder.SetInsideValue( 255 ) +thresholder.SetOutsideValue(0) +thresholder.SetInsideValue(255) -ReaderType = itk.ImageFileReader[ InternalImageType ] -WriterType = itk.ImageFileWriter[ OutputImageType ] +ReaderType = itk.ImageFileReader[InternalImageType] +WriterType = itk.ImageFileWriter[OutputImageType] reader = ReaderType.New() writer = WriterType.New() -reader.SetFileName( argv[1] ) -writer.SetFileName( argv[2] ) +reader.SetFileName(argv[1]) +writer.SetFileName(argv[2]) -FastMarchingFilterType = itk.FastMarchingImageFilter[ InternalImageType, InternalImageType ] +FastMarchingFilterType = itk.FastMarchingImageFilter[ + InternalImageType, + InternalImageType] fastMarching = FastMarchingFilterType.New() -ThresholdSegmentationLevelSetImageFilterType = itk.ThresholdSegmentationLevelSetImageFilter[ InternalImageType, InternalImageType, InternalPixelType ] -thresholdSegmentation = ThresholdSegmentationLevelSetImageFilterType.New() -thresholdSegmentation.SetPropagationScaling( 1.0 ) -if len(argv) > 8 : - thresholdSegmentation.SetCurvatureScaling( float(argv[8]) ) +ThresholdSegLvlSetImgFilterType = itk.ThresholdSegmentationLevelSetImageFilter[ + InternalImageType, + InternalImageType, + InternalPixelType] +thresholdSegmentation = ThresholdSegLvlSetImgFilterType.New() +thresholdSegmentation.SetPropagationScaling(1.0) +if len(argv) > 8: + thresholdSegmentation.SetCurvatureScaling(float(argv[8])) else: - thresholdSegmentation.SetCurvatureScaling( 1.0 ) + thresholdSegmentation.SetCurvatureScaling(1.0) -thresholdSegmentation.SetMaximumRMSError( 0.02 ) -thresholdSegmentation.SetNumberOfIterations( 1200 ) +thresholdSegmentation.SetMaximumRMSError(0.02) +thresholdSegmentation.SetNumberOfIterations(1200) -thresholdSegmentation.SetUpperThreshold( float(argv[7]) ) -thresholdSegmentation.SetLowerThreshold( float(argv[6]) ) +thresholdSegmentation.SetUpperThreshold(float(argv[7])) +thresholdSegmentation.SetLowerThreshold(float(argv[6])) thresholdSegmentation.SetIsoSurfaceValue(0.0) -thresholdSegmentation.SetInput( fastMarching.GetOutput() ) -thresholdSegmentation.SetFeatureImage( reader.GetOutput() ) -thresholder.SetInput( thresholdSegmentation.GetOutput() ) -writer.SetInput( thresholder.GetOutput() ) +thresholdSegmentation.SetInput(fastMarching.GetOutput()) +thresholdSegmentation.SetFeatureImage(reader.GetOutput()) +thresholder.SetInput(thresholdSegmentation.GetOutput()) +writer.SetInput(thresholder.GetOutput()) NodeType = itk.LevelSetNode[InternalPixelType, Dimension] NodeContainer = itk.VectorContainer[itk.UI, NodeType] seeds = NodeContainer.New() -seedPosition = [int( argv[3] ), int( argv[4] )] +seedPosition = [int(argv[3]), int(argv[4])] -initialDistance = float( argv[5] ) +initialDistance = float(argv[5]) node = NodeType() seedValue = - initialDistance -node.SetValue( seedValue ) -node.SetIndex( seedPosition ) +node.SetValue(seedValue) +node.SetIndex(seedPosition) seeds.Initialize() -seeds.InsertElement( 0, node ) +seeds.InsertElement(0, node) -fastMarching.SetTrialPoints( seeds ) +fastMarching.SetTrialPoints(seeds) -fastMarching.SetSpeedConstant( 1.0 ) +fastMarching.SetSpeedConstant(1.0) reader.Update() fastMarching.SetOutputSize( - reader.GetOutput().GetBufferedRegion().GetSize() ) + reader.GetOutput().GetBufferedRegion().GetSize()) writer.Update() itk.echo(thresholdSegmentation) -InternalWriterType = itk.ImageFileWriter[ InternalImageType ] +InternalWriterType = itk.ImageFileWriter[InternalImageType] mapWriter = InternalWriterType.New() -mapWriter.SetInput( fastMarching.GetOutput() ) +mapWriter.SetInput(fastMarching.GetOutput()) mapWriter.SetFileName("fastMarchingImage.mha") mapWriter.Update() speedWriter = InternalWriterType.New() -speedWriter.SetInput( thresholdSegmentation.GetSpeedImage() ) +speedWriter.SetInput(thresholdSegmentation.GetSpeedImage()) speedWriter.SetFileName("speedTermImage.mha") speedWriter.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/timing.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/timing.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/timing.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/timing.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,59 +1,86 @@ +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + +from __future__ import print_function + import time start = time.time() import itk itk.force_load() -print "load:", time.time() - start +print("load:", time.time() - start) -img = itk.Image.UC2.New(Regions=(10,20)) +img = itk.Image.UC2.New(Regions=(10, 20)) img.Allocate() + def index(it): - idx = itk.Index[2]() - for dummy in range(0, it): - img.GetPixel(idx) + idx = itk.Index[2]() + for dummy in range(0, it): + img.GetPixel(idx) + def index2(it): - idx = itk.Index[2]() - for dummy in range(0, it): - idx[0] = 0 - idx[1] = 0 - img.GetPixel(idx) + idx = itk.Index[2]() + for dummy in range(0, it): + idx[0] = 0 + idx[1] = 0 + img.GetPixel(idx) + def integer(it): - for dummy in range(0, it): - img.GetPixel(0) + for dummy in range(0, it): + img.GetPixel(0) + def pylist(it): - l = [0, 0] - for dummy in range(0, it): - img.GetPixel(l) + l = [0, 0] + for dummy in range(0, it): + img.GetPixel(l) + def pytuple(it): - l = (0, 0) - for dummy in range(0, it): - img.GetPixel(l) + l = (0, 0) + for dummy in range(0, it): + img.GetPixel(l) + def new(it): - for dummy in range(0, it): - lo = itk.Image.UC2.__New_orig__() + for dummy in range(0, it): + lo = itk.Image.UC2.__New_orig__() + def extended_new(it): - for dummy in range(0, it): - lo = itk.Image.UC2.New() + for dummy in range(0, it): + lo = itk.Image.UC2.New() def run(f, it): - start = time.time() - f(it) - return time.time() - start + start = time.time() + f(it) + return time.time() - start it = 1000000 -print "index:", run(index, it) -print "index2:", run(index2, it) -print "integer:", run(integer, it) -print "list:", run(pylist, it) -print "tuple:", run(pytuple, it) -print "new:", run(new, 100000) -print "extended_new:", run(extended_new, 100000) +print("index:", run(index, it)) +print("index2:", run(index2, it)) +print("integer:", run(integer, it)) +print("list:", run(pylist, it)) +print("tuple:", run(pytuple, it)) +print("new:", run(new, 100000)) +print("extended_new:", run(extended_new, 100000)) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/typemaps.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/typemaps.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/typemaps.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/typemaps.py 2014-09-03 08:29:34.000000000 +0000 @@ -16,7 +16,11 @@ # #==========================================================================*/ -import itk, sys, gc +from __future__ import print_function + +import itk +import sys +import gc # create some vars used later @@ -37,15 +41,31 @@ idx2 = itk.Index[2](t) idx3 = itk.Index[2](l) idx4 = itk.Index[2](i) -assert idx1.GetElement(0) == idx2.GetElement(0) == idx3.GetElement(0) == idx4.GetElement(0) == i -assert idx1.GetElement(1) == idx2.GetElement(1) == idx3.GetElement(1) == idx4.GetElement(1) == i +assert idx1.GetElement( + 0) == idx2.GetElement( + 0) == idx3.GetElement( + 0) == idx4.GetElement( + 0) == i +assert idx1.GetElement( + 1) == idx2.GetElement( + 1) == idx3.GetElement( + 1) == idx4.GetElement( + 1) == i size1 = itk.Size[2](size) size2 = itk.Size[2](t) size3 = itk.Size[2](l) size4 = itk.Size[2](i) -assert size1.GetElement(0) == size2.GetElement(0) == size3.GetElement(0) == size4.GetElement(0) == i -assert size1.GetElement(1) == size2.GetElement(1) == size3.GetElement(1) == size4.GetElement(1) == i +assert size1.GetElement( + 0) == size2.GetElement( + 0) == size3.GetElement( + 0) == size4.GetElement( + 0) == i +assert size1.GetElement( + 1) == size2.GetElement( + 1) == size3.GetElement( + 1) == size4.GetElement( + 1) == i median = itk.MedianImageFilter.IUC2IUC2.New() median.SetRadius(size) @@ -56,36 +76,44 @@ size3 = median.GetRadius() median.SetRadius(i) size4 = median.GetRadius() -assert size1.GetElement(0) == size2.GetElement(0) == size3.GetElement(0) == size4.GetElement(0) == i -assert size1.GetElement(1) == size2.GetElement(1) == size3.GetElement(1) == size4.GetElement(1) == i +assert size1.GetElement( + 0) == size2.GetElement( + 0) == size3.GetElement( + 0) == size4.GetElement( + 0) == i +assert size1.GetElement( + 1) == size2.GetElement( + 1) == size3.GetElement( + 1) == size4.GetElement( + 1) == i # smart pointers im = itk.Image.UC2.New() -assert im != None +assert im is not None -median.SetInput( im ) +median.SetInput(im) assert median.GetInput() == im assert median.GetInput() != median.GetOutput() -median.SetInput( None ) -assert median.GetInput() == None +median.SetInput(None) +assert median.GetInput() is None # ImageSource median2 = itk.MedianImageFilter.IUC2IUC2.New() -median.SetInput( median2 ) +median.SetInput(median2) assert median.GetInput() == median2.GetOutput() # catching exception try: - median.Update() - print >> sys.stderr, "Exception not throwed!" - sys.exit(1) -except RuntimeError, e: - print "Exception catched as expected", e + median.Update() + print("Exception not throwed!", file=sys.stderr) + sys.exit(1) +except RuntimeError as e: + print("Exception catched as expected", e) # ----- keep that at the end! ----- diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/WatershedSegmentation1.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/WatershedSegmentation1.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/WatershedSegmentation1.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/WatershedSegmentation1.py 2014-09-03 08:29:34.000000000 +0000 @@ -21,13 +21,13 @@ itk.auto_progress(2) reader = itk.ImageFileReader.IF2.New() -reader.SetFileName( sys.argv[1] ) +reader.SetFileName(sys.argv[1]) diffusion = itk.GradientAnisotropicDiffusionImageFilter.IF2IF2.New() diffusion.SetInput(reader.GetOutput()) diffusion.SetTimeStep(0.0625) diffusion.SetConductanceParameter(9.0) -diffusion.SetNumberOfIterations( 5 ); +diffusion.SetNumberOfIterations(5) gradient = itk.GradientMagnitudeImageFilter.IF2IF2.New() gradient.SetInput(diffusion.GetOutput()) @@ -38,12 +38,12 @@ watershed.SetLevel(0.2) relabel = itk.RelabelComponentImageFilter.IUL2ISS2.New() -relabel.SetInput( watershed.GetOutput() ) +relabel.SetInput(watershed.GetOutput()) cast = itk.CastImageFilter.ISS2IUC2.New() -cast.SetInput( relabel.GetOutput() ) +cast.SetInput(relabel.GetOutput()) writer = itk.ImageFileWriter.IUC2.New() -writer.SetFileName( sys.argv[2] ) -writer.SetInput( cast.GetOutput() ) +writer.SetFileName(sys.argv[2]) +writer.SetInput(cast.GetOutput()) writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/wrappingCoverage.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/wrappingCoverage.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/Tests/wrappingCoverage.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/Tests/wrappingCoverage.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,71 +1,88 @@ -# -*- coding: utf-8 -*- - -import sys, re, itk, os +#========================================================================== +# +# Copyright Insight Software Consortium +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +#==========================================================================*/ + +from __future__ import print_function + +import sys +import re +import itk +import os from optparse import OptionParser -# python 2.3 compatibility -if sys.version < '2.4' : - # set compatibility - import sets - set = sets.Set - - def sorted(iterable, cmp=None, key=None, reverse=False) : - i = list(iterable) - if key : - d = {} - for v in iterable : - k = key(v) - if not d.has_key(k) : - d[k] = [] - d[k].append(v) - keys = d.keys() - keys.sort(cmp) - i = [] - for k in keys : - i += d[k] - else : - i.sort(cmp) - if reverse : - i.reverse() - return i - -parser = OptionParser(usage = 'wrappingCoverage.py paths') - -parser.add_option("-b", "--base", dest="base", default="Filter", help="Base string used to search for the classes (default: Filter).") -parser.add_option("-e", "--exclude", dest="exclude", default=None, help="Path of a file with one class to exclude per line (default: None).") -parser.add_option("-E", "--no-error", action="store_true", dest="noError", help="Don't generate an error code if all the classes are not wrapped.") +parser = OptionParser(usage='wrappingCoverage.py paths') + +parser.add_option( + "-b", + "--base", + dest="base", + default="Filter", + help="Base string used to search for the classes (default: Filter).") +parser.add_option( + "-e", + "--exclude", + dest="exclude", + default=None, + help="Path of a file with one class to exclude per line (default: None).") +parser.add_option( + "-E", + "--no-error", + action="store_true", + dest="noError", + help="Don't generate an error code if all the classes are not wrapped.") opts, args = parser.parse_args() # declares classes which will not be wrapped excluded = set([]) if opts.exclude: - map(excluded.add, [c.strip() for c in file(opts.exclude).readlines()]) + map(excluded.add, [c.strip() for c in file(opts.exclude).readlines()]) # get classes from sources headers = [] for d in args: - headers += sum([ f for p,d,f in os.walk(d) if "Deprecated" not in p and "TestKernel" not in p ], []) -classes = set([f[len('itk'):-len('.h')] for f in headers if f.startswith("itk") and not f.startswith("itkv3") and f.endswith(opts.base+".h")]) - excluded + headers += sum([f for p, d, f in os.walk(d) + if "Deprecated" not in p and "TestKernel" not in p], []) +classes = set([f[len('itk'):-len('.h')] for f in headers if f.startswith("itk") + and not f.startswith("itkv3") and + f.endswith(opts.base + ".h")]) - excluded # get filter from wrapper files -# remove classes which are not in the toolkit (external projects, PyImageFilter, ...) -wrapped = set([a for a in dir(itk) if a.endswith(opts.base)]).intersection(classes) +# remove classes which are not in the toolkit (external projects, +# PyImageFilter, ...) +wrapped = set([a for a in dir(itk) if a.endswith(opts.base)] + ).intersection(classes) nonWrapped = classes - wrapped -# print non wrapped classes without much text to stdout, so they can be easily reused -for f in sorted(nonWrapped) : - print f +# print non wrapped classes without much text to stdout, so they can be +# easily reused +for f in sorted(nonWrapped): + print(f) # and print stats in stderr to avoid poluting the list above -print >>sys.stderr -print >>sys.stderr, '%i %s' % (len(classes), opts.base) -print >>sys.stderr, '%i wrapped %s' % (len(wrapped), opts.base) -print >>sys.stderr, '%i non wrapped %s' % (len(nonWrapped), opts.base) -print >>sys.stderr, '%f%% covered' % (len(wrapped) / float(len(classes)) * 100) -print >>sys.stderr +print("", file=sys.stderr) +print('%i %s' % (len(classes), opts.base), file=sys.stderr) +print('%i wrapped %s' % (len(wrapped), opts.base), file=sys.stderr) +print('%i non wrapped %s' % (len(nonWrapped), opts.base), file=sys.stderr) +covered = len(wrapped) / float(len(classes)) +print('%f%% covered' % (covered * 100), file=sys.stderr) +print("", file=sys.stderr) if not opts.noError: - sys.exit(len(nonWrapped)) + sys.exit(len(nonWrapped)) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/WrapITKBuildOptionsConfig.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/WrapITKBuildOptionsConfig.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/WrapITKBuildOptionsConfig.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/WrapITKBuildOptionsConfig.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,17 +1,17 @@ depends = ('ITKCommon',) templates = ( - ('DIMS', 'ITK_WRAP_DIMS', 'DIMS'), - ('USIGN_INTS', 'WRAP_ITK_USIGN_INT', 'USIGN_INTS'), - ('SIGN_INTS', 'WRAP_ITK_SIGN_INT', 'SIGN_INTS'), - ('REALS', 'WRAP_ITK_REAL', 'REALS'), - ('VECTOR_REALS', 'WRAP_ITK_VECTOR_REAL', 'VECTOR_REALS'), - ('COV_VECTOR_REALS', 'WRAP_ITK_COV_VECTOR_REAL', 'COV_VECTOR_REALS'), - ('RGBS', 'WRAP_ITK_RGB', 'RGBS'), - ('RGBAS', 'WRAP_ITK_RGBA', 'RGBAS'), - ('COMPLEX_REALS', 'WRAP_ITK_COMPLEX_REAL', 'COMPLEX_REALS'), - ('INTS', 'WRAP_ITK_INT', 'INTS'), - ('SCALARS', 'WRAP_ITK_SCALAR', 'SCALARS'), - ('VECTORS', 'WRAP_ITK_VECTOR', 'VECTORS'), - ('COLORS', 'WRAP_ITK_COLOR', 'COLORS'), - ('ALL_TYPES', 'WRAP_ITK_ALL_TYPE', 'ALL_TYPES'), + ('DIMS', 'ITK_WRAP_DIMS', 'DIMS'), + ('USIGN_INTS', 'WRAP_ITK_USIGN_INT', 'USIGN_INTS'), + ('SIGN_INTS', 'WRAP_ITK_SIGN_INT', 'SIGN_INTS'), + ('REALS', 'WRAP_ITK_REAL', 'REALS'), + ('VECTOR_REALS', 'WRAP_ITK_VECTOR_REAL', 'VECTOR_REALS'), + ('COV_VECTOR_REALS', 'WRAP_ITK_COV_VECTOR_REAL', 'COV_VECTOR_REALS'), + ('RGBS', 'WRAP_ITK_RGB', 'RGBS'), + ('RGBAS', 'WRAP_ITK_RGBA', 'RGBAS'), + ('COMPLEX_REALS', 'WRAP_ITK_COMPLEX_REAL', 'COMPLEX_REALS'), + ('INTS', 'WRAP_ITK_INT', 'INTS'), + ('SCALARS', 'WRAP_ITK_SCALAR', 'SCALARS'), + ('VECTORS', 'WRAP_ITK_VECTOR', 'VECTORS'), + ('COLORS', 'WRAP_ITK_COLOR', 'COLORS'), + ('ALL_TYPES', 'WRAP_ITK_ALL_TYPE', 'ALL_TYPES'), ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/WrapITK.pth.in otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/WrapITK.pth.in --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Python/WrapITK.pth.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Python/WrapITK.pth.in 2014-09-03 08:29:34.000000000 +0000 @@ -1,2 +1,3 @@ # Python pth file to add WrapITK's path to sys.path. @CONFIG_ITK_WRAP_PYTHON_DIR@ +@CONFIG_ITK_WRAP_LIBRARY_DIR@ diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/CMakeLists.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/CMakeLists.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ - -# configure the test driver -find_program(ITK_TEST_DRIVER itkTestDriver) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/DicomSliceRead.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/DicomSliceRead.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/DicomSliceRead.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/DicomSliceRead.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -# -# Example on the use of DicomImageIO for reading a single DICOM slice, rescale -# the intensities and save it in a different file format. -# - -from InsightToolkit import * - -from sys import argv - -# -# Reads an image in 16bits/pixel -# and save it as 8bits/pixel -# -reader = itkImageFileReaderUS2_New() -writer = itkImageFileWriterUC2_New() - -dicomIO = itkDicomImageIO_New() - -reader.SetImageIO( dicomIO.GetPointer() ) - -filter = itkRescaleIntensityImageFilterUS2UC2_New() - -filter.SetOutputMinimum( 0 ) -filter.SetOutputMaximum(255) - -filter.SetInput( reader.GetOutput() ) -writer.SetInput( filter.GetOutput() ) - -reader.SetFileName( argv[1] ) -writer.SetFileName( argv[2] ) - -writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration3.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration3.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration3.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration3.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -#========================================================================= -# -# Program: Insight Segmentation & Registration Toolkit -# Module: $RCSfile: ImageRegistration3.py,v $ -# Language: C++ -# Date: $Date: 2006/09/06 20:58:42 $ -# Version: $Revision: 1.1 $ -# -# Copyright (c) Insight Software Consortium. All rights reserved. -# See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. -# -# 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. -# -#========================================================================= - -from InsightToolkit import * - -from sys import argv - - - -# -# Read the fixed and moving images using filenames -# from the command line arguments -# -fixedImageReader = itkImageFileReaderF2_New() -movingImageReader = itkImageFileReaderF2_New() - -fixedImageReader.SetFileName( argv[1] ) -movingImageReader.SetFileName( argv[2] ) - -fixedImageReader.Update() -movingImageReader.Update() - -fixedImage = fixedImageReader.GetOutput() -movingImage = movingImageReader.GetOutput() - - - - -# -# Instantiate the classes for the registration framework -# -registration = itkImageRegistrationMethodF2F2_New() -imageMetric = itkMeanSquaresImageToImageMetricF2F2_New() -transform = itkTranslationTransform2_New() -optimizer = itkRegularStepGradientDescentOptimizer_New() -interpolator = itkLinearInterpolateImageFunctionF2D_New() - - -registration.SetOptimizer( optimizer.GetPointer() ) -registration.SetTransform( transform.GetPointer() ) -registration.SetInterpolator( interpolator.GetPointer() ) -registration.SetMetric( imageMetric.GetPointer() ) -registration.SetFixedImage( fixedImage ) -registration.SetMovingImage( movingImage ) - -registration.SetFixedImageRegion( fixedImage.GetBufferedRegion() ) - -transform.SetIdentity() -initialParameters = transform.GetParameters() - -registration.SetInitialTransformParameters( initialParameters ) - -# -# Iteration Observer -# -def iterationUpdate(): - currentParameter = transform.GetParameters() - print "M: %f P: %f %f " % ( optimizer.GetValue(), - currentParameter.GetElement(0), - currentParameter.GetElement(1) ) - -iterationCommand = itkPyCommand_New() -iterationCommand.SetCommandCallable( iterationUpdate ) -optimizer.AddObserver( itkIterationEvent(), iterationCommand.GetPointer() ) - - - -# -# Define optimizer parameters -# -optimizer.SetMaximumStepLength( 4.00 ) -optimizer.SetMinimumStepLength( 0.01 ) -optimizer.SetNumberOfIterations( 200 ) - - -print "Starting registration" - -# -# Start the registration process -# - -registration.Update() - - -# -# Get the final parameters of the transformation -# -finalParameters = registration.GetLastTransformParameters() - -print "Final Registration Parameters " -print "Translation X = %f" % (finalParameters.GetElement(0),) -print "Translation Y = %f" % (finalParameters.GetElement(1),) - - - - -# -# Now, we use the final transform for resampling the -# moving image. -# -resampler = itkResampleImageFilterF2F2_New() -resampler.SetTransform( transform.GetPointer() ) -resampler.SetInput( movingImage ) - -region = fixedImage.GetLargestPossibleRegion() - -resampler.SetSize( region.GetSize() ) - -resampler.SetOutputSpacing( fixedImage.GetSpacing() ) -resampler.SetOutputOrigin( fixedImage.GetOrigin() ) -resampler.SetDefaultPixelValue( 100 ) - -outputCast = itkRescaleIntensityImageFilterF2US2_New() -outputCast.SetOutputMinimum( 0 ) -outputCast.SetOutputMaximum( 65535 ) -outputCast.SetInput(resampler.GetOutput()) - -# -# Write the resampled image -# -writer = itkImageFileWriterUS2_New() - -writer.SetFileName( argv[3] ) -writer.SetInput( outputCast.GetOutput() ) -writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration4.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration4.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration4.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration4.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -#========================================================================= -# -# Program: Insight Segmentation & Registration Toolkit -# Module: $RCSfile: ImageRegistration4.py,v $ -# Language: C++ -# Date: $Date: 2006/09/06 20:58:42 $ -# Version: $Revision: 1.1 $ -# -# Copyright (c) Insight Software Consortium. All rights reserved. -# See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details. -# -# 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. -# -#========================================================================= - -from InsightToolkit import * - -from sys import argv - - - -# -# Read the fixed and moving images using filenames -# from the command line arguments -# -fixedImageReader = itkImageFileReaderF2_New() -movingImageReader = itkImageFileReaderF2_New() - -fixedImageReader.SetFileName( argv[1] ) -movingImageReader.SetFileName( argv[2] ) - -fixedImageReader.Update() -movingImageReader.Update() - -fixedImage = fixedImageReader.GetOutput() -movingImage = movingImageReader.GetOutput() - - - - -# -# Instantiate the classes for the registration framework -# -registration = itkImageRegistrationMethodF2F2_New() -imageMetric = itkMattesMutualInformationImageToImageMetricF2F2_New() -transform = itkTranslationTransform2_New() -optimizer = itkRegularStepGradientDescentOptimizer_New() -interpolator = itkLinearInterpolateImageFunctionF2D_New() - - -imageMetric.SetNumberOfHistogramBins( 20 ); -imageMetric.SetNumberOfSpatialSamples( 10000 ); - -registration.SetOptimizer( optimizer.GetPointer() ) -registration.SetTransform( transform.GetPointer() ) -registration.SetInterpolator( interpolator.GetPointer() ) -registration.SetMetric( imageMetric.GetPointer() ) -registration.SetFixedImage( fixedImage ) -registration.SetMovingImage( movingImage ) - -registration.SetFixedImageRegion( fixedImage.GetBufferedRegion() ) - -transform.SetIdentity() -initialParameters = transform.GetParameters() - -registration.SetInitialTransformParameters( initialParameters ) - -# -# Iteration Observer -# -def iterationUpdate(): - currentParameter = transform.GetParameters() - print "M: %f P: %f %f " % ( optimizer.GetValue(), - currentParameter.GetElement(0), - currentParameter.GetElement(1) ) - -iterationCommand = itkPyCommand_New() -iterationCommand.SetCommandCallable( iterationUpdate ) -optimizer.AddObserver( itkIterationEvent(), iterationCommand.GetPointer() ) - - - -# -# Define optimizer parameters -# -optimizer.SetMaximumStepLength( 4.00 ) -optimizer.SetMinimumStepLength( 0.01 ) -optimizer.SetNumberOfIterations( 200 ) - - -print "Starting registration" - -# -# Start the registration process -# - -registration.Update() - - -# -# Get the final parameters of the transformation -# -finalParameters = registration.GetLastTransformParameters() - -print "Final Registration Parameters " -print "Translation X = %f" % (finalParameters.GetElement(0),) -print "Translation Y = %f" % (finalParameters.GetElement(1),) - - - - -# -# Now, we use the final transform for resampling the -# moving image. -# -resampler = itkResampleImageFilterF2F2_New() -resampler.SetTransform( transform.GetPointer() ) -resampler.SetInput( movingImage ) - -region = fixedImage.GetLargestPossibleRegion() - -resampler.SetSize( region.GetSize() ) - -resampler.SetOutputSpacing( fixedImage.GetSpacing() ) -resampler.SetOutputOrigin( fixedImage.GetOrigin() ) -resampler.SetDefaultPixelValue( 100 ) - -outputCast = itkRescaleIntensityImageFilterF2US2_New() -outputCast.SetOutputMinimum( 0 ) -outputCast.SetOutputMaximum( 65535 ) -outputCast.SetInput(resampler.GetOutput()) - -# -# Write the resampled image -# -writer = itkImageFileWriterUS2_New() - -writer.SetFileName( argv[3] ) -writer.SetInput( outputCast.GetOutput() ) -writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration5.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration5.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration5.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageRegistration5.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -# - -from InsightToolkit import * - -from sys import argv - -# -# Read the fixed and moving images using filenames -# from the command line arguments -# -fixedImageReader = itkImageFileReaderF2_New() -movingImageReader = itkImageFileReaderF2_New() - -fixedImageReader.SetFileName( argv[1] ) -movingImageReader.SetFileName( argv[2] ) - -fixedImageReader.Update() -movingImageReader.Update() - -fixedImage = fixedImageReader.GetOutput() -movingImage = movingImageReader.GetOutput() - -# -# Instantiate the classes for the registration framework -# -registration = itkImageRegistrationMethodF2F2_New() -imageMetric = itkMeanSquaresImageToImageMetricF2F2_New() -transform = itkCenteredRigid2DTransform_New() -optimizer = itkRegularStepGradientDescentOptimizer_New() -interpolator = itkLinearInterpolateImageFunctionF2D_New() - -registration.SetOptimizer( optimizer.GetPointer() ) -registration.SetTransform( transform.GetPointer() ) -registration.SetInterpolator( interpolator.GetPointer() ) -registration.SetMetric( imageMetric.GetPointer() ) -registration.SetFixedImage( fixedImage ) -registration.SetMovingImage( movingImage ) -registration.SetFixedImageRegion( fixedImage.GetBufferedRegion() ) - - -# -# Initial transform parameters -# -transform.SetAngle( 0.0 ); - -# center of the fixed image -fixedSpacing = fixedImage.GetSpacing() -fixedOrigin = fixedImage.GetOrigin() -fixedSize = fixedImage.GetLargestPossibleRegion().GetSize() - -centerFixed = ( fixedOrigin.GetElement(0) + fixedSpacing.GetElement(0) * fixedSize.GetElement(0) / 2.0, - fixedOrigin.GetElement(1) + fixedSpacing.GetElement(1) * fixedSize.GetElement(1) / 2.0 ) - -# center of the moving image -movingSpacing = movingImage.GetSpacing() -movingOrigin = movingImage.GetOrigin() -movingSize = movingImage.GetLargestPossibleRegion().GetSize() - -centerMoving = ( movingOrigin.GetElement(0) + movingSpacing.GetElement(0) * movingSize.GetElement(0) / 2.0, - movingOrigin.GetElement(1) + movingSpacing.GetElement(1) * movingSize.GetElement(1) / 2.0 ) - -# transform center -center = transform.GetCenter() -center.SetElement( 0, centerFixed[0] ) -center.SetElement( 1, centerFixed[1] ) - -# transform translation -translation = transform.GetTranslation() -translation.SetElement( 0, centerMoving[0] - centerFixed[0] ) -translation.SetElement( 1, centerMoving[1] - centerFixed[1] ) - -initialParameters = transform.GetParameters() - -print "Initial Parameters: " -print "Angle: %f" % (initialParameters.GetElement(0), ) -print "Center: %f, %f" % ( initialParameters.GetElement(1), initialParameters.GetElement(2) ) -print "Translation: %f, %f" % (initialParameters.GetElement(3), initialParameters.GetElement(4)) - -registration.SetInitialTransformParameters( initialParameters ) - -# -# Define optimizer parameters -# - -# optimizer scale -translationScale = 1.0 / 1000.0 - -optimizerScales = itkArrayD( transform.GetNumberOfParameters() ) -optimizerScales.SetElement(0, 1.0) -optimizerScales.SetElement(1, translationScale) -optimizerScales.SetElement(2, translationScale) -optimizerScales.SetElement(3, translationScale) -optimizerScales.SetElement(4, translationScale) - -optimizer.SetScales( optimizerScales ) -optimizer.SetMaximumStepLength( 0.1 ) -optimizer.SetMinimumStepLength( 0.001 ) -optimizer.SetNumberOfIterations( 200 ) - -# -# Iteration Observer -# -def iterationUpdate(): - currentParameter = transform.GetParameters() - print "M: %f P: %f %f %f %f %f " % ( optimizer.GetValue(), - currentParameter.GetElement(0), - currentParameter.GetElement(1), - currentParameter.GetElement(2), - currentParameter.GetElement(3), - currentParameter.GetElement(4) ) - -iterationCommand = itkPyCommand_New() -iterationCommand.SetCommandCallable( iterationUpdate ) -optimizer.AddObserver( itkIterationEvent(), iterationCommand.GetPointer() ) - -print "Starting registration" - -# -# Start the registration process -# - -registration.Update() - -# -# Get the final parameters of the transformation -# -finalParameters = registration.GetLastTransformParameters() - -print "Final Registration Parameters " -print "Angle in radians = %f" % finalParameters.GetElement(0) -print "Rotation Center X = %f" % finalParameters.GetElement(1) -print "Rotation Center Y = %f" % finalParameters.GetElement(2) -print "Translation in X = %f" % finalParameters.GetElement(3) -print "Translation in Y = %f" % finalParameters.GetElement(4) - -# Now, we use the final transform for resampling the moving image. -resampler = itkResampleImageFilterF2F2_New() - -resampler.SetTransform( transform.GetPointer() ) -resampler.SetInput( movingImage ) - -region = fixedImage.GetLargestPossibleRegion() - -resampler.SetSize( region.GetSize() ) -resampler.SetOutputSpacing( fixedImage.GetSpacing() ) -resampler.SetOutputOrigin( fixedImage.GetOrigin() ) -resampler.SetDefaultPixelValue( 100 ) - -# -# Cast for output -# -outputCast = itkRescaleIntensityImageFilterF2US2_New() -outputCast.SetInput( resampler.GetOutput() ) -outputCast.SetOutputMinimum( 0 ) -outputCast.SetOutputMaximum( 65535 ) - -writer = itkImageFileWriterUS2_New() - -writer.SetFileName( argv[3] ) -writer.SetInput( outputCast.GetOutput() ) -writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageToArray.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageToArray.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageToArray.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/ImageToArray.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -from InsightToolkit import * -from numarray import * -from sys import argv - -reader = itkImageFileReaderUC2_New() - -connector = itkPyBufferUC2_New() - -reader.SetFileName( argv[1] ) - -reader.Update() - -print "ready to convert image into array" - -buffer = connector.GetArrayFromImage( reader.GetOutput() ) - -writer = itkImageFileWriterUC2_New() - -writer.SetFileName( argv[2] ) - -print "ready to convert array into image" - -writer.SetInput( connector.GetImageFromArray( buffer ) ) - -writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/itkCurvatureFlowTestPython2.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/itkCurvatureFlowTestPython2.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/itkCurvatureFlowTestPython2.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/itkCurvatureFlowTestPython2.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -from InsightToolkit import * -import itktesting - -import sys -import os -import shutil - -basename = os.path.basename( sys.argv[0] ) -name = os.path.splitext( basename )[0] -dir = "Algorithms" - - -testInput = itktesting.ITK_TEST_INPUT -testOutput = itktesting.ITK_TEST_OUTPUT -baseLine = itktesting.ITK_TEST_BASELINE - - -reader = itkImageFileReaderF2_New() -reader.SetFileName( testInput+"/cthead1.png") - - -cf = itkCurvatureFlowImageFilterF2F2_New() -cf.SetInput( reader.GetOutput() ) -cf.SetTimeStep( 0.25 ) -cf.SetNumberOfIterations( 10 ) - - -cfss = itkShiftScaleImageFilterF2US2_New() -cfss.SetInput( cf.GetOutput() ) -cfss.SetShift( 0.7 ) -cfss.SetScale( 0.9 ) - - -valid = itkImageFileReaderUS2_New() -valid.SetFileName( baseLine+"/"+dir+"/"+name+".png") - - -diff = itkDifferenceImageFilterUS2_New() -diff.SetValidInput( valid.GetOutput() ) -diff.SetTestInput( cfss.GetOutput() ) -diff.SetToleranceRadius( 1 ) -diff.SetDifferenceThreshold( 0 ) - -diff.Update() - - -meanDiff = diff.GetMeanDifference() -totalDiff = diff.GetTotalDifference() - - -print "MeanDifference = ", meanDiff -print "TotalDifference = ", totalDiff - - -print "",meanDiff,"" -print "",totalDiff,"" - -if ( meanDiff > 0.1 ) : - convert = itkCastImageFilterUS2UC2_New() - rescale = itkRescaleIntensityImageFilterUS2UC2_New() - rescale.SetInput( diff.GetOutput() ) - rescale.SetOutputMinimum( 0 ) - rescale.SetOutputMaximum( 255 ) - - io = itkPNGImageIO_New() - io.SetUseCompression( 1 ) - io.SetCompressionLevel( 9 ) - - writer = itkImageFileWriterUC2_New() - writer.SetImageIO( io.GetPointer() ) - writer.SetInput( convert.GetOutput() ) - - writer.SetFileName( testOutput+"/"+name+".test.png" ) - convert.SetInput( cfss.GetOutput() ) - writer.Write() - - writer.SetFileName( testOutput+"/"+name+".diff.png" ) - writer.SetInput( rescale.GetOutput() ) - writer.Write() - - shutil.copyfile( baseLine+"/"+dir+"/"+name+".png", testOutput+"/"+name+".valid.png" ) - - print ""+testOutput+"/"+name+".test.png" - print ""+testOutput+"/"+name+".diff.png" - print ""+testOutput+"/"+name+".valid.png" - print "",rescale.GetShift(),"" - print "",rescale.GetScale(),"" - -# return 1 - - - -#return 0 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/VoronoiSegmentation.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/VoronoiSegmentation.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/VoronoiSegmentation.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/notYetUsable/VoronoiSegmentation.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# -# Example on the use of the VoronoiSegmentationImageFilter. -# - -from InsightToolkit import * - -from sys import argv - - -readerInput = itkImageFileReaderUC2_New() -readerPrior = itkImageFileReaderUC2_New() - -readerInput.SetFileName( argv[1] ) -readerPrior.SetFileName( argv[2] ) - -readerInput.Update() -readerPrior.Update() - -filter = itkVoronoiSegmentationImageFilterUC2UC2UC2_New() - -filter.SetInput( readerInput.GetOutput() ) -filter.TakeAPrior( readerPrior.GetOutput() ) - -filter.SetMeanPercentError( eval( argv[4] ) ) -filter.SetSTDPercentError( eval( argv[5] ) ) - -writer = itkImageFileWriterUC2_New() -writer.SetFileName( argv[3] ) -writer.SetInput( filter.GetOutput() ) - -writer.Update() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/pythonTestDriver.py.in otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/pythonTestDriver.py.in --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/pythonTestDriver.py.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Ruby/Tests/pythonTestDriver.py.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -#!@PYTHON_EXECUTABLE@ - -# set environment variables - -import os, subprocess, sys -from optparse import OptionParser - -# the environment needed to find the lib depend on the system -# I'm really not sure that's needed on all the systems... -# TODO: can we replace os.name by os.uname()[0] for all systems ? -env_lib_path = {"posix": "LD_LIBRARY_PATH", "mac": "DYLD_LIBRARY_PATH", "nt": "PATH"}[os.name] -# the environment needed to find the lib depend on the system -if os.name == "posix": - if os.uname()[0] == "Darwin" : - env_lib_path = "DYLD_LIBRARY_PATH" - else : - env_lib_path = "LD_LIBRARY_PATH" -elif os.name == "nt": - env_lib_path = "PATH" -else: - raise "Please add the library path for your system." -lib_path_list = "@PYTHON_TEST_LIB_PATH@".split(';') -if os.environ.has_key(env_lib_path) : - os.environ[env_lib_path] = os.pathsep.join(lib_path_list + [os.environ[env_lib_path]]) -else: - os.environ[env_lib_path] = os.pathsep.join(lib_path_list) - -env_python_path = "PYTHONPATH" -python_path_list = "@PYTHON_TEST_PYTHON_PATH@".split(';') -if os.environ.has_key(env_python_path) : - os.environ[env_python_path] = os.pathsep.join(python_path_list + [os.environ[env_python_path]]) -else: - os.environ[env_python_path] = os.pathsep.join(python_path_list) - -env_wrapitk_python_path = "WRAPITK_PYTHON_PATH" -wrapitk_python_path_list = "@PYTHON_TEST_WRAPITK_PYTHON_PATH@".split(';') -if os.environ.has_key(env_wrapitk_python_path) : - os.environ[env_wrapitk_python_path] = os.pathsep.join(wrapitk_python_path_list + [os.environ[env_wrapitk_python_path]]) -else: - os.environ[env_wrapitk_python_path] = os.pathsep.join(wrapitk_python_path_list) - - - -# setup the option manager to be able to compare the resulting images in the same test - -optionParser = OptionParser(usage="usage: %prog [--compare image1 image2] test.py [arg1 [arg2 [...]]]") -optionParser.add_option("-c", "--compare", action="append", dest="compare", default=[], metavar="IMAGE1 IMAGE2", nargs=2, help="compare IMAGE1 and IMAGE2 and exit with an error if the images are different. This options can appear several times to compare several images.") -optionParser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, help="display the command line before running the programs.") - -(options, args) = optionParser.parse_args() - -if len(args) < 1: - optionParser.print_usage(sys.stderr) - sys.exit(1) - -# call the program, and exit if it fail - -command = ["@PYTHON_EXECUTABLE@"] + args -if options.verbose: - print >> sys.stderr, "+", " ".join(command) -returnValue = subprocess.call( command ) -if returnValue != 0 : - sys.exit( returnValue ) - -# compare the images if needed -for imageFile1, imageFile2 in options.compare : - command = ["@IMAGE_COMPARE@", imageFile1, imageFile2] - if options.verbose: - print >> sys.stderr, "+", " ".join(command) - returnValue = subprocess.call( command ) - if returnValue != 0 : - sys.exit( returnValue ) - - -# everything suceed - just exit -sys.exit(0) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/CMakeLists.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/CMakeLists.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -1,16 +1,22 @@ ############################################################################### -# find swig -#find_package(SWIG REQUIRED) -#include(${SWIG_USE_FILE}) +# Find python +find_package(PythonInterp REQUIRED) ############################################################################### # Build swig option(ITK_USE_SYSTEM_SWIG "Use system swig. If OFF, swig is built as an external project." OFF) -set(swig_version 2.0.4) -set(swig_md5 4319c503ee3a13d2a53be9d828c3adc0) -set(swigwin_md5 4ab8064b1a8894c8577ef9d0fb2523c8) +# Require at least SWIG 3.0.0 +if(ITK_USE_SYSTEM_SWIG) + if(${SWIG_VERSION} VERSION_LESS 3.0.0) + message(WARNING "Swig version less than 3.0.0: \"${SWIG_VERSION}\".") + endif() +endif() + +set(swig_version 3.0.2) +set(swig_md5 62f9b0d010cef36a13a010dc530d0d41) +set(swigwin_md5 3f18de4fc09ab9abb0d3be37c11fbc8f) if(WIN32) set(swig_ep "${CMAKE_CURRENT_BINARY_DIR}/swigwin-${swig_version}/swig.exe") @@ -35,6 +41,7 @@ else() include(ExternalProject) if(WIN32) + itk_download_attempt_check(SWIG) ExternalProject_Add(swig URL http://prdownloads.sourceforge.net/swig/swigwin-${swig_version}.zip URL_MD5 ${swigwin_md5} @@ -61,9 +68,10 @@ # CXXCPP C++ preprocessor # build swig as an external project - ExternalProject_add(PCRE - URL http://downloads.sourceforge.net/project/pcre/pcre/8.12/pcre-8.12.tar.gz - URL_MD5 fa69e4c5d8971544acd71d1f10d59193 + itk_download_attempt_check(PCRE) + ExternalProject_Add(PCRE + URL http://downloads.sourceforge.net/project/pcre/pcre/8.35/pcre-8.35.tar.gz + URL_MD5 ed58bcbe54d3b1d59e9f5415ef45ce1c CONFIGURE_COMMAND env "CC=${CMAKE_C_COMPILER} ${CMAKE_C_COMPILER_ARG1}" @@ -107,7 +115,8 @@ # This script will default YFLAGS to the empty string to avoid a # default value of `-d' given by some make applications. - ExternalProject_add(swig + itk_download_attempt_check(SWIG) + ExternalProject_Add(swig URL http://prdownloads.sourceforge.net/swig/swig-${swig_version}.tar.gz URL_MD5 ${swig_md5} CONFIGURE_COMMAND @@ -133,12 +142,10 @@ set(SWIG_EXECUTABLE ${swig_ep} CACHE FILEPATH "swig executable." FORCE) endif() - ############################################################################### -# find python -find_package(PythonInterp REQUIRED) -set(CABLE_INDEX ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/idx.py CACHE INTERNAL "cableidx path") +set(IDX_GENERATOR ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/idx.py CACHE INTERNAL "idx generator path") +set(PYGCCXML_DIR ${CMAKE_SOURCE_DIR}/Modules/ThirdParty/pygccxml/src CACHE INTERNAL "pygccxml path") ############################################################################### # install the files requires for swiginterface @@ -149,12 +156,9 @@ WRAP_ITK_INSTALL(/Configuration/Generators/SwigInterface module.i.in) WRAP_ITK_INSTALL(/Configuration/Generators/SwigInterface module.includes.in) - install(DIRECTORY pygccxml-1.0.0 + install(DIRECTORY ${PYGCCXML_DIR} DESTINATION "${WRAP_ITK_INSTALL_PREFIX}/Configuration/Generators/SwigInterface" - PATTERN ".svn" EXCLUDE - PATTERN "CVS" EXCLUDE - PATTERN "docs" EXCLUDE - PATTERN "unittests" EXCLUDE + PATTERN ".git" EXCLUDE ) install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/idx.py" @@ -244,15 +248,6 @@ # set(opts ${opts} --import "${bi}") # endforeach() - # message("${opts}") - - # configure the test driver, to set the python path to the pygccxml dir - # find_program(ITK_TEST_DRIVER itkTestDriver) - # set(PYTHON_PYGCCXML_DRIVER "${ITK_TEST_DRIVER}" - # --add-before-env PYTHONPATH "${WRAP_ITK_CMAKE_DIR}/pygccxml-1.0.0/" - # "${PYTHON_EXECUTABLE}" - # ) - if(ITK_WRAP_EXPLICIT) set(opts ${opts} --include "${WRAPPER_LIBRARY_NAME}Explicit.h") endif() @@ -267,12 +262,13 @@ # --include ${WRAPPER_LIBRARY_NAME}.includes # --import ${module_interface_file} --swig-include ${module}_ext.i - -w1 -w3 -w51 -w52 -w53 -w54 #--warning-error + -w1 -w3 -w51 -w52 -w53 -w54 -A protected -A private + -p ${PYGCCXML_DIR} + -g ${GCCXML} --typedef-input ${typedef_in_file} --typedef-output ${typedef_file} --include ${module}SwigInterface.h - # --verbose ${xml_file} ${interface_file} DEPENDS ${DEPS} ${idx_files} ${IGENERATOR} # ${SWIG_INTERFACE_IDX_FILES} ${SWIG_INTERFACE_FILES} ${typedef_in_file} # ${includes_file} @@ -350,7 +346,6 @@ # variables used: # WRAPPER_LIBRARY_NAME # WRAPPER_LIBRARY_OUTPUT_DIR - # WRAPPER_LIBRARY_CABLESWIG_INPUTS # WRAPPER_LIBRARY_DEPENDS # WRAPPER_MASTER_INDEX_OUTPUT_DIR # MODULE_INCLUDES @@ -384,9 +379,9 @@ set(idx_file "${WRAPPER_MASTER_INDEX_OUTPUT_DIR}/${module}.idx") add_custom_command( OUTPUT ${idx_file} - COMMAND ${CABLE_INDEX} - ${xml_file} ${idx_file} - DEPENDS ${CABLE_INDEX} ${xml_file} + COMMAND ${IDX_GENERATOR} + ${PYGCCXML_DIR} ${GCCXML} ${xml_file} ${idx_file} + DEPENDS ${IDX_GENERATOR} ${xml_file} ) WRAP_ITK_INSTALL("/Configuration/Typedefs/" "${idx_file}") # add_custom_target(${module}Idx DEPENDS ${idx_file}) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/idx.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/idx.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/idx.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/idx.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,41 +1,64 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import sys, os -sys.path.append(sys.path[0]+os.sep+'pygccxml-1.0.0') - -import pygccxml, sys, cStringIO +# Import unicode literals so that StringIO works on both Python 2 and 3 +from __future__ import unicode_literals +from __future__ import print_function + +import sys +import os + +try: + # Python 3 + from io import StringIO +except ImportError: + # Python 2 + from cStringIO import StringIO + +pygccxmlPath = sys.argv[1] +gccxmlPath = sys.argv[2] +xmlFilePath = sys.argv[3] +idxFilePath = sys.argv[4] + +sys.path.append(pygccxmlPath) +import warnings +# Temporarly hide pygccxml warnings +# Import normally once pygccxml 1.6.0 is out +warnings.filterwarnings("ignore", category=UserWarning) +warnings.filterwarnings("ignore", category=DeprecationWarning) +import pygccxml # the output file -outputFile = cStringIO.StringIO() +outputFile = StringIO() # init the pygccxml stuff pygccxml.declarations.scopedef_t.RECURSIVE_DEFAULT = False pygccxml.declarations.scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER = True -pygccxml_config = pygccxml.parser.config.config_t() -pygccxml_reader = pygccxml.parser.source_reader.source_reader_t(pygccxml_config) +pygccxml_config = pygccxml.parser.config.gccxml_configuration_t( + gccxml_path=gccxmlPath) +pygccxml_reader = pygccxml.parser.source_reader.source_reader_t( + pygccxml_config) # and read a xml file -res = pygccxml_reader.read_xml_file(sys.argv[1]) +res = pygccxml_reader.read_xml_file(xmlFilePath) -global_ns = pygccxml.declarations.get_global_namespace( res ) +global_ns = pygccxml.declarations.get_global_namespace(res) cable_ns = global_ns.namespace('_cable_') wrappers_ns = cable_ns.namespace('wrappers') -module = os.path.splitext(os.path.basename(sys.argv[1]))[0] +module = os.path.splitext(os.path.basename(xmlFilePath))[0] # iterate over all the typedefs in the _cable_::wrappers namespace for typedef in wrappers_ns.typedefs(): - n = typedef.name - s = typedef.type.decl_string - # drop the :: prefix - it make swig produce invalid code - if s.startswith("::"): - s = s[2:] - print >> outputFile, "{%s} {%s} {%s}" % (s, n, module) + n = typedef.name + s = typedef.type.decl_string + # drop the :: prefix - it make swig produce invalid code + if s.startswith("::"): + s = s[2:] + outputFile.write("{%s} {%s} {%s}\n" % (s, n, module)) content = outputFile.getvalue() -if sys.argv[2] != '-': - f = file( sys.argv[2], "w" ) - f.write( content ) - f.close() +if idxFilePath != '-': + with open(idxFilePath, "w") as f: + f.write(content) else: - sys.stdout.write( content ) + sys.stdout.write(content) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/igenerator.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/igenerator.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/igenerator.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/igenerator.py 2014-09-03 08:29:34.000000000 +0000 @@ -1,33 +1,146 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -import sys, os -sys.path.append(sys.path[0]+os.sep+'pygccxml-1.0.0') - -import pygccxml, sys, re, cStringIO, time, os +# Import unicode literals so that StringIO works on both Python 2 and 3 +from __future__ import unicode_literals +from __future__ import print_function + +import sys +import os +import re +import time from optparse import OptionParser +try: + # Python 3 + from io import StringIO +except ImportError: + # Python 2 + from cStringIO import StringIO + # Start process time measurement t0 = time.clock() optionParser = OptionParser() -optionParser.add_option("--idx", action="append", dest="idx", default=[], metavar="FILE", help="idx file to be used.") -optionParser.add_option("--mdx", action="append", dest="mdx", default=[], metavar="FILE", help="master idx file to be used.") -optionParser.add_option("--include", action="append", dest="includes", default=[], metavar="FILE", help="File to be included in the generated interface file.") -optionParser.add_option("--take-includes", action="append", dest="take_includes", default=[], metavar="FILE", help="File which contains the include to take, and include in the generated interface file.") -optionParser.add_option("--swig-include", action="append", dest="swig_includes", default=[], metavar="FILE", help="File to be included by swig (%include) in the generated interface file.") -optionParser.add_option("--import", action="append", dest="imports", default=[], metavar="FILE", help="File to be imported in the generated interface file.") -optionParser.add_option("--typedef-input", action="store", type="string", dest="typedef_input") -optionParser.add_option("--typedef-output", action="store", type="string", dest="typedef_output") -optionParser.add_option("-w", "--disable-warning", action="append", dest="warnings", default=[], metavar="WARNING", help="Warning to be disabled.") -optionParser.add_option("-A", "--disable-access-warning", action="append", dest="access_warnings", default=[], metavar="LEVEL", help="Access level where warnings are disabled (public, protected, private).") -optionParser.add_option("-W", "--warning-error", action="store_true", dest="warningError", help="Treat warnings as errors.") -optionParser.add_option("-v", "--verbose", action="store_true", dest="verbose", help="Log what is currently done.") -optionParser.add_option("-k", "--keep", action="store_true", dest="keep", help="Don't rewrite the output file if the content is unchanged.") +optionParser.add_option( + "--idx", + action="append", + dest="idx", + default=[], + metavar="FILE", + help="idx file to be used.") +optionParser.add_option( + "--mdx", + action="append", + dest="mdx", + default=[], + metavar="FILE", + help="master idx file to be used.") +optionParser.add_option( + "--include", + action="append", + dest="includes", + default=[], + metavar="FILE", + help="File to be included in the generated interface file.") +optionParser.add_option( + "--take-includes", + action="append", + dest="take_includes", + default=[], + metavar="FILE", + help=( + "File which contains the include to take, and include in the " + "generated interface file.")) +optionParser.add_option( + "--swig-include", + action="append", + dest="swig_includes", + default=[], + metavar="FILE", + help=( + "File to be included by swig (%include) in the generated " + "interface file.")) +optionParser.add_option( + "--import", + action="append", + dest="imports", + default=[], + metavar="FILE", + help="File to be imported in the generated interface file.") +optionParser.add_option( + "--typedef-input", + action="store", + type="string", + dest="typedef_input") +optionParser.add_option( + "--typedef-output", + action="store", + type="string", + dest="typedef_output") +optionParser.add_option( + "-w", + "--disable-warning", + action="append", + dest="igenerator_warnings", + default=[], + metavar="WARNING", + help="Warning to be disabled.") +optionParser.add_option( + "-A", + "--disable-access-warning", + action="append", + dest="access_warnings", + default=[], + metavar="LEVEL", + help=( + "Access level where warnings are disabled " + "(public, protected, private).")) +optionParser.add_option( + "-W", + "--warning-error", + action="store_true", + dest="warningError", + help="Treat warnings as errors.") +optionParser.add_option( + "-v", + "--verbose", + action="store_true", + dest="verbose", + help="Log what is currently done.") +optionParser.add_option( + "-k", + "--keep", + action="store_true", + dest="keep", + help="Don't rewrite the output file if the content is unchanged.") +optionParser.add_option( + "-p", + "--pygccxml-path", + action="store", + dest="pygccxml_path", + help="Path to pygccxml") +optionParser.add_option( + "-g", + "--gccxml-path", + action="store", + dest="gccxml_path", + help="Path to gccxml") options, args = optionParser.parse_args() +sys.path.append(options.pygccxml_path) +import warnings +# Temporarly hide pygccxml warnings +# Import normally once pygccxml 1.6.0 is out +warnings.filterwarnings("ignore", category=UserWarning) +warnings.filterwarnings("ignore", category=DeprecationWarning) +import pygccxml + +# Apply file, for passing std::string as reference in methods +applyFile = StringIO() +applyFileNames = [] # the output file -outputFile = cStringIO.StringIO() +outputFile = StringIO() # a dict to let us use the alias name instead of the full c++ name. Without # that, in many cases, swig don't know that's the same type @@ -41,60 +154,71 @@ typedefSource = {} -warnings = set() +igenerator_warnings = set() + + +def igenerator_warn(id, msg, doWarn=True): + if not doWarn: + # don't warn for anything + return + if str(id) not in options.igenerator_warnings: + if not options.verbose and (id, msg) in igenerator_warnings: + # just do nothing + return + igenerator_warnings.add((id, msg)) + if options.verbose: + if options.warningError: + print("error(%s): %s" % (str(id), msg), file=sys.stderr) + else: + print("warning(%s): %s" % (str(id), msg), file=sys.stderr) + else: + if options.warningError: + print( + "%s: error(%s): %s" % + (args[0], str(id), msg), file=sys.stderr) + else: + print( + "%s: warning(%s): %s" % + (args[0], str(id), msg), file=sys.stderr) -def warn( id, msg, doWarn=True ): - if not doWarn: - # don't warn for anything - return - if str(id) not in options.warnings: - if not options.verbose and (id, msg) in warnings: - # just do nothing - return - warnings.add((id, msg)) + +def info(msg): if options.verbose: - if options.warningError: - print >> sys.stderr, "error(%s): %s" % (str(id), msg) - else: - print >> sys.stderr, "warning(%s): %s" % (str(id), msg) - else: - if options.warningError: - print >> sys.stderr, "%s: error(%s): %s" % (args[0], str(id), msg) - else: - print >> sys.stderr, "%s: warning(%s): %s" % (args[0], str(id), msg) - -def info( msg ): - if options.verbose: - print >> sys.stderr, "info: %s" % msg + print("info: %s" % msg, file=sys.stderr) notWrapped = [ - "itk::SmartPointerForwardReference<.+>", - "itk::LibHandle", - "itk::NeighborhoodAllocator<.+>", - "itk::ImageRegion<.+>", # to avoid wrapping all the region for all the dims - "itk::ImportImageContainer<.+>", - "itk::DefaultPixelAccessor<.+>", - "itk::NeighborhoodAccessorFunctor<.+>", - "itk::DefaultVectorPixelAccessor<.+>", - "itk::VectorImageNeighborhoodAccessorFunctor<.+>", - "itk::.*Iterator.*", # TODO: remove this one ? - "itk::Neighborhood<.+>", # TODO: remove this one - "itk::ThreadFunctionType", - "itk::Functor::.+", - "itk::SmartPointer< itk::Functor::.+", - "itk::Function::.+", - "itk::.+Function.*", # Level set functions - "itk::InterpolateImageFunction<.+>", # use one more dimension than the wrapped one - "itk::watershed::.+", # ignore the internal classes of the watershed - "itk::SmartPointer< itk::VoronoiDiagram2D<.+> >", # require to wrap too more type - "itk::Image< itk::CovariantVector< double, \d+u >, \d+u >", # used internally in ImageToImageMetric + "itk::SmartPointerForwardReference<.+>", + "itk::LibHandle", + "itk::NeighborhoodAllocator<.+>", + # to avoid wrapping all the region for all the dims + "itk::ImageRegion<.+>", + "itk::ImportImageContainer<.+>", + "itk::DefaultPixelAccessor<.+>", + "itk::NeighborhoodAccessorFunctor<.+>", + "itk::DefaultVectorPixelAccessor<.+>", + "itk::VectorImageNeighborhoodAccessorFunctor<.+>", + "itk::.*Iterator.*", # TODO: remove this one ? + "itk::Neighborhood<.+>", # TODO: remove this one + "itk::ThreadFunctionType", + "itk::Functor::.+", + "itk::SmartPointer< itk::Functor::.+", + "itk::Function::.+", + "itk::.+Function.*", # Level set functions + # use one more dimension than the wrapped one + "itk::InterpolateImageFunction<.+>", + "itk::watershed::.+", # ignore the internal classes of the watershed + # require to wrap too more type + "itk::SmartPointer< itk::VoronoiDiagram2D<.+> >", + # used internally in ImageToImageMetric + "itk::Image< itk::CovariantVector< double, \d+u >, \d+u >", ] -notWrappedRegExp = re.compile( "|".join( [ "^"+s+"$" for s in notWrapped] ) ) +notWrappedRegExp = re.compile("|".join(["^" + s + "$" for s in notWrapped])) # vcl_complex code -vcl_complex_headers = {"D": """ class vcl_complexD { +vcl_complex_headers = { + "D": """ class vcl_complexD { public: ~vcl_complexD(); vcl_complexD & operator=(vcl_complexD const & arg0); @@ -118,7 +242,7 @@ }; """, -"F": """class vcl_complexF { + "F": """class vcl_complexF { public: ~vcl_complexF(); vcl_complexF & operator=(vcl_complexF const & arg0); @@ -142,7 +266,7 @@ }; """, -"LD" : """ class vcl_complexLD { + "LD": """ class vcl_complexLD { public: ~vcl_complexLD(); vcl_complexLD & operator=(vcl_complexLD const & arg0); @@ -164,430 +288,535 @@ private: protected: }; -""" -} - -def getType(v): - if hasattr(v, "type"): - return getType(v.type) - if hasattr(v, "declaration"): - return getType(v.declaration) - return v - -def getDeclarationString(t): - t = getType(t) - if t.decl_string == "::PyObject *": - # don't go further - we want to keep that one as is - return "::PyObject *" - if isinstance(t, pygccxml.declarations.cpptypes.pointer_t): - return getDeclarationString(getType(t.base)) + " *" - elif isinstance(t, pygccxml.declarations.cpptypes.const_t): - return getDeclarationString(getType(t.base)) + " const" - elif isinstance(t, pygccxml.declarations.cpptypes.reference_t): - return getDeclarationString(getType(t.base)) + " &" - return t.decl_string +"""} -def renameTypesInSTL( s ): - if s.startswith( "std::" ) and pygccxml.declarations.templates.is_instantiation(s): - args = [] - for arg in pygccxml.declarations.templates.args(s): - t, d = typeAndDecorators( arg ); - args.append( renameTypesInSTL( get_alias( t ) ) + d ) - return pygccxml.declarations.templates.join( pygccxml.declarations.templates.name(s), args ) + typeAndDecorators( s )[1] - return s +def getType(v): + if hasattr(v, "type"): + return getType(v.type) + if hasattr(v, "declaration"): + return getType(v.declaration) + return v -def removeStdAllocator( s ): - if pygccxml.declarations.templates.is_instantiation(s): - args = [] - for arg in pygccxml.declarations.templates.args(s): - if not arg.startswith("std::allocator"): - t, d = typeAndDecorators( arg ); - args.append( removeStdAllocator( t ) + d ) - return pygccxml.declarations.templates.join( pygccxml.declarations.templates.name(s), args ) + typeAndDecorators( s )[1] - return s - - -def typeAndDecorators( s ): - end = "" - s = s.strip() - ends = [" ", "*", "&", "const"] - needToContinue = True - while needToContinue: - needToContinue = False - for e in ends: - if s.endswith( e ): - end = e + end - s = s[:-len(e)] - needToContinue = True - return (s, end) - - -def get_alias( decl_string, w=True ): - s = str(decl_string) - - # drop the :: prefix - it make swig produce invalid code - if s.startswith("::"): - s = s[2:] - - # normalize string - s = normalize( s ) - - # workaround a bug - or is it a feature ? - somewhere - s = s.replace("complex float", "std::complex") - s = s.replace("complex double", "std::complex") - s = s.replace("complex long double", "std::complex") - - (s, end) = typeAndDecorators( s ) - - if aliases.has_key( s ): -# print >> sys.stderr, s, end, " ", aliases[s] - usedTypes.add( aliases[s] ) - return aliases[s] + end - - if s.startswith("itk::Templates::"): - # that's a explicitly instantiated type. The name is the same than the WraITK - # one, so lets use it as a base for WrapITK - # Ex: itk::Templates::RGBPixelUC - # don't store the new string in s, because we need it unchanged if the type is - # explicitly instantiated, but not wrapped - new_s = s.replace("::Templates::", "") - if new_s.split("::")[0] in aliases.values(): - usedTypes.add( new_s ) - return new_s + end - - if s[:s.rfind("::")] in aliases: - # take care of subtypes/enum/... - alias = aliases[ s[:s.rfind("::")] ] + s[s.rfind("::"):] - usedTypes.add( alias ) - return alias + end - - # replace the types defined in this type, to support std::vector for example - s = renameTypesInSTL( s ) - - # drop the allocator part of the type, because it is not supported by the %template directive with some generators (like tcl) - s = removeStdAllocator( s ) - - # rename basic_string to std::string to make name shorter - s = s.replace("std::basic_string< char, std::char_traits< char > >", "std::string") - - # rename some types not renamed by gccxml (why ?) - s = s.replace( "itk::SerieUIDContainer", "std::vector< std::string >") - s = s.replace( "itk::FilenamesContainer", "std::vector< std::string >") - if s.startswith( "itk::") and not notWrappedRegExp.match( s ): - warn( 4, "ITK type not wrapped, or currently not known: %s" % s, w ) +def getDeclarationString(t): + t = getType(t) + if t.decl_string == "::PyObject *": + # don't go further - we want to keep that one as is + return "::PyObject *" + if isinstance(t, pygccxml.declarations.cpptypes.pointer_t): + return getDeclarationString(getType(t.base)) + " *" + elif isinstance(t, pygccxml.declarations.cpptypes.const_t): + return getDeclarationString(getType(t.base)) + " const" + elif isinstance(t, pygccxml.declarations.cpptypes.reference_t): + return getDeclarationString(getType(t.base)) + " &" + return t.decl_string + + +def renameTypesInSTL(s): + if s.startswith("std::") and \ + pygccxml.declarations.templates.is_instantiation(s): + args = [] + for arg in pygccxml.declarations.templates.args(s): + t, d = typeAndDecorators(arg) + args.append(renameTypesInSTL(get_alias(t)) + d) + return pygccxml.declarations.templates.join( + pygccxml.declarations.templates.name(s), + args) + typeAndDecorators(s)[1] + return s + + +def removeStdAllocator(s): + if pygccxml.declarations.templates.is_instantiation(s): + args = [] + for arg in pygccxml.declarations.templates.args(s): + if not arg.startswith("std::allocator"): + t, d = typeAndDecorators(arg) + args.append(removeStdAllocator(t) + d) + return pygccxml.declarations.templates.join( + pygccxml.declarations.templates.name(s), + args) + typeAndDecorators(s)[1] + return s + + +def typeAndDecorators(s): + end = "" + s = s.strip() + ends = [" ", "*", "&", "const"] + needToContinue = True + while needToContinue: + needToContinue = False + for e in ends: + if s.endswith(e): + end = e + end + s = s[:-len(e)] + needToContinue = True + return (s, end) + + +def get_alias(decl_string, w=True): + s = str(decl_string) + + # drop the :: prefix - it make swig produce invalid code + if s.startswith("::"): + s = s[2:] + + # normalize string + s = normalize(s) + + # workaround a bug - or is it a feature ? - somewhere + s = s.replace("complex float", "std::complex") + s = s.replace("complex double", "std::complex") + s = s.replace("complex long double", "std::complex") + + (s, end) = typeAndDecorators(s) + + if s in aliases: + # print(s, end, " ", aliases[s], file=sys.stderr) + usedTypes.add(aliases[s]) + return aliases[s] + end + + if s.startswith("itk::Templates::"): + # that's a explicitly instantiated type. The name is the same than + # the WraITK one, so lets use it as a base for WrapITK + # Ex: itk::Templates::RGBPixelUC + # don't store the new string in s, because we need it unchanged if + # the type is explicitly instantiated, but not wrapped + new_s = s.replace("::Templates::", "") + if new_s.split("::")[0] in aliases.values(): + usedTypes.add(new_s) + return new_s + end + + if s[:s.rfind("::")] in aliases: + # take care of subtypes/enum/... + alias = aliases[s[:s.rfind("::")]] + s[s.rfind("::"):] + usedTypes.add(alias) + return alias + end + + # replace the types defined in this type, to support + # std::vector for example + s = renameTypesInSTL(s) + + # drop the allocator part of the type, because it is not supported by the + # %template directive with some generators (like tcl) + s = removeStdAllocator(s) + + # rename basic_string to std::string to make name shorter + s = s.replace( + "std::basic_string< char, std::char_traits< char > >", + "std::string") + + # rename some types not renamed by gccxml (why ?) + s = s.replace("itk::SerieUIDContainer", "std::vector< std::string >") + s = s.replace("itk::FilenamesContainer", "std::vector< std::string >") + + if s.startswith("itk::") and not notWrappedRegExp.match(s): + igenerator_warn( + 4, + "ITK type not wrapped, or currently not known: %s" % + s, + w) - usedTypes.add( s ) - return s + end + usedTypes.add(s) + return s + end def load_idx(file_name): - f = file(file_name) - for l in f: - (full_name, alias, module) = re.findall(r'{(.*)} {(.*)} {(.*)}', l)[0] - # workaround lack of :: prefix in idx files - # TODO: would it be better to remove the :: prefix in the output of pygccxml ? - # full_name = "::"+full_name - # normalize some basic type names - full_name = normalize( full_name ) - # TODO: add a warning if the type is defined several times - aliases[ full_name ] = alias - # store the source of the def - if typedefSource.has_key( alias ) and file_name != typedefSource[ alias ]: - warn( 7, "%s in %s is already defined in %s." % (alias, file_name, typedefSource[ alias ]) ) - else: - typedefSource[ alias ] = file_name - # don't declare the typedef - they are included from .include files - # print >> outputFile, "typedef %s %s;" % (full_name, alias) - f.close() + with open(file_name, "r") as f: + for l in f: + (full_name, alias, module) = \ + re.findall(r'{(.*)} {(.*)} {(.*)}', l)[0] + # workaround lack of :: prefix in idx files + # TODO: would it be better to remove the :: prefix in the output of + # pygccxml ? + # full_name = "::"+full_name + # normalize some basic type names + full_name = normalize(full_name) + # TODO: add a warning if the type is defined several times + aliases[full_name] = alias + # store the source of the def + if alias in typedefSource and file_name != typedefSource[alias]: + igenerator_warn( + 7, "%s in %s is already defined in %s." % + (alias, file_name, typedefSource[alias])) + else: + typedefSource[alias] = file_name + # don't declare the typedef - they are included from .include files + # outputFile.write("typedef %s %s;\n" % (full_name, alias)) mdx_loaded = set() + + def load_mdx(file_name): - if file_name in mdx_loaded: - # already loaded - no need to do it again - return - mdx_loaded.add( file_name ) - f = file( file_name ) - ls = f.readlines() - f.close() - for l in ls : - if l.startswith( '%' ) or l.isspace(): - # exclude the lines which are starting with % - that's not the idx files - pass - elif l.strip().endswith(".mdx"): - load_mdx(os.path.dirname(file_name)+os.sep+l.strip()) - else: - load_idx(os.path.dirname(file_name)+os.sep+l.strip()) + if file_name in mdx_loaded: + # already loaded - no need to do it again + return + mdx_loaded.add(file_name) + with open(file_name, "r") as f: + ls = f.readlines() + for l in ls: + if l.startswith('%') or l.isspace(): + # exclude the lines which are starting with % - that's not the idx + # files + pass + elif l.strip().endswith(".mdx"): + load_mdx(os.path.dirname(file_name) + os.sep + l.strip()) + else: + load_idx(os.path.dirname(file_name) + os.sep + l.strip()) def normalize(name): - name = name.replace("short unsigned int", "unsigned short") - name = name.replace("long unsigned int", "unsigned long") - name = name.replace("short int", "short") - name = name.replace("long int", "long") + name = name.replace("short unsigned int", "unsigned short") + name = name.replace("long unsigned int", "unsigned long") + name = name.replace("short int", "short") + name = name.replace("long int", "long") # name = name.replace("unsigned int", "unsigned") - # normalize spaces - name = " ".join(name.replace(',', ', ').split()) - return name - - -def generate_class( typedef, indent=0 ): - info("Generating interface for %s." % typedef.name) - - if not typedef.name.startswith("vcl_complex"): - super_classes = [] - for super_class in typedef.type.declaration.bases: - super_classes.append( "%s %s" % ( super_class.access, get_alias(super_class.related_class.decl_string) ) ) - s = "" - if super_classes: - s = " : " + ", ".join( super_classes ) - print >> outputFile, " "*indent, "class %s%s {" % ( typedef.name, s ) - - # iterate over access - for access in pygccxml.declarations.ACCESS_TYPES.ALL: - - # print the access type - print >> outputFile, " "*indent, " %s:" % access - - # warnings or no warning? - w = access not in options.access_warnings - - # iterate over the members - for member in typedef.type.declaration.get_members( access=access ): - if isinstance( member, pygccxml.declarations.typedef.typedef_t ): - warn( 51, "Member typedef are not supported: %s" % member.name, w ) - elif isinstance( member, pygccxml.declarations.calldef.member_function_t ): - generate_method( typedef, member, indent, w ) - elif isinstance( member, pygccxml.declarations.calldef.constructor_t ): - generate_constructor( typedef, member, indent, w ) - elif isinstance( member, pygccxml.declarations.calldef.member_operator_t ): - generate_method( typedef, member, indent, w ) - elif isinstance( member, pygccxml.declarations.calldef.destructor_t ): - generate_destructor( typedef, member, indent, w ) - elif isinstance( member, pygccxml.declarations.enumeration.enumeration_t ): - generate_nested_enum( typedef, member, indent, w ) - elif isinstance( member, pygccxml.declarations.variable.variable_t ): - warn( 52, "Member variables are not supported: %s" % member.name, w ) - elif isinstance( member, pygccxml.declarations.class_declaration.class_t ): - warn( 53, "Member classes are not supported: %s" % member.name, w ) - elif isinstance( member, pygccxml.declarations.class_declaration.class_declaration_t ): - warn( 53, "Member classes are not supported: %s" % member.name, w ) - elif isinstance( member, pygccxml.declarations.calldef.casting_operator_t ): - warn( 54, "Member casting operators are not supported: %s" % member.name, w ) - else : - warn( 50, "Unknown member type: %s" % repr(member), w ) - - # finally, close the class - print >> outputFile, " "*indent, "};" - print >> outputFile - print >> outputFile - - elif typedef.name == "vcl_complexD": - print >> outputFile, vcl_complex_headers["D"] - elif typedef.name == "vcl_complexF": - print >> outputFile, vcl_complex_headers["F"] - elif typedef.name == "vcl_complexLD": - print >> outputFile, vcl_complex_headers["LD"] - else: - # vcl_complex is too difficult to wrap in some cases. Only wrap the constructor. - print >> outputFile, " "*indent, "class %s%s {" % ( typedef.name, s ) - - # iterate over access - for access in pygccxml.declarations.ACCESS_TYPES.ALL: - - # print the access type - print >> outputFile, " "*indent, " %s:" % access - - # warnings or no warning? - w = access not in options.access_warnings - for member in typedef.type.declaration.get_members( access=access ): - if isinstance( member, pygccxml.declarations.calldef.constructor_t ): - generate_constructor( typedef, member, indent, w ) - elif isinstance( member, pygccxml.declarations.calldef.destructor_t ): - generate_destructor( typedef, member, indent, w ) - # finally, close the class - print >> outputFile, " "*indent, "};" - print >> outputFile - print >> outputFile - - -def generate_constructor( typedef, constructor, indent, w ): - # iterate over the arguments - args = [] - for arg in constructor.arguments: - s = "%s %s" % (get_alias(getDeclarationString(arg), w), arg.name) - # append the default value if it exists - if arg.default_value: - s += " = %s" % arg.default_value - # and add the string to the arg list - args.append( s ) - print >> outputFile, " "*indent, " %s(%s);" % (typedef.name, ", ".join( args) ) - - -def generate_destructor( typedef, destructor, indent, w ): - print >> outputFile, " "*indent, " ~%s();" % typedef.name - - -def generate_enum( typedef ): - name = typedef.name - enum = typedef.type.declaration - decl_string = typedef.type.decl_string - # extract the namespace to put it in c++ code. Without that, the code generated by swig - # is wrong because it doesn't include the namespace - ns = "::".join( decl_string.split("::")[:-1]) - print >> outputFile, "%{" - print >> outputFile, "using namespace %s;" % ns - print >> outputFile, "%}" - content = [" %s = %i" % (key, value) for key, value in enum.values] - print >> outputFile, "enum %s { %s };" % ( name, ", ".join( content ) ) - - -def generate_nested_enum( typedef, enum, indent, w ): - content = [" %s = %i" % (key, value) for key, value in enum.values] - print >> outputFile, " "*indent, " enum %s { %s };" % ( enum.name, ", ".join( content ) ) - - -def generate_method( typedef, method, indent, w ): - info("Generating interface for method '%s::%s'." % (typedef.name, method.name) ) - # avoid the apply method for the class vnl_c_vector: the signature is quite strange - # and currently confuse swig :-/ - if "(" in method.return_type.decl_string : - warn( 1, "ignoring method not supported by swig '%s::%s'." % (typedef.name, method.name), w ) - return - - if ( (typedef.name.startswith('vnl_') and method.name in ["as_ref"]) - or (typedef.name.startswith('itk') and method.name in ["rBegin", "rEnd", "GetSpacingCallback", "GetOriginCallback", "Begin", "End"]) ) : - warn( 3, "ignoring black listed method '%s::%s'." % (typedef.name, method.name), w ) - return - - # iterate over the arguments - args = [] - for arg in method.arguments: - s = "%s %s" % (get_alias(getDeclarationString(arg), w), arg.name) - if "(" in s: - warn( 1, "ignoring method not supported by swig '%s::%s'." % (typedef.name, method.name), w ) - return - # append the default value if it exists - if arg.default_value: - s += " = %s" % arg.default_value - # and add the string to the arg list - args.append( s ) - - # find the method decorators - static = "" - const = "" - if method.has_static: - static = "static " - if method.has_const: - const = " const" - if method.virtuality != "not virtual": - static += "virtual " - if method.virtuality == "pure virtual": - const += " = 0" + # normalize spaces + name = " ".join(name.replace(',', ', ').split()) + return name + + +def generate_class(typedef, indent=0): + info("Generating interface for %s." % typedef.name) + + decls = pygccxml.declarations + + if not typedef.name.startswith("vcl_complex"): + super_classes = [] + for super_class in typedef.type.declaration.bases: + super_classes.append( + "%s %s" % + (super_class.access, + get_alias( + super_class.related_class.decl_string))) + s = "" + if super_classes: + s = " : " + ", ".join(super_classes) + outputFile.write(" " * indent) + outputFile.write("class %s%s {\n" % (typedef.name, s)) + + # iterate over access + for access in decls.ACCESS_TYPES.ALL: + + # the access type + outputFile.write(" " * indent) + outputFile.write(" %s:" % access) + + # warnings or no warning? + w = access not in options.access_warnings + + # iterate over the members + for member in typedef.type.declaration.get_members(access=access): + if isinstance(member, decls.typedef.typedef_t): + igenerator_warn( + 51, + "Member typedef are not supported: %s" % + member.name, + w) + elif isinstance(member, decls.calldef.member_function_t): + generate_method(typedef, member, indent, w) + elif isinstance(member, decls.calldef.constructor_t): + generate_constructor(typedef, member, indent, w) + elif isinstance(member, decls.calldef.member_operator_t): + generate_method(typedef, member, indent, w) + elif isinstance(member, decls.calldef.destructor_t): + generate_destructor(typedef, member, indent, w) + elif isinstance(member, decls.enumeration.enumeration_t): + generate_nested_enum(typedef, member, indent, w) + elif isinstance(member, decls.variable.variable_t): + igenerator_warn( + 52, + "Member variables are not supported: %s" % + member.name, + w) + elif isinstance(member, decls.class_declaration.class_t): + igenerator_warn( + 53, + "Member classes are not supported: %s" % + member.name, + w) + elif isinstance( + member, decls.class_declaration.class_declaration_t): + igenerator_warn( + 53, + "Member classes are not supported: %s" % + member.name, + w) + elif isinstance(member, decls.calldef.casting_operator_t): + igenerator_warn( + 54, + "Member casting operators are not supported: %s" % + member.name, + w) + else: + igenerator_warn( + 50, + "Unknown member type: %s" % + repr(member), + w) + + # finally, close the class + outputFile.write(" " * indent) + outputFile.write("};\n\n\n") + + elif typedef.name == "vcl_complexD": + outputFile.write(vcl_complex_headers["D"] + '\n') + elif typedef.name == "vcl_complexF": + outputFile.write(vcl_complex_headers["F"] + '\n') + elif typedef.name == "vcl_complexLD": + outputFile.write(vcl_complex_headers["LD"] + '\n') + else: + # vcl_complex is too difficult to wrap in some cases. Only wrap the + # constructor. + outputFile.write(" " * indent) + outputFile.write("class %s%s {\n" % (typedef.name, s)) + + # iterate over access + for access in pygccxml.declarations.ACCESS_TYPES.ALL: + + # the access type + outputFile.write(" " * indent) + outputFile.write(" %s:\n" % access) + + # warnings or no warning? + w = access not in options.access_warnings + for member in typedef.type.declaration.get_members(access=access): + if isinstance(member, decls.calldef.constructor_t): + generate_constructor(typedef, member, indent, w) + elif isinstance(member, decls.calldef.destructor_t): + generate_destructor(typedef, member, indent, w) + # finally, close the class + outputFile.write(" " * indent) + outputFile.write("};\n\n\n") - print >> outputFile, " "*indent, " %s%s %s(%s)%s;" % (static, get_alias(getDeclarationString(method.return_type), w), method.name, ", ".join( args), const ) +def generate_constructor(typedef, constructor, indent, w): + # iterate over the arguments + args = [] + for arg in constructor.arguments: + s = "%s %s" % (get_alias(getDeclarationString(arg), w), arg.name) + # append the default value if it exists + if arg.default_value: + s += " = %s" % arg.default_value + # and add the string to the arg list + args.append(s) + outputFile.write(" " * indent) + outputFile.write(" %s(%s);\n" % (typedef.name, ", ".join(args))) + + +def generate_destructor(typedef, destructor, indent, w): + outputFile.write(" " * indent) + outputFile.write(" ~%s();\n" % typedef.name) + + +def generate_enum(typedef): + name = typedef.name + enum = typedef.type.declaration + decl_string = typedef.type.decl_string + # extract the namespace to put it in c++ code. Without that, the code + # generated by swig + # is wrong because it doesn't include the namespace + ns = "::".join(decl_string.split("::")[:-1]) + outputFile.write("%{\n") + outputFile.write("using namespace %s;\n" % ns) + outputFile.write("%}\n") + content = [" %s = %i" % (key, value) for key, value in enum.values] + outputFile.write("enum %s { %s };\n" % (name, ", ".join(content))) + + +def generate_nested_enum(typedef, enum, indent, w): + content = [" %s = %i" % (key, value) for key, value in enum.values] + outputFile.write(" " * indent) + outputFile.write(" enum %s { %s };\n" % (enum.name, ", ".join(content))) + + +def generate_method(typedef, method, indent, w): + info( + "Generating interface for method '%s::%s'." % + (typedef.name, method.name)) + # avoid the apply method for the class vnl_c_vector: the signature is + # quite strange and currently confuse swig :-/ + if "(" in method.return_type.decl_string: + igenerator_warn( + 1, "ignoring method not supported by swig '%s::%s'." % + (typedef.name, method.name), w) + return + + names = [ + "rBegin", + "rEnd", + "GetSpacingCallback", + "GetOriginCallback", + "Begin", + "End"] + + if ((typedef.name.startswith('vnl_') and method.name in ["as_ref"]) + or (typedef.name.startswith('itk') and method.name in names)): + igenerator_warn( + 3, "ignoring black listed method '%s::%s'." % + (typedef.name, method.name), w) + return + # iterate over the arguments + args = [] + for arg in method.arguments: + s = "%s %s" % (get_alias(getDeclarationString(arg), w), arg.name) + if "(" in s: + igenerator_warn( + 1, "ignoring method not supported by swig '%s::%s'." % + (typedef.name, method.name), w) + return + # append the default value if it exists + if arg.default_value: + s += " = %s" % arg.default_value + # and add the string to the arg list + args.append(s) + + # find the method decorators + static = "" + const = "" + if method.has_static: + static = "static " + if method.has_const: + const = " const" + if method.virtuality != "not virtual": + static += "virtual " + if method.virtuality == "pure virtual": + const += " = 0" + + outputFile.write(" " * indent) + outputFile.write( + " %s%s %s(%s)%s;\n" % + (static, + get_alias( + getDeclarationString( + method.return_type), + w), + method.name, + ", ".join(args), + const)) + + # Check the method arguments for std::string passed by reference. + # In this case, save the name of the argument in the applyFileNames list + # for further usage. + for arg in method.arguments: + # arg.type is an instance, there is no clean API in pygccxml to get the + # name of the type as a string. This functionnality needs to be added + # to pygccxml. Meanwhile, we can use the __str__() method. + if arg.type.__str__() == "std::string &": + applyFileNames.append(arg.name) # init the pygccxml stuff pygccxml.declarations.scopedef_t.RECURSIVE_DEFAULT = False pygccxml.declarations.scopedef_t.ALLOW_EMPTY_MDECL_WRAPPER = True -# pass a fake gccxml path: it is not used here, but is required by -# pygccxml -pygccxml_config = pygccxml.parser.config.config_t() -#pygccxml_config = pygccxml.parser.config.config_t("gccxml") +pygccxml_config = pygccxml.parser.config.gccxml_configuration_t( + gccxml_path=options.gccxml_path) # create a reader -pygccxml_reader = pygccxml.parser.source_reader.source_reader_t(pygccxml_config) +pygccxml_reader = pygccxml.parser.source_reader.source_reader_t( + pygccxml_config) # and read a xml file info("Processing %s." % args[0]) res = pygccxml_reader.read_xml_file(args[0]) -global_ns = pygccxml.declarations.get_global_namespace( res ) +global_ns = pygccxml.declarations.get_global_namespace(res) cable_ns = global_ns.namespace('_cable_') wrappers_ns = cable_ns.namespace('wrappers') -# pygccxml.declarations.print_declarations( global_ns ) moduleName = cable_ns.variable('group').value[len('(const char*)"'):-1] # and begin to write the output -headerFile = cStringIO.StringIO() +headerFile = StringIO() info("Generating %s header." % args[1]) -print >> headerFile, "// This file is automatically generated." -print >> headerFile, "// Do not modify this file manually." -print >> headerFile -print >> headerFile +headerFile.write("// This file is automatically generated.\n") +headerFile.write("// Do not modify this file manually.\n\n\n") + +langs = [ + "CHICKEN", + "CSHARP", + "GUILE", + "JAVA", + "LUA", + "MODULA3", + "MZSCHEME", + "OCAML", + "PERL", + "PERL5", + "PHP", + "PHP4", + "PHP5", + "PIKE", + "PYTHON", + "R", + "RUBY", + "SEXP", + "TCL", + "XML"] # first, define the module # [1:-1] is there to drop the quotes -for lang in ["CHICKEN", "CSHARP", "GUILE", "JAVA", "LUA", "MODULA3", "MZSCHEME", "OCAML", "PERL", "PERL5", "PHP", "PHP4", "PHP5", "PIKE", "PYTHON", "R", "RUBY", "SEXP", "TCL", "XML"]: - print >> headerFile, "#ifdef SWIG%s" % lang - print >> headerFile, "%%module %s%s" % ( moduleName, lang.title() ) - print >> headerFile, "#endif" -print >> headerFile +for lang in langs: + headerFile.write("#ifdef SWIG%s\n" % lang) + headerFile.write("%%module %s%s\n" % (moduleName, lang.title())) + headerFile.write("#endif\n") +headerFile.write('\n') # add the includes # use a set to avoid putting many times the same include s = set() -print >> headerFile, "%{" +headerFile.write("%{\n") # the include files passed in option for f in options.includes: - i = '#include "%s"' % f - if not i in s: - print >> headerFile, i - s.add( i ) + i = '#include "%s"' % f + if i not in s: + headerFile.write(i + '\n') + s.add(i) # and the includes files from other files for file_name in options.take_includes: - f = file( file_name ) - for l in f : - if l.startswith( '#include' ): - i = " ".join(l.strip().split()) - if not i in s: - print >> headerFile, i - s.add( i ) - f.close() -print >> headerFile, "%}" -print >> headerFile -print >> headerFile + with open(file_name, "r") as f: + for l in f: + if l.startswith('#include'): + i = " ".join(l.strip().split()) + if i not in s: + headerFile.write(i + '\n') + s.add(i) +headerFile.write("%}\n\n\n") # load the aliases files -print >> headerFile, "%{" +headerFile.write("%{\n") # the idx files passed in option for f in options.idx: - load_idx(f) + load_idx(f) # and the idx files in the mdx ones for f in options.mdx: - load_mdx(f) + load_mdx(f) # iterate over all the typedefs in the _cable_::wrappers namespace # to fill the alias dict -for typedef in wrappers_ns.typedefs(): #allow_empty=True): - s = str(typedef.type.decl_string) - # drop the :: prefix - it make swig produce invalid code - if s.startswith("::"): - s = s[2:] - if not aliases.has_key( s ) : - warn( 2, "%s (%s) should be already defined in the idx files." % (s, typedef.name) ) - aliases[s] = typedef.name - # declare the typedef - print >> headerFile, "typedef %s %s;" % (s, typedef.name) - -print >> headerFile, "%}" -print >> headerFile -print >> headerFile +for typedef in wrappers_ns.typedefs(): # allow_empty=True): + s = str(typedef.type.decl_string) + # drop the :: prefix - it make swig produce invalid code + if s.startswith("::"): + s = s[2:] + if s not in aliases: + igenerator_warn( + 2, "%s (%s) should be already defined in the idx files." % + (s, typedef.name)) + aliases[s] = typedef.name + # declare the typedef + headerFile.write("typedef %s %s;\n" % (s, typedef.name)) + +headerFile.write("%}\n\n\n") # add the imports -importFile = cStringIO.StringIO() +importFile = StringIO() for f in options.imports: - print >> importFile, "%%import %s" % f -print >> importFile -print >> importFile + importFile.write("%%import %s\n" % f) +importFile.write("\n\n") # add the swig includes -includeFile = cStringIO.StringIO() +includeFile = StringIO() for f in options.swig_includes: - print >> includeFile, "%%include %s" % f -print >> includeFile -print >> includeFile + includeFile.write("%%include %s\n" % f) +includeFile.write('\n\n') # iterate over all the typedefs in the _cable_::wrappers namespace @@ -596,16 +825,26 @@ classes = [] for typedef in wrappers_ns.typedefs(): - # begin a new class - if isinstance( typedef.type.declaration, pygccxml.declarations.class_declaration.class_t ): - classes.append( (typedef.name, [get_alias(super_class.related_class.decl_string) for super_class in typedef.type.declaration.bases], typedef) ) - - elif isinstance( typedef.type.declaration, pygccxml.declarations.enumeration.enumeration_t ): - # warn( 6, "Enum are currently supported only nested in a class." ) - generate_enum( typedef ) + # begin a new class + if isinstance( + typedef.type.declaration, + pygccxml.declarations.class_declaration.class_t): + + classes.append(( + typedef.name, + [get_alias(super_class.related_class.decl_string) for + super_class in typedef.type.declaration.bases], typedef)) + + elif isinstance( + typedef.type.declaration, + pygccxml.declarations.enumeration.enumeration_t): + # igenerator_warn( 6, "Enum are currently supported only nested in a + # class." ) + generate_enum(typedef) - else: - warn( 5, "Unknown type type: %s" % str(typedef.type.declaration) ) + else: + igenerator_warn( + 5, "Unknown type type: %s" % str(typedef.type.declaration)) # copy the classes in a new ordered list, according to the dependencies @@ -615,77 +854,89 @@ name_already_in_typedefs = [] typedefs = [] while len(classes) != 0: - nclasses = [] - for name, deps, typedef in classes: - ok = True - for d in deps: - if d in name_local_classes and d not in name_already_in_typedefs: - ok = False - if ok: - name_already_in_typedefs.append(name) - typedefs.append(typedef) - else: - nclasses.append( (name, deps, typedef) ) - classes = nclasses + nclasses = [] + for name, deps, typedef in classes: + ok = True + for d in deps: + if d in name_local_classes and d not in name_already_in_typedefs: + ok = False + if ok: + name_already_in_typedefs.append(name) + typedefs.append(typedef) + else: + nclasses.append((name, deps, typedef)) + classes = nclasses # now really generate the swig interface for typedef in typedefs: - # begin a new class - generate_class( typedef ) + # begin a new class + generate_class(typedef) -if len(warnings) > 0 and options.warningError: - sys.exit(1) +if len(igenerator_warnings) > 0 and options.warningError: + sys.exit(1) # search the files to import usedSources = set() for alias in usedTypes: - if typedefSource.has_key( alias ): - idxName = os.path.basename( typedefSource[ alias ] ) - iName = idxName[:-len(".idx")] - usedSources.add( iName ) -outputFileName = os.path.basename( args[1] ) + if alias in typedefSource: + idxName = os.path.basename(typedefSource[alias]) + iName = idxName[:-len(".idx")] + usedSources.add(iName) +outputFileName = os.path.basename(args[1]) if outputFileName in usedSources: - usedSources.remove( outputFileName ) -# print usedSources + usedSources.remove(outputFileName) for src in usedSources: - print >> importFile, "%%import %s.i" % src -print >> importFile -print >> importFile + importFile.write("%%import %s.i\n" % src) +importFile.write('\n\n') # create the typedef header if options.typedef_output: - typedefFile = cStringIO.StringIO() - print >> typedefFile, "#ifndef __%sSwigInterface_h" % moduleName - print >> typedefFile, "#define __%sSwigInterface_h" % moduleName - if options.typedef_input: - f = file(options.typedef_input) - print >> typedefFile, f.read() - f.close() - for src in usedSources: - print >> typedefFile, '#include "%sSwigInterface.h"' % src - print >> typedefFile, "#endif" - f = file(options.typedef_output, "w") - f.write( typedefFile.getvalue() ) - f.close() - + typedefFile = StringIO() + typedefFile.write("#ifndef __%sSwigInterface_h\n" % moduleName) + typedefFile.write("#define __%sSwigInterface_h\n" % moduleName) + if options.typedef_input: + with open(options.typedef_input, "r") as f: + typedefFile.write(f.read() + '\n') + for src in usedSources: + typedefFile.write('#include "%sSwigInterface.h"\n' % src) + typedefFile.write("#endif\n") + with open(options.typedef_output, "w") as f: + f.write(typedefFile.getvalue()) + +# When a std::string is passed by reference, we need to add the %apply +# line with the argument name, and the INOUT command. +# Use a set() to have remove duplicates, this will work event if we got +# multiple functions with the same argument name in the same .i file +# (swig should take care of it). +applyFileNames = set(applyFileNames) +for name in applyFileNames: + applyFile.write( + "%apply (std::string& INOUT) { std::string & " + name + "};\n") +applyFile.write("\n\n") # finally, really write the output -content = headerFile.getvalue()+ importFile.getvalue() + includeFile.getvalue() + outputFile.getvalue() +content = headerFile.getvalue() + importFile.getvalue() + \ + includeFile.getvalue() + applyFile.getvalue() + outputFile.getvalue() if args[1] != '-': - if options.keep and os.path.exists( args[1] ) and file( args[1] ).read() == content: - info("%s unchanged." % args[1]) - else: - info("Writing %s." % args[1]) - f = file(args[1], "w") - f.write( content ) - f.close() + + if options.keep and os.path.exists(args[1]): + with open(args[1], "r") as f: + filecontent = f.read() + + if options.keep and os.path.exists(args[1]) and \ + filecontent == content: + info("%s unchanged." % args[1]) + else: + info("Writing %s." % args[1]) + with open(args[1], "w") as f: + f.write(content) else: - sys.stdout.write( content ) + sys.stdout.write(content) # Stop process time measurement info("%s seconds i-generation time." % (time.clock() - t0)) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/announcement.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/announcement.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/announcement.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/announcement.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -Hello! - -I'm pleased to announce the 1.0 release of pygccxml. - -What is pygccxml? -================= - -"...The purpose of the GCC-XML extension is to generate an XML description of a -C++ program from GCC's internal representation. " - --- Introduction to GCC-XML - -The purpose of pygccxml is to read a generated file and provide a simple -framework to navigate C++ declarations, using Python classes. - -Where is pygccxml? -================== - -Site: http://language-binding.net/pygccxml/pygccxml.html - -Download: http://language-binding.net/pygccxml/download.html - -What's new? -=========== - -Features ---------- - -* Support for ellipsis was added. - -* New experimental back-end, based on ``.pdb`` (progam database file), was added. - -* New high-level API wrapper for ``.bsc`` (browse source code file) was added. - - -Bug fixes ---------- - -* Search algorithm, for template instantiated classes, was improved. - - -For a more complete list, please see the news: -http://language-binding.net/pygccxml/history/history.html diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/LICENSE_1_0.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/LICENSE_1_0.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/LICENSE_1_0.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/LICENSE_1_0.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/MANIFEST otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/MANIFEST --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/MANIFEST 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/MANIFEST 1970-01-01 00:00:00.000000000 +0000 @@ -1,553 +0,0 @@ -announcement.txt -LICENSE_1_0.txt -MANIFEST -README.txt -setup.py -docs\declarations_uml.png -docs\definition.rest -docs\design.rest -docs\download.rest -docs\links.rest -docs\parser_uml.png -docs\pkg-info.txt -docs\pygccxml.rest -docs\pygccxml_uml.vsd -docs\query_interface.rest -docs\upgrade_issues.rest -docs\users.rest -docs\apidocs\api-objects.txt -docs\apidocs\class-tree.html -docs\apidocs\crarr.png -docs\apidocs\epydoc.css -docs\apidocs\epydoc.js -docs\apidocs\help.html -docs\apidocs\identifier-index.html -docs\apidocs\index.html -docs\apidocs\module-tree.html -docs\apidocs\pygccxml-module.html -docs\apidocs\pygccxml-pysrc.html -docs\apidocs\pygccxml.declarations-module.html -docs\apidocs\pygccxml.declarations-pysrc.html -docs\apidocs\pygccxml.declarations.algorithm-module.html -docs\apidocs\pygccxml.declarations.algorithm-pysrc.html -docs\apidocs\pygccxml.declarations.algorithm.match_declaration_t-class.html -docs\apidocs\pygccxml.declarations.algorithm.visit_function_has_not_been_found_t-class.html -docs\apidocs\pygccxml.declarations.algorithms_cache-module.html -docs\apidocs\pygccxml.declarations.algorithms_cache-pysrc.html -docs\apidocs\pygccxml.declarations.algorithms_cache.declaration_algs_cache_t-class.html -docs\apidocs\pygccxml.declarations.algorithms_cache.type_algs_cache_t-class.html -docs\apidocs\pygccxml.declarations.calldef-module.html -docs\apidocs\pygccxml.declarations.calldef-pysrc.html -docs\apidocs\pygccxml.declarations.calldef.argument_t-class.html -docs\apidocs\pygccxml.declarations.calldef.calldef_t-class.html -docs\apidocs\pygccxml.declarations.calldef.casting_operator_t-class.html -docs\apidocs\pygccxml.declarations.calldef.constructor_t-class.html -docs\apidocs\pygccxml.declarations.calldef.destructor_t-class.html -docs\apidocs\pygccxml.declarations.calldef.free_calldef_t-class.html -docs\apidocs\pygccxml.declarations.calldef.free_function_t-class.html -docs\apidocs\pygccxml.declarations.calldef.free_operator_t-class.html -docs\apidocs\pygccxml.declarations.calldef.member_calldef_t-class.html -docs\apidocs\pygccxml.declarations.calldef.member_function_t-class.html -docs\apidocs\pygccxml.declarations.calldef.member_operator_t-class.html -docs\apidocs\pygccxml.declarations.calldef.operator_t-class.html -docs\apidocs\pygccxml.declarations.calldef.VIRTUALITY_TYPES-class.html -docs\apidocs\pygccxml.declarations.call_invocation-module.html -docs\apidocs\pygccxml.declarations.call_invocation-pysrc.html -docs\apidocs\pygccxml.declarations.class_declaration-module.html -docs\apidocs\pygccxml.declarations.class_declaration-pysrc.html -docs\apidocs\pygccxml.declarations.class_declaration.ACCESS_TYPES-class.html -docs\apidocs\pygccxml.declarations.class_declaration.class_declaration_t-class.html -docs\apidocs\pygccxml.declarations.class_declaration.class_t-class.html -docs\apidocs\pygccxml.declarations.class_declaration.CLASS_TYPES-class.html -docs\apidocs\pygccxml.declarations.class_declaration.hierarchy_info_t-class.html -docs\apidocs\pygccxml.declarations.compilers-module.html -docs\apidocs\pygccxml.declarations.compilers-pysrc.html -docs\apidocs\pygccxml.declarations.container_traits-module.html -docs\apidocs\pygccxml.declarations.container_traits-pysrc.html -docs\apidocs\pygccxml.declarations.container_traits.container_traits_impl_t-class.html -docs\apidocs\pygccxml.declarations.container_traits.defaults_eraser-class.html -docs\apidocs\pygccxml.declarations.container_traits.defaults_eraser.recursive_impl-class.html -docs\apidocs\pygccxml.declarations.cpptypes-module.html -docs\apidocs\pygccxml.declarations.cpptypes-pysrc.html -docs\apidocs\pygccxml.declarations.cpptypes.array_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.bool_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.calldef_type_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.char_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.complex_double_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.complex_float_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.complex_long_double_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.compound_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.const_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.declarated_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.double_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.dummy_type_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.ellipsis_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.float_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.free_function_type_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.fundamental_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.java_fundamental_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jboolean_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jbyte_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jchar_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jdouble_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jfloat_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jint_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jlong_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.jshort_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.long_double_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.long_int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.long_long_int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.long_long_unsigned_int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.long_unsigned_int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.member_function_type_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.member_variable_type_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.pointer_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.reference_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.restrict_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.short_int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.short_unsigned_int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.signed_char_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.type_qualifiers_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.type_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.unknown_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.unsigned_char_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.unsigned_int_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.void_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.volatile_t-class.html -docs\apidocs\pygccxml.declarations.cpptypes.wchar_t-class.html -docs\apidocs\pygccxml.declarations.declaration-module.html -docs\apidocs\pygccxml.declarations.declaration-pysrc.html -docs\apidocs\pygccxml.declarations.declaration.declaration_t-class.html -docs\apidocs\pygccxml.declarations.declaration.location_t-class.html -docs\apidocs\pygccxml.declarations.decl_factory-module.html -docs\apidocs\pygccxml.declarations.decl_factory-pysrc.html -docs\apidocs\pygccxml.declarations.decl_factory.decl_factory_t-class.html -docs\apidocs\pygccxml.declarations.decl_printer-module.html -docs\apidocs\pygccxml.declarations.decl_printer-pysrc.html -docs\apidocs\pygccxml.declarations.decl_printer.decl_printer_t-class.html -docs\apidocs\pygccxml.declarations.decl_visitor-module.html -docs\apidocs\pygccxml.declarations.decl_visitor-pysrc.html -docs\apidocs\pygccxml.declarations.decl_visitor.decl_visitor_t-class.html -docs\apidocs\pygccxml.declarations.dependencies-module.html -docs\apidocs\pygccxml.declarations.dependencies-pysrc.html -docs\apidocs\pygccxml.declarations.dependencies.dependency_info_t-class.html -docs\apidocs\pygccxml.declarations.enumeration-module.html -docs\apidocs\pygccxml.declarations.enumeration-pysrc.html -docs\apidocs\pygccxml.declarations.enumeration.enumeration_t-class.html -docs\apidocs\pygccxml.declarations.filtering'-module.html -docs\apidocs\pygccxml.declarations.filtering'-pysrc.html -docs\apidocs\pygccxml.declarations.filtering'.filtering-class.html -docs\apidocs\pygccxml.declarations.function_traits-module.html -docs\apidocs\pygccxml.declarations.function_traits-pysrc.html -docs\apidocs\pygccxml.declarations.matcher'-module.html -docs\apidocs\pygccxml.declarations.matcher'-pysrc.html -docs\apidocs\pygccxml.declarations.matcher'.matcher-class.html -docs\apidocs\pygccxml.declarations.matcher.declaration_not_found_t-class.html -docs\apidocs\pygccxml.declarations.matcher.multiple_declarations_found_t-class.html -docs\apidocs\pygccxml.declarations.matchers-module.html -docs\apidocs\pygccxml.declarations.matchers-pysrc.html -docs\apidocs\pygccxml.declarations.matchers.access_type_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.and_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.calldef_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.custom_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.declaration_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.matcher_base_t-class.html -docs\apidocs\pygccxml.declarations.matchers.namespace_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.not_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.operator_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.or_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.regex_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.variable_matcher_t-class.html -docs\apidocs\pygccxml.declarations.matchers.virtuality_type_matcher_t-class.html -docs\apidocs\pygccxml.declarations.mdecl_wrapper-module.html -docs\apidocs\pygccxml.declarations.mdecl_wrapper-pysrc.html -docs\apidocs\pygccxml.declarations.mdecl_wrapper.call_redirector_t-class.html -docs\apidocs\pygccxml.declarations.mdecl_wrapper.mdecl_wrapper_t-class.html -docs\apidocs\pygccxml.declarations.namespace-module.html -docs\apidocs\pygccxml.declarations.namespace-pysrc.html -docs\apidocs\pygccxml.declarations.namespace.namespace_t-class.html -docs\apidocs\pygccxml.declarations.pattern_parser-module.html -docs\apidocs\pygccxml.declarations.pattern_parser-pysrc.html -docs\apidocs\pygccxml.declarations.pattern_parser.parser_t-class.html -docs\apidocs\pygccxml.declarations.scopedef-module.html -docs\apidocs\pygccxml.declarations.scopedef-pysrc.html -docs\apidocs\pygccxml.declarations.scopedef.scopedef_t-class.html -docs\apidocs\pygccxml.declarations.templates-module.html -docs\apidocs\pygccxml.declarations.templates-pysrc.html -docs\apidocs\pygccxml.declarations.typedef-module.html -docs\apidocs\pygccxml.declarations.typedef-pysrc.html -docs\apidocs\pygccxml.declarations.typedef.typedef_t-class.html -docs\apidocs\pygccxml.declarations.type_traits-module.html -docs\apidocs\pygccxml.declarations.type_traits-pysrc.html -docs\apidocs\pygccxml.declarations.type_traits.auto_ptr_traits-class.html -docs\apidocs\pygccxml.declarations.type_traits.declaration_xxx_traits-class.html -docs\apidocs\pygccxml.declarations.type_traits.impl_details-class.html -docs\apidocs\pygccxml.declarations.type_traits.smart_pointer_traits-class.html -docs\apidocs\pygccxml.declarations.type_visitor-module.html -docs\apidocs\pygccxml.declarations.type_visitor-pysrc.html -docs\apidocs\pygccxml.declarations.type_visitor.type_visitor_t-class.html -docs\apidocs\pygccxml.declarations.variable-module.html -docs\apidocs\pygccxml.declarations.variable-pysrc.html -docs\apidocs\pygccxml.declarations.variable.variable_t-class.html -docs\apidocs\pygccxml.msvc-module.html -docs\apidocs\pygccxml.msvc-pysrc.html -docs\apidocs\pygccxml.msvc.bsc-module.html -docs\apidocs\pygccxml.msvc.bsc-pysrc.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper-module.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper-pysrc.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.Bsc-class.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.BSC_STAT-class.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.enums-class.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.enums.ATTRIBUTES-class.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.enums.MBF-class.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.enums.TYPES-class.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.IinstInfo-class.html -docs\apidocs\pygccxml.msvc.bsc.c_wrapper.NiQ-class.html -docs\apidocs\pygccxml.msvc.bsc.definition_t-class.html -docs\apidocs\pygccxml.msvc.bsc.instance_t-class.html -docs\apidocs\pygccxml.msvc.bsc.module_t-class.html -docs\apidocs\pygccxml.msvc.bsc.reader_t-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details-module.html -docs\apidocs\pygccxml.msvc.bsc_impl_details-pysrc.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.Bsc-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.bsc_reader_t-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.BSC_STAT-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.definition_t-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.enums-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.enums.ATTRIBUTES-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.enums.MBF-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.enums.TYPES-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.IinstInfo-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.instance_t-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.module_t-class.html -docs\apidocs\pygccxml.msvc.bsc_impl_details.NiQ-class.html -docs\apidocs\pygccxml.msvc.common_utils-module.html -docs\apidocs\pygccxml.msvc.common_utils-pysrc.html -docs\apidocs\pygccxml.msvc.common_utils.UNDECORATE_NAME_OPTIONS-class.html -docs\apidocs\pygccxml.msvc.config-module.html -docs\apidocs\pygccxml.msvc.config-pysrc.html -docs\apidocs\pygccxml.msvc.config.binaries_searcher_t-class.html -docs\apidocs\pygccxml.msvc.pdb-module.html -docs\apidocs\pygccxml.msvc.pdb-pysrc.html -docs\apidocs\pygccxml.msvc.pdb.enums-module.html -docs\apidocs\pygccxml.msvc.pdb.enums-pysrc.html -docs\apidocs\pygccxml.msvc.pdb.enums.BasicType-class.html -docs\apidocs\pygccxml.msvc.pdb.enums.CV_access_e-class.html -docs\apidocs\pygccxml.msvc.pdb.enums.DataKind-class.html -docs\apidocs\pygccxml.msvc.pdb.enums.NameSearchOptions-class.html -docs\apidocs\pygccxml.msvc.pdb.enums.UdtKind-class.html -docs\apidocs\pygccxml.msvc.pdb.impl_details-module.html -docs\apidocs\pygccxml.msvc.pdb.impl_details-pysrc.html -docs\apidocs\pygccxml.msvc.pdb.impl_details.full_name_splitter_t-class.html -docs\apidocs\pygccxml.msvc.pdb.loader-module.html -docs\apidocs\pygccxml.msvc.pdb.loader-pysrc.html -docs\apidocs\pygccxml.msvc.pdb.loader.decl_loader_t-class.html -docs\apidocs\pygccxml.msvc.pdb.loader.decl_loader_t.parent_exists_t-class.html -docs\apidocs\pygccxml.parser-module.html -docs\apidocs\pygccxml.parser-pysrc.html -docs\apidocs\pygccxml.parser.config-module.html -docs\apidocs\pygccxml.parser.config-pysrc.html -docs\apidocs\pygccxml.parser.config.gccxml_configuration_t-class.html -docs\apidocs\pygccxml.parser.config.parser_configuration_t-class.html -docs\apidocs\pygccxml.parser.declarations_cache-module.html -docs\apidocs\pygccxml.parser.declarations_cache-pysrc.html -docs\apidocs\pygccxml.parser.declarations_cache.cache_base_t-class.html -docs\apidocs\pygccxml.parser.declarations_cache.dummy_cache_t-class.html -docs\apidocs\pygccxml.parser.declarations_cache.file_cache_t-class.html -docs\apidocs\pygccxml.parser.declarations_cache.record_t-class.html -docs\apidocs\pygccxml.parser.directory_cache-module.html -docs\apidocs\pygccxml.parser.directory_cache-pysrc.html -docs\apidocs\pygccxml.parser.directory_cache.directory_cache_t-class.html -docs\apidocs\pygccxml.parser.directory_cache.filename_entry_t-class.html -docs\apidocs\pygccxml.parser.directory_cache.filename_repository_t-class.html -docs\apidocs\pygccxml.parser.directory_cache.index_entry_t-class.html -docs\apidocs\pygccxml.parser.etree_scanner-module.html -docs\apidocs\pygccxml.parser.etree_scanner-pysrc.html -docs\apidocs\pygccxml.parser.etree_scanner.etree_saxifier_t-class.html -docs\apidocs\pygccxml.parser.etree_scanner.ietree_scanner_t-class.html -docs\apidocs\pygccxml.parser.linker-module.html -docs\apidocs\pygccxml.parser.linker-pysrc.html -docs\apidocs\pygccxml.parser.linker.linker_t-class.html -docs\apidocs\pygccxml.parser.patcher-module.html -docs\apidocs\pygccxml.parser.patcher-pysrc.html -docs\apidocs\pygccxml.parser.patcher.casting_operator_patcher_t-class.html -docs\apidocs\pygccxml.parser.patcher.default_argument_patcher_t-class.html -docs\apidocs\pygccxml.parser.project_reader-module.html -docs\apidocs\pygccxml.parser.project_reader-pysrc.html -docs\apidocs\pygccxml.parser.project_reader.COMPILATION_MODE-class.html -docs\apidocs\pygccxml.parser.project_reader.file_configuration_t-class.html -docs\apidocs\pygccxml.parser.project_reader.file_configuration_t.CONTENT_TYPE-class.html -docs\apidocs\pygccxml.parser.project_reader.project_reader_t-class.html -docs\apidocs\pygccxml.parser.scanner-module.html -docs\apidocs\pygccxml.parser.scanner-pysrc.html -docs\apidocs\pygccxml.parser.scanner.scanner_t-class.html -docs\apidocs\pygccxml.parser.source_reader-module.html -docs\apidocs\pygccxml.parser.source_reader-pysrc.html -docs\apidocs\pygccxml.parser.source_reader.gccxml_runtime_error_t-class.html -docs\apidocs\pygccxml.parser.source_reader.source_reader_t-class.html -docs\apidocs\pygccxml.utils-module.html -docs\apidocs\pygccxml.utils-pysrc.html -docs\apidocs\pygccxml.utils.cached-class.html -docs\apidocs\pygccxml.utils.enum-class.html -docs\apidocs\pygccxml.utils.fs_utils-module.html -docs\apidocs\pygccxml.utils.fs_utils-pysrc.html -docs\apidocs\pygccxml.utils.fs_utils.base_files_iterator-class.html -docs\apidocs\pygccxml.utils.fs_utils.directories_walker-class.html -docs\apidocs\pygccxml.utils.fs_utils.files_walker-class.html -docs\apidocs\pygccxml.utils.loggers-class.html -docs\apidocs\redirect.html -docs\example\example.hpp -docs\example\example.hpp.rest -docs\example\example.hpp.xml -docs\example\example.hpp.xml.rest -docs\example\example.py -docs\example\example.py.rest -docs\example\example.rest -docs\example\output.txt -docs\example\output.txt.rest -docs\history\history.rest -docs\msvc\msvc.rest -gccxml-0.9-upgrade\const_variables.7.xml -gccxml-0.9-upgrade\const_variables.9.xml -gccxml-0.9-upgrade\const_variables.h -gccxml-0.9-upgrade\const_variables.h.diff -gccxml-0.9-upgrade\default_args.7.xml -gccxml-0.9-upgrade\default_args.9.xml -gccxml-0.9-upgrade\default_args.h -gccxml-0.9-upgrade\default_args.h.diff -gccxml-0.9-upgrade\demangled.7.xml -gccxml-0.9-upgrade\demangled.9.xml -gccxml-0.9-upgrade\demangled.h -gccxml-0.9-upgrade\demangled.h.diff -gccxml-0.9-upgrade\offset.7.xml -gccxml-0.9-upgrade\offset.9.xml -gccxml-0.9-upgrade\offset.h -gccxml-0.9-upgrade\offset.h.diff -gccxml-0.9-upgrade\union_and_struct.7.xml -gccxml-0.9-upgrade\union_and_struct.9.xml -gccxml-0.9-upgrade\union_and_struct.h -gccxml-0.9-upgrade\union_and_struct.h.diff -pygccxml\__init__.py -pygccxml\__init__.pyc -pygccxml\declarations\algorithm.py -pygccxml\declarations\algorithm.pyc -pygccxml\declarations\algorithms_cache.py -pygccxml\declarations\algorithms_cache.pyc -pygccxml\declarations\calldef.py -pygccxml\declarations\calldef.pyc -pygccxml\declarations\call_invocation.py -pygccxml\declarations\call_invocation.pyc -pygccxml\declarations\class_declaration.py -pygccxml\declarations\class_declaration.pyc -pygccxml\declarations\compilers.py -pygccxml\declarations\compilers.pyc -pygccxml\declarations\container_traits.py -pygccxml\declarations\container_traits.pyc -pygccxml\declarations\cpptypes.py -pygccxml\declarations\cpptypes.pyc -pygccxml\declarations\declaration.py -pygccxml\declarations\declaration.pyc -pygccxml\declarations\decl_factory.py -pygccxml\declarations\decl_factory.pyc -pygccxml\declarations\decl_printer.py -pygccxml\declarations\decl_printer.pyc -pygccxml\declarations\decl_visitor.py -pygccxml\declarations\decl_visitor.pyc -pygccxml\declarations\dependencies.py -pygccxml\declarations\dependencies.pyc -pygccxml\declarations\enumeration.py -pygccxml\declarations\enumeration.pyc -pygccxml\declarations\filtering.py -pygccxml\declarations\filtering.pyc -pygccxml\declarations\function_traits.py -pygccxml\declarations\function_traits.pyc -pygccxml\declarations\matcher.py -pygccxml\declarations\matcher.pyc -pygccxml\declarations\matchers.py -pygccxml\declarations\matchers.pyc -pygccxml\declarations\mdecl_wrapper.py -pygccxml\declarations\mdecl_wrapper.pyc -pygccxml\declarations\namespace.py -pygccxml\declarations\namespace.pyc -pygccxml\declarations\pattern_parser.py -pygccxml\declarations\pattern_parser.pyc -pygccxml\declarations\scopedef.py -pygccxml\declarations\scopedef.pyc -pygccxml\declarations\templates.py -pygccxml\declarations\templates.pyc -pygccxml\declarations\typedef.py -pygccxml\declarations\typedef.pyc -pygccxml\declarations\type_traits.py -pygccxml\declarations\type_traits.pyc -pygccxml\declarations\type_visitor.py -pygccxml\declarations\type_visitor.pyc -pygccxml\declarations\variable.py -pygccxml\declarations\variable.pyc -pygccxml\declarations\__init__.py -pygccxml\declarations\__init__.pyc -pygccxml\msvc\bsc_impl_details.py -pygccxml\msvc\bsc_impl_details.pyc -pygccxml\msvc\common_utils.py -pygccxml\msvc\common_utils.pyc -pygccxml\msvc\config.py -pygccxml\msvc\config.pyc -pygccxml\msvc\__init__.py -pygccxml\msvc\__init__.pyc -pygccxml\msvc\bsc\c_wrapper.py -pygccxml\msvc\bsc\c_wrapper.pyc -pygccxml\msvc\bsc\__init__.py -pygccxml\msvc\bsc\__init__.pyc -pygccxml\msvc\pdb\enums.py -pygccxml\msvc\pdb\enums.pyc -pygccxml\msvc\pdb\impl_details.py -pygccxml\msvc\pdb\impl_details.pyc -pygccxml\msvc\pdb\kb.txt -pygccxml\msvc\pdb\loader.py -pygccxml\msvc\pdb\loader.pyc -pygccxml\msvc\pdb\__init__.py -pygccxml\msvc\pdb\__init__.pyc -pygccxml\parser\config.py -pygccxml\parser\config.pyc -pygccxml\parser\declarations_cache.py -pygccxml\parser\declarations_cache.pyc -pygccxml\parser\directory_cache.py -pygccxml\parser\directory_cache.pyc -pygccxml\parser\etree_scanner.py -pygccxml\parser\etree_scanner.pyc -pygccxml\parser\linker.py -pygccxml\parser\linker.pyc -pygccxml\parser\patcher.py -pygccxml\parser\patcher.pyc -pygccxml\parser\project_reader.py -pygccxml\parser\project_reader.pyc -pygccxml\parser\scanner.py -pygccxml\parser\scanner.pyc -pygccxml\parser\source_reader.py -pygccxml\parser\source_reader.pyc -pygccxml\parser\__init__.py -pygccxml\parser\__init__.pyc -pygccxml\utils\fs_utils.py -pygccxml\utils\fs_utils.pyc -pygccxml\utils\__init__.py -pygccxml\utils\__init__.pyc -unittests\algorithms_cache_tester.py -unittests\attributes_tester.py -unittests\autoconfig.py -unittests\better_templates_matcher_tester.py -unittests\bit_fields_tester.py -unittests\bsc_tester.py -unittests\cached_source_file_tester.py -unittests\cache_enums_tester.py -unittests\calldef_matcher_tester.py -unittests\call_invocation_tester.py -unittests\complex_types_tester.py -unittests\copy_constructor_tester.py -unittests\core_tester.py -unittests\declarations_cache_tester.py -unittests\declarations_comparison_tester.py -unittests\declarations_tester.py -unittests\declaration_files_tester.py -unittests\decl_printer_tester.py -unittests\decl_string_tester.py -unittests\demangled_tester.py -unittests\dependencies_tester.py -unittests\file_cache_tester.py -unittests\filtering_tester.py -unittests\filters_tester.py -unittests\find_container_traits_tester.py -unittests\free_operators_tester.py -unittests\function_traits_tester.py -unittests\gccxml_runner_tester.py -unittests\has_binary_operator_traits_tester.py -unittests\hierarchy_traveling.py -unittests\namespace_matcher_tester.py -unittests\parser_test_case.py -unittests\patcher_tester.py -unittests\pdb_tester.py -unittests\plain_c_tester.py -unittests\profile_parser.py -unittests\project_reader_correctness_tester.py -unittests\remove_template_defaults_tester.py -unittests\results.txt -unittests\source_reader_tester.py -unittests\start_with_declarations_tester.py -unittests\string_traits_tester.py -unittests\templates_tester.py -unittests\test_all.py -unittests\test_performance.py -unittests\text_reader_tester.py -unittests\timeit_test_parser.py -unittests\typedefs_tester.py -unittests\type_as_exception_bug_tester.py -unittests\type_traits_tester.py -unittests\unnamed_classes_tester.py -unittests\unnamed_enums_bug_tester.py -unittests\variable_matcher_tester.py -unittests\vector_traits_tester.py -unittests\xmlfile_reader_tester.py -unittests\data\abstract_classes.hpp -unittests\data\attributes.hpp -unittests\data\better_templates_matcher_tester.hpp -unittests\data\big.xml.bz2 -unittests\data\big2-new.xml -unittests\data\big2.xml -unittests\data\big2.xml.bz2 -unittests\data\bit_fields.hpp -unittests\data\complex_types.hpp -unittests\data\core_cache.hpp -unittests\data\core_class_hierarchy.hpp -unittests\data\core_class_hierarchy.hpp.xml -unittests\data\core_diamand_hierarchy_base.hpp -unittests\data\core_diamand_hierarchy_derived1.hpp -unittests\data\core_diamand_hierarchy_derived2.hpp -unittests\data\core_diamand_hierarchy_final_derived.hpp -unittests\data\core_membership.hpp -unittests\data\core_ns_join_1.hpp -unittests\data\core_ns_join_2.hpp -unittests\data\core_ns_join_3.hpp -unittests\data\core_overloads_1.hpp -unittests\data\core_overloads_2.hpp -unittests\data\core_types.hpp -unittests\data\covariant_returns.hpp -unittests\data\declarations_calldef.hpp -unittests\data\declarations_comparison.hpp -unittests\data\declarations_enums.hpp -unittests\data\declarations_for_filtering.hpp -unittests\data\declarations_variables.hpp -unittests\data\decl_cache_file1.txt -unittests\data\decl_cache_file1_duplicate.txt -unittests\data\decl_cache_file2.txt -unittests\data\demangled.hpp -unittests\data\demangled_tester_64bit.xml -unittests\data\free_operators.hpp -unittests\data\has_public_binary_operator_traits.hpp -unittests\data\include_all.hpp -unittests\data\include_std.hpp -unittests\data\indexing_suites2.hpp -unittests\data\noncopyable.hpp -unittests\data\ogre.1.7.xml -unittests\data\ogre.1.7.xml.bz2 -unittests\data\ogre1.4.xml -unittests\data\patcher.hpp -unittests\data\patcher_tester_64bit.xml -unittests\data\plain_c.c -unittests\data\pygccxml.cache -unittests\data\remove_template_defaults.hpp -unittests\data\string_traits.hpp -unittests\data\typedefs1.hpp -unittests\data\typedefs2.hpp -unittests\data\typedefs_base.hpp -unittests\data\type_as_exception_bug.h -unittests\data\type_traits.hpp -unittests\data\unnamed_classes.hpp -unittests\data\unnamed_enums_bug1.hpp -unittests\data\unnamed_enums_bug2.hpp -unittests\data\unnamed_ns_bug.hpp -unittests\data\vector_traits.hpp -unittests\data\xxx.bsc -unittests\data\xxx.bsc.bz2 -unittests\data\xxx.pdb.bz2 -unittests\data\msvc_build\all.cpp -unittests\data\msvc_build\msvc_build.sln -unittests\data\msvc_build\msvc_build.vcproj diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/PKG-INFO otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/PKG-INFO --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/PKG-INFO 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/PKG-INFO 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -Metadata-Version: 1.0 -Name: pygccxml -Version: 1.0.0 -Summary: GCC-XML generated file reader -Home-page: http://www.language-binding.net/pygccxml/pygccxml.html -Author: Roman Yakovenko -Author-email: roman.yakovenko@gmail.com -License: UNKNOWN -Description: UNKNOWN -Platform: UNKNOWN diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithm.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithm.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithm.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithm.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,334 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""defines few unrelated algorithms, that works on declarations""" - -import types - -def declaration_path( decl, with_defaults=True ): - """ - returns a list of parent declarations names - - @param decl: declaration for which declaration path should be calculated - @type decl: L{declaration_t} - - @return: [names], where first item contains top parent name and last item - contains decl name - """ - if not decl: - return [] - if not decl.cache.declaration_path: - result = [ decl.name ] - parent = decl.parent - while parent: - if parent.cache.declaration_path: - result.reverse() - decl.cache.declaration_path = parent.cache.declaration_path + result - return decl.cache.declaration_path - else: - result.append( parent.name ) - parent = parent.parent - result.reverse() - decl.cache.declaration_path = result - return result - else: - return decl.cache.declaration_path - -def partial_declaration_path( decl ): - """ - returns a list of parent declarations names without template arguments that - have default value - - @param decl: declaration for which declaration path should be calculated - @type decl: L{declaration_t} - - @return: [names], where first item contains top parent name and last item - contains decl name - """ - #TODO: - #If parent declaration cache already has declaration_path, reuse it for - #calculation. - if not decl: - return [] - if not decl.cache.partial_declaration_path: - result = [ decl.partial_name ] - parent = decl.parent - while parent: - if parent.cache.partial_declaration_path: - result.reverse() - decl.cache.partial_declaration_path \ - = parent.cache.partial_declaration_path + result - return decl.cache.partial_declaration_path - else: - result.append( parent.partial_name ) - parent = parent.parent - result.reverse() - decl.cache.partial_declaration_path = result - return result - else: - return decl.cache.partial_declaration_path - -def get_named_parent( decl ): - """ - returns a reference to a named parent declaration - - @param decl: the child declaration - @type decl: L{declaration_t} - - @return: reference to L{declaration_t} or None if not found - """ - if not decl: - return None - - parent = decl.parent - while parent and ( not parent.name or parent.name == '::' ): - parent = parent.parent - return parent - - -def full_name_from_declaration_path( dpath ): - ##Here I have lack of knowledge: - ##TODO: "What is the full name of declaration declared in unnamed namespace?" - result = filter( None, dpath ) - result = result[0] + '::'.join( result[1:] ) - return result - -def full_name( decl, with_defaults=True ): - """ - returns full name of the declaration - @param decl: declaration for which full name should be calculated. If decl - belongs to unnamed namespace, then L{full_name} is not valid C++ full name. - - @type decl: L{declaration_t} - - @return: full name of declarations. - """ - if None is decl: - raise RuntimeError( "Unable to generate full name for None object!" ) - if with_defaults: - if not decl.cache.full_name: - decl.cache.full_name = full_name_from_declaration_path( declaration_path( decl ) ) - return decl.cache.full_name - else: - if not decl.cache.full_partial_name: - decl.cache.full_partial_name \ - = full_name_from_declaration_path( partial_declaration_path( decl ) ) - return decl.cache.full_partial_name - -def make_flatten( decl_or_decls ): - """ - converts tree representation of declarations to flatten one. - - @param decl_or_decls: reference to list of declaration's or single declaration - @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] - - @return: [ all internal declarations ] - """ - import pygccxml.declarations #prevent cyclic import - def proceed_single( decl ): - answer = [ decl ] - if not isinstance( decl, pygccxml.declarations.scopedef_t ): - return answer - for elem in decl.declarations: - if isinstance( elem, pygccxml.declarations.scopedef_t ): - answer.extend( proceed_single( elem ) ) - else: - answer.append( elem ) - return answer - - decls = [] - if isinstance( decl_or_decls, types.ListType ): - decls.extend( decl_or_decls ) - else: - decls.append( decl_or_decls ) - answer = [] - for decl in decls: - answer.extend( proceed_single( decl ) ) - return answer - -def __make_flatten_generator( decl_or_decls ): - """ - converts tree representation of declarations to flatten one. - - @param decl_or_decls: reference to list of declaration's or single declaration - @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] - - @return: [ all internal declarations ] - """ - - import pygccxml.declarations - def proceed_single( decl ): - yield decl - if not isinstance( decl, pygccxml.declarations.scopedef_t): - return - for internal in decl.declarations: - if isinstance( internal, pygccxml.declarations.scopedef_t): - for internal_internal in proceed_single( internal ): - yield internal_internal - else: - yield internal - - if isinstance( decl_or_decls, types.ListType ): - for creator in decl_or_decls: - for internal in proceed_single( creator ): - yield internal - else: - for internal in proceed_single( decl_or_decls ): - yield internal - -def get_global_namespace(decls): - import pygccxml.declarations - found = filter( lambda decl: decl.name == '::' - and isinstance( decl, pygccxml.declarations.namespace_t ) - , make_flatten( decls ) ) - if len( found ) == 1: - return found[0] - raise RuntimeError( "Unable to find global namespace." ) - -class match_declaration_t: - """ - helper class for different search algorithms. - - This class will help developer to match declaration by: - - declaration type, for example L{class_t} or L{operator_t}. - - declaration name - - declaration full name - - reference to parent declaration - """ - - def __init__( self, type=None, name=None, fullname=None, parent=None ): - self.type = type - self.name = name - self.fullname = fullname - self.parent = parent - - def does_match_exist(self, inst): - """ - returns True if inst do match one of specified criteria - - @param inst: declaration instance - @type inst: L{declaration_t} - - @return: bool - """ - answer = True - if None != self.type: - answer &= isinstance( inst, self.type) - if None != self.name: - answer &= inst.name == self.name - if None != self.parent: - answer &= self.parent is inst.parent - if None != self.fullname: - if inst.name: - answer &= self.fullname == full_name( inst ) - else: - answer = False - return answer - - def __call__(self, inst): - """C{return self.does_match_exist(inst)}""" - return self.does_match_exist(inst) - -def find_all_declarations( declarations - , type=None - , name=None - , parent=None - , recursive=True - , fullname=None ): - """ - returns a list of all declarations that match criteria, defined by developer - - For more information about arguments see L{match_declaration_t} class. - - @return: [ matched declarations ] - """ - decls = [] - if recursive: - decls = make_flatten( declarations ) - else: - decls = declarations - - return filter( match_declaration_t(type, name, fullname, parent), decls ) - -def find_declaration( declarations - , type=None - , name=None - , parent=None - , recursive=True - , fullname=None ): - """ - returns single declaration that match criteria, defined by developer. - If more the one declaration was found None will be returned. - - For more information about arguments see L{match_declaration_t} class. - - @return: matched declaration L{declaration_t} or None - """ - decl = find_all_declarations( declarations, type=type, name=name, parent=parent, recursive=recursive, fullname=fullname ) - if len( decl ) == 1: - return decl[0] - -def find_first_declaration( declarations, type=None, name=None, parent=None, recursive=True, fullname=None ): - """ - returns first declaration that match criteria, defined by developer - - For more information about arguments see L{match_declaration_t} class. - - @return: matched declaration L{declaration_t} or None - """ - matcher = match_declaration_t(type, name, fullname, parent) - if recursive: - decls = make_flatten( declarations ) - else: - decls = declarations - for decl in decls: - if matcher( decl ): - return decl - return None - -def declaration_files(decl_or_decls): - """ - returns set of files - - Every declaration is declared in some file. This function returns set, that - contains all file names of declarations. - - @param decl_or_decls: reference to list of declaration's or single declaration - @type decl_or_decls: L{declaration_t} or [ L{declaration_t} ] - - @return: set( declaration file names ) - """ - files = set() - decls = make_flatten( decl_or_decls ) - for decl in decls: - if decl.location: - files.add( decl.location.file_name ) - return files - -class visit_function_has_not_been_found_t( RuntimeError ): - """ - exception that is raised, from L{apply_visitor}, when a visitor could not be - applied. - - """ - def __init__( self, visitor, decl_inst ): - RuntimeError.__init__( self ) - self.__msg = \ - "Unable to find visit function. Visitor class: %s. Declaration instance class: %s'" \ - % ( visitor.__class__.__name__, decl_inst.__class__.__name__ ) - def __str__(self): - return self.__msg - -def apply_visitor( visitor, decl_inst): - """ - applies a visitor on declaration instance - - @param visitor: instance - @type visitor: L{type_visitor_t} or L{decl_visitor_t} - """ - fname = 'visit_' + decl_inst.__class__.__name__[:-2] #removing '_t' from class name - if not hasattr(visitor, fname ): - raise visit_function_has_not_been_found_t( visitor, decl_inst ) - getattr( visitor, fname )() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithms_cache.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithms_cache.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithms_cache.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/algorithms_cache.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines class that will keep results of different calculations. -""" - - -class declaration_algs_cache_t( object ): - def __init__( self ): - object.__init__( self ) - self._enabled = True - self._full_name = None - self._full_partial_name = None - self._access_type = None - self._demangled_name = None - self._declaration_path = None - self._partial_declaration_path = None - self._container_key_type = None - self._container_element_type = None - - def disable( self ): - self._enabled = False - - def enable( self ): - self._enabled = True - - @property - def enabled( self ): - return self._enabled - - def _get_full_name( self ): - return self._full_name - def _set_full_name( self, fname ): - if not self.enabled: - fname = None - self._full_name = fname - full_name = property( _get_full_name, _set_full_name ) - - def _get_full_partial_name( self ): - return self._full_partial_name - def _set_full_partial_name( self, fname ): - if not self.enabled: - fname = None - self._full_partial_name = fname - full_partial_name = property( _get_full_partial_name, _set_full_partial_name ) - - def _get_access_type( self ): - return self._access_type - def _set_access_type( self, access_type ): - if not self.enabled: - access_type = None - self._access_type = access_type - access_type = property( _get_access_type, _set_access_type ) - - def _get_demangled_name( self ): - return self._demangled_name - def _set_demangled_name( self, demangled_name ): - if not self.enabled: - demangled_name = None - self._demangled_name = demangled_name - demangled_name = property( _get_demangled_name, _set_demangled_name ) - - def _get_declaration_path( self ): - return self._declaration_path - def _set_declaration_path( self, declaration_path ): - if not self.enabled: - declaration_path = None - self._declaration_path = declaration_path - declaration_path = property( _get_declaration_path, _set_declaration_path ) - - def _get_partial_declaration_path( self ): - return self._partial_declaration_path - def _set_partial_declaration_path( self, partial_declaration_path ): - if not self.enabled: - partial_declaration_path = None - self._partial_declaration_path = partial_declaration_path - partial_declaration_path = property( _get_partial_declaration_path - , _set_partial_declaration_path ) - - def _get_container_element_type( self ): - return self._container_element_type - def _set_container_element_type( self, etype ): - if not self.enabled: - etype = None - self._container_element_type = etype - container_element_type = property( _get_container_element_type, _set_container_element_type ) - - def _get_container_key_type( self ): - return self._container_key_type - def _set_container_key_type( self, ktype ): - if not self.enabled: - ktype = None - self._container_key_type = ktype - container_key_type = property( _get_container_key_type, _set_container_key_type ) - - def reset( self ): - self.full_name = None - self.full_partial_name = None - self.access_type = None - self.demangled_name = None - self.declaration_path = None - self.partial_declaration_path = None - self.container_key_type = None - self.container_element_type = None - - def reset_name_based( self ): - self.full_name = None - self.full_partial_name = None - self.demangled_name = None - self.declaration_path = None - self.partial_declaration_path = None - self.container_key_type = None - self.container_element_type = None - - def reset_access_type( self ): - self.access_type = None - -class type_algs_cache_t( object ): - enabled = True - - @staticmethod - def disable(): - type_algs_cache_t.enabled = False - - @staticmethod - def enable( self ): - type_algs_cache_t.enabled = True - - def __init__( self ): - object.__init__( self ) - self._remove_alias = None - - def _get_remove_alias( self ): - return self._remove_alias - def _set_remove_alias( self, remove_alias ): - if not type_algs_cache_t.enabled: - remove_alias = None - self._remove_alias = remove_alias - - remove_alias = property( _get_remove_alias, _set_remove_alias ) - - def reset(self): - self.remove_alias = None diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/calldef.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/calldef.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/calldef.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/calldef.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,561 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines classes, that describes "callable" declarations - -This modules contains definition for next C++ declarations: - - operator - - member - - free - - function - - member - - free - - constructor - - destructor -""" - -import cpptypes -import algorithm -import declaration -import type_traits -import dependencies -import call_invocation - -class VIRTUALITY_TYPES: - """class that defines "virtuality" constants""" - NOT_VIRTUAL = 'not virtual' - VIRTUAL = 'virtual' - PURE_VIRTUAL = 'pure virtual' - ALL = [NOT_VIRTUAL, VIRTUAL, PURE_VIRTUAL] -#preserving backward compatebility -FUNCTION_VIRTUALITY_TYPES = VIRTUALITY_TYPES - -#First level in hierarchy of calldef -class argument_t(object): - """ - class, that describes argument of "callable" declaration - """ - - def __init__( self, name='', type=None, default_value=None, attributes=None): - object.__init__(self) - self._name = name - self._default_value = default_value - self._type = type - self._attributes = attributes - - def clone( self, **keywd ): - """constructs new argument_t instance - - return argument_t( name=keywd.get( 'name', self.name ) - , type=keywd.get( 'type', self.type ) - , default_value=keywd.get( 'default_value', self.default_value ) - , attributes=keywd.get( 'attributes', self.attributes ) ) - - """ - return argument_t( name=keywd.get( 'name', self.name ) - , type=keywd.get( 'type', self.type ) - , default_value=keywd.get( 'default_value', self.default_value ) - , attributes=keywd.get( 'attributes', self.attributes ) ) - - def __str__(self): - if self.ellipsis: - return "..." - else: - if self.default_value==None: - return "%s %s"%(self.type, self.name) - else: - return "%s %s=%s"%(self.type, self.name, self.default_value) - - def __eq__(self, other): - if not isinstance( other, self.__class__ ): - return False - return self.name == other.name \ - and self.default_value == other.default_value \ - and self.type == other.type - - def __ne__( self, other): - return not self.__eq__( other ) - - def __lt__(self, other): - if not isinstance( other, self.__class__ ): - return self.__class__.__name__ < other.__class__.__name__ - return self.name < other.name \ - and self.default_value < other.default_value \ - and self.type < other.type - - def _get_name(self): - return self._name - def _set_name(self, name): - self._name = name - name = property( _get_name, _set_name - , doc="""Argument name. - @type: str""" ) - - @property - def ellipsis(self): - """bool, if True argument represents ellipsis ( "..." ) in function definition""" - return isinstance( self.type, cpptypes.ellipsis_t ) - - def _get_default_value(self): - return self._default_value - def _set_default_value(self, default_value): - self._default_value = default_value - default_value = property( _get_default_value, _set_default_value - , doc="""Argument's default value or None. - @type: str""") - - def _get_type(self): - return self._type - def _set_type(self, type): - self._type = type - type = property( _get_type, _set_type - , doc="""The type of the argument. - @type: L{type_t}""") - - def _get_attributes( self ): - return self._attributes - def _set_attributes( self, attributes ): - self._attributes = attributes - attributes = property( _get_attributes, _set_attributes - , doc="""GCCXML attributes, set using __attribute__((gccxml("..."))) - @type: str - """ ) - - -class calldef_t( declaration.declaration_t ): - """base class for all "callable" declarations""" - def __init__( self, name='', arguments=None, exceptions=None, return_type=None, has_extern=False, does_throw=True ): - declaration.declaration_t.__init__( self, name ) - if not arguments: - arguments = [] - self._arguments = arguments - if not exceptions: - exceptions = [] - self._does_throw = does_throw - self._exceptions = exceptions - self._return_type = return_type - self._has_extern = has_extern - self._demangled_name = None - - def _get__cmp__call_items(self): - """implementation details""" - raise NotImplementedError() - - def _get__cmp__items( self ): - """implementation details""" - items = [ self.arguments - , self.return_type - , self.has_extern - , self.does_throw - , self._sorted_list( self.exceptions ) ] - items.extend( self._get__cmp__call_items() ) - return items - - def __eq__(self, other): - if not declaration.declaration_t.__eq__( self, other ): - return False - return self.return_type == other.return_type \ - and self.arguments == other.arguments \ - and self.has_extern == other.has_extern \ - and self.does_throw == other.does_throw \ - and self._sorted_list( self.exceptions ) \ - == other._sorted_list( other.exceptions ) - - def _get_arguments(self): - return self._arguments - def _set_arguments(self, arguments): - self._arguments = arguments - arguments = property( _get_arguments , _set_arguments - , doc="""The argument list. - @type: list of L{argument_t}""") - - @property - def has_ellipsis( self ): - return self.arguments and self.arguments[-1].ellipsis - - @property - def argument_types( self ): - """list of all argument types""" - return [ arg.type for arg in self.arguments ] - - @property - def required_args(self): - """list of all required arguments""" - r_args = [] - for arg in self.arguments: - if not arg.default_value: - r_args.append( arg ) - else: - break - return r_args - - @property - def optional_args(self): - """list of all optional arguments, the arguments that have default value""" - return self.arguments[ len( self.required_args ) : ] - - def _get_does_throw(self): - return self._does_throw - def _set_does_throw(self, does_throw): - self._does_throw = does_throw - does_throw = property( _get_does_throw, _set_does_throw, - doc="""If False, than function does not throw any exception. - In this case, function was declared with empty throw - statement. - """) - - def _get_exceptions(self): - return self._exceptions - def _set_exceptions(self, exceptions): - self._exceptions = exceptions - exceptions = property( _get_exceptions, _set_exceptions - , doc="""The list of exceptions. - @type: list of L{declaration_t}""") - - def _get_return_type(self): - return self._return_type - def _set_return_type(self, return_type): - self._return_type = return_type - return_type = property( _get_return_type, _set_return_type - , doc='''The type of the return value of the "callable" or None (constructors). - @type: L{type_t} - ''') - @property - def overloads(self): - """A list of overloaded "callables" (i.e. other callables with the same name within the same scope. - - @type: list of L{calldef_t} - """ - if not self.parent: - return [] - # finding all functions with the same name - return self.parent.calldefs( name=self.name - , function=lambda decl: not (decl is self ) - , allow_empty=True - , recursive=False ) - - def _get_has_extern(self): - return self._has_extern - def _set_has_extern(self, has_extern): - self._has_extern = has_extern - has_extern = property( _get_has_extern, _set_has_extern, - doc="""Was this callable declared as "extern"? - @type: bool - """) - - def __remove_parent_fname( self, demangled ): - """implementation details""" - demangled = demangled.strip() - parent_fname = algorithm.full_name( self.parent ) - if parent_fname.startswith( '::' ) and not demangled.startswith( '::' ): - parent_fname = parent_fname[2:] - demangled = demangled[ len( parent_fname ): ] - return demangled - - def _get_demangled_name( self ): - if not self.demangled: - self._demangled_name = '' - - if self._demangled_name: - return self._demangled_name - - if self._demangled_name == '': - return self.name - - demangled = self.demangled - if self.return_type: - return_type = type_traits.remove_alias( self.return_type ).decl_string - - if return_type.startswith( '::' ) and not self.demangled.startswith( '::' ): - return_type = return_type[2:] - demangled = self.demangled - if demangled.startswith( return_type ): - demangled = demangled[ len( return_type ): ] - demangled = demangled.strip() - #removing scope - demangled_name = call_invocation.name( self.__remove_parent_fname( demangled ) ) - if demangled_name.startswith( '::' ): - demangled_name = demangled_name[2:] - #to be on the safe side - if demangled_name.startswith( self.name ): - self._demangled_name = demangled_name - return self._demangled_name - - #well, I am going to try an other strategy - fname = algorithm.full_name( self ) - found = self.demangled.find( fname ) - if -1 == found: - if fname.startswith( '::' ): - fname = fname[2:] - found = self.demangled.find( fname ) - if -1 == found: - self._demangled_name = '' - return self.name - demangled_name = call_invocation.name( self.demangled[ found: ] ) - demangled_name = self.__remove_parent_fname( demangled_name ) - if demangled_name.startswith( '::' ): - demangled_name = demangled_name[2:] - #to be on the safe side - if demangled_name.startswith( self.name ): - self._demangled_name = demangled_name - return self._demangled_name - #if -1 == found: - self._demangled_name = '' - return self.name - - demangled_name = property( _get_demangled_name - , doc="returns function demangled name. It can help you to deal with function template instantiations") - - def i_depend_on_them( self, recursive=True ): - report_dependency = lambda *args, **keywd: dependencies.dependency_info_t( self, *args, **keywd ) - answer = [] - if self.return_type: - answer.append( report_dependency( self.return_type, hint="return type" ) ) - map( lambda arg: answer.append( report_dependency( arg.type ) ) - , self.arguments ) - map( lambda exception: answer.append( report_dependency( exception, hint="exception" ) ) - , self.exceptions ) - return answer - -#Second level in hierarchy of calldef -class member_calldef_t( calldef_t ): - """base class for "callable" declarations that defined within C++ class or struct""" - def __init__( self, virtuality=None, has_const=None, has_static=None, *args, **keywords ): - calldef_t.__init__( self, *args, **keywords ) - self._virtuality = virtuality - self._has_const = has_const - self._has_static = has_static - - def __str__(self): - # Get the full name of the calldef... - name = algorithm.full_name(self) - if name[:2]=="::": - name = name[2:] - # Add the arguments... - args = map(lambda a: str(a), self.arguments) - res = "%s(%s)"%(name, ", ".join(args)) - # Add the return type... - if self.return_type!=None: - res = "%s %s"%(self.return_type, res) - # const? - if self.has_const: - res += " const" - # static? - if self.has_static: - res = "static "+res - # Append the declaration class - cls = self.__class__.__name__ - if cls[-2:]=="_t": - cls = cls[:-2] - cls = cls.replace( '_', ' ' ) - return "%s [%s]"%(res, cls) - - def _get__cmp__call_items(self): - """implementation details""" - return [ self.virtuality, self.has_static, self.has_const ] - - def __eq__(self, other): - if not calldef_t.__eq__( self, other ): - return False - return self.virtuality == other.virtuality \ - and self.has_static == other.has_static \ - and self.has_const == other.has_const - - def get_virtuality(self): - return self._virtuality - def set_virtuality(self, virtuality): - assert virtuality in VIRTUALITY_TYPES.ALL - self._virtuality = virtuality - virtuality = property( get_virtuality, set_virtuality - , doc="""Describes the "virtuality" of the member (as defined by the string constants in the class L{VIRTUALITY_TYPES}). - @type: str""") - - def _get_access_type(self): - return self.parent.find_out_member_access_type( self ) - access_type = property( _get_access_type - , doc="""Return the access type of the member (as defined by the string constants in the class L{ACCESS_TYPES}. - @type: str""") - - def _get_has_const(self): - return self._has_const - def _set_has_const(self, has_const): - self._has_const = has_const - has_const = property( _get_has_const, _set_has_const - , doc="""describes, whether "callable" has const modifier or not""") - - def _get_has_static(self): - return self._has_static - def _set_has_static(self, has_static): - self._has_static = has_static - has_static = property( _get_has_static, _set_has_static - , doc="""describes, whether "callable" has static modifier or not""") - - def function_type(self): - """returns function type. See L{type_t} hierarchy""" - if self.has_static: - return cpptypes.free_function_type_t( return_type=self.return_type - , arguments_types=[ arg.type for arg in self.arguments ] ) - else: - return cpptypes.member_function_type_t( class_inst=self.parent - , return_type=self.return_type - , arguments_types=[ arg.type for arg in self.arguments ] - , has_const=self.has_const ) - - def create_decl_string(self, with_defaults=True): - f_type = self.function_type() - if with_defaults: - return f_type.decl_string - else: - return f_type.partial_decl_string - -class free_calldef_t( calldef_t ): - """base class for "callable" declarations that defined within C++ namespace""" - def __init__( self, *args, **keywords ): - calldef_t.__init__( self, *args, **keywords ) - - def __str__(self): - # Get the full name of the calldef... - name = algorithm.full_name(self) - if name[:2]=="::": - name = name[2:] - # Add the arguments... - args = map(lambda a: str(a), self.arguments) - res = "%s(%s)"%(name, ", ".join(args)) - # Add the return type... - if self.return_type!=None: - res = "%s %s"%(self.return_type, res) - # extern? - if self.has_extern: - res = "extern "+res - # Append the declaration class - cls = self.__class__.__name__ - if cls[-2:]=="_t": - cls = cls[:-2] - cls = cls.replace( '_', ' ' ) - return "%s [%s]"%(res, cls) - - def _get__cmp__call_items(self): - """implementation details""" - return [] - - def function_type(self): - """returns function type. See L{type_t} hierarchy""" - return cpptypes.free_function_type_t( return_type=self.return_type - , arguments_types=[ arg.type for arg in self.arguments ] ) - - def create_decl_string(self, with_defaults=True): - f_type = self.function_type() - if with_defaults: - return f_type.decl_string - else: - return f_type.partial_decl_string - - -class operator_t(object): - """base class for "operator" declarations""" - OPERATOR_WORD_LEN = len( 'operator' ) - def __init__(self): - object.__init__(self) - - @property - def symbol(self): - "operator's symbol. For example: operator+, symbol is equal to '+'" - return self.name[operator_t.OPERATOR_WORD_LEN:].strip() - -#Third level in hierarchy of calldef -class member_function_t( member_calldef_t ): - """describes member function declaration""" - def __init__( self, *args, **keywords ): - member_calldef_t.__init__( self, *args, **keywords ) - -class constructor_t( member_calldef_t ): - """describes constructor declaration""" - def __init__( self, *args, **keywords ): - member_calldef_t.__init__( self, *args, **keywords ) - - def __str__(self): - # Get the full name of the calldef... - name = algorithm.full_name(self) - if name[:2]=="::": - name = name[2:] - # Add the arguments... - args = map(lambda a: str(a), self.arguments) - res = "%s(%s)"%(name, ", ".join(args)) - # Append the declaration class - cls = 'constructor' - if self.is_copy_constructor: - cls = 'copy ' + cls - return "%s [%s]"%(res, cls) - - @property - def is_copy_constructor(self): - """returns True if described declaration is copy constructor, otherwise False""" - args = self.arguments - if 1 != len( args ): - return False - arg = args[0] - if not type_traits.is_reference( arg.type ): - return False - if not type_traits.is_const( arg.type.base ): - return False - unaliased = type_traits.remove_alias( arg.type.base ) - #unaliased now refers to const_t instance - if not isinstance( unaliased.base, cpptypes.declarated_t ): - return False - return id(unaliased.base.declaration) == id(self.parent) - - @property - def is_trivial_constructor(self): - return not bool( self.arguments ) - - -class destructor_t( member_calldef_t ): - """describes deconstructor declaration""" - def __init__( self, *args, **keywords ): - member_calldef_t.__init__( self, *args, **keywords ) - -class member_operator_t( member_calldef_t, operator_t ): - """describes member operator declaration""" - def __init__( self, *args, **keywords ): - member_calldef_t.__init__( self, *args, **keywords ) - operator_t.__init__( self, *args, **keywords ) - self.__class_types = None - -class casting_operator_t( member_calldef_t, operator_t ): - """describes casting operator declaration""" - def __init__( self, *args, **keywords ): - member_calldef_t.__init__( self, *args, **keywords ) - operator_t.__init__( self, *args, **keywords ) - -class free_function_t( free_calldef_t ): - """describes free function declaration""" - def __init__( self, *args, **keywords ): - free_calldef_t.__init__( self, *args, **keywords ) - -class free_operator_t( free_calldef_t, operator_t ): - """describes free operator declaration""" - def __init__( self, *args, **keywords ): - free_calldef_t.__init__( self, *args, **keywords ) - operator_t.__init__( self, *args, **keywords ) - self.__class_types = None - - @property - def class_types( self ): - """list of class/class declaration types, extracted from the operator arguments""" - if None is self.__class_types: - self.__class_types = [] - for type_ in self.argument_types: - decl = None - type_ = type_traits.remove_reference( type_ ) - if type_traits.is_class( type_ ): - decl = type_traits.class_traits.get_declaration( type_ ) - elif type_traits.is_class_declaration( type_ ): - decl = type_traits.class_declaration_traits.get_declaration( type_ ) - else: - pass - if decl: - self.__class_types.append( decl ) - return self.__class_types diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/call_invocation.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/call_invocation.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/call_invocation.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/call_invocation.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -free function call parser - -This module implements all functionality necessary to parse C++ free function -invocation. In other words this module is able to extract next information from -the string like this C{ print_message( message ) }. - - name ( print_message ) - - list of arguments ( message ) - -This module also defines few convenience function like L{split} and L{join}. -""" - -import pattern_parser - -__THE_PARSER = pattern_parser.parser_t( '(', ')', ',' ) - -def is_call_invocation( decl_string ): - """ - returns True if decl_string is function invocation and False otherwise - - @param decl_string: string that should be checked for pattern presence - @type decl_string: str - - @return: bool - """ - global __THE_PARSER - return __THE_PARSER.has_pattern( decl_string ) - -def name( decl_string ): - """ - returns name of function - - @type decl_string: str - @return: str - """ - global __THE_PARSER - return __THE_PARSER.name( decl_string ) - -def args( decl_string ): - """ - returns list of function arguments - - @type decl_string: str - @return: [str] - """ - global __THE_PARSER - return __THE_PARSER.args( decl_string ) - -NOT_FOUND = __THE_PARSER.NOT_FOUND -def find_args( text, start=None ): - """ - finds arguments within function invocation. - - @type text: str - @return: [ arguments ] or L{NOT_FOUND} if arguments could not be found - """ - global __THE_PARSER - return __THE_PARSER.find_args( text, start ) - -def split( decl_string ): - """returns (name, [arguments] )""" - global __THE_PARSER - return __THE_PARSER.split( decl_string ) - -def split_recursive( decl_string ): - """returns [(name, [arguments])]""" - global __THE_PARSER - return __THE_PARSER.split_recursive( decl_string ) - -def join( name, args, arg_separator=None ): - """returns name( argument_1, argument_2, ..., argument_n )""" - global __THE_PARSER - return __THE_PARSER.join( name, args, arg_separator ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/class_declaration.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/class_declaration.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/class_declaration.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/class_declaration.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,532 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines classes, that describes C++ classes - -This modules contains definition for next C++ declarations: - - class definition - - class declaration - - small helper class for describing C++ class hierarchy -""" - -import scopedef -import itertools -import compilers -import algorithm -import declaration -import dependencies -from pygccxml import utils - -class ACCESS_TYPES: - """class that defines "access" constants""" - PUBLIC = "public" - PRIVATE = "private" - PROTECTED = "protected" - ALL = [ PUBLIC, PRIVATE, PROTECTED ] - -class CLASS_TYPES: - """class that defines "class" type constants""" - CLASS = "class" - STRUCT = "struct" - UNION = "union" - ALL = [ CLASS, STRUCT, UNION ] - -def get_partial_name( name ): - import templates - import container_traits #prevent cyclic dependencies - ct = container_traits.find_container_traits( name ) - if ct: - return ct.remove_defaults( name ) - elif templates.is_instantiation( name ): - tmpl_name, args = templates.split( name ) - for i, arg_name in enumerate( args ): - args[i] = get_partial_name( arg_name.strip() ) - return templates.join( tmpl_name, args ) - else: - return name - - -class hierarchy_info_t( object ): - """describes class relationship""" - def __init__(self, related_class=None, access=None, is_virtual=False ): - """creates class that contains partial information about class relationship""" - if related_class: - assert( isinstance( related_class, class_t ) ) - self._related_class = related_class - if access: - assert( access in ACCESS_TYPES.ALL) - self._access=access - self._is_virtual = is_virtual - - def __eq__(self, other): - if not isinstance( other, hierarchy_info_t ): - return False - return algorithm.declaration_path( self.related_class ) == algorithm.declaration_path( other.related_class ) \ - and self.access == other.access \ - and self.is_virtual == other.is_virtual - - def __ne__( self, other): - return not self.__eq__( other ) - - def __lt__(self, other): - if not isinstance( other, self.__class__ ): - return self.__class__.__name__ < other.__class__.__name__ - return ( algorithm.declaration_path( self.related_class ), self.access, self.is_virtual ) \ - < ( algorithm.declaration_path( other.related_class ), other.access, self.is_virtual ) - - def _get_related_class(self): - return self._related_class - def _set_related_class(self, new_related_class): - if new_related_class: - assert( isinstance( new_related_class, class_t ) ) - self._related_class = new_related_class - related_class = property( _get_related_class, _set_related_class - , doc="reference to base or derived L{class}") - - def _get_access(self): - return self._access - def _set_access(self, new_access): - assert( new_access in ACCESS_TYPES.ALL ) - self._access = new_access - access = property( _get_access, _set_access ) - access_type = property( _get_access, _set_access - , doc="describes L{hierarchy type}") - - #TODO: check whether GCC XML support this and if so parser this information - def _get_is_virtual(self): - return self._is_virtual - def _set_is_virtual(self, new_is_virtual): - self._is_virtual = new_is_virtual - is_virtual = property( _get_is_virtual, _set_is_virtual - , doc="indicates whether the inheritance is virtual or not") - - -class class_declaration_t( declaration.declaration_t ): - """describes class declaration""" - def __init__( self, name='' ): - """creates class that describes C++ class declaration( and not definition )""" - declaration.declaration_t.__init__( self, name ) - self._aliases = [] - self._container_traits = None - self._container_traits_set = False - - def _get__cmp__items(self): - """implementation details""" - return [] - - def i_depend_on_them( self, recursive=True ): - return [] - - def _get_aliases(self): - return self._aliases - def _set_aliases( self, new_aliases ): - self._aliases = new_aliases - aliases = property( _get_aliases, _set_aliases - , doc="List of L{aliases} to this instance") - - @property - def container_traits( self ): - """reference to L{container traits} or None""" - if self._container_traits_set == False: - import container_traits #prevent cyclic dependencies - self._container_traits_set = True - self._container_traits = container_traits.find_container_traits( self ) - return self._container_traits - - def _get_partial_name_impl( self ): - return get_partial_name( self.name ) - -class class_t( scopedef.scopedef_t ): - """describes class definition""" - - USE_DEMANGLED_AS_NAME = True - def __init__( self, name='', class_type=CLASS_TYPES.CLASS, is_abstract=False ): - """creates class that describes C++ class definition""" - scopedef.scopedef_t.__init__( self, name ) - if class_type: - assert( class_type in CLASS_TYPES.ALL ) - self._class_type = class_type - self._bases = [] - self._derived = [] - self._is_abstract = is_abstract - self._public_members = [] - self._private_members = [] - self._protected_members = [] - self._aliases = [] - self._byte_size = 0 - self._byte_align = 0 - self._container_traits = None - self._container_traits_set = False - self._recursive_bases = None - self._recursive_derived = None - - def _get_name_impl( self ): - if not self._name: #class with empty name - return self._name - elif class_t.USE_DEMANGLED_AS_NAME and self.demangled and 'GCC' in self.compiler: - if not self.cache.demangled_name: - fname = algorithm.full_name( self.parent ) - if fname.startswith( '::' ) and not self.demangled.startswith( '::' ): - fname = fname[2:] - if self.demangled.startswith( fname ): - tmp = self.demangled[ len( fname ): ] #demangled::name - if tmp.startswith( '::' ): - tmp = tmp[2:] - if '<' not in tmp and '<' in self._name: - #we have template class, but for some reason demangled - #name doesn't contain any template - #This happens for std::string class, but this breaks - #other cases, because this behaviour is not consistent - self.cache.demangled_name = self._name - return self.cache.demangled_name - else: - self.cache.demangled_name = tmp - return tmp - else: - self.cache.demangled_name = self._name - return self._name - else: - return self.cache.demangled_name - else: - return self._name - - def __str__(self): - name = algorithm.full_name(self) - if name[:2]=="::": - name = name[2:] - return "%s [%s]"%(name, self.class_type) - - def _get__cmp__scope_items(self): - """implementation details""" - return [ self.class_type - , self._sorted_list( [ algorithm.declaration_path( base.related_class ) for base in self.bases ] ) - , self._sorted_list( [ algorithm.declaration_path( derive.related_class ) for derive in self.derived ] ) - , self.is_abstract - , self._sorted_list( self.public_members ) - , self._sorted_list( self.private_members ) - , self._sorted_list( self.protected_members ) ] - - def __eq__(self, other): - if not scopedef.scopedef_t.__eq__( self, other ): - return False - return self.class_type == other.class_type \ - and self._sorted_list( [ algorithm.declaration_path( base.related_class ) for base in self.bases ] ) \ - == other._sorted_list( [ algorithm.declaration_path( base.related_class ) for base in other.bases ] ) \ - and self._sorted_list( [ algorithm.declaration_path( derive.related_class ) for derive in self.derived ] ) \ - == other._sorted_list( [ algorithm.declaration_path( derive.related_class ) for derive in other.derived ] ) \ - and self.is_abstract == other.is_abstract \ - and self._sorted_list( self.public_members ) \ - == other._sorted_list( other.public_members ) \ - and self._sorted_list( self.private_members ) \ - == other._sorted_list( other.private_members ) \ - and self._sorted_list( self.protected_members ) \ - == self._sorted_list( other.protected_members ) - - def _get_class_type(self): - return self._class_type - def _set_class_type( self, new_class_type): - if new_class_type: - assert( new_class_type in CLASS_TYPES.ALL ) - self._class_type = new_class_type - class_type = property( _get_class_type, _set_class_type - , doc="describes class L{type}") - - def _get_bases(self): - return self._bases - def _set_bases( self, new_bases ): - self._bases = new_bases - bases = property( _get_bases, _set_bases - , doc="list of L{base classes}") - - @property - def recursive_bases(self): - """list of all L{base classes}""" - if self._recursive_bases is None: - to_go = self.bases[:] - all_bases = [] - while to_go: - base = to_go.pop() - if base not in all_bases: - all_bases.append( base ) - to_go.extend( base.related_class.bases ) - self._recursive_bases = all_bases - return self._recursive_bases - - def _get_derived(self): - return self._derived - def _set_derived( self, new_derived ): - self._derived = new_derived - derived = property( _get_derived, _set_derived - , doc="list of L{derived classes}") - - @property - def recursive_derived(self): - """list of all L{derive classes}""" - if self._recursive_derived is None: - to_go = self.derived[:] - all_derived = [] - while to_go: - derive = to_go.pop() - if derive not in all_derived: - all_derived.append( derive ) - to_go.extend( derive.related_class.derived ) - self._recursive_derived = all_derived - return self._recursive_derived - - def _get_is_abstract(self): - if self.compiler == compilers.MSVC_PDB_9: - #prevent cyclic dependencies - import calldef - import function_traits - from matchers import virtuality_type_matcher_t as vtmatcher_t - filter_pv = vtmatcher_t( calldef.VIRTUALITY_TYPES.PURE_VIRTUAL ) - if self.calldefs( filter_pv, recursive=False, allow_empty=True ): - return True - filter_npv = vtmatcher_t( calldef.VIRTUALITY_TYPES.VIRTUAL ) \ - | vtmatcher_t( calldef.VIRTUALITY_TYPES.NOT_VIRTUAL ) - pv_calldefs = [] - npv_calldefs = [] - - npv_calldefs.extend( self.calldefs( filter_npv, recursive=False, allow_empty=True ) ) - for base in self.recursive_bases: - cls = base.related_class - pv_calldefs.extend( cls.calldefs( filter_pv, recursive=False, allow_empty=True ) ) - npv_calldefs.extend( cls.calldefs( filter_npv, recursive=False, allow_empty=True ) ) - - for pure_virtual in pv_calldefs: - impl_found = filter( lambda f: function_traits.is_same_function( pure_virtual, f ) - , npv_calldefs ) - if not impl_found: - return True - return False - else: - return self._is_abstract - def _set_is_abstract( self, is_abstract ): - self._is_abstract = is_abstract - is_abstract = property( _get_is_abstract, _set_is_abstract - ,doc="describes whether class abstract or not" ) - - def _get_public_members(self): - return self._public_members - def _set_public_members( self, new_public_members ): - self._public_members = new_public_members - public_members = property( _get_public_members, _set_public_members - , doc="list of all public L{members}") - - def _get_private_members(self): - return self._private_members - def _set_private_members( self, new_private_members ): - self._private_members = new_private_members - private_members = property( _get_private_members, _set_private_members - , doc="list of all private L{members}") - - def _get_protected_members(self): - return self._protected_members - def _set_protected_members( self, new_protected_members ): - self._protected_members = new_protected_members - protected_members = property( _get_protected_members, _set_protected_members - , doc="list of all protected L{members}" ) - - def _get_aliases(self): - return self._aliases - def _set_aliases( self, new_aliases ): - self._aliases = new_aliases - aliases = property( _get_aliases, _set_aliases - , doc="List of L{aliases} to this instance") - - def _get_byte_size(self): - return self._byte_size - def _set_byte_size( self, new_byte_size ): - self._byte_size = new_byte_size - byte_size = property( _get_byte_size, _set_byte_size - , doc="Size of this class in bytes @type: int") - - def _get_byte_align(self): - if self.compiler == compilers.MSVC_PDB_9: - compilers.on_missing_functionality( self.compiler, "byte align" ) - return self._byte_align - def _set_byte_align( self, new_byte_align ): - self._byte_align = new_byte_align - byte_align = property( _get_byte_align, _set_byte_align - , doc="Alignment of this class in bytes @type: int") - - def _get_declarations_impl(self): - return self.get_members() - - def get_members( self, access=None): - """ - returns list of members according to access type - - If access equals to None, then returned list will contain all members. - You should not modify the list content, otherwise different optimization - data will stop work and may to give you wrong results. - - @param access: describes desired members - @type access: L{ACCESS_TYPES} - - @return: [ members ] - """ - if access == ACCESS_TYPES.PUBLIC: - return self.public_members - elif access == ACCESS_TYPES.PROTECTED: - return self.protected_members - elif access == ACCESS_TYPES.PRIVATE: - return self.private_members - else: - all_members = [] - all_members.extend( self.public_members ) - all_members.extend( self.protected_members ) - all_members.extend( self.private_members ) - return all_members - - def adopt_declaration( self, decl, access ): - """adds new declaration to the class - - @param decl: reference to a L{declaration} - - @param access: member access type - @type access: L{ACCESS_TYPES} - """ - if access == ACCESS_TYPES.PUBLIC: - self.public_members.append( decl ) - elif access == ACCESS_TYPES.PROTECTED: - self.protected_members.append( decl ) - elif access == ACCESS_TYPES.PRIVATE: - self.private_members.append( decl ) - else: - raise RuntimeError( "Invalid access type: %s." % access ) - decl.parent = self - decl.cache.reset() - decl.cache.access_type = access - - def remove_declaration( self, decl ): - """ - removes decl from members list - - @param decl: declaration to be removed - @type decl: L{declaration_t} - """ - container = None - access_type = self.find_out_member_access_type( decl ) - if access_type == ACCESS_TYPES.PUBLIC: - container = self.public_members - elif access_type == ACCESS_TYPES.PROTECTED: - container = self.protected_members - else: #decl.cache.access_type == ACCESS_TYPES.PRVATE - container = self.private_members - del container[ container.index( decl ) ] - decl.cache.reset() - - def find_out_member_access_type( self, member ): - """ - returns member access type - - @param member: member of the class - @type member: L{declaration_t} - - @return: L{ACCESS_TYPES} - """ - assert member.parent is self - if not member.cache.access_type: - access_type = None - if member in self.public_members: - access_type = ACCESS_TYPES.PUBLIC - elif member in self.protected_members: - access_type = ACCESS_TYPES.PROTECTED - elif member in self.private_members: - access_type = ACCESS_TYPES.PRIVATE - else: - raise RuntimeError( "Unable to find member within internal members list." ) - member.cache.access_type = access_type - return access_type - else: - return member.cache.access_type - - def __find_out_member_dependencies( self, access_type ): - members = self.get_members( access_type ) - answer = [] - map( lambda mem: answer.extend( mem.i_depend_on_them(recursive=True) ), members ) - member_ids = set( map( lambda m: id( m ), members ) ) - for dependency in answer: - if id( dependency.declaration ) in member_ids: - dependency.access_type = access_type - return answer - - def i_depend_on_them( self, recursive=True ): - report_dependency = lambda *args: dependencies.dependency_info_t( self, *args ) - - answer = [] - - map( lambda base: answer.append( report_dependency( base.related_class, base.access_type, "base class" ) ) - , self.bases ) - - if recursive: - map( lambda access_type: answer.extend( self.__find_out_member_dependencies( access_type ) ) - , ACCESS_TYPES.ALL ) - - return answer - - @property - def container_traits( self ): - """reference to L{container traits} or None""" - if self._container_traits_set == False: - import container_traits #prevent cyclic dependencies - self._container_traits_set = True - self._container_traits = container_traits.find_container_traits( self ) - return self._container_traits - - def find_copy_constructor( self ): - copy_ = self.constructors( lambda x: x.is_copy_constructor, recursive=False, allow_empty=True ) - if copy_: - return copy_[0] - else: - return None - - def find_trivial_constructor( self ): - trivial = self.constructors( lambda x: x.is_trivial_constructor, recursive=False, allow_empty=True ) - if trivial: - return trivial[0] - else: - return None - - def _get_partial_name_impl( self ): - import type_traits #prevent cyclic dependencies - if type_traits.is_std_string( self ): - return 'string' - elif type_traits.is_std_wstring( self ): - return 'wstring' - else: - return get_partial_name( self.name ) - - def find_noncopyable_vars( self ): - """returns list of all noncopyable variables""" - import type_traits as tt#prevent cyclic dependencies - logger = utils.loggers.cxx_parser - mvars = self.vars( lambda v: not v.type_qualifiers.has_static, recursive=False, allow_empty=True ) - noncopyable_vars = [] - for mvar in mvars: - type_ = tt.remove_reference( mvar.type ) - if tt.is_const( type_ ): - no_const = tt.remove_const( type_ ) - if tt.is_fundamental( no_const ) or tt.is_enum( no_const): - logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes const member variable - fundamental or enum" % self.decl_string ) - noncopyable_vars.append( mvar ) - if tt.is_class( no_const ): - logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes const member variable - class" % self.decl_string ) - noncopyable_vars.append( mvar ) - if tt.is_array( no_const ): - logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes const member variable - array" % self.decl_string ) - noncopyable_vars.append( mvar ) - if tt.class_traits.is_my_case( type_ ): - cls = tt.class_traits.get_declaration( type_ ) - if tt.is_noncopyable( cls ): - logger.debug( "__contains_noncopyable_mem_var - %s - TRUE - containes member variable - class that is not copyable" % self.decl_string ) - noncopyable_vars.append( mvar ) - logger.debug( "__contains_noncopyable_mem_var - %s - false - doesn't contains noncopyable members" % self.decl_string ) - return noncopyable_vars - - -class_types = ( class_t, class_declaration_t ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/compilers.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/compilers.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/compilers.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/compilers.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -contains enumeration of all compilers supported by the project -""" - -GCC_XML_06 = "GCC-XML 0.6" -GCC_XML_07 = "GCC-XML 0.7" -GCC_XML_09 = "GCC-XML 0.9" -GCC_XML_09_BUGGY = "GCC-XML 0.9 BUGGY" -#revision 122: -#After this fix, all constructors and destructors that exist for a class -#are dumped whether the user declared them or not. Those that were -#implicitly declared by the compiler are marked as "artificial". - -MSVC_PDB_9 = "MSVC PDB 9.0" - -def on_missing_functionality( compiler, functionality ): - raise NotImplementedError( '"%s" compiler doesn\'t support functionality "%s"' - % ( compiler, functionality )) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/container_traits.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/container_traits.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/container_traits.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/container_traits.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,485 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines few algorithms, that deals with different properties of std containers -""" - -import types -import string -import calldef -import cpptypes -import namespace -import templates -import type_traits -import class_declaration - -std_namespaces = ( 'std', 'stdext', '__gnu_cxx' ) - -class defaults_eraser: - @staticmethod - def normalize( type_str ): - return type_str.replace( ' ', '' ) - - @staticmethod - def replace_basic_string( cls_name ): - strings = { - 'std::string' : ( 'std::basic_string,std::allocator >' - , 'std::basic_string, std::allocator >' ) - , 'std::wstring' : ( 'std::basic_string,std::allocator >' - , 'std::basic_string, std::allocator >' ) } - - new_name = cls_name - for short_name, long_names in strings.iteritems(): - for lname in long_names: - new_name = new_name.replace( lname, short_name ) - return new_name - - class recursive_impl: - @staticmethod - def decorated_call_prefix( cls_name, text, doit ): - has_text = cls_name.startswith( text ) - if has_text: - cls_name = cls_name[ len( text ): ] - answer = doit( cls_name ) - if has_text: - answer = text + answer - return answer - - @staticmethod - def decorated_call_suffix( cls_name, text, doit ): - has_text = cls_name.endswith( text ) - if has_text: - cls_name = cls_name[: len( text )] - answer = doit( cls_name ) - if has_text: - answer = answer + text - return answer - - @staticmethod - def erase_call( cls_name ): - global find_container_traits - c_traits = find_container_traits( cls_name ) - if not c_traits: - return cls_name - return c_traits.remove_defaults( cls_name ) - - @staticmethod - def erase_recursive( cls_name ): - ri = defaults_eraser.recursive_impl - no_std = lambda cls_name: ri.decorated_call_prefix( cls_name, 'std::', ri.erase_call ) - no_stdext = lambda cls_name: ri.decorated_call_prefix( cls_name, 'stdext::', no_std ) - no_gnustd = lambda cls_name: ri.decorated_call_prefix( cls_name, '__gnu_cxx::', no_stdext ) - no_const = lambda cls_name: ri.decorated_call_prefix( cls_name, 'const ', no_gnustd ) - no_end_const = lambda cls_name: ri.decorated_call_suffix( cls_name, ' const', no_const ) - return no_end_const( cls_name ) - - @staticmethod - def erase_recursive( cls_name ): - return defaults_eraser.recursive_impl.erase_recursive( cls_name ) - - @staticmethod - def erase_allocator( cls_name, default_allocator='std::allocator' ): - cls_name = defaults_eraser.replace_basic_string( cls_name ) - c_name, c_args = templates.split( cls_name ) - if 2 != len( c_args ): - return - value_type = c_args[0] - tmpl = string.Template( "$container< $value_type, $allocator<$value_type> >" ) - tmpl = tmpl.substitute( container=c_name, value_type=value_type, allocator=default_allocator ) - if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ): - return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) - - @staticmethod - def erase_container( cls_name, default_container_name='std::deque' ): - cls_name = defaults_eraser.replace_basic_string( cls_name ) - c_name, c_args = templates.split( cls_name ) - if 2 != len( c_args ): - return - value_type = c_args[0] - dc_no_defaults = defaults_eraser.erase_recursive( c_args[1] ) - if defaults_eraser.normalize( dc_no_defaults ) \ - != defaults_eraser.normalize( templates.join( default_container_name, [value_type] ) ): - return - return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) - - @staticmethod - def erase_container_compare( cls_name, default_container_name='std::vector', default_compare='std::less' ): - cls_name = defaults_eraser.replace_basic_string( cls_name ) - c_name, c_args = templates.split( cls_name ) - if 3 != len( c_args ): - return - dc_no_defaults = defaults_eraser.erase_recursive( c_args[1] ) - if defaults_eraser.normalize( dc_no_defaults ) \ - != defaults_eraser.normalize( templates.join( default_container_name, [c_args[0]] ) ): - return - dcomp_no_defaults = defaults_eraser.erase_recursive( c_args[2] ) - if defaults_eraser.normalize( dcomp_no_defaults ) \ - != defaults_eraser.normalize( templates.join( default_compare, [c_args[0]] ) ): - return - value_type = defaults_eraser.erase_recursive( c_args[0] ) - return templates.join( c_name, [value_type] ) - - @staticmethod - def erase_compare_allocator( cls_name, default_compare='std::less', default_allocator='std::allocator' ): - cls_name = defaults_eraser.replace_basic_string( cls_name ) - c_name, c_args = templates.split( cls_name ) - if 3 != len( c_args ): - return - value_type = c_args[0] - tmpl = string.Template( "$container< $value_type, $compare<$value_type>, $allocator<$value_type> >" ) - tmpl = tmpl.substitute( container=c_name - , value_type=value_type - , compare=default_compare - , allocator=default_allocator ) - if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ): - return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) - - @staticmethod - def erase_map_compare_allocator( cls_name, default_compare='std::less', default_allocator='std::allocator' ): - cls_name = defaults_eraser.replace_basic_string( cls_name ) - c_name, c_args = templates.split( cls_name ) - if 4 != len( c_args ): - return - key_type = c_args[0] - mapped_type = c_args[1] - tmpls = [ - string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< const $key_type, $mapped_type> > >" ) - , string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< $key_type const, $mapped_type> > >" ) - , string.Template( "$container< $key_type, $mapped_type, $compare<$key_type>, $allocator< std::pair< $key_type, $mapped_type> > >" )] - for tmpl in tmpls: - tmpl = tmpl.substitute( container=c_name - , key_type=key_type - , mapped_type=mapped_type - , compare=default_compare - , allocator=default_allocator ) - if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( tmpl ): - return templates.join( c_name - , [ defaults_eraser.erase_recursive( key_type ) - , defaults_eraser.erase_recursive( mapped_type )] ) - - - @staticmethod - def erase_hash_allocator( cls_name ): - cls_name = defaults_eraser.replace_basic_string( cls_name ) - c_name, c_args = templates.split( cls_name ) - if len( c_args ) < 3: - return - - default_hash=None - default_less='std::less' - default_equal_to='std::equal_to' - default_allocator='std::allocator' - - tmpl = None - if 3 == len( c_args ): - default_hash='hash_compare' - tmpl = "$container< $value_type, $hash<$value_type, $less<$value_type> >, $allocator<$value_type> >" - elif 4 == len( c_args ): - default_hash='hash' - tmpl = "$container< $value_type, $hash<$value_type >, $equal_to<$value_type >, $allocator<$value_type> >" - else: - return - - value_type = c_args[0] - tmpl = string.Template( tmpl ) - for ns in std_namespaces: - inst = tmpl.substitute( container=c_name - , value_type=value_type - , hash= ns + '::' + default_hash - , less=default_less - , equal_to=default_equal_to - , allocator=default_allocator ) - if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( inst ): - return templates.join( c_name, [defaults_eraser.erase_recursive( value_type )] ) - - - @staticmethod - def erase_hashmap_compare_allocator( cls_name ): - cls_name = defaults_eraser.replace_basic_string( cls_name ) - c_name, c_args = templates.split( cls_name ) - - default_hash=None - default_less='std::less' - default_allocator='std::allocator' - default_equal_to = 'std::equal_to' - - tmpl = None - key_type = None - mapped_type = None - if 2 < len( c_args ): - key_type = c_args[0] - mapped_type = c_args[1] - else: - return - - if 4 == len( c_args ): - default_hash = 'hash_compare' - tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type, $less<$key_type> >, $allocator< std::pair< const $key_type, $mapped_type> > >" ) - if key_type.startswith( 'const ' ) or key_type.endswith( ' const' ): - tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type, $less<$key_type> >, $allocator< std::pair< $key_type, $mapped_type> > >" ) - elif 5 == len( c_args ): - default_hash = 'hash' - tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type >, $equal_to<$key_type>, $allocator< $mapped_type> >" ) - if key_type.startswith( 'const ' ) or key_type.endswith( ' const' ): - tmpl = string.Template( "$container< $key_type, $mapped_type, $hash<$key_type >, $equal_to<$key_type>, $allocator< $mapped_type > >" ) - else: - return - - for ns in std_namespaces: - inst = tmpl.substitute( container=c_name - , key_type=key_type - , mapped_type=mapped_type - , hash=ns + '::' + default_hash - , less=default_less - , equal_to = default_equal_to - , allocator=default_allocator ) - if defaults_eraser.normalize( cls_name ) == defaults_eraser.normalize( inst ): - return templates.join( c_name - , [ defaults_eraser.erase_recursive( key_type ) - , defaults_eraser.erase_recursive( mapped_type )] ) - - -class container_traits_impl_t: - """this class implements the functionality needed for convinient work with - STD container classes. - - Implemented functionality: - - find out whether a declaration is STD container or not - - find out container value( mapped ) type - - This class tries to be useful as much, as possible. For example, for class - declaration( and not definition ) it parsers the class name in order to - extract all the information. - """ - def __init__( self - , container_name - , element_type_index - , element_type_typedef - , defaults_remover - , key_type_index=None - , key_type_typedef=None ): - """ - container_name - std container name - element_type_index - position of value\\mapped type within template - arguments list - element_type_typedef - class typedef to the value\\mapped type - key_type_index - position of key type within template arguments list - key_type_typedef - class typedef to the key type - """ - self._name = container_name - self.remove_defaults_impl = defaults_remover - self.element_type_index = element_type_index - self.element_type_typedef = element_type_typedef - self.key_type_index = key_type_index - self.key_type_typedef = key_type_typedef - - def name(self): - return self._name - - def get_container_or_none( self, type ): - """returns reference to the class declaration or None""" - type = type_traits.remove_alias( type ) - type = type_traits.remove_cv( type ) - - cls = None - if isinstance( type, cpptypes.declarated_t ): - cls = type_traits.remove_alias( type.declaration ) - elif isinstance( type, class_declaration.class_t ): - cls = type - elif isinstance( type, class_declaration.class_declaration_t ): - cls = type - else: - return - - if not cls.name.startswith( self.name() + '<' ): - return - - for ns in std_namespaces: - if type_traits.impl_details.is_defined_in_xxx( ns, cls ): - return cls - - def is_my_case( self, type ): - """checks, whether type is STD container or not""" - return bool( self.get_container_or_none( type ) ) - - def class_declaration( self, type ): - """returns reference to the class declaration""" - cls = self.get_container_or_none( type ) - if not cls: - raise TypeError( 'Type "%s" is not instantiation of std::%s' % ( type.decl_string, self.name() ) ) - return cls - - def is_sequence( self, type ): - #raise exception if type is not container - unused = self.class_declaration( type ) - return self.key_type_index is None - - def is_mapping( self, type ): - return not self.is_sequence( type ) - - def __find_xxx_type( self, type, xxx_index, xxx_typedef, cache_property_name ): - cls = self.class_declaration( type ) - result = getattr( cls.cache, cache_property_name ) - if not result: - if isinstance( cls, class_declaration.class_t ): - xxx_type = cls.typedef( xxx_typedef, recursive=False ).type - result = type_traits.remove_declarated( xxx_type ) - else: - xxx_type_str = templates.args( cls.name )[xxx_index] - result = type_traits.impl_details.find_value_type( cls.top_parent, xxx_type_str ) - if None is result: - raise RuntimeError( "Unable to find out %s '%s' key\\value type." - % ( self.name(), cls.decl_string ) ) - setattr( cls.cache, cache_property_name, result ) - return result - - def element_type( self, type ): - """returns reference to the class value\\mapped type declaration""" - return self.__find_xxx_type( type - , self.element_type_index - , self.element_type_typedef - , 'container_element_type') - - def key_type( self, type ): - """returns reference to the class key type declaration""" - if not self.is_mapping( type ): - raise TypeError( 'Type "%s" is not "mapping" container' % str( type ) ) - return self.__find_xxx_type( type - , self.key_type_index - , self.key_type_typedef - , 'container_key_type' ) - - def remove_defaults( self, type_or_string ): - """remove template defaults from a template class instantiation - - For example: - std::vector< int, std::allocator< int > > - will become - std::vector< int > - """ - name = type_or_string - if not isinstance( type_or_string, types.StringTypes ): - name = self.class_declaration( type_or_string ).name - if not self.remove_defaults_impl: - return name - no_defaults = self.remove_defaults_impl( name ) - if not no_defaults: - return name - else: - return no_defaults - -create_traits = container_traits_impl_t -list_traits = create_traits( 'list' - , 0 - , 'value_type' - , defaults_eraser.erase_allocator ) - -deque_traits = create_traits( 'deque' - , 0 - , 'value_type' - , defaults_eraser.erase_allocator ) - -queue_traits = create_traits( 'queue' - , 0 - , 'value_type' - , defaults_eraser.erase_container ) - -priority_queue_traits = create_traits( 'priority_queue' - , 0 - , 'value_type' - , defaults_eraser.erase_container_compare ) - -vector_traits = create_traits( 'vector' - , 0 - , 'value_type' - , defaults_eraser.erase_allocator ) - -stack_traits = create_traits( 'stack' - , 0 - , 'value_type' - , defaults_eraser.erase_container ) - -map_traits = create_traits( 'map' - , 1 - , 'mapped_type' - , defaults_eraser.erase_map_compare_allocator - , key_type_index=0 - , key_type_typedef='key_type') - -multimap_traits = create_traits( 'multimap' - , 1 - , 'mapped_type' - , defaults_eraser.erase_map_compare_allocator - , key_type_index=0 - , key_type_typedef='key_type') - - -hash_map_traits = create_traits( 'hash_map' - , 1 - , 'mapped_type' - , defaults_eraser.erase_hashmap_compare_allocator - , key_type_index=0 - , key_type_typedef='key_type') - - -hash_multimap_traits = create_traits( 'hash_multimap' - , 1 - , 'mapped_type' - , defaults_eraser.erase_hashmap_compare_allocator - , key_type_index=0 - , key_type_typedef='key_type') - -set_traits = create_traits( 'set' - , 0 - , 'value_type' - , defaults_eraser.erase_compare_allocator) - -multiset_traits = create_traits( 'multiset' - , 0 - , 'value_type' - , defaults_eraser.erase_compare_allocator ) - -hash_set_traits = create_traits( 'hash_set' - , 0 - , 'value_type' - , defaults_eraser.erase_hash_allocator ) - -hash_multiset_traits = create_traits( 'hash_multiset' - , 0 - , 'value_type' - , defaults_eraser.erase_hash_allocator ) - -container_traits = ( - list_traits - , deque_traits - , queue_traits - , priority_queue_traits - , vector_traits - , stack_traits - , map_traits - , multimap_traits - , hash_map_traits - , hash_multimap_traits - , set_traits - , hash_set_traits - , multiset_traits - , hash_multiset_traits ) -"""tuple of all STD container traits classes""" - -def find_container_traits( cls_or_string ): - if isinstance( cls_or_string, types.StringTypes ): - if not templates.is_instantiation( cls_or_string ): - return None - name = templates.name( cls_or_string ) - if name.startswith( 'std::' ): - name = name[ len( 'std::' ): ] - for cls_traits in container_traits: - if cls_traits.name() == name: - return cls_traits - else: - for cls_traits in container_traits: - if cls_traits.is_my_case( cls_or_string ): - return cls_traits diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/cpptypes.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/cpptypes.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/cpptypes.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/cpptypes.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,710 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines classes, that describe C++ types -""" - -import compilers -import algorithms_cache - -class type_t(object): - """base class for all types""" - def __init__(self): - object.__init__( self ) - self.cache = algorithms_cache.type_algs_cache_t() - self._byte_size = 0 - self._byte_align = 0 - self.compiler = None - - def __str__(self): - res = self.decl_string - if res[:2]=="::": - res = res[2:] - return res - - def __eq__(self, other): - if not isinstance( other, type_t ): - return False - return self.decl_string == other.decl_string - - def __ne__( self, other): - return not self.__eq__( other ) - - def __lt__(self, other): - if not isinstance( other, self.__class__ ): - return self.__class__.__name__ < other.__class__.__name__ - return self.decl_string < other.decl_string - - def build_decl_string(self, with_defaults=True): - raise NotImplementedError() - - @property - def decl_string( self ): - return self.build_decl_string() - - @property - def partial_decl_string( self ): - return self.build_decl_string( False ) - - def _clone_impl( self ): - raise NotImplementedError() - - def clone( self ): - "returns new instance of the type" - answer = self._clone_impl() - return answer - - def _get_byte_size(self): - return self._byte_size - def _set_byte_size( self, new_byte_size ): - self._byte_size = new_byte_size - byte_size = property( _get_byte_size, _set_byte_size - , doc="Size of this type in bytes @type: int") - - def _get_byte_align(self): - if self.compiler == compilers.MSVC_PDB_9: - compilers.on_missing_functionality( self.compiler, "byte align" ) - return self._byte_align - def _set_byte_align( self, new_byte_align ): - self._byte_align = new_byte_align - byte_align = property( _get_byte_align, _set_byte_align - , doc="Alignment of this type in bytes @type: int") - - -#There are cases when GCC-XML reports something like this -# -#In this case I will use this as type - - -class dummy_type_t( type_t ): - """provides L{type_t} interface for a string, that defines C++ type. - - This class could be very useful in the code generator. - """ - def __init__( self, decl_string ): - type_t.__init__( self ) - self._decl_string = decl_string - - def build_decl_string(self, with_defaults=True): - return self._decl_string - - def _clone_impl( self ): - return dummy_type_t( self._decl_string ) - -class unknown_t( type_t ): - "type, that represents all C++ types, that could not be parsed by GCC-XML" - def __init__( self ): - type_t.__init__( self ) - - def build_decl_string(self, with_defaults=True): - return '?unknown?' - - def _clone_impl( self ): - return self - -class ellipsis_t( type_t ): - """type, that represents "..." in function definition""" - def __init__( self ): - type_t.__init__( self ) - - def build_decl_string(self, with_defaults=True): - return '...' - - def _clone_impl( self ): - return self - -################################################################################ -## Fundamental types: - -class fundamental_t( type_t ): - """base class for all fundamental, build-in types""" - def __init__( self, name ): - type_t.__init__( self ) - self._name = name - - def build_decl_string(self, with_defaults=True): - return self._name - - def _clone_impl( self ): - return self - -class java_fundamental_t( fundamental_t ): - """base class for all JNI defined fundamental types""" - def __init__( self, name ): - fundamental_t.__init__( self, name ) - -class void_t( fundamental_t ): - """represents void type""" - CPPNAME = 'void' - def __init__( self ): - fundamental_t.__init__( self,void_t.CPPNAME ) - -class char_t( fundamental_t ): - """represents char type""" - CPPNAME = 'char' - def __init__( self ): - fundamental_t.__init__( self, char_t.CPPNAME ) - -class signed_char_t( fundamental_t ): - """represents signed char type""" - CPPNAME = 'signed char' - def __init__( self ): - fundamental_t.__init__( self, signed_char_t.CPPNAME ) - -class unsigned_char_t( fundamental_t ): - """represents unsigned char type""" - CPPNAME = 'unsigned char' - def __init__( self ): - fundamental_t.__init__( self, unsigned_char_t.CPPNAME ) - -class wchar_t( fundamental_t ): - """represents wchar_t type""" - CPPNAME = 'wchar_t' - def __init__( self ): - fundamental_t.__init__( self, wchar_t.CPPNAME ) - -class short_int_t( fundamental_t ): - """represents short int type""" - CPPNAME = 'short int' - def __init__( self ): - fundamental_t.__init__( self, short_int_t.CPPNAME ) - -class short_unsigned_int_t( fundamental_t ): - """represents short unsigned int type""" - CPPNAME = 'short unsigned int' - def __init__( self ): - fundamental_t.__init__( self, short_unsigned_int_t.CPPNAME ) - -class bool_t( fundamental_t ): - """represents bool type""" - CPPNAME = 'bool' - def __init__( self ): - fundamental_t.__init__( self, bool_t.CPPNAME ) - -class int_t( fundamental_t ): - """represents int type""" - CPPNAME = 'int' - def __init__( self ): - fundamental_t.__init__( self, int_t.CPPNAME ) - -class unsigned_int_t( fundamental_t ): - """represents unsigned int type""" - CPPNAME = 'unsigned int' - def __init__( self ): - fundamental_t.__init__( self, unsigned_int_t.CPPNAME ) - -class long_int_t( fundamental_t ): - """represents long int type""" - CPPNAME = 'long int' - def __init__( self ): - fundamental_t.__init__( self, long_int_t.CPPNAME ) - -class long_unsigned_int_t( fundamental_t ): - """represents long unsigned int type""" - CPPNAME = 'long unsigned int' - def __init__( self ): - fundamental_t.__init__( self, long_unsigned_int_t.CPPNAME ) - -class long_long_int_t( fundamental_t ): - """represents long long int type""" - CPPNAME = 'long long int' - def __init__( self ): - fundamental_t.__init__( self, long_long_int_t.CPPNAME ) - -class long_long_unsigned_int_t( fundamental_t ): - """represents long long unsigned int type""" - CPPNAME = 'long long unsigned int' - def __init__( self ): - fundamental_t.__init__( self, long_long_unsigned_int_t.CPPNAME ) - -class float_t( fundamental_t ): - """represents float type""" - CPPNAME = 'float' - def __init__( self ): - fundamental_t.__init__( self, float_t.CPPNAME ) - -class double_t( fundamental_t ): - """represents double type""" - CPPNAME = 'double' - def __init__( self ): - fundamental_t.__init__( self, double_t.CPPNAME ) - -class long_double_t( fundamental_t ): - """represents long double type""" - CPPNAME = 'long double' - def __init__( self ): - fundamental_t.__init__( self, long_double_t.CPPNAME ) - -class complex_double_t( fundamental_t ): - """represents complex double type""" - CPPNAME = 'complex double' - def __init__( self ): - fundamental_t.__init__( self, complex_double_t.CPPNAME ) - -class complex_long_double_t( fundamental_t ): - """represents complex long double type""" - CPPNAME = 'complex long double' - def __init__( self ): - fundamental_t.__init__( self, complex_long_double_t.CPPNAME ) - -class complex_float_t( fundamental_t ): - """represents complex float type""" - CPPNAME = 'complex float' - def __init__( self ): - fundamental_t.__init__( self, complex_float_t.CPPNAME ) - -class jbyte_t( java_fundamental_t ): - """represents jbyte type""" - JNAME = 'jbyte' - def __init__( self ): - java_fundamental_t.__init__( self, jbyte_t.JNAME ) - -class jshort_t( java_fundamental_t ): - """represents jshort type""" - JNAME = 'jshort' - def __init__( self ): - java_fundamental_t.__init__( self, jshort_t.JNAME ) - -class jint_t( java_fundamental_t ): - """represents jint type""" - JNAME = 'jint' - def __init__( self ): - java_fundamental_t.__init__( self, jint_t.JNAME ) - -class jlong_t( java_fundamental_t ): - """represents jlong type""" - JNAME = 'jlong' - def __init__( self ): - java_fundamental_t.__init__( self, jlong_t.JNAME ) - -class jfloat_t( java_fundamental_t ): - """represents jfloat type""" - JNAME = 'jfloat' - def __init__( self ): - java_fundamental_t.__init__( self, jfloat_t.JNAME ) - -class jdouble_t( java_fundamental_t ): - """represents jdouble type""" - JNAME = 'jdouble' - def __init__( self ): - java_fundamental_t.__init__( self, jdouble_t.JNAME ) - -class jchar_t( java_fundamental_t ): - """represents jchar type""" - JNAME = 'jchar' - def __init__( self ): - java_fundamental_t.__init__( self, jchar_t.JNAME ) - -class jboolean_t( java_fundamental_t ): - """represents jboolean type""" - JNAME = 'jboolean' - def __init__( self ): - java_fundamental_t.__init__( self, jboolean_t.JNAME ) - -FUNDAMENTAL_TYPES = { - void_t.CPPNAME : void_t() - , char_t.CPPNAME : char_t() - , signed_char_t.CPPNAME : signed_char_t() - , unsigned_char_t.CPPNAME : unsigned_char_t() - , wchar_t.CPPNAME : wchar_t() - , short_int_t.CPPNAME : short_int_t() - , 'signed ' + short_int_t.CPPNAME : short_int_t() - , short_unsigned_int_t.CPPNAME : short_unsigned_int_t() - , bool_t.CPPNAME : bool_t() - , int_t.CPPNAME : int_t() - , 'signed ' + int_t.CPPNAME : int_t() - , unsigned_int_t.CPPNAME : unsigned_int_t() - , long_int_t.CPPNAME : long_int_t() - , long_unsigned_int_t.CPPNAME : long_unsigned_int_t() - , long_long_int_t.CPPNAME : long_long_int_t() - , long_long_unsigned_int_t.CPPNAME : long_long_unsigned_int_t() - , float_t.CPPNAME : float_t() - , double_t.CPPNAME : double_t() - , long_double_t.CPPNAME : long_double_t() - , complex_long_double_t.CPPNAME : complex_long_double_t() - , complex_double_t.CPPNAME : complex_double_t() - , complex_float_t.CPPNAME : complex_float_t() - ##adding java types - , jbyte_t.JNAME : jbyte_t() - , jshort_t.JNAME : jshort_t() - , jint_t.JNAME : jint_t() - , jlong_t.JNAME : jlong_t() - , jfloat_t.JNAME : jfloat_t() - , jdouble_t.JNAME : jdouble_t() - , jchar_t.JNAME : jchar_t() - , jboolean_t.JNAME : jboolean_t() - , '__java_byte' : jbyte_t() - , '__java_short' : jshort_t() - , '__java_int' : jint_t() - , '__java_long' : jlong_t() - , '__java_float' : jfloat_t() - , '__java_double' : jdouble_t() - , '__java_char' : jchar_t() - , '__java_boolean' : jboolean_t() -} -""" -defines a mapping between fundamental type name and its synonym to the instance -of class that describes the type -""" - -################################################################################ -## Compaund types: - -class compound_t( type_t ): - """class that allows to represent compound types like C{const int*}""" - def __init__( self, base ): - type_t.__init__( self ) - self._base = base - - def _get_base(self): - return self._base - def _set_base(self, new_base): - self._base = new_base - - base = property( _get_base, _set_base - , doc="reference to internal/base class") - -class volatile_t( compound_t ): - """represents C{volatile whatever} type""" - def __init__( self, base ): - compound_t.__init__( self, base) - - def build_decl_string(self, with_defaults=True): - return 'volatile ' + self.base.build_decl_string(with_defaults) - - def _clone_impl( self ): - return volatile_t( self.base.clone() ) - -class restrict_t( compound_t ): - """represents C{restrict whatever} type""" - - #The restrict keyword can be considered an extension to the strict aliasing - #rule. It allows the programmer to declare that pointers which share the same - #type (or were otherwise validly created) do not alias eachother. By using - #restrict the programmer can declare that any loads and stores through the - #qualified pointer (or through another pointer copied either directly or - #indirectly from the restricted pointer) are the only loads and stores to - #the same address during the lifetime of the pointer. In other words, the - #pointer is not aliased by any pointers other than its own copies. - - def __init__( self, base ): - compound_t.__init__( self, base) - - def build_decl_string(self, with_defaults=True): - return '__restrict__ ' + self.base.build_decl_string( with_defaults ) - - def _clone_impl( self ): - return restrict_t( self.base.clone() ) - -class const_t( compound_t ): - """represents C{whatever const} type""" - def __init__( self, base ): - compound_t.__init__( self, base ) - - def build_decl_string(self, with_defaults=True): - return self.base.build_decl_string(with_defaults) + ' const' - - def _clone_impl( self ): - return const_t( self.base.clone() ) - -class pointer_t( compound_t ): - """represents C{whatever*} type""" - def __init__( self, base ): - compound_t.__init__( self, base ) - - def build_decl_string(self, with_defaults=True): - return self.base.build_decl_string( with_defaults ) + ' *' - - def _clone_impl( self ): - return pointer_t( self.base.clone() ) - -class reference_t( compound_t ): - """represents C{whatever&} type""" - def __init__( self, base ): - compound_t.__init__( self, base) - - def build_decl_string(self, with_defaults=True): - return self.base.build_decl_string(with_defaults) + ' &' - - def _clone_impl( self ): - return reference_t( self.base.clone() ) - -class array_t( compound_t ): - """represents C++ array type""" - SIZE_UNKNOWN = -1 - def __init__( self, base, size ): - compound_t.__init__( self, base ) - self._size = size - - def _get_size(self): - return self._size - def _set_size(self, size):#sometimes there is a need to update the size of the array - self.cache.reset() - self._size = size - size = property( _get_size, _set_size, - doc="returns array size" ) - - def build_decl_string(self, with_defaults=True): - return self.base.build_decl_string(with_defaults) + '[%d]' % self.size - - def _clone_impl( self ): - return array_t( self.base.clone(), self.size ) - -class calldef_type_t( object ): - """base class for all types that describes "callable" declaration""" - def __init__( self, return_type=None, arguments_types=None ): - object.__init__( self ) - self._return_type = return_type - if arguments_types is None: - arguments_types = [] - self._arguments_types = arguments_types - - def _get_return_type(self): - return self._return_type - def _set_return_type(self, new_return_type): - self._return_type = new_return_type - return_type = property( _get_return_type, _set_return_type - , doc="reference to L{return type}") - - def _get_arguments_types(self): - return self._arguments_types - def _set_arguments_types(self, new_arguments_types): - self._arguments_types = new_arguments_types - arguments_types = property( _get_arguments_types, _set_arguments_types - , doc="list of argument L{types}") - - @property - def has_ellipsis( self ): - return self.arguments_types and isinstance( self.arguments_types[-1], ellipsis_t ) - - -class free_function_type_t( type_t, calldef_type_t ): - """describes free function type""" - NAME_TEMPLATE = '%(return_type)s (*)( %(arguments)s )' - TYPEDEF_NAME_TEMPLATE = '%(return_type)s ( *%(typedef_name)s )( %(arguments)s )' - def __init__( self, return_type=None, arguments_types=None ): - type_t.__init__(self) - calldef_type_t.__init__( self, return_type, arguments_types ) - - @staticmethod - def create_decl_string( return_type, arguments_types, with_defaults=True ): - """ - returns free function type - - @param return_type: function return type - @type return_type: L{type_t} - - @param arguments_types: list of argument L{type} - - @return: L{free_function_type_t} - """ - return free_function_type_t.NAME_TEMPLATE % { - 'return_type' : return_type.build_decl_string( with_defaults ) - , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults ) - , arguments_types ) ) } - - def build_decl_string(self, with_defaults=True): - return self.create_decl_string( self.return_type, self.arguments_types, with_defaults ) - - def _clone_impl( self ): - rt_clone = None - if self.return_type: - rt_clone = self.return_type.clone() - return free_function_type_t( rt_clone - , [ arg.clone() for arg in self.arguments_types ] ) - - #TODO: create real typedef - def create_typedef( self, typedef_name, unused=None, with_defaults=True): - """returns string, that contains valid C++ code, that defines typedef to function type - - @param name: the desired name of typedef - """ - #unused argument simplifies user code - return free_function_type_t.TYPEDEF_NAME_TEMPLATE % { - 'typedef_name' : typedef_name - , 'return_type' : self.return_type.build_decl_string( with_defaults ) - , 'arguments' : ','.join( map( lambda x: x.build_decl_string( with_defaults ) - , self.arguments_types ) ) } - -class member_function_type_t( type_t, calldef_type_t ): - """describes member function type""" - NAME_TEMPLATE = '%(return_type)s ( %(class)s::* )( %(arguments)s ) %(has_const)s' - TYPEDEF_NAME_TEMPLATE = '%(return_type)s ( %(class)s::*%(typedef_name)s )( %(arguments)s ) %(has_const)s' - - def __init__( self, class_inst=None, return_type=None, arguments_types=None, has_const=False): - type_t.__init__(self) - calldef_type_t.__init__( self, return_type, arguments_types ) - self._has_const = has_const - self._class_inst = class_inst - - def _get_has_const(self): - return self._has_const - def _set_has_const(self, has_const ): - self._has_const = has_const - has_const = property( _get_has_const, _set_has_const - , doc="describes, whether function has const modifier") - - def _get_class_inst(self): - return self._class_inst - def _set_class_inst(self, class_inst ): - self._class_inst = class_inst - class_inst = property( _get_class_inst, _set_class_inst - ,doc="reference to parent L{class}" ) - - #TODO: create real typedef - def create_typedef( self, typedef_name, class_alias=None, with_defaults=True): - """creates typedef to the function type - - @param typedef_name: desired type name - @return: string - """ - has_const_str = '' - if self.has_const: - has_const_str = 'const' - if None is class_alias: - if with_defaults: - class_alias = self.class_inst.decl_string - else: - class_alias = self.class_inst.partial_decl_string - return member_function_type_t.TYPEDEF_NAME_TEMPLATE % { - 'typedef_name' : typedef_name - , 'return_type' : self.return_type.build_decl_string( with_defaults ) - , 'class' : class_alias - , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults) - , self.arguments_types ) ) - , 'has_const' : has_const_str } - - def create(self): - return self.build_decl_string( self.return_type - , self.class_inst.decl_string - , self.arguments_types - , self.has_const ) - - - @staticmethod - def create_decl_string(return_type, class_decl_string, arguments_types, has_const, with_defaults=True): - has_const_str = '' - if has_const: - has_const_str = 'const' - return_type_decl_string = '' - if return_type: - return_type_decl_string = return_type.build_decl_string( with_defaults ) - return member_function_type_t.NAME_TEMPLATE % { - 'return_type' : return_type_decl_string - , 'class' : class_decl_string - , 'arguments' : ','.join( map( lambda x: x.build_decl_string(with_defaults) - , arguments_types ) ) - , 'has_const' : has_const_str } - - def build_decl_string(self, with_defaults=True): - return self.create_decl_string( self.return_type - , self.class_inst.decl_string - , self.arguments_types - , self.has_const - , with_defaults) - - def _clone_impl( self ): - rt_clone = None - if self.return_type: - rt_clone = self.return_type.clone() - - return member_function_type_t( self.class_inst - , rt_clone - , [ arg.clone() for arg in self.arguments_types ] - , self.has_const ) - - -class member_variable_type_t( compound_t ): - """describes member variable type""" - NAME_TEMPLATE = '%(type)s ( %(class)s::* )' - def __init__( self, class_inst=None, variable_type=None ): - compound_t.__init__(self, class_inst) - self._mv_type = variable_type - - def _get_variable_type(self): - return self._mv_type - def _set_variable_type(self, new_type): - self._mv_type = new_type - variable_type = property( _get_variable_type, _set_variable_type - , doc="describes member variable L{type}") - - def build_decl_string(self, with_defaults=True): - return self.NAME_TEMPLATE % { 'type' : self.variable_type.build_decl_string(with_defaults) - , 'class' : self.base.build_decl_string(with_defaults) } - - def _clone_impl( self ): - return member_variable_type_t( class_inst=self.base - , variable_type=self.variable_type.clone() ) - - -################################################################################ -## declarated types: - -class declarated_t( type_t ): - """class that binds between to hierarchies: L{type_t} and L{declaration_t}""" - def __init__( self, declaration ): - type_t.__init__( self ) - self._declaration = declaration - - def _get_declaration(self): - return self._declaration - def _set_declaration(self, new_declaration): - self._declaration = new_declaration - declaration = property( _get_declaration, _set_declaration - , doc="reference to L{declaration}") - - def build_decl_string(self, with_defaults=True): - if with_defaults: - return self._declaration.decl_string - else: - return self._declaration.partial_decl_string - - def _clone_impl( self ): - return declarated_t( self._declaration ) - - @property - def byte_size (self): - "Size of this type in bytes @type: int" - return self._declaration.byte_size - - @property - def byte_align (self): - "alignment of this type in bytes @type: int" - return self._declaration.byte_align - -class type_qualifiers_t( object ): - """contains additional information about type: mutable, static, extern""" - def __init__(self, has_static=False, has_mutable=False ): - self._has_static = has_static - self._has_mutable = has_mutable - - def __eq__(self, other): - if not isinstance( other, type_qualifiers_t ): - return False - return self.has_static == other.has_static \ - and self.has_mutable == other.has_mutable - - def __ne__( self, other): - return not self.__eq__( other ) - - def __lt__(self, other): - if not isinstance( other, type_qualifiers_t ): - return object.__lt__( self, other ) - return self.has_static < other.has_static \ - and self.has_mutable < other.has_mutable - - def _get_has_static(self): - return self._has_static - def _set_has_static(self, has_static ): - self._has_static = has_static - has_static = property( _get_has_static, _set_has_static ) - has_extern = has_static #synonim to static - - def _get_has_mutable(self): - return self._has_mutable - def _set_has_mutable(self, has_mutable ): - self._has_mutable = has_mutable - has_mutable = property( _get_has_mutable, _set_has_mutable ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/declaration.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/declaration.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/declaration.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/declaration.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,277 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines 2 important classes - -This module defines: -* declaration_t - base class for all pygccxml defined classes, which describe - a C++ declaration -* location_t - provides information about physical location of the declaration -""" - -import algorithm -import templates -import algorithms_cache - -class location_t(object): - """provides information about the location of the declaration within the source file""" - - def __init__(self, file_name='', line=-1 ): - self._file_name = file_name - self._line = line - - def __eq__(self, other): - if not isinstance( other, self.__class__ ): - return False - return self.line == other.line \ - and self.file_name == other.file_name - - def __ne__( self, other): - return not self.__eq__( other ) - - def __lt__( self, other ): - if not isinstance( other, location_t ): - return self.__class__.__name__ < other.__class__.__name__ - return ( self.file_name, self.line ) < ( other.file_name, other.line ) - - def _get_file_name(self): - return self._file_name - def _set_file_name(self, new_file_name): - self._file_name = new_file_name - file_name = property( _get_file_name, _set_file_name - , doc="""absolute source file name, type string""" ) - - def _get_line( self ): - return self._line - def _set_line( self, new_line ): - self._line = new_line - line = property( _get_line, _set_line, doc="""line number, type int""") - - def as_tuple( self ): - """return tuple(self.file_name, self.line)""" - return (self.file_name, self.line) - -class declaration_t( object ): - """base class for all classes that represent a C++ declaration""" - - def __init__( self, name='', location=None, is_artificial=False, mangled=None, demangled=None, attributes=None ): - self._name = name - self._location = location - self._is_artificial = is_artificial - self._mangled = mangled - self._demangled = demangled - self._attributes = attributes - self._parent = None - self._cache = algorithms_cache.declaration_algs_cache_t() - self._compiler = None - self._partial_name = None - - def __str__(self): - """Default __str__ method. - - This version just returns the decl_string and the class. - Derived classes may override this method to provide more detailed - information. - - A __str__ method for a declaration should always provide enough - information so that it uniquely identifies the declaration and - the user is able to find the declaration in his source code. - """ - name = self.decl_string - if name[:2]=="::": - name = name[2:] - # Append the declaration class - cls = self.__class__.__name__ - if cls[-2:]=="_t": - cls = cls[:-2] - cls = cls.replace( '_', ' ' ) - return "%s [%s]"%(name, cls) - - @staticmethod - def _sorted_list( some_list ): - """implementation details""" - some_list.sort() - return some_list - - def _get__cmp__items( self ): - """implementation details""" - #Every derived class should implement this method. This method should - #return a list of items, that should be compared. - - print '_get__cmp__items not implemented for class ', self.__class__.__name__ - raise NotImplemented() - - def _get__cmp__data(self): - """implementation details""" - data = [ algorithm.declaration_path( self.parent ), self.name, self.location ] - data.extend( self._get__cmp__items() ) - return data - - def __eq__(self, other): - """ - function will return true, if both declarations refers to the same object. - This function could be implemented in terms of _get__cmp__data, but in - this case it will downgrade performance. self.mangled property is not - compared, because it could be chaned from one compilation time to an - other. - """ - if not isinstance( other, self.__class__ ): - return False - return self.name == other.name \ - and self.location == other.location \ - and algorithm.declaration_path( self.parent ) \ - == algorithm.declaration_path( other.parent ) - - def __ne__( self, other): - """return not self.__eq__( other )""" - return not self.__eq__( other ) - - def __lt__(self, other): - """ - C{if not isinstance( other, self.__class__ ):} - C{ return self.__class__.__name__ < other.__class__.__name__} - C{return self._get__cmp__data() < other._get__cmp__data()} - """ - if not isinstance( other, self.__class__ ): - return self.__class__.__name__ < other.__class__.__name__ - return self._get__cmp__data() < other._get__cmp__data() - - def _get_name_impl( self ): - return self._name - - def _get_name( self ): - return self._get_name_impl() - - def _on_rename( self ): - pass - - def _set_name( self, new_name ): - previous_name = self._name - self._name = new_name - self._partial_name = None - self.cache.reset_name_based() - if previous_name: #the was a rename and not initial "set" - self._on_rename() - - name = property( _get_name, _set_name - , doc="""Declaration name - @type: str - """) - - def _get_partial_name_impl( self ): - return self.name - - @property - def partial_name( self ): - """declaration name, without template default arguments - Right now std containers is the only classes that support this functionality""" - if None is self._partial_name: - self._partial_name = self._get_partial_name_impl() - return self._partial_name - - def _get_parent(self): - return self._parent - def _set_parent(self, new_parent): - if new_parent: - assert( isinstance( new_parent, declaration_t ) ) - self._parent = new_parent - parent = property( _get_parent, _set_parent - , doc="""Reference to parent declaration - @type: declaration_t - """) - - def __get_top_parent(self): - parent = self.parent - me = self - while True: - if not parent: - return me - else: - me = parent - parent = me.parent - top_parent = property( __get_top_parent, - doc="""reference to top parent declaration - @type: declaration_t - """ ) - - def _get_location( self ): - return self._location - def _set_location( self, new_location ): - self._location = new_location - location = property( _get_location, _set_location - , doc="""Location of the declaration within source file - @type: L{location_t} - """) - - def _get_is_artificial( self ): - return self._is_artificial - def _set_is_artificial( self, new_artificial ): - self._is_artificial = new_artificial - is_artificial = property( _get_is_artificial, _set_is_artificial - , doc="""Describes whether declaration is compiler generated or not - @type: bool - """) - - def _get_mangled( self ): - return self._mangled - def _set_mangled( self, mangled ): - self._mangled = mangled - mangled = property( _get_mangled, _set_mangled - , doc="""Compiler generated declaration name - @type: str - """ ) - - def _get_demangled( self ): - return self._demangled - def _set_demangled( self, demangled ): - self._demangled = demangled - demangled = property( _get_demangled, _set_demangled - , doc="""Demangled compiler generated declaration name - @type: str - """ ) - - def _get_attributes( self ): - return self._attributes - def _set_attributes( self, attributes ): - self._attributes = attributes - attributes = property( _get_attributes, _set_attributes - , doc="""GCCXML attributes, set using __attribute__((gccxml("..."))) - @type: str - """ ) - - def create_decl_string(self, with_defaults=True): - return algorithm.full_name( self, with_defaults ) - - @property - def decl_string(self): - """declaration full name""" - return self.create_decl_string() - - @property - def partial_decl_string(self): - """declaration full name""" - return self.create_decl_string(with_defaults=False) - - @property - def cache( self ): - """implementation details - - reference to instance of L{algorithms_cache.algorithms_cache_t} class. - """ - return self._cache - - def i_depend_on_them( self, recursive=True ): - """return list of all types and declarations the declaration depends on""" - print self - raise NotImplementedError() - - def _get_compiler( self ): - return self._compiler - def _set_compiler( self, compiler ): - self._compiler = compiler - compiler = property( _get_compiler, _set_compiler - , doc="""compiler name + version - @type: str""" ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_factory.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_factory.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_factory.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_factory.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines default declarations factory class -""" - -from calldef import member_function_t -from calldef import constructor_t -from calldef import destructor_t -from calldef import member_operator_t -from calldef import casting_operator_t -from calldef import free_function_t -from calldef import free_operator_t -from enumeration import enumeration_t -from namespace import namespace_t -from class_declaration import class_t -from class_declaration import class_declaration_t -from typedef import typedef_t -from variable import variable_t - -class decl_factory_t(object): - """ - declarations factory class - """ - def __init__(self): - """creates declarations factory""" - object.__init__(self) - - def create_member_function( self, *arguments, **keywords ): - """creates instance of class that describes member function declaration""" - return member_function_t(*arguments, **keywords) - - def create_constructor( self, *arguments, **keywords ): - """creates instance of class that describes constructor declaration""" - return constructor_t(*arguments, **keywords) - - def create_destructor( self, *arguments, **keywords ): - """creates instance of class that describes destructor declaration""" - return destructor_t(*arguments, **keywords) - - def create_member_operator( self, *arguments, **keywords ): - """creates instance of class that describes member operator declaration""" - return member_operator_t(*arguments, **keywords) - - def create_casting_operator( self, *arguments, **keywords ): - """creates instance of class that describes casting operator declaration""" - return casting_operator_t(*arguments, **keywords) - - def create_free_function( self, *arguments, **keywords ): - """creates instance of class that describes free function declaration""" - return free_function_t(*arguments, **keywords) - - def create_free_operator( self, *arguments, **keywords ): - """creates instance of class that describes free operator declaration""" - return free_operator_t(*arguments, **keywords) - - def create_class_declaration(self, *arguments, **keywords ): - """creates instance of class that describes class declaration""" - return class_declaration_t(*arguments, **keywords) - - def create_class( self, *arguments, **keywords ): - """creates instance of class that describes class definition declaration""" - return class_t(*arguments, **keywords) - - def create_enumeration( self, *arguments, **keywords ): - """creates instance of class that describes enumeration declaration""" - return enumeration_t(*arguments, **keywords) - - def create_namespace( self, *arguments, **keywords ): - """creates instance of class that describes namespace declaration""" - return namespace_t(*arguments, **keywords) - - def create_typedef( self, *arguments, **keywords ): - """creates instance of class that describes typedef declaration""" - return typedef_t(*arguments, **keywords) - - def create_variable( self, *arguments, **keywords ): - """creates instance of class that describes variable declaration""" - return variable_t(*arguments, **keywords) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_printer.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_printer.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_printer.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_printer.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,258 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko, 2006 Allen Bierbaum, Matthias Baas -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines class, decl_printer_t that prints declarations tree in a user friendly format -""" - -import os -import sys -import calldef -import algorithm -import decl_visitor - - -class decl_printer_t( decl_visitor.decl_visitor_t ): - """Helper class for printing decl tree. - - This class provides more information than the __str__() methods do. - The class is not just meant to provide a unique "id" for a declaration - but to inspect an entire declaration tree. This is particularly useful - for new users who want to find out how Py++ works and how it - stores its data. - """ - JUSTIFY = 20 - INDENT_SIZE = 4 - - def __init__( self, level=0, print_details=True, recursive=True, writer=None ): - decl_visitor.decl_visitor_t.__init__(self) - self.__inst = None - self.__level = level - self.__print_details = print_details - self.__recursive = recursive - self.__writer = writer - if not self.__writer: - self.__writer = lambda x: sys.stdout.write( x + os.linesep ) - - def clone(self, increment_level=True): - level = self.__level - if increment_level: - level += 1 - return decl_printer_t( level - , self.print_details - , recursive=self.recursive - , writer=self.writer ) - - def _get_recursive(self): - return self.__recursive - def _set_recursive(self, recursive): - self.__recursive = recursive - recursive = property( _get_recursive, _set_recursive) - - def _get_level(self): - return self.__level - def _set_level(self, lvl): - self.__level = lvl - level = property( _get_level, _set_level ) - - def _get_print_details(self): - return self.__print_details - def _set_print_details(self, details): - self.__print_details = details - print_details = property( _get_print_details, _set_print_details) - - def _get_writer(self): - return self.__writer - def _set_writer(self, writer): - self.__writer = writer - writer = property( _get_writer, _set_writer) - - def _get_inst(self): - return self.__inst - def _set_inst(self, inst): - self.__inst = inst - instance = property( _get_inst, _set_inst ) - - def __nice_decl_name( self, inst ): - name = inst.__class__.__name__ - return name - #if name.endswith( '_t' ): - # name = name[:-len('_t')] - #return name.replace( '_', ' ' ) - - def print_decl_header(self): - header = self.__nice_decl_name( self.__inst ) + ": '%s'" % self.__inst.name - self.writer( ' ' * self.level * self.INDENT_SIZE + header.ljust( self.JUSTIFY )) - if self.__print_details: - curr_level = self.level + 1 - if self.__inst.location: - location = 'location: [%s]:%s'%(self.__inst.location.file_name, self.__inst.location.line) - self.writer( ' ' * curr_level * self.INDENT_SIZE + location) - artificial = 'artificial: ' + "'%s'" % str(self.__inst.is_artificial) - self.writer( ' ' * curr_level * self.INDENT_SIZE + artificial.ljust( self.JUSTIFY )) - if self.__inst.attributes: - attributes = 'attributes: %s'%(self.__inst.attributes) - self.writer( ' ' * curr_level * self.INDENT_SIZE + attributes) - if self.__inst.demangled: - demangled = 'demangled: %s'%(self.__inst.demangled) - self.writer( ' ' * curr_level * self.INDENT_SIZE + demangled) - if self.__inst.mangled: - mangled = 'mangled: %s'%(self.__inst.mangled) - self.writer( ' ' * curr_level * self.INDENT_SIZE + mangled) - - - - def print_calldef_info(self, decl=None): - """ Returns function signature: [retval, [arg1, ..., argN]]. """ - if None is decl: - decl = self.__inst - - retval = None - if decl.return_type: - retval = decl.return_type.decl_string - args = [] - for arg in decl.arguments: - args.append(arg.type.decl_string + ' ' + arg.name) - indent = ' ' * (self.level+1) * self.INDENT_SIZE - self.writer( indent + "return type: " + str(retval) ) - self.writer( indent + "arguments type: " + ', '.join(args)) - if isinstance( decl, calldef.member_calldef_t ): - self.writer( indent + "virtual: " + str(decl.virtuality)) - self.writer( indent + "is const: " + str(decl.has_const)) - self.writer( indent + "is static: " + str(decl.has_static)) - - def visit_member_function( self ): - self.print_decl_header() - self.print_calldef_info() - - def visit_constructor( self ): - self.print_decl_header() - self.print_calldef_info() - - if self.__print_details: - self.writer( ' ' * ( self.level + 1 ) * self.INDENT_SIZE - + 'copy constructor: ' + str(self.__inst.is_copy_constructor) ) - - def visit_destructor( self ): - self.print_decl_header() - - def visit_member_operator( self ): - self.print_decl_header() - self.print_calldef_info() - - def visit_casting_operator( self ): - self.print_decl_header() - self.print_calldef_info() - - def visit_free_function( self ): - self.print_decl_header() - self.print_calldef_info() - - def visit_free_operator( self ): - self.print_decl_header() - self.print_calldef_info() - - def visit_class_declaration(self ): - self.print_decl_header() - - def visit_class(self ): - self.print_decl_header() - curr_level = self.level + 1 - class_type = 'class type: ' + "'%s'" % str(self.__inst.class_type) - self.writer( ' ' * curr_level * self.INDENT_SIZE + class_type.ljust( self.JUSTIFY )) - if self.__print_details: - byte_size = 'size: %d'%(self.__inst.byte_size) - self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_size.ljust( self.JUSTIFY )) - try: - byte_align = 'align: %d'%(self.__inst.byte_align) - self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_align.ljust( self.JUSTIFY )) - except NotImplementedError: - self.writer( ' ' * curr_level * self.INDENT_SIZE + "align: not implemented".ljust( self.JUSTIFY )) - - if self.__inst.aliases: - aliases = map( lambda typedef: typedef.name, self.__inst.aliases ) - aliases.sort() - msg = 'aliases: ' + `aliases` - self.writer( ' ' * curr_level * self.INDENT_SIZE + msg.ljust( self.JUSTIFY )) - - def print_hierarchy(hierarchy_type, classes, curr_level): - self.writer( ' ' * curr_level * self.INDENT_SIZE + hierarchy_type.ljust( self.JUSTIFY )) - curr_level += 1 - for class_ in classes: - class_str = 'class: ' + "'%s'" % str(class_.related_class.decl_string) - self.writer( ' ' * curr_level * self.INDENT_SIZE + class_str.ljust( self.JUSTIFY )) - access = 'access type: ' + "'%s'" % str(class_.access) - self.writer( ' ' * (curr_level + 1)* self.INDENT_SIZE + access.ljust( self.JUSTIFY )) - if not ( None is class_.is_virtual ): - is_virtual = 'virtual inheritance: ' + "'%s'" % str(class_.is_virtual) - self.writer( ' ' * (curr_level + 1)* self.INDENT_SIZE + is_virtual.ljust( self.JUSTIFY )) - - def print_members(members_type, members, curr_level): - self.writer( ' ' * curr_level * self.INDENT_SIZE + members_type.ljust( self.JUSTIFY )) - if self.__recursive: - curr_level += 1 - for member in members: - prn = self.clone() - prn.instance = member - algorithm.apply_visitor( prn, member ) - - if self.__inst.bases: - print_hierarchy( 'base classes: ', self.__inst.bases, curr_level ) - - if self.__inst.derived: - print_hierarchy( 'derived classes: ', self.__inst.derived, curr_level ) - - print_members( 'public: ', self.__inst.public_members, curr_level ) - print_members( 'protected: ', self.__inst.protected_members, curr_level ) - print_members( 'private: ', self.__inst.private_members, curr_level ) - - def visit_enumeration(self): - self.print_decl_header() - curr_level = self.level + 1 - self.writer( ' ' * curr_level * self.INDENT_SIZE + 'values:'.ljust( self.JUSTIFY ) ) - value_level = ' ' * ( curr_level + 1 )* self.INDENT_SIZE - self.writer( os.linesep ) - for name, value in self.__inst.values: - self.writer( value_level + "%s : %s"% (name, value)) - - def visit_namespace(self ): - self.print_decl_header() - if self.__recursive: - for decl in self.__inst.declarations: - prn = self.clone() - prn.instance = decl - algorithm.apply_visitor( prn, decl ) - - def visit_typedef(self ): - self.print_decl_header() - curr_level = self.level + 1 - self.writer( ' ' * curr_level * self.INDENT_SIZE + 'alias to: ' + self.__inst.type.decl_string) - - def visit_variable(self ): - self.print_decl_header() - curr_level = self.level + 1 - self.writer( ' ' * curr_level * self.INDENT_SIZE + 'type: %s value: %s'%(self.__inst.type.decl_string, self.__inst.value) + os.linesep) - if self.__print_details: - byte_size = 'size: %d'%(self.__inst.type.byte_size) - self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_size.ljust( self.JUSTIFY )) - try: - byte_align = 'align: %d'%(self.__inst.type.byte_align) - self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_align.ljust( self.JUSTIFY )) - except NotImplementedError: - self.writer( ' ' * curr_level * self.INDENT_SIZE + "align: not implemented".ljust( self.JUSTIFY )) - byte_offset = 'offset: %d'%(self.__inst.byte_offset) - self.writer( ' ' * curr_level * self.INDENT_SIZE + byte_offset + os.linesep) - -def print_declarations( decls, detailed=True, recursive=True, writer=lambda x: sys.stdout.write( x + os.linesep ) ): - """ Print decl tree rooted at each of the included nodes. - decls - either a single decl or a list of decls. - """ - prn = decl_printer_t(0, detailed, recursive, writer) - if type(decls) is not list: - decls = [decls] - for d in decls: - prn.level = 0 - prn.instance = d - algorithm.apply_visitor(prn, d) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_visitor.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_visitor.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_visitor.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/decl_visitor.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines declarations visitor class interface -""" - -class decl_visitor_t(object): - """ - declarations visitor interface - - All functions within this class should be redefined in derived classes. - """ - def __init__(self): - object.__init__(self) - - def visit_member_function( self ): - raise NotImplementedError() - - def visit_constructor( self ): - raise NotImplementedError() - - def visit_destructor( self ): - raise NotImplementedError() - - def visit_member_operator( self ): - raise NotImplementedError() - - def visit_casting_operator( self ): - raise NotImplementedError() - - def visit_free_function( self ): - raise NotImplementedError() - - def visit_free_operator( self ): - raise NotImplementedError() - - def visit_class_declaration(self ): - raise NotImplementedError() - - def visit_class(self ): - raise NotImplementedError() - - def visit_enumeration(self ): - raise NotImplementedError() - - def visit_namespace(self ): - raise NotImplementedError() - - def visit_typedef(self ): - raise NotImplementedError() - - def visit_variable(self ): - raise NotImplementedError() \ No newline at end of file diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/dependencies.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/dependencies.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/dependencies.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/dependencies.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -this module contains class that keeps dependency information of some declaration -""" - -import cpptypes - -class dependency_info_t( object ): - def __init__( self, declaration, depend_on_it, access_type=None, hint=None ): - object.__init__( self ) - #prevent recursive import - import class_declaration - assert isinstance( depend_on_it, ( class_declaration.class_t, cpptypes.type_t ) ) - self._declaration = declaration - self._depend_on_it = depend_on_it - self._access_type = access_type - self._hint = hint - - @property - def declaration( self ): - return self._declaration - #short name - decl = declaration - - @property - def depend_on_it( self ): - return self._depend_on_it - - def _get_access_type( self ): - return self._access_type - def _set_access_type( self, access_type ): - self._access_type = access_type - access_type = property( _get_access_type, _set_access_type ) - - def __str__( self ): - return 'declaration "%s" depends( %s ) on "%s" ' \ - % ( self.declaration, self.access_type, self.depend_on_it ) - - @property - def hint(self): - """the declaration, that report dependency can put some additional inforamtion - about dependency. It can be used later""" - return self._hint - - def find_out_depend_on_declaration( self ): - """if declaration depends on other declaration and not on some type - this function will return reference to it. Otherwise None will be returned - """ - #prevent recursive import - from pygccxml import declarations - - if isinstance( self.depend_on_it, declarations.declaration_t ): - return self.depend_on_it - base_type = declarations.base_type( declarations.remove_alias( self.depend_on_it ) ) - if isinstance( base_type, cpptypes.declarated_t ): - return base_type.declaration - return None diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/enumeration.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/enumeration.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/enumeration.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/enumeration.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines class, that describes C++ enum -""" - -import copy -import types -import compilers -import declaration - -class enumeration_t( declaration.declaration_t ): - """ - describes C++ enum - """ - def __init__( self, name='', values=None ): - """creates class that describes C++ enum declaration - - The items of the list 'values' may either be strings containing - the enumeration value name or tuples (name, numvalue). - - @param name: Enum name - @type name: str - @param parent: Parent declaration - @type parent: declaration_t - @param values: Enumeration values - @type values: list - """ - declaration.declaration_t.__init__( self, name ) - - # A list of tuples (valname(str), valnum(int)). The order of the list should - # be the same as the order in the C/C++ source file. - self._values = [] - - # Initialize values via property access - self.values = values - self._byte_size = 0 - self._byte_align = 0 - - def __eq__(self, other): - if not declaration.declaration_t.__eq__( self, other ): - return False - return self.values == other.values - - def _get__cmp__items( self ): - """implementation details""" - return [self.values] - - def _get_values(self): - return copy.copy(self._values) - def _set_values(self, values): - self._values = [] - # None is treated like an empty list - if (values==None): - return - # Check that we have indeed a list... - if type(values)!=list: - raise ValueError, "'values' must be a list (got a %s instead)"%type(values).__name__ - # Append the items individually. This has the effect that there's - # some additional type checking and that a copy of 'values' is stored - # and the caller cannot further manipulate the list via his own reference - for item in values: - if isinstance(item, types.StringTypes): - self.append_value(item) - elif type(item)==tuple: - name,num = item - self.append_value(name, num) - else: - raise ValueError, "'values' contains an invalid item: %s"%item - values = property( _get_values, _set_values - , doc="""A list of tuples (valname(str), valnum(int)) that contain the enumeration values. - @type: list""") - - def append_value(self, valuename, valuenum=None): - """Append another enumeration value to the enum. - - The numeric value may be None in which case it is automatically determined by - increasing the value of the last item. - - When the 'values' attribute is accessed the resulting list will be in the same - order as append_value() was called. - - @param valuename: The name of the value. - @type valuename: str - @param valuenum: The numeric value or None. - @type valuenum: int - """ - # No number given? Then use the previous one + 1 - if valuenum==None: - if len(self._values)==0: - valuenum = 0 - else: - valuenum = self._values[-1][1]+1 - - # Store the new value - self._values.append((valuename, int(valuenum))) - - def has_value_name(self, name): - """Check if this enum has a particular name among its values. - - @param name: Enumeration value name - @type name: str - @return: True if there is an enumeration value with the given name - """ - for val,num in self._values: - if val==name: - return True - return False - - def get_name2value_dict( self ): - """returns a dictionary, that maps between enum name( key ) and enum value( value )""" - x = {} - for val, num in self._values: - x[val] = num - return x - - def i_depend_on_them( self, recursive=True ): - return [] - - def _get_byte_size(self): - return self._byte_size - def _set_byte_size( self, new_byte_size ): - self._byte_size = new_byte_size - byte_size = property( _get_byte_size, _set_byte_size - , doc="Size of this class in bytes @type: int") - - def _get_byte_align(self): - if self.compiler == compilers.MSVC_PDB_9: - compilers.on_missing_functionality( self.compiler, "byte align" ) - return self._byte_align - def _set_byte_align( self, new_byte_align ): - self._byte_align = new_byte_align - byte_align = property( _get_byte_align, _set_byte_align - , doc="Alignment of this class in bytes @type: int") diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/filtering.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/filtering.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/filtering.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/filtering.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -deprecated! - -This module defines few algorithms for filtering declarations. -""" - -import os -import algorithm - -class filtering: - """deprecated! - - defines few algorithms for filtering declarations - """ - - @staticmethod - def normalize_path( some_path ): - """return os.path.normcase( os.path.normpath( some_path ) )""" - return os.path.normcase( os.path.normpath( some_path ) ) - - @staticmethod - def contains_parent_dir( fpath, dirs ): - #precondition: dirs and fpath should be normalize_path'ed before calling this function - return bool( filter( lambda dir: fpath.startswith( dir ), dirs ) ) - - @staticmethod - def by_location( decls, locations ): - """ - returns list of declarations that belongs to specified locations. - - This function works recursively. Pay attention: if you remove namespace, - then you remove all declarations defined within the namespace. - - @param decls: declaration or list of declarations - @type decls: L{declaration} or list of L{declarations} - - @param locations: list of directories and/or files names - @type locations: list of strings - - @return: list of L{declarations} - """ - #precondition: decls is a list of op level namespaces - #locations is list of directories and\or files - temp_decls = algorithm.make_flatten( decls ) - locations = map( filtering.normalize_path, locations ) - dirs = filter( lambda location: os.path.isdir( location ), locations ) - files = filter( lambda location: os.path.isfile( location ), locations ) - result = [] - for decl in temp_decls: - if not decl.location: - result.append( decl ) - continue - fpath = filtering.normalize_path( decl.location.file_name ) - if filtering.contains_parent_dir( fpath, dirs ) or fpath in files: - result.append( decl ) - return result - - @staticmethod - def user_defined( decls, matcher ): - """ - returns list of declarations that match user specified criteria. - - This function works recursively. - - @param decls: declaration or list of declarations - @type decls: L{declaration} or list of L{declarations} - - @param matcher: callable object, that takes 1 argument - declaration - and returns True if object should stay, and false otherwise - - @return: list of L{declarations} - """ - #precondition: decls is a list of op level namespaces - return filter( matcher, algorithm.make_flatten( decls ) ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/function_traits.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/function_traits.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/function_traits.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/function_traits.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines few algorithms, that deals with different properties of functions -""" - -import calldef -import type_traits -import class_declaration - -def is_same_return_type( f1, f2 ): - #covariant returns - #The return type of an overriding function shall be either identical to the - #return type of the overridden function or covariant with the classes of the - #functions. If a function D::f overrides a function B::f, the return types - #of the functions are covariant if they satisfy the following criteria: - - #* both are pointers to classes or references to classes - #* the class in the return type of B::f is the same class as the class in - # the return type of D::f or, is an unambiguous direct or indirect base - # class of the class in the return type of D::f and is accessible in D - #* both pointers or references have the same cv-qualification and the class - # type in the return type of D::f has the same cv-qualification as or less - # cv-qualification than the class type in the return type of B::f. - - if not f1.__class__ is f2.__class__: - #it should be assert - return False #2 different calldef types - if not isinstance( f1, calldef.member_calldef_t ): - #for free functions we compare return types as usual - return type_traits.is_same( f1.return_type, f2.return_type) - if f1.virtuality == calldef.VIRTUALITY_TYPES.NOT_VIRTUAL \ - or f2.virtuality == calldef.VIRTUALITY_TYPES.NOT_VIRTUAL: - #for non-virtual member functions we compare types as usual - return type_traits.is_same( f1.return_type, f2.return_type) - rt1 = f1.return_type - rt2 = f2.return_type - if type_traits.is_pointer( rt1 ) and type_traits.is_pointer( rt2 ): - rt1 = type_traits.remove_pointer( rt1 ) - rt2 = type_traits.remove_pointer( rt2 ) - elif type_traits.is_reference( rt1 ) and type_traits.is_reference( rt2 ): - rt1 = type_traits.remove_reference( rt1 ) - rt2 = type_traits.remove_reference( rt2 ) - else: - return type_traits.is_same( f1.return_type, f2.return_type) - if ( type_traits.is_const( rt1 ) and type_traits.is_const( rt2 ) ) \ - or ( False == type_traits.is_const( rt1 ) and False == type_traits.is_const( rt2 ) ): - rt1 = type_traits.remove_const( rt1 ) - rt2 = type_traits.remove_const( rt2 ) - else: - return False - if not type_traits.is_class( rt1 ) or not type_traits.is_class( rt2 ): - return type_traits.is_same( rt1, rt2 ) - c1 = type_traits.class_traits.get_declaration( rt1 ) - c2 = type_traits.class_traits.get_declaration( rt2 ) - if c1.class_type == class_declaration.CLASS_TYPES.UNION \ - or c2.class_type == class_declaration.CLASS_TYPES.UNION: - return type_traits.is_same( rt1, rt2 ) - return type_traits.is_same( c1, c2 ) \ - or type_traits.is_base_and_derived( c1, c2 ) \ - or type_traits.is_base_and_derived( c2, c1 ) - - -def is_same_function( f1, f2 ): - """returns true if f1 and f2 is same function - - Use case: sometimes when user defines some virtual function in base class, - it overrides it in a derived one. Sometimes we need to know whether two member - functions is actualy same function. - """ - if f1 is f2: - return True - if not f1.__class__ is f2.__class__: - return False - if isinstance( f1, calldef.member_calldef_t ) and f1.has_const != f2.has_const: - return False - if f1.name != f2.name: - return False - if not is_same_return_type( f1, f2 ): - return False - if len( f1.arguments ) != len(f2.arguments): - return False - for f1_arg, f2_arg in zip( f1.arguments, f2.arguments ): - if not type_traits.is_same( f1_arg.type, f2_arg.type ): - return False - return True diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/__init__.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/__init__.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/__init__.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,337 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -contains classes that describe different C++ declarations -""" - -import compilers - -from dependencies import dependency_info_t -from declaration import location_t -from declaration import declaration_t -from scopedef import scopedef_t -from enumeration import enumeration_t -from namespace import namespace_t - -from class_declaration import class_t -from class_declaration import CLASS_TYPES -from class_declaration import ACCESS_TYPES -from class_declaration import hierarchy_info_t -from class_declaration import class_declaration_t -from class_declaration import class_types - -from typedef import typedef_t - -from cpptypes import type_t -from cpptypes import dummy_type_t -from cpptypes import unknown_t -from cpptypes import ellipsis_t -from cpptypes import fundamental_t -from cpptypes import void_t -from cpptypes import char_t -from cpptypes import signed_char_t -from cpptypes import unsigned_char_t -from cpptypes import wchar_t -from cpptypes import short_int_t -from cpptypes import short_unsigned_int_t -from cpptypes import bool_t -from cpptypes import int_t -from cpptypes import unsigned_int_t -from cpptypes import long_int_t -from cpptypes import long_unsigned_int_t -from cpptypes import long_long_int_t -from cpptypes import long_long_unsigned_int_t -from cpptypes import float_t -from cpptypes import double_t -from cpptypes import long_double_t -from cpptypes import FUNDAMENTAL_TYPES -from cpptypes import compound_t -from cpptypes import volatile_t -from cpptypes import const_t -from cpptypes import pointer_t -from cpptypes import reference_t -from cpptypes import restrict_t -from cpptypes import array_t -from cpptypes import calldef_type_t -from cpptypes import free_function_type_t -from cpptypes import member_function_type_t -from cpptypes import member_variable_type_t -from cpptypes import declarated_t -from cpptypes import type_qualifiers_t -#java types -from cpptypes import java_fundamental_t -from cpptypes import jbyte_t -from cpptypes import jshort_t -from cpptypes import jint_t -from cpptypes import jlong_t -from cpptypes import jfloat_t -from cpptypes import jdouble_t -from cpptypes import jchar_t -from cpptypes import jboolean_t - - - -from variable import variable_t - -from algorithm import full_name -from algorithm import full_name_from_declaration_path -from algorithm import make_flatten -from algorithm import apply_visitor -from algorithm import declaration_path -from algorithm import get_named_parent -from algorithm import find_declaration -from algorithm import match_declaration_t -from algorithm import find_all_declarations -from algorithm import find_first_declaration -from algorithm import declaration_files -from algorithm import visit_function_has_not_been_found_t -from algorithm import get_global_namespace - -from calldef import VIRTUALITY_TYPES -from calldef import FUNCTION_VIRTUALITY_TYPES -from calldef import argument_t -from calldef import calldef_t -from calldef import member_calldef_t -from calldef import free_calldef_t -from calldef import operator_t -from calldef import member_function_t -from calldef import constructor_t -from calldef import destructor_t -from calldef import member_operator_t -from calldef import casting_operator_t -from calldef import free_function_t -from calldef import free_operator_t - -from decl_visitor import decl_visitor_t -from type_visitor import type_visitor_t - -from type_traits import decompose_type -from type_traits import decompose_class - - -from type_traits import is_enum -from type_traits import enum_declaration -from type_traits import enum_traits - -from type_traits import is_class -from type_traits import class_traits -from type_traits import is_class_declaration -from type_traits import class_declaration_traits - - -from type_traits import is_bool -from type_traits import is_same -from type_traits import is_void -from type_traits import is_void_pointer -from type_traits import is_const -from type_traits import base_type -from type_traits import is_array -from type_traits import is_pointer -from type_traits import is_volatile -from type_traits import is_integral -from type_traits import is_reference -from type_traits import is_arithmetic -from type_traits import is_fundamental -from type_traits import is_floating_point -from type_traits import is_base_and_derived -from type_traits import is_convertible -from type_traits import is_noncopyable -from type_traits import is_std_string -from type_traits import is_std_wstring -from type_traits import is_std_ostream -from type_traits import is_std_wostream -from type_traits import is_calldef_pointer - -from type_traits import is_unary_operator -from type_traits import is_binary_operator - -from type_traits import array_size -from type_traits import array_item_type - -from type_traits import remove_cv -from type_traits import remove_const -from type_traits import remove_alias -from type_traits import remove_pointer -from type_traits import remove_volatile -from type_traits import remove_reference -from type_traits import remove_declarated - -from type_traits import has_destructor -from type_traits import has_public_less -from type_traits import has_copy_constructor -has_trivial_copy = has_copy_constructor #backward comp mode will be removed -from type_traits import has_public_equal -from type_traits import has_public_assign -from type_traits import has_public_destructor -from type_traits import has_public_constructor -from type_traits import has_trivial_constructor -from type_traits import find_trivial_constructor -from type_traits import has_public_binary_operator -from type_traits import has_any_non_copyconstructor - -from type_traits import auto_ptr_traits -from type_traits import smart_pointer_traits - -from container_traits import list_traits -from container_traits import deque_traits -from container_traits import queue_traits -from container_traits import priority_queue_traits -from container_traits import vector_traits -from container_traits import stack_traits -from container_traits import map_traits -from container_traits import multimap_traits -from container_traits import hash_map_traits -from container_traits import hash_multimap_traits -from container_traits import set_traits -from container_traits import hash_set_traits -from container_traits import multiset_traits -from container_traits import hash_multiset_traits -from container_traits import find_container_traits - -from function_traits import is_same_function - -all_container_traits = container_traits.container_traits -"""tuple of all STD container traits classes""" - -sequential_container_traits = \ -[ - list_traits - , deque_traits - , queue_traits - , priority_queue_traits - , vector_traits - , stack_traits - , set_traits - , hash_set_traits - , multiset_traits - , hash_multiset_traits -] -"""list, that contains all STD container traits classes""" - - -import templates -import call_invocation - -from filtering import filtering - -from decl_factory import decl_factory_t - -from matchers import matcher_base_t -from matchers import or_matcher_t -from matchers import and_matcher_t -from matchers import not_matcher_t -from matchers import declaration_matcher_t -from matchers import calldef_matcher_t -from matchers import namespace_matcher_t -from matchers import variable_matcher_t -from matchers import regex_matcher_t -from matchers import access_type_matcher_t -from matchers import operator_matcher_t -from matchers import custom_matcher_t -from matchers import virtuality_type_matcher_t - -#make matchers to look more like functors -or_matcher = or_matcher_t -"""see L{or_matcher} for documentation""" -and_matcher = and_matcher_t -"""see L{and_matcher} for documentation""" -not_matcher = not_matcher_t -"""see L{not_matcher} for documentation""" -declaration_matcher = declaration_matcher_t -"""see L{declaration_matcher} for documentation""" -calldef_matcher = calldef_matcher_t -"""see L{calldef_matcher} for documentation""" -namespace_matcher = namespace_matcher_t -"""see L{namespace_matcher} for documentation""" -variable_matcher = variable_matcher_t -"""see L{variable_matcher} for documentation""" -regex_matcher = regex_matcher_t -"""see L{regex_matcher} for documentation""" -access_type_matcher = access_type_matcher_t -"""see L{access_type_matcher} for documentation""" -operator_matcher = operator_matcher_t -"""see L{operator_matcher} for documentation""" -custom_matcher = custom_matcher_t -"""see L{custom_matcher} for documentation""" -virtuality_type_matcher = virtuality_type_matcher_t -"""see L{virtuality_type_matcher} for documentation""" - -from matcher import matcher - -from mdecl_wrapper import mdecl_wrapper_t - -from decl_printer import decl_printer_t -from decl_printer import print_declarations - - -import scopedef - -scopedef.scopedef_t._impl_all_decl_types = \ -[ - scopedef.scopedef_t - , enumeration_t - , namespace_t - , class_t - , class_declaration_t - , typedef_t - , variable_t - , calldef_t - , member_calldef_t - , free_calldef_t - , operator_t - , member_function_t - , constructor_t - , destructor_t - , member_operator_t - , casting_operator_t - , free_function_t - , free_operator_t -] - -__impl_matchers = scopedef.scopedef_t._impl_matchers -__impl_decl_types = scopedef.scopedef_t._impl_decl_types - -__impl_matchers[ scopedef.scopedef_t.decl ] = declaration_matcher_t - -__impl_matchers[ scopedef.scopedef_t.class_ ] = declaration_matcher_t -__impl_decl_types[ scopedef.scopedef_t.class_ ] = class_t - -__impl_matchers[ scopedef.scopedef_t.variable ] = variable_matcher_t - -__impl_matchers[ scopedef.scopedef_t.calldef ] = calldef_matcher_t -__impl_decl_types[ scopedef.scopedef_t.calldef ] = calldef_t - -__impl_matchers[ scopedef.scopedef_t.operator ] = operator_matcher_t -__impl_decl_types[ scopedef.scopedef_t.operator ] = operator_t - -__impl_matchers[ scopedef.scopedef_t.member_function ] = calldef_matcher_t -__impl_decl_types[ scopedef.scopedef_t.member_function ] = member_function_t - -__impl_matchers[ scopedef.scopedef_t.constructor ] = calldef_matcher_t -__impl_decl_types[ scopedef.scopedef_t.constructor ] = constructor_t - -__impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t -__impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t - -__impl_matchers[ scopedef.scopedef_t.member_operator ] = operator_matcher_t -__impl_decl_types[ scopedef.scopedef_t.member_operator ] = member_operator_t - -__impl_matchers[ scopedef.scopedef_t.casting_operator ] = calldef_matcher_t -__impl_decl_types[ scopedef.scopedef_t.casting_operator ] = casting_operator_t - -__impl_matchers[ scopedef.scopedef_t.enumeration ] = declaration_matcher_t -__impl_decl_types[ scopedef.scopedef_t.enumeration ] = enumeration_t - -__impl_matchers[ scopedef.scopedef_t.typedef ] = declaration_matcher_t -__impl_decl_types[ scopedef.scopedef_t.typedef ] = typedef_t - -__impl_matchers[ namespace_t.namespace ] = namespace_matcher_t - -__impl_matchers[ namespace_t.free_function ] = calldef_matcher_t -__impl_decl_types[ namespace_t.free_function ] = free_function_t - -__impl_matchers[ namespace_t.free_operator ] = operator_matcher_t -__impl_decl_types[ namespace_t.free_operator ] = free_operator_t diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matcher.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matcher.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matcher.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matcher.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""implements few "find" algorithms on declarations tree""" - -import types -import algorithm - -class matcher: - """class-namespace, contains implementation of few "find" algorithms and - definition of related exception classes""" - - class declaration_not_found_t( RuntimeError ): - """exception, that will be raised, if the declaration could not be found""" - def __init__( self, matcher ): - RuntimeError.__init__( self ) - self.matcher = matcher - - def __str__( self ): - return "Unable to find declaration. matcher: [%s]"%str(self.matcher) - - class multiple_declarations_found_t( RuntimeError ): - """exception, that will be raised, if more than one declaration was found""" - def __init__( self, matcher ): - RuntimeError.__init__( self ) - self.matcher = matcher - - def __str__( self ): - return "Multiple declarations has been found. matcher: [%s]"%str(self.matcher) - - @staticmethod - def find( decl_matcher, decls, recursive=True ): - """returns a list of declarations that match "decl_matcher" defined criretia or None - - @param decl_matcher: Python callable object, that takes one argument - reference to declaration - @param decls: reference to declaration or list of declarations to be searched in - @param recursive: boolean, if True the method will run decl_matcher, on internal declarations too - """ - - where = [] - if isinstance( decls, types.ListType ): - where.extend( decls ) - else: - where.append( decls ) - if recursive: - where = algorithm.make_flatten( where ) - return filter( decl_matcher, where ) - - @staticmethod - def find_single( decl_matcher, decls, recursive=True ): - """returns a reference to declaration, that match "decl_matcher" defined - criretia, if a unique declaration could not be found the method will return - None. - - @param decl_matcher: Python callable object, that takes one argument - reference to declaration - @param decls: reference to declaration or list of declarations to be searched in - @param recursive: boolean, if True the method will run decl_matcher, on internal declarations too - """ - answer = matcher.find( decl_matcher, decls, recursive ) - if len(answer) == 1: - return answer[0] - - @staticmethod - def get_single( decl_matcher, decls, recursive=True ): - """returns a reference to declaration, that match "decl_matcher" defined - criretia, if a unique declaration could not be found, an appropriate - exception will be raised. - - @param decl_matcher: Python callable object, that takes one argument - reference to declaration - @param decls: reference to declaration or list of declarations to be searched in - @param recursive: boolean, if True the method will run decl_matcher, on internal declarations too - """ - answer = matcher.find( decl_matcher, decls, recursive ) - if len(answer) == 1: - return answer[0] - elif len(answer) == 0: - raise matcher.declaration_not_found_t( decl_matcher ) - else: - raise matcher.multiple_declarations_found_t( decl_matcher ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matchers.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matchers.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matchers.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/matchers.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,527 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines all "built-in" classes that implement declarations compare functionality -according to some criteria -""" - -import os -import re -import types -import algorithm -import variable -import namespace -import calldef -import cpptypes -import templates -import class_declaration -from pygccxml import utils - -class matcher_base_t(object): - """matcher_base_t class defines interface for classes that will implement - compare functionality according to some criteria. - """ - def __init__( self ): - object.__init__( self ) - - def __call__(self, decl): - raise NotImplementedError( "matcher must always implement the __call__() method." ) - - def __invert__(self): - """not-operator (~)""" - return not_matcher_t(self) - - def __and__(self, other): - """and-operator (&)""" - return and_matcher_t([self, other]) - - def __or__(self, other): - """or-operator (|)""" - return or_matcher_t([self, other]) - - def __str__( self ): - return "base class for all matchers" - -class and_matcher_t(matcher_base_t): - """Combine several other matchers with "&". - - For example: find all private functions with name XXX - - C{ matcher = access_type_matcher_t( 'private' ) & calldef_matcher_t( name='XXX' ) } - """ - def __init__(self, matchers): - matcher_base_t.__init__(self) - self.matchers = matchers - - def __call__(self, decl): - for matcher in self.matchers: - if not matcher(decl): - return False - return True - - def __str__(self): - return " & ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) - - -class or_matcher_t(matcher_base_t): - """Combine several other matchers with "|". - - For example: find all functions and variables with name 'XXX' - - C{ matcher = variable_matcher_t( name='XXX' ) | calldef_matcher_t( name='XXX' ) } - - """ - def __init__(self, matchers): - matcher_base_t.__init__(self) - self.matchers = matchers - - def __call__(self, decl): - for matcher in self.matchers: - if matcher(decl): - return True - return False - - def __str__(self): - return " | ".join( map( lambda x: "(%s)" % str( x ), self.matchers ) ) - - -class not_matcher_t(matcher_base_t): - """Return the inverse result of matcher, using "~" - - For example: find all private and protected declarations - - C{ matcher = ~access_type_matcher_t( 'private' ) } - - """ - def __init__(self, matcher): - matcher_base_t.__init__(self) - self.matcher = matcher - - def __call__(self, decl): - return not self.matcher(decl) - - def __str__(self): - return "~(%s)"%str(self.matcher) - -class declaration_matcher_t( matcher_base_t ): - """ - Instance of this class will match declarations by next criteria: - - declaration name, also could be fully qualified name - Example: wstring or ::std::wstring - - declaration type - Example: L{class_t}, L{namespace_t}, L{enumeration_t} - - location within file system ( file or directory ) - """ - def __init__( self, name=None, decl_type=None, header_dir=None, header_file=None ): - """ - @param decl_type: declaration type to match by. For example L{enumeration_t}. - @type decl_type: any class that derives from L{declarations.declaration_t} class - - @param name: declaration name, could be full name. - @type name: str - - @param header_dir: absolute directory path - @type header_dir: str - - @param header_file: absolute file path - @type header_file: str - - """ - #An other option is that pygccxml will create absolute path using - #os.path.abspath function. But I think this is just wrong, because abspath - #builds path using current working directory. This behavior is fragile - #and very difficult to find a bug. - matcher_base_t.__init__( self ) - self.decl_type = decl_type - self.__name = None - self.__opt_is_tmpl_inst = None - self.__opt_tmpl_name = None - self.__opt_is_full_name = None - self.__decl_name_only = None - - self._set_name( name ) - - self.header_dir = header_dir - self.header_file = header_file - - if self.header_dir: - self.header_dir = utils.normalize_path( self.header_dir ) - if not os.path.isabs( self.header_dir ): - raise RuntimeError( "Path to header directory should be absolute!" ) - - if self.header_file: - self.header_file = utils.normalize_path( self.header_file ) - if not os.path.isabs( self.header_file ): - raise RuntimeError( "Path to header file should be absolute!" ) - - def _get_name(self): - return self.__name - - def _set_name( self, name ): - self.__name = name - if not self.__name: - self.__opt_is_tmpl_inst = None - self.__opt_tmpl_name = None - self.__opt_is_full_name = None - self.__decl_name_only = None - else: - self.__opt_is_tmpl_inst = templates.is_instantiation( self.__name ) - self.__opt_tmpl_name = templates.name( self.__name ) - if self.__opt_is_tmpl_inst: - if '::' in self.__opt_tmpl_name: - self.__opt_is_full_name = True - self.__decl_name_only = self.__opt_tmpl_name.split('::')[-1] - else: - self.__opt_is_full_name = False - self.__decl_name_only = self.__opt_tmpl_name - self.__name = templates.normalize( name ) - else: - if '::' in self.__name: - self.__opt_is_full_name = True - self.__decl_name_only = self.__name.split('::')[-1] - else: - self.__opt_is_full_name = False - self.__decl_name_only = self.__name - - - name = property( _get_name, _set_name ) - - def __str__( self ): - msg = [] - if not None is self.decl_type: - msg.append( '(decl type==%s)' % self.decl_type.__name__ ) - if not None is self.name: - msg.append( '(name==%s)' % self.name ) - if not None is self.header_dir: - msg.append( '(header dir==%s)' % self.header_dir ) - if not None is self.header_file: - msg.append( '(header file==%s)' % self.header_file ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - - def __call__( self, decl ): - if not None is self.decl_type: - if not isinstance( decl, self.decl_type ): - return False - if not None is self.name: - if not self.check_name( decl ): - return False - if not None is self.header_dir and decl.location: - decl_dir = os.path.abspath( os.path.dirname( decl.location.file_name ) ) - decl_dir = utils.normalize_path( decl_dir ) - if decl_dir[:len(self.header_dir)] != self.header_dir: - return False - if not None is self.header_file and decl.location: - decl_file = os.path.abspath( decl.location.file_name ) - decl_file = utils.normalize_path( decl_file ) - if decl_file != self.header_file: - return False - return True - - def check_name( self, decl ): - assert not None is self.name - if self.__opt_is_tmpl_inst: - if not self.__opt_is_full_name: - if self.name != templates.normalize( decl.name ) \ - and self.name != templates.normalize( decl.partial_name ): - return False - else: - if self.name != templates.normalize( algorithm.full_name( decl, with_defaults=True ) ) \ - and self.name != templates.normalize( algorithm.full_name( decl, with_defaults=False ) ): - return False - else: - if not self.__opt_is_full_name: - if self.name != decl.name and self.name != decl.partial_name: - return False - else: - if self.name != algorithm.full_name( decl, with_defaults=True ) \ - and self.name != algorithm.full_name( decl, with_defaults=False ): - return False - return True - - def is_full_name(self): - return self.__opt_is_full_name - - def _get_decl_name_only(self): - return self.__decl_name_only - decl_name_only = property( _get_decl_name_only ) - -class variable_matcher_t( declaration_matcher_t ): - """ - Instance of this class will match variables by next criteria: - - L{declaration_matcher_t} criteria - - variable type. Example: L{int_t} or 'int' - """ - def __init__( self, name=None, type=None, header_dir=None, header_file=None ): - """ - @param type: variable type - @type type: string or instance of L{type_t} derived class - """ - declaration_matcher_t.__init__( self - , name=name - , decl_type=variable.variable_t - , header_dir=header_dir - , header_file=header_file ) - self.type = type - - def __call__( self, decl ): - if not super( variable_matcher_t, self ).__call__( decl ): - return False - if not None is self.type: - if isinstance( self.type, cpptypes.type_t ): - if self.type != decl.type: - return False - else: - if self.type != decl.type.decl_string: - return False - return True - - def __str__( self ): - msg = [ super( variable_matcher_t, self ).__str__() ] - if msg == [ 'any' ]: - msg = [] - if not None is self.type: - msg.append( '(value type==%s)' % str(self.type) ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - - -class namespace_matcher_t( declaration_matcher_t ): - """Instance of this class will match namespaces by name.""" - - def __init__( self, name=None ): - declaration_matcher_t.__init__( self, name=name, decl_type=namespace.namespace_t) - - def __call__( self, decl ): - if self.name and decl.name == '': - #unnamed namespace have same name as thier parent, we should prevent - #this happens. The price is: user should search for unnamed namespace - #directly. - return False - return super( namespace_matcher_t, self ).__call__( decl ) - - -class calldef_matcher_t( declaration_matcher_t ): - """ - Instance of this class will match callable by next criteria: - - L{declaration_matcher_t} criteria - - return type. Example: L{int_t} or 'int' - - argument types - """ - - def __init__( self, name=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): - """ - @param return_type: callable return type - @type return_type: string or instance of L{type_t} derived class - - @param arg_types: list of function argument types. arg_types can contain. - Any item within the list could be string or instance of L{type_t} derived - class. If you don't want some argument to participate in match you can - put None. For example: - - C{ calldef_matcher_t( arg_types=[ 'int &', None ] ) } - - will match all functions that takes 2 arguments, where the first one is - reference to integer and second any - @type arg_types: list - """ - if None is decl_type: - decl_type = calldef.calldef_t - declaration_matcher_t.__init__( self - , name=name - , decl_type=decl_type - , header_dir=header_dir - , header_file=header_file ) - - self.return_type = return_type - self.arg_types = arg_types - - def __call__( self, decl ): - if not super( calldef_matcher_t, self ).__call__( decl ): - return False - if not None is self.return_type \ - and not self.__compare_types( self.return_type, decl.return_type ): - return False - if self.arg_types: - if isinstance( self.arg_types, (types.ListType, types.TupleType)): - if len(self.arg_types) != len( decl.arguments ): - return False - for type_or_str, arg in zip( self.arg_types, decl.arguments ): - if None == type_or_str: - continue - else: - if not self.__compare_types( type_or_str, arg.type ): - return False - return True - - def __compare_types( self, type_or_str, type ): - assert type_or_str - if type is None: - return False - if isinstance( type_or_str, cpptypes.type_t ): - if type_or_str != type: - return False - else: - if type_or_str != type.decl_string: - return False - return True - - def __str__( self ): - msg = [ super( calldef_matcher_t, self ).__str__() ] - if msg == [ 'any' ]: - msg = [] - if not None is self.return_type: - msg.append( '(return type==%s)' % str(self.return_type) ) - if self.arg_types: - for i in range( len( self.arg_types ) ): - if self.arg_types[i] is None: - msg.append( '(arg %d type==any)' % i ) - else: - msg.append( '(arg %d type==%s)' % ( i, str( self.arg_types[i] ) ) ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - - -class operator_matcher_t( calldef_matcher_t ): - """ - Instance of this class will match operators by next criteria: - - L{calldef_matcher_t} criteria - - operator symbol: =, !=, (), [] and etc - """ - def __init__( self, name=None, symbol=None, return_type=None, arg_types=None, decl_type=None, header_dir=None, header_file=None): - """ - @param symbol: operator symbol - @type symbol: str - """ - if None is decl_type: - decl_type = calldef.operator_t - calldef_matcher_t.__init__( self - , name=name - , return_type=return_type - , arg_types=arg_types - , decl_type=decl_type - , header_dir=header_dir - , header_file=header_file) - self.symbol = symbol - - def __call__( self, decl ): - if not super( operator_matcher_t, self ).__call__( decl ): - return False - if not None is self.symbol: - if self.symbol != decl.symbol: - return False - return True - - def __str__( self ): - msg = [ super( operator_matcher_t, self ).__str__() ] - if msg == [ 'any' ]: - msg = [] - if not None is self.symbol: - msg.append( '(symbol==%s)' % str(self.symbol) ) - if not msg: - msg.append( 'any' ) - return ' and '.join( msg ) - -class regex_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration using regular expression. - User should supply a function that will extract from declaration desired - information as string. Later, this matcher will match that string using - user regular expression. - """ - def __init__( self, regex, function=None ): - """ - @param regex: regular expression - @type regex: string, an instance of this class will compile it for you - - @param function: function that will be called to get an information from - declaration as string. As input this function takes 1 argument: reference - to declaration. Return value should be string. If function is None, then - the matcher will use declaration name. - - """ - matcher_base_t.__init__(self) - self.regex = re.compile( regex ) - self.function = function - if None is self.function: - self.function = lambda decl: decl.name - - def __call__( self, decl ): - text = self.function( decl ) - return bool( self.regex.match( text ) ) - - def __str__( self ): - return '(regex=%s)' % self.regex - -class access_type_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration by its access type: public, - private or protected. If declarations does not have access type, for example - free function, then False will be returned. - """ - - def __init__( self, access_type ): - """ - @param access_type: declaration access type - @type access_type: L{ACCESS_TYPES} defines few consts for your convinience. - Any way you can pass public, private or protected as argument to this function - """ - matcher_base_t.__init__( self ) - self.access_type = access_type - - def __call__( self, decl ): - if not isinstance( decl.parent, class_declaration.class_t ): - return False - return self.access_type == decl.parent.find_out_member_access_type( decl ) - - def __str__( self ): - return '(access type=%s)' % self.access_type - -class virtuality_type_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration by its virtuality type: not virtual, - virtual or pure virtual. If declarations does not have virtuality type, for example - free function, then False will be returned. - """ - - def __init__( self, virtuality_type ): - """ - @param access_type: declaration access type - @type access_type: L{VIRTUALITY_TYPES} defines few consts for your convinience. - """ - matcher_base_t.__init__( self ) - self.virtuality_type = virtuality_type - - def __call__( self, decl ): - if not isinstance( decl.parent, class_declaration.class_t ): - return False - return self.virtuality_type == decl.virtuality - - def __str__( self ): - return '(virtuality type=%s)' % self.virtuality_type - - -class custom_matcher_t( matcher_base_t ): - """ - Instance of this class will match declaration by user custom criteria. - """ - - def __init__( self, function ): - """ - @param function: callable, that takes single argument - declaration instance - should return True or False - """ - matcher_base_t.__init__( self ) - self.function = function - - def __call__( self, decl ): - return bool( self.function( decl ) ) - - def __str__( self ): - return '(user criteria)' diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/mdecl_wrapper.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/mdecl_wrapper.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/mdecl_wrapper.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/mdecl_wrapper.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines class L{mdecl_wrapper_t} that allows to work on set of declarations, -as it was one declaration. - -The L{class} allows user to not write "for" loops within the code. -""" - -import os - -class call_redirector_t( object ): - """Internal class used to call some function of objects""" - def __init__( self, name, decls ): - """creates call_redirector_t instance. - - @param name: name of method, to be called on every object in C{decls} list - @param decls: list of objects - """ - object.__init__( self ) - self.name = name - self.decls = decls - - def __call__( self, *arguments, **keywords ): - """calls method C{self.name} on every object within C{self.decls} list""" - for d in self.decls: - callable_ = getattr(d, self.name) - callable_( *arguments, **keywords ) - -class mdecl_wrapper_t( object ): - """Multiple declarations wrapper. - - The main purpose of this class is to allow an user to work on many - declarations, as they were only one single declaration. - - Example: - mb = module_builder_t( ... ) - #lets say we want to exclude all member functions, that returns reference to int: - mb.member_functions( return_type='int &' ).exclude() - - "exclude" function will be called on every function that match the criteria. - """ - - def __init__( self, decls ): - """@param decls: list of declarations to operate on. - @type decls: list of L{declaration wrappers} - """ - object.__init__( self ) - self.__dict__['declarations'] = decls - - def __nonzero__( self ): - return bool( self.declarations ) - - def __len__( self ): - """returns the number of declarations""" - return len( self.declarations ) - - def __getitem__( self, index ): - """provides access to declaration""" - return self.declarations[index] - - def __iter__( self ): - return iter(self.declarations) - - def __ensure_attribute( self, name ): - invalid_decls = filter( lambda d: not hasattr( d, name ), self.declarations ) - sep = os.linesep + ' ' - if invalid_decls: - raise RuntimeError( "Next declarations don't have '%s' attribute: %s" - % ( name, sep.join( map( str, invalid_decls ) ) ) ) - - def __setattr__( self, name, value ): - """Updates the value of attribute on all declarations. - @param name: name of attribute - @param value: new value of attribute - """ - self.__ensure_attribute( name ) - for d in self.declarations: - setattr( d, name, value ) - - def __getattr__( self, name ): - """@param name: name of method - """ - return call_redirector_t( name, self.declarations ) - - def __contains__( self, item ): - return item in self.declarations - - def to_list(self): - l = [] - for d in self.declarations: - l.append( d ) - return l \ No newline at end of file diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/namespace.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/namespace.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/namespace.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/namespace.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,144 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""defines class, that describes C++ namespace declaration""" - -import declaration -import scopedef -import algorithm - -class namespace_t( scopedef.scopedef_t ): - """ - describes C++ namespace - """ - - def __init__( self, name='', declarations=None ): - """creates class that describes C++ namespace declaration""" - scopedef.scopedef_t.__init__( self, name ) - if not declarations: - declarations = [] - self._declarations = declarations # list of all declarations belongs to this namespace - - def __str__(self): - name = algorithm.full_name(self) - if name!="::" and name[:2]=="::": - name = name[2:] - return "%s [namespace]"%name - - def _get__cmp__scope_items(self): - """implementation details""" - return [ self._sorted_list( self.declarations ) ] - - def _get_declarations_impl(self): - return self._declarations - def _set_declarations(self, declarations): - self._declarations = declarations - declarations = property( scopedef.scopedef_t._get_declarations - , _set_declarations - , doc="list of all declarations, defined in the namespace") - - def take_parenting( self, inst ): - """Takes parenting from inst and transfers it to self""" - if self is inst: - return - for decl in inst.declarations: - decl.parent = self - self.declarations.append( decl ) - inst.declarations = [] - - def adopt_declaration( self, decl ): - self.declarations.append( decl ) - decl.parent = self - decl.cache.reset() - - def remove_declaration( self, decl ): - """ - removes decl from members list - - @param decl: declaration to be removed - @type decl: L{declaration_t} - """ - del self.declarations[ self.declarations.index( decl ) ] - decl.cache.reset() - #add more comment about this. - #if not keep_parent: - # decl.parent=None - - def namespace( self, name=None, function=None, recursive=None ): - """returns reference to namespace declaration, that is matched defined criterias""" - return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.namespace ] - , name=name - , function=function - , recursive=recursive ) - ns = namespace - - def namespaces( self, name=None, function=None, recursive=None, allow_empty=None ): - """returns a set of namespace declarations, that are matched defined criterias""" - return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.namespace ] - , name=name - , function=function - , recursive=recursive - , allow_empty=allow_empty) - nss = namespaces - - def free_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to free function declaration, that is matched defined criterias""" - return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.free_function ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ namespace_t.free_function ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - free_fun = free_function - - def free_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of free function declarations, that are matched defined criterias""" - return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.free_function ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ namespace_t.free_function ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - free_funs = free_functions - - def free_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to free operator declaration, that is matched defined criterias""" - return self._find_single( scopedef.scopedef_t._impl_matchers[ namespace_t.free_operator ] - , name=self._build_operator_name( name, function, symbol ) - , symbol=symbol - , function=self._build_operator_function( name, function ) - , decl_type=self._impl_decl_types[ namespace_t.free_operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def free_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of free operator declarations, that are matched defined criterias""" - return self._find_multiple( scopedef.scopedef_t._impl_matchers[ namespace_t.free_operator ] - , name=self._build_operator_name( name, function, symbol ) - , symbol=symbol - , function=self._build_operator_function( name, function ) - , decl_type=self._impl_decl_types[ namespace_t.free_operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def i_depend_on_them( self, recursive=True ): - answer = [] - if recursive: - map( lambda decl: answer.extend( decl.i_depend_on_them() ), self.declarations ) - return answer diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/pattern_parser.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/pattern_parser.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/pattern_parser.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/pattern_parser.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""implementation details""" - -import types - -class parser_t( object ): - """implementation details""" - def __init__( self - , pattern_char_begin - , pattern_char_end - , pattern_char_separator ): - self.__begin = pattern_char_begin - self.__end = pattern_char_end - self.__separator = pattern_char_separator - #right now parser does not take into account next qualifiers, but it will - self.__text_qualifier = '"' - self.__char_qualifier = "'" - self.__escape = '\\' - - def has_pattern( self, decl_string ): - """implementation details""" - last_part = decl_string.split( '::' )[-1] - return -1 != decl_string.find( self.__begin ) and -1 != last_part.find( self.__end ) - - def name( self, decl_string ): - """implementation details""" - assert isinstance( decl_string, types.StringTypes ) - if not self.has_pattern( decl_string ): - return decl_string - args_begin = decl_string.find( self.__begin ) - return decl_string[0: args_begin].strip() - - def __find_args_separator( self, decl_string, start_pos ): - """implementation details""" - bracket_depth = 0 - for index, ch in enumerate( decl_string[start_pos:] ): - if ch not in ( self.__begin, self.__end, self.__separator ): - continue #I am interested only in < and > - elif self.__separator == ch: - if not bracket_depth: - return index + start_pos - elif self.__begin == ch: - bracket_depth += 1 - elif not bracket_depth: - return index + start_pos - else: - bracket_depth -= 1 - return -1 - - def args( self, decl_string ): - """implementation details""" - args_begin = decl_string.find( self.__begin ) - args_end = decl_string.rfind( self.__end ) - if -1 in ( args_begin, args_end ) or args_begin == args_end: - raise RuntimeError( "%s doesn't valid template instantiation string" % decl_string ) - - args_only = decl_string[args_begin + 1: args_end ] - args = [] - previous_found, found = 0, 0 - while True: - found = self.__find_args_separator( args_only, previous_found) - if -1 == found: - args.append( args_only[ previous_found : ] ) - break - #elif decl_string[ found ] == self.__end: - # print args - # raise RuntimeError( "unmatched '%s' token has been found." % self.__end ) - else: - args.append( args_only[ previous_found : found ] ) - previous_found = found + 1 #skip found sep - return [ arg.strip() for arg in args ] - - NOT_FOUND = ( -1, -1 ) - """implementation details""" - - def find_args(self, text, start=None ): - """implementation details""" - if start==None: - start = 0 - first_occurance = text.find( self.__begin, start ) - if first_occurance == -1: - return self.NOT_FOUND - previous_found, found = first_occurance + 1, 0 - while True: - found = self.__find_args_separator( text, previous_found) - if -1 == found: - return self.NOT_FOUND - elif text[ found ] == self.__end: - return ( first_occurance, found ) - else: - previous_found = found + 1 #skip found sep - - def split( self, decl_string ): - """implementation details""" - assert self.has_pattern( decl_string ) - return self.name( decl_string ), self.args( decl_string ) - - def split_recursive( self, decl_string ): - """implementation details""" - assert self.has_pattern( decl_string ) - answer = [] - to_go = [ decl_string ] - while to_go: - name, args = self.split( to_go.pop() ) - answer.append( ( name, args ) ) - for arg in args: - if self.has_pattern( arg ): - to_go.append( arg ) - return answer - - def join( self, name, args, arg_separator=None ): - """implementation details""" - if None is arg_separator: - arg_separator = ', ' - args = filter( None, args) - args_str = '' - if not args: - args_str = ' ' - elif 1 == len( args ): - args_str = ' ' + args[0] + ' ' - else: - args_str = ' ' + arg_separator.join( args ) + ' ' - - return ''.join( [ name, self.__begin, args_str, self.__end ] ) - - def normalize( self, decl_string, arg_separator=None ): - """implementation details""" - if not self.has_pattern( decl_string ): - return decl_string - name, args = self.split( decl_string ) - for i, arg in enumerate( args ): - args[i] = self.normalize( arg ) - return self.join( name, args, arg_separator ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/scopedef.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/scopedef.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/scopedef.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/scopedef.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,650 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines base class for L{namespace_t} and L{class_t} classes -""" - -import time -import algorithm -import filtering -import templates -import declaration -import mdecl_wrapper -from pygccxml import utils -import matcher as matcher_module - -class scopedef_t( declaration.declaration_t ): - """Base class for L{namespace_t} and L{class_t} classes. - - This is the base class for all declaration classes that may have - children nodes. The children can be accessed via the C{declarations} - property. - - Also this class provides "get/select/find" interface. Using this class you - can get instance or instances of internal declaration(s). - - You can find declaration(s) using next criteria: - 1. name - declaration name, could be full qualified name - 2. header_dir - directory, to which belongs file, that the declaration was declarated in. - header_dir should be absolute path. - 3. header_file - file that the declaration was declarated in. - 4. function - user ( your ) custom criteria. The interesting thing is that - this function will be joined with other arguments ( criteria ). - 5. recursive - the search declaration range, if True will be search in - internal declarations too. - - Every "select" API you can invoke and pass as first argument at declaration - name or function. This class will find out correctly what argument represents. - - Example:: - ns - referrers to global namespace - ns.member_function( "do_something ) - will return reference to member - function named "do_something". If there is no such function exception - will be raised. If there is more then one function exception will be - raised too. - - Example 2:: - ns - referers to global namespace - do_smths = ns.member_functions( "do_something ) - will return instance - of L{mdecl_wrapper_t} object. This object allows you few things: - - 1. To iterate on selected declarations - 2. To set some property to desired value using one line of code only: - do_smths.call_policies = x - 3. To call some function on every instance using one line of code: - do_smths.exclude() - - Pay attention: you can not use "get" functions or properties. - """ - - RECURSIVE_DEFAULT = True - ALLOW_EMPTY_MDECL_WRAPPER = False - - declaration_not_found_t = matcher_module.matcher.declaration_not_found_t - multiple_declarations_found_t = matcher_module.matcher.multiple_declarations_found_t - - _impl_matchers = {} #this class variable is used to prevent recursive imports - _impl_decl_types = {} #this class variable is used to prevent recursive imports - _impl_all_decl_types = [] #this class variable is used to prevent recursive imports - - def __init__( self, name=''): - declaration.declaration_t.__init__( self, name ) - - self._optimized = False - self._type2decls = {} - self._type2name2decls = {} - self._type2decls_nr = {} - self._type2name2decls_nr = {} - self._all_decls = None - self._all_decls_not_recursive = None - - def _get_logger( self ): - return utils.loggers.queries_engine - _logger = property( _get_logger, doc="reference to C{queries_engine} logger" ) - - def _get__cmp__scope_items(self): - """implementation details""" - raise NotImplementedError() - - def _get__cmp__items(self): - """implementation details""" - items = [] - if self._optimized: - #in this case we don't need to build class internal declarations list - items.append( self._sorted_list( self._all_decls_not_recursive ) ) - else: - items.append( self._sorted_list( self.declarations ) ) - items.extend( self._get__cmp__scope_items() ) - return items - - def __eq__(self, other): - if not declaration.declaration_t.__eq__( self, other ): - return False - return self._sorted_list( self.declarations[:] ) \ - == other._sorted_list( other.declarations[:] ) - #self_decls = self._all_decls_not_recursive - #if not self._optimized: - #self_decls = self._sorted_list( self.declarations[:] ) - #other_decls = other._all_decls_not_recursive[:] - #if not other._optimized: - #other_decls = other._sorted_list( other.declarations[:] ) - #else: - #return self_decls == other_decls - - def _get_declarations_impl(self): - raise NotImplementedError() - - def _get_declarations(self): - if True == self._optimized: - return self._all_decls_not_recursive - else: - return self._get_declarations_impl() - declarations = property( _get_declarations, doc="list of children L{declarations}" ) - - def remove_declaration( self, decl ): - raise NotImplementedError() - - def __decl_types( self, decl ): - """implementation details""" - types = [] - bases = list( decl.__class__.__bases__ ) - visited = set() - if 'pygccxml' in decl.__class__.__module__: - types.append( decl.__class__ ) - while bases: - base = bases.pop() - if base is declaration.declaration_t: - continue - if base in visited: - continue - if 'pygccxml' not in base.__module__: - continue - types.append( base ) - bases.extend( base.__bases__ ) - return types - - def clear_optimizer(self): - """Cleans query optimizer state""" - self._optimized = False - self._type2decls = {} - self._type2name2decls = {} - self._type2decls_nr = {} - self._type2name2decls_nr = {} - self._all_decls = None - self._all_decls_not_recursive = None - - map( lambda decl: decl.clear_optimizer() - , filter( lambda decl: isinstance( decl, scopedef_t ) - , self.declarations ) ) - - def init_optimizer(self): - """Initializes query optimizer state. - There are 4 internals hash tables: - 1. from type to declarations - 2. from type to declarations for non-recursive queries - 3. from type to name to declarations - 4. from type to name to declarations for non-recursive queries - - Almost every query includes declaration type information. Also very - common query is to search some declaration(s) by name or full name. - Those hashtables allows to search declaration very quick. - """ - if self.name == '::': - self._logger.debug( "preparing data structures for query optimizer - started" ) - start_time = time.clock() - - self.clear_optimizer() - - for dtype in scopedef_t._impl_all_decl_types: - self._type2decls[ dtype ] = [] - self._type2decls_nr[ dtype ] = [] - self._type2name2decls[ dtype ] = {} - self._type2name2decls_nr[ dtype ] = {} - - self._all_decls_not_recursive = self.declarations - self._all_decls = algorithm.make_flatten( self._all_decls_not_recursive ) - for decl in self._all_decls: - types = self.__decl_types( decl ) - for type_ in types: - self._type2decls[ type_ ].append( decl ) - name2decls = self._type2name2decls[ type_ ] - if not name2decls.has_key( decl.name ): - name2decls[ decl.name ] = [] - name2decls[ decl.name ].append( decl ) - if self is decl.parent: - self._type2decls_nr[ type_ ].append( decl ) - name2decls_nr = self._type2name2decls_nr[ type_ ] - if not name2decls_nr.has_key( decl.name ): - name2decls_nr[ decl.name ] = [] - name2decls_nr[ decl.name ].append( decl ) - - map( lambda decl: decl.init_optimizer() - , filter( lambda decl: isinstance( decl, scopedef_t ) - , self._all_decls_not_recursive ) ) - if self.name == '::': - self._logger.debug( "preparing data structures for query optimizer - done( %f seconds ). " - % ( time.clock() - start_time ) ) - self._optimized = True - - def _build_operator_function( self, name, function ): - if callable( name ): - return name - else: - return function - - def _build_operator_name( self, name, function, symbol ): - """implementation details""" - def add_operator( sym ): - if 'new' in sym or 'delete' in sym: - return 'operator ' + sym - else: - return 'operator'+ sym - if callable( name ) and None is function: - name = None - if name: - if not 'operator' in name: - name = add_operator( name ) - return name - elif symbol: - return add_operator( symbol ) - return name #both name and symbol are None - - def _on_rename( self ): - for decl in self.decls(allow_empty=True): - decl.cache.reset_name_based() - #I am not sure whether to introduce this or not? - #It could be very time consuming operation + it changes optimize query - #data structures. - #if self.parent: - # if self.parent._optimized: - # self.parent.init_optimizer() - - def __normalize_args( self, **keywds ): - """implementation details""" - if callable( keywds['name'] ) and None is keywds['function']: - keywds['function'] = keywds['name'] - keywds['name'] = None - return keywds - - def __findout_recursive( self, **keywds ): - """implementation details""" - if None is keywds[ 'recursive' ]: - return self.RECURSIVE_DEFAULT - else: - return keywds[ 'recursive' ] - - def __findout_allow_empty( self, **keywds ): - """implementation details""" - if None is keywds[ 'allow_empty' ]: - return self.ALLOW_EMPTY_MDECL_WRAPPER - else: - return keywds[ 'allow_empty' ] - - def __findout_decl_type( self, match_class, **keywds ): - """implementation details""" - if keywds.has_key( 'decl_type' ): - return keywds['decl_type'] - - matcher_args = keywds.copy() - del matcher_args['function'] - del matcher_args['recursive'] - if matcher_args.has_key('allow_empty'): - del matcher_args['allow_empty'] - - matcher = match_class( **matcher_args ) - if matcher.decl_type: - return matcher.decl_type - return None - - def __create_matcher( self, match_class, **keywds ): - """implementation details""" - matcher_args = keywds.copy() - del matcher_args['function'] - del matcher_args['recursive'] - if matcher_args.has_key('allow_empty'): - del matcher_args['allow_empty'] - - matcher = match_class( **matcher_args ) - if keywds['function']: - self._logger.debug( 'running query: %s and ' % str( matcher ) ) - return lambda decl: matcher( decl ) and keywds['function'](decl) - else: - self._logger.debug( 'running query: %s' % str( matcher ) ) - return matcher - - def __findout_range( self, name, decl_type, recursive ): - """implementation details""" - if not self._optimized: - self._logger.debug( 'running non optimized query - optimization has not been done' ) - decls = self.declarations - if recursive: - decls = algorithm.make_flatten( self.declarations ) - if decl_type: - decls = filter( lambda d: isinstance( d, decl_type ), decls ) - return decls - - if name and templates.is_instantiation( name ): - #templates has tricky mode to compare them, so lets check the whole - #range - name = None - - if name and decl_type: - matcher = scopedef_t._impl_matchers[ scopedef_t.decl ]( name=name ) - if matcher.is_full_name(): - name = matcher.decl_name_only - if recursive: - self._logger.debug( 'query has been optimized on type and name' ) - if self._type2name2decls[decl_type].has_key( name ): - return self._type2name2decls[decl_type][name] - else: - return [] - else: - self._logger.debug( 'non recursive query has been optimized on type and name' ) - if self._type2name2decls_nr[decl_type].has_key( name ): - return self._type2name2decls_nr[decl_type][name] - else: - return [] - elif decl_type: - if recursive: - self._logger.debug( 'query has been optimized on type' ) - return self._type2decls[ decl_type ] - else: - self._logger.debug( 'non recursive query has been optimized on type' ) - return self._type2decls_nr[ decl_type ] - else: - if recursive: - self._logger.debug( 'query has not been optimized ( hint: query does not contain type and/or name )' ) - return self._all_decls - else: - self._logger.debug( 'non recursive query has not been optimized ( hint: query does not contain type and/or name )' ) - return self._all_decls_not_recursive - - def _find_single( self, match_class, **keywds ): - """implementation details""" - self._logger.debug( 'find single query execution - started' ) - start_time = time.clock() - norm_keywds = self.__normalize_args( **keywds ) - matcher = self.__create_matcher( match_class, **norm_keywds ) - dtype = self.__findout_decl_type( match_class, **norm_keywds ) - recursive_ = self.__findout_recursive( **norm_keywds ) - decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) - found = matcher_module.matcher.get_single( matcher, decls, False ) - self._logger.debug( 'find single query execution - done( %f seconds )' % ( time.clock() - start_time ) ) - return found - - def _find_multiple( self, match_class, **keywds ): - """implementation details""" - self._logger.debug( 'find all query execution - started' ) - start_time = time.clock() - norm_keywds = self.__normalize_args( **keywds ) - matcher = self.__create_matcher( match_class, **norm_keywds ) - dtype = self.__findout_decl_type( match_class, **norm_keywds ) - recursive_ = self.__findout_recursive( **norm_keywds ) - allow_empty = self.__findout_allow_empty( **norm_keywds ) - decls = self.__findout_range( norm_keywds['name'], dtype, recursive_ ) - found = matcher_module.matcher.find( matcher, decls, False ) - mfound = mdecl_wrapper.mdecl_wrapper_t( found ) - self._logger.debug( '%d declaration(s) that match query' % len(mfound) ) - self._logger.debug( 'find single query execution - done( %f seconds )' - % ( time.clock() - start_time ) ) - if not mfound and not allow_empty: - raise RuntimeError( "Multi declaration query returned 0 declarations." ) - return mfound - - def decl( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.decl ] - , name=name - , function=function - , decl_type=decl_type - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def decls( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.decl ] - , name=name - , function=function - , decl_type=decl_type - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def class_( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to class declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.class_ ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.class_ ] - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def classes( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of class declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.class_ ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.class_ ] - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def variable( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to variable declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.variable ] - , name=name - , function=function - , type=type - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - var = variable #small alias - - def variables( self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of variable declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.variable ] - , name=name - , function=function - , type=type - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - vars = variables #small alias - - def calldef( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to "calldef" declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.calldef ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.calldef ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def calldefs( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of calldef declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.calldef ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.calldef ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to operator declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.operator ] - , name=self._build_operator_name( name, function, symbol ) - , symbol=symbol - , function=self._build_operator_function( name, function ) - , decl_type=self._impl_decl_types[ scopedef_t.operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of operator declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.operator ] - , name=self._build_operator_name( name, function, symbol ) - , symbol=symbol - , function=self._build_operator_function( name, function ) - , decl_type=self._impl_decl_types[ scopedef_t.operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def member_function( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to member declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.member_function ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.member_function ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - mem_fun = member_function - - def member_functions( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of member function declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.member_function ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.member_function ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - mem_funs = member_functions - - def constructor( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to constructor declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.constructor ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.constructor ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def constructors( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of constructor declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.constructor ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.constructor ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def member_operator( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to member operator declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.member_operator ] - , name=self._build_operator_name( name, function, symbol ) - , symbol=symbol - , function=self._build_operator_function( name, function ) - , decl_type=self._impl_decl_types[ scopedef_t.member_operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - mem_oper = member_operator - def member_operators( self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of member operator declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.member_operator ] - , name=self._build_operator_name( name, function, symbol ) - , symbol=symbol - , function=self._build_operator_function( name, function ) - , decl_type=self._impl_decl_types[ scopedef_t.member_operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - mem_opers = member_operators - - def casting_operator( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to casting operator declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.casting_operator ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.casting_operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive ) - - def casting_operators( self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of casting operator declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.casting_operator ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.casting_operator ] - , return_type=return_type - , arg_types=arg_types - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def enumeration( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to enumeration declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.enumeration ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.enumeration ] - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - enum = enumeration - """adding small aliase to enumeration method""" - - def enumerations( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of enumeration declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.enumeration ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.enumeration ] - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - #adding small aliase - enums = enumerations - - def typedef( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ): - """returns reference to typedef declaration, that is matched defined criterias""" - return self._find_single( self._impl_matchers[ scopedef_t.typedef ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.typedef ] - , header_dir=header_dir - , header_file=header_file - , recursive=recursive) - - def typedefs( self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None ): - """returns a set of typedef declarations, that are matched defined criterias""" - return self._find_multiple( self._impl_matchers[ scopedef_t.typedef ] - , name=name - , function=function - , decl_type=self._impl_decl_types[ scopedef_t.typedef ] - , header_dir=header_dir - , header_file=header_file - , recursive=recursive - , allow_empty=allow_empty) - - def __getitem__(self, name_or_function): - """ Allow simple name based find of decls. Internally just calls decls() method. - @param name_or_function Name of decl to lookup or finder function. - """ - return self.decls(name_or_function) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/templates.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/templates.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/templates.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/templates.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -template instantiation parser - -This module implements all functionality necessary to parse C++ template -instantiations.In other words this module is able to extract next information from -the string like this C{ std::vector }. - - name ( std::vector ) - - list of arguments ( int ) - -This module also defines few convenience function like L{split} and L{join}. -""" - -import pattern_parser - -__THE_PARSER = pattern_parser.parser_t( '<', '>', ',' ) - -def is_instantiation( decl_string ): - """ - returns True if decl_string is template instantiation and False otherwise - - @param decl_string: string that should be checked for pattern presence - @type decl_string: str - - @return: bool - """ - global __THE_PARSER - return __THE_PARSER.has_pattern( decl_string ) - -def name( decl_string ): - """ - returns name of instantiated template - - @type decl_string: str - @return: str - """ - global __THE_PARSER - return __THE_PARSER.name( decl_string ) - -def args( decl_string ): - """ - returns list of template arguments - - @type decl_string: str - @return: [str] - """ - global __THE_PARSER - return __THE_PARSER.args( decl_string ) - -def split( decl_string ): - """returns (name, [arguments] )""" - global __THE_PARSER - return __THE_PARSER.split( decl_string ) - -def split_recursive( decl_string ): - """returns [(name, [arguments])]""" - global __THE_PARSER - return __THE_PARSER.split_recursive( decl_string ) - -def join( name, args ): - """returns name< argument_1, argument_2, ..., argument_n >""" - global __THE_PARSER - return __THE_PARSER.join( name, args ) - -def normalize( decl_string ): - """returns decl_string, which contains "normalized" spaces - - this functionality allows to implement comparison of 2 different string - which are actually same: x::y< z > and x::y - """ - global __THE_PARSER - return __THE_PARSER.normalize( decl_string ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/typedef.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/typedef.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/typedef.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/typedef.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines class that describes C++ typedef declaration -""" - -import declaration -import dependencies - -class typedef_t( declaration.declaration_t ): - """describes C++ typedef declaration""" - - def __init__( self, name='', type=None ): - """creates class that describes C++ typedef""" - declaration.declaration_t.__init__( self, name ) - self._type = type - - def _get__cmp__items( self ): - """implementation details""" - return [self.type] - - def __eq__(self, other): - if not declaration.declaration_t.__eq__( self, other ): - return False - return self.type == other.type - - def _get_type(self): - return self._type - def _set_type(self, type): - self._type = type - type = property( _get_type, _set_type - , doc="reference to the original L{type}" ) - - def i_depend_on_them( self, recursive=True ): - return [ dependencies.dependency_info_t( self, self.type ) ] - - @property - def byte_size (self): - "Size of this type in bytes @type: int" - return self._type.byte_size - - @property - def byte_align (self): - "alignment of this type in bytes @type: int" - return self._type.byte_align diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_traits.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_traits.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_traits.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_traits.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1093 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines few algorithms, that deals with different properties of C++ types - -Do you aware of boost::type_traits library? pygccxml has functionality similar to -it. Using functions defined in this module you can - - find out some properties of the type - - modify type - -Those functions are very valuable for code generation. Almost all functions -within this module works on L{type_t} class hierarchy and\\or L{class_t}. -""" - -import os -import types -import matchers -import typedef -import calldef -import cpptypes -import variable -import algorithm -import namespace -import templates -import enumeration -import class_declaration -from pygccxml import utils -import types as build_in_types - -def __remove_alias(type_): - """implementation details""" - if isinstance( type_, typedef.typedef_t ): - return __remove_alias( type_.type ) - if isinstance( type_, cpptypes.declarated_t ) and isinstance( type_.declaration, typedef.typedef_t ): - return __remove_alias( type_.declaration.type ) - if isinstance( type_, cpptypes.compound_t ): - type_.base = __remove_alias( type_.base ) - return type_ - return type_ - -def remove_alias(type_): - """returns type without typedefs""" - type_ref = None - if isinstance( type_, cpptypes.type_t ): - type_ref = type_ - elif isinstance( type_, typedef.typedef_t ): - type_ref = type_.type - else: - pass #not a valid input, just return it - if not type_ref: - return type_ - if type_ref.cache.remove_alias: - return type_ref.cache.remove_alias - no_alias = __remove_alias( type_ref.clone() ) - type_ref.cache.remove_alias = no_alias - return no_alias - -def create_cv_types( base ): - """implementation details""" - return [ base - , cpptypes.const_t( base ) - , cpptypes.volatile_t( base ) - , cpptypes.volatile_t( cpptypes.const_t( base ) ) ] - -def decompose_type(tp): - """implementation details""" - #implementation of this function is important - if isinstance( tp, cpptypes.compound_t ): - return [tp] + decompose_type( tp.base ) - elif isinstance( tp, typedef.typedef_t ): - return decompose_type( tp.type ) - elif isinstance( tp, cpptypes.declarated_t ) and isinstance( tp.declaration, typedef.typedef_t ): - return decompose_type( tp.declaration.type ) - else: - return [tp] - -def decompose_class(type): - """implementation details""" - types = decompose_type( type ) - return [ tp.__class__ for tp in types ] - -def base_type(type): - """returns base type. - - For C{const int} will return C{int} - """ - types = decompose_type( type ) - return types[-1] - -def does_match_definition(given, main, secondary ): - """implementation details""" - assert isinstance( secondary, build_in_types.TupleType ) - assert 2 == len( secondary ) #general solution could be provided - types = decompose_type( given ) - if isinstance( types[0], main ): - return True - elif 2 <= len( types ) and \ - ( ( isinstance( types[0], main ) and isinstance( types[1], secondary ) ) \ - or ( isinstance( types[1], main ) and isinstance( types[0], secondary ) ) ): - return True - elif 3 <= len( types ): - classes = set( [tp.__class__ for tp in types[:3]] ) - desired = set( [main] + list( secondary ) ) - return classes == desired - else: - return False - -def is_bool( type_ ): - """returns True, if type represents C{bool}, False otherwise""" - return remove_alias( type_ ) in create_cv_types( cpptypes.bool_t() ) - -def is_void( type ): - """returns True, if type represents C{void}, False otherwise""" - return remove_alias( type ) in create_cv_types( cpptypes.void_t() ) - -def is_void_pointer( type ): - """returns True, if type represents C{void*}, False otherwise""" - return is_same( type, cpptypes.pointer_t( cpptypes.void_t() ) ) - -def is_integral( type ): - """returns True, if type represents C++ integral type, False otherwise""" - integral_def = create_cv_types( cpptypes.char_t() ) \ - + create_cv_types( cpptypes.unsigned_char_t() ) \ - + create_cv_types( cpptypes.signed_char_t() ) \ - + create_cv_types( cpptypes.wchar_t() ) \ - + create_cv_types( cpptypes.short_int_t() ) \ - + create_cv_types( cpptypes.short_unsigned_int_t() ) \ - + create_cv_types( cpptypes.bool_t() ) \ - + create_cv_types( cpptypes.int_t() ) \ - + create_cv_types( cpptypes.unsigned_int_t() ) \ - + create_cv_types( cpptypes.long_int_t() ) \ - + create_cv_types( cpptypes.long_unsigned_int_t() ) \ - + create_cv_types( cpptypes.long_long_int_t() ) \ - + create_cv_types( cpptypes.long_long_unsigned_int_t() ) - - return remove_alias( type ) in integral_def - -def is_floating_point( type ): - """returns True, if type represents C++ floating point type, False otherwise""" - float_def = create_cv_types( cpptypes.float_t() ) \ - + create_cv_types( cpptypes.double_t() ) \ - + create_cv_types( cpptypes.long_double_t() ) - - return remove_alias( type ) in float_def - -def is_arithmetic( type ): - """returns True, if type represents C++ integral or floating point type, False otherwise""" - return is_integral( type ) or is_floating_point( type ) - -def is_pointer(type): - """returns True, if type represents C++ pointer type, False otherwise""" - return does_match_definition( type - , cpptypes.pointer_t - , (cpptypes.const_t, cpptypes.volatile_t) ) - -def is_calldef_pointer(type): - """returns True, if type represents pointer to free/member function, False otherwise""" - if not is_pointer(type): - return False - nake_type = remove_alias( type ) - nake_type = remove_const( nake_type ) - nake_type = remove_volatile( nake_type ) - return isinstance( nake_type, cpptypes.compound_t ) \ - and isinstance( nake_type.base, cpptypes.calldef_type_t ) - -def remove_pointer(type): - """removes pointer from the type definition - - If type is not pointer type, it will be returned as is. - """ - nake_type = remove_alias( type ) - if not is_pointer( nake_type ): - return type - elif isinstance( nake_type, cpptypes.volatile_t ) and isinstance( nake_type.base, cpptypes.pointer_t ): - return cpptypes.volatile_t( nake_type.base.base ) - elif isinstance( nake_type, cpptypes.const_t ) and isinstance( nake_type.base, cpptypes.pointer_t ): - return cpptypes.const_t( nake_type.base.base ) - elif isinstance( nake_type.base, cpptypes.calldef_type_t ): - return type - else: - return nake_type.base - -def is_reference(type): - """returns True, if type represents C++ reference type, False otherwise""" - nake_type = remove_alias( type ) - return isinstance( nake_type, cpptypes.reference_t ) - -def is_array(type): - """returns True, if type represents C++ array type, False otherwise""" - nake_type = remove_alias( type ) - nake_type = remove_reference( nake_type ) - nake_type = remove_cv( nake_type ) - return isinstance( nake_type, cpptypes.array_t ) - -def array_size(type): - """returns array size""" - nake_type = remove_alias( type ) - nake_type = remove_reference( nake_type ) - nake_type = remove_cv( nake_type ) - assert isinstance( nake_type, cpptypes.array_t ) - return nake_type.size - -def array_item_type(type_): - """returns array item type""" - if is_array(type_): - type_ = remove_alias( type_ ) - type_ = remove_cv( type_ ) - return type_.base - elif is_pointer( type_ ): - return remove_pointer( type_ ) - else: - assert 0 - -def remove_reference(type): - """removes reference from the type definition - - If type is not reference type, it will be returned as is. - """ - nake_type = remove_alias( type ) - if not is_reference( nake_type ): - return type - else: - return nake_type.base - -def is_const(type): - """returns True, if type represents C++ const type, False otherwise""" - nake_type = remove_alias( type ) - return isinstance( nake_type, cpptypes.const_t ) - -def remove_const(type): - """removes const from the type definition - - If type is not const type, it will be returned as is - """ - - nake_type = remove_alias( type ) - if not is_const( nake_type ): - return type - else: - return nake_type.base - -def remove_declarated( type ): - """removes type-declaration class-binder L{declarated_t} from the type - - If type is not L{declarated_t}, it will be returned as is - """ - type = remove_alias( type ) - if isinstance( type, cpptypes.declarated_t ): - type = type.declaration - return type - -def is_same(type1, type2): - """returns True, if type1 and type2 are same types""" - nake_type1 = remove_declarated( type1 ) - nake_type2 = remove_declarated( type2 ) - return nake_type1 == nake_type2 - -def is_volatile(type): - """returns True, if type represents C++ volatile type, False otherwise""" - nake_type = remove_alias( type ) - return isinstance( nake_type, cpptypes.volatile_t ) - -def remove_volatile(type): - """removes volatile from the type definition - - If type is not volatile type, it will be returned as is - """ - nake_type = remove_alias( type ) - if not is_volatile( nake_type ): - return type - else: - return nake_type.base - -def remove_cv(type): - """removes const and volatile from the type definition""" - - nake_type = remove_alias(type) - if not is_const( nake_type ) and not is_volatile( nake_type ): - return type - result = nake_type - if is_const( nake_type ): - result = nake_type.base - if is_volatile( result ): - result = result.base - return result - -def is_fundamental(type): - """returns True, if type represents C++ fundamental type""" - return does_match_definition( type - , cpptypes.fundamental_t - , (cpptypes.const_t, cpptypes.volatile_t) ) - -class declaration_xxx_traits: - """this class implements the functionality needed for convinient work with - declaration classes - - Implemented functionality: - - find out whether a declaration is a desired one - - get reference to the declaration - """ - sequence = [ remove_alias, remove_cv, remove_declarated ] - def __init__( self, declaration_class ): - self.declaration_class = declaration_class - - def __apply_sequence( self, type ): - for f in self.sequence: - type = f( type ) - return type - - def is_my_case( self, type ): - """returns True, if type represents the desired declaration, False otherwise""" - return isinstance( self.__apply_sequence( type ), self.declaration_class ) - - def get_declaration( self, type ): - """returns reference to the declaration - - Precondition: self.is_my_case( type ) == True - """ - assert self.is_my_case( type ) - return self.__apply_sequence( type ) - -enum_traits = declaration_xxx_traits( enumeration.enumeration_t ) -"""implements functionality, needed for convinient work with C++ enums""" - -is_enum = enum_traits.is_my_case -"""returns True, if type represents C++ enumeration declaration, False otherwise""" - -enum_declaration = enum_traits.get_declaration -"""returns reference to enum declaration""" - -class_traits = declaration_xxx_traits( class_declaration.class_t ) -"""implements functionality, needed for convinient work with C++ classes""" - -is_class = class_traits.is_my_case -"""returns True, if type represents C++ class definition, False otherwise""" - -class_declaration_traits = declaration_xxx_traits( class_declaration.class_declaration_t ) -"""implements functionality, needed for convinient work with C++ class declarations""" - -is_class_declaration = class_declaration_traits.is_my_case -"""returns True, if type represents C++ class declaration, False otherwise""" - -def find_trivial_constructor( type ): - """returns reference to trivial constructor or None""" - assert isinstance( type, class_declaration.class_t ) - return type.find_trivial_constructor() - -def has_trivial_constructor( class_ ): - """if class has public trivial constructor, this function will return reference to it, None otherwise""" - class_ = class_traits.get_declaration( class_ ) - trivial = class_.find_trivial_constructor() - if trivial and trivial.access_type == 'public': - return trivial - -def has_copy_constructor( class_ ): - """if class has public copy constructor, this function will return reference to it, None otherwise""" - class_ = class_traits.get_declaration( class_ ) - copy_constructor = class_.find_copy_constructor() - if copy_constructor and copy_constructor.access_type == 'public': - return copy_constructor - -def has_destructor(class_): - """if class has destructor, this function will return reference to it, None otherwise""" - class_ = class_traits.get_declaration( class_ ) - destructor = class_.decls( decl_type=calldef.destructor_t, recursive=False, allow_empty=True ) - if destructor: - return destructor[0] - -def has_public_constructor(class_): - """if class has any public constructor, this function will return list of them, otherwise None""" - class_ = class_traits.get_declaration(class_) - decls = class_.constructors( lambda c: not c.is_copy_constructor and c.access_type == 'public' - , recursive=False, allow_empty=True ) - if decls: - return decls - -def has_public_assign(class_): - """returns True, if class has public assign operator, False otherwise""" - class_ = class_traits.get_declaration( class_ ) - decls = class_.mem_opers( lambda o: o.symbol == '=' and o.access_type == 'public' - , recursive=False, allow_empty=True ) - return bool( decls ) - -def has_public_destructor(type): - """returns True, if class has public destructor, False otherwise""" - d = has_destructor( type ) - return d and d.access_type == 'public' - -def is_base_and_derived( based, derived ): - """returns True, if there is "base and derived" relationship between classes, False otherwise""" - assert isinstance( based, class_declaration.class_t ) - assert isinstance( derived, ( class_declaration.class_t, tuple ) ) - - all_derived = None - if isinstance( derived, class_declaration.class_t ): - all_derived = ( [derived] ) - else: #tuple - all_derived = derived - - for derived_cls in all_derived: - for base_desc in derived_cls.recursive_bases: - if base_desc.related_class == based: - return True - return False - -def has_any_non_copyconstructor( type): - """if class has any public constructor, which is not copy constructor, this function will return list of them, otherwise None""" - class_ = class_traits.get_declaration( type ) - decls = class_.constructors( lambda c: not c.is_copy_constructor and c.access_type == 'public' - , recursive=False, allow_empty=True ) - if decls: - return decls - -def has_public_binary_operator( type, operator_symbol ): - """returns True, if type has public binary operator, otherwise False""" - not_artificial = lambda decl: decl.is_artificial == False - type = remove_alias( type ) - type = remove_cv( type ) - type = remove_declarated( type ) - assert isinstance( type, class_declaration.class_t ) - - if is_std_string( type ) or is_std_wstring( type ): - #In some case compare operators of std::basic_string are not instantiated - return True - - operators = type.member_operators( function=matchers.custom_matcher_t( not_artificial ) \ - & matchers.access_type_matcher_t( 'public' ) - , symbol=operator_symbol - , allow_empty=True - , recursive=False ) - if operators: - return True - - t = cpptypes.declarated_t( type ) - t = cpptypes.const_t( t ) - t = cpptypes.reference_t( t ) - operators = type.top_parent.operators( function=not_artificial - , arg_types=[t, None] - , symbol=operator_symbol - , allow_empty=True - , recursive=True ) - if operators: - return True - for bi in type.recursive_bases: - assert isinstance( bi, class_declaration.hierarchy_info_t ) - if bi.access_type != class_declaration.ACCESS_TYPES.PUBLIC: - continue - operators = bi.related_class.member_operators( function=matchers.custom_matcher_t( not_artificial ) \ - & matchers.access_type_matcher_t( 'public' ) - , symbol=operator_symbol - , allow_empty=True - , recursive=False ) - if operators: - return True - return False - -def has_public_equal( type ): - """returns True, if class has public operator==, otherwise False""" - return has_public_binary_operator( type, '==' ) - -def has_public_less( type ): - """returns True, if class has public operator<, otherwise False""" - return has_public_binary_operator( type, '<' ) - -def is_unary_operator( oper ): - """returns True, if operator is unary operator, otherwise False""" - #~ definition: - #~ memeber in class - #~ ret-type operator symbol() - #~ ret-type operator [++ --](int) - #~ globally - #~ ret-type operator symbol( arg ) - #~ ret-type operator [++ --](X&, int) - symbols = [ '!', '&', '~', '*', '+', '++', '-', '--' ] - if not isinstance( oper, calldef.operator_t ): - return False - if oper.symbol not in symbols: - return False - if isinstance( oper, calldef.member_operator_t ): - if 0 == len( oper.arguments ): - return True - elif oper.symbol in [ '++', '--' ] and isinstance( oper.arguments[0].type, cpptypes.int_t ): - return True - else: - return False - else: - if 1 == len( oper.arguments ): - return True - elif oper.symbol in [ '++', '--' ] \ - and 2 == len( oper.arguments ) \ - and isinstance( oper.arguments[1].type, cpptypes.int_t ): - #may be I need to add additional check whether first argument is reference or not? - return True - else: - return False - -def is_binary_operator( oper ): - """returns True, if operator is binary operator, otherwise False""" - #~ definition: - #~ memeber in class - #~ ret-type operator symbol(arg) - #~ globally - #~ ret-type operator symbol( arg1, arg2 ) - symbols = [ ',', '()', '[]', '!=', '%', '%=', '&', '&&', '&=', '*', '*=', '+', '+=' - , '-', '-=', '->', '->*', '/', '/=', '<', '<<', '<<=', '<=' - , '=', '==', '>', '>=', '>>', '>>=', '^', '^=', '|', '|=', '||' - ] - if not isinstance( oper, calldef.operator_t ): - return False - if oper.symbol not in symbols: - return False - if isinstance( oper, calldef.member_operator_t ): - if 1 == len( oper.arguments ): - return True - else: - return False - else: - if 2 == len( oper.arguments ): - return True - else: - return False - -class __is_convertible_t: - """implementation details""" - def __init__( self, source, target ): - self.__source = self.__normalize( source ) - self.__target = self.__normalize( target ) - - def __find_class_by_class_declaration( self, class_decl ): - found = algorithm.find_declaration( class_decl.parent.declarations - , name=class_decl.name - , type=class_declaration.class_t ) - return found - - def __normalize( self, type_ ): - type_ = remove_alias( type_ ) - bt_of_type = base_type( type_ ) - if isinstance( bt_of_type, cpptypes.declarated_t ) \ - and isinstance( bt_of_type.declaration, class_declaration.class_declaration_t ): - type_ = type_.clone() - bt_of_type = base_type( type_ ) - bt_of_type.declaration = self.__find_class_by_class_declaration( bt_of_type.declaration ) - return type_ - - def __test_trivial( self, source, target ): - if not ( source and target ): - return False - if is_same( source, target ): - return True #X => X - if is_const( target ) and is_same( source, target.base ): - return True #X => const X - if is_reference( target ) and is_same( source, target.base ): - return True #X => X& - if is_reference( target ) and is_const( target.base ) and is_same( source, target.base.base ): - return True #X => const X& - if is_same( target, cpptypes.pointer_t( cpptypes.void_t() ) ): - if is_integral( source ) or is_enum( source ): - return False - else: - return True #X => void* - if is_pointer( source ) and is_pointer( target ): - if is_const( target.base ) and is_same( source.base, target.base.base ): - return True#X* => const X* - if is_reference( source ) and is_reference( target ): - if is_const( target.base ) and is_same( source.base, target.base.base ): - return True#X& => const X& - if not is_const( source ) and is_array( source ) and is_pointer( target ): - if is_same( base_type(source), target.base ): - return True#X[2] => X* - if is_array( source ) and is_pointer( target ) and is_const( target.base ): - if is_same( base_type(source), target.base.base ): - return True - - def __test_pointer_to_func_or_mv__to__func_or_mv( self, source, target ): - if is_pointer( source ) \ - and is_reference( target ) \ - and isinstance( target.base - , ( cpptypes.free_function_type_t - , cpptypes.member_function_type_t - , cpptypes.member_variable_type_t ) ) \ - and is_same( source.base, target.base ): - return True - - if is_pointer( source ) \ - and isinstance( target - , ( cpptypes.free_function_type_t - , cpptypes.member_function_type_t - , cpptypes.member_variable_type_t ) ) \ - and is_same( source.base, target ): - return True - - if is_pointer( target ) \ - and is_reference( source ) \ - and isinstance( source.base - , ( cpptypes.free_function_type_t - , cpptypes.member_function_type_t - , cpptypes.member_variable_type_t ) ) \ - and is_same( source.base, target.base ): - return True - - if is_pointer( target ) \ - and isinstance( source - , ( cpptypes.free_function_type_t - , cpptypes.member_function_type_t - , cpptypes.member_variable_type_t ) ) \ - and is_same( target.base, source ): - return True - - - def __test_const_x_ref__to__x( self, source, target ): - if not is_reference( source ) \ - or not is_const( source.base ) \ - or not is_same( source.base.base, target ): - return False - if is_fundamental( target ): - return True - if is_enum( target ): - return True - if isinstance( target, cpptypes.declarated_t ): - assert isinstance( target.declaration, class_declaration.class_t ) - if has_copy_constructor( target.declaration ): - return True #we have copy constructor - return False - - def __test_const_ref_x__to__y(self, source, target): - if not is_reference( source ) or not is_const( source.base ): - return False - if is_fundamental( source.base.base ) and is_fundamental( target ): - return True - if is_convertible( source.base.base, cpptypes.int_t() ) and is_enum( target ): - return True - if isinstance( target, cpptypes.declarated_t ): - assert isinstance( target.declaration, class_declaration.class_t ) - if has_copy_constructor( target.declaration ): - return True #we have copy constructor - return False - - def __test_ref_x__to__x( self, source, target ): - if not is_reference( source ) or not is_same( source.base, target ): - return False - if is_fundamental( target ): - return True - if is_enum( target ): - return True - if isinstance( target, cpptypes.declarated_t ): - assert isinstance( target.declaration, class_declaration.class_t ) - if has_copy_constructor( target.declaration ): - return True #we have copy constructor - return False - - def __test_ref_x__to__y(self, source, target): - if not is_reference( source ): - return False - if is_fundamental( source.base ) and is_fundamental( target ): - return True - if is_convertible( source.base, cpptypes.int_t() ) and is_enum( target ): - return True - if isinstance( target, cpptypes.declarated_t ): - assert isinstance( target.declaration, class_declaration.class_t ) - if has_copy_constructor( target.declaration ): - return True #we have copy constructor - return False - - def __test_fundamental__to__fundamental(self, source, target): - if not is_fundamental( base_type( source ) ) or not is_fundamental( base_type( target ) ): - return False - if is_void( base_type( source ) ) or is_void( base_type( target ) ): - return False - if is_fundamental( source ) and is_fundamental( target ): - return True - if not is_pointer( source ) and is_fundamental( target ): - return True - if not is_pointer( source ) and is_const( target ) and is_fundamental( target.base ): - return True - if is_fundamental( source ) \ - and is_reference( target ) \ - and is_const( target.base ) \ - and is_fundamental( target.base.base ): - return True #X => const Y& - return False - - def __test_derived_to_based( self, source, target ): - derived = base_type( source ) - base = base_type( target ) - if not ( isinstance( derived, cpptypes.declarated_t ) \ - and isinstance( derived.declaration, class_declaration.class_t ) ): - return False - if not ( isinstance( base, cpptypes.declarated_t ) \ - and isinstance( base.declaration, class_declaration.class_t ) ): - return False - base = base.declaration - derived = derived.declaration - if not is_base_and_derived( base, derived ): - return False - for b in derived.recursive_bases: - if ( b.related_class is base ) and b.access_type != class_declaration.ACCESS_TYPES.PRIVATE: - break - else: - return False - - base = target - derived = source - is_both_declarated = lambda x, y: isinstance( x, cpptypes.declarated_t ) \ - and isinstance( y, cpptypes.declarated_t ) - #d => b - if is_both_declarated( base, derived ): - return True - #d* => b* - if is_pointer( derived ) and is_pointer( base ) \ - and is_both_declarated( base.base, derived.base ): - return True - #const d* => const b* - if is_pointer( derived ) and is_pointer( base ) \ - and is_const( derived.base ) and is_const( base.base ) \ - and is_both_declarated( base.base.base, derived.base.base ): - return True - #d* => const b* - if is_pointer( derived ) and is_pointer( base ) \ - and is_const( derived.base )\ - and is_both_declarated( base.base.base, derived.base ): - return True - - #d& => b& - if is_reference( derived ) and is_reference( base ) \ - and is_both_declarated( base.base, derived.base ): - return True - #const d& => const b& - if is_reference( derived ) and is_reference( base ) \ - and is_const( derived.base ) and is_const( base.base ) \ - and is_both_declarated( base.base.base, derived.base.base ): - return True - #d& => const b& - if is_reference( derived ) and is_reference( base ) \ - and is_const( derived.base )\ - and is_both_declarated( base.base.base, derived.base ): - return True - return False - - def is_convertible( self ): - source = self.__source - target = self.__target - - if self.__test_trivial(source, target): - return True - if is_array( source ) or is_array( target ): - return False - if self.__test_const_x_ref__to__x(source, target): - return True - if self.__test_const_ref_x__to__y(source, target): - return True - if self.__test_ref_x__to__x(source, target): - return True - if self.__test_ref_x__to__y(source, target): - return True - if self.__test_fundamental__to__fundamental( source, target ): - return True - if self.__test_pointer_to_func_or_mv__to__func_or_mv( source, target ): - return True - if self.__test_derived_to_based( source, target ): - return True - - if isinstance( source, cpptypes.declarated_t ): - if isinstance( source.declaration, enumeration.enumeration_t ) \ - and is_fundamental( target ) \ - and not is_void( target ): - return True # enum could be converted to any integral type - - if isinstance( source.declaration, class_declaration.class_t ): - source_inst = source.declaration - #class instance could be convertible to something else if it has operator - casting_operators = algorithm.find_all_declarations( source_inst.declarations - , type=calldef.casting_operator_t - , recursive=False ) - if casting_operators: - for operator in casting_operators: - if is_convertible( operator.return_type, target ): - return True - - #may be target is class too, so in this case we should check whether is - #has constructor from source - if isinstance( target, cpptypes.declarated_t ): - if isinstance( target.declaration, class_declaration.class_t ): - constructors = algorithm.find_all_declarations( target.declaration.declarations - , type=calldef.constructor_t - , recursive=False ) - if constructors: - for constructor in constructors: - if 1 != len( constructor.arguments ): - continue - #TODO: add test to check explicitness - if is_convertible( source, constructor.arguments[0].type ): - return True - - return False - -def is_convertible( source, target ): - """returns True, if source could be converted to target, otherwise False""" - return __is_convertible_t( source, target ).is_convertible() - -def __is_noncopyable_single( class_): - """implementation details""" - #It is not enough to check base classes, we should also to check - #member variables. - logger = utils.loggers.cxx_parser - - if has_copy_constructor( class_ ) \ - and has_public_constructor( class_ ) \ - and has_public_assign( class_ ) \ - and has_public_destructor( class_ ): - msg = os.linesep.join([ - "__is_noncopyable_single - %s - COPYABLE:" % class_.decl_string - , " trivial copy constructor: yes" - , " public constructor: yes" - , " public assign: yes" - , " public destructor: yes" - ]) - logger.debug( msg ) - return False - if class_.find_noncopyable_vars(): - logger.debug( "__is_noncopyable_single(TRUE) - %s - contains noncopyable members" % class_.decl_string ) - return True - else: - logger.debug( "__is_noncopyable_single(FALSE) - %s - COPYABLE, because is doesn't contains noncopyable members" % class_.decl_string ) - return False - -def is_noncopyable( class_ ): - """returns True, if class is noncopyable, False otherwise""" - logger = utils.loggers.cxx_parser - class_ = class_traits.get_declaration( class_ ) - - true_header = "is_noncopyable(TRUE) - %s - " % class_.decl_string - false_header = "is_noncopyable(false) - %s - " % class_.decl_string - - if class_.class_type == class_declaration.CLASS_TYPES.UNION: - return False - - if class_.is_abstract: - logger.debug( true_header + "abstract client" ) - return True - - #if class has public, user defined copy constructor, than this class is - #copyable - copy_ = class_.find_copy_constructor() - if copy_ and copy_.access_type == 'public' and not copy_.is_artificial: - return False - - for base_desc in class_.recursive_bases: - assert isinstance( base_desc, class_declaration.hierarchy_info_t ) - if base_desc.related_class.decl_string in ('::boost::noncopyable', '::boost::noncopyable_::noncopyable' ): - logger.debug( true_header + "derives from boost::noncopyable" ) - return True - if not has_copy_constructor( base_desc.related_class ): - base_copy_ = base_desc.related_class.find_copy_constructor() - if base_copy_: - if base_copy_.access_type == 'private': - logger.debug( true_header + "there is private copy constructor" ) - return True - else: - if __is_noncopyable_single( base_desc.related_class ): - logger.debug( true_header + "__is_noncopyable_single returned True" ) - return True - if __is_noncopyable_single( base_desc.related_class ): - logger.debug( true_header + "__is_noncopyable_single returned True" ) - return True - - if not has_copy_constructor( class_ ): - logger.debug( true_header + "does not have trival copy constructor" ) - return True - elif not has_public_constructor( class_ ): - logger.debug( true_header + "does not have a public constructor" ) - return True - elif has_destructor( class_ ) and not has_public_destructor( class_ ): - logger.debug( true_header + "has private destructor") - return True - else: - return __is_noncopyable_single( class_ ) - -def is_defined_in_xxx( xxx, cls ): - """small helper function, that checks whether class ( C{cls} ) is defined - under C{::xxx} namespace""" - if not cls.parent: - return False - - if not isinstance( cls.parent, namespace.namespace_t ): - return False - - if xxx != cls.parent.name: - return False - - xxx_ns = cls.parent - if not xxx_ns.parent: - return False - - if not isinstance( xxx_ns.parent, namespace.namespace_t ): - return False - - if '::' != xxx_ns.parent.name: - return False - - global_ns = xxx_ns.parent - return None is global_ns.parent - -class impl_details: - """implementation details""" - @staticmethod - def is_defined_in_xxx( xxx, cls ): - """implementation details""" - if not cls.parent: - return False - - if not isinstance( cls.parent, namespace.namespace_t ): - return False - - if xxx != cls.parent.name: - return False - - xxx_ns = cls.parent - if not xxx_ns.parent: - return False - - if not isinstance( xxx_ns.parent, namespace.namespace_t ): - return False - - if '::' != xxx_ns.parent.name: - return False - - global_ns = xxx_ns.parent - return None is global_ns.parent - - @staticmethod - def find_value_type( global_ns, value_type_str ): - """implementation details""" - if not value_type_str.startswith( '::' ): - value_type_str = '::' + value_type_str - found = global_ns.decls( name=value_type_str - , function=lambda decl: not isinstance( decl, calldef.calldef_t ) - , allow_empty=True ) - if not found: - no_global_ns_value_type_str = value_type_str[2:] - if cpptypes.FUNDAMENTAL_TYPES.has_key( no_global_ns_value_type_str ): - return cpptypes.FUNDAMENTAL_TYPES[ no_global_ns_value_type_str ] - elif is_std_string( value_type_str ): - string_ = global_ns.typedef( '::std::string' ) - return remove_declarated( string_ ) - elif is_std_wstring( value_type_str ): - string_ = global_ns.typedef( '::std::wstring' ) - return remove_declarated( string_ ) - else: - value_type_str = no_global_ns_value_type_str - has_const = value_type_str.startswith( 'const ' ) - if has_const: - value_type_str = value_type_str[ len('const '): ] - has_pointer = value_type_str.endswith( '*' ) - if has_pointer: - value_type_str = value_type_str[:-1] - found = None - if has_const or has_pointer: - found = impl_details.find_value_type( global_ns, value_type_str ) - if not found: - return None - else: - if isinstance( found, class_declaration.class_types ): - found = cpptypes.declarated_t( found ) - if has_const: - found = cpptypes.const_t( found ) - if has_pointer: - found = cpptypes.pointer_t( found ) - return found - if len( found ) == 1: - return found[0] - else: - return None - -class smart_pointer_traits: - """implements functionality, needed for convinient work with smart pointers""" - - @staticmethod - def is_smart_pointer( type ): - """returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise""" - type = remove_alias( type ) - type = remove_cv( type ) - type = remove_declarated( type ) - if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): - return False - if not impl_details.is_defined_in_xxx( 'boost', type ): - return False - return type.decl_string.startswith( '::boost::shared_ptr<' ) - - @staticmethod - def value_type( type ): - """returns reference to boost::shared_ptr value type""" - if not smart_pointer_traits.is_smart_pointer( type ): - raise TypeError( 'Type "%s" is not instantiation of boost::shared_ptr' % type.decl_string ) - type = remove_alias( type ) - cls = remove_cv( type ) - cls = remove_declarated( type ) - if isinstance( cls, class_declaration.class_t ): - return remove_declarated( cls.typedef( "value_type", recursive=False ).type ) - elif not isinstance( cls, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): - raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) - else: - value_type_str = templates.args( cls.name )[0] - ref = impl_details.find_value_type( cls.top_parent, value_type_str ) - if None is ref: - raise RuntimeError( "Unable to find out shared_ptr value type. shared_ptr class is: %s" % cls.decl_string ) - return ref - -class auto_ptr_traits: - """implements functionality, needed for convinient work with std::auto_ptr pointers""" - - @staticmethod - def is_smart_pointer( type ): - """returns True, if type represents instantiation of C{boost::shared_ptr}, False otherwise""" - type = remove_alias( type ) - type = remove_cv( type ) - type = remove_declarated( type ) - if not isinstance( type, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): - return False - if not impl_details.is_defined_in_xxx( 'std', type ): - return False - return type.decl_string.startswith( '::std::auto_ptr<' ) - - @staticmethod - def value_type( type ): - """returns reference to boost::shared_ptr value type""" - if not auto_ptr_traits.is_smart_pointer( type ): - raise TypeError( 'Type "%s" is not instantiation of std::auto_ptr' % type.decl_string ) - type = remove_alias( type ) - cls = remove_cv( type ) - cls = remove_declarated( type ) - if isinstance( cls, class_declaration.class_t ): - return remove_declarated( cls.typedef( "element_type", recursive=False ).type ) - elif not isinstance( cls, ( class_declaration.class_declaration_t, class_declaration.class_t ) ): - raise RuntimeError( "Unable to find out auto_ptr value type. auto_ptr class is: %s" % cls.decl_string ) - else: - value_type_str = templates.args( cls.name )[0] - ref = impl_details.find_value_type( cls.top_parent, value_type_str ) - if None is ref: - raise RuntimeError( "Unable to find out auto_ptr value type. shared_ptr class is: %s" % cls.decl_string ) - return ref - - -def is_std_string( type ): - """returns True, if type represents C++ std::string, False otherwise""" - decl_strings = [ - '::std::basic_string,std::allocator >' - , '::std::basic_string, std::allocator >' - , '::std::string' ] - if isinstance( type, types.StringTypes ): - return type in decl_strings - else: - type = remove_alias( type ) - return remove_cv( type ).decl_string in decl_strings - -def is_std_wstring( type ): - """returns True, if type represents C++ std::wstring, False otherwise""" - decl_strings = [ - '::std::basic_string,std::allocator >' - , '::std::basic_string, std::allocator >' - , '::std::wstring' ] - if isinstance( type, types.StringTypes ): - return type in decl_strings - else: - type = remove_alias( type ) - return remove_cv( type ).decl_string in decl_strings - -def is_std_ostream( type ): - """returns True, if type represents C++ std::string, False otherwise""" - decl_strings = [ - '::std::basic_ostream >' - , '::std::basic_ostream >' - , '::std::ostream' ] - if isinstance( type, types.StringTypes ): - return type in decl_strings - else: - type = remove_alias( type ) - return remove_cv( type ).decl_string in decl_strings - - -def is_std_wostream( type ): - """returns True, if type represents C++ std::string, False otherwise""" - decl_strings = [ - '::std::basic_ostream >' - , '::std::basic_ostream >' - , '::std::wostream' ] - if isinstance( type, types.StringTypes ): - return type in decl_strings - else: - type = remove_alias( type ) - return remove_cv( type ).decl_string in decl_strings diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_visitor.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_visitor.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_visitor.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/type_visitor.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines types visitor class interface -""" - -class type_visitor_t(object): - """ - types visitor interface - - All functions within this class should be redefined in derived classes. - """ - def __init__(self): - object.__init__(self) - - def visit_void( self ): - raise NotImplementedError() - - def visit_char( self ): - raise NotImplementedError() - - def visit_unsigned_char( self ): - raise NotImplementedError() - - def visit_signed_char( self ): - raise NotImplementedError() - - def visit_wchar( self ): - raise NotImplementedError() - - def visit_short_int( self ): - raise NotImplementedError() - - def visit_short_unsigned_int( self ): - raise NotImplementedError() - - def visit_bool( self ): - raise NotImplementedError() - - def visit_int( self ): - raise NotImplementedError() - - def visit_unsigned_int( self ): - raise NotImplementedError() - - def visit_long_int( self ): - raise NotImplementedError() - - def visit_long_unsigned_int( self ): - raise NotImplementedError() - - def visit_long_long_int( self ): - raise NotImplementedError() - - def visit_long_long_unsigned_int( self ): - raise NotImplementedError() - - def visit_float( self ): - raise NotImplementedError() - - def visit_double( self ): - raise NotImplementedError() - - def visit_long_double( self ): - raise NotImplementedError() - - def visit_complex_long_double(self): - raise NotImplementedError() - - def visit_complex_double(self): - raise NotImplementedError() - - def visit_complex_float(self): - raise NotImplementedError() - - def visit_jbyte(self): - raise NotImplementedError() - - def visit_jshort(self): - raise NotImplementedError() - - def visit_jint(self): - raise NotImplementedError() - - def visit_jlong(self): - raise NotImplementedError() - - def visit_jfloat(self): - raise NotImplementedError() - - def visit_jdouble(self): - raise NotImplementedError() - - def visit_jchar(self): - raise NotImplementedError() - - def visit_jboolean(self): - raise NotImplementedError() - - def visit_volatile( self ): - raise NotImplementedError() - - def visit_const( self ): - raise NotImplementedError() - - def visit_pointer( self ): - raise NotImplementedError() - - def visit_reference( self ): - raise NotImplementedError() - - def visit_array( self ): - raise NotImplementedError() - - def visit_free_function_type( self ): - raise NotImplementedError() - - def visit_member_function_type( self ): - raise NotImplementedError() - - def visit_member_variable_type( self ): - raise NotImplementedError() - - def visit_declarated( self ): - raise NotImplementedError() - - def visit_restrict( self ): - raise NotImplementedError() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/variable.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/variable.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/variable.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/declarations/variable.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines class that describes C++ global and member variable declaration -""" - -import declaration -import dependencies -import class_declaration - -class variable_t( declaration.declaration_t ): - """describes C++ global and member variable declaration""" - - def __init__( self, name='', type=None, type_qualifiers=None, value=None, bits=None): - """creates class that describes C++ global or member variable""" - declaration.declaration_t.__init__( self, name ) - self._type = type - self._type_qualifiers = type_qualifiers - self._value = value - self._bits = bits - self._byte_offset = 0 - - def _get__cmp__items( self ): - """implementation details""" - return [ self.type, self.type_qualifiers, self.value ] - - def __eq__(self, other): - """implementation details""" - if not declaration.declaration_t.__eq__( self, other ): - return False - return self.type == other.type \ - and self.type_qualifiers == other.type_qualifiers \ - and self.value == other.value \ - and self.bits == other.bits - - def _get_type(self): - return self._type - def _set_type(self, type): - self._type = type - type = property( _get_type, _set_type - , doc="reference to the variable L{type}" ) - - def _get_type_qualifiers(self): - return self._type_qualifiers - def _set_type_qualifiers(self, type_qualifiers): - self._type_qualifiers = type_qualifiers - type_qualifiers = property( _get_type_qualifiers, _set_type_qualifiers - , doc="reference to the L{type_qualifiers_t} instance" ) - - def _get_value(self): - return self._value - def _set_value(self, value): - self._value = value - value = property( _get_value, _set_value - , doc="string, that contains the variable value" ) - - def _get_bits(self): - return self._bits - def _set_bits(self, bits): - self._bits = bits - bits = property( _get_bits, _set_bits - , doc="integer, that contains information about how many bit takes bit field") - - def _get_byte_offset(self): - return self._byte_offset - def _set_byte_offset(self, byte_offset): - self._byte_offset = byte_offset - byte_offset = property( _get_byte_offset, _set_byte_offset - , doc="integer, offset of the field from the beginning of class.") - - - @property - def access_type(self): - if not isinstance( self.parent, class_declaration.class_t ): - raise RuntimeError( "access_type functionality only available on member variables and not on global variables" ) - return self.parent.find_out_member_access_type( self ) - - def i_depend_on_them( self, recursive=True ): - return [ dependencies.dependency_info_t( self, self.type ) ] diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/__init__.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/__init__.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/__init__.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""Python GCC-XML front end. - -This package provides functionality to extract and inspect -declarations from C/C++ header files. This is accomplished -by invoking the external tool U{gccxml} -which parses a header file and dumps the declarations as a -XML file. This XML file is then read by pygccxml and the contents -are made available as appropriate Python objects. - -To parse a set of C/C++ header files you use the -L{parse()} function in the L{parser} sub package which -returns a tree that contains all declarations found in the header -files. The root of the tree represents the main namespace C{::} and -the children nodes represent the namespace contents such as other -namespaces, classes, functions, etc. Each node in the tree is an -object of a type derived from the -L{declaration_t} base class. An inner -node is always either a namespace (L{namespace_t}) -or a class (L{class_t}) which are both derived -from L{scopedef_t}. Everything else (free functions, -member functions, enumerations, variables, etc.) is always a leaf. -You will find all those declaration classes in the L{declarations} -sub-package. - -""" - -import pygccxml.declarations as declarations -import pygccxml.parser as parser -import pygccxml.utils as utils - -#TODO: -# 1. Write documentation for filtering functionality. -# 2. Add "explicit" property for constructors - -__version__ = '1.0.0' - -__revision__ = 1080 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/c_wrapper.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/c_wrapper.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/c_wrapper.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/c_wrapper.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,284 +0,0 @@ -import os -import sys -import ctypes -import logging - -from ctypes import * -from ctypes.wintypes import ULONG -from ctypes.wintypes import DWORD -from ctypes.wintypes import BOOL -from ctypes.wintypes import BYTE -from ctypes.wintypes import WORD -from ctypes.wintypes import UINT - -from .. import config as msvc_cfg -from ... import utils #import utils from pygccxml package - -STRING = c_char_p -_libraries = {} -_libraries['msvcr70.dll'] = CDLL(msvc_cfg.msvcr_path, mode=RTLD_GLOBAL) -_libraries['msbsc70.dll'] = CDLL(msvc_cfg.msbsc_path, mode=RTLD_GLOBAL) - - -qyMac = 9 -refreshAllOp = 4 -qyDervOf = 7 -delOp = 1 -qyImpMembers = 8 -changeOp = 2 -qyRefs = 4 -qyCalls = 2 -changeIinstOp = 3 -qyContains = 1 -qyCalledBy = 3 -noOp = 5 -qyBaseOf = 6 -qyNil = 0 -addOp = 0 -qyDefs = 5 -PULONG = POINTER(ULONG) -USHORT = c_ushort -PUSHORT = POINTER(USHORT) -UCHAR = c_ubyte -PUCHAR = POINTER(UCHAR) -PSZ = STRING -FLOAT = c_float -PFLOAT = POINTER(FLOAT) -PBOOL = POINTER(BOOL) -LPBOOL = POINTER(BOOL) -PBYTE = POINTER(BYTE) -LPBYTE = POINTER(BYTE) -PINT = POINTER(c_int) -LPINT = POINTER(c_int) -PWORD = POINTER(WORD) -LPWORD = POINTER(WORD) -LPLONG = POINTER(c_long) -PDWORD = POINTER(DWORD) -LPDWORD = POINTER(DWORD) -LPVOID = c_void_p -LPCVOID = c_void_p -INT = c_int -PUINT = POINTER(c_uint) -ULONG_PTR = POINTER(ULONG) -NI = ULONG -IINST = ULONG -IREF = ULONG -IDEF = ULONG -IMOD = USHORT -LINE = USHORT -TYP = BYTE -ATR = USHORT -ATR32 = ULONG -MBF = ULONG -SZ = STRING -SZ_CONST = STRING - -class Bsc(Structure): - pass - -# values for enumeration 'OPERATION' -OPERATION = c_int # enum -class IinstInfo(Structure): - pass -IinstInfo._fields_ = [ - ('m_iinst', IINST), - ('m_szName', SZ_CONST), - ('m_ni', NI), -] -class BSC_STAT(Structure): - pass -BSC_STAT._fields_ = [ - ('cDef', ULONG), - ('cRef', ULONG), - ('cInst', ULONG), - ('cMod', ULONG), - ('cUseLink', ULONG), - ('cBaseLink', ULONG), -] -class NiQ(Structure): - pass -NiQ._fields_ = [ - ('m_iinstOld', IINST), - ('m_iInfoNew', IinstInfo), - ('m_op', OPERATION), - ('m_typ', TYP), -] -pfnNotifyChange = CFUNCTYPE(BOOL, POINTER(NiQ), ULONG, ULONG_PTR) - -# values for enumeration '_qy_' -_qy_ = c_int # enum -QY = _qy_ -Bsc._fields_ = [ -] -BSCOpen = _libraries['msbsc70.dll'].BSCOpen -BSCOpen.restype = BOOL -BSCOpen.argtypes = [SZ_CONST, POINTER(POINTER(Bsc))] -BSCClose = _libraries['msbsc70.dll'].BSCClose -BSCClose.restype = BOOL -BSCClose.argtypes = [POINTER(Bsc)] -BSCIinstInfo = _libraries['msbsc70.dll'].BSCIinstInfo -BSCIinstInfo.restype = BOOL -BSCIinstInfo.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR)] -BSCIrefInfo = _libraries['msbsc70.dll'].BSCIrefInfo -BSCIrefInfo.restype = BOOL -BSCIrefInfo.argtypes = [POINTER(Bsc), IREF, POINTER(SZ), POINTER(LINE)] -BSCIdefInfo = _libraries['msbsc70.dll'].BSCIdefInfo -BSCIdefInfo.restype = BOOL -BSCIdefInfo.argtypes = [POINTER(Bsc), IDEF, POINTER(SZ), POINTER(LINE)] -BSCImodInfo = _libraries['msbsc70.dll'].BSCImodInfo -BSCImodInfo.restype = BOOL -BSCImodInfo.argtypes = [POINTER(Bsc), IMOD, POINTER(SZ)] -BSCSzFrTyp = _libraries['msbsc70.dll'].BSCSzFrTyp -BSCSzFrTyp.restype = SZ -BSCSzFrTyp.argtypes = [POINTER(Bsc), TYP] -BSCSzFrAtr = _libraries['msbsc70.dll'].BSCSzFrAtr -BSCSzFrAtr.restype = SZ -BSCSzFrAtr.argtypes = [POINTER(Bsc), ATR] -BSCGetIinstByvalue = _libraries['msbsc70.dll'].BSCGetIinstByvalue -BSCGetIinstByvalue.restype = BOOL -BSCGetIinstByvalue.argtypes = [POINTER(Bsc), SZ, TYP, ATR, POINTER(IINST)] -BSCGetOverloadArray = _libraries['msbsc70.dll'].BSCGetOverloadArray -BSCGetOverloadArray.restype = BOOL -BSCGetOverloadArray.argtypes = [POINTER(Bsc), SZ, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetUsedByArray = _libraries['msbsc70.dll'].BSCGetUsedByArray -BSCGetUsedByArray.restype = BOOL -BSCGetUsedByArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetUsesArray = _libraries['msbsc70.dll'].BSCGetUsesArray -BSCGetUsesArray.restype = BOOL -BSCGetUsesArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetBaseArray = _libraries['msbsc70.dll'].BSCGetBaseArray -BSCGetBaseArray.restype = BOOL -BSCGetBaseArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetDervArray = _libraries['msbsc70.dll'].BSCGetDervArray -BSCGetDervArray.restype = BOOL -BSCGetDervArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetMembersArray = _libraries['msbsc70.dll'].BSCGetMembersArray -BSCGetMembersArray.restype = BOOL -BSCGetMembersArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetDefArray = _libraries['msbsc70.dll'].BSCGetDefArray -BSCGetDefArray.restype = BOOL -BSCGetDefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)] -BSCGetRefArray = _libraries['msbsc70.dll'].BSCGetRefArray -BSCGetRefArray.restype = BOOL -BSCGetRefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)] -BSCGetModuleContents = _libraries['msbsc70.dll'].BSCGetModuleContents -BSCGetModuleContents.restype = BOOL -BSCGetModuleContents.argtypes = [POINTER(Bsc), IMOD, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetModuleByName = _libraries['msbsc70.dll'].BSCGetModuleByName -BSCGetModuleByName.restype = BOOL -BSCGetModuleByName.argtypes = [POINTER(Bsc), SZ, POINTER(IMOD)] -BSCGetAllModulesArray = _libraries['msbsc70.dll'].BSCGetAllModulesArray -BSCGetAllModulesArray.restype = BOOL -BSCGetAllModulesArray.argtypes = [POINTER(Bsc), POINTER(POINTER(IMOD)), POINTER(ULONG)] -BSCDisposeArray = _libraries['msbsc70.dll'].BSCDisposeArray -BSCDisposeArray.restype = None -BSCDisposeArray.argtypes = [POINTER(Bsc), c_void_p] -BSCFormatDname = _libraries['msbsc70.dll'].BSCFormatDname -BSCFormatDname.restype = SZ -BSCFormatDname.argtypes = [POINTER(Bsc), SZ] -BSCFInstFilter = _libraries['msbsc70.dll'].BSCFInstFilter -BSCFInstFilter.restype = BOOL -BSCFInstFilter.argtypes = [POINTER(Bsc), IINST, MBF] -BSCIinstFrIref = _libraries['msbsc70.dll'].BSCIinstFrIref -BSCIinstFrIref.restype = IINST -BSCIinstFrIref.argtypes = [POINTER(Bsc), IREF] -BSCIinstFrIdef = _libraries['msbsc70.dll'].BSCIinstFrIdef -BSCIinstFrIdef.restype = IINST -BSCIinstFrIdef.argtypes = [POINTER(Bsc), IDEF] -BSCIinstContextIref = _libraries['msbsc70.dll'].BSCIinstContextIref -BSCIinstContextIref.restype = IINST -BSCIinstContextIref.argtypes = [POINTER(Bsc), IREF] -BSCGetStatistics = _libraries['msbsc70.dll'].BSCGetStatistics -BSCGetStatistics.restype = BOOL -BSCGetStatistics.argtypes = [POINTER(Bsc), POINTER(BSC_STAT)] -BSCGetModuleStatistics = _libraries['msbsc70.dll'].BSCGetModuleStatistics -BSCGetModuleStatistics.restype = BOOL -BSCGetModuleStatistics.argtypes = [POINTER(Bsc), IMOD, POINTER(BSC_STAT)] -BSCFCaseSensitive = _libraries['msbsc70.dll'].BSCFCaseSensitive -BSCFCaseSensitive.restype = BOOL -BSCFCaseSensitive.argtypes = [POINTER(Bsc)] -BSCSetCaseSensitivity = _libraries['msbsc70.dll'].BSCSetCaseSensitivity -BSCSetCaseSensitivity.restype = BOOL -BSCSetCaseSensitivity.argtypes = [POINTER(Bsc), BOOL] -BSCGetAllGlobalsArray = _libraries['msbsc70.dll'].BSCGetAllGlobalsArray -BSCGetAllGlobalsArray.restype = BOOL -BSCGetAllGlobalsArray.argtypes = [POINTER(Bsc), MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCSzFrAtr2 = _libraries['msbsc70.dll'].BSCSzFrAtr2 -BSCSzFrAtr2.restype = SZ -BSCSzFrAtr2.argtypes = [POINTER(Bsc), ATR32] -BSCIinstInfo2 = _libraries['msbsc70.dll'].BSCIinstInfo2 -BSCIinstInfo2.restype = BOOL -BSCIinstInfo2.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR32)] -BSCGetIinstByvalue2 = _libraries['msbsc70.dll'].BSCGetIinstByvalue2 -BSCGetIinstByvalue2.restype = BOOL -BSCGetIinstByvalue2.argtypes = [POINTER(Bsc), SZ, TYP, ATR32, POINTER(IINST)] -OpenBSCQuery = _libraries['msbsc70.dll'].OpenBSCQuery -OpenBSCQuery.restype = BOOL -OpenBSCQuery.argtypes = [POINTER(Bsc)] -CloseBSCQuery = _libraries['msbsc70.dll'].CloseBSCQuery -CloseBSCQuery.restype = BOOL -CloseBSCQuery.argtypes = [] -BOB = ULONG -InitBSCQuery = _libraries['msbsc70.dll'].InitBSCQuery -InitBSCQuery.restype = BOOL -InitBSCQuery.argtypes = [QY, BOB] -BobNext = _libraries['msbsc70.dll'].BobNext -BobNext.restype = BOB -BobNext.argtypes = [] -BobFrName = _libraries['msbsc70.dll'].BobFrName -BobFrName.restype = BOB -BobFrName.argtypes = [SZ] -LszNameFrBob = _libraries['msbsc70.dll'].LszNameFrBob -LszNameFrBob.restype = SZ -LszNameFrBob.argtypes = [BOB] -CLS = USHORT - -class enums: - class MBF(utils.enum): - NIL = 0x000 - VARS = 0x001 - FUNCS = 0x002 - MACROS = 0x004 - TYPES = 0x008 - CLASS = 0x010 - INCL = 0x020 - MSGMAP = 0x040 - DIALOGID = 0x080 - LIBRARY = 0x100 - IMPORT = 0x200 - TEMPLATE = 0x400 - NAMESPACE = 0x800 - ALL = 0xFFF - - class TYPES(utils.enum): - FUNCTION = 0x01 - LABEL = 0x02 - PARAMETER = 0x03 - VARIABLE = 0x04 - CONSTANT = 0x05 - MACRO = 0x06 - TYPEDEF = 0x07 - STRUCNAM = 0x08 - ENUMNAM = 0x09 - ENUMMEM = 0x0A - UNIONNAM = 0x0B - SEGMENT = 0x0C - GROUP = 0x0D - PROGRAM = 0x0E - CLASSNAM = 0x0F - MEMFUNC = 0x10 - MEMVAR = 0x11 - - class ATTRIBUTES(utils.enum): - LOCAL = 0x001 - STATIC = 0x002 - SHARED = 0x004 - NEAR = 0x008 - COMMON = 0x010 - DECL_ONLY = 0x020 - PUBLIC = 0x040 - NAMED = 0x080 - MODULE = 0x100 - VIRTUAL = 0x200 - PRIVATE = 0x400 - PROTECT = 0x800 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/__init__.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/__init__.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/__init__.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,291 +0,0 @@ -import os -import sys -import logging -from c_wrapper import * -from .. import common_utils as msvc_utils - -class definition_t(object): - #represents some other symbol - def __init__( self, def_id, bsc ): - self.__bsc = bsc - self.__def_id = def_id - - @property - def def_id(self): - return self.__def_id - - @utils.cached - def location( self ): - module = STRING() - line = LINE() - if not BSCIdefInfo( self.__bsc, self.def_id, byref( module ), byref( line ) ): - raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__def_id ) ) - return (module, line) - - @utils.cached - def file_name(self): - return self.location[0].value - - @utils.cached - def line(self): - return self.location[1].value - - def __str__( self ): - return self.file_name + ': %d' % self.line + ' name: %s' % self.as_instance.name - - @utils.cached - def as_instance(self): - return self.__bsc.create_instance( BSCIinstFrIdef( self.__bsc, self.def_id) ) - -class instance_t(object): - #represents some symbol - def __init__( self, inst_id, bsc ): - self.__bsc = bsc - self.__inst_id = inst_id - - @property - def inst_id(self): - return self.__inst_id - - @utils.cached - def name_type_attribute_mangled_name( self ): - name = STRING() - typ = TYP() - attribute = ATR() - if not BSCIinstInfo( self.__bsc, self.inst_id, byref( name ), byref( typ ), byref( attribute ) ): - raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__inst_id ) ) - undecorated_name = msvc_utils.undecorate_name( name.value ) - if undecorated_name.startswith( ' ?? ' ): - undecorated_name = undecorated_name[4:] - #BSCFormatDname( self.__bsc, name ) - return undecorated_name, typ, attribute, name.value - - @utils.cached - def mangled_name(self): - return self.name_type_attribute_mangled_name[3] - - @utils.cached - def name(self): - return self.name_type_attribute_mangled_name[0] - - @utils.cached - def type(self): - return self.name_type_attribute_mangled_name[1].value - - @utils.cached - def attribute(self): - return self.name_type_attribute_mangled_name[2].value - - @utils.cached - def is_class(self): - return self.type in [ enums.TYPES.STRUCNAM - , enums.TYPES.UNIONNAM - , enums.TYPES.CLASSNAM ] - - def __str__( self ): - tmp = [] - if enums.TYPES.has_value( self.type ): - tmp.append( 'type( "%s" )' % enums.TYPES.name_of( self.type ) ) - if enums.ATTRIBUTES.has_value( self.attribute ): - tmp.append( 'attribute( "%s" )' % enums.ATTRIBUTES.name_of( self.attribute ) ) - tmp.append( 'name( "%s" )' % self.name ) - tmp.append( 'mangled name( "%s" )' % self.mangled_name ) - return ', '.join( tmp ) - - - @utils.cached - def definitions( self ): - definitions_len = ULONG(0) - definitions_ids = pointer( IDEF() ) - - if not BSCGetDefArray( self.__bsc, self.inst_id, byref( definitions_ids ), byref( definitions_len ) ): - raise RuntimeError( "Unable to call BSCGetDefArray" ) - - definitions = map( lambda i: definition_t( definitions_ids[i], self.__bsc ) - , range( definitions_len.value ) ) - - BSCDisposeArray( self.__bsc, definitions_ids ) - return definitions - - @utils.cached - def members( self ): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetMembersArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetMembersArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - - @utils.cached - def used_symbols(self): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetUsesArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetUsesArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - - @utils.cached - def base_classes(self): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetBaseArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetBaseArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - - @utils.cached - def derived_classes(self): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetDervArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetDervArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - -class module_t(object): - #represents file - def __init__( self, mod_id, bsc ): - self.__bsc = bsc - self.__mod_id = mod_id - - @property - def mod_id( self ): - return self.__mod_id - - @utils.cached - def path( self ): - name = STRING() - BSCImodInfo(self.__bsc, self.__mod_id, byref(name)) - return name.value - - @utils.cached - def instances( self ): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetModuleContents( self.__bsc, self.mod_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetModuleContents" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - -class reader_t( object ): - def __init__( self, bsc_file ): - self.logger = utils.loggers.pdb_reader - self.logger.setLevel(logging.INFO) - - self.__bsc_file = bsc_file - self.__bsc = pointer( Bsc() ) - if not BSCOpen( self.__bsc_file, byref( self.__bsc ) ): - raise RuntimeError( "Unable to open bsc file '%s'" % self.__bsc_file ) - - self.__instances_cache = {} #inst id : instance_t - self.__bsc.create_instance = lambda inst_id: self.__create_instance( inst_id ) - - @utils.cached - def instances(self): - return self.__instances_cache.values() - - def __create_instance( self, inst_id ): - try: - return self.__instances_cache[ inst_id ] - except KeyError: - inst = instance_t( inst_id, self.__bsc ) - self.__instances_cache[ inst_id ] = inst - return inst - - def load_instances( self ): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetAllGlobalsArray( self.__bsc, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to load all globals symbols" ) - - for i in range( instances_len.value ): - self.__create_instance( instances_ids[i] ) - - BSCDisposeArray( self.__bsc, instances_ids ) - - @utils.cached - def is_case_sensitive( self ): - return bool( BSCFCaseSensitive( self.__bsc ) ) - - @utils.cached - def files(self): - module_ids = pointer( IMOD() ) - module_len = ULONG() - bs = BSC_STAT() - - if not BSCGetAllModulesArray( self.__bsc, module_ids, byref(module_len) ): - raise RuntimeError( "Unable to load all modules" ) - - modules = map( lambda i: module_t( module_ids[i], self.__bsc ) - , range( module_len.value ) ) - - BSCDisposeArray( self.__bsc, module_ids ) - - return modules - - def print_stat( self ): - stat = BSC_STAT() - BSCGetStatistics( self.__bsc, byref( stat ) ) - for f, t in stat._fields_: - print '%s: %s' % ( f, str( getattr( stat, f) ) ) - - def print_classes(self, file_name=None): - for m in self.files: - if file_name and m.path != file_name: - continue - print 'File: ', m.path - if m.instances: - print '\tInstances:' - for inst in m.instances: - print '\t\t', str(inst) - if inst.definitions: - print '\t\t\tDefinitions:' - for definition in inst.definitions: - print '\t\t\t\t', str( definition ) - if inst.members: - print '\t\t\tMembers:' - for member in inst.members: - print '\t\t\t\t', str( member ) - if inst.used_symbols: - print '\t\t\tUsed symbols:' - for used_symbol in inst.used_symbols: - print '\t\t\t\t', str( used_symbol ) - if inst.base_classes: - print '\t\t\tBase classes:' - for base_class in inst.base_classes: - print '\t\t\t\t', str( base_class ) - if inst.derived_classes: - print '\t\t\tDerived classes:' - for derived_class in inst.derived_classes: - print '\t\t\t\t', str( derived_class ) - - def __del__( self ): - if self.__bsc: - BSCClose( self.__bsc ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc_impl_details.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc_impl_details.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc_impl_details.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/bsc_impl_details.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,568 +0,0 @@ -import os -import sys -import ctypes -import logging -import msvc_details -from ctypes import * -from ctypes.wintypes import ULONG -from ctypes.wintypes import DWORD -from ctypes.wintypes import BOOL -from ctypes.wintypes import BYTE -from ctypes.wintypes import WORD -from ctypes.wintypes import UINT - -sys.path.append( r'../..' ) - -from pygccxml import utils -from pygccxml import declarations - - -STRING = c_char_p -_libraries = {} -_libraries['msvcr70.dll'] = CDLL(msvc_details.msvcr_path, mode=RTLD_GLOBAL) -_libraries['msbsc70.dll'] = CDLL(msvc_details.msbsc_path, mode=RTLD_GLOBAL) - - -qyMac = 9 -refreshAllOp = 4 -qyDervOf = 7 -delOp = 1 -qyImpMembers = 8 -changeOp = 2 -qyRefs = 4 -qyCalls = 2 -changeIinstOp = 3 -qyContains = 1 -qyCalledBy = 3 -noOp = 5 -qyBaseOf = 6 -qyNil = 0 -addOp = 0 -qyDefs = 5 -PULONG = POINTER(ULONG) -USHORT = c_ushort -PUSHORT = POINTER(USHORT) -UCHAR = c_ubyte -PUCHAR = POINTER(UCHAR) -PSZ = STRING -FLOAT = c_float -PFLOAT = POINTER(FLOAT) -PBOOL = POINTER(BOOL) -LPBOOL = POINTER(BOOL) -PBYTE = POINTER(BYTE) -LPBYTE = POINTER(BYTE) -PINT = POINTER(c_int) -LPINT = POINTER(c_int) -PWORD = POINTER(WORD) -LPWORD = POINTER(WORD) -LPLONG = POINTER(c_long) -PDWORD = POINTER(DWORD) -LPDWORD = POINTER(DWORD) -LPVOID = c_void_p -LPCVOID = c_void_p -INT = c_int -PUINT = POINTER(c_uint) -ULONG_PTR = POINTER(ULONG) -NI = ULONG -IINST = ULONG -IREF = ULONG -IDEF = ULONG -IMOD = USHORT -LINE = USHORT -TYP = BYTE -ATR = USHORT -ATR32 = ULONG -MBF = ULONG -SZ = STRING -SZ_CONST = STRING - -class Bsc(Structure): - pass - -# values for enumeration 'OPERATION' -OPERATION = c_int # enum -class IinstInfo(Structure): - pass -IinstInfo._fields_ = [ - ('m_iinst', IINST), - ('m_szName', SZ_CONST), - ('m_ni', NI), -] -class BSC_STAT(Structure): - pass -BSC_STAT._fields_ = [ - ('cDef', ULONG), - ('cRef', ULONG), - ('cInst', ULONG), - ('cMod', ULONG), - ('cUseLink', ULONG), - ('cBaseLink', ULONG), -] -class NiQ(Structure): - pass -NiQ._fields_ = [ - ('m_iinstOld', IINST), - ('m_iInfoNew', IinstInfo), - ('m_op', OPERATION), - ('m_typ', TYP), -] -pfnNotifyChange = CFUNCTYPE(BOOL, POINTER(NiQ), ULONG, ULONG_PTR) - -# values for enumeration '_qy_' -_qy_ = c_int # enum -QY = _qy_ -Bsc._fields_ = [ -] -BSCOpen = _libraries['msbsc70.dll'].BSCOpen -BSCOpen.restype = BOOL -BSCOpen.argtypes = [SZ_CONST, POINTER(POINTER(Bsc))] -BSCClose = _libraries['msbsc70.dll'].BSCClose -BSCClose.restype = BOOL -BSCClose.argtypes = [POINTER(Bsc)] -BSCIinstInfo = _libraries['msbsc70.dll'].BSCIinstInfo -BSCIinstInfo.restype = BOOL -BSCIinstInfo.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR)] -BSCIrefInfo = _libraries['msbsc70.dll'].BSCIrefInfo -BSCIrefInfo.restype = BOOL -BSCIrefInfo.argtypes = [POINTER(Bsc), IREF, POINTER(SZ), POINTER(LINE)] -BSCIdefInfo = _libraries['msbsc70.dll'].BSCIdefInfo -BSCIdefInfo.restype = BOOL -BSCIdefInfo.argtypes = [POINTER(Bsc), IDEF, POINTER(SZ), POINTER(LINE)] -BSCImodInfo = _libraries['msbsc70.dll'].BSCImodInfo -BSCImodInfo.restype = BOOL -BSCImodInfo.argtypes = [POINTER(Bsc), IMOD, POINTER(SZ)] -BSCSzFrTyp = _libraries['msbsc70.dll'].BSCSzFrTyp -BSCSzFrTyp.restype = SZ -BSCSzFrTyp.argtypes = [POINTER(Bsc), TYP] -BSCSzFrAtr = _libraries['msbsc70.dll'].BSCSzFrAtr -BSCSzFrAtr.restype = SZ -BSCSzFrAtr.argtypes = [POINTER(Bsc), ATR] -BSCGetIinstByvalue = _libraries['msbsc70.dll'].BSCGetIinstByvalue -BSCGetIinstByvalue.restype = BOOL -BSCGetIinstByvalue.argtypes = [POINTER(Bsc), SZ, TYP, ATR, POINTER(IINST)] -BSCGetOverloadArray = _libraries['msbsc70.dll'].BSCGetOverloadArray -BSCGetOverloadArray.restype = BOOL -BSCGetOverloadArray.argtypes = [POINTER(Bsc), SZ, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetUsedByArray = _libraries['msbsc70.dll'].BSCGetUsedByArray -BSCGetUsedByArray.restype = BOOL -BSCGetUsedByArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetUsesArray = _libraries['msbsc70.dll'].BSCGetUsesArray -BSCGetUsesArray.restype = BOOL -BSCGetUsesArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetBaseArray = _libraries['msbsc70.dll'].BSCGetBaseArray -BSCGetBaseArray.restype = BOOL -BSCGetBaseArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetDervArray = _libraries['msbsc70.dll'].BSCGetDervArray -BSCGetDervArray.restype = BOOL -BSCGetDervArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetMembersArray = _libraries['msbsc70.dll'].BSCGetMembersArray -BSCGetMembersArray.restype = BOOL -BSCGetMembersArray.argtypes = [POINTER(Bsc), IINST, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetDefArray = _libraries['msbsc70.dll'].BSCGetDefArray -BSCGetDefArray.restype = BOOL -BSCGetDefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)] -BSCGetRefArray = _libraries['msbsc70.dll'].BSCGetRefArray -BSCGetRefArray.restype = BOOL -BSCGetRefArray.argtypes = [POINTER(Bsc), IINST, POINTER(POINTER(IREF)), POINTER(ULONG)] -BSCGetModuleContents = _libraries['msbsc70.dll'].BSCGetModuleContents -BSCGetModuleContents.restype = BOOL -BSCGetModuleContents.argtypes = [POINTER(Bsc), IMOD, MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCGetModuleByName = _libraries['msbsc70.dll'].BSCGetModuleByName -BSCGetModuleByName.restype = BOOL -BSCGetModuleByName.argtypes = [POINTER(Bsc), SZ, POINTER(IMOD)] -BSCGetAllModulesArray = _libraries['msbsc70.dll'].BSCGetAllModulesArray -BSCGetAllModulesArray.restype = BOOL -BSCGetAllModulesArray.argtypes = [POINTER(Bsc), POINTER(POINTER(IMOD)), POINTER(ULONG)] -BSCDisposeArray = _libraries['msbsc70.dll'].BSCDisposeArray -BSCDisposeArray.restype = None -BSCDisposeArray.argtypes = [POINTER(Bsc), c_void_p] -BSCFormatDname = _libraries['msbsc70.dll'].BSCFormatDname -BSCFormatDname.restype = SZ -BSCFormatDname.argtypes = [POINTER(Bsc), SZ] -BSCFInstFilter = _libraries['msbsc70.dll'].BSCFInstFilter -BSCFInstFilter.restype = BOOL -BSCFInstFilter.argtypes = [POINTER(Bsc), IINST, MBF] -BSCIinstFrIref = _libraries['msbsc70.dll'].BSCIinstFrIref -BSCIinstFrIref.restype = IINST -BSCIinstFrIref.argtypes = [POINTER(Bsc), IREF] -BSCIinstFrIdef = _libraries['msbsc70.dll'].BSCIinstFrIdef -BSCIinstFrIdef.restype = IINST -BSCIinstFrIdef.argtypes = [POINTER(Bsc), IDEF] -BSCIinstContextIref = _libraries['msbsc70.dll'].BSCIinstContextIref -BSCIinstContextIref.restype = IINST -BSCIinstContextIref.argtypes = [POINTER(Bsc), IREF] -BSCGetStatistics = _libraries['msbsc70.dll'].BSCGetStatistics -BSCGetStatistics.restype = BOOL -BSCGetStatistics.argtypes = [POINTER(Bsc), POINTER(BSC_STAT)] -BSCGetModuleStatistics = _libraries['msbsc70.dll'].BSCGetModuleStatistics -BSCGetModuleStatistics.restype = BOOL -BSCGetModuleStatistics.argtypes = [POINTER(Bsc), IMOD, POINTER(BSC_STAT)] -BSCFCaseSensitive = _libraries['msbsc70.dll'].BSCFCaseSensitive -BSCFCaseSensitive.restype = BOOL -BSCFCaseSensitive.argtypes = [POINTER(Bsc)] -BSCSetCaseSensitivity = _libraries['msbsc70.dll'].BSCSetCaseSensitivity -BSCSetCaseSensitivity.restype = BOOL -BSCSetCaseSensitivity.argtypes = [POINTER(Bsc), BOOL] -BSCGetAllGlobalsArray = _libraries['msbsc70.dll'].BSCGetAllGlobalsArray -BSCGetAllGlobalsArray.restype = BOOL -BSCGetAllGlobalsArray.argtypes = [POINTER(Bsc), MBF, POINTER(POINTER(IINST)), POINTER(ULONG)] -BSCSzFrAtr2 = _libraries['msbsc70.dll'].BSCSzFrAtr2 -BSCSzFrAtr2.restype = SZ -BSCSzFrAtr2.argtypes = [POINTER(Bsc), ATR32] -BSCIinstInfo2 = _libraries['msbsc70.dll'].BSCIinstInfo2 -BSCIinstInfo2.restype = BOOL -BSCIinstInfo2.argtypes = [POINTER(Bsc), IINST, POINTER(SZ), POINTER(TYP), POINTER(ATR32)] -BSCGetIinstByvalue2 = _libraries['msbsc70.dll'].BSCGetIinstByvalue2 -BSCGetIinstByvalue2.restype = BOOL -BSCGetIinstByvalue2.argtypes = [POINTER(Bsc), SZ, TYP, ATR32, POINTER(IINST)] -OpenBSCQuery = _libraries['msbsc70.dll'].OpenBSCQuery -OpenBSCQuery.restype = BOOL -OpenBSCQuery.argtypes = [POINTER(Bsc)] -CloseBSCQuery = _libraries['msbsc70.dll'].CloseBSCQuery -CloseBSCQuery.restype = BOOL -CloseBSCQuery.argtypes = [] -BOB = ULONG -InitBSCQuery = _libraries['msbsc70.dll'].InitBSCQuery -InitBSCQuery.restype = BOOL -InitBSCQuery.argtypes = [QY, BOB] -BobNext = _libraries['msbsc70.dll'].BobNext -BobNext.restype = BOB -BobNext.argtypes = [] -BobFrName = _libraries['msbsc70.dll'].BobFrName -BobFrName.restype = BOB -BobFrName.argtypes = [SZ] -LszNameFrBob = _libraries['msbsc70.dll'].LszNameFrBob -LszNameFrBob.restype = SZ -LszNameFrBob.argtypes = [BOB] -CLS = USHORT - -class enums: - class MBF(utils.enum): - NIL = 0x000 - VARS = 0x001 - FUNCS = 0x002 - MACROS = 0x004 - TYPES = 0x008 - CLASS = 0x010 - INCL = 0x020 - MSGMAP = 0x040 - DIALOGID = 0x080 - LIBRARY = 0x100 - IMPORT = 0x200 - TEMPLATE = 0x400 - NAMESPACE = 0x800 - ALL = 0xFFF - - class TYPES(utils.enum): - FUNCTION = 0x01 - LABEL = 0x02 - PARAMETER = 0x03 - VARIABLE = 0x04 - CONSTANT = 0x05 - MACRO = 0x06 - TYPEDEF = 0x07 - STRUCNAM = 0x08 - ENUMNAM = 0x09 - ENUMMEM = 0x0A - UNIONNAM = 0x0B - SEGMENT = 0x0C - GROUP = 0x0D - PROGRAM = 0x0E - CLASSNAM = 0x0F - MEMFUNC = 0x10 - MEMVAR = 0x11 - - class ATTRIBUTES(utils.enum): - LOCAL = 0x001 - STATIC = 0x002 - SHARED = 0x004 - NEAR = 0x008 - COMMON = 0x010 - DECL_ONLY = 0x020 - PUBLIC = 0x040 - NAMED = 0x080 - MODULE = 0x100 - VIRTUAL = 0x200 - PRIVATE = 0x400 - PROTECT = 0x800 - -class definition_t(object): - #represents some other symbol - def __init__( self, def_id, bsc ): - self.__bsc = bsc - self.__def_id = def_id - - @property - def def_id(self): - return self.__def_id - - @utils.cached - def location( self ): - module = STRING() - line = LINE() - if not BSCIdefInfo( self.__bsc, self.def_id, byref( module ), byref( line ) ): - raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__def_id ) ) - return (module, line) - - @utils.cached - def file_name(self): - return self.location[0].value - - @utils.cached - def line(self): - return self.location[1].value - - def __str__( self ): - return self.file_name + ': %d' % self.line + ' name: %s' % self.as_instance.name - - @utils.cached - def as_instance(self): - return self.__bsc.create_instance( BSCIinstFrIdef( self.__bsc, self.def_id) ) - -class instance_t(object): - #represents some symbol - def __init__( self, inst_id, bsc ): - self.__bsc = bsc - self.__inst_id = inst_id - - @property - def inst_id(self): - return self.__inst_id - - @utils.cached - def name_type_attribute_mangled_name( self ): - name = STRING() - typ = TYP() - attribute = ATR() - if not BSCIinstInfo( self.__bsc, self.inst_id, byref( name ), byref( typ ), byref( attribute ) ): - raise RuntimeError( "Unable to load information about instance(%s)" % str( self.__inst_id ) ) - undecorated_name = BSCFormatDname( self.__bsc, name ) - return undecorated_name, typ, attribute, name.value - - - @utils.cached - def mangled_name(self): - return self.name_type_attribute_mangled_name[3] - - @utils.cached - def name(self): - return self.name_type_attribute_mangled_name[0] - - @utils.cached - def type(self): - return self.name_type_attribute_mangled_name[1].value - - @utils.cached - def attribute(self): - return self.name_type_attribute_mangled_name[2].value - - def __str__( self ): - tmp = [] - if enums.TYPES.has_value( self.type ): - tmp.append( 'type( "%s" )' % enums.TYPES.name_of( self.type ) ) - if enums.ATTRIBUTES.has_value( self.attribute ): - tmp.append( 'attribute( "%s" )' % enums.ATTRIBUTES.name_of( self.attribute ) ) - tmp.append( 'name( "%s" )' % self.name ) - tmp.append( 'mangled name( "%s" )' % self.mangled_name ) - return ', '.join( tmp ) - - - @utils.cached - def definitions( self ): - definitions_len = ULONG(0) - definitions_ids = pointer( IDEF() ) - - if not BSCGetDefArray( self.__bsc, self.inst_id, byref( definitions_ids ), byref( definitions_len ) ): - raise RuntimeError( "Unable to call BSCGetDefArray" ) - - definitions = map( lambda i: definition_t( definitions_ids[i], self.__bsc ) - , range( definitions_len.value ) ) - - BSCDisposeArray( self.__bsc, definitions_ids ) - return definitions - - @utils.cached - def members( self ): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetMembersArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetMembersArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - - @utils.cached - def used_symbols(self): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetUsesArray( self.__bsc, self.inst_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetUsesArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - - @utils.cached - def base_classes(self): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetBaseArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetBaseArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - - @utils.cached - def derived_classes(self): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetDervArray( self.__bsc, self.inst_id, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetDervArray" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - -class module_t(object): - #represents file - def __init__( self, mod_id, bsc ): - self.__bsc = bsc - self.__mod_id = mod_id - - @property - def mod_id( self ): - return self.__mod_id - - @utils.cached - def path( self ): - name = STRING() - BSCImodInfo(self.__bsc, self.__mod_id, byref(name)) - return name.value - - @utils.cached - def instances( self ): - instances_len = ULONG(0) - instances_ids = pointer( IINST() ) - - if not BSCGetModuleContents( self.__bsc, self.mod_id, enums.MBF.ALL, byref( instances_ids ), byref( instances_len ) ): - raise RuntimeError( "Unable to call BSCGetModuleContents" ) - - instances = map( lambda i: self.__bsc.create_instance( instances_ids[i] ) - , range( instances_len.value ) ) - - BSCDisposeArray( self.__bsc, instances_ids ) - return instances - -class bsc_reader_t( object ): - def __init__( self, bsc_file ): - self.logger = utils.loggers.pdb_reader - self.logger.setLevel(logging.INFO) - - self.__bsc_file = bsc_file - self.__bsc = pointer( Bsc() ) - if not BSCOpen( self.__bsc_file, byref( self.__bsc ) ): - raise RuntimeError( "Unable to open bsc file '%s'" % self.__bsc_file ) - - self.__instances_cache = {} #inst id : instance_t - self.__bsc.create_instance = lambda inst_id: self.__create_instance( inst_id ) - - def __create_instance( self, inst_id ): - try: - return self.__instances_cache[ inst_id ] - except KeyError: - inst = instance_t( inst_id, self.__bsc ) - self.__instances_cache[ inst_id ] = inst - return inst - - def query_all_instances( self ): - instances_len = ULONG(0) - instances = pointer( IINST() ) - - if not BSCGetAllGlobalsArray( self.__bsc, enums.MBF.ALL, byref( instances ), byref( instances_len ) ): - raise RuntimeError( "Unable to load all globals symbols" ) - for i in range( instances_len.value ): - self.__instances.append( instances[i] ) - BSCDisposeArray( self.__bsc, instances ) - - @utils.cached - def is_case_sensitive( self ): - return bool( BSCFCaseSensitive( self.__bsc ) ) - - @utils.cached - def files(self): - module_ids = pointer( IMOD() ) - module_len = ULONG() - bs = BSC_STAT() - - if not BSCGetAllModulesArray( self.__bsc, module_ids, byref(module_len) ): - raise RuntimeError( "Unable to load all modules" ) - - modules = map( lambda i: module_t( module_ids[i], self.__bsc ) - , range( module_len.value ) ) - - BSCDisposeArray( self.__bsc, module_ids ) - - return modules - - def print_stat( self ): - stat = BSC_STAT() - BSCGetStatistics( self.__bsc, byref( stat ) ) - for f, t in stat._fields_: - print '%s: %s' % ( f, str( getattr( stat, f) ) ) - - def print_classes(self, file_name=None): - for m in self.files: - if file_name and m.path != file_name: - continue - print 'File: ', m.path - if m.instances: - print '\tInstances:' - for inst in m.instances: - print '\t\t', str(inst) - if inst.definitions: - print '\t\t\tDefinitions:' - for definition in inst.definitions: - print '\t\t\t\t', str( definition ) - if inst.members: - print '\t\t\tMembers:' - for member in inst.members: - print '\t\t\t\t', str( member ) - if inst.used_symbols: - print '\t\t\tUsed symbols:' - for used_symbol in inst.used_symbols: - print '\t\t\t\t', str( used_symbol ) - if inst.base_classes: - print '\t\t\tBase classes:' - for base_class in inst.base_classes: - print '\t\t\t\t', str( base_class ) - if inst.derived_classes: - print '\t\t\tDerived classes:' - for derived_class in inst.derived_classes: - print '\t\t\t\t', str( derived_class ) - - def __del__( self ): - if self.__bsc: - BSCClose( self.__bsc ) - -if __name__ == '__main__': - control_bsc = r'xxx.bsc' - reader = bsc_reader_t( control_bsc ) - reader.print_stat() - print 'is_case_sensitive', reader.is_case_sensitive - #~ reader.query_all_instances() - #reader.files - reader.print_classes( )#r'c:\dev\produce_pdb\produce_pdb.cpp') diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/common_utils.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/common_utils.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/common_utils.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/common_utils.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -import ctypes -import ctypes.wintypes -import config as msvc_cfg - -class UNDECORATE_NAME_OPTIONS: - UNDNAME_COMPLETE = 0x0000 #Enables full undecoration. - UNDNAME_NO_LEADING_UNDERSCORES = 0x0001 #Removes leading underscores from Microsoft extended keywords. - UNDNAME_NO_MS_KEYWORDS = 0x0002 #Disables expansion of Microsoft extended keywords. - UNDNAME_NO_FUNCTION_RETURNS = 0x0004 #Disables expansion of return type for primary declaration. - UNDNAME_NO_ALLOCATION_MODEL = 0x0008 #Disables expansion of the declaration model. - UNDNAME_NO_ALLOCATION_LANGUAGE = 0x0010 #Disables expansion of the declaration language specifier. - UNDNAME_RESERVED1 = 0x0020 #RESERVED. - UNDNAME_RESERVED2 = 0x0040 #RESERVED. - UNDNAME_NO_THISTYPE = 0x0060 #Disables all modifiers on the this type. - UNDNAME_NO_ACCESS_SPECIFIERS = 0x0080 #Disables expansion of access specifiers for members. - UNDNAME_NO_THROW_SIGNATURES = 0x0100 #Disables expansion of "throw-signatures" for functions and pointers to functions. - UNDNAME_NO_MEMBER_TYPE = 0x0200 #Disables expansion of static or virtual members. - UNDNAME_NO_RETURN_UDT_MODEL = 0x0400 #Disables expansion of the Microsoft model for UDT returns. - UNDNAME_32_BIT_DECODE = 0x0800 #Undecorates 32-bit decorated names. - UNDNAME_NAME_ONLY = 0x1000 #Gets only the name for primary declaration; returns just [scope::]name. Expands template params. - UNDNAME_TYPE_ONLY = 0x2000 #Input is just a type encoding; composes an abstract declarator. - UNDNAME_HAVE_PARAMETERS = 0x4000 #The real template parameters are available. - UNDNAME_NO_ECSU = 0x8000 #Suppresses enum/class/struct/union. - UNDNAME_NO_IDENT_CHAR_CHECK = 0x10000 #Suppresses check for valid identifier characters. - UNDNAME_NO_PTR64 = 0x20000 #Does not include ptr64 in output. - - UNDNAME_SCOPES_ONLY = UNDNAME_NO_LEADING_UNDERSCORES \ - | UNDNAME_NO_MS_KEYWORDS \ - | UNDNAME_NO_FUNCTION_RETURNS \ - | UNDNAME_NO_ALLOCATION_MODEL \ - | UNDNAME_NO_ALLOCATION_LANGUAGE \ - | UNDNAME_NO_ACCESS_SPECIFIERS \ - | UNDNAME_NO_THROW_SIGNATURES \ - | UNDNAME_NO_MEMBER_TYPE \ - | UNDNAME_NO_ECSU \ - | UNDNAME_NO_IDENT_CHAR_CHECK - -#__unDName definition was taken from: -#http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2006-02/msg00754.html -msvcrxx = ctypes.CDLL( msvc_cfg.msvcr_path, mode=ctypes.RTLD_GLOBAL) - -free_type = ctypes.CFUNCTYPE( None, ctypes.c_void_p ) #free type -malloc_type = ctypes.CFUNCTYPE( ctypes.c_void_p, ctypes.c_uint ) #malloc type - - -__unDName = msvcrxx.__unDName -__unDName.argtypes = [ ctypes.c_char_p #undecorated name - , ctypes.c_char_p #decorated name - , ctypes.c_int #sizeof undecorated name - , malloc_type - , free_type - , ctypes.c_ushort #flags - ] -__unDName.restype = ctypes.c_char_p - - -def undecorate_name( name, options=None ): - if not name: - return '' - if options is None: - options = UNDECORATE_NAME_OPTIONS.UNDNAME_NO_ECSU - buffer_size = 1024 * 32 - undecorated_name = ctypes.create_string_buffer('\0' * buffer_size) #should be enouph for any symbol - __unDName( undecorated_name - , name - , buffer_size - , malloc_type( msvcrxx.malloc ) - , free_type( msvcrxx.free ) - , options ) - return undecorated_name.value diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/config.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/config.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/config.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/config.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -import os -import sys -import comtypes -from .. import utils -import comtypes.client -import _winreg as win_registry -from distutils import msvccompiler - -class binaries_searcher_t: - - def get_msbsc_path( self ): - relative_path = os.path.dirname( sys.modules[__name__].__file__) - absolute_path = os.path.abspath (relative_path) - return os.path.join( absolute_path, 'msbsc70.dll' ) - - def get_msvcr70_path( self ): - relative_path = os.path.dirname( sys.modules[__name__].__file__) - absolute_path = os.path.abspath (relative_path) - return os.path.join( absolute_path, 'msvcr70.dll' ) - - - def get_msvcr_path( self ): - vss_installed = self.__get_installed_vs_dirs() - for f in utils.files_walker( vss_installed, ["*.dll"], ): - f_path, f_name = os.path.split( f.upper() ) - if f_name.startswith( 'MSVCR' ): - return f - else: - raise RuntimeError( 'Unable to find msvcrXX.dll. Search path is: %s' % vss_installed ) - - def get_msdia_path( self ): - vss_installed = self.__get_installed_vs_dirs() - msdia_dlls = self.__get_msdia_dll_paths( vss_installed ) - if 1 == len(msdia_dlls): - return msdia_dlls[0] - else: - #TODO find the highest version and use it. - pass - - def __get_msdia_dll_paths( self, vss_installed ): - msdia_dlls = [] - for vs in vss_installed: - debug_dir = os.path.join( vs, 'Common7', 'Packages', 'Debugger' ) - files = filter( lambda f: f.startswith( 'msdia' ) and f.endswith( '.dll' ) - , os.listdir( debug_dir ) ) - if not files: - continue - msdia_dlls.extend([ os.path.join( debug_dir, f ) for f in files ]) - if not msdia_dlls: - raise RuntimeError( 'pygccxml unable to find out msdiaXX.dll location' ) - return msdia_dlls - - def __get_installed_vs_dirs( self ): - vs_reg_path = 'Software\Microsoft\VisualStudio\SxS\VS7' - values = self.read_values( win_registry.HKEY_LOCAL_MACHINE, vs_reg_path ) - return [ values.values()[0] ] - - def read_keys(self, base, key): - return msvccompiler.read_keys(base, key) - - def read_values(self, base, key): - return msvccompiler.read_values(base, key) - -bs = binaries_searcher_t() - -msdia_path = bs.get_msdia_path() -print 'msdia path: ', msdia_path - -msbsc_path = bs.get_msbsc_path() -print 'msbsc path: ', msbsc_path - -msvcr_path = bs.get_msvcr_path() -print 'msvcr path: ', msvcr_path diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/enums.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/enums.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/enums.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/enums.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -from ... import utils #import utils from pygccxml package - -class BasicType(utils.enum): - btNoType = 0 - btVoid = 1 - btChar = 2 - btWChar = 3 - btInt = 6 - btUInt = 7 - btFloat = 8 - btBCD = 9 - btBool = 10 - btLong = 13 - btULong = 14 - btCurrency = 25 - btDate = 26 - btVariant = 27 - btComplex = 28 - btBit = 29 - btBSTR = 30 - btHresult = 31 - - - - -#Adding code, that was not generated for some reason. -class UdtKind(utils.enum): - UdtStruct, UdtClass, UdtUnion = (0, 1, 2) - -class CV_access_e(utils.enum): - CV_private, CV_protected, CV_public = (1, 2, 3) - -class NameSearchOptions(utils.enum): - nsNone = 0 - nsfCaseSensitive = 0x1 - nsfCaseInsensitive = 0x2 - nsfFNameExt = 0x4 - nsfRegularExpression = 0x8 - nsfUndecoratedName = 0x10 - - # For backward compabibility: - nsCaseSensitive = nsfCaseSensitive - nsCaseInsensitive = nsfCaseInsensitive - nsFNameExt = nsfFNameExt - nsRegularExpression = nsfRegularExpression | nsfCaseSensitive - nsCaseInRegularExpression = nsfRegularExpression | nsfCaseInsensitive - - -class DataKind( utils.enum ): - DataIsUnknown = 0 - DataIsLocal = 1 - DataIsStaticLocal = 2 - DataIsParam = 3 - DataIsObjectPtr = 4 - DataIsFileStatic = 5 - DataIsGlobal = 6 - DataIsMember = 7 - DataIsStaticMember = 8 - DataIsConstant = 9 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/impl_details.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/impl_details.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/impl_details.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/impl_details.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -from . import enums -from pygccxml import declarations - -def guess_class_type( udt_kind ): - if enums.UdtKind.UdtStruct == udt_kind: - return declarations.CLASS_TYPES.STRUCT - elif enums.UdtKind.UdtClass == udt_kind: - return declarations.CLASS_TYPES.CLASS - else: - return declarations.CLASS_TYPES.UNION - -class full_name_splitter_t( object ): - def __init__( self, full_name ): - self.__full_name = full_name - self.__identifiers = self.__split_scope_identifiers() - self.__scope_identifiers = None - - @property - def name( self ): - return self.__identifiers[-1] - - @property - def scope_names( self ): - if None is self.__scope_identifiers: - self.__scope_identifiers = []# ['::'] - for i in range( len(self.__identifiers) - 1): - self.__scope_identifiers.append( '::'.join( self.__identifiers[0:i+1] ) ) - return self.__scope_identifiers - - @property - def identifiers( self ): - return self.__identifiers - - def __split_scope_identifiers( self ): - try: - result = [] - tmp = self.__full_name.split( '::' ) - tmp.reverse() - while tmp: - token = tmp.pop() - less_count = token.count( '<' ) - greater_count = token.count( '>' ) - if less_count != greater_count: - while less_count != greater_count and tmp: - next_token = tmp.pop() - token = token + '::' + next_token - less_count += next_token.count( '<' ) - greater_count += next_token.count( '>' ) - result.append( token ) - return result - except Exception, err: - msg = 'Unable to split scope for identifiers. The full scope name is: "%s". Error: %s' - msg = msg % ( self.__full_name, str(err) ) - raise RuntimeError( msg ) - -__name_splitters = {} -def get_name_splitter( full_name ): - try: - return __name_splitters[full_name] - except KeyError: - splitter = full_name_splitter_t( full_name ) - __name_splitters[full_name] = splitter - return splitter - -if '__main__' == __name__: - name = "boost::detail::is_base_and_derived_impl2::Host" - fnsp = full_name_splitter_t( name ) - for x in fnsp.scope_names: - print x - - fnsp = full_name_splitter_t( 'x' ) - for x in fnsp.scope_names: - print x diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/__init__.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/__init__.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/__init__.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -import os -import sys -import ctypes -import pprint -import logging -import comtypes -import comtypes.client - -from . import impl_details - -from ... import utils -from ... import declarations -from .. import config as msvc_cfg - -msdia = comtypes.client.GetModule( msvc_cfg.msdia_path ) - -#~ comtypes_client_gen_dir = comtypes.client.gen_dir -#~ try: - #~ comtypes.client.gen_dir = None - #~ msdia = comtypes.client.GetModule( msvc_cfg.msdia_path ) -#~ finally: - #~ comtypes.client.gen_dir = comtypes_client_gen_dir - -from loader import decl_loader_t diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/kb.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/kb.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/kb.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/kb.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -url: http://www.hightechtalks.com/visual-studio-net-debugging/re-using-dia-sdk-find-360868.html -Q: how to find out member variable offset? -A (By Oleg): -1. Assuming that you have IDiaSymbol interface pointer for the class (UDT) symbol, -use IDiaSymbol::findChildren (with SymTagData as the tag) to lookup the field -with the given name (or all fields). - -2. IDiaSymbol::findChildren will give you IDiaEnumSymbols interface, which you can use -to retrieve IDiaSymbol for the field(s). - -3. Using the field's IDiaSymbol interface, call IDiaSymbol::get_locationType to determine -the location of the field. -If the location is LocIsThisRel, use IDiaSymbol::get_offset to obtain the offset. -If the location is LocIsStatic, use IDiaSymbol::get_addressSection and IDiaSymbol::get_addressOffset, -or IDiaSymbol::get_relativeVirtualAddress, or IDiaSymbol::get_virtualAddress to obtain -the address of the static member. diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/loader.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/loader.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/loader.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/msvc/pdb/loader.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,703 +0,0 @@ -import os -import re -import pdb -import sys -import ctypes -import pprint -import logging -import comtypes -import itertools -import comtypes.client - -from . import enums -from . import impl_details - -from ... import utils -from ... import declarations -from .. import config as msvc_cfg -from .. import common_utils as msvc_utils - -msdia = comtypes.client.GetModule( msvc_cfg.msdia_path ) - -SymTagEnum = 12 -msdia.SymTagEnum = 12 - -def iif( condition, true_value, false_value ): - if condition: - return true_value - else: - return false_value - -def as_symbol( x ): - return ctypes.cast( x, ctypes.POINTER( msdia.IDiaSymbol ) ) - -def as_table( x ): - return ctypes.cast( x, ctypes.POINTER( msdia.IDiaTable ) ) - -def as_enum_symbols( x ): - return ctypes.cast( x, ctypes.POINTER( msdia.IDiaEnumSymbols ) ) - -def as_enum_variant( x ): - return ctypes.cast( x, ctypes.POINTER( comtypes.automation.IEnumVARIANT ) ) - -def print_files( session ): - files = iter( session.findFile( None, '', 0 ) ) - for f in files: - f = ctypes.cast( f, ctypes.POINTER(msdia.IDiaSourceFile) ) - print 'File: ', f.fileName - -class decl_loader_t(object): - COMPILER = declarations.compilers.MSVC_PDB_9 - def __init__(self, pdb_file_path ): - self.logger = utils.loggers.pdb_reader - self.logger.setLevel(logging.INFO) - self.logger.debug( 'creating DiaSource object' ) - self.__dia_source = comtypes.client.CreateObject( msdia.DiaSource ) - self.logger.debug( 'loading pdb file: %s' % pdb_file_path ) - self.__dia_source.loadDataFromPdb(pdb_file_path) - self.logger.debug( 'opening session' ) - self.__dia_session = self.__dia_source.openSession() - self.logger.debug( 'opening session - done' ) - self.__global_ns = declarations.namespace_t( '::' ) - self.__global_ns.compiler = self.COMPILER - self.__id2decl = {} #cache symIndexId : decl - self.__types_cache = {} #smbl id : type - - def __find_table(self, name): - valid_names = ( 'Symbols', 'SourceFiles', 'Sections' - , 'SegmentMap', 'InjectedSource', 'FrameData' ) - tables = self.__dia_session.getEnumTables() - for table in itertools.imap(as_table, tables): - if name == table.name: - return table - else: - return None - - @utils.cached - def symbols_table(self): - return self.__find_table( "Symbols" ) - - @utils.cached - def symbols(self): - self.logger.info( 'loading symbols from the file' ) - smbls = {} - for smbl in itertools.imap( as_symbol, as_enum_variant( self.symbols_table._NewEnum ) ): - smbl.uname = msvc_utils.undecorate_name( smbl.name, msvc_utils.UNDECORATE_NAME_OPTIONS.UNDNAME_SCOPES_ONLY ) - def smbl_undecorate_name( options = None ): - return msvc_utils.undecorate_name( smbl.name, options ) - smbl.undecorate_name = smbl_undecorate_name - smbls[ smbl.symIndexId ] = smbl - self.logger.info( 'loading symbols(%d) from the file - done', len( smbls ) ) - return smbls - - def __load_nss(self): - def ns_filter( smbl ): - self.logger.debug( '__load_ns.ns_filter, %s', smbl.uname ) - tags = ( msdia.SymTagFunction - , msdia.SymTagBlock - , msdia.SymTagData - #~ , msdia.SymTagAnnotation - #~ , msdia.SymTagPublicSymbol - , msdia.SymTagUDT - , msdia.SymTagEnum - #~ , msdia.SymTagFunctionType - #~ , msdia.SymTagPointerType - , msdia.SymTagArrayType - , msdia.SymTagBaseType - , msdia.SymTagTypedef - , msdia.SymTagBaseClass - , msdia.SymTagFriend - #~ , msdia.SymTagFunctionArgType - #~ , msdia.SymTagUsingNamespace - ) - if smbl.symTag not in tags: - self.logger.debug( 'smbl.symTag not in tags, %s', smbl.uname ) - return False - elif smbl.symTag == msdia.SymTagData and not self.__is_my_var( smbl ): - return False - elif not smbl.name: - self.logger.debug( 'not smbl.name, %s', smbl.uname ) - return False - #~ elif '-' in smbl.name: - #~ self.logger.debug( '"-" in smbl.name, %s', smbl.uname ) - #~ return False - elif smbl.classParent: - parent_smbl = self.symbols[ smbl.classParentId ] - while parent_smbl: - if parent_smbl.symTag == msdia.SymTagUDT: - if parent_smbl.uname in smbl.uname: - #for some reason std::map is reported as parent of std::_Tree, in source code - #std::map derives from std::_Tree. In logical sense parent name is a subset of the child name - self.logger.debug( 'parent_smbl.symTag == msdia.SymTagUDT, %s', parent_smbl.uname ) - return False - else: - return True - else: - parent_smbl = self.symbols[ parent_smbl.classParentId ] - else: - return True - - self.logger.debug( 'scanning symbols table' ) - - self.logger.debug( 'looking for scopes' ) - names = set() - for index, smbl in enumerate( itertools.ifilter( ns_filter, self.symbols.itervalues() ) ): - if index and ( index % 10000 == 0 ): - self.logger.debug( '%d symbols scanned', index ) - name_splitter = impl_details.get_name_splitter( smbl.uname ) - for sn in name_splitter.scope_names: - if '<' in sn: - break - else: - names.add( sn ) - names = list( names ) - names.sort() - self.logger.debug( 'looking for scopes - done' ) - - nss = {'': self.__global_ns} - - self.logger.debug( 'building namespace objects' ) - for ns_name in itertools.ifilterfalse( self.__find_udt, names ): - self.logger.debug( 'inserting ns "%s" into declarations tree', ns_name ) - name_splitter = impl_details.get_name_splitter( ns_name ) - if not name_splitter.scope_names: - parent_ns = self.global_ns - else: - parent_ns = nss.get( name_splitter.scope_names[-1], None ) - if not parent_ns: - continue #in this case the parent scope is UDT - ns_decl = declarations.namespace_t( name_splitter.name ) - ns_decl.compiler = self.COMPILER - ns_decl.mangled = ns_decl.name - ns_decl.demangled = ns_decl.name - parent_ns.adopt_declaration( ns_decl ) - nss[ ns_name ] = ns_decl - self.logger.debug( 'inserting ns "%s" into declarations tree - done', ns_name ) - self.logger.debug( 'building namespace objects - done' ) - - self.logger.debug( 'scanning symbols table - done' ) - - def __update_decls_tree( self, decl ): - #~ if decl.name == 'money_base' and isinstance( decl, declarations.class_t ): - #~ pdb.set_trace() - smbl = decl.dia_symbols[0] - if smbl.classParentId in self.__id2decl: - self.__adopt_declaration( self.__id2decl[smbl.classParentId], decl ) - else: - name_splitter = impl_details.get_name_splitter( smbl.uname ) - if not name_splitter.scope_names: - self.__adopt_declaration( self.global_ns, decl ) - else: - parent_name = '::' + name_splitter.scope_names[-1] - try: - parent = self.global_ns.decl( parent_name ) - except: - declarations.print_declarations( self.global_ns ) - print 'identifiers:' - for index, identifier in enumerate(name_splitter.identifiers): - print index, ':', identifier - raise - self.__adopt_declaration( parent, decl ) - - def __adopt_declaration( self, parent, decl ): - smbl = decl.dia_symbols[0] - already_added = parent.decls( decl.name, decl_type=decl.__class__, recursive=False, allow_empty=True ) - if not already_added: - if isinstance( parent, declarations.namespace_t ): - parent.adopt_declaration( decl ) - else: - parent.adopt_declaration( decl, self.__guess_access_type( smbl ) ) - self.__id2decl[ smbl.symIndexId ] = decl - else: - for other_decl in already_added: - if self.__is_same_smbls( other_decl, decl ): - other_decl.dia_symbols.append( smbl ) - self.__id2decl[ smbl.symIndexId ] = other_decl - return - else: - if isinstance( parent, declarations.namespace_t ): - parent.adopt_declaration( decl ) - else: - parent.adopt_declaration( decl, self.__guess_access_type( smbl ) ) - self.__id2decl[ smbl.symIndexId ] = decl - - def __guess_access_type( self, smbl ): - if enums.CV_access_e.CV_private == smbl.access: - return declarations.ACCESS_TYPES.PRIVATE - elif enums.CV_access_e.CV_protected == smbl.access: - return declarations.ACCESS_TYPES.PROTECTED - else: - fully_undecorated_name = smbl.undecorate_name() - if fully_undecorated_name.startswith( 'private:' ): - declarations.ACCESS_TYPES.PRIVATE - elif fully_undecorated_name.startswith( 'protected:' ): - declarations.ACCESS_TYPES.PROTECTED - else: - return declarations.ACCESS_TYPES.PUBLIC - - class parent_exists_t: - def __init__( self, global_ns, classes, id2decl ): - self.global_ns = global_ns - self.classes = classes - self.id2decl = id2decl - self.__parent_exist = set() - - def __call__( self, decl ): - smbl = decl.dia_symbols[0] - if smbl.classParent: - if smbl.classParentId in self.id2decl: - return True - else: - return False - if self.classes.has_key( smbl.classParentId ): - return False - name_splitter = impl_details.get_name_splitter( smbl.uname ) - if not name_splitter.scope_names: - return True #global namespace - else: - #print "I am here " + '::' + name_splitter.scope_names[-1] - parent_name = '::' + name_splitter.scope_names[-1] - if parent_name in self.__parent_exist: - return True - found = self.global_ns.decls( parent_name - , decl_type=declarations.scopedef_t - , allow_empty=True - , recursive=True ) - if found: - self.__parent_exist.add( parent_name ) - return bool( found ) - - def __clear_symbols(self): - self.logger.info( 'clearing symbols' ) - to_be_deleted = [] - useless_tags = ( - msdia.SymTagAnnotation - , msdia.SymTagPublicSymbol - , msdia.SymTagBlock - , msdia.SymTagFuncDebugStart - , msdia.SymTagFuncDebugEnd - ) - for smbl_id, smbl in self.symbols.iteritems(): - if smbl.symTag in useless_tags \ - or ( smbl.symTag == msdia.SymTagData and not self.__is_my_var( smbl ) ): - to_be_deleted.append( smbl_id ) - - map( lambda smbl_id: self.symbols.pop( smbl_id ), to_be_deleted ) - self.logger.info( 'clearing symbols(%d) - done', len( to_be_deleted ) ) - - - def __normalize_name( self, decl ): - if decl.name == '': - decl.name = '' - elif decl.name.startswith( '?' ): - decl.name = '' - elif isinstance( decl, declarations.namespace_t ) and 'anonymous-namespace' in decl.name: - decl.name = '' - else: - pass - - def __join_unnamed_nss( self, ns_parent ): - child_nss = ns_parent.namespaces( name='', recursive=False, allow_empty=True ) - if len(child_nss) > 1: - alive_ns = child_nss[0] - dead_nss = child_nss[1:] - for dead_ns in dead_nss: - decls = dead_ns.decls( recursive=False, allow_empty=True ) - map( dead_ns.remove_declaration, decls ) - map( alive_ns.adopt_declaration, decls ) - map( ns_parent.remove_declaration, dead_nss ) - map( self.__join_unnamed_nss - , ns_parent.namespaces( recursive=False, allow_empty=True ) ) - - - def read(self): - self.__clear_symbols() - self.__load_nss() - self.__load_classes() - self.__load_base_classes() - self.__load_enums() - self.__load_vars() - self.__load_typedefs() - self.__load_calldefs() - map( self.__normalize_name, self.global_ns.decls(recursive=True) ) - self.__join_unnamed_nss( self.global_ns ) - #join unnamed namespaces - - @property - def dia_global_scope(self): - return self.__dia_session.globalScope - - @property - def global_ns(self): - return self.__global_ns - - def __is_same_smbls( self, decl1, decl2 ): - if not( decl1.__class__ is decl2.__class__ ): - return False - if decl1.name == decl2.name: - if isinstance( decl1, declarations.calldef_t ): - #TODO: well, I will have to fix this someday - return False - else: - return True - else: - return False - #~ return self.__dia_session.symsAreEquiv( decl1.dia_symbols[0], decl2.dia_symbols[0] ) - - def __find_udt( self, name ): - self.logger.debug( 'testing whether name( "%s" ) is UDT symbol' % name ) - flags = enums.NameSearchOptions.nsfCaseSensitive - found = self.dia_global_scope.findChildren( msdia.SymTagUDT, name, flags ) - if found.Count == 1: - self.logger.debug( 'name( "%s" ) is UDT symbol' % name ) - return as_symbol( found.Item(0) ) - elif 1 < found.Count: - raise RuntimeError( "duplicated UDTs with name '%s', were found" % name ) - #~ self.logger.debug( 'name( "%s" ) is UDT symbol' % name ) - #~ return [as_symbol( s ) for s in iter(found)] - #~ for s in iter(found): - #~ s = - #~ print s.name - #~ print impl_details.guess_class_type(s.udtKind) - else: - self.logger.debug( 'name( "%s" ) is **NOT** UDT symbol' % name ) - return None - - def __update_decl( self, decl, smbl ): - decl.dia_symbols = [smbl] - decl.compiler = self.COMPILER - if not isinstance( decl, declarations.typedef_t ): - decl.byte_size = smbl.length - decl.byte_offset = smbl.offset - decl.mangled = iif( smbl.get_undecoratedNameEx(0), smbl.name, '' ) - decl.demangled = iif( smbl.uname, smbl.uname, '' ) - decl.is_artificial = bool( smbl.compilerGenerated ) - decl.location = declarations.location_t( smbl.lexicalParent.sourceFileName ) - - - def __load_classes( self ): - classes = {}#unique symbol id : class decl - is_udt = lambda smbl: smbl.symTag == msdia.SymTagUDT - self.logger.info( 'building udt objects' ) - for udt_smbl in itertools.ifilter( is_udt, self.symbols.itervalues() ): - classes[udt_smbl.symIndexId] = self.__create_class(udt_smbl) - self.logger.info( 'building udt objects(%d) - done', len(classes) ) - - self.logger.info( 'integrating udt objects with namespaces' ) - does_parent_exists = self.parent_exists_t( self.global_ns, classes, self.__id2decl ) - while classes: - to_be_integrated = len( classes ) - self.logger.info( 'there are %d classes to go', len( classes ) ) - to_be_deleted = filter( does_parent_exists, classes.itervalues() ) - map( self.__update_decls_tree, to_be_deleted ) - map( lambda decl: classes.pop( decl.dia_symbols[0].symIndexId ) - , to_be_deleted ) - if not ( to_be_integrated - len( classes ) ): - for cls in classes.itervalues(): - self.logger.warning( 'unable to integrate class "%s" into declarations tree', cls.dia_symbols[0].uname ) - break - self.logger.info( 'integrating udt objects with namespaces - done' ) - - def __load_base_classes( self ): - make_hi = declarations.hierarchy_info_t - is_base_class = lambda smbl: smbl.symTag == msdia.SymTagBaseClass \ - and False == smbl.indirectVirtualBaseClass - self.logger.info( 'building class hierarchies' ) - for count, smbl in enumerate( itertools.ifilter( is_base_class, self.symbols.itervalues() ) ): - base_id = smbl.type.symIndexId - derived_id = smbl.classParentId - - hi_base = make_hi( self.__id2decl[base_id] - , self.__guess_access_type( smbl ) - , bool( smbl.virtualBaseClass ) ) - self.__id2decl[ derived_id ].bases.append( hi_base ) - - hi_derived = make_hi( self.__id2decl[derived_id] - , self.__guess_access_type( smbl ) - , bool( smbl.virtualBaseClass ) ) - self.__id2decl[ base_id ].derived.append( hi_derived ) - - self.logger.info( 'building class hierarchies(%d) - done', count ) - - def __load_enums( self ): - is_enum = lambda smbl: smbl.symTag == msdia.SymTagEnum - self.logger.info( 'building enum objects' ) - for enums_count, enum_smbl in enumerate( itertools.ifilter( is_enum, self.symbols.itervalues() ) ): - enum_decl = self.__create_enum(enum_smbl) - if not enum_decl: - continue - self.__update_decls_tree( enum_decl ) - self.logger.info( 'building enum objects(%d) - done', enums_count ) - - def __create_enum( self, enum_smbl ): - name_splitter = impl_details.get_name_splitter( enum_smbl.uname ) - self.logger.debug( 'working on enum %s', enum_smbl.uname ) - enum_decl = declarations.enumeration_t( name_splitter.name ) - self.__update_decl( enum_decl, enum_smbl ) - - values = enum_smbl.findChildren( msdia.SymTagData, None, 0 ) - for v in itertools.imap(as_symbol, values): - if v.classParent.symIndexId != enum_smbl.symIndexId: - continue - enum_decl.append_value( v.name, v.value ) - if enum_decl.values: - return enum_decl - else: - #for some reason same enum could appear under global namespace and - #under the class, it was defined in. This is a criteria I use to distinguish - #between those cases - return None - - def __create_class( self, class_smbl ): - name_splitter = impl_details.get_name_splitter( class_smbl.uname ) - class_decl = declarations.class_t( name_splitter.name ) - self.__update_decl( class_decl, class_smbl ) - class_decl.class_type = impl_details.guess_class_type(class_smbl.udtKind) - return class_decl - - def __is_my_var( self, smbl ): - #I am only interested in global and class variables - if smbl.symTag != msdia.SymTagData: - return False - if not smbl.uname: - return False - if smbl.classParentId not in self.symbols: - return True #global scope - parent_smbl = self.symbols[ smbl.classParentId ] - return bool( parent_smbl.symTag == msdia.SymTagUDT ) - - def __load_vars( self ): - self.logger.info( 'building variable objects' ) - - for vars_count, var_smbl in enumerate( itertools.ifilter( self.__is_my_var, self.symbols.itervalues() ) ): - var_decl = self.__create_var(var_smbl) - if var_decl: - self.__update_decls_tree( var_decl ) - self.logger.info( 'building variable objects(%d) - done', vars_count ) - - def __create_var( self, smbl ): - self.logger.debug( 'creating variable "%s"', smbl.uname ) - name_splitter = impl_details.get_name_splitter( smbl.uname ) - decl = declarations.variable_t( name_splitter.name ) - self.__update_decl( decl, smbl ) - decl.type = self.create_type( smbl.type ) - decl.value = str(smbl.value) - self.logger.debug( 'creating variable "%s" - done', smbl.uname ) - return decl - - def __load_typedefs( self ): - self.logger.info( 'building typedef objects' ) - is_typedef = lambda smbl: smbl.symTag == msdia.SymTagTypedef - for typedefs_count, typedef_smbl in enumerate( itertools.ifilter( is_typedef, self.symbols.itervalues() ) ): - typedef_decl = self.__create_typedef(typedef_smbl) - self.__update_decls_tree( typedef_decl ) - self.logger.info( 'building typedef objects(%d) - done', typedefs_count ) - - def __create_typedef( self, smbl ): - self.logger.debug( 'creating typedef "%s"', smbl.uname ) - name_splitter = impl_details.get_name_splitter( smbl.uname ) - decl = declarations.typedef_t( name_splitter.name - , self.create_type( smbl.type ) ) - self.__update_decl( decl, smbl ) - self.logger.debug( 'creating typedef "%s" - done', smbl.uname ) - return decl - - def __load_calldefs( self ): - self.logger.info( 'building function objects' ) - is_function = lambda smbl: smbl.symTag == msdia.SymTagFunction - for functions_count, function_smbl in enumerate( itertools.ifilter( is_function, self.symbols.itervalues() ) ): - function_decl = self.__create_calldef(function_smbl) - if function_decl: - self.__update_decls_tree( function_decl ) - self.logger.info( 'building function objects(%d) - done', functions_count ) - - def __guess_operator_type( self, smbl, operator_type ): - #assumption: the code deals with correct code - if not smbl.uname.startswith( 'operator' ) or smbl.uname == 'operator': - return None - oper_smbls = ('!', ' ', '*', '%', '&', '(', '+', '-', ',', '/', '|', '~', '[', '^', '=', '<') - if smbl.uname[ len( 'operator' ) ] not in oper_smbls: - return None - if smbl.uname[ len( 'operator' ) ] == ' ' \ - and smbl.uname not in ['operator new', 'operator delete']: - #we have casting operator - return declarations.casting_operator_t() - if isinstance( operator_type, declarations.member_function_type_t ): - return declarations.member_operator_t() - else: - return declarations.free_operator_t() - - def __guess_constructor( self, smbl, calldef_type ): - tmpls = declarations.templates - class_ = declarations.remove_declarated( calldef_type.class_inst ) - if class_.name == smbl.uname \ - or ( tmpls.is_instantiation( class_.name ) - and tmpls.name( class_.name ) == smbl.uname ): - calldef_type.return_type = None - return declarations.constructor_t() - - def __create_calldef( self, smbl ): - self.logger.debug( 'creating calldef "%s"', smbl.uname ) - #~ if smbl.uname == 'some_function': - #~ pdb.set_trace() - name_splitter = impl_details.get_name_splitter( smbl.uname ) - calldef_type = self.create_type( smbl.type ) #what does happen with constructor? - decl = None - if isinstance( calldef_type, declarations.member_function_type_t ): - could_be_static = False - could_be_const = False - if smbl.uname.startswith( '~' ): - decl = declarations.destructor_t() - if not decl: #may be operator - decl = self.__guess_operator_type(smbl, calldef_type) - could_be_static = True - could_be_const = True - if not decl: #may be constructor - decl = self.__guess_constructor( smbl, calldef_type ) - if not decl: - decl = declarations.member_function_t() - could_be_static = True - could_be_const = True - if smbl.virtual: - decl.virtuality = iif( smbl.pure - , declarations.VIRTUALITY_TYPES.PURE_VIRTUAL - , declarations.VIRTUALITY_TYPES.VIRTUAL ) - decl.has_const = bool( could_be_const and smbl.constType ) - decl.has_static = bool( could_be_static and smbl.isStatic ) - else: - decl = self.__guess_operator_type(smbl, calldef_type) - if not decl: - if 'instantiate::`dynamic initializer for' in smbl.uname: - return #in this case we deal with initializer of some global variable - decl = declarations.free_function_t() - decl.name = smbl.uname - decl.arguments = map( lambda t: declarations.argument_t( type=t ) - , calldef_type.arguments_types ) - - args_smbls = map( as_symbol, smbl.findChildren( msdia.SymTagData, None, 0 ) ) - args_smbls = filter( lambda smbl: smbl.dataKind == enums.DataKind.DataIsParam, args_smbls ) - - for index, arg_smbl in enumerate( args_smbls ): - arg_decl = decl.arguments[index] - arg_decl.name = arg_smbl.name - arg_decl.default_value = arg_smbl.value - decl.return_type = calldef_type.return_type - - self.__update_decl( decl, smbl ) - self.logger.debug( 'creating calldef "%s" - done', smbl.uname ) - return decl - - def __create_function_type( self, smbl ): - return_type = self.create_type( smbl.type ) - args_smbls = smbl.findChildren( msdia.SymTagFunctionArgType, None, 0 ) - args_types = map( self.create_type, itertools.imap(as_symbol, args_smbls) ) - if smbl.objectPointerType: - try: - class_ = self.create_type( smbl.objectPointerType ) - class_ = declarations.base_type( class_ ) - #~ pdb.set_trace() - return declarations.member_function_type_t( class_, return_type, args_types ) - except: - self.logger.warning( 'unable to find out the type of the object pointer for a class method.' ) - return declarations.unknown_t() - else: - return declarations.free_function_type_t( return_type, args_types ) - - def create_type( self, smbl ): - #http://msdn2.microsoft.com/en-us/library/s3f49ktz(VS.80).aspx - if smbl.symIndexId in self.__types_cache: - return self.__types_cache[smbl.symIndexId] - my_type = None - if msdia.SymTagBaseType == smbl.symTag: - if enums.BasicType.btNoType == smbl.baseType: - my_type = declarations.unknown_t() - elif enums.BasicType.btVoid == smbl.baseType: - my_type = declarations.void_t() - elif enums.BasicType.btChar == smbl.baseType: - my_type = declarations.char_t() - elif enums.BasicType.btWChar == smbl.baseType: - my_type = declarations.wchar_t() - elif smbl.baseType in ( enums.BasicType.btInt, enums.BasicType.btLong ): - if 8 == smbl.length: - my_type = declarations.long_long_int_t() - elif 4 == smbl.length: - my_type = declarations.int_t() #long_int_t - elif 2 == smbl.length: - my_type = declarations.short_int_t() - else: - my_type = declarations.int_t() - elif enums.BasicType.btUInt == smbl.baseType: - if 2 == smbl.length: - my_type = declarations.short_unsigned_int_t() - else: - my_type = declarations.unsigned_int_t() - elif enums.BasicType.btFloat == smbl.baseType: - if 8 == smbl.length: - my_type = declarations.double_t() - else: - my_type = declarations.float_t() - elif enums.BasicType.btBCD == smbl.baseType: - my_type = declarations.unknown_t() - elif enums.BasicType.btBool == smbl.baseType: - my_type = declarations.bool_t() - elif enums.BasicType.btULong == smbl.baseType: - if 8 == smbl.length: - my_type = declarations.long_long_unsigned_int_t() - else: - my_type = declarations.long_unsigned_int_t() - elif enums.BasicType.btCurrency == smbl.baseType: - my_type = declarations.unknown_t() - elif enums.BasicType.btDate == smbl.baseType: - my_type = declarations.double_t() - elif enums.BasicType.btVariant == smbl.baseType: - my_type = declarations.unknown_t() - elif enums.BasicType.btComplex == smbl.baseType: - my_type = declarations.complex_double_t() - elif enums.BasicType.btBit == smbl.baseType: - my_type = declarations.unknown_t() - elif enums.BasicType.btBSTR == smbl.baseType: - my_type = declarations.unknown_t() - elif enums.BasicType.btHresult == smbl.baseType: - my_type = declarations.long_int_t() - else: - my_type = declarations.unknown_t() - elif msdia.SymTagPointerType == smbl.symTag: - base_type = self.create_type( smbl.type ) - if smbl.reference: - my_type = declarations.reference_t( base_type ) - else: - my_type = declarations.pointer_t( base_type ) - elif msdia.SymTagArrayType == smbl.symTag: - element_type = self.create_type( smbl.type ) - size = declarations.array_t.SIZE_UNKNOWN - if smbl.count: - size = smbl.count - #~ if smbl.length and element_type.byte_size: - #~ size = smbl.length / element_type.byte_size - my_type = declarations.array_t( element_type, size ) - elif smbl.symTag in ( msdia.SymTagUDT, msdia.SymTagTypedef, msdia.SymTagEnum ): - if smbl.symIndexId in self.__id2decl: - decl = self.__id2decl[ smbl.symIndexId ] - my_type = declarations.declarated_t( decl ) - else: - my_type = declarations.unknown_t() - elif msdia.SymTagFunctionArgType == smbl.symTag: - my_type = self.create_type( smbl.type ) - elif msdia.SymTagFunctionType == smbl.symTag: - my_type = self.__create_function_type( smbl ) - else: - my_type = declarations.unknown_t() - try: - my_type.byte_size = smbl.length - except AttributeError: - pass - if smbl.constType: - if isinstance( my_type, declarations.member_function_type_t ): - my_type.has_const = True - else: - if not isinstance( my_type, declarations.const_t ): - my_type = declarations.const_t( my_type ) - if smbl.volatileType: - if not isinstance( my_type, declarations.volatile_t ): - my_type = declarations.volatile_t( my_type ) - return my_type diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/config.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/config.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/config.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/config.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,192 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""This module contains the implementation of the L{config_t} class. -""" - -import os -import sys -import copy - -class parser_configuration_t(object): - """Configuration object to collect parameters for invoking C++ parser - - This class serves as a base class for the parameters that can be used - to customize the call to C++ parser. This class also allows users to work with - relative files paths. In this case files are searched in the following order: - - 1. current directory - - 2. working directory - - 3. additional include paths specified by the user - - """ - def __init__( self - , working_directory='.' - , include_paths=None - , define_symbols=None - , undefine_symbols=None - , cflags="" - , compiler=None): - """Constructor. - """ - object.__init__( self ) - self.__working_directory = working_directory - - if not include_paths: - include_paths = [] - self.__include_paths = include_paths - - if not define_symbols: - define_symbols = [] - self.__define_symbols = define_symbols - - if not undefine_symbols: - undefine_symbols = [] - self.__undefine_symbols = undefine_symbols - - self.__cflags = cflags - - self.__compiler = compiler - - def clone(self): - raise NotImplementedError( self.__class__.__name__ ) - - def __get_working_directory(self): - return self.__working_directory - def __set_working_directory(self, working_dir): - self.__working_directory=working_dir - working_directory = property( __get_working_directory, __set_working_directory ) - - @property - def include_paths(self): - """list of include paths to look for header files""" - return self.__include_paths - - @property - def define_symbols(self): - """list of "define" directives """ - return self.__define_symbols - - @property - def undefine_symbols(self): - """list of "undefine" directives """ - return self.__undefine_symbols - - @property - def compiler(self): - """compiler name to simulate""" - return self.__compiler - - def __get_cflags(self): - return self.__cflags - def __set_cflags(self, val): - self.__cflags = val - cflags = property( __get_cflags, __set_cflags - , doc="additional flags to pass to compiler" ) - - def __ensure_dir_exists( self, dir_path, meaning ): - if os.path.isdir( dir_path ): - return - msg = None - if os.path.exists( self.working_directory ): - raise RuntimeError( '%s("%s") does not exist!' % ( meaning, dir_path ) ) - else: - raise RuntimeError( '%s("%s") should be "directory", not a file.' % ( meaning, dir_path ) ) - - - def raise_on_wrong_settings( self ): - """validates the configuration settings and raises RuntimeError on error""" - self.__ensure_dir_exists( self.working_directory, 'working directory' ) - map( lambda idir: self.__ensure_dir_exists( idir, 'include directory' ) - , self.include_paths ) - - -class gccxml_configuration_t(parser_configuration_t): - """Configuration object to collect parameters for invoking gccxml. - - This class serves as a container for the parameters that can be used - to customize the call to gccxml. - """ - def __init__( self - , gccxml_path='' - , working_directory='.' - , include_paths=None - , define_symbols=None - , undefine_symbols=None - , start_with_declarations=None - , ignore_gccxml_output=False - , cflags="" - , compiler=None): - """Constructor. - """ - parser_configuration_t.__init__( self - , working_directory=working_directory - , include_paths=include_paths - , define_symbols=define_symbols - , undefine_symbols=undefine_symbols - , cflags=cflags - , compiler=compiler) - - self.__gccxml_path = gccxml_path - - if not start_with_declarations: - start_with_declarations = [] - self.__start_with_declarations = start_with_declarations - - self.__ignore_gccxml_output = ignore_gccxml_output - - def clone(self): - return copy.deepcopy( self ) - - def __get_gccxml_path(self): - return self.__gccxml_path - def __set_gccxml_path(self, new_path ): - self.__gccxml_path = new_path - gccxml_path = property( __get_gccxml_path, __set_gccxml_path - , doc="gccxml binary location" ) - - @property - def start_with_declarations(self): - """list of declarations gccxml should start with, when it dumps declaration tree""" - return self.__start_with_declarations - - def __get_ignore_gccxml_output(self): - return self.__ignore_gccxml_output - def __set_ignore_gccxml_output(self, val=True): - self.__ignore_gccxml_output = val - ignore_gccxml_output = property( __get_ignore_gccxml_output, __set_ignore_gccxml_output - , doc="set this property to True, if you want pygccxml to ignore any error\\warning that comes from gccxml" ) - - - def raise_on_wrong_settings( self ): - return - super( gccxml_configuration_t, self ).raise_on_wrong_settings() - if os.path.isfile( self.gccxml_path ): - return - if sys.platform == 'win32': - gccxml_name = 'gccxml' + '.exe' - environment_var_delimiter = ';' - elif sys.platform == 'linux2' or sys.platform == 'darwin': - gccxml_name = 'gccxml' - environment_var_delimiter = ':' - else: - raise RuntimeError( 'unable to find out location of gccxml' ) - may_be_gccxml = os.path.join( self.gccxml_path, gccxml_name ) - if os.path.isfile( may_be_gccxml ): - self.gccxml_path = may_be_gccxml - else: - for path in os.environ['PATH'].split( environment_var_delimiter ): - gccxml_path = os.path.join( path, gccxml_name ) - if os.path.isfile( gccxml_path ): - self.gccxml_path = gccxml_path - break - else: - msg = 'gccxml_path("%s") should exists or to be a valid file name.' \ - % self.gccxml_path - raise RuntimeError( msg ) - -config_t = gccxml_configuration_t #backward computability diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/declarations_cache.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/declarations_cache.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/declarations_cache.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/declarations_cache.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,240 +0,0 @@ -#! /usr/bin/python -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -try: - import hashlib as md5 -except: - import md5 -import time -import cPickle -from pygccxml import utils -import config as cxx_parsers_cfg - -def file_signature( filename ): - if not os.path.isfile( filename ): - return None - if not os.path.exists( filename ): - return None - # Extend here to use md5 hash for signature - # - This change allows duplicate autogenerated files to be recognized - #return os.path.getmtime( source ) - sig = md5.new() - f = file(filename,'r') - sig.update(f.read()) - f.close() - return sig.hexdigest() - -def configuration_signature( config ): - """ Return a signature for a configuration (config_t) - object. This can then be used as a key in the cache. - This method must take into account anything about - a configuration that could cause the declarations generated - to be different between runs. - """ - sig = md5.new() - if isinstance( config, cxx_parsers_cfg.gccxml_configuration_t ): - sig.update(str(config.gccxml_path)) - sig.update(str(config.working_directory)) - if isinstance( config, cxx_parsers_cfg.gccxml_configuration_t ): - sig.update(str(config.cflags)) - for p in config.include_paths: - sig.update(str(p)) - for s in config.define_symbols: - sig.update(str(s)) - for u in config.undefine_symbols: - sig.update(str(u)) - return sig.hexdigest() - -class cache_base_t( object ): - logger = utils.loggers.declarations_cache - - def __init__( self ): - object.__init__(self) - - def flush(self): - """ Flush (write out) the cache to disk if needed. """ - raise NotImplementedError() - - def update(self, source_file, configuration, declarations, included_files): - """ Update cache entry. - @param source_file: path to the C++ source file being parsed - @param configuration: configuration used in parsing (config_t) - @param declarations: declaration tree found when parsing - @param included_files: files included by parsing. - """ - raise NotImplementedError() - - def cached_value(self, source_file, configuration): - """ Return declarations we have cached for the source_file and configuration - given. - @param source_file: path to the C++ source file being parsed. - @param configuration: configuration to use for parsing (config_t) - """ - raise NotImplementedError() - -class record_t( object ): - def __init__( self - , source_signature - , config_signature - , included_files - , included_files_signature - , declarations ): - self.__source_signature = source_signature - self.__config_signature = config_signature - self.__included_files = included_files - self.__included_files_signature = included_files_signature - self.__declarations = declarations - self.__was_hit = True # Track if there was a cache hit - - def _get_was_hit(self): - return self.__was_hit - def _set_was_hit(self, was_hit): - self.__was_hit = was_hit - was_hit = property( _get_was_hit, _set_was_hit ) - - def key(self): - return ( self.__source_signature, self.__config_signature) - - @staticmethod - def create_key( source_file, configuration ): - return ( file_signature(source_file) - , configuration_signature(configuration)) - - def __source_signature(self): - return self.__source_signature - source_signature = property( __source_signature ) - - def __config_signature(self): - return self.__config_signature - config_signature = property( __config_signature ) - - def __included_files(self): - return self.__included_files - included_files = property( __included_files ) - - def __included_files_signature(self): - return self.__included_files_signature - included_files_signature = property( __included_files_signature ) - - def __declarations(self): - return self.__declarations - declarations = property( __declarations ) - -class file_cache_t( cache_base_t ): - """ Cache implementation to store data in a pickled form in a file. - This class contains some cache logic that keeps track of which entries - have been 'hit' in the cache and if an entry has not been hit then - it is deleted at the time of the flush(). This keeps the cache from - growing larger when files change and are not used again. - """ - - def __init__( self, name ): - """ - @param name: name of the cache file. - """ - cache_base_t.__init__( self ) - self.__name = name # Name of cache file - self.__cache = self.__load( self.__name ) # Map record_key to record_t - self.__needs_flushed = not bool( self.__cache ) # If empty then we need to flush - for entry in self.__cache.itervalues(): # Clear hit flags - entry.was_hit = False - - @staticmethod - def __load( file_name ): - " Load pickled cache from file and return the object. " - cache = None - if os.path.exists( file_name ) and not os.path.isfile( file_name ): - raise RuntimeError( 'Cache should be initialized with valid full file name' ) - if not os.path.exists( file_name ): - file( file_name, 'w+b' ).close() - return {} - cache_file_obj = file( file_name, 'rb' ) - try: - file_cache_t.logger.info( 'Loading cache file "%s".' % file_name ) - start_time = time.clock() - cache = cPickle.load( cache_file_obj ) - file_cache_t.logger.debug( "Cache file has been loaded in %.1f secs"%( time.clock() - start_time ) ) - file_cache_t.logger.debug( "Found cache in file: [%s] entries: %s" - % ( file_name, len( cache.keys() ) ) ) - except Exception, error: - file_cache_t.logger.exception( "Error occured while reading cache file: %s", error ) - cache_file_obj.close() - file_cache_t.logger.info( "Invalid cache file: [%s] Regenerating." % file_name ) - file(file_name, 'w+b').close() # Create empty file - cache = {} # Empty cache - return cache - - def flush(self): - # If not marked as needing flushed, then return immediately - if not self.__needs_flushed: - self.logger.debug("Cache did not change, ignoring flush.") - return - - # Remove entries that did not get a cache hit - num_removed = 0 - for key in self.__cache.keys(): - if not self.__cache[key].was_hit: - num_removed += 1 - del self.__cache[key] - if num_removed > 0: - self.logger.debug( "There are %s removed entries from cache." % num_removed ) - # Save out the cache to disk - cache_file = file( self.__name, 'w+b' ) - cPickle.dump( self.__cache, cache_file, cPickle.HIGHEST_PROTOCOL ) - cache_file.close() - - def update(self, source_file, configuration, declarations, included_files): - """ Update a cached record with the current key and value contents. """ - record = record_t( source_signature=file_signature(source_file) - , config_signature=configuration_signature(configuration) - , included_files=included_files - , included_files_signature=map( file_signature, included_files) - , declarations=declarations - ) - # Switched over to holding full record in cache so we don't have - # to keep creating records in the next method. - self.__cache[ record.key() ] = record - self.__cache[ record.key() ].was_hit = True - self.__needs_flushed = True - - def cached_value(self, source_file, configuration): - """ Attempt to lookup the cached decls for the given file and configuration. - If not found or signature check fails, returns None. - """ - key = record_t.create_key(source_file, configuration) - if not self.__cache.has_key( key ): - return None - record = self.__cache[key] - if self.__is_valid_signature( record ): - record.was_hit = True # Record cache hit - return record.declarations - else: #some file has been changed - del self.__cache[key] - return None - - def __is_valid_signature( self, record ): - # This is now part of key - #if self.__signature( record.source_file ) != record.source_file_signature: - # return False - for index, included_file in enumerate( record.included_files ): - if file_signature( included_file ) != record.included_files_signature[index]: - return False - return True - - -class dummy_cache_t( cache_base_t ): - def __init__( self ): - cache_base_t.__init__(self) - - def flush(self): - pass - - def update(self, source_file, configuration, declarations, included_files): - pass - - def cached_value(self, source_file, configuration): - return None diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/directory_cache.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/directory_cache.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/directory_cache.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/directory_cache.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,531 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) -# -# The initial version of the directory_cache_t class was written -# by Matthias Baas (baas@ira.uka.de). - -"""Directory cache implementation. - -This module contains the implementation of a cache that uses individual -files stored in a dedicated cache directory to store the cached contents. -The cache class is L{directory_cache_t} which can be passed to the C{cache} -argument of the L{parse()} function. -""" - -import os, os.path, gzip -try: - import hashlib as md5 -except: - import md5 -import cPickle -import declarations_cache - -class index_entry_t: - """Entry of the index table in the directory cache index. - - Each cached header file (i.e. each *.cache file) has a corresponding - index_entry_t object. This object is used to determine whether the - cache file with the declarations is still valid or not. - - This class is a helper class for the directory_cache_t class. - """ - - def __init__( self, filesigs, configsig ): - """Constructor. - - filesigs is a list of tuples (fileid, sig)... - configsig is the signature of the configuration object. - """ - self.filesigs = filesigs - self.configsig = configsig - - def __getstate__(self): - return (self.filesigs, self.configsig) - - def __setstate__(self, state): - self.filesigs, self.configsig = state - - -class directory_cache_t ( declarations_cache.cache_base_t ): - """Cache class that stores its data as multiple files inside a directory. - - The cache stores one index file called "index.dat" which is always - read by the cache when the cache object is created. Each header file - will have its corresponding *.cache file that stores the declarations - found in the header file. The index file is used to determine whether - a *.cache file is still valid or not (by checking if one of the dependent - files (i.e. the header file itself and all included files) have been - modified since the last run). - """ - - def __init__( self, dir="cache", compression=False, md5_sigs=True ): - """Constructor. - - dir is the cache directory (it is created if it does not exist). - If compression is set to True the cache files will be compressed - using gzip. - md5_sigs determines whether file modifications is checked by - computing a md5 digest or by checking the modification date. - """ - declarations_cache.cache_base_t.__init__(self) - - # Cache directory - self.__dir = os.path.abspath(dir) - - # Flag that determines whether the cache files will be compressed - self.__compression = compression - - # Flag that determines whether the signature is a md5 digest or - # the modification time - # (this flag is passed to the filename_repository_t class) - self.__md5_sigs = md5_sigs - - # Filename repository - self.__filename_rep = filename_repository_t(self.__md5_sigs) - - # Index dictionary (Key is the value returned by _create_cache_key() - # (which is based on the header file name) and value is an - # index_entry_t object) - self.__index = {} - - # Flag that indicates whether the index was modified - self.__modified_flag = False - - # Check if dir refers to an existing file... - if os.path.isfile(self.__dir): - raise ValueError, "Cannot use %s as cache directory. There is already a file with that name."%self.__dir - - # Load the cache or create the cache directory... - if os.path.isdir(self.__dir): - self._load() - else: - # Create the cache directory... - os.mkdir(self.__dir) - - def flush(self): - """Save the index table to disk.""" - - self._save() -# self.__filename_rep._dump() - - def update(self, source_file, configuration, declarations, included_files): - """Replace a cache entry by a new value. - - @param source_file: Header file name. - @type source_file: str - @param configuration: Configuration object. - @type configuration: L{config_t} - @param declarations: Declarations contained in the header file. - @type declarations: picklable object - @param included_files: Dependent files - @type included_files: list of str - """ - # Normlize all paths... - source_file = os.path.normpath(source_file) - included_files = map(lambda p: os.path.normpath(p), included_files) - - # Create the list of dependent files. This is the included_files list - # + the source file. Duplicate names are removed. - dependent_files = {} - for name in [source_file]+included_files: - dependent_files[name] = 1 - dependent_files = dependent_files.keys() - - key = self._create_cache_key(source_file) - # Remove an existing entry (if there is one) - # After calling this method, it is guaranteed that __index[key] - # does not exist anymore. - self._remove_entry(source_file, key) - - # Create a new entry... - - # Create the sigs of all dependent files... - filesigs = [] - for filename in dependent_files: - id_,sig = self.__filename_rep.acquire_filename(filename) - filesigs.append((id_,sig)) - - configsig = self._create_config_signature(configuration) - entry = index_entry_t(filesigs, configsig) - self.__index[key] = entry - self.__modified_flag = True - - # Write the declarations into the cache file... - cachefilename = self._create_cache_filename(source_file) - self._write_file(cachefilename, declarations) - - - def cached_value(self, source_file, configuration): - """Return the cached declarations or None. - - @param source_file: Header file name - @type source_file: str - @param configuration: Configuration object - @type configuration: L{config_t} - @return: Cached declarations or None - """ - - # Check if the cache contains an entry for source_file - key = self._create_cache_key(source_file) - entry = self.__index.get(key) - if entry==None: -# print "CACHE: %s: Not cached"%source_file - return None - - # Check if the entry is still valid. It is not valid if: - # - the source_file has been updated - # - the configuration object has changed (i.e. the header is parsed - # by gccxml with different settings which may influence the - # declarations) - # - the included files have been updated - # (this list is part of the cache entry as it cannot be known - # by the caller when cached_value() is called. It was instead - # passed to update()) - - # Check if the config is different... - configsig = self._create_config_signature(configuration) - if configsig!=entry.configsig: -# print "CACHE: %s: Config mismatch"%source_file - return None - - # Check if any of the dependent files has been modified... - for id_, sig in entry.filesigs: - if self.__filename_rep.is_file_modified(id_, sig): -# print "CACHE: %s: Entry not up to date"%source_file - return None - - # Load and return the cached declarations - cachefilename = self._create_cache_filename(source_file) - decls = self._read_file(cachefilename) - -# print "CACHE: Using cached decls for",source_file - return decls - - def _load(self): - """Load the cache. - - Loads the file index.dat which contains the index table and - the file name repository. - - This method is called by the constructor. - """ - - indexfilename = os.path.join(self.__dir, "index.dat") - if os.path.exists(indexfilename): - data = self._read_file(indexfilename) - self.__index = data[0] - self.__filename_rep = data[1] - if self.__filename_rep._md5_sigs!=self.__md5_sigs: - print "CACHE: Warning: md5_sigs stored in the cache is set to %s."%self.__filename_rep._md5_sigs - print " Please remove the cache to change this setting." - self.__md5_sigs = self.__filename_rep._md5_sigs - else: - self.__index = {} - self.__filename_rep = filename_repository_t(self.__md5_sigs) - - self.__modified_flag = False - - def _save(self): - """Save the cache index if it was modified. - - Saves the index table and the file name repository in the file - index.dat. - """ - if self.__modified_flag: - self.__filename_rep.update_id_counter() - indexfilename = os.path.join(self.__dir, "index.dat") - self._write_file(indexfilename, (self.__index,self.__filename_rep)) - self.__modified_flag = False - - def _read_file(self, filename): - """Read a Python object from a cache file. - - Reads a pickled object from disk and returns it. - - @param filename: Name of the file that should be read. - @type filename: str - @returns: Unpickled file contents - """ - if self.__compression: - f = gzip.GzipFile(filename, "rb") - else: - f = file(filename, "rb") - res = cPickle.load(f) - f.close() - return res - - def _write_file(self, filename, data): - """Write a data item into a file. - - The data object is written to a file using the pickle mechanism. - - @param filename: Output file name - @type filename: str - @param data: A Python object that will be pickled - @type data: picklable object - """ - if self.__compression: - f = gzip.GzipFile(filename, "wb") - else: - f = file(filename, "wb") - cPickle.dump(data, f, cPickle.HIGHEST_PROTOCOL) - f.close() - - def _remove_entry(self, source_file, key): - """Remove an entry from the cache. - - source_file is the name of the header and key is its corresponding - cache key (obtained by a call to L{_create_cache_key()}). - The entry is removed from the index table, any referenced file - name is released and the cache file is deleted. - - If key references a non-existing entry, the method returns - immediately. - - @param source_file: Header file name - @type source_file: str - @param key: Key value for the specified header file - @type key: hashable object - """ - - entry = self.__index.get(key) - if entry==None: - return - - # Release the referenced files... - for id_, sig in entry.filesigs: - self.__filename_rep.release_filename(id_) - - # Remove the cache entry... - del self.__index[key] - self.__modified_flag = True - - # Delete the corresponding cache file... - cachefilename = self._create_cache_filename(source_file) - try: - os.remove(cachefilename) - except OSError, e: - print "Could not remove cache file (%s)"%e - - - def _create_cache_key(self, source_file): - """Return the cache key for a header file. - - @param source_file: Header file name - @type source_file: str - @returns: Key for the given header file - @rtype: str - """ - path, name = os.path.split(source_file) - return name+str(hash(path)) - - def _create_cache_filename(self, source_file): - """Return the cache file name for a header file. - - @param source_file: Header file name - @type source_file: str - @returns: Cache file name (*.cache) - @rtype: str - """ - res = self._create_cache_key(source_file)+".cache" - return os.path.join(self.__dir, res) - - def _create_config_signature(self, config): - """Return the signature for a config object. - - The signature is computed as md5 digest of the contents of - working_directory, include_paths, define_symbols and - undefine_symbols. - - @param config: Configuration object - @type config: L{config_t} - @returns: Signature - @rtype: str - """ - m = md5.new() - m.update(config.working_directory) - map(lambda p: m.update(p), config.include_paths) - map(lambda p: m.update(p), config.define_symbols) - map(lambda p: m.update(p), config.undefine_symbols) - map(lambda p: m.update(p), config.cflags) - return m.digest() - - - - -class filename_entry_t: - """This is a record stored in the filename_repository_t class. - - The class is an internal class used in the implementation of the - filename_repository_t class and it just serves as a container for - the file name and the reference count. - """ - - def __init__( self, filename ): - """Constructor. - - The reference count is initially set to 0. - """ - # Filename - self.filename = filename - # Reference count - self.refcount = 0 - - # Cached signature value for the file. - # If sig_valid flag is False, the signature still has to be computed, - # otherwise the cached value can be used. - # These attributes must not be pickled! - self.sig_valid = False - self.signature = None - - def __getstate__(self): - # Only pickle filename and refcount - return (self.filename, self.refcount) - - def __setstate__(self, state): - self.filename, self.refcount = state - self.sig_valid = False - self.signature = None - - def inc_ref_count(self): - """Increase the reference count by 1.""" - self.refcount += 1 - - def dec_ref_count(self): - """Decrease the reference count by 1 and return the new count.""" - self.refcount -= 1 - return self.refcount - - -class filename_repository_t: - """File name repository. - - This class stores file names and can check whether a file has been - modified or not since a previous call. - A file name is stored by calling acquire_filename() which returns - an ID and a signature of the file. The signature can later be used - to check if the file was modified by calling is_file_modified(). - If the file name is no longer required release_filename() should be - called so that the entry can be removed from the repository. - """ - - def __init__( self, md5_sigs ): - """Constructor. - """ - - # Flag that determines whether the signature is a md5 digest or - # the modification time - # (this flag is passed to the filename_repository_t class) - self._md5_sigs = md5_sigs - - # ID lookup table (key: filename / value: id_) - self.__id_lut = {} - - # Entry dictionary (key: id_ / value: filename_entry_t) - # This dictionary contains the actual data. - # It must always hold that each entry in __entries has a corresponding - # entry in __id_lut (i.e. the keys in __id_lut must be the names - # stored in __entries) - self.__entries = {} - - # A counter for new ids - self.__next_id = 1 - - def acquire_filename(self, name): - """Acquire a file name and return its id and its signature. - """ - id_ = self.__id_lut.get(name) - # Is this a new entry? - if id_==None: - # then create one... - id_ = self.__next_id - self.__next_id += 1 - self.__id_lut[name] = id_ - entry = filename_entry_t(name) - self.__entries[id_] = entry - else: - # otherwise obtain the entry... - entry = self.__entries[id_] - - entry.inc_ref_count() - return id_, self._get_signature(entry) - - def release_filename(self, id_): - """Release a file name. - """ - entry = self.__entries.get(id_) - if entry==None: - raise ValueError, "Invalid filename id (%d)"%id_ - - # Decrease reference count and check if the entry has to be removed... - if entry.dec_ref_count()==0: - del self.__entries[id_] - del self.__id_lut[entry.filename] - - def is_file_modified(self, id_, signature): - """Check if the file referred to by id_ has been modified. - """ - entry = self.__entries.get(id_) - if entry==None: - raise ValueError, "Invalid filename id_ (%d)"%id_ - - # Is the signature already known? - if entry.sig_valid: - # use the cached signature - filesig = entry.signature - else: - # compute the signature and store it - filesig = self._get_signature(entry) - entry.signature = filesig - entry.sig_valid = True - - return filesig!=signature - - def update_id_counter(self): - """Update the id_ counter so that it doesn't grow forever. - """ - if len(self.__entries)==0: - self.__next_id = 1 - else: - self.__next_id = max(self.__entries.keys())+1 - - def _get_signature(self, entry): - """Return the signature of the file stored in entry. - """ - if self._md5_sigs: - # return md5 digest of the file content... - if not os.path.exists(entry.filename): - return None - try: - f = file(entry.filename) - except IOError, e: - print "Cannot determine md5 digest:",e - return None - data = f.read() - f.close() - return md5.new(data).digest() - else: - # return file modification date... - try: - return os.path.getmtime(entry.filename) - except OSError, e: - return None - - def _dump(self): - """Dump contents for debugging/testing. - """ - - print 70*"-" - print "ID lookup table:" - for name in self.__id_lut: - id_ = self.__id_lut[name] - print " %s -> %d"%(name, id_) - - print 70*"-" - print "%-4s %-60s %s"%("ID", "Filename", "Refcount") - print 70*"-" - for id_ in self.__entries: - entry = self.__entries[id_] - print "%04d %-60s %d"%(id_, entry.filename, entry.refcount) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/etree_scanner.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/etree_scanner.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/etree_scanner.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/etree_scanner.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import scanner -import xml.etree.cElementTree as ElementTree - -class etree_saxifier_t(object): - def __init__(self, etree, handler): - self.__root_elem = etree.getroot() - self.__handler = handler - - def saxify(self): - self.__handler.startDocument() - self.__recursive_saxify( self.__root_elem ) - self.__handler.endDocument() - - def __recursive_saxify(self, element ): - self.__handler.startElement( element.tag, element.attrib ) - map( self.__recursive_saxify, element ) - self.__handler.endElement( element.tag ) - -class etree_scanner_t( scanner.scanner_t ): - def __init__(self, gccxml_file, decl_factory, *args ): - scanner.scanner_t.__init__( self, gccxml_file, decl_factory, *args ) - - def read( self ): - tree = ElementTree.parse( self.gccxml_file ) - saxifier = etree_saxifier_t( tree, self ) - saxifier.saxify() - -class ietree_scanner_t( scanner.scanner_t ): - def __init__(self, gccxml_file, decl_factory, *args ): - scanner.scanner_t.__init__( self, gccxml_file, decl_factory, *args ) - - def read( self ): - context = ElementTree.iterparse(self.gccxml_file, events=("start", "end")) - for event, elem in context: - if event == 'start': - self.startElement( elem.tag, elem.attrib ) - else: - self.endElement( elem.tag ) - elem.clear() - self.endDocument() - -etree_scanner_t = ietree_scanner_t diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/__init__.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/__init__.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/__init__.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -"""Parser sub-package. -""" - -from config import config_t -from config import gccxml_configuration_t - -from project_reader import COMPILATION_MODE -from project_reader import project_reader_t -from project_reader import file_configuration_t -from project_reader import create_text_fc -from project_reader import create_source_fc -from project_reader import create_gccxml_fc -from project_reader import create_cached_source_fc - -from source_reader import source_reader_t -from source_reader import gccxml_runtime_error_t -from declarations_cache import cache_base_t -from declarations_cache import file_cache_t -from declarations_cache import dummy_cache_t -from directory_cache import directory_cache_t -#shortcut -CONTENT_TYPE = file_configuration_t.CONTENT_TYPE - - -def parse( files - , config=None - , compilation_mode=COMPILATION_MODE.FILE_BY_FILE - , cache=None ): - """Parse header files. - - @param files: The header files that should be parsed - @type files: list of str - @param config: Configuration object or None - @type config: L{config_t} - @param compilation_mode: Determines whether the files are parsed individually or as one single chunk - @type compilation_mode: L{COMPILATION_MODE} - @param cache: Declaration cache (None=no cache) - @type cache: L{cache_base_t} or str - @returns: Declarations - """ - - if not config: - config = config_t() - parser = project_reader_t( config=config, cache=cache ) - answer = parser.read_files(files, compilation_mode) - return answer - -def parse_string(content, config=None): - if not config: - config = config_t() - parser = project_reader_t(config ) - return parser.read_string(content) - -def parse_xml_file( content, config=None ): - parser = source_reader_t( config ) - return parser.read_xml_file( content ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/linker.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/linker.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/linker.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/linker.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,271 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import types -from pygccxml.declarations import * - -class linker_t( decl_visitor_t, type_visitor_t, object ): - def __init__( self, decls, types, access, membership, files ): - decl_visitor_t.__init__(self) - type_visitor_t.__init__(self) - object.__init__(self) - - self.__decls = decls - self.__types = types - self.__access = access - self.__membership = membership - self.__files = files - self.__inst = None - - self.__compiler = None - if self.__decls: - for d in self.__decls.itervalues(): - self.__compiler = d.compiler - break - - def _get_inst(self): - return self.__inst - def _set_inst(self, inst): - self.__inst = inst - #use inst, to reduce attribute access time - if isinstance( inst, declaration_t ) and inst.location: - inst.location.file_name = self.__files[inst.location.file_name] - instance = property( _get_inst, _set_inst ) - - def __link_type(self, type_id): - if type_id is None: - return None #in some situations type_id is None, return_type of constructor or destructor - elif self.__types.has_key( type_id ): - return self.__types[type_id] - elif self.__decls.has_key( type_id ): - base = declarated_t( declaration=self.__decls[ type_id ] ) - self.__types[type_id] = base - return base - elif '...' == type_id: - return ellipsis_t() - else: - return unknown_t() - - def __link_compound_type(self): - self.__inst.base = self.__link_type( self.__inst.base ) - - def __link_members(self): - if not self.__membership.has_key( id(self.__inst) ): - return - for member in self.__membership[ id(self.__inst) ]: - if not self.__access.has_key( member ): - continue - access = self.__access[member] - if not self.__decls.has_key( member ): - continue - decl = self.__decls[member] - if isinstance( self.__inst, class_t ): - self.__inst.adopt_declaration( decl, access ) - else: - self.__inst.adopt_declaration( decl ) - - def __link_calldef(self): - self.__inst.return_type = self.__link_type( self.__inst.return_type ) - if isinstance( self.__inst, type_t ): - linked_args = [ self.__link_type( arg ) for arg in self.__inst.arguments_types ] - self.__inst.arguments_types = linked_args - else: - for arg in self.__inst.arguments: - arg.type = self.__link_type(arg.type) - for index in range( len( self.__inst.exceptions ) ): - try: - self.__inst.exceptions[index] = self.__decls[ self.__inst.exceptions[index] ] - except KeyError: - self.__inst.exceptions[index] = self.__link_type( self.__inst.exceptions[index] ) - - def visit_member_function( self ): - self.__link_calldef() - - def visit_constructor( self ): - self.__link_calldef() - - def visit_destructor( self ): - self.__link_calldef() - - def visit_member_operator( self ): - self.__link_calldef() - - def visit_casting_operator( self ): - self.__link_calldef() - #will be fixed by patcher. It is needed because of demangled name taken into account - #self.__inst._name = 'operator ' + self.__inst.return_type.decl_string - - def visit_free_function( self ): - self.__link_calldef() - - def visit_free_operator( self ): - self.__link_calldef() - - def visit_class_declaration(self ): - pass - - def visit_class(self ): - self.__link_members() - #GCC-XML sometimes generates constructors with names that does not match - #class name. I think this is because those constructors are compiler - #generated. I need to find out more about this and to talk with Brad - - new_name = self.__inst._name - if templates.is_instantiation( new_name ): - new_name = templates.name( new_name ) - - for decl in self.__inst.declarations: - if not isinstance( decl, constructor_t ): - continue - if '.' in decl._name or '$' in decl._name: - decl._name = new_name - - bases = self.__inst.bases.split() - self.__inst.bases = [] - for base in bases: - #it could be "_5" or "protected:_5" - data = base.split(':') - base_decl = self.__decls[ data[-1] ] - access = ACCESS_TYPES.PUBLIC - if 2 == len( data ): - access = data[0] - self.__inst.bases.append( hierarchy_info_t( base_decl, access ) ) - base_decl.derived.append( hierarchy_info_t( self.__inst, access ) ) - - def visit_enumeration(self ): - pass - - def visit_namespace(self ): - self.__link_members() - - def visit_typedef(self ): - self.__inst.type = self.__link_type(self.__inst.type) - - def visit_variable(self ): - self.__inst.type = self.__link_type(self.__inst.type) - - def visit_void( self ): - pass - - def visit_char( self ): - pass - - def visit_signed_char( self ): - pass - - def visit_unsigned_char( self ): - pass - - def visit_wchar( self ): - pass - - def visit_short_int( self ): - pass - - def visit_short_unsigned_int( self ): - pass - - def visit_bool( self ): - pass - - def visit_int( self ): - pass - - def visit_unsigned_int( self ): - pass - - def visit_long_int( self ): - pass - - def visit_long_unsigned_int( self ): - pass - - def visit_long_long_int( self ): - pass - - def visit_long_long_unsigned_int( self ): - pass - - def visit_float( self ): - pass - - def visit_double( self ): - pass - - def visit_long_double( self ): - pass - - def visit_complex_long_double(self): - pass - - def visit_complex_double(self): - pass - - def visit_complex_float(self): - pass - - def visit_jbyte(self): - pass - - def visit_jshort(self): - pass - - def visit_jint(self): - pass - - def visit_jlong(self): - pass - - def visit_jfloat(self): - pass - - def visit_jdouble(self): - pass - - def visit_jchar(self): - pass - - def visit_jboolean(self): - pass - - def visit_volatile( self ): - self.__link_compound_type() - - def visit_const( self ): - self.__link_compound_type() - - def visit_pointer( self ): - if '0.9' in self.__compiler and isinstance( self.__inst.base, member_variable_type_t ): - original_inst = self.__inst - self.__inst = self.__inst.base - self.visit_member_variable_type() - self.__inst = original_inst - else: - self.__link_compound_type() - - def visit_reference( self ): - self.__link_compound_type() - - def visit_array( self ): - self.__link_compound_type() - - def visit_free_function_type( self ): - self.__link_calldef() - - def visit_member_function_type( self ): - self.__link_calldef() - if isinstance( self.__inst, type_t ): - self.__inst.class_inst = self.__link_type( self.__inst.class_inst ) - - def visit_member_variable_type( self ): - self.__inst.variable_type = self.__link_type( self.__inst.variable_type ) - self.__link_compound_type() - - def visit_declarated( self ): - if isinstance( self.__inst.declaration, types.StringTypes ): - self.__inst.declaration = self.__decls[self.__inst.declaration] - - def visit_restrict( self ): - self.__link_compound_type() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/patcher.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/patcher.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/patcher.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/patcher.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -from pygccxml import utils -from pygccxml import declarations - - -class default_argument_patcher_t( object ): - def __init__( self, enums ): - object.__init__( self ) - self.__enums = enums - - def __call__(self, decl): - for arg in decl.arguments: - if not arg.default_value: - continue - fixer = self.__find_fixer( decl, arg ) - if fixer: - arg.default_value = fixer( decl, arg ) - - def __find_fixer(self, func, arg): - if not arg.default_value: - return False - elif self.__is_unqualified_enum( func, arg ): - return self.__fix_unqualified_enum - elif self.__is_double_call( func, arg ): - return self.__fix_double_call - elif self.__is_invalid_integral( func, arg ): - return self.__fix_invalid_integral - elif self.__is_constructor_call( func, arg ): - return self.__fix_constructor_call - else: - return None - - def __join_names( self, prefix, suffix ): - if prefix == '::': - return '::' + suffix - else: - return prefix + '::' + suffix - - def __is_unqualified_enum(self, func, arg): - type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) - if not declarations.is_enum( type_ ): - return False - enum_type = declarations.enum_declaration( type_ ) - return enum_type.has_value_name( arg.default_value ) - - def __fix_unqualified_enum( self, func, arg): - type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) - enum_type = declarations.enum_declaration( type_ ) - return self.__join_names( enum_type.parent.decl_string, arg.default_value ) - - def __is_invalid_integral(self, func, arg): - type_ = declarations.remove_reference( declarations.remove_cv( arg.type ) ) - if not declarations.is_integral( type_ ): - return False - try: - int( arg.default_value ) - return False - except: - return True - - def __fix_invalid_integral(self, func, arg): - try: - int( arg.default_value ) - return arg.default_value - except: - pass - - try: - int( arg.default_value, 16 ) - if 64 == utils.get_architecture(): - #on 64 bit architecture, gccxml reports 0fffff, which is valid number - #the problem is that in this case it is so buggy so pygccxml can not fix it - #users will have to fix the default value manually - return arg.default_value - default_value = arg.default_value.lower() - found_hex = filter( lambda ch: ch in 'abcdef', default_value ) - if found_hex and not default_value.startswith( '0x' ): - int( '0x' + default_value, 16 ) - return '0x' + default_value - except: - pass - - #may be we deal with enum - parent = func.parent - while parent: - found = self.__find_enum( parent, arg.default_value ) - if found: - if declarations.is_fundamental( arg.type ) and ' ' in arg.type.decl_string: - template = '(%s)(%s)' - else: - template = '%s(%s)' - return template % ( arg.type.decl_string - , self.__join_names( found.parent.decl_string, arg.default_value ) ) - else: - parent = parent.parent - return arg.default_value - - def __find_enum( self, scope, default_value ): - #this algorithm could be improved: it could take into account - #1. unnamed namespaced - #2. location within files - - for enum in self.__enums: - if enum.parent is scope and enum.has_value_name( default_value ): - return enum - return None - - def __is_double_call( self, func, arg ): - call_invocation = declarations.call_invocation - dv = arg.default_value - found1 = call_invocation.find_args( dv ) - if found1 == call_invocation.NOT_FOUND: - return False - found2 = call_invocation.find_args( dv, found1[1] + 1 ) - if found2 == call_invocation.NOT_FOUND: - return False - args1 = call_invocation.args( dv[ found1[0] : found1[1] + 1 ] ) - args2 = call_invocation.args( dv[ found2[0] : found2[1] + 1 ] ) - return len(args1) == len(args2) - - def __fix_double_call( self, func, arg ): - call_invocation = declarations.call_invocation - dv = arg.default_value - found1 = call_invocation.find_args( dv ) - found2 = call_invocation.find_args( dv, found1[1] + 1 ) - #args1 = call_invocation.args( dv[ found1[0] : found1[1] + 1 ] ) - args2 = call_invocation.args( dv[ found2[0] : found2[1] + 1 ] ) - return call_invocation.join( dv[:found1[0]], args2 ) - - def __is_constructor_call( self, func, arg ): - #if '0.9' in func.compiler: - # return False - call_invocation = declarations.call_invocation - dv = arg.default_value - if not call_invocation.is_call_invocation( dv ): - return False - name = call_invocation.name( dv ) - base_type = declarations.base_type( arg.type ) - if not isinstance( base_type, declarations.declarated_t ): - return False - decl = base_type.declaration - return decl.name == name \ - or ( isinstance( decl, declarations.class_t ) \ - and name in map( lambda typedef: typedef.name, decl.aliases ) ) - - def __fix_constructor_call( self, func, arg ): - call_invocation = declarations.call_invocation - dv = arg.default_value - if not call_invocation.is_call_invocation( dv ): - return False - base_type = declarations.base_type( arg.type ) - decl = base_type.declaration - name, args = call_invocation.split( dv ) - if decl.name != name: - #we have some alias to the class - relevant_typedefs = filter( lambda typedef: typedef.name == name - , decl.aliases ) - if 1 == len( relevant_typedefs ): - f_q_name = self.__join_names( declarations.full_name( relevant_typedefs[0].parent ) - , name ) - else:#in this case we can not say which typedef user uses: - f_q_name = self.__join_names( declarations.full_name( decl.parent ) - , decl.name ) - else: - f_q_name = self.__join_names( declarations.full_name( decl.parent ), name ) - - return call_invocation.join( f_q_name, args ) - -class casting_operator_patcher_t( object ): - def __init__( self ): - object.__init__( self ) - - def __call__(self, decl): - decl.name = 'operator ' + decl.return_type.decl_string - -_casting_oper_patcher_ = casting_operator_patcher_t() - -def fix_calldef_decls(decls, enums): - default_arg_patcher = default_argument_patcher_t(enums) - #decls should be flat list of all declarations, you want to apply patch on - for decl in decls: - default_arg_patcher( decl ) - if isinstance( decl, declarations.casting_operator_t): - _casting_oper_patcher_( decl ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/project_reader.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/project_reader.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/project_reader.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/project_reader.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,477 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -import time -import types -import source_reader -import declarations_cache -import pygccxml.declarations -from pygccxml import utils - -class COMPILATION_MODE: - ALL_AT_ONCE = 'all at once' - FILE_BY_FILE = 'file by file' - - -class file_configuration_t( object ): - """ - file_configuration_t - a class, that contains some data and description how - to treat the data. file_configuration_t can contain reference to the next types - of data: - - 1) path to C++ source file - - 2) path to `GCC-XML`_ generated XML file - - 3) path to C++ source file and path to `GCC-XML`_ generated XML file - - In this case, if XML file does not exists, it will be created. Next time - you will ask to parse the source file, the XML file will be used instead. - - Small tip: you can setup your makefile to delete XML files every time, - the relevant source file has changed. - - 4) Python string, that contains valid C++ code - - - There are few functions, that will help you to construct file_configuration_t - object: - - * L{create_source_fc} - - * L{create_gccxml_fc} - - * L{create_cached_source_fc} - - * L{create_text_fc} - - """ - class CONTENT_TYPE: - STANDARD_SOURCE_FILE = 'standard source file' - CACHED_SOURCE_FILE = 'cached source file' - GCCXML_GENERATED_FILE = 'gccxml generated file' - TEXT = 'text' - - def __init__( self - , data - , start_with_declarations=None - , content_type=CONTENT_TYPE.STANDARD_SOURCE_FILE - , cached_source_file=None ): - object.__init__( self ) - self.__data = data - if not start_with_declarations: - start_with_declarations = [] - self.__start_with_declarations = start_with_declarations - self.__content_type = content_type - self.__cached_source_file = cached_source_file - if not self.__cached_source_file \ - and self.__content_type == self.CONTENT_TYPE.CACHED_SOURCE_FILE: - self.__cached_source_file = self.__data + '.xml' - - @property - def data(self): - return self.__data - - @property - def start_with_declarations(self): - return self.__start_with_declarations - - @property - def content_type(self): - return self.__content_type - - @property - def cached_source_file(self): - return self.__cached_source_file - -def create_text_fc( text ): - """ - Creates L{file_configuration_t} instance, configured to contain Python string, - that contains valid C++ code - - @param text: C++ code - @type text: str - - @return: L{file_configuration_t} - """ - return file_configuration_t( data=text - , content_type=file_configuration_t.CONTENT_TYPE.TEXT ) - -def create_source_fc( header ): - """ - Creates L{file_configuration_t} instance, configured to contain path to - C++ source file - - @param header: path to C++ source file - @type header: str - - @return: L{file_configuration_t} - """ - return file_configuration_t( data=header - , content_type=file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE ) - -def create_gccxml_fc( xml_file ): - """ - Creates L{file_configuration_t} instance, configured to contain path to - GCC-XML generated XML file. - - @param xml_file: path to GCC-XML generated XML file - @type xml_file: str - - @return: L{file_configuration_t} - """ - return file_configuration_t( data=xml_file - , content_type=file_configuration_t.CONTENT_TYPE.GCCXML_GENERATED_FILE ) - -def create_cached_source_fc( header, cached_source_file ): - """ - Creates L{file_configuration_t} instance, configured to contain path to - GCC-XML generated XML file and C++ source file. If XML file does not exists, - it will be created and used for parsing. If XML file exists, it will be used - for parsing. - - @param header: path to C++ source file - @type header: str - - @param cached_source_file: path to GCC-XML generated XML file - @type cached_source_file: str - - @return: L{file_configuration_t} - """ - return file_configuration_t( data=header - , cached_source_file=cached_source_file - , content_type=file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE ) - -class project_reader_t: - """Parses header files and returns the contained declarations. - """ - def __init__( self, config, cache=None, decl_factory=None): - """Constructor. - - config is a configuration object that contains the parameters - for invoking gccxml. cache specifies the cache to use for - caching declarations between separate runs. By default, no - cache is used. decl_factory is an object that must provide - the same interface than - L{decl_factory_t}, i.e. there must - be a set of C{create_*} methods that return an instance of an - appropriate declaration class. By default, the declaration - classes defined in the L{declarations} package are used. - - @param config: Configuration object - @type config: L{config_t} - @param cache: Declaration cache (None=no cache) - @type cache: L{cache_base_t} or str - @param decl_factory: Custom declaration factory object or None - @type decl_factory: decl_factory_t - """ - self.__config = config - self.__dcache = None - if isinstance( cache, declarations_cache.cache_base_t ): - self.__dcache = cache - elif isinstance( cache, types.StringTypes ): - self.__dcache = declarations_cache.file_cache_t(cache) - else: - self.__dcache = declarations_cache.dummy_cache_t() - self.__decl_factory = decl_factory - if not decl_factory: - self.__decl_factory = pygccxml.declarations.decl_factory_t() - - self.logger = utils.loggers.gccxml - - @staticmethod - def get_os_file_names( files ): - """Returns a list of OS file names - - @param files: list of strings or L{file_configuration_t} instances. - files could contain a mix of them - @type files: list - """ - fnames = [] - for f in files: - if isinstance( f, types.StringTypes ): - fnames.append( f ) - elif isinstance( f, file_configuration_t ): - if f.content_type in ( file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE - , file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE ): - fnames.append( f.data ) - else: - pass - return fnames - - def read_files( self, files, compilation_mode=COMPILATION_MODE.FILE_BY_FILE): - """Parse header files. - - @param files: list of strings or L{file_configuration_t} instances. - files could contain a mix of them - @type files: list - @param compilation_mode: Determines whether the files are parsed individually or as one single chunk - @type compilation_mode: L{COMPILATION_MODE} - @returns: Declarations - """ - if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE \ - and len( files ) == len( self.get_os_file_names(files) ): - return self.__parse_all_at_once(files) - else: - if compilation_mode == COMPILATION_MODE.ALL_AT_ONCE: - msg = ''.join([ - "Unable to parse files using ALL_AT_ONCE mode. " - , "There is some file configuration that is not file. " - , "pygccxml.parser.project_reader_t switches to FILE_BY_FILE mode." ]) - self.logger.warning( msg ) - return self.__parse_file_by_file(files) - - def __parse_file_by_file(self, files): - namespaces = [] - config = self.__config.clone() - self.logger.debug( "Reading project files: file by file" ) - for prj_file in files: - reader = None - header = None - content_type = None - if isinstance( prj_file, file_configuration_t ): - del config.start_with_declarations[:] - config.start_with_declarations.extend( prj_file.start_with_declarations ) - header = prj_file.data - content_type = prj_file.content_type - else: - config = self.__config - header = prj_file - content_type = file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE - reader = source_reader.source_reader_t( config - , self.__dcache - , self.__decl_factory ) - decls = None - if content_type == file_configuration_t.CONTENT_TYPE.STANDARD_SOURCE_FILE: - self.logger.info( 'Parsing source file "%s" ... ' % header ) - decls = reader.read_file( header ) - elif content_type == file_configuration_t.CONTENT_TYPE.GCCXML_GENERATED_FILE: - self.logger.info( 'Parsing xml file "%s" ... ' % header ) - decls = reader.read_xml_file( header ) - elif content_type == file_configuration_t.CONTENT_TYPE.CACHED_SOURCE_FILE: - #TODO: raise error when header file does not exist - if not os.path.exists( prj_file.cached_source_file ): - dir_ = os.path.split( prj_file.cached_source_file )[0] - if dir_ and not os.path.exists( dir_ ): - os.makedirs( dir_ ) - self.logger.info( 'Creating xml file "%s" from source file "%s" ... ' - % ( prj_file.cached_source_file, header ) ) - reader.create_xml_file( header, prj_file.cached_source_file ) - self.logger.info( 'Parsing xml file "%s" ... ' % prj_file.cached_source_file ) - decls = reader.read_xml_file( prj_file.cached_source_file ) - else: - decls = reader.read_string( header ) - namespaces.append( decls ) - self.logger.debug( "Flushing cache... " ) - start_time = time.clock() - self.__dcache.flush() - self.logger.debug( "Cache has been flushed in %.1f secs" % ( time.clock() - start_time ) ) - answer = [] - self.logger.debug( "Joining namespaces ..." ) - for file_nss in namespaces: - answer = self._join_top_namespaces( answer, file_nss ) - self.logger.debug( "Joining declarations ..." ) - for ns in answer: - if isinstance( ns, pygccxml.declarations.namespace_t ): - self._join_declarations( ns ) - leaved_classes = self._join_class_hierarchy( answer ) - types = self.__declarated_types(answer) - self.logger.debug( "Relinking declared types ..." ) - self._relink_declarated_types( leaved_classes, types ) - source_reader.bind_aliases( pygccxml.declarations.make_flatten( answer ) ) - return answer - - def __parse_all_at_once(self, files): - config = self.__config.clone() - self.logger.debug( "Reading project files: all at once" ) - header_content = [] - for header in files: - if isinstance( header, file_configuration_t ): - del config.start_with_declarations[:] - config.start_with_declarations.extend( header.start_with_declarations ) - header_content.append( '#include "%s" %s' % ( header.data, os.linesep ) ) - else: - header_content.append( '#include "%s" %s' % ( header, os.linesep ) ) - return self.read_string( ''.join( header_content ) ) - - def read_string(self, content): - """Parse a string containing C/C++ source code. - - @param content: C/C++ source code. - @type content: str - @returns: Declarations - """ - reader = source_reader.source_reader_t( self.__config, None, self.__decl_factory ) - return reader.read_string( content ) - - def _join_top_namespaces(self, main_ns_list, other_ns_list): - answer = main_ns_list[:] - for other_ns in other_ns_list: - main_ns = pygccxml.declarations.find_declaration( answer - , type=pygccxml.declarations.namespace_t - , name=other_ns._name - , recursive=False ) - if main_ns: - main_ns.take_parenting( other_ns ) - else: - answer.append( other_ns ) - return answer - - def _join_namespaces( self, nsref ): - assert isinstance( nsref, pygccxml.declarations.namespace_t ) - ddhash = {} # decl.__class__ : { decl.name : [decls] } double declaration hash - decls = [] - - for decl in nsref.declarations: - if not ddhash.has_key( decl.__class__ ): - ddhash[ decl.__class__ ] = { decl._name : [ decl ] } - decls.append( decl ) - else: - joined_decls = ddhash[ decl.__class__ ] - if not joined_decls.has_key( decl._name ): - decls.append( decl ) - joined_decls[decl._name] = [ decl ] - else: - if isinstance( decl, pygccxml.declarations.calldef_t ): - if decl not in joined_decls[decl._name]: - #functions has overloading - decls.append( decl ) - joined_decls[decl._name].append( decl ) - elif isinstance( decl, pygccxml.declarations.enumeration_t ): - #unnamed enums - if not decl.name and decl not in joined_decls[decl._name]: - decls.append( decl ) - joined_decls[decl._name].append( decl ) - elif isinstance( decl, pygccxml.declarations.class_t ): - #unnamed classes - if not decl.name and decl not in joined_decls[decl._name]: - decls.append( decl ) - joined_decls[decl._name].append( decl ) - else: - assert 1 == len( joined_decls[ decl._name ] ) - if isinstance( decl, pygccxml.declarations.namespace_t ): - joined_decls[ decl._name ][0].take_parenting( decl ) - nsref.declarations = decls - - def _join_class_hierarchy( self, namespaces ): - create_key = lambda decl:( decl.location.as_tuple() - , tuple( pygccxml.declarations.declaration_path( decl ) ) ) - classes = filter( lambda decl: isinstance(decl, pygccxml.declarations.class_t ) - , pygccxml.declarations.make_flatten( namespaces ) ) - leaved_classes = {} - #selecting classes to leave - for class_ in classes: - key = create_key( class_ ) - if key not in leaved_classes: - leaved_classes[ key ] = class_ - #replacing base and derived classes with those that should be leave - #also this loop will add missing derived classes to the base - for class_ in classes: - leaved_class = leaved_classes[create_key( class_ )] - for base_info in class_.bases: - leaved_base = leaved_classes[ create_key( base_info.related_class ) ] - #treating base class hierarchy of leaved_class - leaved_base_info = pygccxml.declarations.hierarchy_info_t( - related_class=leaved_base - , access=base_info.access ) - if leaved_base_info not in leaved_class.bases: - leaved_class.bases.append( leaved_base_info ) - else: - index = leaved_class.bases.index( leaved_base_info ) - leaved_class.bases[index].related_class = leaved_base_info.related_class - #treating derived class hierarchy of leaved_base - leaved_derived_for_base_info = pygccxml.declarations.hierarchy_info_t( - related_class=leaved_class - , access=base_info.access ) - if leaved_derived_for_base_info not in leaved_base.derived: - leaved_base.derived.append( leaved_derived_for_base_info ) - else: - index = leaved_base.derived.index( leaved_derived_for_base_info ) - leaved_base.derived[index].related_class = leaved_derived_for_base_info.related_class - for derived_info in class_.derived: - leaved_derived = leaved_classes[ create_key( derived_info.related_class ) ] - #treating derived class hierarchy of leaved_class - leaved_derived_info = pygccxml.declarations.hierarchy_info_t( - related_class=leaved_derived - , access=derived_info.access ) - if leaved_derived_info not in leaved_class.derived: - leaved_class.derived.append( leaved_derived_info ) - #treating base class hierarchy of leaved_derived - leaved_base_for_derived_info = pygccxml.declarations.hierarchy_info_t( - related_class=leaved_class - , access=derived_info.access ) - if leaved_base_for_derived_info not in leaved_derived.bases: - leaved_derived.bases.append( leaved_base_for_derived_info ) - #this loops remove instance we from parent.declarations - for class_ in classes: - key = create_key( class_ ) - if id( leaved_classes[key] ) == id( class_ ): - continue - else: - declarations = None - if class_.parent: - declarations = class_.parent.declarations - else: - declarations = namespaces #yes, we are talking about global class that doesn't - #belong to any namespace. Usually is compiler generated top level classes - declarations_ids = [ id(decl) for decl in declarations ] - del declarations[ declarations_ids.index( id(class_) ) ] - return leaved_classes - - def _relink_declarated_types(self, leaved_classes, declarated_types): - create_key = lambda decl:( decl.location.as_tuple() - , tuple( pygccxml.declarations.declaration_path( decl ) ) ) - for decl_wrapper_type in declarated_types: - #it is possible, that cache contains reference to dropped class - #We need to clear it - decl_wrapper_type.cache.reset() - if isinstance( decl_wrapper_type.declaration, pygccxml.declarations.class_t ): - key = create_key(decl_wrapper_type.declaration) - if leaved_classes.has_key( key ): - decl_wrapper_type.declaration = leaved_classes[ create_key(decl_wrapper_type.declaration) ] - else: - if decl_wrapper_type.declaration._name.startswith( '__vmi_class_type_info_pseudo' ): - continue - msg = [] - msg.append( "Unable to find out actual class definition: '%s'." % decl_wrapper_type.declaration._name ) - msg.append( "Class definition has been changed from one compilation to an other." ) - msg.append( "Why did it happen to me? Here is a short list of reasons: " ) - msg.append( " 1. There are different preprocessor definitions applied on same file during compilation" ) - msg.append( " 2. Bug in pygccxml." ) - self.logger.error( os.linesep.join(msg) ) - - def _join_declarations( self, declref ): - self._join_namespaces( declref ) - for ns in declref.declarations: - if isinstance( ns, pygccxml.declarations.namespace_t ): - self._join_declarations( ns ) - - def __declarated_types(self, namespaces): - def get_from_type(cpptype): - if not cpptype: - return [] - elif isinstance( cpptype, pygccxml.declarations.fundamental_t ): - return [] - elif isinstance( cpptype, pygccxml.declarations.declarated_t ): - return [ cpptype ] - elif isinstance( cpptype, pygccxml.declarations.compound_t ): - return get_from_type( cpptype.base ) - elif isinstance( cpptype, pygccxml.declarations.calldef_type_t ): - types = get_from_type( cpptype.return_type ) - for arg in cpptype.arguments_types: - types.extend( get_from_type( arg ) ) - return types - else: - assert isinstance( cpptype, ( pygccxml.declarations.unknown_t - , pygccxml.declarations.ellipsis_t ) ) - return [] - types = [] - for decl in pygccxml.declarations.make_flatten( namespaces ): - if isinstance( decl, pygccxml.declarations.calldef_t ): - types.extend( get_from_type( decl.function_type() ) ) - elif isinstance( decl, (pygccxml.declarations.typedef_t, pygccxml.declarations.variable_t) ): - types.extend( get_from_type( decl.type ) ) - return types diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/scanner.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/scanner.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/scanner.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/scanner.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,539 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -import types -import pprint -import xml.sax -import warnings -import xml.sax.handler -from pygccxml.declarations import * -from pygccxml import utils - -##convention -#XML_NN - XML Node Name -#XML_AN - XML Attribute Name -#also those constants are sorted for easy searching. -XML_AN_ABSTRACT = "abstract" -XML_AN_ACCESS = "access" -XML_AN_ALIGN = "align" -XML_AN_ARTIFICIAL = "artificial" -XML_AN_ATTRIBUTES = "attributes" -XML_AN_BASE_TYPE = "basetype" -XML_AN_BASES = "bases" -XML_AN_BITS = "bits" -XML_AN_CONST = "const" -XML_AN_CONTEXT = "context" -XML_AN_CVS_REVISION = "cvs_revision" -XML_AN_DEFAULT = "default" -XML_AN_DEMANGLED = "demangled" -XML_AN_EXTERN = "extern" -XML_AN_FILE = "file" -XML_AN_ID = "id" -XML_AN_INCOMPLETE = "incomplete" -XML_AN_INIT = "init" -XML_AN_LINE = "line" -XML_AN_MANGLED = "mangled" -XML_AN_MAX = "max" -XML_AN_MEMBERS = "members" -XML_AN_MUTABLE = "mutable" -XML_AN_NAME = "name" -XML_AN_OFFSET = "offset" -XML_AN_PURE_VIRTUAL = "pure_virtual" -XML_AN_RESTRICT = "restrict" -XML_AN_RETURNS = "returns" -XML_AN_SIZE = "size" -XML_AN_STATIC = "static" -XML_AN_THROW = "throw" -XML_AN_TYPE = "type" -XML_AN_VIRTUAL = "virtual" -XML_AN_VOLATILE = "volatile" -XML_NN_ARGUMENT = "Argument" -XML_NN_ARRAY_TYPE = "ArrayType" -XML_NN_CASTING_OPERATOR = "Converter" -XML_NN_CLASS = "Class" -XML_NN_CONSTRUCTOR = "Constructor" -XML_NN_CV_QUALIFIED_TYPE = "CvQualifiedType" -XML_NN_DESTRUCTOR = "Destructor" -XML_NN_ELLIPSIS = "Ellipsis" -XML_NN_ENUMERATION = "Enumeration" -XML_NN_ENUMERATION_VALUE = "EnumValue" -XML_NN_FIELD = "Field" -XML_NN_FILE = "File" -XML_NN_FUNCTION = "Function" -XML_NN_FUNCTION_TYPE = "FunctionType" -XML_NN_FUNDAMENTAL_TYPE = "FundamentalType" -XML_NN_FREE_OPERATOR = "OperatorFunction" -XML_NN_GCC_XML = "GCC_XML" -XML_NN_MEMBER_OPERATOR = "OperatorMethod" -XML_NN_METHOD = "Method" -XML_NN_METHOD_TYPE = "MethodType" -XML_NN_NAMESPACE = "Namespace" -XML_NN_OFFSET_TYPE = "OffsetType" -XML_NN_POINTER_TYPE = "PointerType" -XML_NN_REFERENCE_TYPE = "ReferenceType" -XML_NN_ROOT = "GCC_XML" -XML_NN_STRUCT = "Struct" -XML_NN_TYPEDEF = "Typedef" -XML_NN_UNION = "Union" -XML_NN_VARIABLE = "Variable" - -class scanner_t( xml.sax.handler.ContentHandler ): - def __init__(self, gccxml_file, decl_factory, *args ): - xml.sax.handler.ContentHandler.__init__(self, *args ) - self.logger = utils.loggers.gccxml - self.gccxml_file = gccxml_file - #defining parsing tables - self.__readers = { - XML_NN_FILE : self.__read_file - , XML_NN_NAMESPACE : self.__read_namespace - , XML_NN_ENUMERATION : self.__read_enumeration - , XML_NN_ENUMERATION_VALUE : self.__read_enumeration_value - , XML_NN_ARRAY_TYPE : self.__read_array_type - , XML_NN_CV_QUALIFIED_TYPE : self.__read_cv_qualified_type - , XML_NN_POINTER_TYPE : self.__read_pointer_type - , XML_NN_REFERENCE_TYPE : self.__read_reference_type - , XML_NN_FUNDAMENTAL_TYPE : self.__read_fundamental_type - , XML_NN_ARGUMENT : self.__read_argument - , XML_NN_FUNCTION_TYPE : self.__read_function_type - , XML_NN_METHOD_TYPE : self.__read_method_type - , XML_NN_OFFSET_TYPE : self.__read_offset_type - , XML_NN_TYPEDEF : self.__read_typedef - , XML_NN_VARIABLE : self.__read_variable - , XML_NN_CLASS : self.__read_class - , XML_NN_STRUCT : self.__read_struct - , XML_NN_UNION : self.__read_union - , XML_NN_FIELD : self.__read_field - , XML_NN_CASTING_OPERATOR : self.__read_casting_operator - , XML_NN_CONSTRUCTOR : self.__read_constructor - , XML_NN_DESTRUCTOR : self.__read_destructor - , XML_NN_FUNCTION : self.__read_function - , XML_NN_FREE_OPERATOR : self.__read_free_operator - , XML_NN_MEMBER_OPERATOR : self.__read_member_operator - , XML_NN_METHOD : self.__read_method - , XML_NN_GCC_XML : self.__read_version - , XML_NN_ELLIPSIS : self.__read_ellipsis - } - self.deep_declarations = [ - XML_NN_CASTING_OPERATOR - , XML_NN_CONSTRUCTOR - , XML_NN_DESTRUCTOR - , XML_NN_ENUMERATION - , XML_NN_FILE - , XML_NN_FUNCTION - , XML_NN_FREE_OPERATOR - , XML_NN_MEMBER_OPERATOR - , XML_NN_METHOD - , XML_NN_FUNCTION_TYPE - , XML_NN_METHOD_TYPE - ] - - assert isinstance( decl_factory, decl_factory_t ) - self.__decl_factory = decl_factory - - #mapping from id -> decl - self.__declarations = {} - #list of all read declarations - self.__calldefs = [] - #list of enums I need later - self.__enums = [] - #mapping from id -> type - self.__types = {} - #mapping from id -> file - self.__files = {} - #mapping between decl id -> access - self.__access = {} - #current object under construction - self.__inst = None - #mapping from id to members - self.__members = {} - - self.__compiler = None - - def read( self ): - xml.sax.parse( self.gccxml_file, self ) - - def endDocument( self ): - #updating membership - members_mapping = {} - for gccxml_id, members in self.__members.iteritems(): - decl = self.__declarations.get( gccxml_id, None ) - if not decl or not isinstance( decl, scopedef_t): - continue - members_mapping[ id( decl ) ] = members - self.__members = members_mapping - - def declarations(self): - return self.__declarations - - def calldefs( self ): - return self.__calldefs - - def enums(self): - return self.__enums - - def types(self): - return self.__types - - def files(self): - return self.__files - - def access(self): - return self.__access - - def members(self): - return self.__members - - def startElementNS(self, name, qname, attrs): - return self.startElement( name[1], attrs ) - - def endElementNS(self, name, qname): - return self.endElement( name[1] ) - - def startElement(self, name, attrs): - try: - if name not in self.__readers: - return - obj = self.__readers[name]( attrs ) - if not obj: - return #it means that we worked on internals - #for example EnumValue of function argument - if name in self.deep_declarations: - self.__inst = obj - self.__read_access( attrs ) - element_id = attrs.get(XML_AN_ID, None) - if isinstance( obj, declaration_t ): - obj.compiler = self.__compiler - self.__update_membership( attrs ) - self.__declarations[ element_id ] = obj - if not isinstance( obj, namespace_t ): - self.__read_location( obj, attrs ) - if isinstance( obj, class_t): - self.__read_bases( obj, attrs ) - self.__read_artificial(obj, attrs) - self.__read_mangled( obj, attrs) - self.__read_demangled( obj, attrs) - self.__read_attributes(obj, attrs) - - elif isinstance( obj, type_t ): - self.__types[ element_id ] = obj - self.__read_byte_size(obj, attrs) - self.__read_byte_align(obj, attrs) - elif isinstance( obj, types.StringTypes ): - self.__files[ element_id ] = obj - else: - self.logger.warning( 'Unknown object type has been found.' - + ' Please report this bug to pygccxml development team.' ) - except Exception, error: - msg = 'error occured, while parsing element with name "%s" and attrs "%s".' - msg = msg + os.linesep + 'Error: %s.' % str( error ) - self.logger.error( msg % ( name, pprint.pformat( attrs.keys() ) ) ) - raise - - def endElement(self, name): - if name in self.deep_declarations: - self.__inst = None - - def __read_location(self, decl, attrs): - decl.location = location_t( file_name=attrs[XML_AN_FILE], line=int(attrs[XML_AN_LINE])) - - def __update_membership(self, attrs): - parent = attrs.get( XML_AN_CONTEXT, None ) - if not parent: - return - if not self.__members.has_key( parent ): - self.__members[ parent ] = [] - self.__members[parent].append( attrs[XML_AN_ID] ) - - def __read_members(self, decl, attrs ): - decl.declarations = attrs.get(XML_AN_MEMBERS, "") - - def __read_bases(self, decl, attrs ): - decl.bases = attrs.get( XML_AN_BASES, "" ) - - def __read_artificial( self, decl, attrs ): - decl.is_artificial = attrs.get( XML_AN_ARTIFICIAL, False ) - - def __read_mangled( self, decl, attrs ): - decl.mangled = attrs.get( XML_AN_MANGLED, None ) - - def __read_demangled( self, decl, attrs ): - decl.demangled = attrs.get( XML_AN_DEMANGLED, None ) - - def __read_attributes( self, decl, attrs ): - decl.attributes = attrs.get( XML_AN_ATTRIBUTES, None ) - - def __read_access( self, attrs ): - self.__access[ attrs[XML_AN_ID] ] = attrs.get( XML_AN_ACCESS, ACCESS_TYPES.PUBLIC ) - - def __read_byte_size (self, decl, attrs): - "Using duck typing to set the size instead of in constructor" - size = attrs.get(XML_AN_SIZE, 0) - decl.byte_size = int(size)/8 # Make sure the size is in bytes instead of bits - - def __read_byte_offset (self, decl, attrs): - "Using duck typing to set the offset instead of in constructor" - offset = attrs.get(XML_AN_OFFSET, 0) - decl.byte_offset = int(offset)/8 # Make sure the size is in bytes instead of bits - - def __read_byte_align (self, decl, attrs): - "Using duck typing to set the alignment" - align = attrs.get(XML_AN_ALIGN, 0) - decl.byte_align = int(align)/8 # Make sure the size is in bytes instead of bits - - def __read_root(self, attrs): - pass - - def __read_file( self, attrs ): - return attrs.get( XML_AN_NAME, '' ) - - def __read_namespace(self, attrs): - ns_name = attrs.get( XML_AN_NAME, '' ) - if '.' in ns_name: - #if '.' in namespace then this is mangled namespace -> in c++ namespace{...} - #that is almost true: gcc mangale name using top file name. - #almost all files has '.' in name - ns_name = '' - return self.__decl_factory.create_namespace( name=ns_name ) - - def __read_enumeration(self, attrs): - enum_name = attrs.get( XML_AN_NAME, '' ) - if '$_' in enum_name or '._' in enum_name: - #it means that this is unnamed enum. in c++ enum{ x }; - enum_name = '' - decl = self.__decl_factory.create_enumeration( name=enum_name ) - self.__read_byte_size(decl, attrs) - self.__read_byte_align(decl, attrs) - self.__enums.append( decl ) - return decl - - def __read_enumeration_value( self, attrs ): - name = attrs.get( XML_AN_NAME, '' ) - num = int(attrs[XML_AN_INIT]) - self.__inst.append_value(name, num) - - def __guess_int_value( self, value_as_str ): - #returns instance of int or None - #if gcc compiled the code, than it is correct! - numeric_suffix_letters = 'UuLlFf' - for s in numeric_suffix_letters: - value_as_str = value_as_str.replace( s, '' ) - try: - return int( value_as_str ) - except ValueError: - try: - return int( value_as_str, 16 ) - except ValueError: - return None - - def __read_array_type( self, attrs ): - type_ = attrs[ XML_AN_TYPE ] - size = self.__guess_int_value( attrs.get(XML_AN_MAX, '' ) ) - if size is None: - size = array_t.SIZE_UNKNOWN - msg = 'unable to find out array size from expression "%s"' % attrs[ XML_AN_MAX ] - # warning is absolutely useless without much clue - # warnings.warn( msg ) - return array_t( type_, size + 1 ) - - def __read_cv_qualified_type( self, attrs ): - if attrs.has_key( XML_AN_CONST ): - return const_t( attrs[XML_AN_TYPE] ) - elif attrs.has_key( XML_AN_VOLATILE ): - return volatile_t( attrs[XML_AN_TYPE] ) - elif attrs.has_key( XML_AN_RESTRICT ): - return restrict_t( attrs[XML_AN_TYPE] ) - else: - assert 0 - - def __read_pointer_type( self, attrs ): - return pointer_t( attrs[XML_AN_TYPE] ) - - def __read_reference_type( self, attrs ): - return reference_t( attrs[XML_AN_TYPE] ) - - def __read_fundamental_type(self, attrs ): - try: - return FUNDAMENTAL_TYPES[ attrs.get( XML_AN_NAME, '' ) ] - except KeyError: - raise RuntimeError( "pygccxml error: unable to find fundamental type with name '%s'." - % attrs.get( XML_AN_NAME, '' ) ) - - def __read_offset_type( self,attrs ): - base = attrs[ XML_AN_BASE_TYPE ] - type_ = attrs[ XML_AN_TYPE ] - if '0.9' in self.__compiler: - return pointer_t( member_variable_type_t( class_inst=base, variable_type=type_ ) ) - else: - return member_variable_type_t( class_inst=base, variable_type=type_ ) - - def __read_argument( self, attrs ): - if isinstance( self.__inst, calldef_type_t ): - self.__inst.arguments_types.append( attrs[XML_AN_TYPE] ) - else: - argument = argument_t() - argument.name = attrs.get( XML_AN_NAME, 'arg%d' % len(self.__inst.arguments) ) - argument.type = attrs[XML_AN_TYPE] - argument.default_value = attrs.get( XML_AN_DEFAULT, None ) - self.__read_attributes( argument, attrs ) - if argument.default_value == '': - argument.default_value = None - self.__inst.arguments.append( argument ) - - def __read_ellipsis( self, attrs ): - if isinstance( self.__inst, calldef_type_t ): - self.__inst.arguments_types.append( '...' ) - else: - argument = argument_t( type='...' ) - self.__inst.arguments.append( argument ) - - def __read_calldef( self, calldef, attrs, is_declaration ): - #destructor for example doesn't have return type - calldef.return_type = attrs.get( XML_AN_RETURNS, None ) - if is_declaration: - self.__calldefs.append( calldef ) - calldef.name = attrs.get(XML_AN_NAME, '') - calldef.has_extern = attrs.get( XML_AN_EXTERN, False ) - throw_stmt = attrs.get( XML_AN_THROW, None ) - if None is throw_stmt: - calldef.does_throw = True - calldef.exceptions = [] - elif "" == throw_stmt: - calldef.does_throw = False - calldef.exceptions = [] - else: - calldef.does_throw = True - calldef.exceptions = throw_stmt.split() - - def __read_member_function( self, calldef, attrs, is_declaration ): - self.__read_calldef( calldef, attrs, is_declaration ) - calldef.has_const = attrs.get( XML_AN_CONST, False ) - if is_declaration: - calldef.has_static = attrs.get( XML_AN_STATIC, False ) - if attrs.has_key( XML_AN_PURE_VIRTUAL ): - calldef.virtuality = VIRTUALITY_TYPES.PURE_VIRTUAL - elif attrs.has_key( XML_AN_VIRTUAL ): - calldef.virtuality = VIRTUALITY_TYPES.VIRTUAL - else: - calldef.virtuality = VIRTUALITY_TYPES.NOT_VIRTUAL - else: - calldef.class_inst = attrs[XML_AN_BASE_TYPE] - - def __read_function_type(self, attrs): - answer = free_function_type_t() - self.__read_calldef( answer, attrs, False ) - return answer - - def __read_method_type(self, attrs): - answer = member_function_type_t() - self.__read_member_function( answer, attrs, False ) - return answer - - def __read_typedef(self, attrs ): - return self.__decl_factory.create_typedef( name=attrs.get( XML_AN_NAME, '' ), type=attrs[XML_AN_TYPE]) - - def __read_variable(self, attrs ): - type_qualifiers = type_qualifiers_t() - type_qualifiers.has_mutable = attrs.get(XML_AN_MUTABLE, False) - type_qualifiers.has_static = attrs.get(XML_AN_EXTERN, False) - bits = attrs.get( XML_AN_BITS, None ) - if bits: - bits = int( bits ) - decl = self.__decl_factory.create_variable( name=attrs.get( XML_AN_NAME, '' ) - , type=attrs[XML_AN_TYPE] - , type_qualifiers=type_qualifiers - , value=attrs.get( XML_AN_INIT, None ) - , bits=bits) - self.__read_byte_offset(decl, attrs) - return decl - - __read_field = __read_variable #just a synonim - - def __read_class_impl(self, class_type, attrs): - decl = None - name = attrs.get(XML_AN_NAME, '') - if '$' in name or '.' in name: - name = '' - if attrs.has_key( XML_AN_INCOMPLETE ): - decl = self.__decl_factory.create_class_declaration(name=name) - else: - decl = self.__decl_factory.create_class( name=name, class_type=class_type ) - if attrs.get( XML_AN_ABSTRACT, False ): - decl.is_abstract = True - else: - decl.is_abstract = False - self.__read_byte_size(decl, attrs) - self.__read_byte_align(decl, attrs) - return decl - - def __read_class( self, attrs ): - return self.__read_class_impl( CLASS_TYPES.CLASS, attrs ) - - def __read_struct( self, attrs ): - return self.__read_class_impl( CLASS_TYPES.STRUCT, attrs ) - - def __read_union( self, attrs ): - return self.__read_class_impl( CLASS_TYPES.UNION, attrs ) - - def __read_casting_operator(self, attrs ): - operator = self.__decl_factory.create_casting_operator() - self.__read_member_function( operator, attrs, True ) - return operator - - def __read_constructor( self, attrs ): - constructor = self.__decl_factory.create_constructor() - self.__read_member_function( constructor, attrs, True ) - return constructor - - def __read_function(self, attrs): - gfunction = self.__decl_factory.create_free_function() - self.__read_calldef( gfunction, attrs, True ) - return gfunction - - def __read_method(self, attrs): - mfunction = self.__decl_factory.create_member_function() - self.__read_member_function( mfunction, attrs, True ) - return mfunction - - def __read_destructor(self, attrs): - destructor = self.__decl_factory.create_destructor() - self.__read_member_function( destructor, attrs, True ) - destructor.name = '~' + destructor.name - return destructor - - def __read_free_operator(self, attrs ): - operator = self.__decl_factory.create_free_operator() - self.__read_member_function( operator, attrs, True ) - if 'new' in operator.name or 'delete' in operator.name: - operator.name = 'operator ' + operator.name - else: - operator.name = 'operator' + operator.name - return operator - - def __read_member_operator(self, attrs): - operator = self.__decl_factory.create_member_operator() - self.__read_member_function( operator, attrs, True ) - if 'new' in operator.name or 'delete' in operator.name: - operator.name = 'operator ' + operator.name - else: - operator.name = 'operator' + operator.name - return operator - - def __read_version(self, attrs): - logger = utils.loggers.cxx_parser - - version = float( attrs.get(XML_AN_CVS_REVISION, 0.6) ) - if version is None: - logger.info ( 'GCCXML version - 0.6' ) - self.__compiler = compilers.GCC_XML_06 - elif version <= 1.114: - logger.info ( 'GCCXML version - 0.7' ) - self.__compiler = compilers.GCC_XML_07 - elif version in ( 1.115, 1.116, 1.117, 1.118, 1.119, 1.120, 1.121 ): - logger.info ( 'GCCXML version - 0.9 BUGGY' ) - self.__compiler = compilers.GCC_XML_09_BUGGY - else: - logger.info ( 'GCCXML version - 0.9' ) - self.__compiler = compilers.GCC_XML_09 diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/source_reader.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/source_reader.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/source_reader.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/parser/source_reader.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,345 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -import sys -import linker -import config -import patcher -import pygccxml.utils - -try: #select the faster xml parser - from etree_scanner import etree_scanner_t as scanner_t -except: - from scanner import scanner_t - -import declarations_cache -from pygccxml import utils -from pygccxml.declarations import * - -class gccxml_runtime_error_t( RuntimeError ): - def __init__( self, msg ): - RuntimeError.__init__( self, msg ) - -def bind_aliases( decls ): - """ - This function binds between class and it's typedefs. - - @param decls: list of all declarations - @type all_classes: list of L{declaration_t} items - - @return: None - """ - visited = set() - typedefs = filter( lambda decl: isinstance( decl, typedef_t ), decls ) - for decl in typedefs: - type_ = remove_alias( decl.type ) - if not isinstance( type_, declarated_t ): - continue - cls_inst = type_.declaration - if not isinstance( cls_inst, class_types ): - continue - if id( cls_inst ) not in visited: - visited.add( id( cls_inst ) ) - del cls_inst.aliases[:] - cls_inst.aliases.append( decl ) - -class source_reader_t: - """ - This class reads C++ source code and returns declarations tree. - - This class is the only class that have an intime knowledge about GCC-XML. - It has only one responsibility: it calls GCC-XML with a source file specified - by user and creates declarations tree. The implementation of this class is split - to 2 classes: - - 1. L{scanner_t} - this class scans the "XML" file, generated by GCC-XML and - creates `pygccxml`_ declarations and types classes. After the xml file has - been processed declarations and type class instances keeps references to - each other using GCC-XML generated id's. - - 2. L{linker_t} - this class contains logic for replacing GCC-XML generated - ids with references to declarations or type class instances. - """ - def __init__( self, config, cache=None, decl_factory=None ): - """ - @param config: instance of L{config_t} class, that contains GCC-XML - configuration - @type config: L{config_t} - - @param cache: reference to cache object, that will be updated after - file has been parsed. - @param cache: instance of class, that derives from {cache_base_t} - - @param decl_factory: declarations factory, if not given default - declarations factory L{decl_factory_t} will be used - """ - self.logger = utils.loggers.cxx_parser - self.__search_directories = [] - self.__config = config - self.__search_directories.append( config.working_directory ) - self.__search_directories.extend( config.include_paths ) - if not cache: - cache = declarations_cache.dummy_cache_t() - self.__dcache = cache - self.__config.raise_on_wrong_settings() - self.__decl_factory = decl_factory - if not decl_factory: - self.__decl_factory = decl_factory_t() - - def __create_command_line(self, file, xmlfile): - assert isinstance( self.__config, config.config_t ) - #returns - cmd = [] - #first is gccxml executable - if 'win32' in sys.platform: - cmd.append( '"%s"' % os.path.normpath( self.__config.gccxml_path ) ) - else: - cmd.append( '%s' % os.path.normpath( self.__config.gccxml_path ) ) - - # Add all cflags passed - if self.__config.cflags != "": - cmd.append(" %s "%self.__config.cflags) - #second all additional includes directories - cmd.append( ''.join( [' -I"%s"' % search_dir for search_dir in self.__search_directories] ) ) - #third all additional defined symbols - cmd.append( ''.join( [' -D"%s"' % defined_symbol for defined_symbol in self.__config.define_symbols] ) ) - cmd.append( ''.join( [' -U"%s"' % undefined_symbol for undefined_symbol in self.__config.undefine_symbols] ) ) - #fourth source file - cmd.append( '"%s"' % file ) - #five destination file - cmd.append( '-fxml="%s"' % xmlfile ) - if self.__config.start_with_declarations: - cmd.append( '-fxml-start="%s"' % ','.join( self.__config.start_with_declarations ) ) - # Specify compiler if asked to - if self.__config.compiler: - cmd.append( " --gccxml-compiler %s" % self.__config.compiler ) - cmd_line = ' '.join(cmd) - if 'win32' in sys.platform : - cmd_line = '"%s"' % cmd_line - self.logger.info( 'gccxml cmd: %s' % cmd_line ) - return cmd_line - - def create_xml_file( self, header, destination=None ): - """ - This function will return the file name of the file, created by GCC-XML - for "header" file. If destination_file_path is not None, then this file - path will be used and returned. - - @param header: path to source file, that should be parsed - @type header: str - - @param destination: if given, will be used as target file/path for - GCC-XML generated file. - @type destination: str - - @return: path to GCC-XML generated file - """ - gccxml_file = destination - # If file specified, remove it to start else create new file name - if gccxml_file: - pygccxml.utils.remove_file_no_raise( gccxml_file ) - else: - gccxml_file = pygccxml.utils.create_temp_file_name( suffix='.xml' ) - try: - ffname = header - if not os.path.isabs( ffname ): - ffname = self.__file_full_name(header) - command_line = self.__create_command_line( ffname, gccxml_file ) - input_, output = os.popen4( command_line ) - input_.close() - gccxml_reports = [] - while True: - data = output.readline() - gccxml_reports.append( data ) - if not data: - break - exit_status = output.close() - gccxml_msg = ''.join(gccxml_reports) - if self.__config.ignore_gccxml_output: - if not os.path.isfile(gccxml_file): - raise gccxml_runtime_error_t( "Error occured while running GCC-XML: %s status:%s" % (gccxml_msg, exit_status) ) - else: - if gccxml_msg or exit_status or not os.path.isfile(gccxml_file): - raise gccxml_runtime_error_t( "Error occured while running GCC-XML: %s" % gccxml_msg ) - except Exception, error: - pygccxml.utils.remove_file_no_raise( gccxml_file ) - raise error - return gccxml_file - - def create_xml_file_from_string( self, content, destination=None ): - """ - Creates XML file from text. - - @param content: C++ source code - @type content: str - - @param destination: file name for GCC-XML generated file - @type destination: str - - @return: returns file name of GCC-XML generated file - """ - header_file = pygccxml.utils.create_temp_file_name( suffix='.h' ) - gccxml_file = None - try: - header_file_obj = file(header_file, 'w+') - header_file_obj.write( content ) - header_file_obj.close() - gccxml_file = self.create_xml_file( header_file, destination ) - finally: - pygccxml.utils.remove_file_no_raise( header_file ) - return gccxml_file - - def read_file( self, source_file ): - if isinstance( self.__config, config.gccxml_configuration_t ): - return self.read_gccxml_file( source_file ) - else: - return self.read_synopsis_file( source_file ) - - def read_gccxml_file(self, source_file): - """ - Reads C++ source file and returns declarations tree - - @param source_file: path to C++ source file - @type source_file: str - """ - declarations, types = None, None - gccxml_file = '' - try: - ffname = self.__file_full_name(source_file) - self.logger.debug( "Reading source file: [%s]." % ffname ) - declarations = self.__dcache.cached_value( ffname, self.__config ) - if not declarations: - self.logger.debug( "File has not been found in cache, parsing..." ) - gccxml_file = self.create_xml_file( ffname ) - declarations, files = self.__parse_gccxml_created_file( gccxml_file ) - self.__dcache.update( ffname, self.__config, declarations, files ) - else: - self.logger.debug( "File has not been changed, reading declarations from cache." ) - except Exception, error: - if gccxml_file: - pygccxml.utils.remove_file_no_raise( gccxml_file ) - raise error - if gccxml_file: - pygccxml.utils.remove_file_no_raise( gccxml_file ) - return declarations - - def read_xml_file(self, gccxml_created_file): - """ - Reads GCC-XML generated XML file. - - @param gccxml_created_file: path to GCC-XML generated file - @type gccxml_created_file: str - - @return: declarations tree - """ - assert(self.__config!=None) - - ffname = self.__file_full_name(gccxml_created_file) - self.logger.debug( "Reading xml file: [%s]" % gccxml_created_file ) - declarations = self.__dcache.cached_value( ffname, self.__config ) - if not declarations: - self.logger.debug( "File has not been found in cache, parsing..." ) - declarations, files = self.__parse_gccxml_created_file( ffname ) - self.__dcache.update( ffname, self.__config, declarations, [] ) - else: - self.logger.debug( "File has not been changed, reading declarations from cache." ) - - return declarations - - def read_string(self, content): - """ - Reads Python string, that contains valid C++ code, and returns - declarations tree. - """ - header_file = pygccxml.utils.create_temp_file_name( suffix='.h' ) - header_file_obj = file(header_file, 'w+') - header_file_obj.write( content ) - header_file_obj.close() - declarations = None - try: - declarations = self.read_file( header_file ) - except Exception, error: - pygccxml.utils.remove_file_no_raise( header_file ) - raise error - pygccxml.utils.remove_file_no_raise( header_file ) - return declarations - - def __file_full_name( self, file ): - if os.path.isfile( file ): - return file - for path in self.__search_directories: - file_path = os.path.join( path, file ) - if os.path.isfile( file_path ): - return file_path - raise RuntimeError( "pygccxml error: file '%s' does not exist" % file ) - - def __produce_full_file( self, file_path ): - if 'win' in sys.platform or 'linux' in sys.platform: - file_path = file_path.replace( r'\/', os.path.sep ) - if os.path.isabs( file_path ): - return file_path - try: - abs_file_path = os.path.realpath( os.path.join( self.__config.working_directory, file_path ) ) - if os.path.exists( abs_file_path ): - return os.path.normpath( abs_file_path ) - return file_path - except Exception: - return file_path - - def __parse_gccxml_created_file( self, gccxml_file ): - scanner_ = scanner_t( gccxml_file, self.__decl_factory ) - scanner_.read() - decls = scanner_.declarations() - types = scanner_.types() - files = {} - for file_id, file_path in scanner_.files().iteritems(): - files[file_id] = self.__produce_full_file(file_path) - linker_ = linker.linker_t( decls=decls - , types=types - , access=scanner_.access() - , membership=scanner_.members() - , files=files ) - for type_ in types.values(): - #I need this copy because internaly linker change types collection - linker_.instance = type_ - apply_visitor( linker_, type_ ) - for decl in decls.itervalues(): - linker_.instance = decl - apply_visitor( linker_, decl ) - bind_aliases( decls.itervalues() ) - #some times gccxml report typedefs defined in no namespace - #it happens for example in next situation - #template< typename X> - #void ddd(){ typedef typename X::Y YY;} - #if I will fail on this bug next time, the right way to fix it may be different - patcher.fix_calldef_decls( scanner_.calldefs(), scanner_.enums() ) - decls = filter( lambda inst: isinstance( inst, namespace_t ) and not inst.parent - , decls.itervalues() ) - return ( decls, files.values() ) - - def read_synopsis_file( self, source_file ): - import synopsis_scanner - from Synopsis import AST - from Synopsis.Parsers import Cxx - - ffname = self.__file_full_name(source_file) - - cppflags = [] - map( lambda dpath: cppflags.append( '-I %s' % dpath ) - , self.__config.include_paths ) - map( lambda define: cppflags.append( '-D %s' % define ) - , self.__config.define_symbols ) - map( lambda define: cppflags.append( '-U %s' % define ) - , self.__config.undefine_symbols ) - - cxx = Cxx.Parser( preprocess=True, cppflags=cppflags ) - ast = AST.AST() - cxx.process( ast, input=[source_file] ) - scanner = synopsis_scanner.scanner_t( ast, self.__decl_factory ) - scanner.visitAST( ast ) - declarations = [scanner.global_ns] - self.__dcache.update( ffname, self.__config, declarations, [] ) - return declarations diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/fs_utils.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/fs_utils.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/fs_utils.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/fs_utils.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import os -from types import * - -##If you want include files that doesn't have extension then use filter like '*.' - -def _make_list( argument ): - if type(argument) in StringTypes: - if argument: - return [argument] - else: - return [] - elif type(argument) is ListType: - return argument - else: - raise TypeError( 'Argument "%s" must be or list of strings or string.' % argument ) - -class base_files_iterator: - def __init__(self, file_exts, is_include_exts = True): - self.__file_exts = _make_list( file_exts ) - self.__is_include_exts = is_include_exts - - def _is_to_skip(self, file_path): - if not self.__file_exts: - return 0 - file_ext = os.path.splitext( file_path )[1] - if not file_ext: - file_ext = '.' + file_ext - file_ext = '*' + file_ext - if file_ext.lower() in self.__file_exts: - return not self.__is_include_exts - else: - return self.__is_include_exts - - def _subdirectories_and_files(self, directory_path): - files, directories = [], [] - directory_contents = os.listdir(directory_path) - for object_name in directory_contents: - object_path = os.path.join(directory_path, object_name) - if os.path.isfile( object_path ) and not self._is_to_skip( object_path ): - files.append( object_path ) - elif os.path.isdir( object_path ): - directories.append( object_path ) - else: - pass - return directories, files - - def __iter__(self): - raise NotImplementedError - - def next(self): - raise NotImplementedError - - def restart(self): - raise NotImplementedError - -class files_walker(base_files_iterator): - def __init__(self, directories, file_ext_filter = '', is_include_filter = True, is_recursive = True): - base_files_iterator.__init__(self, file_ext_filter, is_include_filter) - self.__directories = _make_list( directories ) - self.__is_recursive = is_recursive - self.__file_generator = None - - def __walk(self): - directories = self.__directories[:] - while directories: - sub_directories, files = self._subdirectories_and_files( directories.pop(0) ) - if self.__is_recursive: - for directory in sub_directories: - directories.append( directory ) - for file_os in files: - yield file_os - - def __iter__(self): - self.__file_generator = self.__walk() - return self - - def next(self): - return self.__file_generator.next() - - def restart(self): - self.__file_generator = None - - -class directories_walker: - def __init__(self, directories, is_recursive = 1): - self.__directories = [] - for root in _make_list( directories ): - self.__directories.extend( self.__sub_directories( root ) ) - self.__is_recursive = is_recursive - self.__directory_generator = None - - def __sub_directories(self, directory_path): - sub_directories = [] - directory_contains = os.listdir(directory_path) - for object_in_directory in directory_contains: - full_path = os.path.join(directory_path, object_in_directory) - if os.path.isdir( full_path ): - sub_directories.append( full_path ) - return sub_directories - - def __walk(self): - directories = self.__directories[:] - for curr_directory in directories: - yield curr_directory - if self.__is_recursive: - for f in directories_walker( [curr_directory], True ): - yield f - - def __iter__(self): - self.__directory_generator = self.__walk() - return self - - def next(self): - return self.__directory_generator.next() - - def restart(self): - self.__directory_generator = None - - -if '__main__' == __name__: - pass - #lFileCount = 0 - #for file_os in files_iterator( r'C:\Program Files\Microsoft Visual Studio\VC98\Include\stlport', ['*.h', '*.'], True, False): - #print file_os - #lFileCount += 1 - #print lFileCount - - #~ for directory in directories_iterator( '/home/roman/language-binding', False ): - #~ print directory - #~ for directory in directories_iterator( '/home/roman/language-binding', True ): - #~ print directory diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/__init__.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/__init__.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/__init__.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/pygccxml/utils/__init__.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,156 +0,0 @@ -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -""" -defines logger classes and few convinience methods, not related to the declarations -tree -""" - -import os -import sys -import logging -import tempfile -from fs_utils import files_walker -from fs_utils import directories_walker - -def _create_logger_( name ): - """implementation details""" - logger = logging.getLogger(name) - handler = logging.StreamHandler() - #handler.setFormatter( logging.Formatter( os.linesep + '%(levelname)s %(message)s' ) ) - handler.setFormatter( logging.Formatter( '%(levelname)s %(message)s' ) ) - logger.addHandler(handler) - logger.setLevel(logging.WARNING) - return logger - -class loggers: - """class-namespace, defines few loggers classes, used in the project""" - - cxx_parser = _create_logger_( 'pygccxml.cxx_parser' ) - """logger for C++ parser functionality - - If you set this logger level to DEBUG, you will be able to see the exact - command line, used to invoke GCC-XML and errors that occures during XML parsing - """ - - gccxml = cxx_parser #backward compatability - - pdb_reader = _create_logger_( 'pygccxml.pdb_reader' ) - """logger for MS .pdb file reader functionality - """ - - - queries_engine = _create_logger_( 'pygccxml.queries_engine' ) - """logger for query engine functionality. - - If you set this logger level to DEBUG, you will be able to see what queries - you do against declarations tree, measure performance and may be even to improve it. - Query engine reports queries and whether they are optimized or not. - """ - - declarations_cache = _create_logger_( 'pygccxml.declarations_cache' ) - """logger for declarations tree cache functionality - - If you set this logger level to DEBUG, you will be able to see what is exactly - happens, when you read the declarations from cache file. You will be able to - decide, whether it worse for you to use this or that cache strategy. - """ - - root = logging.getLogger( 'pygccxml' ) - """root logger exists for your convinience only""" - - all = [ root, cxx_parser, queries_engine, declarations_cache, pdb_reader ] - """contains all logger classes, defined by the class""" - -def remove_file_no_raise(file_name ): - """removes file from disk, if exception is raised, it silently ignores it""" - try: - if os.path.exists(file_name): - os.remove( file_name ) - except Exception, error: - loggers.root.error( "Error ocured while removing temprorary created file('%s'): %s" - % ( file_name, str( error ) ) ) - -def create_temp_file_name(suffix, prefix=None, dir=None): - """small convinience function that creates temporal file. - - This function is a wrapper aroung Python built-in function - tempfile.mkstemp - """ - if not prefix: - prefix = tempfile.template - fd, name = tempfile.mkstemp( suffix=suffix, prefix=prefix, dir=dir ) - file_obj = os.fdopen( fd ) - file_obj.close() - return name - -def normalize_path( some_path ): - """return os.path.normpath( os.path.normcase( some_path ) )""" - return os.path.normpath( os.path.normcase( some_path ) ) - -def get_architecture(): - """returns computer architecture: 32 or 64. - - The guess is based on maxint. - """ - if sys.maxint == 2147483647: - return 32 - elif sys.maxint == 9223372036854775807: - return 64 - else: - raise RuntimeError( "Unknown architecture" ) - - -#The following code is cut-and-paste from this post: -#http://groups.google.com/group/comp.lang.python/browse_thread/thread/5b71896c06bd0f76/ -#Thanks to Michele Simionato, for it -class cached(property): - 'Convert a method into a cached attribute' - def __init__(self, method): - private = '_' + method.__name__ - def fget(s): - try: - return getattr(s, private) - except AttributeError: - value = method(s) - setattr(s, private, value) - return value - def fdel(s): - del s.__dict__[private] - super(cached, self).__init__(fget, fdel=fdel) - - @staticmethod - def reset(self): - cls = self.__class__ - for name in dir(cls): - attr = getattr(cls, name) - if isinstance(attr, cached): - delattr(self, name) - -class enum( object ): - """Usage example: - class fruits(enum): - apple = 0 - orange = 1 - - fruits.has_value( 1 ) - fruits.name_of( 1 ) - """ - - @classmethod - def has_value( cls, enum_numeric_value ): - for name, value in cls.__dict__.iteritems(): - if enum_numeric_value == value: - return True - else: - return False - - @classmethod - def name_of( cls, enum_numeric_value ): - for name, value in cls.__dict__.iteritems(): - if enum_numeric_value == value: - return name - else: - raise RuntimeError( 'Unable to find name for value(%d) in enumeration "%s"' - % ( enum_numeric_value, cls.__name__ ) ) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/README.txt otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/README.txt --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/README.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/README.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -pygccxml - Reading GCCXML output -================================ - -pygccxml is a specialized XML reader that reads the output from GCCXML. - -Homepage: http://www.language-binding.net/pygccxml/pygccxml.html - - -Install -------- - -The package uses the Python distutils so you can do the usual procedure: - - python setup.py install - -For more information about using the distutils see the Python manual -"Installing Python Modules". - - -Documentation -------------- - -For examples and tutorials see the pygccxml web site. An API reference -is available in the directory docs/apidocs in the source archive. - -If you obtained the source code from the subversion repository you -have to build the API reference yourself. This can be done using the -setup script: - - python setup.py doc - -In order for this to work you need epydoc (http://epydoc.sourceforge.net). - - --------------------------------------------------------------------------- -Copyright 2004-2008 Roman Yakovenko. -Distributed under the Boost Software License, Version 1.0. (See -accompanying file LICENSE_1_0.txt or copy at -http://www.boost.org/LICENSE_1_0.txt) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/setup.py otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/setup.py --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/setup.py 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/SwigInterface/pygccxml-1.0.0/setup.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# Copyright 2004-2008 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import sys, os, os.path -from distutils import sysconfig -from distutils.core import setup -from distutils.cmd import Command - -def generate_doc(): - """Generate the epydoc reference manual. - """ - print "Generating epydoc files..." - - from epydoc.docbuilder import build_doc_index - from epydoc.docwriter.html import HTMLWriter - - docindex = build_doc_index(['pygccxml']) - html_writer = HTMLWriter( docindex - , prj_name='pygccxml' - , prj_url='http://www.language-binding.net' - , show_private=False - , show_frames=False) - - html_writer.write( os.path.join('docs', 'apidocs') ) - -class doc_cmd(Command): - """This is a new distutils command 'doc' to build the epydoc manual. - """ - - description = 'build the API reference using epydoc' - user_options = [('no-doc', None, "don't run epydoc")] - boolean_options = ['no-doc'] - - def initialize_options (self): - self.no_doc = 0 - - def finalize_options (self): - pass - - def run(self): - if self.no_doc: - return - generate_doc() - - -# Generate the doc when a source distribution is created -if sys.argv[-1]=="sdist": - generate_doc() - - -setup( name = "pygccxml", - version = "1.0.0", - description = "GCC-XML generated file reader", - author = "Roman Yakovenko", - author_email = "roman.yakovenko@gmail.com", - url = 'http://www.language-binding.net/pygccxml/pygccxml.html', - packages = [ 'pygccxml', - 'pygccxml.declarations', - 'pygccxml.parser', - 'pygccxml.msvc', - 'pygccxml.msvc.bsc', - 'pygccxml.msvc.pdb', - 'pygccxml.utils' ], - cmdclass = {"doc" : doc_cmd} -) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Tcl/CreateLanguageSupport.cmake otb-4.2.0/Utilities/ITK/Wrapping/Generators/Tcl/CreateLanguageSupport.cmake --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Tcl/CreateLanguageSupport.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Tcl/CreateLanguageSupport.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -12,7 +12,7 @@ set(modules ) - foreach(source ${WRAPPER_LIBRARY_CABLESWIG_INPUTS}) + foreach(source ${WRAPPER_LIBRARY_SWIG_INPUTS}) get_filename_component(base_name ${source} NAME_WE) string(REGEX REPLACE "^wrap_" "" group_name "${base_name}") diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/Generators/Tcl/TCLGetInterp.i otb-4.2.0/Utilities/ITK/Wrapping/Generators/Tcl/TCLGetInterp.i --- otb-4.0.0/Utilities/ITK/Wrapping/Generators/Tcl/TCLGetInterp.i 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/Generators/Tcl/TCLGetInterp.i 2014-09-03 08:29:34.000000000 +0000 @@ -77,7 +77,7 @@ %} // import fake itk command -// because itkCommand will be wrapped elsewhere by cableswig +// because itkCommand will be wrapped elsewhere by swig %import "itkCommand.i" // create an itkJavaCommand that has an Execute method that diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/itkWrapSetup.cmake otb-4.2.0/Utilities/ITK/Wrapping/itkWrapSetup.cmake --- otb-4.0.0/Utilities/ITK/Wrapping/itkWrapSetup.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/itkWrapSetup.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,23 +1,21 @@ - -# Make it easier to enable the main supported languages, by providing the option even when -# the Wrapping directory has not yet been included -option(ITK_WRAP_PYTHON "Build python support" OFF) - -option(ITK_WRAPPING "Build external languages support" OFF) -mark_as_advanced(ITK_WRAPPING) - # check whether we should go in the wrapping folder, even with ITK_WRAPPING is OFF +# ITK_WRAPPING is an internal variable that indicates wrapping for any +# language will be attempted. if(NOT ITK_WRAPPING_REACHED) if(ITK_WRAP_PYTHON OR ITK_WRAP_JAVA) # force ITK_WRAPPING to ON - unset(ITK_WRAPPING CACHE) - option(ITK_WRAPPING "Build external languages support" ON) - mark_as_advanced(ITK_WRAPPING) + set(ITK_WRAPPING ON CACHE INTERNAL "Build external languages support" FORCE) endif() endif() if(ITK_WRAPPING) if(NOT ITK_BUILD_SHARED_LIBS) - message(FATAL_ERROR "Wrapping requires a shared build, change BUILD_SHARED_LIBS to ON") + message(WARNING "Wrapping requires a shared build, changing BUILD_SHARED_LIBS to ON") + set(BUILD_SHARED_LIBS ON CACHE BOOL "Build ITK with shared libraries." FORCE ) + endif() + + if(ITK_USE_64BITS_IDS AND WIN32) + message(FATAL_ERROR "Wrapping with ITK_USE_64BITS_IDS is not supported on Windows. + Please turn OFF ITK_USE_64BITS_IDS.") endif() endif() diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/TypedefMacros.cmake otb-4.2.0/Utilities/ITK/Wrapping/TypedefMacros.cmake --- otb-4.0.0/Utilities/ITK/Wrapping/TypedefMacros.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/TypedefMacros.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -1,5 +1,5 @@ ################################################################################ -# Macro definitions for creating proper CableSwig input files from wrap_*.cmake +# Macro definitions for creating proper Swig input files from wrap_*.cmake # files. # This file includes definitions for the macros to call from a CMakeList file # to cause wrap_*.cmake files to be turned into CXX files, and definitions for @@ -69,20 +69,16 @@ # not the full path or file name. set(WRAPPER_LIBRARY_GROUPS ) - # WRAPPER_LIBRARY_CABLESWIG_INPUTS. List of C++ source files to be used - # as input for CableSwig. This list is then appended to by + # WRAPPER_LIBRARY_SWIG_INPUTS. List of C++ source files to be used + # as input for Swig. This list is then appended to by # WRAPPER_LIBRARY_AUTO_INCLUDE_WRAP_FILES. A full path to each input is required. - set(WRAPPER_LIBRARY_CABLESWIG_INPUTS ) + set(WRAPPER_LIBRARY_SWIG_INPUTS ) # WRAPPER_SWIG_LIBRARY_FILES. List of swig .swg files to pass to cswig to control # type handling and so forth. A full path to each include is required. # The itk.swg file and the library file for the current library are implicitly added. set(WRAPPER_SWIG_LIBRARY_FILES ) - # WRAPPER_LIBRARY_SWIG_INPUTS. SWIG input files to be fed to swig (not - # CableSwig). A full path to each input is required. - set(WRAPPER_LIBRARY_SWIG_INPUTS ) - # WRAPPER_LIBRARY_CXX_SOURCES. C++ sources to be compiled and linked in # to the wrapper library (with no prior processing by swig, etc.) # A full path to each input is required. @@ -153,7 +149,7 @@ # Include the wrap_*.cmake files in WRAPPER_LIBRARY_SOURCE_DIR. This causes # corresponding wrap_*.cxx files to be generated WRAPPER_LIBRARY_OUTPUT_DIR, - # and added to the WRAPPER_LIBRARY_CABLESWIG_INPUTS list. + # and added to the WRAPPER_LIBRARY_SWIG_INPUTS list. # In addition, this causes the other required wrap_*.cxx files for the entire # library and each wrapper language to be created. # Finally, this macro causes the language support files for the templates and @@ -284,7 +280,7 @@ # Write the file, inless the included cmake file told us not to. # A file might declare WRAPPER_DO_NOT_CREATE_CXX if that cmake file # provides a custom wrap_*.cxx file and manually appends it to the - # WRAPPER_LIBRARY_CABLESWIG_INPUTS list; thus that file would not + # WRAPPER_LIBRARY_SWIG_INPUTS list; thus that file would not # need or want any cxx file generated. # if(NOT WRAPPER_DO_NOT_CREATE_CXX) # WRITE_WRAP_CXX("wrap_${module}.cxx") @@ -405,7 +401,7 @@ endmacro() macro(itk_wrap_simple_class class) - # Similar to itk_wrap_class in that it generates typedefs for CableSwig input. + # Similar to itk_wrap_class in that it generates typedefs for Swig input. # However, since no templates need to be declared, there's no need for # itk_wrap_class ... (declare templates) .. itk_end_wrap_class. Instead # itk_wrap_simple_class takes care of it all. @@ -425,7 +421,7 @@ macro(itk_wrap_named_simple_class class swig_name) - # Similar to itk_wrap_named_class in that it generates typedefs for CableSwig input. + # Similar to itk_wrap_named_class in that it generates typedefs for Swig input. # However, since no templates need to be declared, there's no need for # itk_wrap_class ... (declare templates) .. itk_end_wrap_class. Instead # itk_wrap_named_simple_class takes care of it all. @@ -469,7 +465,7 @@ macro(itk_end_wrap_class) # Parse through the list of WRAPPER_TEMPLATES set up by the macros at the bottom # of this file, turning them into proper C++ type definitions suitable for - # input to CableSwig. The C++ definitions are stored in WRAPPER_TYPEDEFS. + # input to Swig. The C++ definitions are stored in WRAPPER_TYPEDEFS. # # Global vars used: WRAPPER_CLASS WRAPPER_WRAP_METHOD WRAPPER_TEMPLATES WRAPPER_SWIG_NAME # Global vars modified: WRAPPER_TYPEDEFS @@ -560,7 +556,7 @@ # Macros which cause one or more template instantiations to be added to the # WRAPPER_TEMPLATES list. This list is initialized by the macro itk_wrap_class above, # and used by the macro itk_end_wrap_class to produce the wrap_xxx.cxx files with -# the correct templates. These cxx files serve as the CableSwig inputs. +# the correct templates. These cxx files serve as the Swig inputs. ################################################################################ macro(itk_wrap_template name types) @@ -798,182 +794,3 @@ INTERSECTION(${var_name} "${dimension_condition}" "${ITK_WRAP_DIMS}") endif() endmacro() - - -# deprecated macros -macro(WRAP_LIBRARIES) - message("Deprecation warning: WRAP_LIBRARIES is replaced by itk_wrap_modules.") - itk_wrap_modules() -endmacro() - -macro(END_WRAP_LIBRARIES) - message("Deprecation warning: END_WRAP_LIBRARIES is replaced by itk_end_wrap_modules.") - itk_end_wrap_modules() -endmacro() - -macro(WRAP_LIBRARY library_name) - message("Deprecation warning: WRAP_LIBRARY is replaced by itk_wrap_module.") - itk_wrap_module("${library_name}") -endmacro() - -macro(END_WRAP_LIBRARY ) - message("Deprecation warning: END_WRAP_LIBRARY is replaced by itk_end_wrap_module.") - itk_end_wrap_module("${library_name}") -endmacro() - -macro(AUTO_INCLUDE_MODULES) - message("Deprecation warning: AUTO_INCLUDE_MODULES is replaced by itk_auto_load_submodules.") - itk_auto_load_submodules() -endmacro() - -macro(WRAP_MODULE module) - message("Deprecation warning: WRAP_MODULE is replaced by itk_wrap_submodule.") - itk_wrap_submodule("${module}") -endmacro() - -macro(END_WRAP_MODULE) - message("Deprecation warning: END_WRAP_MODULE is replaced by itk_end_wrap_submodule.") - itk_end_wrap_submodule() -endmacro() - -macro(WRAP_CLASS class) - message("Deprecation warning: WRAP_CLASS is replaced by itk_wrap_class.") - itk_wrap_class("${class}" "${ARGN}") -endmacro() - -macro(WRAP_NAMED_CLASS class swig_name) - message("Deprecation warning: WRAP_NAMED_CLASS is replaced by itk_wrap_named_class.") - itk_wrap_named_class("${class}" "${swig_name}" "${ARGN}") -endmacro() - -macro(WRAP_NON_TEMPLATE_CLASS class) - message("Deprecation warning: WRAP_NON_TEMPLATE_CLASS is replaced by itk_wrap_simple_class.") - itk_wrap_simple_class("${class}" "${ARGN}") -endmacro() - -macro(WRAP_NAMED_NON_TEMPLATE_CLASS class swig_name) - message("Deprecation warning: WRAP_NAMED_NON_TEMPLATE_CLASS is replaced by itk_wrap_named_simple_class.") - itk_wrap_named_simple_class("${class}" "${swig_name}" "${ARGN}") -endmacro() - -macro(WRAP_INCLUDE include_file) - message("Deprecation warning: WRAP_INCLUDE is replaced by itk_wrap_include.") - itk_wrap_include("${include_file}") -endmacro() - -macro(END_WRAP_CLASS) - message("Deprecation warning: END_WRAP_CLASS is replaced by itk_end_wrap_class.") - itk_end_wrap_class() -endmacro() - -macro(ADD_ONE_TYPEDEF wrap_method wrap_class swig_name) - message("Deprecation warning: ADD_ONE_TYPEDEF is replaced by itk_wrap_one_type.") - itk_wrap_one_type("${wrap_method}" "${wrap_class}" "${swig_name}") -endmacro() - -macro(WRAP_TEMPLATE name type) - message("Deprecation warning: WRAP_TEMPLATE is replaced by itk_wrap_template.") - itk_wrap_template("${name}" "${type}") -endmacro() - -macro(WRAP_IMAGE_FILTER param_type param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER is replaced by itk_wrap_template.") - itk_wrap_image_filter("${param_type}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_ALL_TYPES param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_ALL_TYPES() is replaced by itk_wrap_template(\"\${WRAP_ITK_ALL_TYPES}\").") - itk_wrap_image_filter("${WRAP_ITK_ALL_TYPES}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_SCALAR param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_SCALAR() is replaced by itk_wrap_template(\"\${WRAP_ITK_SCALAR}\").") - itk_wrap_image_filter("${WRAP_ITK_SCALAR}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_VECTOR param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_VECTOR() is replaced by itk_wrap_template(\"\${WRAP_ITK_VECTOR}\").") - itk_wrap_image_filter("${WRAP_ITK_VECTOR}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_USIGN_INT param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_USIGN_INT() is replaced by itk_wrap_template(\"\${WRAP_ITK_USIGN_INT}\").") - itk_wrap_image_filter("${WRAP_ITK_USIGN_INT}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_SIGN_INT param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_SIGN_INT() is replaced by itk_wrap_template(\"\${WRAP_ITK_SIGN_INT}\").") - itk_wrap_image_filter("${WRAP_ITK_SIGN_INT}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_INT param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_INT() is replaced by itk_wrap_template(\"\${WRAP_ITK_INT}\").") - itk_wrap_image_filter("${WRAP_ITK_INT}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_REAL param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_REAL() is replaced by itk_wrap_template(\"\${WRAP_ITK_REAL}\").") - itk_wrap_image_filter("${WRAP_ITK_REAL}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_RGB param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_RGB() is replaced by itk_wrap_template(\"\${WRAP_ITK_RGB}\").") - itk_wrap_image_filter("${WRAP_ITK_RGB}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_RGBA param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_RGBA() is replaced by itk_wrap_template(\"\${WRAP_ITK_RGBA}\").") - itk_wrap_image_filter("${WRAP_ITK_RGBA}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_VECTOR_REAL param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_VECTOR_REAL() is replaced by itk_wrap_template(\"\${WRAP_ITK_VECTOR_REAL}\").") - itk_wrap_image_filter("${WRAP_ITK_VECTOR_REAL}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_COV_VECTOR_REAL param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_COV_VECTOR_REAL() is replaced by itk_wrap_template(\"\${WRAP_ITK_COV_VECTOR_REAL}\").") - itk_wrap_image_filter("${WRAP_ITK_COV_VECTOR_REAL}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_COMPLEX_REAL param_count) - message("Deprecation warning: WRAP_IMAGE_FILTER_COMPLEX_REAL() is replaced by itk_wrap_template(\"\${WRAP_ITK_COMPLEX_REAL}\").") - itk_wrap_image_filter("${WRAP_ITK_COMPLEX_REAL}" ${param_count} "${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_COMBINATIONS) - message("Deprecation warning: WRAP_IMAGE_FILTER_COMBINATIONS is replaced by itk_wrap_image_filter_combinations.") - itk_wrap_image_filter_combinations("${ARGN}") -endmacro() - -macro(WRAP_IMAGE_FILTER_TYPES) - message("Deprecation warning: WRAP_IMAGE_FILTER_TYPES is replaced by itk_wrap_image_filter_types.") - itk_wrap_image_filter_types("${ARGN}") -endmacro() - -macro(FILTER_DIMS) - message("Deprecation warning: FILTER_DIMS is replaced by itk_wrap_filter_dims.") - itk_wrap_filter_dims("${ARGN}") -endmacro() - -macro(BEGIN_WRAPPER_LIBRARY library_name) - message("Deprecation warning: BEGIN_WRAPPER_LIBRARY is replaced by itk_wrap_module.") - itk_wrap_module("${library_name}") -endmacro() - -macro(WRAPPER_LIBRARY_CREATE_LIBRARY) - message("Deprecation warning: WRAPPER_LIBRARY_CREATE_LIBRARY is replaced by itk_end_wrap_module.") - itk_end_wrap_module() -endmacro() - -macro(WRAPPER_LIBRARY_CREATE_WRAP_FILES) - message("Deprecation warning: WRAPPER_LIBRARY_CREATE_WRAP_FILES is replaced by itk_auto_load_submodules.") - itk_auto_load_submodules() -endmacro() - -macro(INCLUDE_WRAP_CMAKE module) - message("Deprecation warning: INCLUDE_WRAP_CMAKE is replaced by itk_load_submodule.") - itk_load_submodule("${module}") -endmacro() - -set(WRAP_ITK_DIMS "${ITK_WRAP_DIMS}" CACHE INTERNAL "deprecated - do not use" FORCE) diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/WrapITKConfig.cmake.in otb-4.2.0/Utilities/ITK/Wrapping/WrapITKConfig.cmake.in --- otb-4.0.0/Utilities/ITK/Wrapping/WrapITKConfig.cmake.in 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/WrapITKConfig.cmake.in 2014-09-03 08:29:34.000000000 +0000 @@ -22,11 +22,6 @@ set(SWIG_DIR "${possible_swig_dir}" CACHE PATH "Path to Swig build or install") endif() -# set WrapITK version -set(WrapITK_VERSION_MAJOR @WrapITK_VERSION_MAJOR@) -set(WrapITK_VERSION_MINOR @WrapITK_VERSION_MINOR@) -set(WrapITK_VERSION_PATCH @WrapITK_VERSION_PATCH@) - # Set up the rest of the variables that WrapITK was built with. set(ITK_WRAP_unsigned_char @ITK_WRAP_unsigned_char@ CACHE BOOL "Wrap unsigned char type") set(ITK_WRAP_unsigned_short @ITK_WRAP_unsigned_short@ CACHE BOOL "Wrap unsigned short type") diff -Nru otb-4.0.0/Utilities/ITK/Wrapping/WrapITKTypes.cmake otb-4.2.0/Utilities/ITK/Wrapping/WrapITKTypes.cmake --- otb-4.0.0/Utilities/ITK/Wrapping/WrapITKTypes.cmake 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/ITK/Wrapping/WrapITKTypes.cmake 2014-09-03 08:29:34.000000000 +0000 @@ -4,7 +4,6 @@ # itk::Command has to be available in all ITK wrapped files set(WRAPPER_DEFAULT_INCLUDE itkCommand.h - itkStatisticsLabelObject.h ) # define some macro to help creation of types vars @@ -243,22 +242,28 @@ END_WRAP_TYPE() set(itk_Wrap_Point ${WRAPPER_TEMPLATES}) -WRAP_TYPE("itk::LevelSetNode" "LSN") - # Only make level set nodes for the selected image pixel types - foreach(d ${ITK_WRAP_DIMS}) - foreach(type ${WRAP_ITK_SCALAR}) - ADD_TEMPLATE("${ITKM_${type}}${d}" "${ITKT_${type}},${d}") +if(ITK_BUILD_DEFAULT_MODULES OR ITKGroup_Filtering) + # Needed by Modules/Filtering/FastMarching/wrapping/itkLevelSetNode.wrap + WRAP_TYPE("itk::LevelSetNode" "LSN") + # Only make level set nodes for the selected image pixel types + foreach(d ${ITK_WRAP_DIMS}) + foreach(type ${WRAP_ITK_SCALAR}) + ADD_TEMPLATE("${ITKM_${type}}${d}" "${ITKT_${type}},${d}") + endforeach() endforeach() - endforeach() -END_WRAP_TYPE() -set(itk_Wrap_LevelSetNode ${WRAPPER_TEMPLATES}) - -WRAP_TYPE("itk::FlatStructuringElement" "SE") - foreach(d ${ITK_WRAP_DIMS}) - ADD_TEMPLATE("${d}" "${d}") - endforeach() -END_WRAP_TYPE() -set(itk_Wrap_StructuringElement ${WRAPPER_TEMPLATES}) + END_WRAP_TYPE() + set(itk_Wrap_LevelSetNode ${WRAPPER_TEMPLATES}) +endif() + +if(ITK_BUILD_DEFAULT_MODULES OR ITKGroup_Filtering) + # Needed by Modules/Filtering/MathematicalMorphology/wrapping/itkFlatStructuringElement.wrap + WRAP_TYPE("itk::FlatStructuringElement" "SE") + foreach(d ${ITK_WRAP_DIMS}) + ADD_TEMPLATE("${d}" "${d}") + endforeach() + END_WRAP_TYPE() + set(itk_Wrap_StructuringElement ${WRAPPER_TEMPLATES}) +endif() WRAP_TYPE("itk::SpatialObject" "SO") foreach(d ${ITK_WRAP_DIMS}) @@ -273,11 +278,14 @@ END_WRAP_TYPE() set(itk_Wrap_Histogram ${WRAPPER_TEMPLATES}) -WRAP_TYPE("itk::LabelMap" "LM") - foreach(d ${ITK_WRAP_DIMS}) - ADD_TEMPLATE("${d}" "itk::StatisticsLabelObject< ${ITKT_UL}, ${d} >") -endforeach() -END_WRAP_TYPE() -set(itk_Wrap_LabelMap ${WRAPPER_TEMPLATES}) +if(ITK_BUILD_DEFAULT_MODULES OR ITKGroup_Filtering) + # Needed by Modules/Filtering/LabelMap/wrapping/ITKLabelMapBase.wrap + WRAP_TYPE("itk::LabelMap" "LM") + foreach(d ${ITK_WRAP_DIMS}) + ADD_TEMPLATE("${d}" "itk::StatisticsLabelObject< ${ITKT_UL}, ${d} >") + endforeach() + END_WRAP_TYPE() + set(itk_Wrap_LabelMap ${WRAPPER_TEMPLATES}) +endif() #------------------------------------------------------------------------------ diff -Nru otb-4.0.0/Utilities/otbkml/CMakeLists.txt otb-4.2.0/Utilities/otbkml/CMakeLists.txt --- otb-4.0.0/Utilities/otbkml/CMakeLists.txt 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbkml/CMakeLists.txt 2014-09-03 08:29:34.000000000 +0000 @@ -161,7 +161,6 @@ if(WIN32) if(NOT BORLAND) # if(NOT CYGWIN) - if(NOT MINGW) include_directories("${CMAKE_CURRENT_SOURCE_DIR}/third_party/zlib-1.2.3.src") set(libzlib_src_la_SOURCES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/zlib-1.2.3.src") set(libzlib_src_la_SOURCES @@ -178,8 +177,7 @@ ${libzlib_src_la_SOURCES_DIR}/uncompr.c ${libzlib_src_la_SOURCES_DIR}/zutil.c ) set(LIBKML_COMPILE_ZLIB ON) - endif() -# endif() +# endif() endif() endif() if(APPLE) diff -Nru otb-4.0.0/Utilities/otbkml/src/kml/base/file_win32.cc otb-4.2.0/Utilities/otbkml/src/kml/base/file_win32.cc --- otb-4.0.0/Utilities/otbkml/src/kml/base/file_win32.cc 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbkml/src/kml/base/file_win32.cc 2014-09-03 08:29:34.000000000 +0000 @@ -32,7 +32,9 @@ #include "kml/base/file.h" #include #include +#ifndef __MINGW32__ #include +#endif #include namespace kmlbase { @@ -40,7 +42,11 @@ // Internal to the win32 file class. We need a conversion from string to // LPCWSTR. static std::wstring Str2Wstr(const string& str) { - std::wstring wstr(str.length(), L''); +#ifndef __MINGW32__ + std::wstring wstr(str.length(), L''); +#else + std::wstring wstr(str.length(), L' '); +#endif std::copy(str.begin(), str.end(), wstr.begin()); return wstr; } diff -Nru otb-4.0.0/Utilities/otbmuparser/muParserBytecode.cpp otb-4.2.0/Utilities/otbmuparser/muParserBytecode.cpp --- otb-4.0.0/Utilities/otbmuparser/muParserBytecode.cpp 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbmuparser/muParserBytecode.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -30,6 +30,7 @@ #include #include #include +#include #include "muParserDef.h" #include "muParserError.h" diff -Nru otb-4.0.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.c otb-4.2.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.c --- otb-4.0.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.c 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.c 2014-09-03 08:29:34.000000000 +0000 @@ -174,7 +174,7 @@ /* ---------------------------------------------------------------------- */ #ifdef _WIN32 -#ifndef OPJ_STATIC +#if !defined(OPJ_STATIC) && !defined(__MINGW32__) BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { diff -Nru otb-4.0.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.h otb-4.2.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.h --- otb-4.0.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbopenjpeg/libopenjpeg/openjpeg.h 2014-09-03 08:29:34.000000000 +0000 @@ -1526,7 +1526,7 @@ OPJ_API opj_jp2_index_t* OPJ_CALLCONV opj_get_jp2_index(opj_codec_t *p_codec); /* >>OTB */ -OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create0(); +//OPJ_API opj_image_t* OPJ_CALLCONV opj_image_create0(); OPJ_API void opj_copy_image_header(const opj_image_t* p_image_src, opj_image_t* p_image_dest); /* < #include -class NEWMAT::Matrix; +namespace NEWMAT +{ +class Matrix; +} //***************************************************************************** // CLASS: ossimRS1SarModel @@ -37,7 +40,7 @@ ossimRS1SarModel(const ossimFilename& imageDir); virtual ~ossimRS1SarModel(); - + enum ImagingMode { UNKNOWN_MODE = 0, @@ -59,25 +62,25 @@ ASCENDING, DESCENDING }; - + //! Fulfills ossimObject base-class pure virtuals. Saves modeling info to KWL. //! Returns true if successful. virtual bool saveState(ossimKeywordlist& kwl, const char* prefix=NULL) const; - + //! Fulfills ossimObject base-class pure virtuals. Reads modeling info from KWL. //! Returns true if successful. virtual bool loadState(const ossimKeywordlist& kwl, const char* prefix=NULL); //! Establishes geographic 3D point given image line, sample and ellipsoid height. - virtual void lineSampleHeightToWorld(const ossimDpt& imagePt, - const double& heightAboveEllipsoid, + virtual void lineSampleHeightToWorld(const ossimDpt& imagePt, + const double& heightAboveEllipsoid, ossimGpt& worldPt) const; //! Given an image point, returns a ray originating at some arbitrarily high //! point (in this model at the sensor position) and pointing towards the target. virtual void imagingRay(const ossimDpt& image_point, ossimEcefRay& image_ray) const; - inline virtual bool useForward() const { return false; } //!image to ground faster + inline virtual bool useForward() const { return false; } //!image to ground faster //! Returns pointer to a new instance, copy of this. virtual ossimObject* dup() const { return 0; } // TBR @@ -93,7 +96,7 @@ void establishVehicleSpace(); void interpolatedScanORP(const ossimDpt& orp, ossimEcefPoint& orp_ecf) const; void deallocateMemory(); - + ossimRefPtr theCeosData; ossimRefPtr theArpPosInterp; // in ECF ossimRefPtr theArpVelInterp; // in ECF @@ -115,13 +118,13 @@ double theTimePerLine; // seconds DirectionFlag theDirectionFlag; double theSrGrCoeff[6]; - ossimDpt thePixelSpacing; + ossimDpt thePixelSpacing; //*** // Additional data members used for scan-mode imagery: //*** ossimDblGrid theLatGrid; ossimDblGrid theLonGrid; - + //*** // Adjustable Parameters: //*** @@ -131,7 +134,7 @@ double theLineScale; double theSkew; double theOrientation; // degrees - + //*** // Adjustable model parameters array indexes: //*** @@ -150,4 +153,3 @@ #endif - diff -Nru otb-4.0.0/Utilities/otbossim/src/ossim/imaging/ossimTiling.cpp otb-4.2.0/Utilities/otbossim/src/ossim/imaging/ossimTiling.cpp --- otb-4.0.0/Utilities/otbossim/src/ossim/imaging/ossimTiling.cpp 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbossim/src/ossim/imaging/ossimTiling.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -932,7 +932,8 @@ if (theMapProjection.valid()) { - out << "\ntheMapProjection:\n" << theMapProjection->print(out); + out << "\ntheMapProjection:\n"; + theMapProjection->print(out); } else { diff -Nru otb-4.0.0/Utilities/otbossim/src/ossim/projection/ossimNitfProjectionFactory.cpp otb-4.2.0/Utilities/otbossim/src/ossim/projection/ossimNitfProjectionFactory.cpp --- otb-4.0.0/Utilities/otbossim/src/ossim/projection/ossimNitfProjectionFactory.cpp 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbossim/src/ossim/projection/ossimNitfProjectionFactory.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -282,14 +282,14 @@ if (traceDebug() && proj) { - ossimNotify(ossimNotifyLevel_DEBUG) - << "ossimNitfProjectionFactory::makeGeographic DEBUG:" - << "\nUpper left corner: " << gpts[0] - << "\nUpper right corner: " << gpts[1] - << "\nLower right corner: " << gpts[2] - << "\nLower left corner: " << gpts[3] << endl - << proj->print(ossimNotify(ossimNotifyLevel_DEBUG)) - << std::endl; + ossimNotify(ossimNotifyLevel_DEBUG) + << "ossimNitfProjectionFactory::makeGeographic DEBUG:" + << "\nUpper left corner: " << gpts[0] + << "\nUpper right corner: " << gpts[1] + << "\nLower right corner: " << gpts[2] + << "\nLower left corner: " << gpts[3] << std::endl; + proj->print(ossimNotify(ossimNotifyLevel_DEBUG)); + ossimNotify(ossimNotifyLevel_DEBUG) << std::endl; } } // matches: if (hdr) diff -Nru otb-4.0.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.cpp otb-4.2.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.cpp --- otb-4.0.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.cpp 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -146,6 +146,8 @@ theIncidenceAngle(), theViewingAngle(), theAzimuthAngle(), + theAlongTrackIncidenceAngle(), + theAcrossTrackIncidenceAngle(), theImageSize(0, 0), theTileSize(0, 0), @@ -185,6 +187,12 @@ theLineDenCoeff(), theSampNumCoeff(), theSampDenCoeff(), + + theTimeRangeStart(), + theTimeRangeEnd(), + theLinePeriod(0.0), + theSwathFirstCol(0), + theSwathLastCol(0), theRefGroundPoint(0.0, 0.0, 0.0), theRefImagePoint(0.0, 0.0) @@ -219,6 +227,9 @@ theViewingAngle.clear(); theAzimuthAngle.clear(); + theAlongTrackIncidenceAngle.clear(); + theAcrossTrackIncidenceAngle.clear(); + theImageSize.makeNan(); theTileSize.makeNan(); theNumberOfMegaTilesInRow = 0; @@ -252,8 +263,8 @@ theErrBiasX = 0.0; theErrBiasY = 0.0; theErrRand = 0.0; - theLineOffset = 0; - theSampOffset = 0; + theLineOffset = 0.0; + theSampOffset = 0.0; theLatOffset = 0.0; theLonOffset = 0.0; theHeightOffset = 0.0; @@ -267,6 +278,12 @@ theSampNumCoeff.clear(); theSampDenCoeff.clear(); theSpecId = ""; + + theTimeRangeStart = ""; + theTimeRangeEnd = ""; + theLinePeriod = 0.0; + theSwathFirstCol = 0; + theSwathLastCol = 0; } void ossimPleiadesDimapSupportData::printInfo(ostream& os) const @@ -294,6 +311,8 @@ << "\n Incidence Angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theIncidenceAngle) << "\n Viewing Angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theViewingAngle) << "\n Azimuth Angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theAzimuthAngle) + << "\n Along track incidence angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theAlongTrackIncidenceAngle) + << "\n Across track incidence angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theAcrossTrackIncidenceAngle) << "\n Sun Azimuth (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theSunAzimuth) << "\n Sun Elevation (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theSunElevation) @@ -332,6 +351,14 @@ << "\n theErrBiasY: " << theErrBiasY << "\n theErrRand: " << theErrRand << "\n" + + << "\n Acquisition time parameters (only valid for SENSOR product):" + << "\n TimeRangeStart: "<< theTimeRangeStart + << "\n TimeRangeEnd: "<< theTimeRangeEnd + << "\n LinePeriod: "<< theLinePeriod + << "\n SwathFirstCol: "<< theSwathFirstCol + << "\n SwathLastCol: "<< theSwathLastCol + << "\n" << "\n---------------------------------------------------------" << "\n " << std::endl; } @@ -635,6 +662,17 @@ va = theViewingAngle; } + void ossimPleiadesDimapSupportData::getAcrossTrackIncidenceAngle(std::vector& act) const + { + act = theAcrossTrackIncidenceAngle; + } + + void ossimPleiadesDimapSupportData::getAlongTrackIncidenceAngle(std::vector& alt) const + { + alt = theAlongTrackIncidenceAngle; + } + + void ossimPleiadesDimapSupportData::getRefGroundPoint(ossimGpt& gp) const { gp = theRefGroundPoint; @@ -833,6 +871,38 @@ static_cast(theAzimuthAngle.size()), true); + + tempString = ""; + for(idx = 0; idx < theAlongTrackIncidenceAngle.size(); ++idx) + { + tempString += (ossimString::toString(theAlongTrackIncidenceAngle[idx]) + " "); + } + kwl.add(prefix, + "along_track_incidence_angle", + tempString, + true); + + kwl.add(prefix, + "number_of_along_track_incidence_angle", + static_cast(theAlongTrackIncidenceAngle.size()), + true); + + + tempString = ""; + for(idx = 0; idx < theAcrossTrackIncidenceAngle.size(); ++idx) + { + tempString += (ossimString::toString(theAcrossTrackIncidenceAngle[idx]) + " "); + } + kwl.add(prefix, + "across_track_incidence_angle", + tempString, + true); + + kwl.add(prefix, + "number_of_across_track_incidence_angle", + static_cast(theAcrossTrackIncidenceAngle.size()), + true); + kwl.add(prefix, "ul_ground_point", ossimString::toString(theUlCorner.latd()) + " " + @@ -901,7 +971,35 @@ "solar_irradiance", tempString, true); - + + // Some geometric parameters exist only in the case of a SENSOR image + if (theProcessingLevelString == "SENSOR") + { + kwl.add(prefix, + "time_range_start", + theTimeRangeStart, + true); + + kwl.add(prefix, + "time_range_end", + theTimeRangeEnd, + true); + + kwl.add(prefix, + "line_period", + ossimString::toString(theLinePeriod), + true); + + kwl.add(prefix, + "swath_first_col", + theSwathFirstCol, + true); + kwl.add(prefix, + "swath_last_col", + theSwathLastCol, + true); + } + return true; } @@ -1019,6 +1117,33 @@ } } + total = ossimString(kwl.find(prefix,"number_of_along_track_incidence_angle")).toUInt32(); + theAlongTrackIncidenceAngle.resize(total); + tempString = kwl.find(prefix,"along_track_incidence_angle"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theAlongTrackIncidenceAngle.size();++idx) + { + in >> tempValue.string(); + theAlongTrackIncidenceAngle[idx] = tempValue.toDouble(); + } + } + + total = ossimString(kwl.find(prefix,"number_of_across_track_incidence_angle")).toUInt32(); + theAcrossTrackIncidenceAngle.resize(total); + tempString = kwl.find(prefix,"across_track_incidence_angle"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theAcrossTrackIncidenceAngle.size();++idx) + { + in >> tempValue.string(); + theAcrossTrackIncidenceAngle[idx] = tempValue.toDouble(); + } + } theUlCorner =createGround( kwl.find(prefix, "ul_ground_point")); theUrCorner =createGround( kwl.find(prefix, "ur_ground_point")); @@ -1067,6 +1192,16 @@ theSolarIrradiance[idx] = tempValue.toDouble(); } } + + // Some geometric parameters exist only in the case of a SENSOR image + if (theProcessingLevelString == "SENSOR") + { + theTimeRangeStart = ossimString(kwl.find(prefix,"time_range_start")); + theTimeRangeEnd = ossimString(kwl.find(prefix,"time_range_end")); + theLinePeriod = ossimString(kwl.find(prefix,"line_period")).toDouble(); + theSwathFirstCol = ossimString(kwl.find(prefix,"swath_first_col")).toInt32(); + theSwathLastCol = ossimString(kwl.find(prefix,"swath_last_col")).toInt32(); + } return true; } @@ -1739,7 +1874,10 @@ { return false; } - theSampOffset = nodeValue.toInt32(); + // Pleiades metadata assume that the coordinate of the center of + // the upper-left pixel is (1,1), so we remove 1 to get back to + // OSSIM convention. + theSampOffset = nodeValue.toDouble()-1; if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) { @@ -1769,7 +1907,10 @@ { return false; } - theLineOffset = nodeValue.toInt32(); + // Pleiades metadata assume that the coordinate of the center of + // the upper-left pixel is (1,1), so we remove 1 to get back to + // OSSIM convention. + theLineOffset = nodeValue.toDouble()-1; return true; } @@ -2328,7 +2469,7 @@ bool ossimPleiadesDimapSupportData::parseGeometricData(ossimRefPtr xmlDocument) { - ossimString xpath; + ossimString xpath, nodeValue; vector > xml_nodes; xml_nodes.clear(); @@ -2463,9 +2604,149 @@ } theAzimuthAngle.push_back(sub_nodes[0]->getText().toDouble()); + //--- + // Fetch the along track incidence angle : + //--- + sub_nodes.clear(); + if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) + { + xpath = "Incidences/ALONG_TRACK_INCIDENCE"; + } + else + { + xpath = "Acquisition_Angles/INCIDENCE_ANGLE_ALONG_TRACK"; + } + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + theAlongTrackIncidenceAngle.push_back(sub_nodes[0]->getText().toDouble()); + + //--- + // Fetch the across track incidence angle : + //--- + sub_nodes.clear(); + if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) + { + xpath = "Incidences/ORTHO_TRACK_INCIDENCE"; + } + else + { + xpath = "Acquisition_Angles/INCIDENCE_ANGLE_ACROSS_TRACK"; + } + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + theAcrossTrackIncidenceAngle.push_back(sub_nodes[0]->getText().toDouble()); + ++node; } - + + if (theProcessingLevelString == "SENSOR") + { + // check that this product is SENSOR (some tags are not present in ORTHO) + //--- + // Fetch the time stamp of the first line: + //--- + if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) + { + xpath = "/Geometric_Data/Sensor_Model_Characteristics/UTC_Sensor_Model_Range/START"; + } + else + { + xpath = "/Geometric_Data/Refined_Model/Time/Time_Range/START"; + } + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theTimeRangeStart)) + { + return false; + } + + //--- + // Fetch the time stamp of the last line: + //--- + if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) + { + xpath = "/Geometric_Data/Sensor_Model_Characteristics/UTC_Sensor_Model_Range/END"; + } + else + { + xpath = "/Geometric_Data/Refined_Model/Time/Time_Range/END"; + } + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theTimeRangeEnd)) + { + return false; + } + + //--- + // Fetch the line period: + //--- + if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) + { + xpath = "/Geometric_Data/Sensor_Model_Characteristics/SENSOR_LINE_PERIOD"; + } + else + { + xpath = "/Geometric_Data/Refined_Model/Time/Time_Stamp/LINE_PERIOD"; + } + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theLinePeriod = nodeValue.toDouble(); + + //--- + // Fetch the swath first col: + //--- + if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) + { + xpath = "/Geometric_Data/Sensor_Model_Characteristics/Sensor_Viewing_Model/Position_In_Retina/FIRST_COL"; + } + else + { + xpath = "/Geometric_Data/Refined_Model/Geometric_Calibration/Instrument_Calibration/Swath_Range/FIRST_COL"; + } + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theSwathFirstCol = nodeValue.toInt32(); + + //--- + // Fetch the swath last col: + //--- + if (theDIMAPVersion == OSSIM_PLEIADES_DIMAPv1) + { + xpath = "/Geometric_Data/Sensor_Model_Characteristics/Sensor_Viewing_Model/Position_In_Retina/LAST_COL"; + } + else + { + xpath = "/Geometric_Data/Refined_Model/Geometric_Calibration/Instrument_Calibration/Swath_Range/LAST_COL"; + } + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theSwathLastCol = nodeValue.toInt32(); + } + return true; } @@ -2585,6 +2866,9 @@ { return false; } + + // TODO : fetch (if any in v1) the other acquisition time parameters + } else { @@ -2611,6 +2895,7 @@ } theAcquisitionDate = firstLineImagingDate + "T" + firstLineImagingTime; + } return true; diff -Nru otb-4.0.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.h otb-4.2.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.h --- otb-4.0.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.h 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbossimplugins/ossim/ossimPleiadesDimapSupportData.h 2014-09-03 08:29:34.000000000 +0000 @@ -114,6 +114,10 @@ void getIncidenceAngle(std::vector& ia) const; void getViewingAngle(std::vector& va) const; + //Along and across track incidence angle + void getAcrossTrackIncidenceAngle(std::vector& act) const; + void getAlongTrackIncidenceAngle(std::vector& alt) const; + //--- // Corner points: //--- @@ -152,7 +156,13 @@ double getLatScale() const {return theLatScale;}; double getLonScale() const {return theLonScale;}; double getHeightScale() const {return theHeightScale;}; - + + + ossimString getTimeRangeStart() const {return theTimeRangeStart;}; + ossimString getTimeRangeEnd() const {return theTimeRangeEnd;}; + ossim_float64 getLinePeriod() const {return theLinePeriod;}; + ossim_int32 getSwathFirstCol() const {return theSwathFirstCol;}; + ossim_int32 getSwathLastCol() const {return theSwathLastCol;}; private: @@ -176,6 +186,9 @@ std::vector theIncidenceAngle; std::vector theViewingAngle; std::vector theAzimuthAngle; + + std::vector theAlongTrackIncidenceAngle; + std::vector theAcrossTrackIncidenceAngle; ossimIpt theImageSize; ossimIpt theTileSize; @@ -206,8 +219,8 @@ double theErrBiasX; double theErrBiasY; double theErrRand; - ossim_int32 theLineOffset; - ossim_int32 theSampOffset; + double theLineOffset; + double theSampOffset; double theLatOffset; double theLonOffset; double theHeightOffset; @@ -221,6 +234,14 @@ std::vector theLineDenCoeff; std::vector theSampNumCoeff; std::vector theSampDenCoeff; + + // Additional metadata used to enhance pansharpening + ossimString theTimeRangeStart; + ossimString theTimeRangeEnd; + ossim_float64 theLinePeriod; + ossim_int32 theSwathFirstCol; + ossim_int32 theSwathLastCol; + //--- TODO MSD Check if it is necessary to keep that diff -Nru otb-4.0.0/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp otb-4.2.0/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp --- otb-4.0.0/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbossimplugins/ossim/ossimPluginProjectionFactory.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -9,7 +9,12 @@ //---------------------------------------------------------------------------- // $Id$ - +//*** +// Note to programmer: To add a new model, search this file for "ADD_MODEL" +// to locate places requiring editing. Functional example below... +// +// ADD_MODEL: Include all sensor model headers here: +//*** #include "ossimPluginProjectionFactory.h" #include #include @@ -24,6 +29,7 @@ #include "ossimPleiadesModel.h" #include #include "ossimTileMapModel.h" +#include "ossimSpot6Model.h" //*** // Define Trace flags for use within this file: @@ -252,6 +258,49 @@ } } + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << MODULE << " DEBUG: testing ossimSpot6Model" << std::endl; + } + + // Spot6 + if ( !projection ) + { + ossimRefPtr model = new ossimSpot6Model(); + if ( model->open(filename) ) + { + projection = model.get(); + } + else + { + model = 0; + } + } + + //*** + // ADD_MODEL: (Please leave this comment for the next programmer) + //*** + //if(traceDebug()) + //{ + // ossimNotify(ossimNotifyLevel_DEBUG) + // << MODULE << " DEBUG: testing MY_NEW_MODEL" << std::endl; + //} + + // MY_NEW_MODEL + //if ( !projection ) + //{ + // ossimRefPtr model = new MY_NEW_MODEL(); + // if ( model->open(filename) ) + //{ + // projection = model.get(); + //} + // else + // { + // model = 0; + // } + //} + return projection.release(); } @@ -306,6 +355,17 @@ { return new ossimPleiadesModel; } + else if (name == STATIC_TYPE_NAME(ossimSpot6Model)) + { + return new ossimSpot6Model; + } + + //*** + // ADD_MODEL: (Please leave this comment for the next programmer) + //*** +// if(name == MY_NEW_MODEL) +// return new myNewModel; + if(traceDebug()) { @@ -405,6 +465,26 @@ result = 0; } } + else if (type == "ossimSpot6Model") + { + result = new ossimSpot6Model(); + if ( !result->loadState(kwl, prefix) ) + { + result = 0; + } + } + + //*** + // ADD_MODEL: (Please leave this comment for the next programmer) + //*** +// else if (type == "ossimSpot6Model") +// { +// result = new ossimSpot6Model(); +// if ( !result->loadState(kwl, prefix) ) +// { +// result = 0; +// } +// } } @@ -442,6 +522,12 @@ typeList.push_back(STATIC_TYPE_NAME(ossimFormosatModel)); typeList.push_back(STATIC_TYPE_NAME(ossimTileMapModel)); typeList.push_back(STATIC_TYPE_NAME(ossimPleiadesModel)); + typeList.push_back(STATIC_TYPE_NAME(ossimSpot6Model)); + + //*** + // ADD_MODEL: Please leave this comment for the next programmer. Add above. + //*** + //typeList.push_back(STATIC_TYPE_NAME(MY_NEW_MODEL)); } bool ossimPluginProjectionFactory::isTileMap(const ossimFilename& filename)const diff -Nru otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.cpp otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.cpp --- otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.cpp 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,2217 @@ +//******************************************************************* +// Copyright (C) 2014 Centre National Etudes Spatiales +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// Author : Christophe Palmann (christophe.palmann@c-s.fr) +// +// Description: +// +// Contains declaration of class ossimSpot6DimapSupportData +// +//***************************************************************************** + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include + + +// Define Trace flags for use within this file: +static ossimTrace traceExec ("ossimSpot6DimapSupportData:exec"); +static ossimTrace traceDebug ("ossimSpot6DimapSupportData:debug"); + +static std::string getVectorFloat64AsString(std::vector in) +{ + std::vector::iterator it; + std::stringstream strTmp; + + for ( it=in.begin() ; it < in.end(); it++ ) + { + strTmp << " " << (*it); + } + + return strTmp.str(); +} + +static std::string getVectorDoubleAsString(std::vector in) +{ + std::vector::iterator it; + std::stringstream strTmp; + + for ( it=in.begin() ; it < in.end(); it++ ) + { + strTmp << " " << (*it); + } + + return strTmp.str(); +} + +static std::string getVectorStringAsString(std::vector in) +{ + std::vector::iterator it; + std::stringstream strTmp; + + for ( it=in.begin() ; it < in.end(); it++ ) + { + strTmp << " " << (*it); + } + + return strTmp.str(); +} + + + +namespace ossimplugins +{ + + static bool readOneXmlNode(ossimRefPtr xmlDocument, + ossimString xpath, + ossimString& nodeValue) + { + vector > xml_nodes; + + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << " DEBUG:" + << "\nCould not find: " << xpath << std::endl; + } + return false; + } + if (xml_nodes.size() != 1) + { + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << " DEBUG:" + << "\nMore than one node value with " << xpath << std::endl; + } + return false; + } + nodeValue = xml_nodes[0]->getText(); + return true; + } + + ossimSpot6DimapSupportData::ossimSpot6DimapSupportData () + :ossimErrorStatusInterface(), + theDIMAPVersion(OSSIM_Spot6_UNKNOWN), + theMetadataSubProfile(OSSIM_Spot6_METADATA_SUBPROFILE_UNKNOWN), + theProductIsOk(false), + theRpcIsOk(false), + theXmlDocumentRoot(), + + theSensorID(), + theImageID(), + theProductionDate(), + theAcquisitionDate(), + theInstrument(), + theInstrumentIndex(), + theProcessingLevelString(), + theSpectralProcessingString(), + + theSunAzimuth(), + theSunElevation(), + theIncidenceAngle(), + theViewingAngle(), + theAzimuthAngle(), + + theImageSize(0, 0), + theTileSize(0, 0), + theNumberOfMegaTilesInRow(0), + theNumberOfMegaTilesInCol(0), + theNumberOfMegaTiles(0), + theMultiDataFile(), + + theNumBands(0), + theBandOrder(), + + thePhysicalBias(), + thePhysicalGain(), + theSolarIrradiance(), + + theUlCorner(), + theUrCorner(), + theLrCorner(), + theLlCorner(), + + theSpecId(), + theErrBias(0), + theErrBiasX(0), + theErrBiasY(0), + theErrRand(0), + theLineOffset(0), + theSampOffset(0), + theLatOffset(0), + theLonOffset(0), + theHeightOffset(0), + theLineScale(0), + theSampScale(0), + theLatScale(0), + theLonScale(0), + theHeightScale(0), + theLineNumCoeff(), + theLineDenCoeff(), + theSampNumCoeff(), + theSampDenCoeff(), + + theRefGroundPoint(0.0, 0.0, 0.0), + theRefImagePoint(0.0, 0.0) + { + } + + ossimSpot6DimapSupportData::~ossimSpot6DimapSupportData () + { + } + + + void ossimSpot6DimapSupportData::clearFields() + { + clearErrorStatus(); + theDIMAPVersion = OSSIM_Spot6_UNKNOWN; + theMetadataSubProfile = OSSIM_Spot6_METADATA_SUBPROFILE_UNKNOWN; + theProductIsOk = false; + theRpcIsOk = false; + theXmlDocumentRoot = ""; + theImageID = ""; + theSensorID=""; + theProductionDate = ""; + theAcquisitionDate = ""; + theInstrument = ""; + theInstrumentIndex = ""; + theProcessingLevelString = ""; + theSpectralProcessingString = ""; + + theSunAzimuth.clear(); + theSunElevation.clear(); + theIncidenceAngle.clear(); + theViewingAngle.clear(); + theAzimuthAngle.clear(); + + theImageSize.makeNan(); + theTileSize.makeNan(); + theNumberOfMegaTilesInRow = 0; + theNumberOfMegaTilesInCol = 0; + theNumberOfMegaTiles = 0; + ossimString msg = ""; + theMultiDataFile.setBooleanValue(false, msg); + + theNumBands = 0; + theBandOrder.clear(); + + thePhysicalBias.clear(); + thePhysicalGain.clear(); + theSolarIrradiance.clear(); + + //--- + // Corner points: + //--- + theUlCorner.makeNan(); + theUrCorner.makeNan(); + theLrCorner.makeNan(); + theLlCorner.makeNan(); + + theRefGroundPoint.makeNan(); + theRefImagePoint.makeNan(); + + //--- + // RPC model parameters + //--- + theErrBias = 0.0; + theErrBiasX = 0.0; + theErrBiasY = 0.0; + theErrRand = 0.0; + theLineOffset = 0; + theSampOffset = 0; + theLatOffset = 0.0; + theLonOffset = 0.0; + theHeightOffset = 0.0; + theLineScale = 0.0; + theSampScale = 0.0; + theLatScale = 0.0; + theLonScale = 0.0; + theHeightScale = 0.0; + theLineNumCoeff.clear(); + theLineDenCoeff.clear(); + theSampNumCoeff.clear(); + theSampDenCoeff.clear(); + theSpecId = ""; + } + + void ossimSpot6DimapSupportData::printInfo(ostream& os) const + { + + os << "\n----------------- Info on Spot6 Image -------------------" + << "\n " + << "\n Job Number (ID): " << theImageID + << "\n Acquisition Date: " << theAcquisitionDate + << "\n Instrument: " << theInstrument + << "\n Instrument Index: " << theInstrumentIndex + << "\n Production Date: " << theProductionDate + << "\n Processing Level: " << theProcessingLevelString + << "\n Spectral Processing: " << theSpectralProcessingString + + << "\n Number of Bands: " << theNumBands + << "\n Bands Display Order: " << getVectorStringAsString(theBandOrder) + + << "\n Image Size: " << theImageSize + << "\n Tile Size: " << theTileSize + << "\n Number Of Tiles (Row, Col): " << theNumberOfMegaTiles << " (" + << theNumberOfMegaTilesInRow << ", " + << theNumberOfMegaTilesInCol << ")" + + << "\n Incidence Angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theIncidenceAngle) + << "\n Viewing Angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theViewingAngle) + << "\n Azimuth Angle (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theAzimuthAngle) + << "\n Sun Azimuth (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theSunAzimuth) + << "\n Sun Elevation (TopCenter, Center, BottomCenter): " << getVectorFloat64AsString(theSunElevation) + + << "\n Physical Bias (for each band): " << getVectorFloat64AsString(thePhysicalBias) + << "\n Physical Gain (for each band): " << getVectorFloat64AsString(thePhysicalGain) + << "\n Solar Irradiance (for each band): " << getVectorFloat64AsString(theSolarIrradiance) + + << "\n Geo Center Point: " << theRefGroundPoint + // TODO add RefImagePoint if necessary + + << "\n Corner Points:" + << "\n UL: " << theUlCorner + << "\n UR: " << theUrCorner + << "\n LR: " << theLrCorner + << "\n LL: " << theLlCorner + << "\n" + + << "\n RPC model parameters:" + << "\n RPC ID: " << theSpecId + << "\n SampNumCoeff: " << getVectorDoubleAsString(theSampNumCoeff) + << "\n SampDenCoeff: " << getVectorDoubleAsString(theSampDenCoeff) + << "\n LineNumCoeff: " << getVectorDoubleAsString(theLineNumCoeff) + << "\n LineDenCoeff: " << getVectorDoubleAsString(theLineDenCoeff) + << "\n LonScale: " << theLonScale + << "\n LonOffset: " << theLonOffset + << "\n LatScale: " << theLatScale + << "\n LonScale: " << theLonScale + << "\n HeightScale: " << theHeightScale + << "\n HeightOffset: " << theHeightOffset + << "\n SampScale: " << theSampScale + << "\n SampOffset: " << theSampOffset + << "\n LineScale: " << theLineScale + << "\n LineOffset: " << theLineOffset + << "\n theErrBias: " << theErrBias + << "\n theErrBiasX: " << theErrBiasX + << "\n theErrBiasY: " << theErrBiasY + << "\n theErrRand: " << theErrRand + << "\n" + << "\n---------------------------------------------------------" + << "\n " << std::endl; + } + + bool ossimSpot6DimapSupportData::parseXmlFile(const ossimFilename& file) + { + static const char MODULE[] = "ossimSpot6DimapSupportData::parseXmlFile"; + //traceDebug.setTraceFlag(true); + + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nFile: " << file << std::endl; + } + + if (allMetadataRead()) + clearFields(); + + //--- + // Instantiate the file reading: + //--- + ossim_int64 fileSize = file.fileSize(); + std::ifstream in(file.c_str(), std::ios::binary|std::ios::in); + std::vector fullBuffer; + ossimString bufferedIo; + if(in.good()&&(fileSize > 0)) + { + char buf[100]; + fullBuffer.resize(fileSize); + in.read(buf, std::min((ossim_int64)100, fileSize)); + if(!in.fail()) + { + ossimString testString = ossimString(buf, + buf + in.gcount()); + if(testString.contains("xml")) + { + in.seekg(0); + in.read(&fullBuffer.front(), (std::streamsize)fullBuffer.size()); + if(!in.fail()) + { + bufferedIo = ossimString(fullBuffer.begin(), + fullBuffer.begin()+in.gcount()); + } + } + } + } + else + { + return false; + } + //--- + // Instantiate the XML parser: + //--- + ossimRefPtr xmlDocument; + + if(bufferedIo.empty()) + { + xmlDocument = new ossimXmlDocument(file); + } + else + { + xmlDocument = new ossimXmlDocument; + std::istringstream inStringStream(bufferedIo.string()); + if(!xmlDocument->read(inStringStream)) + { + return false; + } + } + if (xmlDocument->getErrorStatus()) + { + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nUnable to parse xml file" << std::endl; + } + setErrorStatus(); + return false; + } + + if (!parseMetadataIdentificationDIMAPv2(xmlDocument) ) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseMetadataIdentification failed. Returning false" + << std::endl; + } + return false; + } + + + if (theMetadataSubProfile == OSSIM_Spot6_METADATA_SUBPROFILE_PRODUCT) + { + if (theProductIsOk) + clearFields(); + + if (!parseDatasetIdentification(xmlDocument)) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseDatasetdentification failed. Returning false" << std::endl; + } + return false; + } + + if (!parseDatasetContent(xmlDocument)) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseDatasetContent failed. Returning false" << std::endl; + return false; + } + + if (!parseProductInformation(xmlDocument)) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseProductInformation failed. Returning false" << std::endl; + } + return false; + } + + if (!parseCoordinateReferenceSystem(xmlDocument)) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseCoordinateReferenceSystem failed. Returning false" << std::endl; + } + return false; + } + + if (!parseGeoposition(xmlDocument)) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseGeoposition failed. Returning false" << std::endl; + } + return false; + } + + if (!parseProcessingInformation(xmlDocument)) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseProcessingInformation failed. Returning false" << std::endl; + } + return false; + } + + if (!parseRasterData(xmlDocument)) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseRasterData failed. Returning false" << std::endl; + } + return false; + } + + if (!parseRadiometricData(xmlDocument)) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseRadiometricData failed. Returning false" << std::endl; + return false; + } + + if (!parseGeometricData(xmlDocument)) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseGeometricData failed. Returning false" << std::endl; + return false; + } + + if (!parseQualityAssessment(xmlDocument)) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseQualityAssessment failed. Returning false" << std::endl; + return false; + } + + if (!parseDatasetSources(xmlDocument)) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseDatasetSources failed. Returning false" << std::endl; + return false; + } + + theProductIsOk = true; + } + + if (theMetadataSubProfile == OSSIM_Spot6_METADATA_SUBPROFILE_RPC) + { + // Parse RPC file + if (theProcessingLevelString == "SENSOR") + { + if (parseRPCMetadata(xmlDocument) == false) + { + ossimNotify(ossimNotifyLevel_FATAL) + << MODULE << " DEBUG:" << "ossimSpot6DimapSupportData::parseXmlFile:" + << "\nparseRPCMetadata initialization failed. Returning false" << std::endl; + return false; + } + theRpcIsOk = true; + } + else + theRpcIsOk = true; + } + + if (theProcessingLevelString != "SENSOR") + theRpcIsOk = true; + + if (traceDebug() && allMetadataRead()) + { + printInfo(ossimNotify(ossimNotifyLevel_DEBUG)); + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG: exited..." << std::endl; + } + + return true; + } + + ossimString ossimSpot6DimapSupportData::getProcessingLevel() const + { + return theProcessingLevelString; + } + + ossimString ossimSpot6DimapSupportData::getSensorID() const + { + return theSensorID; + } + + ossimString ossimSpot6DimapSupportData::getAcquisitionDate() const + { + return theAcquisitionDate; + } + + ossimString ossimSpot6DimapSupportData::getProductionDate() const + { + return theProductionDate; + } + + ossimString ossimSpot6DimapSupportData::getImageID() const + { + return theImageID; + } + + ossimString ossimSpot6DimapSupportData::getInstrument() const + { + return theInstrument; + } + + ossimString ossimSpot6DimapSupportData::getInstrumentIndex() const + { + return theInstrumentIndex; + } + + void ossimSpot6DimapSupportData::getSunAzimuth(std::vector& az) const + { + az = theSunAzimuth; + } + + void ossimSpot6DimapSupportData::getSunElevation(std::vector& el) const + { + el = theSunElevation; + } + + void ossimSpot6DimapSupportData::getImageSize(ossimIpt& sz) const + { + sz = theImageSize; + } + + ossim_uint32 ossimSpot6DimapSupportData::getNumberOfBands() const + { + return theNumBands; + } + + void ossimSpot6DimapSupportData::getIncidenceAngle(std::vector& ia) const + { + ia = theIncidenceAngle; + } + + void ossimSpot6DimapSupportData::getViewingAngle(std::vector& va) const + { + va = theViewingAngle; + } + + void ossimSpot6DimapSupportData::getRefGroundPoint(ossimGpt& gp) const + { + gp = theRefGroundPoint; + } + + void ossimSpot6DimapSupportData::getRefImagePoint(ossimDpt& rp) const + { + rp = theRefImagePoint; + } + + void ossimSpot6DimapSupportData::getUlCorner(ossimGpt& pt) const + { + pt = theUlCorner; + } + + void ossimSpot6DimapSupportData::getUrCorner(ossimGpt& pt) const + { + pt = theUrCorner; + } + + void ossimSpot6DimapSupportData::getLrCorner(ossimGpt& pt) const + { + pt = theLrCorner; + } + + void ossimSpot6DimapSupportData::getLlCorner(ossimGpt& pt) const + { + pt = theLlCorner; + } + + void ossimSpot6DimapSupportData::getImageRect(ossimDrect& rect)const + { + rect = ossimDrect(0.0, 0.0, theImageSize.x-1.0, theImageSize.y-1.0); + } + + + bool ossimSpot6DimapSupportData::saveState(ossimKeywordlist& kwl, + const char* prefix)const + { + ossimString tempString; + ossim_uint32 idx = 0; + + kwl.add(prefix, + ossimKeywordNames::TYPE_KW, + "ossimSpot6DimapSupportData", + true); + + tempString = ""; + for(idx = 0; idx < theSunAzimuth.size(); ++idx) + { + tempString += (ossimString::toString(theSunAzimuth[idx]) + " "); + } + + kwl.add(prefix, + ossimKeywordNames::AZIMUTH_ANGLE_KW, + tempString, + true); + + kwl.add(prefix, + "number_of_azimuth_angle", + static_cast(theSunAzimuth.size()), + true); + + tempString = ""; + for(idx = 0; idx < theSunElevation.size(); ++idx) + { + tempString += (ossimString::toString(theSunElevation[idx]) + " "); + } + + kwl.add(prefix, + ossimKeywordNames::ELEVATION_ANGLE_KW, + tempString, + true); + + kwl.add(prefix, + "number_of_elevation_angle", + static_cast(theSunElevation.size()), + true); + + //--- + // Note: since this is a new keyword, use the point.toString as there is + // no backwards compatibility issues. + //--- + + kwl.add(prefix, + "image_size", + ossimString::toString(theImageSize.x) + " " + + ossimString::toString(theImageSize.y), + true); + + kwl.add(prefix, + "reference_ground_point", + ossimString::toString(theRefGroundPoint.latd()) + " " + + ossimString::toString(theRefGroundPoint.lond()) + " " + + ossimString::toString(theRefGroundPoint.height()) + " " + + theRefGroundPoint.datum()->code(), + true); + + kwl.add(prefix, + "reference_image_point", + ossimString::toString(theRefImagePoint.x) + " " + + ossimString::toString(theRefImagePoint.y), + true); + + kwl.add(prefix, + ossimKeywordNames::NUMBER_BANDS_KW, + theNumBands, + true); + + tempString = ""; + for(idx = 0; idx < theBandOrder.size(); ++idx) + { + tempString += (theBandOrder[idx] + " "); + } + + kwl.add(prefix, + "band_name_list", + tempString, + true); + + kwl.add(prefix, + "image_id", + theImageID, + true); + + kwl.add(prefix, + "processing_level", + theProcessingLevelString, + true); + + kwl.add(prefix, + "instrument", + theInstrument, + true); + + kwl.add(prefix, + "instrument_index", + theInstrumentIndex, + true); + + kwl.add(prefix, + ossimKeywordNames::IMAGE_DATE_KW, + theAcquisitionDate, + true); + + kwl.add(prefix, + "production_date", + theProductionDate, + true); + + tempString = ""; + for(idx = 0; idx < theIncidenceAngle.size(); ++idx) + { + tempString += (ossimString::toString(theIncidenceAngle[idx]) + " "); + } + + kwl.add(prefix, + "incident_angle", + tempString, + true); + + kwl.add(prefix, + "number_of_incident_angle", + static_cast(theIncidenceAngle.size()), + true); + + tempString = ""; + for(idx = 0; idx < theViewingAngle.size(); ++idx) + { + tempString += (ossimString::toString(theViewingAngle[idx]) + " "); + } + + kwl.add(prefix, + "viewing_angle", + tempString, + true); + + kwl.add(prefix, + "number_of_viewing_angle", + static_cast(theViewingAngle.size()), + true); + + tempString = ""; + for(idx = 0; idx < theAzimuthAngle.size(); ++idx) + { + tempString += (ossimString::toString(theAzimuthAngle[idx]) + " "); + } + + kwl.add(prefix, + "scene_orientation", + tempString, + true); + + kwl.add(prefix, + "number_of_scene_orientation", + static_cast(theAzimuthAngle.size()), + true); + + kwl.add(prefix, + "ul_ground_point", + ossimString::toString(theUlCorner.latd()) + " " + + ossimString::toString(theUlCorner.lond()) + " " + + ossimString::toString(theUlCorner.height()) + " " + + theUlCorner.datum()->code(), + true); + + kwl.add(prefix, + "ur_ground_point", + ossimString::toString(theUrCorner.latd()) + " " + + ossimString::toString(theUrCorner.lond()) + " " + + ossimString::toString(theUrCorner.height()) + " " + + theUrCorner.datum()->code(), + true); + + kwl.add(prefix, + "lr_ground_point", + ossimString::toString(theLrCorner.latd()) + " " + + ossimString::toString(theLrCorner.lond()) + " " + + ossimString::toString(theLrCorner.height()) + " " + + theLrCorner.datum()->code(), + true); + + kwl.add(prefix, + "ll_ground_point", + ossimString::toString(theLlCorner.latd()) + " " + + ossimString::toString(theLlCorner.lond()) + " " + + ossimString::toString(theLlCorner.height()) + " " + + theLlCorner.datum()->code(), + true); + + kwl.add(prefix, + "sensorID", + theSensorID, + true); + + + tempString = ""; + for(idx = 0; idx < thePhysicalBias.size(); ++idx) + { + tempString += (ossimString::toString(thePhysicalBias[idx]) + " "); + } + kwl.add(prefix, + "physical_bias", + tempString, + true); + + tempString = ""; + for(idx = 0; idx < thePhysicalGain.size(); ++idx) + { + tempString += (ossimString::toString(thePhysicalGain[idx]) + " "); + } + kwl.add(prefix, + "physical_gain", + tempString, + true); + + tempString = ""; + for(idx = 0; idx < theSolarIrradiance.size(); ++idx) + { + tempString += (ossimString::toString(theSolarIrradiance[idx]) + " "); + } + + kwl.add(prefix, + "solar_irradiance", + tempString, + true); + + return true; + } + + bool ossimSpot6DimapSupportData::loadState(const ossimKeywordlist& kwl, + const char* prefix) + { + ossim_uint32 idx = 0; + ossim_uint32 total; + ossimString tempString; + + clearFields(); + + + ossimString type = kwl.find(prefix, ossimKeywordNames::TYPE_KW); + + if(type != "ossimSpot6DimapSupportData") + { + return false; + } + + total = ossimString(kwl.find(prefix,"number_of_azimuth_angle")).toUInt32(); + theSunAzimuth.resize(total); + tempString = kwl.find(prefix,ossimKeywordNames::AZIMUTH_ANGLE_KW); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theSunAzimuth.size();++idx) + { + in >> tempValue.string(); + theSunAzimuth[idx] = tempValue.toDouble(); + } + } + + total = ossimString(kwl.find(prefix,"number_of_elevation_angle")).toUInt32(); + theSunElevation.resize(total); + tempString = kwl.find(prefix,ossimKeywordNames::ELEVATION_ANGLE_KW); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theSunElevation.size();++idx) + { + in >> tempValue.string(); + theSunElevation[idx] = tempValue.toDouble(); + } + } + + theImageSize = createIpt(kwl.find(prefix, "image_size")); + theRefGroundPoint = createGround(kwl.find(prefix, "reference_ground_point")); + theRefImagePoint = createDpt(kwl.find(prefix, "reference_image_point")); + + theNumBands = ossimString(kwl.find(prefix, ossimKeywordNames::NUMBER_BANDS_KW)).toUInt32(); + + theBandOrder.resize(theNumBands); + tempString = kwl.find(prefix,"band_name_list"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theBandOrder.size();++idx) + { + in >> tempValue.string(); + theBandOrder[idx] = tempValue; + } + } + + theAcquisitionDate = kwl.find(prefix, ossimKeywordNames::IMAGE_DATE_KW); + theProductionDate = kwl.find(prefix, "production_date"); + theImageID = kwl.find(prefix, "image_id"); + theInstrument = kwl.find(prefix, "instrument"); + theInstrumentIndex = kwl.find(prefix, "instrument_index"); + + total = ossimString(kwl.find(prefix,"number_of_incident_angle")).toUInt32(); + theIncidenceAngle.resize(total); + tempString = kwl.find(prefix,"incident_angle"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theIncidenceAngle.size();++idx) + { + in >> tempValue.string(); + theIncidenceAngle[idx] = tempValue.toDouble(); + } + } + + total = ossimString(kwl.find(prefix,"number_of_viewing_angle")).toUInt32(); + theViewingAngle.resize(total); + tempString = kwl.find(prefix,"viewing_angle"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theViewingAngle.size();++idx) + { + in >> tempValue.string(); + theViewingAngle[idx] = tempValue.toDouble(); + } + } + + total = ossimString(kwl.find(prefix,"number_of_scene_orientation")).toUInt32(); + theAzimuthAngle.resize(total); + tempString = kwl.find(prefix,"scene_orientation"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theAzimuthAngle.size();++idx) + { + in >> tempValue.string(); + theAzimuthAngle[idx] = tempValue.toDouble(); + } + } + + + theUlCorner =createGround( kwl.find(prefix, "ul_ground_point")); + theUrCorner =createGround( kwl.find(prefix, "ur_ground_point")); + theLrCorner =createGround( kwl.find(prefix, "lr_ground_point")); + theLlCorner =createGround( kwl.find(prefix, "ll_ground_point")); + + theSensorID = ossimString(kwl.find(prefix, "sensorID")); + + theProcessingLevelString = ossimString(kwl.find(prefix, "processing_level")); + + thePhysicalBias.resize(theNumBands); + tempString = kwl.find(prefix,"physical_bias"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < thePhysicalBias.size();++idx) + { + in >> tempValue.string(); + thePhysicalBias[idx] = tempValue.toDouble(); + } + } + + thePhysicalGain.resize(theNumBands); + tempString = kwl.find(prefix,"physical_gain"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < thePhysicalGain.size();++idx) + { + in >> tempValue.string(); + thePhysicalGain[idx] = tempValue.toDouble(); + } + } + + theSolarIrradiance.resize(theNumBands); + tempString = kwl.find(prefix,"solar_irradiance"); + if(tempString != "") + { + std::istringstream in(tempString.string()); + ossimString tempValue; + for(idx = 0; idx < theSolarIrradiance.size();++idx) + { + in >> tempValue.string(); + theSolarIrradiance[idx] = tempValue.toDouble(); + } + } + + return true; + } + + ossimGpt ossimSpot6DimapSupportData::createGround(const ossimString& s)const + { + std::istringstream in(s.string()); + ossimString lat, lon, height; + ossimString code; + + in >> lat.string() >> lon.string() >> height.string() >> code.string(); + + return ossimGpt(lat.toDouble(), + lon.toDouble(), + height.toDouble(), + ossimDatumFactory::instance()->create(code)); + + } + + ossimDpt ossimSpot6DimapSupportData::createDpt(const ossimString& s)const + { + std::istringstream in(s.string()); + ossimString x, y; + ossimString code; + + in >> x.string() >> y.string(); + + return ossimDpt(x.toDouble(), y.toDouble()); + + } + + ossimIpt ossimSpot6DimapSupportData::createIpt(const ossimString& s)const + { + std::istringstream in(s.string()); + ossimString x, y; + ossimString code; + + in >> x.string() >> y.string(); + + return ossimIpt(x.toInt(), y.toInt()); + + } + + bool ossimSpot6DimapSupportData::parseProductInformation( + ossimRefPtr xmlDocument) + { + ossimString xpath; + vector > xml_nodes; + + //--- + // Fetch the Image ID: + //--- + xpath = "/Product_Information/Delivery_Identification/JOB_ID"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theImageID)) + { + return false; + } + + //--- + // Fetch the ProductionDate: + //--- + xpath = "/Product_Information/Delivery_Identification/PRODUCTION_DATE"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theProductionDate)) + { + return false; + } + + return true; + } + + bool ossimSpot6DimapSupportData::parseDatasetContent( + ossimRefPtr xmlDocument) + { + ossimString xpath, nodeValue; + vector > xml_nodes; + + //--- + // Corner points: + //--- + xml_nodes.clear(); + xpath = "/Dataset_Content/Dataset_Extent/Vertex"; + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() != 4) + { + setErrorStatus(); + return false; + } + std::vector >::iterator node = xml_nodes.begin(); + while (node != xml_nodes.end()) + { + ossimGpt gpt; + ossimDpt ipt; + + std::vector > sub_nodes; + xpath = "LAT"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + gpt.lat = sub_nodes[0]->getText().toDouble(); + + sub_nodes.clear(); + xpath = "LON"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + gpt.lon = sub_nodes[0]->getText().toDouble(); + gpt.hgt = 0.0; // assumed + + sub_nodes.clear(); + xpath = "ROW"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + ipt.line = sub_nodes[0]->getText().toDouble() - 1.0; + + sub_nodes.clear(); + xpath = "COL"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + ipt.samp = sub_nodes[0]->getText().toDouble() - 1.0; + + if (ipt.line < 1.0) + if (ipt.samp < 1.0) + theUlCorner = gpt; + else + theUrCorner = gpt; + else + if (ipt.samp < 1.0) + theLlCorner = gpt; + else + theLrCorner = gpt; + + ++node; + } + + + + //--- + // Center of frame. + //--- + theRefGroundPoint.hgt = 0.0; // TODO needs to be looked up + + if (!readOneXmlNode(xmlDocument, + theXmlDocumentRoot + "/Dataset_Content/Dataset_Extent/Center/LON", // DIMAPv2 + nodeValue)) + { + return false; + } + theRefGroundPoint.lon = nodeValue.toDouble(); + + if (!readOneXmlNode(xmlDocument, theXmlDocumentRoot + "/Dataset_Content/Dataset_Extent/Center/LAT", nodeValue)) // DIMAPv2 + { + return false; + } + theRefGroundPoint.lat = nodeValue.toDouble(); + + return true; + } + + bool ossimSpot6DimapSupportData::parseRadiometricData( + ossimRefPtr xmlDocument) + { + ossimString xpath; + std::vector > xml_nodes; + std::vector > sub_nodes; + std::vector >::iterator node; + + //--- + // Fetch the gain and bias for each spectral band: + //--- + thePhysicalGain.assign(theNumBands, 1.000); + thePhysicalBias.assign(theNumBands, 0.000); + + xml_nodes.clear(); + xpath = "/Radiometric_Data/Radiometric_Calibration/Instrument_Calibration/Band_Measurement_List/Band_Radiance"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + + node = xml_nodes.begin(); + while (node != xml_nodes.end()) + { + sub_nodes.clear(); + xpath = "BAND_ID"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + + ossimString bandName = sub_nodes[0]->getText(); + ossim_uint32 bandIndex; + if (bandName == "B0") + bandIndex = 0; + else + if (bandName == "B1") + bandIndex = 1; + else + if (bandName == "B2") + bandIndex = 2; + else + if (bandName == "B3") + bandIndex = 3; + else + if (bandName == "P") bandIndex = 0; + else + { + ossimNotify(ossimNotifyLevel_WARN) + << "ossimSpot6DimapSupportData::parseRadiometricMetadata ERROR: Band ID is incorrect\n"; + } + + if ((bandIndex >= theNumBands ) ) + { + ossimNotify(ossimNotifyLevel_WARN) + << "ossimSpot6DimapSupportData::parseRadiometricMetadata ERROR: Band index outside of range\n"; + return false; + } + + sub_nodes.clear(); + xpath = "BIAS"; //DIMAPv2 + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + thePhysicalBias[bandIndex] = sub_nodes[0]->getText().toDouble(); + + sub_nodes.clear(); + xpath = "GAIN"; //DIMAPv2 + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + thePhysicalGain[bandIndex] = sub_nodes[0]->getText().toDouble(); + + ++node; + } + + // Initialize to 999 : we find this value in some DIMAPv2 file + // and there is no such tag in DIMAPv1 file + theSolarIrradiance.assign(theNumBands, 999.000); + + xml_nodes.clear(); + xpath = "/Radiometric_Data/Radiometric_Calibration/Instrument_Calibration/Band_Measurement_List/Band_Solar_Irradiance"; + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + + node = xml_nodes.begin(); + while (node != xml_nodes.end()) + { + sub_nodes.clear(); + xpath = "BAND_ID"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + + ossimString bandName = sub_nodes[0]->getText(); + ossim_uint32 bandIndex; + if (bandName == "B0") + bandIndex = 0; + else + if (bandName == "B1") + if (theNumBands != 1) + bandIndex = 1; + else + bandIndex = 0; + else + if (bandName == "B2") + if (theNumBands != 1) + bandIndex = 2; + else + bandIndex = 0; + else + if (bandName == "B3") + if (theNumBands != 1) + bandIndex = 3; + else + bandIndex = 0; + else + if (bandName == "P") + bandIndex = 0; + else + { + ossimNotify(ossimNotifyLevel_WARN) + << "ossimSpot6DimapSupportData::parseRadiometricMetadata ERROR: Band ID is incorrect\n"; + } + + if ((bandIndex >= theNumBands)) + { + ossimNotify(ossimNotifyLevel_WARN) + << "ossimSpot6DimapSupportData::parseRadiometricMetadata ERROR: Band index outside of range 2\n"; + return false; + } + + sub_nodes.clear(); + xpath = "VALUE"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + return false; + } + theSolarIrradiance[bandIndex] = sub_nodes[0]->getText().toDouble(); + + ++node; + } + + return true; + } + + + bool ossimSpot6DimapSupportData::parseRPCMetadata( + ossimRefPtr xmlDocument) + { + static const char MODULE[] = "ossimSpot6DimapSupportData::parseRPCMetadata"; + ossimString xpath, nodeValue; + vector > xml_nodes; + + //--- + // Fetch the Global RFM - Direct Model - Bias: + //--- + xpath = "/Rational_Function_Model/Resource_Reference/RESOURCE_ID"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG: Could not find: " << xpath << std::endl; + return false; + } + theSpecId = nodeValue; + + //--- + // Fetch the Global RFM - Inverse Model: + //--- + xml_nodes.clear(); + xpath = "/Rational_Function_Model/Global_RFM/Inverse_Model"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.empty()) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG: Could not find: " << xpath << std::endl; + } + return false; + } + + for (ossim_uint32 it = 1; it < 21; it ++) + { + std::ostringstream valueStr; + valueStr << it; + + xml_nodes.clear(); + xpath = "/Rational_Function_Model/Global_RFM/Inverse_Model/LINE_NUM_COEFF_"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xpath = xpath + valueStr.str(); + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + theLineNumCoeff.push_back(xml_nodes[0]->getText().toDouble()); + + xml_nodes.clear(); + xpath = "/Rational_Function_Model/Global_RFM/Inverse_Model/LINE_DEN_COEFF_"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xpath = xpath + valueStr.str(); + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + theLineDenCoeff.push_back(xml_nodes[0]->getText().toDouble()); + + xml_nodes.clear(); + xpath = "/Rational_Function_Model/Global_RFM/Inverse_Model/SAMP_NUM_COEFF_"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xpath = xpath + valueStr.str(); + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + theSampNumCoeff.push_back(xml_nodes[0]->getText().toDouble()); + + xml_nodes.clear(); + xpath = "/Rational_Function_Model/Global_RFM/Inverse_Model/SAMP_DEN_COEFF_"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xpath = xpath + valueStr.str(); + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + theSampDenCoeff.push_back(xml_nodes[0]->getText().toDouble()); + } + + + //--- + // Fetch the Global RFM - Inverse Model - Bias: + //--- + xpath = "/Rational_Function_Model/Global_RFM/Inverse_Model/ERR_BIAS_ROW"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theErrBiasX = nodeValue.toDouble(); + xpath = "/Rational_Function_Model/Global_RFM/Inverse_Model/ERR_BIAS_COL"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theErrBiasY = nodeValue.toDouble(); + + //--- + // Fetch the Global RFM validity parameters : + //--- + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/LONG_SCALE"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theLonScale = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/LONG_OFF"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theLonOffset = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/LAT_SCALE"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theLatScale = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/LAT_OFF"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theLatOffset = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/HEIGHT_SCALE"; + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theHeightScale = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/HEIGHT_OFF"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theHeightOffset = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/SAMP_SCALE"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theSampScale = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/SAMP_OFF"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theSampOffset = nodeValue.toInt32(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/LINE_SCALE"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theLineScale = nodeValue.toDouble(); + + xpath = "/Rational_Function_Model/Global_RFM/RFM_Validity/LINE_OFF"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theLineOffset = nodeValue.toInt32(); + + return true; + } + + bool ossimSpot6DimapSupportData::parseMetadataIdentificationDIMAPv2(ossimRefPtr xmlDocument) + { + static const char MODULE[] = "ossimSpot6DimapSupportData::parseMetadataIdentification"; + + vector > xml_nodes; + ossimString xpath, nodeValue; + theXmlDocumentRoot = "/DIMAP_Document"; + + //--- + // Get the version string which can be used as a key for parsing. + //--- + xml_nodes.clear(); + xpath = "/Metadata_Identification/METADATA_FORMAT"; + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + + // FIXME MSD: used to support Spot6/Pleiades samples from SPOT-IMAGES website which are not coherent + // with the specification (28/09/2012). Should be remove when first data will be available and sample + // replaced. + theXmlDocumentRoot = "/SPOT_DIMAP_Document"; + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the old root: " << theXmlDocumentRoot << endl; + } + + xml_nodes.clear(); + xpath = "/Metadata_Identification/METADATA_FORMAT"; + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + // FIXME MSD: used to support spot6/peiades samples from SPOT-IMAGES website which are not coherent + // with the specification (28/09/2012). Should be remove when first data will be available and sample + // replaced. + theXmlDocumentRoot = "/Dimap_Document"; + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nTry to use the new root: " << theXmlDocumentRoot << endl; + } + + xml_nodes.clear(); + xpath = "/Metadata_Identification/METADATA_FORMAT"; + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << endl; + } + return false; + } + } + } + + ossimString attribute = "version"; + ossimString value; + xml_nodes[0]->getAttributeValue(value, attribute); + if (value != "2.0") + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_WARN) + << "WARNING: DIMAP metadata version is not correct!" << std::endl; + } + return false; + } + + //--- + // Check that it is a valid SPOT DIMAPv2 file + //--- + xpath = "/Metadata_Identification/METADATA_PROFILE"; + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + + ossimString metadataProfile; + if ( (nodeValue != "S6_SENSOR") + && (nodeValue != "S6_ORTHO") + && (nodeValue != "S6_MOSAIC") ) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << "DEBUG:\n Not a Spot6 DIMAPv2 file: metadata profile is incorrect!" << std::endl; + } + return false; + } + else + metadataProfile = nodeValue; + + //--- + // Get the subprofile + //--- + xpath = "/Metadata_Identification/METADATA_SUBPROFILE"; + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + + if ((nodeValue == "PRODUCT")) + theMetadataSubProfile = OSSIM_Spot6_METADATA_SUBPROFILE_PRODUCT; + else if ( (nodeValue == "RPC") && (metadataProfile == "S6_SENSOR") ) + theMetadataSubProfile = OSSIM_Spot6_METADATA_SUBPROFILE_RPC; + else + { + theMetadataSubProfile = OSSIM_Spot6_METADATA_SUBPROFILE_UNKNOWN; + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) + << "DEBUG:\n Not a Spot6 DIMAPv2 file: metadata subprofile is incorrect !" << std::endl; + } + return false; + } + + theDIMAPVersion = OSSIM_Spot6_DIMAPv2; + + return true; + } + + bool ossimSpot6DimapSupportData::parseDatasetIdentification(ossimRefPtr xmlDocument) + { + return true; + } + + bool ossimSpot6DimapSupportData::parseCoordinateReferenceSystem(ossimRefPtr xmlDocument) + { + return true; + } + + bool ossimSpot6DimapSupportData::parseGeoposition(ossimRefPtr xmlDocument) + { + return true; + } + + bool ossimSpot6DimapSupportData::parseProcessingInformation(ossimRefPtr xmlDocument) + { + static const char MODULE[] = "ossimSpot6DimapSupportData::parseProcessingInformation"; + + vector > xml_nodes; + ossimString xpath, nodeValue; + + //--- + // Fetch the Processing Level: + //--- + xpath = "/Processing_Information/Product_Settings/PROCESSING_LEVEL"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theProcessingLevelString)) + { + return false; + } + + //--- + // Fetch the Spectral Processing: + //--- + xpath = "/Processing_Information/Product_Settings/PROCESSING_LEVEL"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theSpectralProcessingString)) + { + return false; + } + + return true; + } + + bool ossimSpot6DimapSupportData::parseRasterData(ossimRefPtr xmlDocument) + { + static const char MODULE[] = "ossimSpot6DimapSupportData::parseRasterData"; + vector > xml_nodes; + ossimString xpath, nodeValue; + //--- + // Fetch if the product file is linked to one or many JP2 files: + //--- + xpath = "/Raster_Data/Data_Access/DATA_FILE_TILES"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theMultiDataFile.setValue(nodeValue); + + //--- + // Fetch the MegaImageSize: + //--- + xpath = "/Raster_Data/Raster_Dimensions/NCOLS"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theImageSize.samp = nodeValue.toInt(); + + xpath = "/Raster_Data/Raster_Dimensions/NROWS"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theImageSize.line = nodeValue.toInt(); + + if (theMultiDataFile.getBoolean()) + { + //--- + // Fetch the Number of MegaTiles: + //--- + xpath = "/Raster_Data/Raster_Dimensions/Tile_Set/NTILES"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theNumberOfMegaTiles = nodeValue.toUInt32(); + + //--- + // Fetch the Number of MegaTiles in X and Y: + //--- + + xml_nodes.clear(); + xpath = "/Raster_Data/Raster_Dimensions/Tile_Set/Regular_Tiling/NTILES_COUNT"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG: \nCould not find: " << xpath << std::endl; + } + return false; + } + + ossimString value; + ossimString attribute = "ntiles_x"; + if (!xml_nodes[0]->getAttributeValue(value, attribute)) + { + attribute = "ntiles_R"; + xml_nodes[0]->getAttributeValue(value, attribute); + } + theNumberOfMegaTilesInRow = value.toUInt32(); + + attribute = "ntiles_y"; + if (!xml_nodes[0]->getAttributeValue(value, attribute)) + { + attribute = "ntiles_C"; + xml_nodes[0]->getAttributeValue(value, attribute); + } + theNumberOfMegaTilesInCol = value.toUInt32(); + + if (theNumberOfMegaTilesInRow * theNumberOfMegaTilesInCol != theNumberOfMegaTiles) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG: \nIncoherent number of tiles: " << xpath << std::endl; + } + return false; + } + + //--- + // Fetch the size of MegaTiles: + //--- + xml_nodes.clear(); + xpath = "/Raster_Data/Raster_Dimensions/Tile_Set/Regular_Tiling/NTILES_SIZE"; + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + + + attribute = "nrows"; + xml_nodes[0]->getAttributeValue(value, attribute); + theTileSize.line = value.toUInt32(); + + attribute = "ncols"; + xml_nodes[0]->getAttributeValue(value, attribute); + theTileSize.samp = value.toUInt32(); + } + + //--- TODO_MSD is it useful in the case of RPC model ??? + // We will make the RefImagePoint the zero base center of the image. This + // is used by the ossimSensorModel::worldToLineSample iterative loop as + // the starting point. Since the ossimSensorModel does not know of the + // sub image we make it zero base. (comments from spot) + //--- + theRefImagePoint.line = theImageSize.line / 2.0; + theRefImagePoint.samp = theImageSize.samp / 2.0; + + //--- + // Fetch number of bands + //--- + xpath = "/Raster_Data/Raster_Dimensions/NBANDS"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + theNumBands = nodeValue.toUInt32(); + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nNumber of bands: " << theNumBands << std::endl; + } + + //--- + // Fetch Band Display Order + //--- + xml_nodes.clear(); + xpath = "/Raster_Data/Raster_Display/Band_Display_Order/RED_CHANNEL"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + theBandOrder.push_back(xml_nodes[0]->getText()); + + if (theNumBands > 1) + { + xml_nodes.clear(); + xpath = "/Raster_Data/Raster_Display/Band_Display_Order/GREEN_CHANNEL"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + theBandOrder.push_back(xml_nodes[0]->getText()); + + xml_nodes.clear(); + xpath = "/Raster_Data/Raster_Display/Band_Display_Order/BLUE_CHANNEL"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + theBandOrder.push_back(xml_nodes[0]->getText()); + + if (theNumBands > 3) + { + xml_nodes.clear(); + xpath = "/Raster_Data/Raster_Display/Band_Display_Order/ALPHA_CHANNEL"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() == 0) + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " DEBUG:" << "\nCould not find: " << xpath << std::endl; + } + return false; + } + + theBandOrder.push_back(xml_nodes[0]->getText()); + } + } + + return true; + } + + bool ossimSpot6DimapSupportData::parseGeometricData(ossimRefPtr xmlDocument) + { + ossimString xpath; + vector > xml_nodes; + + xml_nodes.clear(); + xpath = "/Geometric_Data/Use_Area/Located_Geometric_Values"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + xmlDocument->findNodes(xpath, xml_nodes); + if (xml_nodes.size() != 9 ) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + + std::vector >::iterator node = xml_nodes.begin(); + while (node != xml_nodes.end()) + { + std::vector > sub_nodes; + + //--- + // Fetch the Sun Azimuth: + //--- + xpath = "Solar_Incidences/SUN_AZIMUTH"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + theSunAzimuth.push_back(sub_nodes[0]->getText().toDouble()); + + //--- + // Fetch the Sun Elevation: + //--- + sub_nodes.clear(); + xpath = "Solar_Incidences/SUN_ELEVATION"; + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + theSunElevation.push_back(sub_nodes[0]->getText().toDouble()); + + //--- + // Fetch the Incidence Angle: + //--- + sub_nodes.clear(); + xpath = "Acquisition_Angles/INCIDENCE_ANGLE"; //DIMAPv2 + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + theIncidenceAngle.push_back(sub_nodes[0]->getText().toDouble()); + + //--- + // Fetch the Viewing Angle: + //--- + sub_nodes.clear(); + xpath = "Acquisition_Angles/VIEWING_ANGLE"; //DIMAPv2 + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + theViewingAngle.push_back(sub_nodes[0]->getText().toDouble()); + + //--- + // Fetch the Azimuth Angle: + //--- + sub_nodes.clear(); + xpath = "Acquisition_Angles/AZIMUTH_ANGLE"; //DIMAPv2 + (*node)->findChildNodes(xpath, sub_nodes); + if (sub_nodes.size() == 0) + { + setErrorStatus(); + if(traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nCould not find: " << xpath << std::endl; + } + return false; + } + theAzimuthAngle.push_back(sub_nodes[0]->getText().toDouble()); + + ++node; + } + + return true; + } + + bool ossimSpot6DimapSupportData::parseQualityAssessment(ossimRefPtr xmlDocument) + { + return true; + } + + bool ossimSpot6DimapSupportData::parseDatasetSources(ossimRefPtr xmlDocument) + { + static const char MODULE[] = "ossimSpot6DimapSupportData::parseDatasetSources"; + ossimString xpath, nodeValue; + vector > xml_nodes; + + //--- + // Fetch the mission index (1A ou 1B) ? + // and generate theSensorID + //--- + xpath = "/Dataset_Sources/Source_Identification/Strip_Source/MISSION"; + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + + if (nodeValue != "SPOT") + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nNot a SPOT mission!"<< std::endl; + } + return false; + } + + //--- + // Fetch the mission index (1A ou 1B) ? + // and generate theSensorID + //--- + xpath = "/Dataset_Sources/Source_Identification/Strip_Source/MISSION_INDEX"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, nodeValue)) + { + return false; + } + + if (nodeValue == "6") + theSensorID = "SPOT 6"; + else + { + setErrorStatus(); + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG:\nNot a valid sensorID!"<< std::endl; + } + return false; + } + + //--- + // Fetch the Instrument: + //--- + xpath = "/Dataset_Sources/Source_Identification/Strip_Source/INSTRUMENT"; + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theInstrument)) + { + return false; + } + + //--- + // Fetch the Instrument Index: + //--- + xpath = "/Dataset_Sources/Source_Identification/Strip_Source/INSTRUMENT_INDEX"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, theInstrumentIndex)) + { + return false; + } + + //--- + // Fetch the Imaging Date: + //--- + ossimString firstLineImagingDate; + xpath = "/Dataset_Sources/Source_Identification/Strip_Source/IMAGING_DATE"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, firstLineImagingDate)) + { + return false; + } + + //--- + // Fetch the Imaging Time: + //--- + ossimString firstLineImagingTime; + xpath = "/Dataset_Sources/Source_Identification/Strip_Source/IMAGING_TIME"; //DIMAPv2 + xpath = theXmlDocumentRoot + xpath; + if (!readOneXmlNode(xmlDocument, xpath, firstLineImagingTime)) + { + return false; + } + + theAcquisitionDate = firstLineImagingDate + "T" + firstLineImagingTime; + + return true; + } + +} diff -Nru otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.h otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.h --- otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6DimapSupportData.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,350 @@ +//******************************************************************* +// Copyright (C) 2014 Centre National Etudes Spatiales +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// Author : Christophe Palmann (christophe.palmann@c-s.fr) +// +// Description: +// +// Contains declaration of class ossimSpot6DimapSupportData +// +//***************************************************************************** +#ifndef ossimSpot6DimapSupportData_HEADER +#define ossimSpot6DimapSupportData_HEADER + +#include + +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include +#include + + +#include +#include + + +class ossimKeywordlist; +class ossimXmlDocument; + +namespace ossimplugins +{ + class OSSIM_PLUGINS_DLL ossimSpot6DimapSupportData : public ossimObject, + public ossimErrorStatusInterface + { + public: + enum ossimSpot6DIMAPVersion + { + OSSIM_Spot6_UNKNOWN, + OSSIM_Spot6_DIMAPv2 + }; + + /** metadata subprofile type */ + enum ossimSpot6MetadataSubProfile + { + OSSIM_Spot6_METADATA_SUBPROFILE_UNKNOWN = 0, + OSSIM_Spot6_METADATA_SUBPROFILE_PRODUCT = 1, + OSSIM_Spot6_METADATA_SUBPROFILE_RPC = 2 + }; + + ossimSpot6DimapSupportData(); + + virtual ~ossimSpot6DimapSupportData(); + + void clearFields(); + + bool parseXmlFile(const ossimFilename& file); + + //--- + // Convenient method to print important image info: + //--- + void printInfo (ostream& os) const; + + /** + * Method to save the state of the object to a keyword list. + * Return true if ok or false on error. + */ + virtual bool saveState(ossimKeywordlist& kwl, + const char* prefix = 0)const; + /** + * Method to the load (recreate) the state of the object from a keyword + * list. Return true if ok or false on error. + */ + virtual bool loadState(const ossimKeywordlist& kwl, + const char* prefix = 0); + + ossimString getSensorID() const; + ossimString getProcessingLevel() const; + ossimString getAcquisitionDate() const; + ossimString getProductionDate() const; + ossimString getImageID() const; + ossimString getInstrument() const; + ossimString getInstrumentIndex() const; + + ossim_uint32 getNumberOfBands() const; + void getSunAzimuth(std::vector& az) const; + void getSunElevation(std::vector& el) const; + void getImageSize(ossimIpt& sz) const; + + void getIncidenceAngle(std::vector& ia) const; + void getViewingAngle(std::vector& va) const; + + //--- + // Corner points: + //--- + void getUlCorner(ossimGpt& pt) const; + void getUrCorner(ossimGpt& pt) const; + void getLrCorner(ossimGpt& pt) const; + void getLlCorner(ossimGpt& pt) const; + + //--- + // Image center point: + //--- + + /** Center of frame, sub image if there is one. */ + void getRefGroundPoint(ossimGpt& gp) const; + + /** zero base center point */ + void getRefImagePoint(ossimDpt& rp) const; + + /** Zero based image rectangle, sub image if there is one. */ + void getImageRect(ossimDrect& rect)const; + + bool allMetadataRead(){return (theProductIsOk && theRpcIsOk);}; + + std::vector getLineNumCoeff() const {return theLineNumCoeff;}; + std::vector getLineDenCoeff() const {return theLineDenCoeff;}; + std::vector getSampNumCoeff() const {return theSampNumCoeff;}; + std::vector getSampDenCoeff() const {return theSampDenCoeff;}; + + ossim_int32 getLineOffset() const {return theLineOffset;}; + ossim_int32 getSampOffset() const {return theSampOffset;}; + double getLatOffset() const {return theLatOffset;}; + double getLonOffset() const {return theLonOffset;}; + double getHeightOffset() const {return theHeightOffset;}; + double getLineScale() const {return theLineScale;}; + double getSampScale() const {return theSampScale;}; + double getLatScale() const {return theLatScale;}; + double getLonScale() const {return theLonScale;}; + double getHeightScale() const {return theHeightScale;}; + + + + private: + ossimSpot6DIMAPVersion theDIMAPVersion; + ossimSpot6MetadataSubProfile theMetadataSubProfile; // only for DIMAPv2 + bool theProductIsOk; + bool theRpcIsOk; + ossimString theXmlDocumentRoot; + + ossimString theSensorID; + ossimString theImageID; + ossimString theProductionDate; + ossimString theAcquisitionDate; + ossimString theInstrument; + ossimString theInstrumentIndex; + ossimString theProcessingLevelString; + ossimString theSpectralProcessingString; + + std::vector theSunAzimuth; + std::vector theSunElevation; + std::vector theIncidenceAngle; + std::vector theViewingAngle; + std::vector theAzimuthAngle; + + ossimIpt theImageSize; + ossimIpt theTileSize; + ossim_uint32 theNumberOfMegaTilesInRow; + ossim_uint32 theNumberOfMegaTilesInCol; + ossim_uint32 theNumberOfMegaTiles; + ossimBooleanProperty theMultiDataFile; + + ossim_uint32 theNumBands; + std::vector theBandOrder; + + /** Calibration information for radiometric corrections*/ + std::vector thePhysicalBias; + std::vector thePhysicalGain; + std::vector theSolarIrradiance; + + //--- + // Corner points: + //--- + ossimGpt theUlCorner; + ossimGpt theUrCorner; + ossimGpt theLrCorner; + ossimGpt theLlCorner; + + // RPC parameters + ossimString theSpecId; + double theErrBias; + double theErrBiasX; + double theErrBiasY; + double theErrRand; + ossim_int32 theLineOffset; + ossim_int32 theSampOffset; + double theLatOffset; + double theLonOffset; + double theHeightOffset; + double theLineScale; + double theSampScale; + double theLatScale; + double theLonScale; + double theHeightScale; + + std::vector theLineNumCoeff; + std::vector theLineDenCoeff; + std::vector theSampNumCoeff; + std::vector theSampDenCoeff; + + + //--- TODO MSD Check if it is necessary to keep that + /** Center of frame on ground, if sub image it's the center of that. */ + ossimGpt theRefGroundPoint; + + /** Zero based center of frame. */ + ossimDpt theRefImagePoint; + + + ossimGpt createGround(const ossimString& s)const; + ossimDpt createDpt(const ossimString& s)const; + ossimIpt createIpt(const ossimString& s)const; + //--- + + bool parseRPCMetadata(ossimRefPtr xmlDocument); + + bool parseMetadataIdentificationDIMAPv2(ossimRefPtr xmlDocument); + + /** + * Dataset Identification: + * + * From xml section: + * /Dimap_Document/Dataset_Identification/ + * + * NOT YET USED + * + * @return true. + */ + bool parseDatasetIdentification(ossimRefPtr xmlDocument); + + /** + * Dataset Content: + * + * From xml section: + * /Dimap_Document/Dataset_Content/ + * + * Initializes: + * theRefGroundPoint + * theUlCorner + * theUrCorner + * theLrCorner + * theLlCorner + * + * Note that the theRefGroundPoint will be the zero based center of + * the whole mega image. + * Note that the corners will be the corners of the whole mega image. + * @return true on success, false if not found. + */ + bool parseDatasetContent(ossimRefPtr xmlDocument); + + /** + * Product Information: + * + * From xml section: + * /Dimap_Document/Product_Information/ + * + * Initializes: + * theImageID + * theProductionDate + * + * @return true on success, false if not found. + */ + bool parseProductInformation(ossimRefPtr xmlDocument); + + /** + * Coordinate Reference System: + * + * From xml section: + * /Dimap_Document/Coordinate_Reference_System/ + * + * NOT YET USED + * + * @return true. + */ + bool parseCoordinateReferenceSystem(ossimRefPtr xmlDocument); + + /** + * Geoposition: + * + * From xml section: + * /Dimap_Document/Geoposition/ + * + * NOT YET USED + * + * @return true. + */ + bool parseGeoposition(ossimRefPtr xmlDocument); + + /** + * Processing Information: + * + * From xml section: + * /Dimap_Document/Processing_Information/ + * + * Initializes: + * theProcessingLevel + * theSpectralProcessing + * + * @return true on success, false if not found. + */ + bool parseProcessingInformation(ossimRefPtr xmlDocument); + + bool parseRasterData(ossimRefPtr xmlDocument); + + bool parseRadiometricData(ossimRefPtr xmlDocument); + + bool parseGeometricData(ossimRefPtr xmlDocument); + + /** + * QualityAssessment: + * + * From xml section: + * /Dimap_Document/Quality_Assessment/ + * + * NOT YET USED + * + * @return true. + */ + bool parseQualityAssessment(ossimRefPtr xmlDocument); + + bool parseDatasetSources(ossimRefPtr xmlDocument); + + + + }; +} +#endif /* #ifndef ossimSpot6DimapSupportData_HEADER */ diff -Nru otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.cpp otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.cpp --- otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.cpp 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,372 @@ +//******************************************************************* +// Copyright (C) 2014 Centre National Etudes Spatiales +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// Author : Christophe Palmann (christophe.palmann@c-s.fr) +// +// Description: +// +// Contains definition of class ossimSpot6Model +// +//***************************************************************************** + +#include "ossimSpot6Model.h" + +#include +#include + +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +namespace ossimplugins +{ + +// Define Trace flags for use within this file: + static ossimTrace traceExec ("ossimSpot6Model:exec"); + static ossimTrace traceDebug ("ossimSpot6Model:debug"); + + + RTTI_DEF1(ossimSpot6Model, "ossimSpot6Model", ossimRpcModel); + +//************************************************************************************************* +// Constructor +//************************************************************************************************* + ossimSpot6Model::ossimSpot6Model() + :ossimRpcModel (), + theSupportData (0) + { + for (unsigned int i = 0; i < 20; i++) + { + theLineDenCoef[i] = 0.0; + theLineNumCoef[i] = 0.0; + theSampNumCoef[i] = 0.0; + theSampDenCoef[i] = 0.0; + } + } + +//************************************************************************************************* +// Constructor +//************************************************************************************************* + ossimSpot6Model::ossimSpot6Model(const ossimSpot6Model& rhs) + :ossimRpcModel (rhs), + theSupportData (0) + { + } + +//************************************************************************************************* +// Destructor +//************************************************************************************************* + ossimSpot6Model::~ossimSpot6Model() + { + if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG DESTRUCTOR: ~ossimSpot6Model(): entering..." << std::endl; + + theSupportData = 0; + + if (traceExec()) ossimNotify(ossimNotifyLevel_DEBUG) << "DEBUG DESTRUCTOR: ~ossimSpot6Model(): returning..." << std::endl; + } +//************************************************************************************************* +// Infamous DUP +//************************************************************************************************* + ossimObject* ossimSpot6Model::dup() const + { + return new ossimSpot6Model(*this); + } + +//************************************************************************************************* +// Print +//************************************************************************************************* + std::ostream& ossimSpot6Model::print(std::ostream& out) const + { + // Capture stream flags since we are going to mess with them. + std::ios_base::fmtflags f = out.flags(); + + out << "\nDump of ossimSpot6Model at address " << (hex) << this + << (dec) + << "\n------------------------------------------------" + << "\n theImageID = " << theImageID + << "\n theImageSize = " << theImageSize + << "\n theRefGndPt = " << theRefGndPt + << "\n theRefImgPt = " << theRefImgPt + << "\n theProcessingLevel = " << theSupportData->getProcessingLevel() + << "\n------------------------------------------------" + << "\n " << endl; + + // Set the flags back. + out.flags(f); + + if (theSupportData->getProcessingLevel() == "SENSOR") + return ossimRpcModel::print(out); + else + return out; + } + +//************************************************************************************************* +// Save State +//************************************************************************************************* + bool ossimSpot6Model::saveState(ossimKeywordlist& kwl, + const char* prefix) const + { + if(theSupportData.valid()) + { + ossimString supportPrefix = ossimString(prefix) + "support_data."; + theSupportData->saveState(kwl, supportPrefix); + } + + // If only it is a sensor product we save parameters from RPC model, its avoid to + // propagate a empty RPC model + if (theSupportData->getProcessingLevel() == "SENSOR") + { + ossimRpcModel::saveState(kwl, prefix); + return true; + } + else + { + kwl.add(prefix, "sensor", theSensorID, true); + return true; + } + } + +//************************************************************************************************* +// Load State +//************************************************************************************************* + bool ossimSpot6Model::loadState(const ossimKeywordlist& kwl, + const char* prefix) + { + if(!theSupportData) + { + theSupportData = new ossimSpot6DimapSupportData; + } + + ossimString supportPrefix = ossimString(prefix) + "support_data."; + theSupportData->loadState(kwl, supportPrefix); + + // If only it is a sensor product we load parameters from RPC model only, its avoid to + // add a empty RPC model + if (theSupportData->getProcessingLevel() == "SENSOR") + { + ossimRpcModel::loadState(kwl, prefix); + return true; + } + else + { + return true; + } + } + + + + bool + ossimSpot6Model::open(const ossimFilename& file) + { + static const char MODULE[] = "ossimSpot6Model::open"; + //traceDebug.setTraceFlag(true); + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n"; + } + + // Make the gsd nan so it gets computed. + theGSD.makeNan(); + + bool result = false; + + // Filename used. + ossimFilename DIMxmlFile; + ossimFilename RPCxmlFile; + + // Generate metadata and rpc filename + if ( (file.ext().downcase() != "jp2" && file.ext().downcase() != "tif") + || !file.exists()) + { + //not a valid file + return false; + } + else + { + // DIMAPv2 + DIMxmlFile = file.path(); + RPCxmlFile = file.path(); + ossimFilename DIMxmlFileTmp = file.file(); + ossimFilename RPCxmlFileTmp; + + DIMxmlFileTmp = DIMxmlFileTmp.file().replaceStrThatMatch("^IMG_", "DIM_"); + DIMxmlFileTmp = DIMxmlFileTmp.replaceStrThatMatch("_R[0-9]+C[0-9]+\\.(JP2|TIF)$", ".XML"); + // Check if it is an XML extension + if( DIMxmlFileTmp.ext() != "XML") + return false; + + RPCxmlFileTmp = DIMxmlFileTmp.file().replaceStrThatMatch("^DIM_", "RPC_"); + + DIMxmlFile = DIMxmlFile.dirCat(DIMxmlFileTmp); + RPCxmlFile = RPCxmlFile.dirCat(RPCxmlFileTmp); + + if (!DIMxmlFile.exists()) + { + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "SPOT main DIMAP file " << DIMxmlFile << " doesn't exist ...\n"; + } + return false; + } + } + + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "Metadata xml file: " << DIMxmlFile << "\n"; + ossimNotify(ossimNotifyLevel_DEBUG) << "RPC xml file: " << RPCxmlFile << "\n"; + } + + ossimString processingLevel; + // Parse the metadata xml file + if ( !theSupportData.valid() ) + theSupportData = new ossimSpot6DimapSupportData(); + + if(!theSupportData->parseXmlFile(DIMxmlFile)) + { + theSupportData = 0; // ossimRefPtr + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << "ossimSpot6Model::open DEBUG:" + << "\nCould not open correctly DIMAP file" << std::endl; + } + return false; + } + + theSensorID = theSupportData->getSensorID(); + theImageID = theSupportData->getImageID(); + // Get the processing level (ORTHO or SENSOR or perhaps MOSAIC ?) + processingLevel = theSupportData->getProcessingLevel(); + + // Parse the RPC xml file if necessary + if (RPCxmlFile.exists() && processingLevel == "SENSOR") + { + if (!theSupportData->parseXmlFile(RPCxmlFile)) + { + theSupportData = 0; // ossimRefPtr + ossimNotify(ossimNotifyLevel_WARN) << "ossimSpot6Model::open WARNING:" + << "\nCould not open correctly RPC file" << std::endl; + return false; + } + + thePolyType = B; + + for (unsigned int i = 0 ; i < 20; i++ ) + { + theLineNumCoef[i] = theSupportData->getLineNumCoeff()[i]; + theLineDenCoef[i] = theSupportData->getLineDenCoeff()[i]; + theSampNumCoef[i] = theSupportData->getSampNumCoeff()[i]; + theSampDenCoef[i] = theSupportData->getSampDenCoeff()[i]; + } + + theLineScale = theSupportData->getLineScale(); + theSampScale = theSupportData->getSampScale(); + theLatScale = theSupportData->getLatScale(); + theLonScale = theSupportData->getLonScale(); + theHgtScale = theSupportData->getHeightScale(); + theLineOffset = theSupportData->getLineOffset(); + theSampOffset = theSupportData->getSampOffset(); + theLatOffset = theSupportData->getLatOffset(); + theLonOffset = theSupportData->getLonOffset(); + theHgtOffset = theSupportData->getHeightOffset(); + } + + // TODO MSD Check if this part is necessary + _productXmlFile = DIMxmlFile; + ossimSupportFilesList::instance()->add(_productXmlFile); + + // TODO MSD WARNING File with multi tiles are not well managed + theSupportData->getImageRect(theImageClipRect); + theSupportData->getImageSize(theImageSize); + + finishConstruction(); + clearErrorStatus(); + + result = true; + if (traceDebug()) + { + ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " exit status = " << (result ? "true" : "false\n") << std::endl; + } + + /*std::cout << "---------------------------" << std::endl; + print(std::cout); + std::cout << "---------------------------" << std::endl;*/ + return result; + } + +//************************************************************************************************* +//! Collects common code among all parsers +//************************************************************************************************* + void ossimSpot6Model::finishConstruction() + { + theImageSize.line = theImageClipRect.height(); + theImageSize.samp = theImageClipRect.width(); + theRefImgPt.line = theImageClipRect.midPoint().y; + theRefImgPt.samp = theImageClipRect.midPoint().x; + theRefGndPt.lat = theLatOffset; + theRefGndPt.lon = theLonOffset; + theRefGndPt.hgt = theHgtOffset; + + //--- + // NOTE: We must call "updateModel()" to set parameter used by base + // ossimRpcModel prior to calling lineSampleHeightToWorld or all + // the world points will be same. + //--- + updateModel(); + + ossimGpt v0, v1, v2, v3; + lineSampleHeightToWorld(theImageClipRect.ul(), theHgtOffset, v0); + lineSampleHeightToWorld(theImageClipRect.ur(), theHgtOffset, v1); + lineSampleHeightToWorld(theImageClipRect.lr(), theHgtOffset, v2); + lineSampleHeightToWorld(theImageClipRect.ll(), theHgtOffset, v3); + + theBoundGndPolygon = ossimPolygon (ossimDpt(v0), ossimDpt(v1), ossimDpt(v2), ossimDpt(v3)); + + // Set the ground reference point using the model. + lineSampleHeightToWorld(theRefImgPt, theHgtOffset, theRefGndPt); + + if( theGSD.hasNans() ) + { + try + { + // This will set theGSD and theMeanGSD. Method throws ossimException. + computeGsd(); + } + catch (const ossimException& e) + { + ossimNotify(ossimNotifyLevel_WARN) + << "ossimSpot6Model::finishConstruction -- caught exception:\n" + << e.what() << std::endl; + } + } + } + +} + diff -Nru otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.h otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.h --- otb-4.0.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.h 1970-01-01 00:00:00.000000000 +0000 +++ otb-4.2.0/Utilities/otbossimplugins/ossim/ossimSpot6Model.h 2014-09-03 08:29:34.000000000 +0000 @@ -0,0 +1,114 @@ +//******************************************************************* +// Copyright (C) 2014 Centre National Etudes Spatiales +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 3 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +// +// Author : Christophe Palmann (christophe.palmann@c-s.fr) +// +// Description: +// +// Contains declaration of class ossimSpot6Model. +// +//***************************************************************************** +// FIXME $Id: ossimSpot5Model.h 15766 2009-10-20 12:37:09Z gpotts $ +#ifndef ossimSpot6Model_HEADER +#define ossimSpot6Model_HEADER + +#include + +#include +#include "ossimSpot6DimapSupportData.h" + +#include + +#include + + +namespace ossimplugins +{ + class ossimSpot6DimapSupportData; + + class OSSIM_PLUGINS_DLL ossimSpot6Model : public ossimRpcModel + { + public: + /*! + * CONSTRUCTORS: + */ + /** @brief default constructor */ + ossimSpot6Model(); + + /** @brief copy constructor */ + ossimSpot6Model(const ossimSpot6Model& rhs); + + /** @brief Destructor */ + virtual ~ossimSpot6Model(); + + bool open(const ossimFilename& file); + + /*! + * Returns pointer to a new instance, copy of this. + * Not implemented yet! Returns NULL... + */ + virtual ossimObject* dup() const; + + /*! + * Extends base-class implementation. Dumps contents of object to ostream. + */ + virtual std::ostream& print(std::ostream& out) const; + + /*! + * Fulfills ossimObject base-class pure virtuals. Loads and saves geometry + * KWL files. Returns true if successful. + */ + virtual bool saveState(ossimKeywordlist& kwl, + const char* prefix=NULL) const; + + virtual bool loadState(const ossimKeywordlist& kwl, + const char* prefix=NULL); + + void setSupportData(ossimSpot6DimapSupportData* supportData) + { + theSupportData = supportData; + } + ossimSpot6DimapSupportData* getSupportData() + { + return theSupportData.get(); + } + const ossimSpot6DimapSupportData* getSupportData()const + { + return theSupportData.get(); + } + + protected: + + bool parseMetaData(const ossimFilename& file); + + bool parseRpcData (const ossimFilename& file); + + // In the future + //bool parseJP2File (const ossimFilename& file); + + void finishConstruction(); + + ossimRefPtr theSupportData; + + ossimFilename _productXmlFile; + + + TYPE_DATA + }; +} +#endif /* #ifndef ossimSpot6Model_HEADER */ + diff -Nru otb-4.0.0/Utilities/otbsiftfast/libsiftfast.cpp otb-4.2.0/Utilities/otbsiftfast/libsiftfast.cpp --- otb-4.0.0/Utilities/otbsiftfast/libsiftfast.cpp 2014-02-25 13:06:50.000000000 +0000 +++ otb-4.2.0/Utilities/otbsiftfast/libsiftfast.cpp 2014-09-03 08:29:34.000000000 +0000 @@ -594,7 +594,7 @@ typedef vector LISTBUF; static LISTBUF s_listconvbuf; //TODO, make 16 byte aligned static int s_convbufsize = 0; // the size of all the buffers in s_listconvbuf -static int SIFT_ALIGNED16(s_convmask[4]) = {0xffffffff,0xffffffff,0xffffffff,0}; +static int SIFT_ALIGNED16(s_convmask[4]) = {static_cast(0xffffffff),static_cast(0xffffffff),static_cast(0xffffffff),0}; struct myaccum { float SIFT_ALIGNED16(faccum[2][4]); }; @@ -1750,7 +1750,7 @@ DEF_CONST(CF4_0, 0.0f) DEF_CONST(CF4_2, 2.0f) -DEI_CONST(CI4_SIGN, 0x80000000u) +DEI_CONST(CI4_SIGN, static_cast(0x80000000u)) DEF_CONST(CF4__1, -1.0f) DEF_CONST(CF4_1, 1.0f) DEF_CONST(CF4_SMALL, 1.0E-35f)