diff --git a/Applications/Classification/CMakeLists.txt b/Applications/Classification/CMakeLists.txt index f4470df9a8c82317c41de54840f7aeec5a2c7100..69747da6d00b4b08675a0fd303630014fd4ca754 100644 --- a/Applications/Classification/CMakeLists.txt +++ b/Applications/Classification/CMakeLists.txt @@ -8,4 +8,4 @@ OTB_CREATE_APPLICATION(NAME ImageSVMClassifier OTB_CREATE_APPLICATION(NAME KMeansClassification SOURCES otbKMeansClassification.cxx - LINK_LIBRARIES OTBBasicFilters) + LINK_LIBRARIES OTBIO;OTBCommon;OTBBasicFilters;OTBFeatureExtraction;OTBLearning) diff --git a/Applications/Classification/otbImageSVMClassifier.cxx b/Applications/Classification/otbImageSVMClassifier.cxx index d464f22f91457ef9c2cd5285f01e2fd162ba5300..a54eae260860e880e78fdcddf749ba5522917f6c 100644 --- a/Applications/Classification/otbImageSVMClassifier.cxx +++ b/Applications/Classification/otbImageSVMClassifier.cxx @@ -62,9 +62,9 @@ public: // Cast filter // TODO: supress that !! - typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType, - UInt8ImageType::PixelType> ExtractImageFilterType; - typedef ImageToVectorImageCastFilter<UInt8ImageType, FloatVectorImageType> CastImageFilterType; + //typedef MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType, + // UInt8ImageType::PixelType> ExtractImageFilterType; +//typedef ImageToVectorImageCastFilter<UInt8ImageType, FloatVectorImageType> CastImageFilterType; private: ImageSVMClassifier() @@ -153,13 +153,9 @@ private: { otbAppLogINFO("Using input mask"); // Load mask image and cast into LabeledImageType - FloatVectorImageType::Pointer inMask = GetParameterImage("mask"); - m_Extract = ExtractImageFilterType::New(); - m_Extract->SetInput( inMask ); - m_Extract->SetChannel(1); - m_Extract->UpdateOutputInformation(); + UInt8ImageType::Pointer inMask = GetParameterUInt8Image("mask"); - m_ClassificationFilter->SetInputMask(m_Extract->GetOutput()); + m_ClassificationFilter->SetInputMask(inMask); } SetParameterOutputImage<UInt8ImageType>("out", m_ClassificationFilter->GetOutput()); @@ -168,7 +164,6 @@ private: ClassificationFilterType::Pointer m_ClassificationFilter; ModelPointerType m_ModelSVM; RescalerType::Pointer m_Rescaler; - ExtractImageFilterType::Pointer m_Extract; }; diff --git a/Applications/Classification/otbKMeansClassification.cxx b/Applications/Classification/otbKMeansClassification.cxx index 850b84b0bbdc86ac3f4d026749179fa6d3070764..0fccc4b1171ff190307605bdafd33981aa564da0 100644 --- a/Applications/Classification/otbKMeansClassification.cxx +++ b/Applications/Classification/otbKMeansClassification.cxx @@ -30,35 +30,28 @@ #include "itkWeightedCentroidKdTreeGenerator.h" #include "itkKdTreeBasedKmeansEstimator.h" #include "itkMersenneTwisterRandomVariateGenerator.h" -#include "itkCastImageFilter.h" -#include "otbMultiToMonoChannelExtractROI.h" namespace otb { namespace Wrapper { -typedef otb::Image<FloatVectorImageType::InternalPixelType, 2> ImageReaderType; - -typedef UInt8ImageType LabeledImageType; -typedef ImageReaderType::PixelType PixelType; +typedef FloatImageType::PixelType PixelType; typedef itk::FixedArray<PixelType, 108> SampleType; typedef itk::Statistics::ListSample<SampleType> ListSampleType; typedef itk::Statistics::WeightedCentroidKdTreeGenerator<ListSampleType> TreeGeneratorType; typedef TreeGeneratorType::KdTreeType TreeType; typedef itk::Statistics::KdTreeBasedKmeansEstimator<TreeType> EstimatorType; -typedef itk::CastImageFilter<FloatImageListType, FloatImageType> CastMaskFilterType; -typedef otb::MultiToMonoChannelExtractROI<FloatVectorImageType::InternalPixelType,LabeledImageType::InternalPixelType > ExtractorType; typedef otb::StreamingTraits<FloatVectorImageType> StreamingTraitsType; typedef itk::ImageRegionSplitter<2> SplitterType; -typedef ImageReaderType::RegionType RegionType; +typedef FloatImageType::RegionType RegionType; typedef itk::ImageRegionConstIterator<FloatVectorImageType> IteratorType; -typedef itk::ImageRegionConstIterator<LabeledImageType> LabeledIteratorType; +typedef itk::ImageRegionConstIterator<UInt8ImageType> LabeledIteratorType; -typedef otb::KMeansImageClassificationFilter<FloatVectorImageType, LabeledImageType, 108> ClassificationFilterType; +typedef otb::KMeansImageClassificationFilter<FloatVectorImageType, UInt8ImageType, 108> ClassificationFilterType; class KMeansClassification: public Application { @@ -116,12 +109,11 @@ private: itk::Statistics::MersenneTwisterRandomVariateGenerator::Pointer randomGen = itk::Statistics::MersenneTwisterRandomVariateGenerator::New(); m_InImage = GetParameterImage("in"); - m_Extractor = ExtractorType::New(); - m_Extractor->SetInput(GetParameterImage("vm")); - m_Extractor->SetChannel(1); - m_Extractor->UpdateOutputInformation(); - LabeledImageType::Pointer maskImage = m_Extractor->GetOutput(); + std::cout<<"mask in progress"<<std::endl; + + UInt8ImageType::Pointer maskImage = GetParameterUInt8Image("vm"); + std::cout<<"mask in progress done"<<std::endl; std::ostringstream message(""); const unsigned int nbsamples = GetParameterInt("ts"); @@ -331,11 +323,10 @@ private: m_Classifier->SetCentroids(estimator->GetParameters()); - SetParameterOutputImage<LabeledImageType> ("out", m_Classifier->GetOutput()); + SetParameterOutputImage<UInt8ImageType> ("out", m_Classifier->GetOutput()); } - ExtractorType::Pointer m_Extractor; ClassificationFilterType::Pointer m_Classifier; FloatVectorImageType::Pointer m_InImage; diff --git a/Applications/FeatureExtraction/otbLineSegmentDetection.cxx b/Applications/FeatureExtraction/otbLineSegmentDetection.cxx index 6467b754f9d999e0a60c9c0b884d4db5b180492b..b7a064e721e90b0c05615f417aba723b002d4011 100644 --- a/Applications/FeatureExtraction/otbLineSegmentDetection.cxx +++ b/Applications/FeatureExtraction/otbLineSegmentDetection.cxx @@ -20,13 +20,8 @@ #include "otbStreamingLineSegmentDetector.h" -#include "otbImage.h" -#include "otbVectorImage.h" #include "otbVectorImageToAmplitudeImageFilter.h" #include "otbVectorData.h" -#include "otbImageFileReader.h" -#include "otbVectorDataFileWriter.h" -#include "otbStandardFilterWatcher.h" #include "otbStreamingStatisticsImageFilter.h" #include "itkShiftScaleImageFilter.h" @@ -35,8 +30,6 @@ #include "itkAffineTransform.h" - - namespace otb { namespace Wrapper diff --git a/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx b/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx index ff70251c3316bf0670c252f18a82fd4f90c5def9..eb4623b06f49fbe08a46ac00dc2679d8c018bc48 100644 --- a/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx +++ b/Applications/Hyperspectral/otbHyperspectralUnmixing.cxx @@ -30,17 +30,12 @@ #include "otbVectorImageToMatrixImageFilter.h" -#include "itkCastImageFilter.h" - namespace otb { namespace Wrapper { -typedef itk::CastImageFilter<FloatVectorImageType, DoubleVectorImageType> FloatToDoubleFilterType; -typedef itk::CastImageFilter<DoubleVectorImageType, FloatVectorImageType> DoubleToFloatFilterType; - const unsigned int Dimension = 2; typedef otb::StreamingStatisticsVectorImageFilter<DoubleVectorImageType> StreamingStatisticsVectorImageFilterType; @@ -265,10 +260,7 @@ private: * */ - FloatToDoubleFilterType::Pointer cast = FloatToDoubleFilterType::New(); - cast->SetInput( GetParameterImage("in") ); - DoubleVectorImageType::Pointer inputImage = cast->GetOutput(); - m_ProcessObjects.push_back(cast.GetPointer()); + DoubleVectorImageType::Pointer inputImage = GetParameterImage<DoubleVectorImageType>("in"); DoubleVectorImageType::Pointer endmembersImage; if ( inputEndmembers.empty() ) @@ -332,11 +324,7 @@ private: * Read input endmembers */ std::cout << "Read Endmembers " << inputEndmembers << std::endl; - - FloatToDoubleFilterType::Pointer cast = FloatToDoubleFilterType::New(); - cast->SetInput( GetParameterImage("ie") ); - endmembersImage = cast->GetOutput(); - m_ProcessObjects.push_back(cast.GetPointer()); + endmembersImage = GetParameterImage<DoubleVectorImageType>("ie"); } // endmembersRef->Update(); @@ -430,12 +418,7 @@ private: */ std::cout << "Write endmembers " << outputEndmembers << std::endl; - DoubleToFloatFilterType::Pointer cast = DoubleToFloatFilterType::New(); - cast->SetInput( endmembersImage ); - FloatVectorImageType::Pointer endmembersImageFloat = cast->GetOutput(); - m_ProcessObjects.push_back(cast.GetPointer()); - - SetParameterOutputImage("oe", endmembersImageFloat); + SetParameterOutputImage<DoubleVectorImageType>("oe", endmembersImage); } if ( unmixingAlgo != UnMixingMethod_NONE ) @@ -444,12 +427,8 @@ private: * Write abundance map */ //std::cout << "Write abundance map" << outputImageName << std::endl; - DoubleToFloatFilterType::Pointer cast = DoubleToFloatFilterType::New(); - cast->SetInput( abundanceMap ); - FloatVectorImageType::Pointer abundanceMapFloat = cast->GetOutput(); - m_ProcessObjects.push_back(cast.GetPointer()); - SetParameterOutputImage("out", abundanceMapFloat); + SetParameterOutputImage<DoubleVectorImageType>("out", abundanceMap); } } diff --git a/Applications/Util/otbConvert.cxx b/Applications/Util/otbConvert.cxx index 37d1303d319fa0255762d829761642306f102c62..90a73618737030483452c642205abefc0f267782 100644 --- a/Applications/Util/otbConvert.cxx +++ b/Applications/Util/otbConvert.cxx @@ -117,8 +117,7 @@ private: void GenericDoExecute() { // Get the input image list - FloatVectorImageType::Pointer input = this->GetParameterImage("in"); - input->UpdateOutputInformation(); + typename TImageType::Pointer castIm; @@ -131,14 +130,13 @@ private: if( rescaleType == "None" ) { - typedef itk::CastImageFilter<FloatVectorImageType, TImageType> CastFilterType; - typename CastFilterType::Pointer cast = CastFilterType::New(); - cast->SetInput( input ); - m_TmpFilter = cast; - castIm = cast->GetOutput(); + castIm = this->GetParameterImage<TImageType>("in"); } else { + FloatVectorImageType::Pointer input = this->GetParameterImage("in"); + input->UpdateOutputInformation(); + const unsigned int nbComp(input->GetNumberOfComponentsPerPixel()); typedef otb::VectorRescaleIntensityImageFilter<FloatVectorImageType, TImageType> RescalerType; @@ -233,14 +231,8 @@ private: castIm = rescaler->GetOutput(); } - - typedef itk::CastImageFilter<TImageType, FloatVectorImageType> EndCastFilterType; - typename EndCastFilterType::Pointer endCast = EndCastFilterType::New(); - endCast->SetInput( castIm ); - endCast->UpdateOutputInformation(); - - m_FinalCaster = endCast; - SetParameterOutputImage("out", endCast->GetOutput()); + + SetParameterOutputImage<TImageType>("out", castIm); } @@ -278,7 +270,6 @@ private: } } - itk::ProcessObject::Pointer m_FinalCaster; itk::ProcessObject::Pointer m_TmpFilter; TransferLogType::Pointer m_TransferLog; };; diff --git a/Applications/Util/otbMultiResolutionPyramid.cxx b/Applications/Util/otbMultiResolutionPyramid.cxx index 3671cda391ca44c3cd2d9f25f0fabc9e77c03627..1efff57af1ad99f76c2c9c522c1adca546492dfb 100644 --- a/Applications/Util/otbMultiResolutionPyramid.cxx +++ b/Applications/Util/otbMultiResolutionPyramid.cxx @@ -18,8 +18,6 @@ #include "otbWrapperApplication.h" #include "otbWrapperApplicationFactory.h" -#include "otbImage.h" -#include "otbVectorImage.h" #include "otbPerBandVectorImageFilter.h" #include "itkDiscreteGaussianImageFilter.h" #include "itkShrinkImageFilter.h" @@ -53,9 +51,8 @@ public: itkTypeMacro(MultiResolutionPyramid, otb::Application); /** Image and filters typedef */ - typedef otb::Image<float> SingleImageType; - typedef itk::DiscreteGaussianImageFilter<SingleImageType, - SingleImageType> SmoothingImageFilterType; + typedef itk::DiscreteGaussianImageFilter<FloatImageType, + FloatImageType> SmoothingImageFilterType; typedef otb::PerBandVectorImageFilter<FloatVectorImageType, FloatVectorImageType, diff --git a/Code/ApplicationEngine/otbWrapperApplication.cxx b/Code/ApplicationEngine/otbWrapperApplication.cxx index 9e87af74fba4caf3d6325baad6b89cef523e0bd8..bb6deb868bf9eb36a9dc936dcc91aafefcbbfbf6 100644 --- a/Code/ApplicationEngine/otbWrapperApplication.cxx +++ b/Code/ApplicationEngine/otbWrapperApplication.cxx @@ -37,6 +37,8 @@ #include "otbWrapperAddProcessToWatchEvent.h" + +#include "otbWrapperTypes.h" namespace otb { namespace Wrapper diff --git a/Code/ApplicationEngine/otbWrapperApplication.h b/Code/ApplicationEngine/otbWrapperApplication.h index 17806a3b75f3d4732a7993a87a97038dfe5aacf9..7f8fa5c7ab563dcbcbf628c0328e4ed77ed70eb8 100644 --- a/Code/ApplicationEngine/otbWrapperApplication.h +++ b/Code/ApplicationEngine/otbWrapperApplication.h @@ -30,6 +30,7 @@ #include "otbWrapperMacros.h" #include "otbWrapperTypes.h" #include "otbWrapperOutputImageParameter.h" +#include "otbWrapperInputImageParameter.h" namespace otb { @@ -216,14 +217,6 @@ public: */ void SetParameterOutputImage(std::string parameter, FloatVectorImageType* value); - /* Set an output image value - * - * Can be called for types : - * \li ParameterType_OutputImage - */ - template <class TImageType> - void SetParameterOutputImage(std::string parameter, TImageType* value); - /* Set the pixel type in which the image will be saved * * Can be called for types : @@ -289,8 +282,45 @@ public: * Can be called for types : * \li ParameterType_InputImage */ - template <class TImageType> - TImageType* GetParameterImage(std::string parameter); +#define otbGetParameterImageMacro( Image ) \ + Image##Type * GetParameter##Image( std::string parameter ) \ + { \ + Image##Type::Pointer ret; \ + Parameter* param = GetParameterByKey(parameter); \ + if (dynamic_cast<InputImageParameter*>(param)) \ + { \ + InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); \ + ret = paramDown->Get##Image(); \ + } \ + return ret; \ + } + + otbGetParameterImageMacro(UInt8Image); + otbGetParameterImageMacro(Int8Image); + otbGetParameterImageMacro(UInt16Image); + otbGetParameterImageMacro(Int16Image); + otbGetParameterImageMacro(UInt32Image); + otbGetParameterImageMacro(Int32Image); + otbGetParameterImageMacro(FloatImage); + otbGetParameterImageMacro(DoubleImage); + + otbGetParameterImageMacro(UInt8VectorImage); + otbGetParameterImageMacro(Int8VectorImage); + otbGetParameterImageMacro(UInt16VectorImage); + otbGetParameterImageMacro(Int16VectorImage); + otbGetParameterImageMacro(UInt32VectorImage); + otbGetParameterImageMacro(Int32VectorImage); + otbGetParameterImageMacro(FloatVectorImage); + otbGetParameterImageMacro(DoubleVectorImage); + + otbGetParameterImageMacro(UInt8RGBAImage); + otbGetParameterImageMacro(Int8RGBAImage); + otbGetParameterImageMacro(UInt16RGBAImage); + otbGetParameterImageMacro(Int16RGBAImage); + otbGetParameterImageMacro(UInt32RGBAImage); + otbGetParameterImageMacro(Int32RGBAImage); + otbGetParameterImageMacro(FloatRGBAImage); + otbGetParameterImageMacro(DoubleRGBAImage); /* Get an image list value @@ -384,6 +414,43 @@ protected: /* Set the user level of access to a parameter */ void SetParameterUserLevel(std::string paramKey, UserLevel level); + /* Get an image value + * + * Can be called for types : + * \li ParameterType_InputImage + */ + template <class TImageType> + TImageType* GetParameterImage(std::string parameter) + { + typename TImageType::Pointer ret; + Parameter* param = GetParameterByKey(parameter); + if (dynamic_cast<InputImageParameter*>(param)) + { + InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); + ret = paramDown->GetImage<TImageType>(); + } + + //TODO: exception if not found ? + return ret; + } + + /* Set an output image value + * + * Can be called for types : + * \li ParameterType_OutputImage + */ + template <class TImageType> + void SetParameterOutputImage(std::string parameter, TImageType* value) + { + Parameter* param = GetParameterByKey(parameter); + + if (dynamic_cast<OutputImageParameter*>(param)) + { + OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param); + paramDown->SetValue(value); + } + } + private: /* Implement this method to add parameters */ virtual void DoCreateParameters() = 0; @@ -412,8 +479,8 @@ private: } //end namespace otb -#ifndef OTB_MANUAL_INSTANTIATION -#include "otbWrapperApplication.txx" -#endif +//#ifndef OTB_MANUAL_INSTANTIATION +//#include "otbWrapperApplication.txx" +//#endif #endif // __otbWrapperApplication_h_ diff --git a/Code/ApplicationEngine/otbWrapperApplication.txx b/Code/ApplicationEngine/otbWrapperApplication.txx deleted file mode 100644 index 12d21fb4efe040dcfaf56d4de87180d4fe8ff799..0000000000000000000000000000000000000000 --- a/Code/ApplicationEngine/otbWrapperApplication.txx +++ /dev/null @@ -1,59 +0,0 @@ -/*========================================================================= - - Program: ORFEO Toolbox - Language: C++ - Date: $Date$ - Version: $Revision$ - - - Copyright (c) Centre National d'Etudes Spatiales. All rights reserved. - See OTBCopyright.txt for details. - - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ -#include "otbWrapperApplication.h" - -#include "otbWrapperOutputImageParameter.h" -#include "otbWrapperInputImageParameter.h" -//#include "otbWrapperParameterGroup.h" - - -namespace otb -{ -namespace Wrapper -{ - -template <class TImageType> -void Application::SetParameterOutputImage(std::string parameter, TImageType* value) -{ - Parameter* param = GetParameterByKey(parameter); - - if (dynamic_cast<OutputImageParameter*>(param)) - { - OutputImageParameter* paramDown = dynamic_cast<OutputImageParameter*>(param); - paramDown->SetValue(value); - } -} - -template <class TImageType> -TImageType* Application::GetParameterImage(std::string parameter) -{ - typename TImageType::Pointer ret; - Parameter* param = GetParameterByKey(parameter); - - if (dynamic_cast<InputImageParameter*>(param)) - { - InputImageParameter* paramDown = dynamic_cast<InputImageParameter*>(param); - ret = paramDown->GetImage<TImageType>(); - } - - //TODO: exception if not found ? - return ret; -} - -} -} diff --git a/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx b/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx index a83d776ce4e0b200b9913442277f8f478a46c6b9..db38925881ed4e852ae76bd8394b4a8e89d703c6 100644 --- a/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx +++ b/Code/ApplicationEngine/otbWrapperInputImageParameter.cxx @@ -29,14 +29,10 @@ namespace Wrapper InputImageParameter::InputImageParameter() { - std::cout<<this<<" InputImageParameter::GetImage m_Image.IsNull() "<<m_Image.IsNull()<<std::endl; - this->SetName("Input Image"); this->SetKey("in"); m_FileName=""; this->ClearValue(); - std::cout<<this<<" InputImageParameter::GetImage m_Image.IsNull() "<<m_Image.IsNull()<<std::endl; - } InputImageParameter::~InputImageParameter() @@ -46,7 +42,6 @@ InputImageParameter::~InputImageParameter() void InputImageParameter::SetFromFileName(const std::string& filename) { - std::cout<<this<<" InputImageParameter::SetFromFileName"<<std::endl; // First clear previous file choosen this->ClearValue(); @@ -72,23 +67,53 @@ InputImageParameter::SetFromFileName(const std::string& filename) } + FloatVectorImageType* InputImageParameter::GetImage() { - std::cout<<this<<" GetImage<FloatVectorImageType>"<<std::endl; return this->GetImage<FloatVectorImageType>(); } +#define otbGetImageMacro(image) \ + image##Type * \ + InputImageParameter::Get##image () \ + { \ + return this->GetImage< image##Type > (); \ + } + +otbGetImageMacro(UInt8Image) +otbGetImageMacro(Int8Image); +otbGetImageMacro(UInt16Image); +otbGetImageMacro(Int16Image); +otbGetImageMacro(UInt32Image); +otbGetImageMacro(Int32Image); +otbGetImageMacro(FloatImage); +otbGetImageMacro(DoubleImage); + +otbGetImageMacro(UInt8VectorImage); +otbGetImageMacro(Int8VectorImage); +otbGetImageMacro(UInt16VectorImage); +otbGetImageMacro(Int16VectorImage); +otbGetImageMacro(UInt32VectorImage); +otbGetImageMacro(Int32VectorImage); +otbGetImageMacro(FloatVectorImage); +otbGetImageMacro(DoubleVectorImage); + +otbGetImageMacro(UInt8RGBAImage); +otbGetImageMacro(Int8RGBAImage); +otbGetImageMacro(UInt16RGBAImage); +otbGetImageMacro(Int16RGBAImage); +otbGetImageMacro(UInt32RGBAImage); +otbGetImageMacro(Int32RGBAImage); +otbGetImageMacro(FloatRGBAImage); +otbGetImageMacro(DoubleRGBAImage); + + template <class TOutputImage> TOutputImage * InputImageParameter::GetImage() { - std::cout<<this<<" InputImageParameter::GetImage inside"<<std::endl; - std::cout<<this<<" InputImageParameter::GetImage m_FileName "<<m_FileName<<std::endl; - std::cout<<this<<" InputImageParameter::GetImage m_FileName.empty() "<<m_FileName.empty()<<std::endl; - std::cout<<this<<" InputImageParameter::GetImage m_Image.IsNull() "<<m_Image.IsNull()<<std::endl; - // 2 cases : the user set a filename vs. the user set an image //////////////////////// Filename case: if( !m_FileName.empty() ) @@ -107,14 +132,13 @@ InputImageParameter::GetImage() m_Image = reader->GetOutput(); m_Reader = reader; - + // Pay attention, don't return m_Image because it is a ImageBase... return reader->GetOutput(); } //////////////////////// Image case: else { - std::cout<<this<<" GetImage<FloatVectorImageType>"<<std::endl; if( m_Image.IsNull() ) { itkExceptionMacro("No input image or filename detected..."); @@ -224,7 +248,6 @@ InputImageParameter::GetImage() } } -std::cout<<this<<" InputImageParameter::GetImage outside"<<std::endl; } @@ -1644,8 +1667,7 @@ template <class TInputImage> void InputImageParameter::SetImage(TInputImage* image) { -std::cout<<this<<" InputImageParameter::SetImage"<<std::endl; - m_Image = image; + m_Image = image; } @@ -1661,7 +1683,6 @@ InputImageParameter::HasValue() const void InputImageParameter::ClearValue() { - std::cout<<this<<" InputImageParameter::ClearValue"<<std::endl; m_Image = NULL; m_Reader = NULL; m_Caster = NULL; diff --git a/Code/ApplicationEngine/otbWrapperInputImageParameter.h b/Code/ApplicationEngine/otbWrapperInputImageParameter.h index 93e386575bc16a08b53c04176df1ba993e0701d3..937ec74dadc04b1c7d8a7bb212e0c1f032d97fda 100644 --- a/Code/ApplicationEngine/otbWrapperInputImageParameter.h +++ b/Code/ApplicationEngine/otbWrapperInputImageParameter.h @@ -51,15 +51,42 @@ public: void SetFromFileName(const std::string& filename); itkGetConstMacro(FileName, std::string); - /** Get the input image as FloatVectorImageType */ + + /** Get the input image as FloatVectorImageType. */ FloatVectorImageType* GetImage(); - + + /** Get the input image as XXXImageType */ + UInt8ImageType* GetUInt8Image(); + Int8ImageType* GetInt8Image(); + UInt16ImageType* GetUInt16Image(); + Int16ImageType* GetInt16Image(); + UInt32ImageType* GetUInt32Image(); + Int32ImageType* GetInt32Image(); + FloatImageType* GetFloatImage(); + DoubleImageType* GetDoubleImage(); + + UInt8VectorImageType* GetUInt8VectorImage(); + Int8VectorImageType* GetInt8VectorImage(); + UInt16VectorImageType* GetUInt16VectorImage(); + Int16VectorImageType* GetInt16VectorImage(); + UInt32VectorImageType* GetUInt32VectorImage(); + Int32VectorImageType* GetInt32VectorImage(); + FloatVectorImageType* GetFloatVectorImage(); + DoubleVectorImageType* GetDoubleVectorImage(); + + UInt8RGBAImageType* GetUInt8RGBAImage(); + Int8RGBAImageType* GetInt8RGBAImage(); + UInt16RGBAImageType* GetUInt16RGBAImage(); + Int16RGBAImageType* GetInt16RGBAImage(); + UInt32RGBAImageType* GetUInt32RGBAImage(); + Int32RGBAImageType* GetInt32RGBAImage(); + FloatRGBAImageType* GetFloatRGBAImage(); + DoubleRGBAImageType* GetDoubleRGBAImage(); + /** Get the input image as templated image type. */ template <class TImageType> TImageType* GetImage(); - template <class TOutputImage> - TOutputImage* GetImage(unsigned int typeIn); /** Set a FloatVectorImageType image.*/ void SetImage(FloatVectorImageType* image); @@ -160,8 +187,8 @@ protected: RGBAFloatReaderType::Pointer m_RGBAFloatReader; RGBADoubleReaderType::Pointer m_RGBADoubleReader; */ - itk::ProcessObject * m_Reader; - itk::ProcessObject * m_Caster; + itk::ProcessObject::Pointer m_Reader; + itk::ProcessObject::Pointer m_Caster; private: InputImageParameter(const Parameter &); //purposely not implemented