From ab11c7e102973b8142f895674bd8d503527dd248 Mon Sep 17 00:00:00 2001 From: Antoine Regimbeau <antoine.regimbeau@c-s.fr> Date: Wed, 14 Feb 2018 14:33:27 +0100 Subject: [PATCH] REFAC: cleaning code --- .../otbWrapperInputImageParameterDouble.cxx | 35 ------ .../otbWrapperInputImageParameterFloat.cxx | 35 ------ .../otbWrapperInputImageParameterInt16.cxx | 35 ------ .../otbWrapperInputImageParameterInt32.cxx | 35 ------ .../src/otbWrapperInputImageParameterMacros.h | 18 --- .../otbWrapperInputImageParameterUInt16.cxx | 35 ------ .../otbWrapperInputImageParameterUInt32.cxx | 35 ------ .../otbWrapperInputImageParameterUInt8.cxx | 35 ------ .../otbWrapperOutputImageParameterTest.cxx | 108 +++++++++--------- 9 files changed, 54 insertions(+), 317 deletions(-) delete mode 100644 Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx delete mode 100644 Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx delete mode 100644 Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx delete mode 100644 Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx delete mode 100644 Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx delete mode 100644 Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx delete mode 100644 Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx deleted file mode 100644 index c0676eac9f..0000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterDouble.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * 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 - * - * 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 <vcl_deprecated_header.h> -#include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" -#include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" - -namespace otb -{ -namespace Wrapper -{ -otbGetImageMacro(DoubleImage); -otbGetImageMacro(DoubleVectorImage) -} -} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx deleted file mode 100644 index 07648108de..0000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterFloat.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * 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 - * - * 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 <vcl_deprecated_header.h> -#include "otbWrapperInputImageParameter.h" -#include "otbWrapperInputImageParameterMacros.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" -#include "otb_boost_string_header.h" - -namespace otb -{ -namespace Wrapper -{ -otbGetImageMacro(FloatImage); -otbGetImageMacro(FloatVectorImage) -} -} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx deleted file mode 100644 index 39c5ec5641..0000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt16.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * 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 - * - * 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 <vcl_deprecated_header.h> -#include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" -#include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" - -namespace otb -{ -namespace Wrapper -{ -otbGetImageMacro(Int16Image); -otbGetImageMacro(Int16VectorImage) -} -} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx deleted file mode 100644 index 29679a5e39..0000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterInt32.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * 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 - * - * 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 <vcl_deprecated_header.h> -#include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" -#include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" - -namespace otb -{ -namespace Wrapper -{ -otbGetImageMacro(Int32Image); -otbGetImageMacro(Int32VectorImage) -} -} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h index 3f3525af7a..2f1a7915b4 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterMacros.h @@ -33,22 +33,4 @@ otbGetImageMacro(type##VectorImage); -/* -#define otbCastImageMacro(InputImageType, OutputImageType, theMethod) \ - template<> OutputImageType * \ - InputImageParameter::CastImage<InputImageType , OutputImageType>() \ - { \ - return this->theMethod<InputImageType , OutputImageType>(); \ - } - -#define otbGenericCastImageMacro(InputImageType, theMethod, prefix) \ - otbCastImageMacro(InputImageType, UInt8##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, UInt16##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Int16##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, UInt32##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Int32##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Float##prefix##ImageType, theMethod) \ - otbCastImageMacro(InputImageType, Double##prefix##ImageType, theMethod) -*/ - #endif diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx deleted file mode 100644 index 23c64f3c7a..0000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt16.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * 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 - * - * 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 <vcl_deprecated_header.h> -#include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" -#include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" - -namespace otb -{ -namespace Wrapper -{ -otbGetImageMacro(UInt16Image); -otbGetImageMacro(UInt16VectorImage) -} -} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx deleted file mode 100644 index b4ae369742..0000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt32.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * 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 - * - * 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 <vcl_deprecated_header.h> -#include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" -#include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" - -namespace otb -{ -namespace Wrapper -{ -otbGetImageMacro(UInt32Image); -otbGetImageMacro(UInt32VectorImage) -} -} diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx deleted file mode 100644 index 19b9544d45..0000000000 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameterUInt8.cxx +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2005-2017 Centre National d'Etudes Spatiales (CNES) - * - * This file is part of Orfeo Toolbox - * - * https://www.orfeo-toolbox.org/ - * - * 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 - * - * 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 <vcl_deprecated_header.h> -#include "otbWrapperInputImageParameter.h" -#include "itksys/SystemTools.hxx" -#include "otbWrapperTypes.h" -#include "otbWrapperInputImageParameterMacros.h" -#include "otb_boost_string_header.h" - -namespace otb -{ -namespace Wrapper -{ -otbGetImageMacro(UInt8Image); -otbGetImageMacro(UInt8VectorImage) -} -} diff --git a/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx b/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx index 34cbb1d6f1..ea8899b8e0 100644 --- a/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx +++ b/Modules/Wrappers/ApplicationEngine/test/otbWrapperOutputImageParameterTest.cxx @@ -62,57 +62,57 @@ int otbWrapperOutputImageParameterTest1(int itkNotUsed(argc), char* argv[]) } -template < typename ImageType > -void Cross( int p , std::string inputfilename, std::string outputfilename) -{ - otb::Wrapper::InputImageParameter::Pointer paramIn ( - otb::Wrapper::InputImageParameter::New() ); - paramIn->SetFromFileName( inputfilename ); - otb::Wrapper::OutputImageParameter::Pointer paramOut( - otb::Wrapper::OutputImageParameter::New() ); - paramOut->SetFileName( outputfilename ); - paramOut->SetImage(paramIn->GetImage<ImageType>()); - paramOut->InitializeWriters(); - paramOut->SetPixelType(static_cast<otb::Wrapper::ImagePixelType>(p)); - paramOut->Write(); -} - - -int otbWrapperOutputImageParameterConversionTest(int , char* argv[]) -{ - std::string filenamein = argv[1]; - std::string filenameout = argv[2] ; - std::string extension = filenameout.substr( filenameout.find_last_of('.') ); - - filenameout = filenameout.substr( 0 , filenameout.find_last_of('.') ); - - for ( int i = otb::Wrapper::ImagePixelType_uint8 ; i < 11 ; i++ ) - { - std::string type = - otb::Wrapper::OutputImageParameter::ConvertPixelTypeToString( - static_cast<otb::Wrapper::ImagePixelType>(i) ); - Cross< otb::Wrapper::UInt8ImageType > (i , filenamein , filenameout+"_UInt8_"+ type + extension ) ; - Cross< otb::Wrapper::Int16ImageType > ( i , filenamein , filenameout+"_Int16_"+ type + extension ) ; - Cross< otb::Wrapper::UInt16ImageType > ( i , filenamein , filenameout+"_UInt16_"+ type + extension ) ; - Cross< otb::Wrapper::Int32ImageType > ( i , filenamein , filenameout+"_Int21_"+ type + extension ) ; - Cross< otb::Wrapper::UInt32ImageType > ( i , filenamein , filenameout+"_UInt32_"+ type + extension ) ; - Cross< otb::Wrapper::FloatImageType > ( i , filenamein , filenameout+"_float_"+ type + extension ) ; - Cross< otb::Wrapper::DoubleImageType > ( i , filenamein , filenameout+"_double_"+ type + extension ) ; - Cross< otb::Wrapper::UInt8VectorImageType > ( i , filenamein , filenameout+"_UInt8Vect_"+ type + extension ) ; - Cross< otb::Wrapper::Int16VectorImageType > ( i , filenamein , filenameout+"_Int16Vect_"+ type + extension ) ; - Cross< otb::Wrapper::UInt16VectorImageType > ( i , filenamein , filenameout+"_UInt16Vect_"+ type + extension ) ; - Cross< otb::Wrapper::Int32VectorImageType > ( i , filenamein , filenameout+"_Int21Vect_"+ type + extension ) ; - Cross< otb::Wrapper::UInt32VectorImageType > ( i , filenamein , filenameout+"_UInt32Vect_"+ type + extension ) ; - Cross< otb::Wrapper::FloatVectorImageType > ( i , filenamein , filenameout+"_floatVect_"+ type + extension ) ; - Cross< otb::Wrapper::DoubleVectorImageType > ( i , filenamein , filenameout+"_doubleVect_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexInt16ImageType > ( i , filenamein , filenameout+"_CInt16_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexInt32ImageType > ( i , filenamein , filenameout+"_CInt32_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexFloatImageType > ( i , filenamein , filenameout+"_Cfloat_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexDoubleImageType > ( i , filenamein , filenameout+"_Cdouble_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexInt16VectorImageType > ( i , filenamein , filenameout+"_CInt16Vect_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexInt32VectorImageType > ( i , filenamein , filenameout+"_CInt32Vect_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexFloatVectorImageType > ( i , filenamein , filenameout+"_CfloatVect_"+ type + extension ) ; - Cross< otb::Wrapper::ComplexDoubleVectorImageType > ( i , filenamein , filenameout+"_CdoubleVect_"+ type + extension ) ; - } - return 0; -} +// template < typename ImageType > +// void Cross( int p , std::string inputfilename, std::string outputfilename) +// { +// otb::Wrapper::InputImageParameter::Pointer paramIn ( +// otb::Wrapper::InputImageParameter::New() ); +// paramIn->SetFromFileName( inputfilename ); +// otb::Wrapper::OutputImageParameter::Pointer paramOut( +// otb::Wrapper::OutputImageParameter::New() ); +// paramOut->SetFileName( outputfilename ); +// paramOut->SetImage(paramIn->GetImage<ImageType>()); +// paramOut->InitializeWriters(); +// paramOut->SetPixelType(static_cast<otb::Wrapper::ImagePixelType>(p)); +// paramOut->Write(); +// } + + +// int otbWrapperOutputImageParameterConversionTest(int , char* argv[]) +// { +// std::string filenamein = argv[1]; +// std::string filenameout = argv[2] ; +// std::string extension = filenameout.substr( filenameout.find_last_of('.') ); + +// filenameout = filenameout.substr( 0 , filenameout.find_last_of('.') ); + +// for ( int i = otb::Wrapper::ImagePixelType_uint8 ; i < 11 ; i++ ) +// { +// std::string type = +// otb::Wrapper::OutputImageParameter::ConvertPixelTypeToString( +// static_cast<otb::Wrapper::ImagePixelType>(i) ); +// Cross< otb::Wrapper::UInt8ImageType > (i , filenamein , filenameout+"_UInt8_"+ type + extension ) ; +// Cross< otb::Wrapper::Int16ImageType > ( i , filenamein , filenameout+"_Int16_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt16ImageType > ( i , filenamein , filenameout+"_UInt16_"+ type + extension ) ; +// Cross< otb::Wrapper::Int32ImageType > ( i , filenamein , filenameout+"_Int21_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt32ImageType > ( i , filenamein , filenameout+"_UInt32_"+ type + extension ) ; +// Cross< otb::Wrapper::FloatImageType > ( i , filenamein , filenameout+"_float_"+ type + extension ) ; +// Cross< otb::Wrapper::DoubleImageType > ( i , filenamein , filenameout+"_double_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt8VectorImageType > ( i , filenamein , filenameout+"_UInt8Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::Int16VectorImageType > ( i , filenamein , filenameout+"_Int16Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt16VectorImageType > ( i , filenamein , filenameout+"_UInt16Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::Int32VectorImageType > ( i , filenamein , filenameout+"_Int21Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::UInt32VectorImageType > ( i , filenamein , filenameout+"_UInt32Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::FloatVectorImageType > ( i , filenamein , filenameout+"_floatVect_"+ type + extension ) ; +// Cross< otb::Wrapper::DoubleVectorImageType > ( i , filenamein , filenameout+"_doubleVect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt16ImageType > ( i , filenamein , filenameout+"_CInt16_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt32ImageType > ( i , filenamein , filenameout+"_CInt32_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexFloatImageType > ( i , filenamein , filenameout+"_Cfloat_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexDoubleImageType > ( i , filenamein , filenameout+"_Cdouble_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt16VectorImageType > ( i , filenamein , filenameout+"_CInt16Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexInt32VectorImageType > ( i , filenamein , filenameout+"_CInt32Vect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexFloatVectorImageType > ( i , filenamein , filenameout+"_CfloatVect_"+ type + extension ) ; +// Cross< otb::Wrapper::ComplexDoubleVectorImageType > ( i , filenamein , filenameout+"_CdoubleVect_"+ type + extension ) ; +// } +// return 0; +// } -- GitLab