From ce236e90d2151ce1961917dffccb56698121f03f Mon Sep 17 00:00:00 2001 From: Antoine Regimbeau <antoine.regimbeau@c-s.fr> Date: Wed, 21 Feb 2018 14:42:43 +0100 Subject: [PATCH] REFAC: cleaning old trace --- .../app/otbPolygonClassStatistics.cxx | 28 +++- .../app/otbDomainTransform.cxx | 4 +- .../Applications/AppTest/app/CMakeLists.txt | 5 - Modules/Applications/AppTest/otb-module.cmake | 1 - .../Core/Common/src/otbFilterWatcherBase.cxx | 1 - .../src/otbStandardOneLineFilterWatcher.cxx | 3 - Modules/Core/ImageBase/include/otbImage.h | 8 +- Modules/Core/ImageBase/include/otbImage.txx | 6 - .../Core/ImageBase/include/otbVectorImage.h | 8 +- .../Core/ImageBase/include/otbVectorImage.txx | 5 - .../Core/ObjectList/include/otbImageList.h | 2 + .../Core/ObjectList/include/otbImageList.txx | 43 ++++-- .../otbPipelineMemoryPrintCalculator.h | 2 +- .../src/otbPipelineMemoryPrintCalculator.cxx | 16 ++- .../include/otbStatisticsXMLFileWriter.txx | 2 +- .../IO/ImageIO/include/otbImageFileWriter.txx | 2 - .../otbWrapperAddProcessToWatchEvent.h | 8 +- .../include/otbWrapperApplication.h | 5 - .../include/otbWrapperOutputImageParameter.h | 2 - .../otbWrapperOutputVectorDataParameter.h | 7 - .../src/otbWrapperApplication.cxx | 131 +----------------- .../src/otbWrapperInputImageParameter.cxx | 6 +- .../src/otbWrapperOutputImageParameter.cxx | 21 --- .../ApplicationEngine/test/CMakeLists.txt | 10 +- .../test/otbApplicationEngineTestDriver.cxx | 2 +- .../src/otbApplicationLauncherCommandLine.cxx | 45 ------ .../src/otbWrapperCommandLineLauncher.cxx | 4 +- .../QtWidget/include/itkQtProgressBar.h | 3 +- .../otbWrapperQtWidgetSimpleProgressReport.h | 1 - .../QtWidget/src/itkQtProgressBar.cxx | 20 --- ...otbWrapperQtWidgetSimpleProgressReport.cxx | 13 -- 31 files changed, 89 insertions(+), 325 deletions(-) diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index ff4f4b01e4..4a35145462 100644 --- a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx +++ b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx @@ -76,7 +76,7 @@ private: SetDocName("Polygon Class Statistics"); SetDocLongDescription("The application processes a set of geometries " "intended for training (they should have a field giving the associated " - "class). The geometries are analysed against a support image to compute " + "class). The geometries are analyzed against a support image to compute " "statistics : \n" " - number of samples per class\n" " - number of samples per geometry\n" @@ -92,17 +92,17 @@ private: AddDocTag(Tags::Learning); - AddParameter(ParameterType_InputImage, "in", "InputImage"); + AddParameter(ParameterType_InputImage, "in", "Input image"); SetParameterDescription("in", "Support image that will be classified"); - AddParameter(ParameterType_InputImage, "mask", "InputMask"); + AddParameter(ParameterType_InputImage, "mask", "Input validity mask"); SetParameterDescription("mask", "Validity mask (only pixels corresponding to a mask value greater than 0 will be used for statistics)"); MandatoryOff("mask"); AddParameter(ParameterType_InputFilename, "vec", "Input vectors"); - SetParameterDescription("vec","Input geometries to analyse"); + SetParameterDescription("vec","Input geometries to analyze"); - AddParameter(ParameterType_OutputFilename, "out", "Output Statistics"); + AddParameter(ParameterType_OutputFilename, "out", "Output XML statistics file"); SetParameterDescription("out","Output file to store statistics (XML format)"); AddParameter(ParameterType_ListView, "field", "Field Name"); @@ -155,6 +155,22 @@ private: } } } + + // Check that the extension of the output parameter is XML (mandatory for + // StatisticsXMLFileWriter) + // Check it here to trigger the error before polygons analysis + + if ( HasValue("out") ) + { + // Store filename extension + // Check that the right extension is given : expected .xml + const std::string extension = itksys::SystemTools::GetFilenameLastExtension(this->GetParameterString("out")); + + if (itksys::SystemTools::LowerCase(extension) != ".xml") + { + otbAppLogFATAL( << extension << " is a wrong extension for parameter \"out\": Expected .xml" ); + } + } } void DoExecute() ITK_OVERRIDE @@ -223,7 +239,7 @@ private: filter->SetLayerIndex(this->GetParameterInt("layer")); filter->GetStreamer()->SetAutomaticAdaptativeStreaming(GetParameterInt("ram")); - AddProcess(filter->GetStreamer(),"Analyse polygons..."); + AddProcess(filter->GetStreamer(),"Analyze polygons..."); filter->Update(); FilterType::ClassCountMapType &classCount = filter->GetClassCountOutput()->Get(); diff --git a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx index c3321c2bb5..c853f4863b 100644 --- a/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx +++ b/Modules/Applications/AppDomainTransform/app/otbDomainTransform.cxx @@ -277,7 +277,7 @@ private: //typedef itk::::ForwardFFTImageFilter over otbImage< InputPixelType > - typedef itk::ForwardFFTImageFilter < TInputImage, OutputImageType > FFTFilter; + typedef itk::ForwardFFTImageFilter < TInputImage, ComplexOutputImageType > FFTFilter; FFTFilter::Pointer fwdFilter = FFTFilter::New(); fwdFilter->SetInput( inImage ); @@ -286,7 +286,7 @@ private: typedef otb::VectorImage<OutputPixelType> TOutputImage; typedef otb::ComplexToVectorImageCastFilter< - OutputImageType, + ComplexOutputImageType, TOutputImage > ComplexToVectorImageCastFilter; ComplexToVectorImageCastFilter::Pointer unaryFunctorImageFilter = ComplexToVectorImageCastFilter::New(); diff --git a/Modules/Applications/AppTest/app/CMakeLists.txt b/Modules/Applications/AppTest/app/CMakeLists.txt index 3322351683..44d54be96b 100644 --- a/Modules/Applications/AppTest/app/CMakeLists.txt +++ b/Modules/Applications/AppTest/app/CMakeLists.txt @@ -22,8 +22,3 @@ otb_create_application( NAME TestApplication SOURCES otbTestApplication.cxx LINK_LIBRARIES ${${otb-module}_LIBRARIES}) - -otb_create_application( - NAME MemoryTest - SOURCES otbMemoryTestApplication.cxx - LINK_LIBRARIES ${${otb-module}_LIBRARIES}) \ No newline at end of file diff --git a/Modules/Applications/AppTest/otb-module.cmake b/Modules/Applications/AppTest/otb-module.cmake index d67ae1c326..fc492e17d8 100644 --- a/Modules/Applications/AppTest/otb-module.cmake +++ b/Modules/Applications/AppTest/otb-module.cmake @@ -23,7 +23,6 @@ set(DOCUMENTATION "Test application.") otb_module(OTBAppTest DEPENDS OTBApplicationEngine - OTBImageBase TEST_DEPENDS OTBTestKernel OTBCommandLine diff --git a/Modules/Core/Common/src/otbFilterWatcherBase.cxx b/Modules/Core/Common/src/otbFilterWatcherBase.cxx index bbb564b02c..2e4f9644bb 100644 --- a/Modules/Core/Common/src/otbFilterWatcherBase.cxx +++ b/Modules/Core/Common/src/otbFilterWatcherBase.cxx @@ -159,7 +159,6 @@ FilterWatcherBase FilterWatcherBase ::~FilterWatcherBase() { - std::cout<<"A FilterWatcherBase is deleted... Description was "<<m_Comment<<std::endl; // Remove any observers we have on the old process object if (m_Process) { diff --git a/Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx b/Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx index 84c67d05c9..77e350402f 100644 --- a/Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx +++ b/Modules/Core/Common/src/otbStandardOneLineFilterWatcher.cxx @@ -29,7 +29,6 @@ StandardOneLineFilterWatcher : m_StarsCount(50), m_CurrentNbStars(-1) { - std::cout<<"A StandardOneLineFilterWatcher is created (default)"<<std::endl; } StandardOneLineFilterWatcher @@ -39,7 +38,6 @@ StandardOneLineFilterWatcher m_StarsCount(50), m_CurrentNbStars(-1) { - std::cout<<"A StandardOneLineFilterWatcher is created with description "<<comment<<std::endl; } StandardOneLineFilterWatcher @@ -49,7 +47,6 @@ StandardOneLineFilterWatcher m_StarsCount(50), m_CurrentNbStars(-1) { - std::cout<<"A StandardOneLineFilterWatcher is created with description "<<comment<<std::endl; } void diff --git a/Modules/Core/ImageBase/include/otbImage.h b/Modules/Core/ImageBase/include/otbImage.h index 4eb2ec9388..3bec599c72 100644 --- a/Modules/Core/ImageBase/include/otbImage.h +++ b/Modules/Core/ImageBase/include/otbImage.h @@ -179,7 +179,7 @@ public: // { // return AccessorType(); // } - static int m_Instance; + /** Return the NeighborhoodAccessor functor */ NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() { @@ -252,11 +252,7 @@ public: protected: Image(); - ~Image() ITK_OVERRIDE { - std::cout<<"An image is deleted"<<std::endl; - m_Instance--; - std::cout<<m_Instance<<" image(s) still live(s)"<<std::endl; - } + ~Image() ITK_OVERRIDE {} private: Image(const Self &) = delete; diff --git a/Modules/Core/ImageBase/include/otbImage.txx b/Modules/Core/ImageBase/include/otbImage.txx index 6127e6b48d..096a725960 100644 --- a/Modules/Core/ImageBase/include/otbImage.txx +++ b/Modules/Core/ImageBase/include/otbImage.txx @@ -29,15 +29,9 @@ namespace otb { -template <class TPixel, unsigned int VImageDimension> -int Image<TPixel, VImageDimension>::m_Instance = 0; - template <class TPixel, unsigned int VImageDimension> Image<TPixel, VImageDimension>::Image() { - std::cout<<"An image is created"<<std::endl; - m_Instance++; - std::cout<<m_Instance<<" image(s) live(s)"<<std::endl; } template <class TPixel, unsigned int VImageDimension> diff --git a/Modules/Core/ImageBase/include/otbVectorImage.h b/Modules/Core/ImageBase/include/otbVectorImage.h index edd3b267c9..2fa39e599a 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.h +++ b/Modules/Core/ImageBase/include/otbVectorImage.h @@ -179,7 +179,7 @@ public: // { // return AccessorType( this->GetNumberOfComponentsPerPixel() ); // } - static int m_Instance; + /** Return the NeighborhoodAccessor functor */ NeighborhoodAccessorFunctorType GetNeighborhoodAccessor() { @@ -194,11 +194,7 @@ public: protected: VectorImage(); - ~VectorImage() ITK_OVERRIDE { - std::cout<<"A vector image is deleted"<<std::endl; - m_Instance--; - std::cout<<m_Instance<<" vector image(s) still live(s)"<<std::endl; - } + ~VectorImage() ITK_OVERRIDE {} private: VectorImage(const Self &); //purposely not implemented diff --git a/Modules/Core/ImageBase/include/otbVectorImage.txx b/Modules/Core/ImageBase/include/otbVectorImage.txx index 0d95d4c6e9..f6123af584 100644 --- a/Modules/Core/ImageBase/include/otbVectorImage.txx +++ b/Modules/Core/ImageBase/include/otbVectorImage.txx @@ -29,15 +29,10 @@ namespace otb { -template <class TPixel, unsigned int VImageDimension> -int VectorImage<TPixel, VImageDimension>::m_Instance = 0; template <class TPixel, unsigned int VImageDimension> VectorImage<TPixel, VImageDimension>::VectorImage() { - std::cout<<"A vector image is created"<<std::endl; - m_Instance++; - std::cout<<m_Instance<<" vector image(s) live(s)"<<std::endl; } template <class TPixel, unsigned int VImageDimension> diff --git a/Modules/Core/ObjectList/include/otbImageList.h b/Modules/Core/ObjectList/include/otbImageList.h index 611d84a47a..4cb77bddec 100644 --- a/Modules/Core/ObjectList/include/otbImageList.h +++ b/Modules/Core/ObjectList/include/otbImageList.h @@ -68,6 +68,8 @@ public: throw (itk::InvalidRequestedRegionError) ITK_OVERRIDE; void UpdateOutputData(void) ITK_OVERRIDE; + void SetRequestedRegion(const itk::DataObject * source); + protected: /** Constructor */ ImageList() {}; diff --git a/Modules/Core/ObjectList/include/otbImageList.txx b/Modules/Core/ObjectList/include/otbImageList.txx index dc0cbc9b6f..dec0ab8b3e 100644 --- a/Modules/Core/ObjectList/include/otbImageList.txx +++ b/Modules/Core/ObjectList/include/otbImageList.txx @@ -39,10 +39,32 @@ ImageList<TImage> || it.Get()->GetDataReleased() || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion()) { + if(it.Get()->GetSource()) + { + it.Get()->GetSource()->UpdateOutputData(it.Get()); + } + } + } +} + +template <class TImage> +void +ImageList<TImage> +::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError) + { + Superclass::PropagateRequestedRegion(); + + for (ConstIterator it = this->Begin(); it != this->End(); ++it) + { + if (it.Get()->GetUpdateMTime() < it.Get()->GetPipelineMTime() + || it.Get()->GetDataReleased() + || it.Get()->RequestedRegionIsOutsideOfTheBufferedRegion()) + { + if (it.Get()->GetSource()) { it.Get()->GetSource()->PropagateRequestedRegion(it.Get()); - + // Check that the requested region lies within the largest possible region if (!it.Get()->VerifyRequestedRegion()) { @@ -51,23 +73,24 @@ ImageList<TImage> e.SetLocation(ITK_LOCATION); e.SetDataObject(it.Get()); e.SetDescription("Requested region is (at least partially) outside the largest possible region."); - + throw e; } - - it.Get()->GetSource()->UpdateOutputData(it.Get()); } } } -} + } -template <class TImage> +template<class TImage> void ImageList<TImage> -::PropagateRequestedRegion() throw (itk::InvalidRequestedRegionError) - { - Superclass::PropagateRequestedRegion(); - } +::SetRequestedRegion(const itk::DataObject * source) +{ + for (ConstIterator it = this->Begin(); it != this->End(); ++it) + { + it.Get()->SetRequestedRegion(source); + } +} template <class TImage> void diff --git a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h index 826478711d..41fe7808e9 100644 --- a/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h +++ b/Modules/Core/Streaming/include/otbPipelineMemoryPrintCalculator.h @@ -121,7 +121,7 @@ public: static const double MegabyteToByte; /** Evaluate the print (in bytes) of a single data object */ - MemoryPrintType EvaluateDataObjectPrint(DataObjectType * data) const; + MemoryPrintType EvaluateDataObjectPrint(DataObjectType * data); protected: /** Constructor */ diff --git a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx index 033c58bc37..d7d62e8c88 100644 --- a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx +++ b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx @@ -162,7 +162,7 @@ PipelineMemoryPrintCalculator PipelineMemoryPrintCalculator::MemoryPrintType PipelineMemoryPrintCalculator -::EvaluateDataObjectPrint(DataObjectType * data) const +::EvaluateDataObjectPrint(DataObjectType * data) { otbMsgDevMacro(<< "EvaluateMemoryPrint for " << data->GetNameOfClass() << " (" << data << ")") @@ -183,11 +183,13 @@ PipelineMemoryPrintCalculator { \ ImageList<Image<type, 2> > * imageList = dynamic_cast<otb::ImageList<otb::Image<type, 2> > *>(data); \ MemoryPrintType print(0); \ - for(ImageList<Image<type, 2> >::ConstIterator it = imageList->Begin(); \ + for(ImageList<Image<type, 2> >::Iterator it = imageList->Begin(); \ it != imageList->End(); ++it) \ { \ - print += it.Get()->GetRequestedRegion().GetNumberOfPixels() \ - * it.Get()->GetNumberOfComponentsPerPixel() * sizeof(type); \ + if(it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource());\ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ } \ return print; \ } \ @@ -198,8 +200,10 @@ PipelineMemoryPrintCalculator for(ImageList<VectorImage<type, 2> >::ConstIterator it = imageList->Begin(); \ it != imageList->End(); ++it) \ { \ - print += it.Get()->GetRequestedRegion().GetNumberOfPixels() \ - * it.Get()->GetNumberOfComponentsPerPixel() * sizeof(type); \ + if(it.Get()->GetSource()) \ + print += this->EvaluateProcessObjectPrintRecursive(it.Get()->GetSource());\ + else \ + print += this->EvaluateDataObjectPrint(it.Get()); \ } \ return print; \ } \ diff --git a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx index f1d830132a..b20416b4d7 100644 --- a/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx +++ b/Modules/IO/IOXML/include/otbStatisticsXMLFileWriter.txx @@ -72,7 +72,7 @@ StatisticsXMLFileWriter<TMeasurementVector> itkExceptionMacro(<<"The XML output FileName is empty, please set the filename via the method SetFileName"); // Check that the right extension is given : expected .xml */ - std::string extension = itksys::SystemTools::GetFilenameLastExtension(m_FileName); + const std::string extension = itksys::SystemTools::GetFilenameLastExtension(m_FileName); if (itksys::SystemTools::LowerCase(extension) != ".xml") { itkExceptionMacro(<<extension diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.txx b/Modules/IO/ImageIO/include/otbImageFileWriter.txx index 62b9338f30..b1472291f1 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.txx +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.txx @@ -80,7 +80,6 @@ ImageFileWriter<TInputImage> this->SetAutomaticAdaptativeStreaming(); m_FilenameHelper = FNameHelperType::New(); - std::cout<<"A writer is created"<<std::endl; } /** @@ -90,7 +89,6 @@ template <class TInputImage> ImageFileWriter<TInputImage> ::~ImageFileWriter() { - std::cout<<"A writer is deleted"<<std::endl; } template <class TInputImage> diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h index 129e1e74ea..3cf9114c81 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperAddProcessToWatchEvent.h @@ -44,13 +44,9 @@ public: typedef AddProcessToWatchEvent Self; typedef itk::EventObject Superclass; - AddProcessToWatchEvent(){ - std::cout<<"A new AddProcessToWatchEvent is created"<<std::endl; - } + AddProcessToWatchEvent(){} AddProcessToWatchEvent(const Self& s) :itk::EventObject(s){}; - ~AddProcessToWatchEvent() ITK_OVERRIDE { - std::cout<<"The AddProcessToWatchEvent is deleted... Description was : "<<m_ProcessDescription<<std::endl; - } + ~AddProcessToWatchEvent() ITK_OVERRIDE {} /** Set/Get the process to watch */ virtual void SetProcess(itk::ProcessObject * process) diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index 556a1f11cb..e5b6ea2dcf 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -154,10 +154,6 @@ public: */ int ExecuteAndWriteOutput(); - /** Clear the pipeline and the various parameters that hold data - */ - virtual void ClearMemory(); - /* Get the internal application parameters * * WARNING: this method may disappear from the API */ @@ -849,7 +845,6 @@ public: } void RegisterPipeline(); - void ReleaseDataFromPipeline(); std::vector<itk::ProcessObject::Pointer> m_Filters; protected: diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h index 55b6145035..fd0c392b70 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputImageParameter.h @@ -113,8 +113,6 @@ public: std::string CheckFileName(bool fixMissingExtension = false); - void ClearValue() override; - protected: /** Constructor */ OutputImageParameter(); diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h index adf5faf96f..fb90702544 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperOutputVectorDataParameter.h @@ -107,13 +107,6 @@ public: m_Writer = otb::VectorDataFileWriter<VectorDataType>::New(); } - void ClearValue() override - { - m_Writer = nullptr; - m_VectorData = nullptr; - // m_FileName = ""; - Superclass::ClearValue(); - } protected: /** Constructor */ OutputVectorDataParameter() diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index 9367558dc0..69df972b30 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -485,72 +485,6 @@ int Application::Execute() return 0; } -void -Application::ReleaseDataFromPipeline() -{ - std::stack< itk::DataObject * > dataStack; - std::set< itk::DataObject * > dataSet; - std::vector<std::string> paramList = GetParametersKeys(true); - for (std::vector<std::string>::const_iterator it = paramList.begin(); - it != paramList.end(); - ++it) - { - std::string key = *it; - if ( GetParameterType(key) == ParameterType_OutputImage ) - { - Parameter* param = GetParameterByKey(key); - OutputImageParameter * outP = dynamic_cast<OutputImageParameter*>(param); - itk::ImageBase<2> * outData = outP->GetValue(); - std::cout<<"one image in output"<<std::endl; - dataSet.insert(outData); - } - else if ( GetParameterType(key) == ParameterType_OutputVectorData ) - { - Parameter* param = GetParameterByKey(key); - OutputVectorDataParameter * outP = dynamic_cast<OutputVectorDataParameter*>(param); - Wrapper::VectorDataType * outData = outP->GetValue(); - dataSet.insert(outData); - } - else - continue; - } - // DFS - std::stack< itk::ProcessObject * > processStack; - for ( auto data : dataSet ) - { - auto process = (data->GetSource()).GetPointer(); - if ( process != nullptr ) - processStack.push( process ); - } - - while ( !processStack.empty() ) - { - std::cout<<"one process is processed"<<std::endl; - itk::ProcessObject * current = processStack.top(); - std::cout<<"top"<<std::endl; - processStack.pop(); - std::cout<<"pop"<<std::endl; - std::cout<<current->GetNameOfClass()<<std::endl; - auto inputVector = current->GetInputs(); - for ( auto data : inputVector ) - { - if ( dataSet.find( data.GetPointer() ) != dataSet.end() && data != nullptr ) - continue; - std::cout<<"one data is stored"<<std::endl; - dataSet.insert( data.GetPointer() ); - itk::ProcessObject * process = data->GetSource().GetPointer(); - if ( process != nullptr ) - processStack.push( process ); - } - } - - for ( auto data : dataSet ) - { - std::cout<<"one bulk is freed"<<std::endl; - data->ReleaseData(); - } -} - int Application::ExecuteAndWriteOutput() { std::cout<<"Executing..."<<std::endl; @@ -665,73 +599,10 @@ int Application::ExecuteAndWriteOutput() this->AfterExecuteAndWriteOutputs(); m_Chrono.Stop(); - ReleaseDataFromPipeline(); - ClearMemory(); + return status; } -void Application::ClearMemory() -{ - // Cleaning the parameter input and output - std::vector<std::string> paramList = GetParametersKeys(true); - std::string filename (""); - for (std::vector<std::string>::const_iterator it = paramList.begin(); - it != paramList.end(); - ++it) - { - std::string key = *it; - // if (GetParameterType(key) == ParameterType_InputImage ) - // { - // Parameter* param = GetParameterByKey(key); - // InputImageParameter * input = dynamic_cast<InputImageParameter*>(param); - // filename = input->GetFileName(); - // input->ClearValue(); - // input->SetFromFileName(filename); - // } - // else if (GetParameterType(key) == ParameterType_InputImageList ) - // { - // Parameter* param = GetParameterByKey(key); - // InputImageListParameter * input = dynamic_cast<InputImageListParameter*>(param); - // std::vector< std::string > filenamelist = input->GetFileNameList(); - // input->ClearValue(); - // input->SetListFromFileName(filenamelist); - // } - // else if (GetParameterType(key) == ParameterType_InputVectorData ) - // { - // Parameter* param = GetParameterByKey(key); - // InputVectorDataParameter * input = dynamic_cast<InputVectorDataParameter*>(param); - // filename = input->GetFileName(); - // input->ClearValue(); - // input->SetFromFileName(filename); - // } - // else if (GetParameterType(key) == ParameterType_InputVectorDataList ) - // { - // Parameter* param = GetParameterByKey(key); - // InputVectorDataListParameter * input = dynamic_cast<InputVectorDataListParameter*>(param); - // std::vector< std::string > filenamelist = input->GetFileNameList(); - // input->ClearValue(); - // input->SetListFromFileName(filenamelist); - // } - if (GetParameterType(key) == ParameterType_OutputImage ) - { - Parameter* param = GetParameterByKey(key); - OutputImageParameter * output = dynamic_cast<OutputImageParameter*>(param); - filename = output->GetFileName(); - output->ClearValue(); - output->SetFileName(filename); - } - else - { - continue; - } - } - - // Cleaning m_ProgressSource - // m_ProgressSource = nullptr; - - // Cleaning m_Filters - m_Filters.clear(); -} /* Enable the use of an optional parameter. Returns the previous state */ void Application::EnableParameter(std::string paramKey) { diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx index 3c5adf6fe6..fe226ef2ff 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperInputImageParameter.cxx @@ -104,9 +104,9 @@ void InputImageParameter ::ClearValue() { - m_Image = nullptr; - m_Reader = nullptr; - m_Caster = nullptr; + m_Image = ITK_NULLPTR; + m_Reader = ITK_NULLPTR; + m_Caster = ITK_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 37d91b86d0..d0dd667879 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperOutputImageParameter.cxx @@ -651,26 +651,5 @@ OutputImageParameter::CheckFileName(bool fixMissingExtension) return ret; } -void OutputImageParameter::ClearValue() -{ - m_Image = nullptr; - // m_FileName = ""; - - m_VectorUInt8Writer = nullptr; - m_VectorInt16Writer = nullptr; - m_VectorUInt16Writer = nullptr; - m_VectorInt32Writer = nullptr; - m_VectorUInt32Writer = nullptr; - m_VectorFloatWriter = nullptr; - m_VectorDoubleWriter = nullptr; - - m_RGBUInt8Writer = nullptr; - m_RGBAUInt8Writer = nullptr; - - // m_RAMValue = 0; - - Superclass::ClearValue(); -} - } } diff --git a/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt index 2018d29e92..319466cb4c 100644 --- a/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt +++ b/Modules/Wrappers/ApplicationEngine/test/CMakeLists.txt @@ -171,11 +171,11 @@ otb_add_test(NAME owTvOutputImageParameter COMMAND otbApplicationEngineTestDrive "my description" ) -otb_add_test(NAME owTvOutputImageParameterConversion COMMAND otbApplicationEngineTestDriver - otbWrapperOutputImageParameterConversionTest - ${INPUTDATA}/poupees.tif - ${TEMP}/poupees_out.tif - ) +#~ otb_add_test(NAME owTvOutputImageParameterConversion COMMAND otbApplicationEngineTestDriver + #~ otbWrapperOutputImageParameterConversionTest + #~ ${INPUTDATA}/poupees.tif + #~ ${TEMP}/poupees_out.tif + #~ ) otb_add_test(NAME owTvDocExampleStructureTest COMMAND otbApplicationEngineTestDriver --compare-ascii ${NOTOL} diff --git a/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx b/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx index 17a6d631ba..5ccef49653 100644 --- a/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx +++ b/Modules/Wrappers/ApplicationEngine/test/otbApplicationEngineTestDriver.cxx @@ -51,6 +51,6 @@ void RegisterTests() REGISTER_TEST(otbWrapperInputVectorDataParameterNew); REGISTER_TEST(otbWrapperOutputImageParameterNew); REGISTER_TEST(otbWrapperOutputImageParameterTest1); - REGISTER_TEST(otbWrapperOutputImageParameterConversionTest); + //~ REGISTER_TEST(otbWrapperOutputImageParameterConversionTest); REGISTER_TEST(otbApplicationMemoryConnectTest); } diff --git a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx index 0e19743f40..4c5bd8a93f 100644 --- a/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx +++ b/Modules/Wrappers/CommandLine/src/otbApplicationLauncherCommandLine.cxx @@ -22,7 +22,6 @@ #include "otbWrapperCommandLineLauncher.h" #include "otb_tinyxml.h" #include <vector> -#include <iostream> #ifdef OTB_USE_MPI #include "otbMPIConfig.h" @@ -305,53 +304,9 @@ int main(int argc, char* argv[]) ShowUsage(argv); return false; } - goto RUN; - RUN : - for (auto i : vexp) - std::cout<<i<<" "; - std::cout<<std::endl; bool success = launcher->Load(vexp) && launcher->ExecuteAndWriteOutput(); - - std::string answer; - std::cout<<"Rerun or run with other args? r : rerun ; s : small test ; b : big test ; else quit "<<std::endl; - std::cin >> answer; - if ( answer[0]=='r') - { - std::cout<<"again"<<std::endl; - goto RUN; - } - else if ( answer[0]=='s' ) - { - std::cout<<"Small test running"<<std::endl; - vexp[2] = "/home/antoine/dev/my_data/anaglyphInput2.tif"; - vexp[4] = "/home/antoine/dev/my_data/anaglyphOut.tif"; - goto RUN; - } - else if ( answer[0]=='b' ) - { - std::cout<<"Big test running"<<std::endl; - vexp[2] = "/home/antoine/dev/my_data/bigbigtestclassic.tif"; - vexp[4] = "/home/antoine/dev/my_data/bigbigtestclasssic.tif"; - goto RUN; - } - // else - // { - // vexp.clear(); - // for (int i = 1; i < argc; i++) - // { - // std::string strarg(answer[i]); - // std::string cleanArg = CleanWord(strarg); - // if (cleanArg.empty()) - // { - // // Empty argument ! - // continue; - // } - // vexp.push_back(cleanArg); - // } - // goto RUN; - // } // shutdown MPI after application finished #ifdef OTB_USE_MPI otb::MPIConfig::Instance()->terminate(); diff --git a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx index 7b5caa5d02..cf70dc07b7 100644 --- a/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx +++ b/Modules/Wrappers/CommandLine/src/otbWrapperCommandLineLauncher.cxx @@ -188,9 +188,7 @@ bool CommandLineLauncher::ExecuteAndWriteOutput() m_Application->GetLogger()->Fatal("Caught unknown exception during application execution.\n"); return false; } - - // Cleaning process - DeleteWatcherList(); + return true; } diff --git a/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h b/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h index 9e50a25914..5dd5b1b482 100644 --- a/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h +++ b/Modules/Wrappers/QtWidget/include/itkQtProgressBar.h @@ -52,11 +52,10 @@ public: void ProcessEvent(itk::Object * caller, const itk::EventObject & event ); void ConstProcessEvent(const itk::Object * caller, const itk::EventObject & event ); + /** Manage a Progress event */ void Observe( itk::Object *caller ); - void ClearObserver(); - signals: void SetValueChanged(int); diff --git a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h index 3a60401cd1..3f5c4605bf 100644 --- a/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h +++ b/Modules/Wrappers/QtWidget/include/otbWrapperQtWidgetSimpleProgressReport.h @@ -61,7 +61,6 @@ public slots: void AddNewProcessToReport(); private: - void ClearEvent(); QtWidgetSimpleProgressReport(const QtWidgetSimpleProgressReport&); //purposely not implemented void operator=(const QtWidgetSimpleProgressReport&); //purposely not //implemented diff --git a/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx b/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx index 0f799d02a8..ba8070ca0b 100644 --- a/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx +++ b/Modules/Wrappers/QtWidget/src/itkQtProgressBar.cxx @@ -98,24 +98,4 @@ QtProgressBar::Observe( itk::Object *caller ) m_Caller->AddObserver( itk::ProgressEvent(), m_RedrawCommand.GetPointer() ); } -void -QtProgressBar::ClearObserver() -{ - if ( m_Caller->HasObserver(itk::ProgressEvent()) ) - { - unsigned int i(0); - while ( (m_Caller->GetCommand(i)) != (m_RedrawCommand.GetPointer()) ) - { - ++i; - if (i>10) - std::cout<<"ERROR"<<std::endl; - } - std::cout<<i<<std::endl; - m_Caller->RemoveObserver(i); - - } - m_Caller = nullptr; - // m_Caller->RemoveAllObservers(); -} - } // end namespace fltk diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx index 1a11aea5ad..c8347b23d9 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetSimpleProgressReport.cxx @@ -78,24 +78,12 @@ QtWidgetSimpleProgressReport::ProcessEvent( itk::Object * itkNotUsed(caller), if(eventToWatch) { m_CurrentProcess = eventToWatch->GetProcess(); - std::cout<<"process in the box : "<<m_CurrentProcess->GetNameOfClass()<<std::endl; m_CurrentDescription = eventToWatch->GetProcessDescription(); - std::cout<<"Description is : "<<m_CurrentDescription<<std::endl; emit AddNewProcessToReport(); } } } -void -QtWidgetSimpleProgressReport::ClearEvent() -{ - std::cout<<"Cleaning event"<<std::endl; - m_CurrentProcess = nullptr; - m_CurrentDescription = ""; - // emit AddNewProcessToReport(); - m_Bar->ClearObserver(); -} - void QtWidgetSimpleProgressReport::ReportProcess() { m_Bar->Observe(m_CurrentProcess); @@ -105,7 +93,6 @@ void QtWidgetSimpleProgressReport::ReportProcess() void QtWidgetSimpleProgressReport::Init() { - // ClearEvent(); m_Bar->setValue(0); m_Label->setText("No process"); } -- GitLab