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() )
280 << TImageType::GetImageDimension() <<
" and pixel type: \""
287 template<
class TImageType >
294 template<
class TPixelType,
unsigned int VImageDimension,
unsigned int VLength,
295 template<
typename,
unsigned int>
class TVector >
301 typename VectorImageType::InternalPixelType* buffer =
reinterpret_cast<typename VectorImageType::InternalPixelType*
>( img->GetPixelContainer()->GetBufferPointer() );
306 numberOfElements *= VImageDimension;
308 typename VectorImageType::Pointer out = VectorImageType::New();
311 out->GetPixelContainer()->SetImportPointer(buffer, numberOfElements,
true );
312 img->GetPixelContainer()->ContainerManageMemoryOff();
314 out->SetRegions( img->GetBufferedRegion() );
316 return Image(out.GetPointer());
327 template <
typename T>
333 static std::ostream & ToStringHelper(std::ostream &os,
const char &v);
334 static std::ostream & ToStringHelper(std::ostream &os,
const signed char &v);
335 static std::ostream & ToStringHelper(std::ostream &os,
const unsigned char &v);
345 unsigned long AddObserverToActiveProcessObject( EventCommand &e );
350 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)
std::string GetPixelIDTypeAsString(void) const
const std::string SITKCommon_EXPORT GetPixelIDValueAsString(PixelIDValueType type)
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
uint64_t GetNumberOfPixels(void) const
Get the number of pixels in the image.
An implementation of the Command design pattern for callback.
void CopyInformation(const Image &srcImage)
Copy common meta-data from an image to this one.
std::list< EventCommand > m_Commands
static TImageType::ConstPointer CastImageToITK(const Image &img)
#define SITKCommon_EXPORT
The 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)
Base class for SimpleITK classes based on ProcessObject.
An inheratable class to disable copying of a class.
class ITK_FORWARD_EXPORT Command
unsigned int GetDimension(void) const