diff --git a/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx b/Modules/Applications/AppClassification/app/otbPolygonClassStatistics.cxx index ff4f4b01e4be8c30476b4aef78dadaf9819e606f..4a35145462f48ac18220bafc08c5ab2998426f35 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 c3321c2bb57dcac0cd547b8d2356055cfeb7f9bc..c853f4863b75e799d10a1199098cffae48640792 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 3322351683809a6528d782ec6324527c73409e0b..44d54be96b09f488538771a820f73ffb7048df87 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 d67ae1c32692babe31986f77409955fbc102a4e5..fc492e17d8722f75117ebd22724e3f37f7354fa5 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 bbb564b02cc7b535e5d7c3cd88563531bb745203..2e4f9644bba448954ffa458622593cac7afa9f6c 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 84c67d05c946b0f45adea34c79681657f71bcd79..77e350402fa99e890d4c53f274b567ea99a83873 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 4eb2ec9388729eb7098640363a393064aee6e875..3bec599c720a7fbbfc72ecae5d44a537517a4826 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 6127e6b48db03cee0a946ddc15a9b8c1a0250eb9..096a7259605c8dc9adabe7c9c058fdd27490332d 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 edd3b267c9170a6151e5f4a53e6a6e08d4a8ce14..2fa39e599a1811ef98b7930931c37a5031e19cd9 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 0d95d4c6e972055086b2ea3fb4dc2a31f86814d6..f6123af5845fc49c321a84febdd28be828ee21bc 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 611d84a47a18efdb93a79085fa4a764968338ddf..4cb77bddec306437bccb05b45b81bdf71c9b9610 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 dc0cbc9b6fef35e3430891fb9cd08a7e4324aefd..dec0ab8b3e5ce3a834ee5a6dc9a247831d432f5b 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 826478711d24b2c9ab3ac7e75d4e8586354c8afb..41fe7808e9d84a0d0ae3017996e417ea0cd97c3a 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 033c58bc379fed6aba092e28e346b1d58ab35b84..d7d62e8c88cd6a779425feb92d5c9eeea7a71497 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 f1d830132a227162ceb539c3435fd8436b085de4..b20416b4d77617e0c23ea967603cbd910489ea5c 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 62b9338f300a306a20eb001bae57d0c07f447b15..b1472291f1ae216f302757ad00b69bfd161b3630 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 129e1e74ead27906516c18e7b8da61380fc8287c..3cf9114c81a09c5c329913a69971acb59389bfce 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 556a1f11cb850228a35b3401436b837dd0375852..e5b6ea2dcfce0a131cde7a56ad72188373e9ed49 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 55b614503572b93f896e7d1c93da93aae9dcd1f2..fd0c392b706d11977caa60031c601b046860210c 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 adf5faf96f91bd926eba62ab462cddcadd57756a..fb90702544a20191e1f5a474c0c7571cb48015aa 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 9367558dc00abca59b67aeb5e7a517611204da7b..69df972b304229ec3f38858bfbaab2bf2ff9a648 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 3c5adf6fe675c6a578f238f0cd94f7b2495ef912..fe226ef2ffbd7ccb6f588e3926642181c31819ea 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 37d91b86d0344c3c52df5e07264c8864809f1077..d0dd6678797767b6f50d61ba0a9667173d1a77e1 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 2018d29e92c7716215adc8274f9303dca5287e1f..319466cb4c49d21b321d55aa57ff0df847f56a53 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 17a6d631ba03d9d78c25383da7bf06a450be9884..5ccef4965304591a54437f5f75e1d4070bff360a 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 0e19743f40f34c7fb386f9e2eccfebd3b8224a4a..4c5bd8a93f43780e7d4827b260ae92e73ca9fde3 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 7b5caa5d0263529d606ecf87b7c774de3e25e953..cf70dc07b7bd8e50922a313f4bc6ff21ecaa973c 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 9e50a259148c84747ce362246a471b0ea922a407..5dd5b1b48203dfd471be3baf5800d76e657dbb0c 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 3a60401cd1802dfe8d3f493e42d9f4f935f6ebda..3f5c4605bf77da04611aa403ed553d6a121015a5 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 0f799d02a8e2eb5b49c53f68022dc8b3ce0ad611..ba8070ca0bdd637259fdc6ba9d76828320279c42 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 1a11aea5adea89eec38058cd9e2282f6995acefd..c8347b23d981365c4bde9dedb798dfde1f9561d7 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"); }