Commit f0ec6a41 authored by Emmanuel Christophe's avatar Emmanuel Christophe

MRG

parents 178f2fee 15290b64
......@@ -57,7 +57,7 @@ ADD_DEFINITIONS(
#-----------------------------------------------------------------------------
# OTB version number. An even minor number corresponds to releases.
SET(OTB_VERSION_MAJOR "2")
SET(OTB_VERSION_MINOR "4")
SET(OTB_VERSION_MINOR "6")
SET(OTB_VERSION_PATCH "0")
......
......@@ -27,7 +27,7 @@
namespace otb
{
/** \class otbBSplineDecompositionImageFilter
/** \class BSplineDecompositionImageFilter
* \brief This class is an evolution of the itk::BSplineDecompositionImageFilter to handle
* huge images with this interpolator. For more documentation, please refer to the original
* class.
......
......@@ -24,7 +24,7 @@
namespace otb
{
/** \class otbLabelizeConnectedThresholdImageFilter
/** \class LabelizeConnectedThresholdImageFilter
* \brief
*
*/
......
......@@ -26,8 +26,8 @@
namespace otb
{
/** \class otbLabelizeImageFilterBase
* \brief
/** \class LabelizeImageFilterBase
* \brief Base class for filter labelizing image region based on segmentation.
*
*/
template <class TInputImage, class TOutputImage, class TFilter>
......
......@@ -25,6 +25,10 @@
namespace otb {
/** \class CumulantsForEdgeworth
* \brief Helper class for KullbackLeiblerDistanceImageFilter. Please refer to KullbackLeiblerDistanceImageFilter.
*
*/
template < class TInput >
class CumulantsForEdgeworth
{
......@@ -59,7 +63,10 @@ class CumulantsForEdgeworth
namespace Functor {
/** \class KullbackLeiblerDistance
* \brief Functor for KullbackLeiblerDistanceImageFilter. Please refer to KullbackLeiblerDistanceImageFilter.
*
*/
template < class TInput1, class TInput2, class TOutput >
class KullbackLeiblerDistance
{
......
......@@ -29,7 +29,7 @@
namespace otb {
/** \class KullbackLeiblerSupervizedDistance
/** \class KullbackLeiblerSupervizedDistanceImageFilter
* \brief Implements KullbackLeibler distance over Edgeworth approximation,
* between a Neighborhood and a predefined Region of Interest.
*
......
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
Some parts of this code are derived from ITK. See ITKCopyright.txt
for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbStandardWriterWatcher.h"
namespace otb
{
StandardWriterWatcher
::StandardWriterWatcher(itk::ProcessObject* process,
const char *comment)
: WriterWatcherBase(process, comment)
{
m_StarsCount = 50;
}
StandardWriterWatcher
::StandardWriterWatcher( const StandardWriterWatcher& watch)
{
// Initialize state
m_StarsCount = watch.m_StarsCount;
}
void
StandardWriterWatcher
::operator=(const StandardWriterWatcher &watch)
{
// Initialize state
m_StarsCount = watch.m_StarsCount;
}
void
StandardWriterWatcher
::ShowWriterProgress()
{
this->ShowProgress();
}
void
StandardWriterWatcher
::ShowFilterProgress()
{
this->ShowProgress();
}
void
StandardWriterWatcher
::ShowProgress()
{
itk::OStringStream oss;
oss.str("");
oss<<"\r";
if (m_SourceProcess)
{
double progress = m_SourceProcess->GetProgress();
int progressPercent = static_cast<int>(progress*100);
std::string stars(static_cast<int>(progress*m_StarsCount),'*');
std::string blanks(m_StarsCount - stars.length(),' ');
oss << "Current Tile: ";
if(progressPercent<10)
{
oss<<" ";
}
if(progressPercent<100)
{
oss<<" ";
}
oss<<progressPercent << "% [" << stars << blanks << "] ";
}
if (m_Process)
{
double progress = m_Process->GetProgress();
int progressPercent = static_cast<int>(progress*100);
std::string stars(static_cast<int>(progress*m_StarsCount),'*');
std::string blanks(m_StarsCount - stars.length(),' ');
oss << "Writing: ";
if(progressPercent<10)
{
oss<<" ";
}
if(progressPercent<100)
{
oss<<" ";
}
oss<< progressPercent << "% [" << stars << blanks << "]" << std::flush;
}
std::cout<<oss.str();
}
void
StandardWriterWatcher
::StartWriter()
{
m_TimeProbe.Start();
std::cout<<"Writing task: "<< " \"" << m_Comment << "\" " << std::endl;
std::cout << "Writer type: "<<(m_Process.GetPointer() ? m_Process->GetNameOfClass() : "None")<< std::endl;
std::cout << "Filter type: "<<(m_SourceProcess.GetPointer() ? m_SourceProcess->GetNameOfClass() : "None")<< std::endl;
}
void
StandardWriterWatcher
::EndWriter()
{
m_TimeProbe.Stop();
std::cout << std::endl << "Writing task took "
<< m_TimeProbe.GetMeanTime()
<< " seconds." << std::endl;
}
} // end namespace otb
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
Some parts of this code are derived from ITK. See ITKCopyright.txt
for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __otbStandardWriterWatcher_h
#define __otbStandardWriterWatcher_h
#include "otbWriterWatcherBase.h"
namespace otb
{
/** \class StandardWriterWatcher
* \brief This class shows the percentage progress execution
* of the pipeline filtering process
*
* This class is based on oberservers desgin patter
* Abstract class ProcessObject is the subject
* Event are oberservers
*
* Usage example:
*
* \code
* typedef itk::BinaryThresholdImageWriter<ImageType> WriterType;
* WriterType::Pointer thresholdWriter = WriterType::New();
*
* StandardWriterWatcher watcher(thresholdWriter, "Threshold");
* \endcode
*
* \see itk::SimpleWriterWatcher
* \see otb::fltkWriterWatcher
*/
class ITK_EXPORT StandardWriterWatcher : public otb::WriterWatcherBase
{
public:
/** Constructor. Takes a ProcessObject to monitor and an optional
* comment string that is prepended to each event message. */
StandardWriterWatcher(itk::ProcessObject* process,
const char *comment="");
/** Copy constructor */
StandardWriterWatcher(const StandardWriterWatcher&);
/** operator= */
void operator=(const StandardWriterWatcher& );
/** Get/Set number of stars */
void SetStars( int count ) { m_StarsCount = count;}
const int& GetStars() const { return m_StarsCount;}
protected:
/** Callback method to show the ProgressEvent */
virtual void ShowWriterProgress();
/** Callback method to show the StartEvent */
virtual void StartWriter();
/** Callback method to show the EndEvent */
virtual void EndWriter();
/** Callback method to show the ProgressEvent */
virtual void ShowFilterProgress();
/** Callback method to show the StartEvent */
virtual void StartFilter(){};
/** Callback method to show the EndEvent */
virtual void EndFilter(){};
/** This is the method invoked by ShowFilterProgress() and ShowWriterProgress() */
virtual void ShowProgress();
private:
/** Stars coutning */
int m_StarsCount;
};
} // end namespace otb
#endif
/*=========================================================================
Program: ORFEO Toolbox
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Centre National d'Etudes Spatiales. All rights reserved.
See OTBCopyright.txt for details.
Some parts of this code are derived from ITK. See ITKCopyright.txt
for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#include "otbWriterWatcherBase.h"
namespace otb
{
WriterWatcherBase
::WriterWatcherBase()
{
// Initialize state
m_Comment = "Not watching an object";
m_Process = 0;
}
WriterWatcherBase
::WriterWatcherBase(itk::ProcessObject* process,
const char *comment)
{
// Initialize state
m_Process = process;
m_Comment = comment;
// Create a series of commands
m_StartWriterCommand = CommandType::New();
m_EndWriterCommand = CommandType::New();
m_ProgressWriterCommand = CommandType::New();
m_StartFilterCommand = CommandType::New();
m_EndFilterCommand = CommandType::New();
m_ProgressFilterCommand = CommandType::New();
// Assign the callbacks
m_StartFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::StartFilter);
m_EndFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::EndFilter);
m_ProgressFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::ShowFilterProgress);
m_StartWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::StartWriter);
m_EndWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::EndWriter);
m_ProgressWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::ShowWriterProgress);
// Add the commands as observers
m_StartWriterTag = m_Process->AddObserver(itk::StartEvent(),
m_StartWriterCommand);
m_EndWriterTag = m_Process->AddObserver(itk::EndEvent(),
m_EndWriterCommand);
m_ProgressWriterTag = m_Process->AddObserver(itk::ProgressEvent(),
m_ProgressWriterCommand);
// Try to get the filter that is wired to m_Process.
if(m_Process->GetInputs()[0]->GetSource())
{
m_SourceProcess = m_Process->GetInputs()[0]->GetSource();
// Add the commands as observers
m_StartFilterTag = m_SourceProcess->AddObserver(itk::StartEvent(),
m_StartFilterCommand);
m_EndFilterTag = m_SourceProcess->AddObserver(itk::EndEvent(),
m_EndFilterCommand);
m_ProgressFilterTag = m_SourceProcess->AddObserver(itk::ProgressEvent(),
m_ProgressFilterCommand);
}
}
WriterWatcherBase
::WriterWatcherBase( const WriterWatcherBase& watch)
{
// Remove any observers we have on the old process object
if (m_Process)
{
if (m_StartWriterCommand)
{
m_Process->RemoveObserver(m_StartWriterTag);
}
if (m_EndWriterCommand)
{
m_Process->RemoveObserver(m_EndWriterTag);
}
if (m_ProgressWriterCommand)
{
m_Process->RemoveObserver(m_ProgressWriterTag);
}
}
if (m_SourceProcess)
{
if (m_StartFilterCommand)
{
m_SourceProcess->RemoveObserver(m_StartFilterTag);
}
if (m_EndFilterCommand)
{
m_SourceProcess->RemoveObserver(m_EndFilterTag);
}
if (m_ProgressFilterCommand)
{
m_SourceProcess->RemoveObserver(m_ProgressFilterTag);
}
}
// Initialize state
m_TimeProbe = watch.m_TimeProbe;
m_Process = watch.m_Process;
m_SourceProcess = watch.m_SourceProcess;
m_Comment = watch.m_Comment;
m_StartFilterTag = 0;
m_EndFilterTag = 0;
m_ProgressFilterTag = 0;
m_StartWriterTag = 0;
m_EndWriterTag = 0;
m_ProgressWriterTag = 0;
// Create a series of commands
if (m_Process)
{
m_StartWriterCommand = CommandType::New();
m_EndWriterCommand = CommandType::New();
m_ProgressWriterCommand = CommandType::New();
// Assign the callbacks
m_StartWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::StartWriter);
m_EndWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::EndWriter);
m_ProgressWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::ShowWriterProgress);
// Add the commands as observers
m_StartWriterTag = m_Process->AddObserver(itk::StartEvent(), m_StartWriterCommand);
m_EndWriterTag = m_Process->AddObserver(itk::EndEvent(), m_EndWriterCommand);
m_ProgressWriterTag
= m_Process->AddObserver(itk::ProgressEvent(), m_ProgressWriterCommand);
}
if (m_SourceProcess)
{
m_StartFilterCommand = CommandType::New();
m_EndFilterCommand = CommandType::New();
m_ProgressFilterCommand = CommandType::New();
// Assign the callbacks
m_StartFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::StartFilter);
m_EndFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::EndFilter);
m_ProgressFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::ShowFilterProgress);
// Add the commands as observers
m_StartFilterTag = m_SourceProcess->AddObserver(itk::StartEvent(), m_StartFilterCommand);
m_EndFilterTag = m_SourceProcess->AddObserver(itk::EndEvent(), m_EndFilterCommand);
m_ProgressFilterTag
= m_SourceProcess->AddObserver(itk::ProgressEvent(), m_ProgressFilterCommand);
}
}
void
WriterWatcherBase
::operator=(const WriterWatcherBase &watch)
{
// Remove any observers we have on the old process object
if (m_Process)
{
if (m_StartWriterCommand)
{
m_Process->RemoveObserver(m_StartWriterTag);
}
if (m_EndWriterCommand)
{
m_Process->RemoveObserver(m_EndWriterTag);
}
if (m_ProgressWriterCommand)
{
m_Process->RemoveObserver(m_ProgressWriterTag);
}
}
if (m_SourceProcess)
{
if (m_StartFilterCommand)
{
m_SourceProcess->RemoveObserver(m_StartFilterTag);
}
if (m_EndFilterCommand)
{
m_SourceProcess->RemoveObserver(m_EndFilterTag);
}
if (m_ProgressFilterCommand)
{
m_SourceProcess->RemoveObserver(m_ProgressFilterTag);
}
}
// Initialize state
m_TimeProbe = watch.m_TimeProbe;
m_Process = watch.m_Process;
m_SourceProcess = watch.m_SourceProcess;
m_Comment = watch.m_Comment;
m_StartFilterTag = 0;
m_EndFilterTag = 0;
m_ProgressFilterTag = 0;
m_StartWriterTag = 0;
m_EndWriterTag = 0;
m_ProgressWriterTag = 0;
// Create a series of commands
if (m_Process)
{
m_StartWriterCommand = CommandType::New();
m_EndWriterCommand = CommandType::New();
m_ProgressWriterCommand = CommandType::New();
// Assign the callbacks
m_StartWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::StartWriter);
m_EndWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::EndWriter);
m_ProgressWriterCommand->SetCallbackFunction(this,
&WriterWatcherBase::ShowWriterProgress);
// Add the commands as observers
m_StartWriterTag = m_Process->AddObserver(itk::StartEvent(), m_StartWriterCommand);
m_EndWriterTag = m_Process->AddObserver(itk::EndEvent(), m_EndWriterCommand);
m_ProgressWriterTag
= m_Process->AddObserver(itk::ProgressEvent(), m_ProgressWriterCommand);
}
if (m_SourceProcess)
{
m_StartFilterCommand = CommandType::New();
m_EndFilterCommand = CommandType::New();
m_ProgressFilterCommand = CommandType::New();
// Assign the callbacks
m_StartFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::StartFilter);
m_EndFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::EndFilter);
m_ProgressFilterCommand->SetCallbackFunction(this,
&WriterWatcherBase::ShowFilterProgress);
// Add the commands as observers
m_StartFilterTag = m_SourceProcess->AddObserver(itk::StartEvent(), m_StartFilterCommand);
m_EndFilterTag = m_SourceProcess->AddObserver(itk::EndEvent(), m_EndFilterCommand);
m_ProgressFilterTag
= m_SourceProcess->AddObserver(itk::ProgressEvent(), m_ProgressFilterCommand);
}
}
WriterWatcherBase
::~WriterWatcherBase()
{
// Remove any observers we have on the old process object
if (m_Process)
{
if (m_StartWriterCommand)
{
m_Process->RemoveObserver(m_StartWriterTag);
}
if (m_EndWriterCommand)
{
m_Process->RemoveObserver(m_EndWriterTag);
}
if (m_ProgressWriterCommand)
{
m_Process->RemoveObserver(m_ProgressWriterTag);
}
}
if (m_SourceProcess)
{
if (m_StartFilterCommand)
{
m_SourceProcess->RemoveObserver(m_StartFilterTag);
}
if (m_EndFilterCommand)
{
m_SourceProcess->RemoveObserver(m_EndFilterTag);
}
if (m_ProgressFilterCommand)
{
m_SourceProcess->RemoveObserver(m_ProgressFilterTag);
}
}
}
} // end namespace otb
/*=========================================================================
Program: ORFEO Toolbox