18 #ifndef sitkProcessObject_h
19 #define sitkProcessObject_h
34 template<
typename T,
unsigned int NVectorDimension >
class Vector;
68 virtual std::string ToString()
const;
71 virtual std::string GetName()
const = 0;
79 virtual void DebugOn();
80 virtual void DebugOff();
86 virtual bool GetDebug()
const;
87 virtual void SetDebug(
bool debugFlag);
95 static void GlobalDefaultDebugOn();
96 static void GlobalDefaultDebugOff();
100 static bool GetGlobalDefaultDebug();
101 static void SetGlobalDefaultDebug(
bool debugFlag);
112 static void GlobalWarningDisplayOn();
113 static void GlobalWarningDisplayOff();
114 static void SetGlobalWarningDisplay(
bool flag);
115 static bool GetGlobalWarningDisplay();
122 static void SetGlobalDefaultNumberOfThreads(
unsigned int n);
123 static unsigned int GetGlobalDefaultNumberOfThreads();
138 static double GetGlobalDefaultCoordinateTolerance();
139 static void SetGlobalDefaultCoordinateTolerance(
double );
141 static double GetGlobalDefaultDirectionTolerance();
142 static void SetGlobalDefaultDirectionTolerance(
double);
149 virtual void SetNumberOfThreads(
unsigned int n);
150 virtual unsigned int GetNumberOfThreads()
const;
186 virtual void RemoveAllCommands();
201 virtual float GetProgress( )
const;
218 virtual void Abort();
227 : m_Event(e), m_Command(c), m_ITKTag(
std::numeric_limits<unsigned long>::max())
250 virtual void RemoveITKObserver( EventCommand &e );
260 virtual void OnActiveProcessDelete( );
269 template<
class TImageType >
272 typename TImageType::ConstPointer itkImage =
273 dynamic_cast <
const TImageType* > ( img.
GetITKBase() );
275 if ( itkImage.IsNull() )
282 template<
class TImageType >
289 template<
class TPixelType,
unsigned int VImageDimension,
unsigned int VLength,
290 template<
typename,
unsigned int>
class TVector >
296 typename VectorImageType::InternalPixelType* buffer =
reinterpret_cast<typename VectorImageType::InternalPixelType*
>( img->GetPixelContainer()->GetBufferPointer() );
301 numberOfElements *= VImageDimension;
303 typename VectorImageType::Pointer out = VectorImageType::New();
306 out->GetPixelContainer()->SetImportPointer(buffer, numberOfElements,
true );
307 img->GetPixelContainer()->ContainerManageMemoryOff();
308 out->CopyInformation( img );
309 out->SetRegions( img->GetBufferedRegion() );
311 return Image(out.GetPointer());
322 template <
typename T>
328 static std::ostream & ToStringHelper(std::ostream &os,
const char &v);
329 static std::ostream & ToStringHelper(std::ostream &os,
const signed char &v);
330 static std::ostream & ToStringHelper(std::ostream &os,
const unsigned char &v);
340 unsigned long AddObserverToActiveProcessObject( EventCommand &e );
345 void RemoveObserverFromActiveProcessObject( EventCommand &e );
static std::ostream & ToStringHelper(std::ostream &os, const T &v)
float m_ProgressMeasurement
EventCommand(EventEnum e, Command *c)
itk::DataObject * GetITKBase(void)
SizeValueType GetNumberOfPixels() const
EventEnum
Events which can be observed from ProcessObject.
class ITK_FORWARD_EXPORT ProcessObject
unsigned int m_NumberOfThreads
static Image CastITKToImage(TImageType *img)
itk::ProcessObject * m_ActiveProcess
An implementation of the Command design pattern for callback.
std::list< EventCommand > m_Commands
static TImageType::ConstPointer CastImageToITK(const Image &img)
#define SITKCommon_EXPORT
The main Image class for SimpleITK.
static Image CastITKToImage(itk::Image< TVector< TPixelType, VLength >, VImageDimension > *img)
bool operator<(const EventCommand &o) const
bool operator==(const EventCommand &o) const
#define sitkExceptionMacro(x)
virtual const RegionType & GetBufferedRegion() const
Base class for SimpleITK classes based on ProcessObject.
An inheratable class to disable copying of a class.
class ITK_FORWARD_EXPORT Command