diff --git a/CMakeLists.txt b/CMakeLists.txt index c5e1130921996b6eae49b4e01b1304fa4edda13a..dc4875285f1b32fc88dde006ea577391777444b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,10 +231,6 @@ mark_as_advanced(OTB_USE_DEPRECATED) option(OTB_USE_OPENMP "Add openmp compiler and linker flags" OFF) option(OTB_USE_SSE_FLAGS "Enable SIMD optimizations (hardware dependent)." ON) -#----------------------------------------------------------------------------- -# SHOW_ALL_MSG_DEBUG option -option(OTB_SHOW_ALL_MSG_DEBUG "Show all debug messages (very verbose)" OFF) -#mark_as_advanced(OTB_SHOW_ALL_MSG_DEBUG) include(OTBSetStandardCompilerFlags) #--------------------------------------------------------------- diff --git a/Documentation/Cookbook/rst/ExtendedFilenames.rst b/Documentation/Cookbook/rst/AdvancedUse.rst similarity index 87% rename from Documentation/Cookbook/rst/ExtendedFilenames.rst rename to Documentation/Cookbook/rst/AdvancedUse.rst index 02b5512351958d0b5ae88f1de831e9c5c2f823cc..604380e57a96fd41d45411e905f6380256f6c21c 100644 --- a/Documentation/Cookbook/rst/ExtendedFilenames.rst +++ b/Documentation/Cookbook/rst/AdvancedUse.rst @@ -1,7 +1,24 @@ -.. _extended-filenames: +Advanced Use +============ + +This section describes advanced configuration options and tricks. + +Environment variables that affects Orfeo ToolBox +------------------------------------------------ + +The following environment variables are parsed by Orfeo ToolBox. Note +that they only affect default values, and that settings in extended +filenames, applications, monteverdi or custom C++ code might override +those values. + +* ``OTB_DEM_DIRECTORY``: Default directory were DEM tiles are stored. It should only contain ```.hgt`` or or georeferenced ``.tif`` files. Empty if not set (no directory set) +* ``OTB_GEOID_FILE``: Default path to the geoid file that will be used to retrieve height of DEM above ellipsoid. Empty if not set (no geoid set) +* ``OTB_MAX_RAM_HINT``: Default maximum memory that OTB should use for processing, in MB. If not set, default value is 128 MB. +* ``OTB_LOGGER_LEVEL``: Default level of logging for OTB. Should be one of ``DEBUG``, ``INFO``, ``WARNING``, ``CRITICAL`` or ``FATAL``, by increasing order of priority. Only messages with a higher priority than the level of logging will be displayed. If not set, default level is ``INFO``. Extended filenames -================================ +------------------ +.. _extended-filenames: Extended filenames is an interesting feature of OTB. With it, you can control several aspects of the beahvior of the OTB in the OTB-Applications or in our @@ -42,7 +59,6 @@ applications from the bash command line.** Reader options ^^^^^^^^^^^^^^ - :: &geom=<path/filename.geom> diff --git a/Documentation/Cookbook/rst/index_TOC.rst b/Documentation/Cookbook/rst/index_TOC.rst index 12565d1577bd6a9211449e2c9e71b2cf0ca291e6..126fc8debfbd713cdd752205ee33f49ba9b60dfd 100644 --- a/Documentation/Cookbook/rst/index_TOC.rst +++ b/Documentation/Cookbook/rst/index_TOC.rst @@ -8,7 +8,7 @@ Table of Contents Installation OTB-Applications Monteverdi - ExtendedFilenames + AdvancedUse Recipes Applications FAQ diff --git a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx index 6063915cfb4996895de1371735454092f81368d7..0294d5f74408c9828958a2aab1b679d6c6ca1fe2 100644 --- a/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx +++ b/Modules/Adapters/OSSIMAdapters/src/otbImageKeywordlist.cxx @@ -241,8 +241,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) if (projection) { - otbMsgDevMacro(<< "OSSIM plugin projection instantiated ! "); - hasMetaData = projection->saveState(geom_kwl); otb_kwl.SetKeywordlist(geom_kwl); } @@ -257,7 +255,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) ->open(ossimFilename(filename.c_str()))); if (handler) { - otbMsgDevMacro(<< "OSSIM Open Image SUCCESS ! "); // Add ossimPlugins model ossimProjectionFactoryRegistry::instance()->registerFactory(ossimplugins::ossimPluginProjectionFactory::instance()); @@ -273,7 +270,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) // if the handler has found a sensor model, copy the tags found if (hasMetaData && dynamic_cast<ossimSensorModel const*>(projection)) { - otbMsgDevMacro(<<"OSSIM sensor projection instantiated ! "); otb_kwl.SetKeywordlist(geom_kwl); // geom_kwl.print(std::cout); } @@ -317,16 +313,6 @@ ReadGeometryFromImage(const std::string& filename, bool checkRpcTag) // which uses ossimSensorModelFactory and ossimPluginProjectionFactory internally, // thus by-passing the need for a valid ossimImageHandler. - if (!hasMetaData) - { - otbMsgDevMacro(<< "OSSIM MetaData not present ! "); - } - else - { - otbMsgDevMacro(<< "OSSIM MetaData present ! "); - //otbMsgDevMacro(<< geom_kwl); - } - return otb_kwl; } @@ -479,7 +465,6 @@ WriteGeometry(const ImageKeywordlist& otb_kwl, const std::string& filename) if (geom_kwl.getSize() > 0) { - otbMsgDevMacro(<< "Exporting keywordlist ..."); ossimFilename geomFileName(filename); geomFileName.setExtension(".geom"); geom_kwl.write(geomFileName.chars()); diff --git a/Modules/Core/Common/include/otbConfigurationManager.h b/Modules/Core/Common/include/otbConfigurationManager.h index 8c8f9af7ccd5ab93838100e780fe1546b0d66a7a..71e45fe72763231c649d559c687f2c8b7dafe0b8 100644 --- a/Modules/Core/Common/include/otbConfigurationManager.h +++ b/Modules/Core/Common/include/otbConfigurationManager.h @@ -31,7 +31,7 @@ #include <string> #include <boost/cstdint.hpp> - +#include "itkLoggerBase.h" #include "OTBCommonExport.h" namespace otb @@ -84,6 +84,27 @@ public: */ static RAMValueType GetMaxRAMHint(); + /** + * Logger level controls the level of logging that OTB will output. + * + * This is used to set-up the otb::Logger class. + * + * If OTB_LOGGER_LEVEL environment variable is set to one of DEBUG, + * INFO, WARNING, CRITICAL or FATAL, the logger level will be + * set accordingly. + * + * Priority is DEBUG < INFO < WARNING < CRITICAL < FATAL. + * + * Only messages with a higher priority than the logger level will + * be displayed. + * + * By default (if OTB_LOGGER_LEVEL is not set or can not be + * decoded), level is INFO. + * + */ + static itk::LoggerBase::PriorityLevelType GetLoggerLevel(); + + private: ConfigurationManager(); //purposely not implemented ~ConfigurationManager(); //purposely not implemented diff --git a/Modules/Wrappers/ApplicationEngine/include/otbLogger.h b/Modules/Core/Common/include/otbLogger.h similarity index 77% rename from Modules/Wrappers/ApplicationEngine/include/otbLogger.h rename to Modules/Core/Common/include/otbLogger.h index ba43072a199e2a1e29f481dc232022e457017389..3e69d173c0a9c75c0451919930fb3068b25b66e2 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbLogger.h +++ b/Modules/Core/Common/include/otbLogger.h @@ -23,6 +23,7 @@ #include "itkLoggerBase.h" #include "itkLogger.h" +#include "OTBCommonExport.h" namespace otb { @@ -31,9 +32,9 @@ namespace otb { * * Sets OTB wide settings in its constructor * - * \ingroup OTBApplicationEngine + * \ingroup OTBCommon */ -class Logger : public itk::Logger +class OTBCommon_EXPORT Logger : public itk::Logger { public: typedef Logger Self; @@ -41,15 +42,27 @@ public: typedef itk::SmartPointer< Self > Pointer; typedef itk::SmartPointer< const Self > ConstPointer; - itkTypeMacro(Logger, Object); - itkNewMacro(Self); + itkTypeMacro(Logger, itk::Logger); + + static Pointer Instance(); + itkNewMacro(Self); + // Overwrite this to provide custom formatting of log entries std::string BuildFormattedEntry(itk::Logger::PriorityLevelType, std::string const&) ITK_OVERRIDE; + void LogSetupInformation(); + protected: - Logger(); - virtual ~Logger(); + Logger(); + virtual ~Logger() ITK_OVERRIDE; + +private: + Logger(const Self &); //purposely not implemented + void operator =(const Self&); //purposely not implemented + + static Pointer CreateInstance(); + }; // class Logger } // namespace otb diff --git a/Modules/Core/Common/include/otbMacro.h b/Modules/Core/Common/include/otbMacro.h index 84a5ffc77372e6bc0f6500b0f0a1e14146cf68fe..6a248d4551a2f3f57220b4de62f3550a7dee5ad0 100644 --- a/Modules/Core/Common/include/otbMacro.h +++ b/Modules/Core/Common/include/otbMacro.h @@ -31,6 +31,7 @@ #include "itkMacro.h" #include "itkObject.h" #include "otbConfigure.h" +#include "otbLogger.h" /** * \namespace otb @@ -42,86 +43,31 @@ namespace otb { } // end namespace otb - this is here for documentation purposes -/** This macro is used to print debug (or other information). They are - * also used to catch errors, etc. Example usage looks like: - * itkDebugMacro(<< "this is debug info" << this->SomeVariable); */ -#define otbDebugMacro(x) itkDebugMacro(x) -/* { if ( this->GetDebug() && *::itk::Object::GetGlobalWarningDisplay()) \ - { std::ostringstream itkmsg; \ - itkmsg << "Debug: In " __FILE__ ", line " << __LINE__ << "\n" \ - << this->GetNameOfClass() << " (" << this << "): " x \ - << "\n\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); } \ -}*/ - -#define otbMsgDebugMacro(x) \ - { \ - if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << " Msg Debug: " x << "\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \ - } \ - } +#define otbFileContext(x) \ + << "file " __FILE__ ", line " << __LINE__<<", " x -#ifndef NDEBUG -#define otbGenericMsgDebugMacro(x) \ - { \ - if (::itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << " Generic Msg Debug: " x << "\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \ - } \ - } -#else -#define otbGenericMsgDebugMacro(x) -#endif +#define otbClassContext(x) \ + << this->GetNameOfClass() << " (" << this << "): " x -#define otbGenericMsgTestingMacro(x) \ - { \ - std::cout x << std::endl; \ - } +// Beware that to log to CRITICAL level, level should be passed as "Error" +#define otbLogMacro(level,msg) \ + { \ + std::ostringstream itkmsg; \ + itkmsg msg << "\n"; \ + otb::Logger::Instance()->level(itkmsg.str().c_str()); \ + } -#ifdef OTB_SHOW_ALL_MSG_DEBUG -#define otbMsgDevMacro(x) \ - { \ - { \ - std::ostringstream itkmsg; \ - itkmsg << " Msg Dev: (" << __FILE__ << ":" << __LINE__ << ") " x << "\n"; \ - ::itk::OutputWindowDisplayDebugText(itkmsg.str().c_str()); \ - } \ - } -#else -#define otbMsgDevMacro(x) -#endif - -/** This macro is used to print warning information (i.e., unusual circumstance - * but not necessarily fatal.) Example usage looks like: - * itkWarningMacro(<< "this is warning info" << this->SomeVariable); */ -#define otbWarningMacro(x) \ - { \ - if (itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << "\n" \ - << this->GetNameOfClass() << " (" << this << "): " x \ - << "\n\n"; \ - itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \ - } \ - } - -#define otbGenericWarningMacro(x) \ - { \ - if (itk::Object::GetGlobalWarningDisplay()) \ - { \ - std::ostringstream itkmsg; \ - itkmsg << "WARNING: In " __FILE__ ", line " << __LINE__ << ": " x <<"\n";\ - itk::OutputWindowDisplayWarningText(itkmsg.str().c_str()); \ - } \ - } +// Re-definition of old log macros to use the otbLogMacro +#define otbDebugMacro(x) otbLogMacro(Debug,otbFileContext(otbClassContext(x))) +#define otbMsgDebugMacro(x) otbLogMacro(Debug,otbFileContext(x)) +#define otbGenericMsgDebugMacro(x) otbLogMacro(Debug,x) +#define otbMsgDevMacro(x) otbLogMacro(Debug,otbFileContext(x)) +#define otbWarningMacro(x) otbLogMacro(Warning,otbFileContext(otbClassContext(x))) +#define otbGenericWarningMacro(x) otbLogMacro(Warning,otbFileContext(x)) +#define otbGenericMsgTestingMAcro(x) otbLogMacro(Info,"[testing] "<<x) + /** This macro is used to control condition. It use ONLY by the OTB developers * */ diff --git a/Modules/Core/Common/src/CMakeLists.txt b/Modules/Core/Common/src/CMakeLists.txt index 02ff6250e794704244acbe370fc7c562a13524c3..ce5d20761e59a5e57cf7f3b909317dc1c072f7aa 100644 --- a/Modules/Core/Common/src/CMakeLists.txt +++ b/Modules/Core/Common/src/CMakeLists.txt @@ -29,12 +29,12 @@ set(OTBCommon_SRC otbWriterWatcherBase.cxx otbStopwatch.cxx otbStringToHTML.cxx + otbLogger.cxx ) add_library(OTBCommon ${OTBCommon_SRC}) target_link_libraries(OTBCommon - ${OTBITK_LIBRARIES} - + ${OTBITK_LIBRARIES} ${OTBGDAL_LIBRARIES} ) otb_module_target(OTBCommon) diff --git a/Modules/Core/Common/src/otbConfigurationManager.cxx b/Modules/Core/Common/src/otbConfigurationManager.cxx index de0ea045799aaded54294a9eba4cbfe68598fd65..d12d1833620ebce22b3cb1615457f7ec87057031 100644 --- a/Modules/Core/Common/src/otbConfigurationManager.cxx +++ b/Modules/Core/Common/src/otbConfigurationManager.cxx @@ -20,9 +20,13 @@ #include "otbConfigurationManager.h" +#include "otbMacro.h" + #include "itksys/SystemTools.hxx" #include <cstdlib> +#include <algorithm> +#include <string> namespace otb { @@ -59,6 +63,39 @@ ConfigurationManager::RAMValueType ConfigurationManager::GetMaxRAMHint() } return value; +} + +itk::LoggerBase::PriorityLevelType ConfigurationManager::GetLoggerLevel() +{ + std::string svalue; + // Default value is INFO + itk::LoggerBase::PriorityLevelType level = itk::LoggerBase::INFO; + + if(itksys::SystemTools::GetEnv("OTB_LOGGER_LEVEL",svalue)) + { + if(svalue.compare("DEBUG") == 0) + { + level = itk::LoggerBase::DEBUG; + } + else if(svalue.compare("INFO") == 0) + { + level = itk::LoggerBase::INFO; + } + else if(svalue.compare("WARNING") == 0) + { + level = itk::LoggerBase::WARNING; + } + else if(svalue.compare("CRITICAL") == 0) + { + level = itk::LoggerBase::CRITICAL; + } + else + { + otbLogMacro(Error,<<"Unknown value for OTB_LOGGER_LEVEL_MACRO. Possible values are DEBUG, INFO, WARNING, CRITICAL."); + } + } + return level; } + } diff --git a/Modules/Core/Common/src/otbConfigure.h.in b/Modules/Core/Common/src/otbConfigure.h.in index 5194398344bab96a44eb4bb622fda9dc1bf0ae46..2146cf15bffa6fdb90e30c766a9f3f483263944e 100644 --- a/Modules/Core/Common/src/otbConfigure.h.in +++ b/Modules/Core/Common/src/otbConfigure.h.in @@ -27,9 +27,6 @@ #cmakedefine OTB_BUILD_SHARED_LIBS -/* Show developer debug messages */ -#cmakedefine OTB_SHOW_ALL_MSG_DEBUG - #cmakedefine OTB_USE_GDAL_20 #cmakedefine OTB_USE_OPENMP diff --git a/Modules/Wrappers/ApplicationEngine/src/otbLogger.cxx b/Modules/Core/Common/src/otbLogger.cxx similarity index 57% rename from Modules/Wrappers/ApplicationEngine/src/otbLogger.cxx rename to Modules/Core/Common/src/otbLogger.cxx index f7994eed4db3a1830b7fc2e1028bd23344c205eb..b3730cf445a5816ca693da32de7d2a71f3aaba37 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbLogger.cxx +++ b/Modules/Core/Common/src/otbLogger.cxx @@ -20,18 +20,42 @@ #include "otbLogger.h" #include "itksys/SystemTools.hxx" +#include "otbConfigurationManager.h" +#include "itkStdStreamLogOutput.h" +#include <iostream> +#include "gdal.h" +#include "itkMultiThreader.h" namespace otb { -Logger::Logger() : - itk::Logger::Logger() +Logger::Pointer Logger::CreateInstance() { -#if OTB_DEBUG - this->SetPriorityLevel(itk::LoggerBase::DEBUG); -#else - this->SetPriorityLevel(itk::LoggerBase::INFO); -#endif + Logger::Pointer instance = Logger::New(); + + // By default, redirect logs to std::cout + itk::StdStreamLogOutput::Pointer defaultOutput = itk::StdStreamLogOutput::New(); + defaultOutput->SetStream(std::cout); + + instance->AddLogOutput(defaultOutput); + + // Log setup information + instance->LogSetupInformation(); + + return instance; +} + +Logger::Pointer Logger::Instance() +{ + // Static locales are initialized once in a thread-safe way + static Logger::Pointer instance = CreateInstance(); + + return instance; +} + +Logger::Logger() +{ + this->SetPriorityLevel(otb::ConfigurationManager::GetLoggerLevel()); this->SetLevelForFlushing(itk::LoggerBase::CRITICAL); @@ -43,6 +67,26 @@ Logger::~Logger() { } +void Logger::LogSetupInformation() +{ + std::ostringstream oss; + + oss<<"Default RAM limit for OTB is "<<otb::ConfigurationManager::GetMaxRAMHint()<<" MB"<<std::endl; + this->Info(oss.str()); + oss.str(""); + oss.clear(); + + oss<<"GDAL maximum cache size is "<<GDALGetCacheMax64()/(1024*1024)<<" MB"<<std::endl; + this->Info(oss.str()); + oss.str(""); + oss.clear(); + + oss<<"OTB will use at most "<<itk::MultiThreader::GetGlobalDefaultNumberOfThreads()<<" threads"<<std::endl; + this->Info(oss.str()); + oss.str(""); + oss.clear(); +} + std::string Logger::BuildFormattedEntry(itk::Logger::PriorityLevelType level, std::string const & content) { static const std::string levelString[] = { "(MUSTFLUSH)", "(FATAL)", "(CRITICAL)", diff --git a/Modules/Core/ImageBase/include/otbExtractROIBase.txx b/Modules/Core/ImageBase/include/otbExtractROIBase.txx index 78f546387ffad9fd276030426eaf6abb1529480d..26108adf677fe834494606ae68f2d252778201ce 100644 --- a/Modules/Core/ImageBase/include/otbExtractROIBase.txx +++ b/Modules/Core/ImageBase/include/otbExtractROIBase.txx @@ -152,11 +152,6 @@ ExtractROIBase<TInputImage, TOutputImage> } requestedRegion.SetIndex(index); inputPtr->SetRequestedRegion(requestedRegion); - - otbMsgDevMacro(<< "InputRequestedRegion (otbExtractROIBase): "); - otbMsgDevMacro(<< " - index: " << requestedRegion.GetIndex()); - otbMsgDevMacro(<< " - size: " << requestedRegion.GetSize()); - } /** diff --git a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx index 07dcdbd82dbac30b545398f9e17f7af23bc38e53..743d5de28151ab5a78646e113ff5217b7b1296b1 100644 --- a/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbRAMDrivenAdaptativeStreamingManager.txx @@ -72,7 +72,7 @@ RAMDrivenAdaptativeStreamingManager<TImage>::PrepareStreaming( itk::DataObject * this->m_Splitter = splitter; this->m_ComputedNumberOfSplits = this->m_Splitter->GetNumberOfSplits(region, nbDivisions); - otbMsgDevMacro(<< "Number of split : " << this->m_ComputedNumberOfSplits) + this->m_Region = region; } diff --git a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx index b4fc50fbfacba49a145987ad00fdc73a6d80dd82..008b6c0eaafe7d39dfc3febf6889be7471d1cf0c 100644 --- a/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx +++ b/Modules/Core/Streaming/include/otbStreamingImageVirtualWriter.txx @@ -227,11 +227,11 @@ StreamingImageVirtualWriter<TInputImage> m_ObserverID = source->AddObserver(itk::ProgressEvent(), command); m_IsObserving = true; } - else - { - itkWarningMacro(<< "Could not get the source process object. Progress report might be buggy"); - } + const auto firstSplitSize = m_StreamingManager->GetSplit(0).GetSize(); + otbLogMacro(Info,<<"Estimation will be performed in "<<m_NumberOfDivisions<<" blocks of "<<firstSplitSize[0]<<"x"<<firstSplitSize[1]<<" pixels"); + + /** * Loop over the number of pieces, execute the upstream pipeline on each * piece, and copy the results into the output image. @@ -242,7 +242,6 @@ StreamingImageVirtualWriter<TInputImage> m_CurrentDivision++, m_DivisionProgress = 0, this->UpdateFilterProgress()) { streamRegion = m_StreamingManager->GetSplit(m_CurrentDivision); - otbMsgDevMacro(<< "Processing region : " << streamRegion ) //inputPtr->ReleaseData(); //inputPtr->SetRequestedRegion(streamRegion); //inputPtr->Update(); diff --git a/Modules/Core/Streaming/include/otbStreamingManager.txx b/Modules/Core/Streaming/include/otbStreamingManager.txx index b0fdfced068fffe79695afedc671b6f7d3d22d67..d30e3a2580195baf4dc0281fa7826af34e24e5cc 100644 --- a/Modules/Core/Streaming/include/otbStreamingManager.txx +++ b/Modules/Core/Streaming/include/otbStreamingManager.txx @@ -47,12 +47,9 @@ StreamingManager<TImage>::GetActualAvailableRAMInBytes(MemoryPrintType available if (availableRAMInBytes == 0) { - otbMsgDevMacro(<< "Retrieving available RAM size from configuration"); // Retrieve it from the configuration availableRAMInBytes = 1024*1024*ConfigurationManager::GetMaxRAMHint(); } - - otbMsgDevMacro("RAM used to estimate memory footprint : " << availableRAMInBytes / 1024 / 1024 << " MB") return availableRAMInBytes; } @@ -62,8 +59,6 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp MemoryPrintType availableRAM, double bias) { - otbMsgDevMacro(<< "availableRAM " << availableRAM) - MemoryPrintType availableRAMInBytes = GetActualAvailableRAMInBytes(availableRAM); otb::PipelineMemoryPrintCalculator::Pointer memoryPrintCalculator; @@ -103,7 +98,6 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp if (smallRegionSuccess) { - otbMsgDevMacro("Using an extract to estimate memory : " << smallRegion) // the region is well behaved, inside the largest possible region memoryPrintCalculator->SetDataToWrite(extractFilter->GetOutput() ); @@ -114,7 +108,6 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp } else { - otbMsgDevMacro("Using the input region to estimate memory : " << region) // the region is not well behaved // use the full region memoryPrintCalculator->SetDataToWrite(input); @@ -148,11 +141,8 @@ StreamingManager<TImage>::EstimateOptimalNumberOfDivisions(itk::DataObject * inp unsigned int optimalNumberOfDivisions = otb::PipelineMemoryPrintCalculator::EstimateOptimalNumberOfStreamDivisions(pipelineMemoryPrint, availableRAMInBytes); - otbMsgDevMacro( "Estimated Memory print for the full image : " - << static_cast<unsigned int>(pipelineMemoryPrint * otb::PipelineMemoryPrintCalculator::ByteToMegabyte ) << std::endl) - otbMsgDevMacro( "Optimal number of stream divisions: " - << optimalNumberOfDivisions << std::endl) - + otbLogMacro(Info,<<"Estimated memory for full processing: "<<pipelineMemoryPrint * otb::PipelineMemoryPrintCalculator::ByteToMegabyte<<"MB (avail.: "<<availableRAMInBytes * otb::PipelineMemoryPrintCalculator::ByteToMegabyte<<" NB), optimal image partitioning: "<<optimalNumberOfDivisions<<" blocks"); + return optimalNumberOfDivisions; } diff --git a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx index d7d62e8c88cd6a779425feb92d5c9eeea7a71497..403c9d38674047805593342aa9cd3363c23d29a8 100644 --- a/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx +++ b/Modules/Core/Streaming/src/otbPipelineMemoryPrintCalculator.cxx @@ -105,7 +105,7 @@ PipelineMemoryPrintCalculator::MemoryPrintType PipelineMemoryPrintCalculator ::EvaluateProcessObjectPrintRecursive(ProcessObjectType * process) { - otbMsgDevMacro(<< "EvaluateMemoryPrint for " << process->GetNameOfClass() << " (" << process << ")") + otbLogMacro(Debug,<<"Recursive evaluation of memory print for ProcessObject" << process->GetNameOfClass() << " (" << process << ")"); // This variable will store the final print MemoryPrintType print = 0; @@ -164,8 +164,9 @@ PipelineMemoryPrintCalculator::MemoryPrintType PipelineMemoryPrintCalculator ::EvaluateDataObjectPrint(DataObjectType * data) { - otbMsgDevMacro(<< "EvaluateMemoryPrint for " << data->GetNameOfClass() << " (" << data << ")") - + + otbLogMacro(Debug,<<"Evaluation of memory print for DataObject " << data->GetNameOfClass() << " (" << data << ")"); + #define OTB_IMAGE_SIZE_BLOCK(type) \ if(dynamic_cast<itk::Image<type, 2> *>(data) != NULL) \ { \ diff --git a/Modules/Feature/Descriptors/test/CMakeLists.txt b/Modules/Feature/Descriptors/test/CMakeLists.txt index 587685882e08c5adfec389e8d381de9cab0ea19d..6382e7b260145bece389dcc81ded8032f926bee1 100644 --- a/Modules/Feature/Descriptors/test/CMakeLists.txt +++ b/Modules/Feature/Descriptors/test/CMakeLists.txt @@ -263,9 +263,10 @@ otb_add_test(NAME feTvFourierMellinDescriptors COMMAND otbDescriptorsTestDriver ) otb_add_test(NAME feTvImageToSIFTKeyPointSetFilterDistanceMap COMMAND otbDescriptorsTestDriver - --compare-ascii ${EPSILON_3} + --compare-ascii ${EPSILON_3} ${BASELINE_FILES}/feTvImageToSIFTKeyPointSetFilterDistanceMap.txt ${TEMP}/feTvImageToSIFTKeyPointSetFilterDistanceMap.txt + --ignore-lines-with 2 INFO DEBUG otbImageToSIFTKeyPointSetFilterDistanceMap ${INPUTDATA}/scene.png 6 3 0.08 10.0 diff --git a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx index f4cfe1ecfd01f6360d084c486daa451c0c794896..4f55f67b2b7e26937c2874ce508dad414bd9edb2 100644 --- a/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx +++ b/Modules/IO/IOGDAL/src/otbGDALImageIO.cxx @@ -74,57 +74,6 @@ public: }; // end of GDALDataTypeWrapper -/* -template<class InputType> -void printOutputData(InputType *pData, int nbBands, int nbPixelToRead) -{ - for (unsigned int itPxl = 0; itPxl < (unsigned int) (nbPixelToRead * nbBands); itPxl++) - { - std::cout << "Buffer["<< itPxl << "] = " << *(pData + itPxl) << std::endl; - } -}; - -void printDataBuffer(unsigned char *pData, GDALDataType pxlType, int nbBands, int nbPixelToRead) -{ - if (pxlType == GDT_Int16) - { - printOutputData( static_cast<short*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_Int32) - { - printOutputData( static_cast<int*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_Float32) - { - printOutputData( static_cast<float*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_Float64) - { - printOutputData( static_cast<double*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CInt16) - { - printOutputData( static_cast<std::complex<short>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CInt32) - { - printOutputData( static_cast<std::complex<int>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CFloat32) - { - printOutputData( static_cast<std::complex<float>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else if (pxlType == GDT_CFloat64) - { - printOutputData( static_cast<std::complex<double>*>( static_cast<void*>(pData) ), nbBands, nbPixelToRead); - } - else - { - std::cerr << "Pixel type unknown" << std::endl; - } -}; -*/ - GDALImageIO::GDALImageIO() { // By default set number of dimensions to two. @@ -147,9 +96,6 @@ GDALImageIO::GDALImageIO() m_IsIndexed = false; m_DatasetNumber = 0; - //m_poBands = NULL; - //m_hDriver = NULL; - //m_poDataset = NULL; m_NbBands = 0; m_FlagWriteImageInformation = true; @@ -177,7 +123,6 @@ bool GDALImageIO::CanReadFile(const char* file) // First check the extension if (file == ITK_NULLPTR) { - itkDebugMacro(<< "No filename specified."); return false; } m_Dataset = GDALDriverManagerWrapper::GetInstance().Open(file); @@ -207,7 +152,7 @@ void GDALImageIO::Read(void* buffer) // Check if conversion succeed if (p == ITK_NULLPTR) { - itkExceptionMacro(<< "GDAL : Bad alloc"); + itkExceptionMacro(<< "Buffer passed to GDALImageIO for reading is NULL."); return; } @@ -219,15 +164,10 @@ void GDALImageIO::Read(void* buffer) int lNbLinesRegion = this->GetIORegion().GetSize()[1]; int lNbColumnsRegion = this->GetIORegion().GetSize()[0]; - //std::cout << "OriginBuffer= " << lFirstLineRegion << " x " << lFirstColumnRegion << std::endl; - //std::cout << "SizeBuffer= " << lNbLinesRegion << " x " << lNbColumnsRegion << std::endl; - // Compute the origin of the image region to read at the initial resolution int lFirstLine = lFirstLineRegion * (1 << m_ResolutionFactor); int lFirstColumn = lFirstColumnRegion * (1 << m_ResolutionFactor); - //std::cout << "OriginImage= " << lFirstLine << " x " << lFirstColumn << std::endl; - // Compute the size of the image region to read at the initial resolution int lNbLines = lNbLinesRegion * (1 << m_ResolutionFactor); int lNbColumns = lNbColumnsRegion * (1 << m_ResolutionFactor); @@ -238,103 +178,11 @@ void GDALImageIO::Read(void* buffer) if (lFirstColumn + lNbColumns > static_cast<int>(m_OriginalDimensions[0])) lNbColumns = static_cast<int>(m_OriginalDimensions[0]-lFirstColumn); - //std::cout << "SizeImage= " << lNbLines << " x " << lNbColumns << std::endl; - - GDALDataset* dataset = m_Dataset->GetDataSet(); - // This special case is due to the fact the CINT/CLONG types - // do not exists in ITK. In this case we only report the first band - // TODO This should be fixed - /*if (GDALDataTypeIsComplex(m_PxType->pixType) - && (m_PxType->pixType != GDT_CFloat32) - && (m_PxType->pixType != GDT_CFloat64)) - { - int pixelOffset = m_BytePerPixel * m_NbBands; - int lineOffset = m_BytePerPixel * m_NbBands * lNbColumns; - int bandOffset = m_BytePerPixel; - int nbBands = m_NbBands; - - int nbPixelToRead = lNbColumns * lNbLines; - std::streamoff nbBytes = static_cast<std::streamoff>(m_NbBands) * static_cast<std::streamoff>(nbPixelToRead) * static_cast<std::streamoff>(m_BytePerPixel); - unsigned char *pBufferTemp = new unsigned char[static_cast<unsigned int>(nbBytes)]; - - // keep it for the moment - otbMsgDevMacro(<< "Parameters RasterIO (case CInt and CShort):" - << "\n indX = " << lFirstColumn - << "\n indY = " << lFirstLine - << "\n sizeX = " << lNbColumns - << "\n sizeY = " << lNbLines - << "\n GDAL Data Type = " << GDALGetDataTypeName(m_PxType->pixType) - << "\n pixelOffset = " << pixelOffset - << "\n lineOffset = " << lineOffset - << "\n bandOffset = " << bandOffset); - - CPLErr lCrGdal = m_Dataset->GetDataSet()->RasterIO(GF_Read, - lFirstColumn, - lFirstLine, - lNbColumns, - lNbLines, - pBufferTemp, //p, // pData - lNbColumns, - lNbLines, - m_PxType->pixType, - nbBands, - // We want to read all bands - NULL, - pixelOffset, - lineOffset, - bandOffset); - // Check for gdal error - if (lCrGdal == CE_Failure) - { - itkExceptionMacro(<< "Error while reading image (GDAL format) " << m_FileName ); - delete[] pBufferTemp; - return; - } - //std::cout << "RAW BUFFER:" <<std::endl; - //printDataBuffer(pBufferTemp, m_PxType->pixType, m_NbBands, lNbColumns*lNbLines); - - // Convert the buffer to GDT_Float64 type - typedef std::complex<float> RealType; - typedef double ScalarRealType; - - if (m_PxType->pixType == GDT_CInt32) - { - //std::cout << "Convert input File from GDT_CInt32 to GDT_CFloat32" << std::endl; - typedef std::complex<int> ComplexIntType; - - for (unsigned int itPxl = 0; itPxl < (unsigned int) (nbPixelToRead * m_NbBands); itPxl++) - { - ComplexIntType pxlValue = *(static_cast<ComplexIntType*>( static_cast<void*>(pBufferTemp)) + itPxl ); - - RealType pxlValueReal( static_cast<ScalarRealType>(pxlValue.real()), static_cast<ScalarRealType>(pxlValue.imag()) ); - - memcpy((void*) (&(p[itPxl*sizeof(RealType)])), (const void*) (&(pxlValueReal)), (size_t) (sizeof(RealType))); - } - } - else if (m_PxType->pixType == GDT_CInt16) - { - //std::cout << "Convert input File from GDT_CInt16 to GDT_CFloat32" << std::endl; - typedef std::complex<short> ComplexShortType; - - for (unsigned int itPxl = 0; itPxl < (unsigned int) (nbPixelToRead * m_NbBands); itPxl++) - { - ComplexShortType pxlValue = *(static_cast<ComplexShortType*>( static_cast<void*>(pBufferTemp)) + itPxl ); - - RealType pxlValueReal( static_cast<ScalarRealType>(pxlValue.real()), static_cast<ScalarRealType>(pxlValue.imag()) ); - - memcpy((void*) (&(p[itPxl*sizeof(RealType)])), (const void*) (&(pxlValueReal)), (size_t) (sizeof(RealType))); - } - } - //std::cout << "CONVERTED BUFFER:" <<std::endl; - //printDataBuffer(p, GDT_CFloat64, m_NbBands, lNbColumns*lNbLines); - delete[] pBufferTemp; - } - // In the indexed case, one has to retrieve the index image and the // color table, and translate p to a 4 components color values buffer - else*/ if (m_IsIndexed) + if (m_IsIndexed) { // TODO: This is a very special case and seems to be working only // for unsigned char pixels. There might be a gdal method to do @@ -346,8 +194,9 @@ void GDALImageIO::Read(void* buffer) std::streamoff step = static_cast<std::streamoff>(this->GetNumberOfComponents()) * static_cast<std::streamoff>(m_BytePerPixel); - - CPLErr lCrGdal = dataset->GetRasterBand(1)->RasterIO(GF_Read, + otbLogMacro(Debug,<<"GDAL reads ["<<lFirstColumn<<", "<<lFirstColumn+lNbColumns-1<<"]x["<<lFirstLine<<", "<<lFirstLine+lNbLines-1<<"] indexed color image of type "<<GDALGetDataTypeName(m_PxType->pixType)<<" from file "<<m_FileName); + otb::Stopwatch chrono = otb::Stopwatch::StartNew(); + CPLErr lCrGdal = dataset->GetRasterBand(1)->RasterIO(GF_Read, lFirstColumn, lFirstLine, lNbColumns, @@ -358,11 +207,16 @@ void GDALImageIO::Read(void* buffer) m_PxType->pixType, 0, 0); - if (lCrGdal == CE_Failure) + chrono.Stop(); + + if (lCrGdal == CE_Failure) { itkExceptionMacro(<< "Error while reading image (GDAL format) '" << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); } + + otbLogMacro(Debug,<< "GDAL read took " << chrono.GetElapsedMilliseconds() << " ms") + // Interpret index as color std::streamoff cpt(0); GDALColorTable* colorTable = dataset->GetRasterBand(1)->GetColorTable(); @@ -394,19 +248,7 @@ void GDALImageIO::Read(void* buffer) } // keep it for the moment - //otbMsgDevMacro(<< "Number of bands inside input file: " << m_NbBands); - otbMsgDevMacro(<< "Parameters RasterIO : \n" - << " indX = " << lFirstColumn << "\n" - << " indY = " << lFirstLine << "\n" - << " sizeX = " << lNbColumns << "\n" - << " sizeY = " << lNbLines << "\n" - << " Buffer Size X = " << lNbColumnsRegion << "\n" - << " Buffer Size Y = " << lNbLinesRegion << "\n" - << " GDAL Data Type = " << GDALGetDataTypeName(m_PxType->pixType) << "\n" - << " nbBands = " << nbBands << "\n" - << " pixelOffset = " << pixelOffset << "\n" - << " lineOffset = " << lineOffset << "\n" - << " bandOffset = " << bandOffset ); + otbLogMacro(Debug,<<"GDAL reads ["<<lFirstColumn<<", "<<lFirstColumnRegion+lNbColumnsRegion-1<<"]x["<<lFirstLineRegion<<", "<<lFirstLineRegion+lNbLinesRegion-1<<"] x "<<nbBands<<" bands of type "<<GDALGetDataTypeName(m_PxType->pixType)<<" from file "<<m_FileName); otb::Stopwatch chrono = otb::Stopwatch::StartNew(); CPLErr lCrGdal = m_Dataset->GetDataSet()->RasterIO(GF_Read, @@ -425,8 +267,6 @@ void GDALImageIO::Read(void* buffer) lineOffset, bandOffset); chrono.Stop(); - otbMsgDevMacro(<< "RasterIO Read took " << chrono.GetElapsedMilliseconds() << " ms") - // Check if gdal call succeed if (lCrGdal == CE_Failure) { @@ -434,8 +274,10 @@ void GDALImageIO::Read(void* buffer) << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); return; } - //printDataBuffer(p, m_PxType->pixType, m_NbBands, lNbColumnsRegion*lNbLinesRegion); - } + + otbLogMacro(Debug,<< "GDAL read took " << chrono.GetElapsedMilliseconds() << " ms") + + } } bool GDALImageIO::GetSubDatasetInfo(std::vector<std::string> &names, std::vector<std::string> &desc) @@ -456,8 +298,6 @@ bool GDALImageIO::GetSubDatasetInfo(std::vector<std::string> &names, std::vector std::string key, name; if (System::ParseHdfSubsetName(papszMetadata[cpt], key, name)) { - otbMsgDevMacro(<< "- key: " << key); - otbMsgDevMacro(<< "- name: " << name); // check if this is a dataset name if (key.find("_NAME") != std::string::npos) names.push_back(name); // check if this is a dataset descriptor @@ -609,8 +449,6 @@ void GDALImageIO::InternalReadImageInformation() std::string key, name; if (System::ParseHdfSubsetName(papszMetadata[cpt], key, name)) { - otbMsgDevMacro(<< "- key: " << key); - otbMsgDevMacro(<< "- name: " << name); // check if this is a dataset name if (key.find("_NAME") != std::string::npos) names.push_back(name); } @@ -618,7 +456,6 @@ void GDALImageIO::InternalReadImageInformation() } if (m_DatasetNumber < names.size()) { - otbMsgDevMacro(<< "Reading: " << names[m_DatasetNumber]); m_Dataset = GDALDriverManagerWrapper::GetInstance().Open(names[m_DatasetNumber]); } else @@ -643,8 +480,6 @@ void GDALImageIO::InternalReadImageInformation() m_OriginalDimensions.push_back(dataset->GetRasterXSize()); m_OriginalDimensions.push_back(dataset->GetRasterYSize()); - otbMsgDevMacro(<< "Original Dimensions of the input file: " << m_OriginalDimensions[0] << " x " << m_OriginalDimensions[1]); - // Get Number of Bands m_NbBands = dataset->GetRasterCount(); @@ -661,21 +496,13 @@ void GDALImageIO::InternalReadImageInformation() /*std::cout << "Overviews size of input file" << m_FileName << ": " << m_OverviewsSize.back().first << " x " << m_OverviewsSize.back().second << std::endl; */ - otbMsgDevMacro( << "Overviews size of input file" << m_FileName << ": " - << m_OverviewsSize.back().first << " x " << m_OverviewsSize.back().second); } - otbMsgDevMacro(<< "Number of Overviews inside input file: " << m_NumberOfOverviews); - otbMsgDevMacro(<< "Input file dimension: " << m_Dimensions[0] << ", " << m_Dimensions[1]); - otbMsgDevMacro(<< "Number of bands inside input file: " << m_NbBands); - this->SetNumberOfComponents(m_NbBands); // Set the number of dimensions (verify for the dim ) this->SetNumberOfDimensions(2); - otbMsgDevMacro(<< "Nb of Dimensions of the input file: " << m_NumberOfDimensions); - // Automatically set the Type to Binary for GDAL data this->SetFileTypeToBinary(); @@ -683,7 +510,7 @@ void GDALImageIO::InternalReadImageInformation() // Consider only the data type given by the first band // Maybe be could changed (to check) m_PxType->pixType = dataset->GetRasterBand(1)->GetRasterDataType(); - otbMsgDevMacro(<< "PixelType inside input file: "<< GDALGetDataTypeName(m_PxType->pixType) ); + if (m_PxType->pixType == GDT_Byte) { SetComponentType(UCHAR); @@ -809,7 +636,7 @@ void GDALImageIO::InternalReadImageInformation() // we are reading a complex data set into an image where the pixel // type is Vector<real>: we have to double the number of component // for that to work - otbMsgDevMacro( << "GDALtypeIO= Complex and IFReader::InternalPixelType= Scalar and IFReader::PixelType= Vector"); + otbLogMacro(Warning,<<"Encoding of file ("<<m_FileName<<") is complex but will be read as a VectorImage of scalar type, with twice the number of bands."); this->SetNumberOfComponents(m_NbBands*2); this->SetPixelType(VECTOR); } @@ -831,12 +658,6 @@ void GDALImageIO::InternalReadImageInformation() } } - /*** Parameters set by Internal Read function ***/ - otbMsgDevMacro( << "Pixel Type IFReader = " << GetPixelTypeAsString(this->GetPixelType()) ) - otbMsgDevMacro( << "Number of component IFReader = " << this->GetNumberOfComponents() ) - otbMsgDevMacro( << "Byte per pixel set = " << m_BytePerPixel ) - otbMsgDevMacro( << "Component Type set = " << GetComponentTypeAsString(this->GetComponentType()) ); - /*----------------------------------------------------------------------*/ /*-------------------------- METADATA ----------------------------------*/ /*----------------------------------------------------------------------*/ @@ -854,8 +675,6 @@ void GDALImageIO::InternalReadImageInformation() if(blockSizeX > 0 && blockSizeY > 0) { - otbMsgDevMacro(<< "Original blockSize: "<< blockSizeX << " x " << blockSizeY ); - blockSizeX = uint_ceildivpow2(blockSizeX,m_ResolutionFactor); if (m_Dataset->IsJPEG2000()) { @@ -868,8 +687,6 @@ void GDALImageIO::InternalReadImageInformation() blockSizeY = blockSizeY * (1 << m_ResolutionFactor); } - otbMsgDevMacro(<< "Decimated blockSize: "<< blockSizeX << " x " << blockSizeY ); - itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::TileHintX, blockSizeX); itk::EncapsulateMetaData<unsigned int>(dict, MetaDataKey::TileHintY, blockSizeY); } @@ -948,7 +765,6 @@ void GDALImageIO::InternalReadImageInformation() } else { - otbMsgDevMacro( << "No projection => sensor model" ); // Special case for Jpeg2000 files : try to read the origin in the GML box if (m_Dataset->IsJPEG2000()) { @@ -1044,7 +860,7 @@ void GDALImageIO::InternalReadImageInformation() } else { - otbWarningMacro(<< "Incorrect geotransform (spacing = 0)!"); + otbLogMacro(Warning,<< "Geotransform reported by GDAL is invalid (spacing = 0)"); m_Spacing[0] = 1; m_Spacing[1] = 1; } @@ -1065,23 +881,6 @@ void GDALImageIO::InternalReadImageInformation() m_Origin[0] += 0.5*m_Spacing[0]; m_Origin[1] += 0.5*m_Spacing[1]; - // Dataset info - otbMsgDevMacro(<< "**** ReadImageInformation() DATASET INFO: ****" ); - otbMsgDevMacro(<< "Projection Ref: "<< dataset->GetProjectionRef() ); - double GT[6]; - if (dataset->GetGeoTransform(GT) == CE_None) - { - otbMsgDevMacro( <<"Geo Transform: "<< GT[0] << ", " << GT[1] << ", " - << GT[2] << ", " << GT[3] << ", " - << GT[4] << ", " << GT[5] ); - } - else - { - otbMsgDevMacro( << "No Geo Transform: "); - } - otbMsgDevMacro(<< "GCP Projection Ref: "<< dataset->GetGCPProjection() ); - otbMsgDevMacro(<< "GCP Count: " << dataset->GetGCPCount() ); - /* -------------------------------------------------------------------- */ /* Report metadata. */ /* -------------------------------------------------------------------- */ @@ -1289,7 +1088,6 @@ bool GDALImageIO::CanWriteFile(const char* name) // First check the filename if (name == ITK_NULLPTR) { - itkDebugMacro(<< "No filename specified."); return false; } @@ -1307,7 +1105,7 @@ bool GDALImageIO::CanWriteFile(const char* name) if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, ITK_NULLPTR ) == ITK_NULLPTR && GDALGetMetadataItem( driver, GDAL_DCAP_CREATECOPY, ITK_NULLPTR ) == ITK_NULLPTR ) { - itkDebugMacro(<< "The driver " << GDALGetDriverShortName(driver) << " does not support writing"); + otbLogMacro(Warning,<< "GDAL driver " << GDALGetDriverShortName(driver) << " does not support writing"); return false; } return true; @@ -1321,7 +1119,6 @@ bool GDALImageIO::CanStreamWrite() if (driver == ITK_NULLPTR) { - itkDebugMacro(<< "Unable to instantiate driver " << gdalDriverShortName); m_CanStreamWrite = false; } if ( GDALGetMetadataItem( driver, GDAL_DCAP_CREATE, ITK_NULLPTR ) != ITK_NULLPTR ) @@ -1347,7 +1144,7 @@ void GDALImageIO::Write(const void* buffer) // Check if conversion succeed if (buffer == ITK_NULLPTR) { - itkExceptionMacro(<< "GDAL : Bad alloc"); + itkExceptionMacro(<< "Null buffer passed to GDALImageIO for writing."); return; } @@ -1373,18 +1170,7 @@ void GDALImageIO::Write(const void* buffer) // If driver supports streaming if (m_CanStreamWrite) { - - otbMsgDevMacro(<< "RasterIO Write requested region : " << this->GetIORegion() << - "\n, lFirstColumn =" << lFirstColumn << - "\n, lFirstLine =" << lFirstLine << - "\n, lNbColumns =" << lNbColumns << - "\n, lNbLines =" << lNbLines << - "\n, m_PxType =" << GDALGetDataTypeName(m_PxType->pixType) << - "\n, m_NbBands =" << m_NbBands << - "\n, m_BytePerPixel ="<< m_BytePerPixel << - "\n, Pixel offset =" << m_BytePerPixel * m_NbBands << // is nbComp * BytePerPixel - "\n, Line offset =" << m_BytePerPixel * m_NbBands * lNbColumns << // is pixelOffset * nbColumns - "\n, Band offset =" << m_BytePerPixel) // is BytePerPixel + otbLogMacro(Debug,<<"GDAL writes ["<<lFirstColumn<<", "<<lFirstColumn+lNbColumns-1<<"]x["<<lFirstLine<<", "<<lFirstLine+lNbLines-1<<"] x "<<m_NbBands<<" bands of type "<<GDALGetDataTypeName(m_PxType->pixType)<<" to file "<<m_FileName); otb::Stopwatch chrono = otb::Stopwatch::StartNew(); CPLErr lCrGdal = m_Dataset->GetDataSet()->RasterIO(GF_Write, @@ -1408,7 +1194,6 @@ void GDALImageIO::Write(const void* buffer) // Band offset is BytePerPixel m_BytePerPixel); chrono.Stop(); - otbMsgDevMacro(<< "RasterIO Write took " << chrono.GetElapsedMilliseconds() << " ms") // Check if writing succeed if (lCrGdal == CE_Failure) @@ -1416,6 +1201,9 @@ void GDALImageIO::Write(const void* buffer) itkExceptionMacro(<< "Error while writing image (GDAL format) '" << m_FileName.c_str() << "' : " << CPLGetLastErrorMsg()); } + + otbLogMacro(Debug,<< "GDAL write took " << chrono.GetElapsedMilliseconds() << " ms") + // Flush dataset cache m_Dataset->GetDataSet()->FlushCache(); } @@ -1582,55 +1370,6 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) if (m_CanStreamWrite) { GDALCreationOptionsType creationOptions = m_CreationOptions; -/* - // Force tile mode for TIFF format if no creation option are given - if( driverShortName == "GTiff" ) - { - if ( CreationOptionContains( "TILED=YES" ) ) - { - // User requested tiled TIFF explicitly - // - // Let GDAL set up the BLOCKXSIZE and BLOCKYSIZE - // or suppose the user have set it also along with TILED=YES - // This allows the user to have complete - // control over the tiling scheme - } - else if ( CreationOptionContains( "BLOCKYSIZE=" ) ) - { - // User did not set "TILED=YES" but set "BLOCKYSIZE=" - // -> He requested a stripped TIFF - } - else - { - // User did not specify "TILED=YES" nor "BLOCKYSIZE=?" - // Switch to TILED mode automatically, and choose BLOCKXSIZE and BLOCKYSIZE for him - - otbMsgDevMacro(<< "Enabling TIFF Tiled mode") - - // Use a fixed tile size - // Take as reference is a 256*256 short int 4 bands tile - const unsigned int ReferenceTileSizeInBytes = 256 * 256 * 4 * 2; - const unsigned int NbPixelPerTile = ReferenceTileSizeInBytes / m_BytePerPixel / m_NbBands; - const unsigned int IdealTileDimension = static_cast<unsigned int>( vcl_sqrt(static_cast<float>(NbPixelPerTile)) ); - - // Set tileDimension to the nearest power of two and aligned to - // 16 pixels (needed by TIFF spec) - unsigned int tileDimension = 16; - while(2*tileDimension < IdealTileDimension) - { - tileDimension*=2; - } - otbMsgDevMacro(<< "Tile dimension : " << tileDimension << " * " << tileDimension) - - std::ostringstream tileDimensionStr; - tileDimensionStr << tileDimension; - - creationOptions.push_back( "TILED=YES" ); - creationOptions.push_back( std::string("BLOCKXSIZE=") + tileDimensionStr.str() ); - creationOptions.push_back( std::string("BLOCKYSIZE=") + tileDimensionStr.str() ); - } - } -*/ m_Dataset = GDALDriverManagerWrapper::GetInstance().Create( driverShortName, GetGdalWriteImageFileName(driverShortName, m_FileName), @@ -1691,7 +1430,7 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) // If there is no ProjectionRef, and the GeoTransform is not the identity, // then saving also GCPs is undefined behavior for GDAL, and a WGS84 projection crs // is assigned arbitrarily - otbMsgDevMacro(<< "Skipping GCPs saving to prevent GDAL from assigning a WGS84 projection ref to the file") + otbLogMacro(Warning,<< "Skipping GCPs saving to prevent GDAL from assigning a WGS84 projref to file ("<<m_FileName<<")") } else { @@ -1802,7 +1541,6 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) unsigned int equalityPos = svalue.find_first_of('='); std::string tag = svalue.substr(0, equalityPos); std::string value = svalue.substr(equalityPos + 1); - otbMsgDevMacro(<< "Metadata: " << tag << "=" << value); dataset->SetMetadataItem(tag.c_str(), value.c_str(), ITK_NULLPTR); } } @@ -1810,24 +1548,6 @@ void GDALImageIO::InternalWriteImageInformation(const void* buffer) // END - // Dataset info - otbMsgDevMacro( << "**** WriteImageInformation() DATASET INFO: ****" ); - otbMsgDevMacro( << "Projection Ref: "<<dataset->GetProjectionRef() ); - double GT[6]; - if (dataset->GetGeoTransform(GT) == CE_None) - { - otbMsgDevMacro( <<"Geo Transform: "<< GT[0] << ", " << GT[1] << ", " - << GT[2] << ", " << GT[3] << ", " - << GT[4] << ", " << GT[5] ); - } - else - { - otbMsgDevMacro( << "No Geo Transform: "); - } - - otbMsgDevMacro( << "GCP Projection Ref: "<< dataset->GetGCPProjection() ); - otbMsgDevMacro( << "GCP Count: " << dataset->GetGCPCount() ); - // Write no-data flags std::vector<bool> noDataValueAvailable; bool ret = itk::ExposeMetaData<std::vector<bool> >(dict,MetaDataKey::NoDataValueAvailable,noDataValueAvailable); @@ -1926,7 +1646,6 @@ bool GDALImageIO::GetOriginFromGMLBox(std::vector<double> &origin) std::string gmlString = static_cast<std::string>(jp2Metadata.papszGMLMetadata[0]); gmlString.erase(0,18); // We need to remove first part to create a true xml stream - otbMsgDevMacro( << "XML extract from GML box: " << gmlString ); TiXmlDocument doc; doc.Parse(gmlString.c_str()); // Create xml doc from a string @@ -1942,13 +1661,8 @@ bool GDALImageIO::GetOriginFromGMLBox(std::vector<double> &origin) .FirstChild( "gml:limits" ) .FirstChild( "gml:GridEnvelope" ) .FirstChild( "gml:low").ToElement(); - if(originTag) + if(!originTag) { - otbMsgDevMacro( << "\t Origin (" << originTag->Value() <<" tag)= "<< originTag->GetText()); - } - else - { - otbMsgDevMacro( << "Didn't find the GML element which indicate the origin!" ); return false; } @@ -1963,8 +1677,6 @@ bool GDALImageIO::GetOriginFromGMLBox(std::vector<double> &origin) origin[0] += -1.0; origin[1] += -1.0; - otbMsgDevMacro( << "\t Origin from GML box: " << origin[0] << ", " << origin[1] ); - return true; } diff --git a/Modules/IO/ImageIO/include/otbImageFileReader.txx b/Modules/IO/ImageIO/include/otbImageFileReader.txx index 87cc50b6e38b3de373d20c163872d5898b885666..c8d4fb2d0f13c9a9add354d34fbff848b2397100 100644 --- a/Modules/IO/ImageIO/include/otbImageFileReader.txx +++ b/Modules/IO/ImageIO/include/otbImageFileReader.txx @@ -107,7 +107,6 @@ void ImageFileReader<TOutputImage, ConvertPixelTraits> ::SetImageIO( otb::ImageIOBase * imageIO) { - itkDebugMacro("setting ImageIO to " << imageIO ); if (this->m_ImageIO != imageIO ) { this->m_ImageIO = imageIO; @@ -207,12 +206,6 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> char * loadBuffer = new char[nbBytes]; - otbMsgDevMacro(<< "buffer size for ImageIO::read = " << nbBytes << " = \n" - << "ComponentSize ("<< this->m_ImageIO->GetComponentSize() << ") x " \ - << "Nb of Component ( max(" << this->m_ImageIO->GetNumberOfComponents() \ - << " , "<<m_BandList.size() << ") ) x " \ - << "Nb of Pixel to read (" << region.GetNumberOfPixels() << ")"); - this->m_ImageIO->Read(loadBuffer); if (m_FilenameHelper->BandRangeIsSet()) @@ -410,13 +403,13 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> if (m_FilenameHelper->ExtGEOMFileNameIsSet()) { otb_kwl = ReadGeometryFromGEOMFile(m_FilenameHelper->GetExtGEOMFileName()); - otbMsgDevMacro(<< "Loading external kwl: "<< m_FilenameHelper->GetExtGEOMFileName()); + otbLogMacro(Info,<< "Loading kwl metadata from external geom file "<< m_FilenameHelper->GetExtGEOMFileName()); } // Case 2: attached geom (if present) else if (itksys::SystemTools::FileExists(attachedGeom)) { otb_kwl = ReadGeometryFromGEOMFile(attachedGeom); - otbMsgDevMacro(<< "Loading attached kwl"); + otbLogMacro(Info,<< "Loading kwl metadata from attached geom file "<<attachedGeom); } // Case 3: find an ossimPluginProjection // Case 4: find an ossimProjection @@ -424,7 +417,14 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> else { otb_kwl = ReadGeometryFromImage(lFileNameOssimKeywordlist,!m_FilenameHelper->GetSkipRpcTag()); - otbMsgDevMacro(<< "Loading internal kwl"); + if(!otb_kwl.Empty()) + { + otbLogMacro(Info,<< "Loading kwl metadata from official product in file "<<lFileNameOssimKeywordlist); + } + else + { + otbLogMacro(Info,<< "No kwl metadata found in file "<<lFileNameOssimKeywordlist); + } } // Don't add an empty ossim keyword list @@ -644,8 +644,6 @@ ImageFileReader<TOutputImage, ConvertPixelTraits> fic_trouve = true; } - otbMsgDevMacro(<< "lFileNameGdal : " << GdalFileName.c_str()); - otbMsgDevMacro(<< "fic_trouve : " << fic_trouve); return (fic_trouve); } diff --git a/Modules/IO/ImageIO/include/otbImageFileWriter.txx b/Modules/IO/ImageIO/include/otbImageFileWriter.txx index b1472291f1ae216f302757ad00b69bfd161b3630..907da0d9bd562a6954e2978a34a38830f671de09 100644 --- a/Modules/IO/ImageIO/include/otbImageFileWriter.txx +++ b/Modules/IO/ImageIO/include/otbImageFileWriter.txx @@ -99,7 +99,6 @@ ImageFileWriter<TInputImage> typedef NumberOfDivisionsStrippedStreamingManager<TInputImage> NumberOfDivisionsStrippedStreamingManagerType; typename NumberOfDivisionsStrippedStreamingManagerType::Pointer streamingManager = NumberOfDivisionsStrippedStreamingManagerType::New(); streamingManager->SetNumberOfDivisions(nbDivisions); - m_StreamingManager = streamingManager; } @@ -111,7 +110,6 @@ ImageFileWriter<TInputImage> typedef NumberOfDivisionsTiledStreamingManager<TInputImage> NumberOfDivisionsTiledStreamingManagerType; typename NumberOfDivisionsTiledStreamingManagerType::Pointer streamingManager = NumberOfDivisionsTiledStreamingManagerType::New(); streamingManager->SetNumberOfDivisions(nbDivisions); - m_StreamingManager = streamingManager; } @@ -123,7 +121,6 @@ ImageFileWriter<TInputImage> typedef NumberOfLinesStrippedStreamingManager<TInputImage> NumberOfLinesStrippedStreamingManagerType; typename NumberOfLinesStrippedStreamingManagerType::Pointer streamingManager = NumberOfLinesStrippedStreamingManagerType::New(); streamingManager->SetNumberOfLinesPerStrip(nbLinesPerStrip); - m_StreamingManager = streamingManager; } @@ -136,7 +133,6 @@ ImageFileWriter<TInputImage> typename RAMDrivenStrippedStreamingManagerType::Pointer streamingManager = RAMDrivenStrippedStreamingManagerType::New(); streamingManager->SetAvailableRAMInMB(availableRAM); streamingManager->SetBias(bias); - m_StreamingManager = streamingManager; } @@ -147,8 +143,7 @@ ImageFileWriter<TInputImage> { typedef TileDimensionTiledStreamingManager<TInputImage> TileDimensionTiledStreamingManagerType; typename TileDimensionTiledStreamingManagerType::Pointer streamingManager = TileDimensionTiledStreamingManagerType::New(); - streamingManager->SetTileDimension(tileDimension); - + streamingManager->SetTileDimension(tileDimension); m_StreamingManager = streamingManager; } @@ -238,7 +233,6 @@ void ImageFileWriter<TInputImage> ::SetIORegion(const itk::ImageIORegion& region) { - itkDebugMacro("setting IORegion to " << region); if (m_IORegion != region) { m_IORegion = region; @@ -289,7 +283,7 @@ ImageFileWriter<TInputImage> /** Parse streaming modes */ if(m_FilenameHelper->StreamingTypeIsSet()) { - itkWarningMacro(<<"Streaming configuration through extended filename is used. Any previous streaming configuration (ram value, streaming mode ...) will be ignored."); + otbLogMacro(Warning,<<"Streaming configuration through extended filename is used. Any previous streaming configuration (ram value, streaming mode ...) will be ignored."); std::string type = m_FilenameHelper->GetStreamingType(); @@ -311,11 +305,11 @@ ImageFileWriter<TInputImage> { if(sizemode != "auto") { - itkWarningMacro(<<"In auto streaming type, the sizemode option will be ignored."); + otbLogMacro(Warning,<<"In auto streaming type, the sizemode option will be ignored."); } if(sizevalue == 0.) { - itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); + otbLogMacro(Warning,<<"sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); } this->SetAutomaticAdaptativeStreaming(sizevalue); } @@ -325,7 +319,7 @@ ImageFileWriter<TInputImage> { if(sizevalue == 0.) { - itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); + otbLogMacro(Warning,<<"sizemode is auto but sizevalue is 0. Value will be fetched from the OTB_MAX_RAM_HINT environment variable if set, or else use the default value"); } this->SetAutomaticTiledStreaming(sizevalue); } @@ -333,7 +327,7 @@ ImageFileWriter<TInputImage> { if(sizevalue == 0.) { - itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } this->SetNumberOfDivisionsTiledStreaming(static_cast<unsigned int>(sizevalue)); } @@ -341,7 +335,7 @@ ImageFileWriter<TInputImage> { if(sizevalue == 0.) { - itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } this->SetTileDimensionTiledStreaming(static_cast<unsigned int>(sizevalue)); @@ -353,7 +347,7 @@ ImageFileWriter<TInputImage> { if(sizevalue == 0.) { - itkWarningMacro("sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); + otbLogMacro(Warning,<<"sizemode is auto but sizevalue is 0. Value will be fetched from configuration file if any, or from cmake configuration otherwise."); } this->SetAutomaticStrippedStreaming(sizevalue); @@ -362,7 +356,7 @@ ImageFileWriter<TInputImage> { if(sizevalue == 0.) { - itkWarningMacro("Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to nbsplits but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } this->SetNumberOfDivisionsStrippedStreaming(static_cast<unsigned int>(sizevalue)); } @@ -370,7 +364,7 @@ ImageFileWriter<TInputImage> { if(sizevalue == 0.) { - itkWarningMacro("Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); + otbLogMacro(Warning,<<"Streaming sizemode is set to height but sizevalue is 0. This will result in upredicted behaviour. Please consider setting the sizevalue by using &streaming:sizevalue=x."); } this->SetNumberOfLinesStrippedStreaming(static_cast<unsigned int>(sizevalue)); } @@ -380,7 +374,7 @@ ImageFileWriter<TInputImage> { if(sizemode!="" || sizevalue!=0.) { - itkWarningMacro("Streaming is explicitly disabled, sizemode and sizevalue will be ignored."); + otbLogMacro(Warning,<<"Streaming is explicitly disabled, sizemode and sizevalue will be ignored."); } this->SetNumberOfDivisionsTiledStreaming(0); } @@ -389,7 +383,7 @@ ImageFileWriter<TInputImage> { if(m_FilenameHelper->StreamingSizeValueIsSet() || m_FilenameHelper->StreamingSizeModeIsSet()) { - itkWarningMacro(<<"No streaming type is set, streaming sizemode and sizevalue will be ignored."); + otbLogMacro(Warning,<<"No streaming type is set, streaming sizemode and sizevalue will be ignored."); } } @@ -418,8 +412,6 @@ ImageFileWriter<TInputImage> if (m_ImageIO.IsNull()) //try creating via factory { - itkDebugMacro(<< "Attempting factory creation of ImageIO for file: " - << m_FileName); this->SetImageIO(ImageIOFactory::CreateImageIO(m_FileName.c_str(), otb::ImageIOFactory::WriteMode)); @@ -429,13 +421,8 @@ ImageFileWriter<TInputImage> { if (!m_ImageIO->CanWriteFile(m_FileName.c_str())) { - itkDebugMacro(<< "ImageIO exists but doesn't know how to write file:" - << m_FileName); - if (m_FactorySpecifiedImageIO) { - itkDebugMacro(<< "Attempting creation of ImageIO with a factory for file:" - << m_FileName); m_ImageIO = ImageIOFactory::CreateImageIO(m_FileName.c_str(), otb::ImageIOFactory::WriteMode); m_FactorySpecifiedImageIO = true; @@ -514,7 +501,7 @@ ImageFileWriter<TInputImage> e.SetDataObject(inputPtr); throw e; } - otbMsgDevMacro(<< "inputRegion " << inputRegion); + otbLogMacro(Info,<<"Writing user defined region ["<<start[0]<<", "<<start[0]+size[0]-1<<"]x["<<start[1]<<", "<<start[1]+size[1]<<"]"); } /** @@ -526,9 +513,8 @@ ImageFileWriter<TInputImage> /** Control if the ImageIO is CanStreamWrite */ if (m_ImageIO->CanStreamWrite() == false) { - otbWarningMacro( - << "The ImageFactory selected for the image file <" << m_FileName.c_str() << - "> does not support streaming."); + otbLogMacro(Warning,<<"The file format of " << m_FileName << + " does not support streaming. All data will be loaded to memory"); this->SetNumberOfDivisionsStrippedStreaming(1); } @@ -537,12 +523,14 @@ ImageFileWriter<TInputImage> * Not sure that if this modification is needed */ else if (inputPtr->GetBufferedRegion() == inputRegion) { - otbMsgDevMacro(<< "Buffered region is the largest possible region, there is no need for streaming."); + otbLogMacro(Debug,<< "Buffered region is the largest possible region, there is no need for streaming."); this->SetNumberOfDivisionsStrippedStreaming(1); } m_StreamingManager->PrepareStreaming(inputPtr, inputRegion); m_NumberOfDivisions = m_StreamingManager->GetNumberOfSplits(); - otbMsgDebugMacro(<< "Number Of Stream Divisions : " << m_NumberOfDivisions); + + const auto firstSplitSize = m_StreamingManager->GetSplit(0).GetSize(); + otbLogMacro(Info,<<"File "<<m_FileName<<" will be written in "<<m_NumberOfDivisions<<" blocks of "<<firstSplitSize[0]<<"x"<<firstSplitSize[1]<<" pixels"); /** * Loop over the number of pieces, execute the upstream pipeline on each @@ -612,7 +600,7 @@ ImageFileWriter<TInputImage> } else { - itkWarningMacro(<< "Could not get the source process object. Progress report might be buggy"); + otbLogMacro(Warning,<< "Could not get the source process object. Progress report might be buggy"); } for (m_CurrentDivision = 0; @@ -746,9 +734,6 @@ ImageFileWriter<TInputImage> { if ( m_NumberOfDivisions > 1 || m_UserSpecifiedIORegion) { - itkDebugMacro("Requested stream region does not match generated output"); - itkDebugMacro("input filter may not support streaming well"); - cacheImage = InputImageType::New(); cacheImage->CopyInformation(input); diff --git a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx index 2b14f6dca92ebe4c97d4305b16afe744e5635944..1d1c03e39a67864cbcbe81c014c4a97d7aca59df 100644 --- a/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx +++ b/Modules/Learning/Supervised/include/otbLibSVMMachineLearningModel.txx @@ -66,7 +66,7 @@ LibSVMMachineLearningModel<TInputValue,TOutputValue> this->m_Problem.l = 0; this->m_Problem.y = ITK_NULLPTR; this->m_Problem.x = ITK_NULLPTR; -#ifndef OTB_SHOW_ALL_MSG_DEBUG +#ifndef NDEBUG svm_set_print_string_function(&otb::Utils::PrintNothing); #endif } diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx index 74e7385133261080cf1e05a831fbac8608f94abe..814695045a90df698c862b0a361fe78683ebaa7d 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperInputImageParameter.txx @@ -38,8 +38,6 @@ template <class TImageType> TImageType* InputImageParameter::GetImage() { - otbMsgDevMacro(<< "GetImage()"); - // Used m_PreviousFileName because if not, when the user call twice GetImage, // it without changing the filename, it returns 2 different // image pointers diff --git a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt index 6d5031b81535d229184ef57c515981bab7c4261f..115c5a772bc146af0c87c8123920e90a4f33f1bf 100644 --- a/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt +++ b/Modules/Wrappers/ApplicationEngine/src/CMakeLists.txt @@ -57,7 +57,6 @@ set( OTBApplicationEngine_SRC otbWrapperAbstractParameterList.cxx otbWrapperParameterList.cxx otbWrapperBoolParameter.cxx - otbLogger.cxx ) add_library(OTBApplicationEngine ${OTBApplicationEngine_SRC}) diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx index f022af0ddbe47d8d7c59415363fff57800151c4f..f68d3a39233577a2f5e139063eb43da100cf9130 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplicationRegistry.cxx @@ -211,10 +211,6 @@ ApplicationRegistry::CreateApplication(const std::string& name, bool useFactory) appli = app; appli->Init(); } - else - { - otbMsgDevMacro( << "Error ApplicationRegistry factory did not return an Application: " << possibleApp->GetNameOfClass() << std::endl ); - } } } @@ -350,10 +346,6 @@ ApplicationRegistry::GetAvailableApplications(bool useFactory) std::string curName(app->GetName()); appSet.insert(curName); } - else - { - otbMsgDevMacro( << "Error ApplicationRegistry factory did not return an Application: " << (*i)->GetNameOfClass() << std::endl ); - } } } @@ -438,7 +430,7 @@ ApplicationRegistry::LoadApplicationFromPath(std::string path,std::string name) } else { - otbMsgDevMacro( << "Can't load library : " << path << std::endl ); + otbLogMacro(Warning,<< "Failed to load libraries from " << path << " while trying to create application "<<name ); } } return appli;