00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
#ifndef __itkProcessObject_h
00021
#define __itkProcessObject_h
00022
00023
#include "itkObject.h"
00024
#include "itkDataObject.h"
00025
#include "itkMultiThreader.h"
00026
#include "itkObjectFactory.h"
00027
#include <vector>
00028
00029
namespace itk
00030 {
00031
00078 class ITKCommon_EXPORT ProcessObject :
public Object
00079 {
00080
public:
00082 typedef ProcessObject
Self;
00083 typedef Object Superclass;
00084 typedef SmartPointer<Self> Pointer;
00085 typedef SmartPointer<const Self> ConstPointer;
00086
00088
itkTypeMacro(ProcessObject,
Object);
00089
00091 typedef DataObject::Pointer DataObjectPointer;
00092
00094 typedef std::vector<DataObjectPointer>
DataObjectPointerArray;
00095
00099 DataObjectPointerArray& GetInputs()
00100 {
return m_Inputs;}
00101 std::vector<DataObjectPointer>::size_type GetNumberOfInputs()
const
00102
{
return m_Inputs.size();}
00103
00107 DataObjectPointerArray& GetOutputs()
00108 {
return m_Outputs; }
00109 std::vector<DataObjectPointer>::size_type GetNumberOfOutputs()
const
00110 {
return m_Outputs.size();}
00111
00114
itkSetMacro(AbortGenerateData,
bool);
00115
00118
itkGetConstReferenceMacro(AbortGenerateData,
bool);
00119
00121
itkBooleanMacro(AbortGenerateData);
00122
00127
itkSetClampMacro(Progress,
float,0.0,1.0);
00128
00132
itkGetConstReferenceMacro(Progress,
float);
00133
00139
void UpdateProgress(
float amount);
00140
00159
virtual void Update();
00160
00167
virtual void UpdateLargestPossibleRegion();
00168
00181
virtual void UpdateOutputInformation();
00182
00185
virtual void PropagateRequestedRegion(
DataObject *output);
00186
00188
virtual void UpdateOutputData(
DataObject *output);
00189
00190
00198
virtual void EnlargeOutputRequestedRegion(
DataObject *
itkNotUsed(output)){};
00199
00200
00204
virtual void ResetPipeline();
00205
00220
virtual DataObjectPointer MakeOutput(
unsigned int idx);
00221
00225
virtual void SetReleaseDataFlag(
bool flag);
00226
virtual bool GetReleaseDataFlag();
00227
void ReleaseDataFlagOn() {SetReleaseDataFlag(
true);}
00228
void ReleaseDataFlagOff() {SetReleaseDataFlag(
false);}
00229
00231
itkSetClampMacro( NumberOfThreads,
int, 1, ITK_MAX_THREADS );
00232
itkGetConstReferenceMacro( NumberOfThreads,
int );
00233
00235
MultiThreader * GetMultiThreader()
00236 {
return m_Threader;}
00237
00238
protected:
00239 ProcessObject();
00240 ~ProcessObject();
00241
void PrintSelf(std::ostream& os,
Indent indent)
const;
00242
00245
virtual void SetNthInput(
unsigned int num,
DataObject *input);
00246
virtual void AddInput(
DataObject *input);
00247
virtual void RemoveInput(
DataObject *input);
00248
itkSetMacro(NumberOfRequiredInputs,
unsigned int);
00249
itkGetConstReferenceMacro(NumberOfRequiredInputs,
unsigned int);
00250
00264
virtual void GenerateInputRequestedRegion();
00265
00277
virtual void GenerateOutputRequestedRegion(
DataObject *output);
00278
00283
virtual void PrepareOutputs();
00284
00295
virtual void ReleaseInputs();
00296
00307
virtual void GenerateOutputInformation();
00308
00311
virtual void SetNthOutput(
unsigned int num,
DataObject *output);
00312
virtual void AddOutput(
DataObject *output);
00313
virtual void RemoveOutput(
DataObject *output);
00314
itkSetMacro(NumberOfRequiredOutputs,
unsigned int);
00315
itkGetConstReferenceMacro(NumberOfRequiredOutputs,
unsigned int);
00316
00318
virtual void GenerateData() {}
00319
00321
void SetNumberOfInputs(
unsigned int num);
00322
00324 DataObject * GetInput(
unsigned int idx);
00325
00327
void SetNumberOfOutputs(
unsigned int num);
00328
00330
DataObject * GetOutput(
unsigned int idx);
00331
00334
virtual void PropagateResetPipeline();
00335
00341
bool m_Updating;
00342
00344
TimeStamp m_InformationTime;
00345
00346
private:
00347 ProcessObject(
const Self&);
00348
void operator=(
const Self&);
00349
00351 std::vector<DataObjectPointer> m_Inputs;
00352
unsigned int m_NumberOfRequiredInputs;
00353
00355 std::vector<DataObjectPointer> m_Outputs;
00356
unsigned int m_NumberOfRequiredOutputs;
00357
00359
bool m_AbortGenerateData;
00360
float m_Progress;
00361
00364
MultiThreader::Pointer m_Threader;
00365
int m_NumberOfThreads;
00366
00368
friend class DataObject;
00369 };
00370
00371 }
00372
00373
#endif
00374