From b122bc908a1ecb32bd292a2c53b1b6dc8cd8ce34 Mon Sep 17 00:00:00 2001 From: Stephane ALBERT <stephane.albert@c-s.fr> Date: Mon, 1 Apr 2019 17:12:10 +0200 Subject: [PATCH] STYLE: Applied clang-format. --- .../app/otbPolygonClassStatistics.cxx | 64 ++-- .../app/otbSampleSelection.cxx | 94 +++--- .../AppImageUtils/app/otbManageNoData.cxx | 2 +- .../app/otbLargeScaleMeanShift.cxx | 6 +- .../include/otbWrapperApplication.h | 114 +++---- .../include/otbWrapperCastImage.h | 64 ++-- .../include/otbWrapperInputImageParameter.h | 80 +++-- .../include/otbWrapperOutputImageParameter.h | 13 +- .../src/otbWrapperApplication.cxx | 132 ++++---- .../src/otbWrapperInputImageParameter.cxx | 18 +- .../src/otbWrapperOutputImageParameter.cxx | 299 ++++++++---------- 11 files changed, 417 insertions(+), 469 deletions(-) diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index 1d5c7726da..bbfb99010e 100644 --- a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx @@ -64,7 +64,6 @@ public: private: PolygonClassStatistics() { - } void DoInit() override @@ -175,46 +174,39 @@ private: void DoExecute() override { - otb::ogr::DataSource::Pointer vectors = - otb::ogr::DataSource::New(this->GetParameterString("vec")); + otb::ogr::DataSource::Pointer vectors = otb::ogr::DataSource::New(this->GetParameterString("vec")); - // Retrieve the field name - std::vector<int> selectedCFieldIdx = GetSelectedItems("field"); + // Retrieve the field name + std::vector<int> selectedCFieldIdx = GetSelectedItems("field"); - if(selectedCFieldIdx.empty()) + if (selectedCFieldIdx.empty()) { otbAppLogFATAL(<<"No field has been selected for data labelling!"); } - std::vector<std::string> cFieldNames = GetChoiceNames("field"); - std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; - - otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this,"elev"); - - // Reproject geometries - FloatVectorImageType::Pointer inputImg = this->GetParameterImage("in"); - std::string imageProjectionRef = inputImg->GetProjectionRef(); - FloatVectorImageType::ImageKeywordlistType imageKwl = - inputImg->GetImageKeywordlist(); - std::string vectorProjectionRef = - vectors->GetLayer(GetParameterInt("layer")).GetProjectionRef(); - - otb::ogr::DataSource::Pointer reprojVector = vectors; - GeometriesType::Pointer inputGeomSet; - ProjectionFilterType::Pointer geometriesProjFilter; - GeometriesType::Pointer outputGeomSet; - const OGRSpatialReference imgOGRSref = - OGRSpatialReference( imageProjectionRef.c_str() ); - const OGRSpatialReference vectorOGRSref = - OGRSpatialReference( vectorProjectionRef.c_str() ); - bool doReproj = true; - // don't reproject for these cases - if ( vectorProjectionRef.empty() - || ( imgOGRSref.IsSame( &vectorOGRSref ) ) - || ( imageProjectionRef.empty() && imageKwl.GetSize() == 0) ) - doReproj = false; - - if (doReproj) + std::vector<std::string> cFieldNames = GetChoiceNames("field"); + std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; + + otb::Wrapper::ElevationParametersHandler::SetupDEMHandlerFromElevationParameters(this, "elev"); + + // Reproject geometries + FloatVectorImageType::Pointer inputImg = this->GetParameterImage("in"); + std::string imageProjectionRef = inputImg->GetProjectionRef(); + FloatVectorImageType::ImageKeywordlistType imageKwl = inputImg->GetImageKeywordlist(); + std::string vectorProjectionRef = vectors->GetLayer(GetParameterInt("layer")).GetProjectionRef(); + + otb::ogr::DataSource::Pointer reprojVector = vectors; + GeometriesType::Pointer inputGeomSet; + ProjectionFilterType::Pointer geometriesProjFilter; + GeometriesType::Pointer outputGeomSet; + const OGRSpatialReference imgOGRSref = OGRSpatialReference(imageProjectionRef.c_str()); + const OGRSpatialReference vectorOGRSref = OGRSpatialReference(vectorProjectionRef.c_str()); + bool doReproj = true; + // don't reproject for these cases + if (vectorProjectionRef.empty() || (imgOGRSref.IsSame(&vectorOGRSref)) || (imageProjectionRef.empty() && imageKwl.GetSize() == 0)) + doReproj = false; + + if (doReproj) { inputGeomSet = GeometriesType::New(vectors); reprojVector = otb::ogr::DataSource::New(); @@ -236,7 +228,7 @@ private: filter->SetInput(this->GetParameterImage("in")); if (IsParameterEnabled("mask") && HasValue("mask")) { - filter->SetMask(this->GetParameterUInt8Image("mask")); + filter->SetMask(this->GetParameterUInt8Image("mask")); } filter->SetOGRData(reprojVector); filter->SetFieldName(fieldName); diff --git a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx index 5537a77f3e..959f3c129d 100644 --- a/Modules/Applications/AppClassification/app/otbSampleSelection.cxx +++ b/Modules/Applications/AppClassification/app/otbSampleSelection.cxx @@ -87,40 +87,41 @@ private: // Documentation SetDocName("Sample Selection"); - SetDocLongDescription("The application selects a set of samples from geometries " - "intended for training (they should have a field giving the associated " - "class). \n\nFirst of all, the geometries must be analyzed by the PolygonClassStatistics application " - "to compute statistics about the geometries, which are summarized in an xml file. " - "\nThen, this xml file must be given as input to this application (parameter instats).\n\n" - "The input support image and the input training vectors shall be given in " - "parameters 'in' and 'vec' respectively. Only the sampling grid (origin, size, spacing)" - "will be read in the input image.\n" - "There are several strategies to select samples (parameter strategy) : \n\n" - " - smallest (default) : select the same number of sample in each class" - " so that the smallest one is fully sampled.\n" - " - constant : select the same number of samples N in each class" - " (with N below or equal to the size of the smallest class).\n" - " - byclass : set the required number for each class manually, with an input CSV file" - " (first column is class name, second one is the required samples number).\n\n" - " - percent: set a target global percentage of samples to use. Class proportions will be respected. \n\n" - " - total: set a target total number of samples to use. Class proportions will be respected. \n\n" - "There is also a choice on the sampling type to performs : \n\n" - " - periodic : select samples uniformly distributed\n" - " - random : select samples randomly distributed\n\n" - "Once the strategy and type are selected, the application outputs samples positions" - "(parameter out).\n\n" - - "The other parameters to look at are : \n\n" - " - layer : index specifying from which layer to pick geometries.\n" - " - field : set the field name containing the class.\n" - " - mask : an optional raster mask can be used to discard samples.\n" - " - outrates : allows outputting a CSV file that summarizes the sampling rates for each class.\n" - - "\nAs with the PolygonClassStatistics application, different types of geometry are supported : " - "polygons, lines, points. \nThe behavior of this application is different for each type of geometry : \n\n" - " - polygon: select points whose center is inside the polygon\n" - " - lines : select points intersecting the line\n" - " - points : select closest point to the provided point"); + SetDocLongDescription( + "The application selects a set of samples from geometries " + "intended for training (they should have a field giving the associated " + "class). \n\nFirst of all, the geometries must be analyzed by the PolygonClassStatistics application " + "to compute statistics about the geometries, which are summarized in an xml file. " + "\nThen, this xml file must be given as input to this application (parameter instats).\n\n" + "The input support image and the input training vectors shall be given in " + "parameters 'in' and 'vec' respectively. Only the sampling grid (origin, size, spacing)" + "will be read in the input image.\n" + "There are several strategies to select samples (parameter strategy) : \n\n" + " - smallest (default) : select the same number of sample in each class" + " so that the smallest one is fully sampled.\n" + " - constant : select the same number of samples N in each class" + " (with N below or equal to the size of the smallest class).\n" + " - byclass : set the required number for each class manually, with an input CSV file" + " (first column is class name, second one is the required samples number).\n\n" + " - percent: set a target global percentage of samples to use. Class proportions will be respected. \n\n" + " - total: set a target total number of samples to use. Class proportions will be respected. \n\n" + "There is also a choice on the sampling type to performs : \n\n" + " - periodic : select samples uniformly distributed\n" + " - random : select samples randomly distributed\n\n" + "Once the strategy and type are selected, the application outputs samples positions" + "(parameter out).\n\n" + + "The other parameters to look at are : \n\n" + " - layer : index specifying from which layer to pick geometries.\n" + " - field : set the field name containing the class.\n" + " - mask : an optional raster mask can be used to discard samples.\n" + " - outrates : allows outputting a CSV file that summarizes the sampling rates for each class.\n" + + "\nAs with the PolygonClassStatistics application, different types of geometry are supported : " + "polygons, lines, points. \nThe behavior of this application is different for each type of geometry : \n\n" + " - polygon: select points whose center is inside the polygon\n" + " - lines : select points intersecting the line\n" + " - points : select closest point to the provided point"); SetDocLimitations("None"); SetDocAuthors("OTB-Team"); SetDocSeeAlso(" "); @@ -272,21 +273,20 @@ private: otbAppLogFATAL(<<"No field has been selected for data labelling!"); } - std::vector<std::string> cFieldNames = GetChoiceNames("field"); - std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; + std::vector<std::string> cFieldNames = GetChoiceNames("field"); + std::string fieldName = cFieldNames[selectedCFieldIdx.front()]; - m_ReaderStat->SetFileName(this->GetParameterString("instats")); - ClassCountMapType classCount = m_ReaderStat->GetStatisticMapByName<ClassCountMapType>("samplesPerClass"); - m_RateCalculator->SetClassCount(classCount); + m_ReaderStat->SetFileName(this->GetParameterString("instats")); + ClassCountMapType classCount = m_ReaderStat->GetStatisticMapByName<ClassCountMapType>("samplesPerClass"); + m_RateCalculator->SetClassCount(classCount); - switch (this->GetParameterInt("strategy")) + switch (this->GetParameterInt("strategy")) { // byclass case 0: { otbAppLogINFO("Sampling strategy : set number of samples for each class"); - ClassCountMapType requiredCount = - otb::SamplingRateCalculator::ReadRequiredSamples(this->GetParameterString("strategy.byclass.in")); + ClassCountMapType requiredCount = otb::SamplingRateCalculator::ReadRequiredSamples(this->GetParameterString("strategy.byclass.in")); m_RateCalculator->SetNbOfSamplesByClass(requiredCount); } break; @@ -376,10 +376,8 @@ private: ProjectionFilterType::Pointer geometriesProjFilter; GeometriesType::Pointer outputGeomSet; bool doReproj = true; - const OGRSpatialReference imgOGRSref = - OGRSpatialReference( imageProjectionRef.c_str() ); - const OGRSpatialReference vectorOGRSref = - OGRSpatialReference( vectorProjectionRef.c_str() ); + const OGRSpatialReference imgOGRSref = OGRSpatialReference(imageProjectionRef.c_str()); + const OGRSpatialReference vectorOGRSref = OGRSpatialReference(vectorProjectionRef.c_str()); // don't reproject for these cases if ( vectorProjectionRef.empty() || ( imgOGRSref.IsSame( &vectorOGRSref ) ) @@ -426,7 +424,7 @@ private: periodicFilt->SetSamplerParameters(param); if (IsParameterEnabled("mask") && HasValue("mask")) { - periodicFilt->SetMask(this->GetParameterUInt8Image("mask")); + periodicFilt->SetMask(this->GetParameterUInt8Image("mask")); } periodicFilt->GetStreamer()->SetAutomaticTiledStreaming(this->GetParameterInt("ram")); AddProcess(periodicFilt->GetStreamer(),"Selecting positions with periodic sampler..."); @@ -444,7 +442,7 @@ private: randomFilt->SetLayerIndex(this->GetParameterInt("layer")); if (IsParameterEnabled("mask") && HasValue("mask")) { - randomFilt->SetMask(this->GetParameterUInt8Image("mask")); + randomFilt->SetMask(this->GetParameterUInt8Image("mask")); } randomFilt->GetStreamer()->SetAutomaticTiledStreaming(this->GetParameterInt("ram")); AddProcess(randomFilt->GetStreamer(),"Selecting positions with random sampler..."); diff --git a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx index 97f1193ef3..4cd2b5f917 100644 --- a/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx +++ b/Modules/Applications/AppImageUtils/app/otbManageNoData.cxx @@ -158,7 +158,7 @@ private: else if (GetParameterString("mode") == "apply") { m_MaskFilters.clear(); - UInt8ImageType::Pointer maskPtr = this->GetParameterUInt8Image("mode.apply.mask"); + UInt8ImageType::Pointer maskPtr = this->GetParameterUInt8Image("mode.apply.mask"); unsigned int nbBands = inputPtr->GetNumberOfComponentsPerPixel(); itk::MetaDataDictionary &dict = inputPtr->GetMetaDataDictionary(); std::vector<bool> flags; diff --git a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx index d42af406a7..bc414d0f20 100644 --- a/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx +++ b/Modules/Applications/AppSegmentation/app/otbLargeScaleMeanShift.cxx @@ -191,13 +191,11 @@ private: if (IsParameterEnabled("mode.vector.imfield") && HasValue("mode.vector.imfield")) { - GetInternalApplication("vectorization")->SetParameterInputImage("in", - GetParameterImageBase("mode.vector.imfield")); + GetInternalApplication("vectorization")->SetParameterInputImage("in", GetParameterImageBase("mode.vector.imfield")); } else { - GetInternalApplication("vectorization")->SetParameterInputImage("in", - GetParameterImageBase("in")); + GetInternalApplication("vectorization")->SetParameterInputImage("in", GetParameterImageBase("in")); } GetInternalApplication("vectorization")->SetParameterString("inseg", tmpFilenames[2]); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 0100750038..a7bbd97876 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -908,7 +908,7 @@ protected: * \li ParameterType_InputImage */ template <class TImageType> - TImageType* GetParameterImage(std::string parameter); + TImageType* GetParameterImage(std::string parameter); /** Declare a parameter as having an automatic value */ void AutomaticValueOn(std::string paramKey); @@ -922,7 +922,7 @@ protected: * \li ParameterType_OutputImage */ template <class TImageType> - void SetParameterOutputImage(std::string parameter, TImageType* value); + void SetParameterOutputImage(std::string parameter, TImageType* value); /* Set a complex output image value * @@ -930,7 +930,7 @@ protected: * \li ParameterType_ComplexOutputImage */ template <class TImageType> - void SetParameterComplexOutputImage(std::string parameter, TImageType* value); + void SetParameterComplexOutputImage(std::string parameter, TImageType* value); private: /* Implement this method to add parameters */ @@ -1011,77 +1011,85 @@ private: #endif -namespace otb { namespace Wrapper { +namespace otb +{ +namespace Wrapper +{ -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8VectorImageType * Application::GetParameterImage< UInt8VectorImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE Int16VectorImageType * Application::GetParameterImage< Int16VectorImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt16VectorImageType * Application::GetParameterImage< UInt16VectorImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE Int32VectorImageType * Application::GetParameterImage< Int32VectorImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt32VectorImageType * Application::GetParameterImage< UInt32VectorImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8VectorImageType* Application::GetParameterImage<UInt8VectorImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE Int16VectorImageType* Application::GetParameterImage<Int16VectorImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt16VectorImageType* Application::GetParameterImage<UInt16VectorImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE Int32VectorImageType* Application::GetParameterImage<Int32VectorImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt32VectorImageType* Application::GetParameterImage<UInt32VectorImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE FloatVectorImageType * Application::GetParameterImage< FloatVectorImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE DoubleVectorImageType * Application::GetParameterImage< DoubleVectorImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE FloatVectorImageType* Application::GetParameterImage<FloatVectorImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE DoubleVectorImageType* Application::GetParameterImage<DoubleVectorImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt16VectorImageType * Application::GetParameterImage< ComplexInt16VectorImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt32VectorImageType * Application::GetParameterImage< ComplexInt32VectorImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt16VectorImageType* Application::GetParameterImage<ComplexInt16VectorImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt32VectorImageType* Application::GetParameterImage<ComplexInt32VectorImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexFloatVectorImageType * Application::GetParameterImage< ComplexFloatVectorImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexDoubleVectorImageType * Application::GetParameterImage< ComplexDoubleVectorImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexFloatVectorImageType* Application::GetParameterImage<ComplexFloatVectorImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexDoubleVectorImageType* Application::GetParameterImage<ComplexDoubleVectorImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8RGBImageType * Application::GetParameterImage< UInt8RGBImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8RGBAImageType * Application::GetParameterImage< UInt8RGBAImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8RGBImageType* Application::GetParameterImage<UInt8RGBImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8RGBAImageType* Application::GetParameterImage<UInt8RGBAImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8ImageType * Application::GetParameterImage< UInt8ImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE Int16ImageType * Application::GetParameterImage< Int16ImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt16ImageType * Application::GetParameterImage< UInt16ImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE Int32ImageType * Application::GetParameterImage< Int32ImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt32ImageType * Application::GetParameterImage< UInt32ImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt8ImageType* Application::GetParameterImage<UInt8ImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE Int16ImageType* Application::GetParameterImage<Int16ImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt16ImageType* Application::GetParameterImage<UInt16ImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE Int32ImageType* Application::GetParameterImage<Int32ImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE UInt32ImageType* Application::GetParameterImage<UInt32ImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE FloatImageType * Application::GetParameterImage< FloatImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE DoubleImageType * Application::GetParameterImage< DoubleImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE FloatImageType* Application::GetParameterImage<FloatImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE DoubleImageType* Application::GetParameterImage<DoubleImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt16ImageType * Application::GetParameterImage< ComplexInt16ImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt32ImageType * Application::GetParameterImage< ComplexInt32ImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt16ImageType* Application::GetParameterImage<ComplexInt16ImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexInt32ImageType* Application::GetParameterImage<ComplexInt32ImageType>(std::string); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexFloatImageType * Application::GetParameterImage< ComplexFloatImageType >( std::string ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexDoubleImageType * Application::GetParameterImage< ComplexDoubleImageType >( std::string ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexFloatImageType* Application::GetParameterImage<ComplexFloatImageType>(std::string); +extern template OTBApplicationEngine_EXPORT_TEMPLATE ComplexDoubleImageType* Application::GetParameterImage<ComplexDoubleImageType>(std::string); // -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt8VectorImageType >( std::string, UInt8VectorImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< Int16VectorImageType >( std::string, Int16VectorImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt16VectorImageType >( std::string, UInt16VectorImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< Int32VectorImageType >( std::string, Int32VectorImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt32VectorImageType >( std::string, UInt32VectorImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8VectorImageType>(std::string, UInt8VectorImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int16VectorImageType>(std::string, Int16VectorImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt16VectorImageType>(std::string, UInt16VectorImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int32VectorImageType>(std::string, Int32VectorImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt32VectorImageType>(std::string, UInt32VectorImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< FloatVectorImageType >( std::string, FloatVectorImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< DoubleVectorImageType >( std::string, DoubleVectorImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<FloatVectorImageType>(std::string, FloatVectorImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<DoubleVectorImageType>(std::string, DoubleVectorImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt16VectorImageType >( std::string, ComplexInt16VectorImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt32VectorImageType >( std::string, ComplexInt32VectorImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt16VectorImageType>(std::string, + ComplexInt16VectorImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt32VectorImageType>(std::string, + ComplexInt32VectorImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexFloatVectorImageType >( std::string, ComplexFloatVectorImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexDoubleVectorImageType >( std::string, ComplexDoubleVectorImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexFloatVectorImageType>(std::string, + ComplexFloatVectorImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexDoubleVectorImageType>(std::string, + ComplexDoubleVectorImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt8RGBImageType >( std::string, UInt8RGBImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt8RGBAImageType >( std::string, UInt8RGBAImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8RGBImageType>(std::string, UInt8RGBImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8RGBAImageType>(std::string, UInt8RGBAImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt8ImageType >( std::string, UInt8ImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< Int16ImageType >( std::string, Int16ImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt16ImageType >( std::string, UInt16ImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< Int32ImageType >( std::string, Int32ImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< UInt32ImageType >( std::string, UInt32ImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt8ImageType>(std::string, UInt8ImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int16ImageType>(std::string, Int16ImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt16ImageType>(std::string, UInt16ImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<Int32ImageType>(std::string, Int32ImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<UInt32ImageType>(std::string, UInt32ImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< FloatImageType >( std::string, FloatImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< DoubleImageType >( std::string, DoubleImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<FloatImageType>(std::string, FloatImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<DoubleImageType>(std::string, DoubleImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt16ImageType >( std::string, ComplexInt16ImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt32ImageType >( std::string, ComplexInt32ImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt16ImageType>(std::string, ComplexInt16ImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt32ImageType>(std::string, ComplexInt32ImageType*); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexFloatImageType >( std::string, ComplexFloatImageType * ); -extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage< ComplexDoubleImageType >( std::string, ComplexDoubleImageType * ); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexFloatImageType>(std::string, ComplexFloatImageType*); +extern template OTBApplicationEngine_EXPORT_TEMPLATE void Application::SetParameterOutputImage<ComplexDoubleImageType>(std::string, ComplexDoubleImageType*); -} } +} // namespace Wrapper +} // namespace otb #endif // otbWrapperApplication_h_ diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperCastImage.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperCastImage.h index c7bd039fb2..0e975d7adc 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperCastImage.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperCastImage.h @@ -42,30 +42,24 @@ namespace details * * \ingroup OTBApplicationEngine */ -template< typename TOutputImage, - typename TInputImage > +template <typename TOutputImage, typename TInputImage> struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage { /** Input clamping */ - using InputClampImageFilter = - ClampImageFilter< TInputImage, DoubleVectorImageType >; + using InputClampImageFilter = ClampImageFilter<TInputImage, DoubleVectorImageType>; /** Output clamping */ - using OutputClampImageFilter = - ClampImageFilter< DoubleVectorImageType , TOutputImage >; + using OutputClampImageFilter = ClampImageFilter<DoubleVectorImageType, TOutputImage>; /** Constructor. */ - CastImage( TInputImage * in ) : - icif( InputClampImageFilter::New() ), - ocif( OutputClampImageFilter::New() ), - out( ocif->GetOutput() ) + CastImage(TInputImage* in) : icif(InputClampImageFilter::New()), ocif(OutputClampImageFilter::New()), out(ocif->GetOutput()) { - assert( in ); + assert(in); - icif->SetInput( in ); + icif->SetInput(in); - ocif->SetInput( icif->GetOutput() ); + ocif->SetInput(icif->GetOutput()); } /** Input-image clamp filter. */ @@ -75,7 +69,7 @@ struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage typename OutputClampImageFilter::Pointer ocif; /** Output image. */ - TOutputImage * out; + TOutputImage* out; }; @@ -84,24 +78,20 @@ struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage * pipeline when input-image is DoubleVectorImageType. * * \ingroup OTBApplicationEngine -*/ -template< typename TOutputImage > -struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage< TOutputImage, - DoubleVectorImageType > + */ +template <typename TOutputImage> +struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage<TOutputImage, DoubleVectorImageType> { /** Output clamping */ - using OutputClampImageFilter = - ClampImageFilter< DoubleVectorImageType , TOutputImage >; + using OutputClampImageFilter = ClampImageFilter<DoubleVectorImageType, TOutputImage>; /** Constructor. */ - CastImage( DoubleVectorImageType * in ) : - ocif( OutputClampImageFilter::New() ), - out( ocif->GetOutput() ) + CastImage(DoubleVectorImageType* in) : ocif(OutputClampImageFilter::New()), out(ocif->GetOutput()) { - assert( in ); + assert(in); - ocif->SetInput( in ); + ocif->SetInput(in); } /** Input-image clamp filter. */ @@ -111,7 +101,7 @@ struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage< TOutputImage, typename OutputClampImageFilter::Pointer ocif; /** Output image. */ - TOutputImage * out; + TOutputImage* out; }; @@ -121,18 +111,17 @@ struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage< TOutputImage, * * \ingroup OTBApplicationEngine */ -template< typename T > -struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage< T, T > +template <typename T> +struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage<T, T> { - CastImage( T * in ) : - out( in ) + CastImage(T* in) : out(in) { - assert( in ); + assert(in); } itk::ProcessObject::Pointer icif; itk::ProcessObject::Pointer ocif; - T * out; + T* out; }; @@ -142,18 +131,17 @@ struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage< T, T > * * \ingroup OTBApplicationEngine */ -template<> -struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage< DoubleVectorImageType, DoubleVectorImageType > +template <> +struct OTBApplicationEngine_EXPORT_TEMPLATE CastImage<DoubleVectorImageType, DoubleVectorImageType> { - CastImage( DoubleVectorImageType * in ) : - out( in ) + CastImage(DoubleVectorImageType* in) : out(in) { - assert( in ); + assert(in); } itk::ProcessObject::Pointer icif; itk::ProcessObject::Pointer ocif; - DoubleVectorImageType * out; + DoubleVectorImageType* out; }; } // namespace details. diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h index e9ccf1627e..a49e4c2bfb 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.h @@ -61,46 +61,46 @@ public: /** Get input-image as ImageBaseType. */ - ImageBaseType const * GetImage() const; - ImageBaseType * GetImage(); + ImageBaseType const* GetImage() const; + ImageBaseType* GetImage(); /** Get the input image as XXXImageType */ - UInt8ImageType * GetUInt8Image(); - UInt16ImageType * GetUInt16Image(); - Int16ImageType * GetInt16Image(); - UInt32ImageType * GetUInt32Image(); - Int32ImageType * GetInt32Image(); - FloatImageType * GetFloatImage(); - DoubleImageType * GetDoubleImage(); - - UInt8VectorImageType * GetUInt8VectorImage(); - UInt16VectorImageType * GetUInt16VectorImage(); - Int16VectorImageType * GetInt16VectorImage(); - UInt32VectorImageType * GetUInt32VectorImage(); - Int32VectorImageType * GetInt32VectorImage(); - FloatVectorImageType * GetFloatVectorImage(); - DoubleVectorImageType * GetDoubleVectorImage(); - - UInt8RGBImageType * GetUInt8RGBImage(); - UInt8RGBAImageType * GetUInt8RGBAImage(); + UInt8ImageType* GetUInt8Image(); + UInt16ImageType* GetUInt16Image(); + Int16ImageType* GetInt16Image(); + UInt32ImageType* GetUInt32Image(); + Int32ImageType* GetInt32Image(); + FloatImageType* GetFloatImage(); + DoubleImageType* GetDoubleImage(); + + UInt8VectorImageType* GetUInt8VectorImage(); + UInt16VectorImageType* GetUInt16VectorImage(); + Int16VectorImageType* GetInt16VectorImage(); + UInt32VectorImageType* GetUInt32VectorImage(); + Int32VectorImageType* GetInt32VectorImage(); + FloatVectorImageType* GetFloatVectorImage(); + DoubleVectorImageType* GetDoubleVectorImage(); + + UInt8RGBImageType* GetUInt8RGBImage(); + UInt8RGBAImageType* GetUInt8RGBAImage(); // Complex image - ComplexInt16ImageType * GetComplexInt16Image(); - ComplexInt32ImageType * GetComplexInt32Image(); - ComplexFloatImageType * GetComplexFloatImage(); - ComplexDoubleImageType * GetComplexDoubleImage(); + ComplexInt16ImageType* GetComplexInt16Image(); + ComplexInt32ImageType* GetComplexInt32Image(); + ComplexFloatImageType* GetComplexFloatImage(); + ComplexDoubleImageType* GetComplexDoubleImage(); - ComplexInt16VectorImageType * GetComplexInt16VectorImage(); - ComplexInt32VectorImageType * GetComplexInt32VectorImage(); - ComplexFloatVectorImageType * GetComplexFloatVectorImage(); - ComplexDoubleVectorImageType * GetComplexDoubleVectorImage(); + ComplexInt16VectorImageType* GetComplexInt16VectorImage(); + ComplexInt32VectorImageType* GetComplexInt32VectorImage(); + ComplexFloatVectorImageType* GetComplexFloatVectorImage(); + ComplexDoubleVectorImageType* GetComplexDoubleVectorImage(); /** Get the input image as templated image type. */ template <class TImageType> TImageType* GetImage(); /** Set a templated image.*/ - void SetImage( ImageBaseType * image ); + void SetImage(ImageBaseType* image); /** Generic cast method that will be specified for each image type. */ @@ -122,10 +122,10 @@ protected: ~InputImageParameter() override; private: - InputImageParameter(const Parameter &) = delete; - void operator =(const Parameter&) = delete; + InputImageParameter(const Parameter&) = delete; + void operator=(const Parameter&) = delete; - std::string m_FileName; + std::string m_FileName; itk::ProcessObject::Pointer m_Reader; ImageBaseType::Pointer m_Image; @@ -134,21 +134,17 @@ private: itk::ProcessObject::Pointer m_OutputCaster; private: - /** */ - template< typename T > - using InputClampImageFilter = - ClampImageFilter< T, otb::Wrapper::DoubleVectorImageType >; + template <typename T> + using InputClampImageFilter = ClampImageFilter<T, otb::Wrapper::DoubleVectorImageType>; /** */ - template< typename T > - using OutputClampImageFilter = - ClampImageFilter< otb::Wrapper::DoubleVectorImageType, T >; + template <typename T> + using OutputClampImageFilter = ClampImageFilter<otb::Wrapper::DoubleVectorImageType, T>; /** */ - template< typename TOutputImage, - typename TInputImage > - TOutputImage * Cast( TInputImage * ); + template <typename TOutputImage, typename TInputImage> + TOutputImage* Cast(TInputImage*); /** Store the loaded image filename */ std::string m_PreviousFileName; diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h index 74f49a1abe..ec7a1a8f85 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h @@ -96,7 +96,7 @@ public: void SetFileName (const char* filename); void SetFileName (const std::string& filename); - itkGetStringMacro( FileName ); + itkGetStringMacro(FileName); void Write(); @@ -132,15 +132,14 @@ private: void operator =(const Parameter&) = delete; /** Switch TInputImage according to expected output type. */ - template< typename TInputImage > - void SwitchInput( TInputImage * ); + template <typename TInputImage> + void SwitchInput(TInputImage*); /** */ - template< typename TOutputImage, - typename TInputImage > - void ClampAndWriteVectorImage( TInputImage * ); + template <typename TOutputImage, typename TInputImage> + void ClampAndWriteVectorImage(TInputImage*); - //FloatVectorImageType::Pointer m_Image; + // FloatVectorImageType::Pointer m_Image; ImageBaseType::Pointer m_Image; itk::ProcessObject::Pointer m_InputCaster; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index b78cbf666f..c635708b25 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -72,73 +72,77 @@ namespace Wrapper { -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8VectorImageType * Application::GetParameterImage< UInt8VectorImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int16VectorImageType * Application::GetParameterImage< Int16VectorImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt16VectorImageType * Application::GetParameterImage< UInt16VectorImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int32VectorImageType * Application::GetParameterImage< Int32VectorImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt32VectorImageType * Application::GetParameterImage< UInt32VectorImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8VectorImageType* Application::GetParameterImage<UInt8VectorImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int16VectorImageType* Application::GetParameterImage<Int16VectorImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt16VectorImageType* Application::GetParameterImage<UInt16VectorImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int32VectorImageType* Application::GetParameterImage<Int32VectorImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt32VectorImageType* Application::GetParameterImage<UInt32VectorImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE FloatVectorImageType * Application::GetParameterImage< FloatVectorImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE DoubleVectorImageType * Application::GetParameterImage< DoubleVectorImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE FloatVectorImageType* Application::GetParameterImage<FloatVectorImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE DoubleVectorImageType* Application::GetParameterImage<DoubleVectorImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt16VectorImageType * Application::GetParameterImage< ComplexInt16VectorImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt32VectorImageType * Application::GetParameterImage< ComplexInt32VectorImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt16VectorImageType* Application::GetParameterImage<ComplexInt16VectorImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt32VectorImageType* Application::GetParameterImage<ComplexInt32VectorImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexFloatVectorImageType * Application::GetParameterImage< ComplexFloatVectorImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexDoubleVectorImageType * Application::GetParameterImage< ComplexDoubleVectorImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexFloatVectorImageType* Application::GetParameterImage<ComplexFloatVectorImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexDoubleVectorImageType* Application::GetParameterImage<ComplexDoubleVectorImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8RGBImageType * Application::GetParameterImage< UInt8RGBImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8RGBAImageType * Application::GetParameterImage< UInt8RGBAImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8RGBImageType* Application::GetParameterImage<UInt8RGBImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8RGBAImageType* Application::GetParameterImage<UInt8RGBAImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8ImageType * Application::GetParameterImage< UInt8ImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int16ImageType * Application::GetParameterImage< Int16ImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt16ImageType * Application::GetParameterImage< UInt16ImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int32ImageType * Application::GetParameterImage< Int32ImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt32ImageType * Application::GetParameterImage< UInt32ImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt8ImageType* Application::GetParameterImage<UInt8ImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int16ImageType* Application::GetParameterImage<Int16ImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt16ImageType* Application::GetParameterImage<UInt16ImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE Int32ImageType* Application::GetParameterImage<Int32ImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE UInt32ImageType* Application::GetParameterImage<UInt32ImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE FloatImageType * Application::GetParameterImage< FloatImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE DoubleImageType * Application::GetParameterImage< DoubleImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE FloatImageType* Application::GetParameterImage<FloatImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE DoubleImageType* Application::GetParameterImage<DoubleImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt16ImageType * Application::GetParameterImage< ComplexInt16ImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt32ImageType * Application::GetParameterImage< ComplexInt32ImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt16ImageType* Application::GetParameterImage<ComplexInt16ImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexInt32ImageType* Application::GetParameterImage<ComplexInt32ImageType>(std::string); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexFloatImageType * Application::GetParameterImage< ComplexFloatImageType >( std::string ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexDoubleImageType * Application::GetParameterImage< ComplexDoubleImageType >( std::string ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexFloatImageType* Application::GetParameterImage<ComplexFloatImageType>(std::string); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE ComplexDoubleImageType* Application::GetParameterImage<ComplexDoubleImageType>(std::string); // -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt8VectorImageType >( std::string, UInt8VectorImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< Int16VectorImageType >( std::string, Int16VectorImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt16VectorImageType >( std::string, UInt16VectorImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< Int32VectorImageType >( std::string, Int32VectorImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt32VectorImageType >( std::string, UInt32VectorImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt8VectorImageType>(std::string, UInt8VectorImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<Int16VectorImageType>(std::string, Int16VectorImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt16VectorImageType>(std::string, UInt16VectorImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<Int32VectorImageType>(std::string, Int32VectorImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt32VectorImageType>(std::string, UInt32VectorImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< FloatVectorImageType >( std::string, FloatVectorImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< DoubleVectorImageType >( std::string, DoubleVectorImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<FloatVectorImageType>(std::string, FloatVectorImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<DoubleVectorImageType>(std::string, DoubleVectorImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt16VectorImageType >( std::string, ComplexInt16VectorImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt32VectorImageType >( std::string, ComplexInt32VectorImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt16VectorImageType>(std::string, + ComplexInt16VectorImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt32VectorImageType>(std::string, + ComplexInt32VectorImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexFloatVectorImageType >( std::string, ComplexFloatVectorImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexDoubleVectorImageType >( std::string, ComplexDoubleVectorImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexFloatVectorImageType>(std::string, + ComplexFloatVectorImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexDoubleVectorImageType>(std::string, + ComplexDoubleVectorImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt8RGBImageType >( std::string, UInt8RGBImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt8RGBAImageType >( std::string, UInt8RGBAImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt8RGBImageType>(std::string, UInt8RGBImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt8RGBAImageType>(std::string, UInt8RGBAImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt8ImageType >( std::string, UInt8ImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< Int16ImageType >( std::string, Int16ImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt16ImageType >( std::string, UInt16ImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< Int32ImageType >( std::string, Int32ImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< UInt32ImageType >( std::string, UInt32ImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt8ImageType>(std::string, UInt8ImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<Int16ImageType>(std::string, Int16ImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt16ImageType>(std::string, UInt16ImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<Int32ImageType>(std::string, Int32ImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<UInt32ImageType>(std::string, UInt32ImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< FloatImageType >( std::string, FloatImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< DoubleImageType >( std::string, DoubleImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<FloatImageType>(std::string, FloatImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<DoubleImageType>(std::string, DoubleImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt16ImageType >( std::string, ComplexInt16ImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexInt32ImageType >( std::string, ComplexInt32ImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt16ImageType>(std::string, ComplexInt16ImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexInt32ImageType>(std::string, ComplexInt32ImageType*); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexFloatImageType >( std::string, ComplexFloatImageType * ); -template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage< ComplexDoubleImageType >( std::string, ComplexDoubleImageType * ); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexFloatImageType>(std::string, ComplexFloatImageType*); +template OTBApplicationEngine_EXPORT_EXPLICIT_TEMPLATE void Application::SetParameterOutputImage<ComplexDoubleImageType>(std::string, ComplexDoubleImageType*); void Application::SetName( const std::string & name ) @@ -536,8 +540,7 @@ Application::RegisterPipeline() if ( GetParameterType(key) == ParameterType_OutputImage ) { Parameter* param = GetParameterByKey(key); - OutputImageParameter * outP = - dynamic_cast< OutputImageParameter * >( param ); + OutputImageParameter* outP = dynamic_cast<OutputImageParameter*>(param); itk::ImageBase< 2 > * outData = outP->GetValue(); if ( outData ) dataStack.push(outData); @@ -545,8 +548,7 @@ Application::RegisterPipeline() else if ( GetParameterType(key) == ParameterType_OutputVectorData ) { Parameter* param = GetParameterByKey(key); - OutputVectorDataParameter * outP = - dynamic_cast< OutputVectorDataParameter * >( param ); + OutputVectorDataParameter* outP = dynamic_cast<OutputVectorDataParameter*>(param); VectorDataType * outData = outP->GetValue(); if ( outData ) dataStack.push(outData); @@ -554,8 +556,7 @@ Application::RegisterPipeline() else if ( GetParameterType(key) == ParameterType_InputImage ) { Parameter* param = GetParameterByKey(key); - InputImageParameter * inP = - dynamic_cast< InputImageParameter * >( param ); + InputImageParameter* inP = dynamic_cast<InputImageParameter*>(param); if ( !inP->HasValue() ) continue; ImageBaseType * inData = inP->GetImage< ImageBaseType >(); @@ -565,13 +566,12 @@ Application::RegisterPipeline() else if ( GetParameterType(key) == ParameterType_InputImageList ) { Parameter * param = GetParameterByKey(key); - InputImageListParameter * inP = - dynamic_cast< InputImageListParameter * > ( param ); + InputImageListParameter* inP = dynamic_cast<InputImageListParameter*>(param); if ( !inP->HasValue() ) continue; const FloatVectorImageListType * list = inP->GetImageList(); - for ( auto it = list->Begin() ; it != list->End() ; ++it ) - { + for (auto it = list->Begin(); it != list->End(); ++it) + { FloatVectorImageType * inData = it.Get().GetPointer(); if ( inData && !inputData.count(inData) ) inputData.insert(inData); @@ -616,10 +616,9 @@ Application::RegisterPipeline() // if current is a list push every of its members in datastack if ( dynamic_cast< DataObjectListInterface *> (current) ) { - DataObjectListInterface * list = - dynamic_cast< DataObjectListInterface *> (current); - int length = list->Size(); - for ( int i = 0 ; i < length ; i++ ) + DataObjectListInterface* list = dynamic_cast<DataObjectListInterface*>(current); + int length = list->Size(); + for (int i = 0; i < length; i++) { itk::DataObject * newData = list->GetNthDataObject(i); if ( !current || inputData.count( current ) ) @@ -697,10 +696,9 @@ void Application::FreeRessources() // If input is a list if ( dynamic_cast< DataObjectListInterface *> (data.GetPointer()) ) { - DataObjectListInterface * list = - dynamic_cast< DataObjectListInterface *> (data.GetPointer()); - int length = list->Size(); - for ( int i = 0 ; i < length ; i++ ) + DataObjectListInterface* list = dynamic_cast<DataObjectListInterface*>(data.GetPointer()); + int length = list->Size(); + for (int i = 0; i < length; i++) { itk::DataObject * newData = list->GetNthDataObject(i); if ( !newData || dataSet.count( newData ) ) @@ -1656,7 +1654,7 @@ Application::SetParameterImageBase(const std::string & key, ImageBaseType* img, if (dynamic_cast<InputImageParameter*>(param)) { InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); - paramDown->SetImage( img ); + paramDown->SetImage(img); } else if (dynamic_cast<InputImageListParameter*>(param)) { diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx index 6a408f5f89..6959aba4ff 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx @@ -63,17 +63,13 @@ InputImageParameter::SetFromFileName(const std::string& filename) } -ImageBaseType * -InputImageParameter -::GetImage() +ImageBaseType* InputImageParameter ::GetImage() { return m_Image.GetPointer(); } -ImageBaseType const * -InputImageParameter -::GetImage() const +ImageBaseType const* InputImageParameter ::GetImage() const { return m_Image.GetPointer(); } @@ -93,12 +89,10 @@ otbGetImageMacro(UInt8RGBImage); otbGetImageMacro(UInt8RGBAImage); -void -InputImageParameter -::SetImage( ImageBaseType * image ) +void InputImageParameter ::SetImage(ImageBaseType* image) { m_UseFilename = false; - m_Image = image; + m_Image = image; } @@ -114,8 +108,8 @@ InputImageParameter { m_Image = nullptr; m_Reader = nullptr; - m_InputCaster = nullptr; - m_OutputCaster = nullptr; + m_InputCaster = nullptr; + m_OutputCaster = nullptr; m_FileName = ""; m_PreviousFileName=""; m_UseFilename = true; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx index bd1bdc4f86..39b36a355b 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx @@ -25,26 +25,26 @@ #include "otbWrapperCastImage.h" #ifdef OTB_USE_MPI -# include "otbMPIConfig.h" -# include "otbMPIVrtWriter.h" -# ifdef OTB_USE_SPTW -# include "otbSimpleParallelTiffWriter.h" -# endif +#include "otbMPIConfig.h" +#include "otbMPIVrtWriter.h" +#ifdef OTB_USE_SPTW +#include "otbSimpleParallelTiffWriter.h" +#endif #endif #include "itksys/SystemTools.hxx" -#define CAST_IMAGE_BASE( T, image_base ) \ - { \ - T * img = dynamic_cast< T * >( image_base ); \ - \ - if( img ) \ - { \ - SwitchInput< T >( img ); \ - \ - return; \ - } \ +#define CAST_IMAGE_BASE(T, image_base) \ + { \ + T* img = dynamic_cast<T*>(image_base); \ + \ + if (img) \ + { \ + SwitchInput<T>(img); \ + \ + return; \ + } \ } @@ -55,18 +55,15 @@ namespace Wrapper // Declare specialisation for UInt8RGBAImageType -template<> -void OutputImageParameter::SwitchInput(UInt8RGBAImageType * ); +template <> +void OutputImageParameter::SwitchInput(UInt8RGBAImageType*); // Declare specialisation for UInt8RGBImageType template <> -void OutputImageParameter::SwitchInput( UInt8RGBImageType * ); +void OutputImageParameter::SwitchInput(UInt8RGBImageType*); -OutputImageParameter::OutputImageParameter() - : m_PixelType(ImagePixelType_float), - m_DefaultPixelType(ImagePixelType_float), - m_RAMValue(0) +OutputImageParameter::OutputImageParameter() : m_PixelType(ImagePixelType_float), m_DefaultPixelType(ImagePixelType_float), m_RAMValue(0) { SetName("Output Image"); SetKey("out"); @@ -178,205 +175,192 @@ OutputImageParameter::ConvertStringToPixelType(const std::string &value, ImagePi } -void -OutputImageParameter -::InitializeWriters() +void OutputImageParameter ::InitializeWriters() { - ImageBaseType * image = m_Image.GetPointer(); + ImageBaseType* image = m_Image.GetPointer(); - CAST_IMAGE_BASE( UInt8VectorImageType, image ); - CAST_IMAGE_BASE( Int16VectorImageType, image ); - CAST_IMAGE_BASE( UInt16VectorImageType, image ); - CAST_IMAGE_BASE( Int32VectorImageType, image ); - CAST_IMAGE_BASE( UInt32VectorImageType, image ); + CAST_IMAGE_BASE(UInt8VectorImageType, image); + CAST_IMAGE_BASE(Int16VectorImageType, image); + CAST_IMAGE_BASE(UInt16VectorImageType, image); + CAST_IMAGE_BASE(Int32VectorImageType, image); + CAST_IMAGE_BASE(UInt32VectorImageType, image); - CAST_IMAGE_BASE( FloatVectorImageType, image ); - CAST_IMAGE_BASE( DoubleVectorImageType, image ); + CAST_IMAGE_BASE(FloatVectorImageType, image); + CAST_IMAGE_BASE(DoubleVectorImageType, image); - CAST_IMAGE_BASE( ComplexInt16VectorImageType, image ); - CAST_IMAGE_BASE( ComplexInt32VectorImageType, image ); - CAST_IMAGE_BASE( ComplexFloatVectorImageType, image ); - CAST_IMAGE_BASE( ComplexDoubleVectorImageType, image ); + CAST_IMAGE_BASE(ComplexInt16VectorImageType, image); + CAST_IMAGE_BASE(ComplexInt32VectorImageType, image); + CAST_IMAGE_BASE(ComplexFloatVectorImageType, image); + CAST_IMAGE_BASE(ComplexDoubleVectorImageType, image); - CAST_IMAGE_BASE( UInt8ImageType, image ); - CAST_IMAGE_BASE( Int16ImageType, image ); - CAST_IMAGE_BASE( UInt16ImageType, image ); - CAST_IMAGE_BASE( Int32ImageType, image ); - CAST_IMAGE_BASE( UInt32ImageType, image ); + CAST_IMAGE_BASE(UInt8ImageType, image); + CAST_IMAGE_BASE(Int16ImageType, image); + CAST_IMAGE_BASE(UInt16ImageType, image); + CAST_IMAGE_BASE(Int32ImageType, image); + CAST_IMAGE_BASE(UInt32ImageType, image); - CAST_IMAGE_BASE( FloatImageType, image ); - CAST_IMAGE_BASE( DoubleImageType, image ); + CAST_IMAGE_BASE(FloatImageType, image); + CAST_IMAGE_BASE(DoubleImageType, image); - CAST_IMAGE_BASE( ComplexInt16ImageType, image ); - CAST_IMAGE_BASE( ComplexInt32ImageType, image ); - CAST_IMAGE_BASE( ComplexFloatImageType, image ); - CAST_IMAGE_BASE( ComplexDoubleImageType, image ); + CAST_IMAGE_BASE(ComplexInt16ImageType, image); + CAST_IMAGE_BASE(ComplexInt32ImageType, image); + CAST_IMAGE_BASE(ComplexFloatImageType, image); + CAST_IMAGE_BASE(ComplexDoubleImageType, image); - CAST_IMAGE_BASE( UInt8RGBImageType, image ); - CAST_IMAGE_BASE( UInt8RGBAImageType, image ); + CAST_IMAGE_BASE(UInt8RGBImageType, image); + CAST_IMAGE_BASE(UInt8RGBAImageType, image); - itkExceptionMacro( "Unknown image-base type." ); + itkExceptionMacro("Unknown image-base type."); } -template< typename TOutputImage, - typename TInputImage > -void -OutputImageParameter -::ClampAndWriteVectorImage( TInputImage * in ) +template <typename TOutputImage, typename TInputImage> +void OutputImageParameter ::ClampAndWriteVectorImage(TInputImage* in) { - assert( in ); - assert( !m_FileName.empty() ); + assert(in); + assert(!m_FileName.empty()); // Use metaprogramming to choose optimized pipeline. - details::CastImage< TOutputImage, TInputImage > clamp( in ); + details::CastImage<TOutputImage, TInputImage> clamp(in); #ifdef OTB_USE_MPI otb::MPIConfig::Pointer mpiConfig = otb::MPIConfig::Instance(); - if( mpiConfig->GetNbProcs() > 1 ) - { - std::string extension = - itksys::SystemTools::GetFilenameExtension( m_FileName ); + if (mpiConfig->GetNbProcs() > 1) + { + std::string extension = itksys::SystemTools::GetFilenameExtension(m_FileName); - if(extension == ".vrt") - { + if (extension == ".vrt") + { // Use the MPIVrtWriter - auto vrtWriter = - otb::MPIVrtWriter< TOutputImage >::New(); + auto vrtWriter = otb::MPIVrtWriter<TOutputImage>::New(); - vrtWriter->SetInput( clamp.out ); - vrtWriter->SetFileName( m_FileName ); - vrtWriter->SetAvailableRAM( m_RAMValue); + vrtWriter->SetInput(clamp.out); + vrtWriter->SetFileName(m_FileName); + vrtWriter->SetAvailableRAM(m_RAMValue); // Change internal state only when everything has been setup // without raising exception. - m_InputCaster = clamp.icif; + m_InputCaster = clamp.icif; m_OutputCaster = clamp.ocif; m_Writer = vrtWriter; return; - } + } #ifdef OTB_USE_SPTW else if (extension == ".tif") - { + { // Use simple parallel tiff writer - auto sptWriter = - otb::SimpleParallelTiffWriter< TOutputImage >::New(); + auto sptWriter = otb::SimpleParallelTiffWriter<TOutputImage>::New(); - sptWriter->SetFileName( m_FileName ); - sptWriter->SetInput( clamp.out ); - sptWriter->GetStreamingManager()->SetDefaultRAM( m_RAMValue ); + sptWriter->SetFileName(m_FileName); + sptWriter->SetInput(clamp.out); + sptWriter->GetStreamingManager()->SetDefaultRAM(m_RAMValue); // Change internal state only when everything has been setup // without raising exception. - m_InputCaster = clamp.icif; + m_InputCaster = clamp.icif; m_OutputCaster = clamp.ocif; m_Writer = sptWriter; return; - } + } #endif // OTB_USE_SPTW else { - itkGenericExceptionMacro( - "File format " - << extension - << " not supported for parallel writing with MPI. Supported formats are " - ".vrt and .tif. Extended filenames are not supported." - ); + itkGenericExceptionMacro("File format " << extension + << " not supported for parallel writing with MPI. Supported formats are " + ".vrt and .tif. Extended filenames are not supported."); } } #endif // OTB_USE_MPI - // - // Use default OTB writer. + // + // Use default OTB writer. - auto writer = otb::ImageFileWriter< TOutputImage >::New(); + auto writer = otb::ImageFileWriter<TOutputImage>::New(); - writer->SetFileName( m_FileName ); - writer->SetInput( clamp.out ); - writer->GetStreamingManager()->SetDefaultRAM( m_RAMValue ); + writer->SetFileName(m_FileName); + writer->SetInput(clamp.out); + writer->GetStreamingManager()->SetDefaultRAM(m_RAMValue); - // Change internal state only when everything has been setup - // without raising exception. + // Change internal state only when everything has been setup + // without raising exception. - m_InputCaster = clamp.icif; - m_OutputCaster = clamp.ocif; + m_InputCaster = clamp.icif; + m_OutputCaster = clamp.ocif; - m_Writer = writer; + m_Writer = writer; } -template< typename TInputImage > -void -OutputImageParameter -::SwitchInput( TInputImage * image ) +template <typename TInputImage> +void OutputImageParameter ::SwitchInput(TInputImage* image) { - assert( image ); + assert(image); - switch( m_PixelType ) - { - case ImagePixelType_uint8: - ClampAndWriteVectorImage< UInt8VectorImageType >( image ); - break; + switch (m_PixelType) + { + case ImagePixelType_uint8: + ClampAndWriteVectorImage<UInt8VectorImageType>(image); + break; - case ImagePixelType_int16: - ClampAndWriteVectorImage< Int16VectorImageType >( image ); - break; + case ImagePixelType_int16: + ClampAndWriteVectorImage<Int16VectorImageType>(image); + break; - case ImagePixelType_uint16: - ClampAndWriteVectorImage< UInt16VectorImageType >( image ); - break; + case ImagePixelType_uint16: + ClampAndWriteVectorImage<UInt16VectorImageType>(image); + break; - case ImagePixelType_int32: + case ImagePixelType_int32: - ClampAndWriteVectorImage< Int32VectorImageType >( image ); - break; + ClampAndWriteVectorImage<Int32VectorImageType>(image); + break; - case ImagePixelType_uint32: - ClampAndWriteVectorImage< UInt32VectorImageType >( image ); - break; + case ImagePixelType_uint32: + ClampAndWriteVectorImage<UInt32VectorImageType>(image); + break; - case ImagePixelType_float: - ClampAndWriteVectorImage< FloatVectorImageType >( image ); - break; + case ImagePixelType_float: + ClampAndWriteVectorImage<FloatVectorImageType>(image); + break; - case ImagePixelType_double: - ClampAndWriteVectorImage< DoubleVectorImageType >( image ); - break; + case ImagePixelType_double: + ClampAndWriteVectorImage<DoubleVectorImageType>(image); + break; - case ImagePixelType_cint16: - ClampAndWriteVectorImage < ComplexInt16VectorImageType >( image ); - break; + case ImagePixelType_cint16: + ClampAndWriteVectorImage<ComplexInt16VectorImageType>(image); + break; - case ImagePixelType_cint32: - ClampAndWriteVectorImage < ComplexInt32VectorImageType >( image ); - break; + case ImagePixelType_cint32: + ClampAndWriteVectorImage<ComplexInt32VectorImageType>(image); + break; - case ImagePixelType_cfloat: - ClampAndWriteVectorImage< ComplexFloatVectorImageType >( image ); + case ImagePixelType_cfloat: + ClampAndWriteVectorImage<ComplexFloatVectorImageType>(image); break; case ImagePixelType_cdouble: - ClampAndWriteVectorImage < ComplexDoubleVectorImageType >( image ); - break; + ClampAndWriteVectorImage<ComplexDoubleVectorImageType>(image); + break; default: - assert( false && "Unexpected image-type." ); + assert(false && "Unexpected image-type."); break; } } @@ -388,7 +372,7 @@ OutputImageParameter::Write() m_Writer->Update(); // Clean internal filters - m_InputCaster = nullptr; + m_InputCaster = nullptr; m_OutputCaster = nullptr; m_Writer = nullptr; @@ -414,9 +398,7 @@ OutputImageParameter::SetValue(ImageBaseType* image) SetActive(true); } -bool -OutputImageParameter -::HasValue() const +bool OutputImageParameter ::HasValue() const { return !m_FileName.empty(); } @@ -464,40 +446,35 @@ OutputImageParameter::CheckFileName(bool fixMissingExtension) // Specialization for UInt8RGBAImageType -template<> -void -OutputImageParameter -::SwitchInput( UInt8RGBAImageType * img ) +template <> +void OutputImageParameter ::SwitchInput(UInt8RGBAImageType* img) { - assert( img ); + assert(img); - if( m_PixelType != ImagePixelType_uint8 ) - itkExceptionMacro("Unknown PixelType for RGBA Image. Only uint8 is supported."); + if (m_PixelType != ImagePixelType_uint8) + itkExceptionMacro("Unknown PixelType for RGBA Image. Only uint8 is supported."); - auto writer = - otb::ImageFileWriter< UInt8RGBAImageType >::New(); + auto writer = otb::ImageFileWriter<UInt8RGBAImageType>::New(); - writer->SetFileName( GetFileName() ); - writer->SetInput( img ); - writer->GetStreamingManager()->SetDefaultRAM( m_RAMValue ); + writer->SetFileName(GetFileName()); + writer->SetInput(img); + writer->GetStreamingManager()->SetDefaultRAM(m_RAMValue); m_Writer = writer; } // Specialization for UInt8RGBImageType -template<> -void -OutputImageParameter -::SwitchInput( UInt8RGBImageType * img ) +template <> +void OutputImageParameter ::SwitchInput(UInt8RGBImageType* img) { - if( m_PixelType != ImagePixelType_uint8 ) + if (m_PixelType != ImagePixelType_uint8) itkExceptionMacro("Unknown PixelType for RGB Image. Only uint8 is supported."); - auto writer = otb::ImageFileWriter< UInt8RGBImageType >::New(); + auto writer = otb::ImageFileWriter<UInt8RGBImageType>::New(); - writer->SetFileName( GetFileName() ); - writer->SetInput( img ); - writer->GetStreamingManager()->SetDefaultRAM( m_RAMValue ); + writer->SetFileName(GetFileName()); + writer->SetInput(img); + writer->GetStreamingManager()->SetDefaultRAM(m_RAMValue); m_Writer = writer; } -- GitLab