Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkProcessObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkProcessObject.h,v $
00005   Language:  C++
00006   Date:      $Date: 2007-08-17 20:16:10 $
00007   Version:   $Revision: 1.77 $
00008 
00009   Copyright (c) Insight Software Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012   Portions of this code are covered under the VTK copyright.
00013   See VTKCopyright.txt or http://www.kitware.com/VTKCopyright.htm for details.
00014 
00015      This software is distributed WITHOUT ANY WARRANTY; without even 
00016      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00017      PURPOSE.  See the above copyright notices for more information.
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 
00087 class ITKCommon_EXPORT ProcessObject : public Object
00088 {
00089 public:
00091   typedef ProcessObject       Self;
00092   typedef Object  Superclass;
00093   typedef SmartPointer<Self>  Pointer;
00094   typedef SmartPointer<const Self>  ConstPointer;
00095 
00097   itkTypeMacro(ProcessObject,Object);
00098 
00100   typedef DataObject::Pointer DataObjectPointer;
00101 
00103   typedef std::vector<DataObjectPointer> DataObjectPointerArray;
00104 
00108   DataObjectPointerArray& GetInputs() 
00109     {return m_Inputs;}
00110 
00112   typedef DataObjectPointerArray::size_type DataObjectPointerArraySizeType;
00113 
00118   DataObjectPointerArraySizeType GetNumberOfInputs() const
00119     {return m_Inputs.size();}
00120 
00128   virtual DataObjectPointerArraySizeType GetNumberOfValidRequiredInputs() const;
00129 
00133   DataObjectPointerArray& GetOutputs()
00134     { return m_Outputs; }
00135   DataObjectPointerArraySizeType GetNumberOfOutputs() const
00136     {return m_Outputs.size();}
00138 
00141   itkSetMacro(AbortGenerateData,bool);
00142 
00145   itkGetConstReferenceMacro(AbortGenerateData,bool);
00146 
00148   itkBooleanMacro(AbortGenerateData); 
00149 
00154   itkSetClampMacro(Progress,float,0.0f,1.0f);
00155 
00159   itkGetConstReferenceMacro(Progress,float);
00160 
00166   void UpdateProgress(float amount);
00167 
00186   virtual void Update();
00187 
00194   virtual void UpdateLargestPossibleRegion();
00195 
00208   virtual void UpdateOutputInformation();
00209 
00212   virtual void PropagateRequestedRegion(DataObject *output);
00213 
00215   virtual void UpdateOutputData(DataObject *output);
00216 
00217 
00225   virtual void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output)){};
00226 
00227 
00231   virtual void ResetPipeline();
00232 
00247   virtual DataObjectPointer MakeOutput(unsigned int idx);
00248 
00254   virtual void SetReleaseDataFlag(bool flag);
00255   virtual bool GetReleaseDataFlag() const;
00256   void ReleaseDataFlagOn() {this->SetReleaseDataFlag(true);}
00257   void ReleaseDataFlagOff() {this->SetReleaseDataFlag(false);}
00259 
00272   itkSetMacro(ReleaseDataBeforeUpdateFlag, bool);
00273   itkGetConstReferenceMacro(ReleaseDataBeforeUpdateFlag, bool);
00274   itkBooleanMacro(ReleaseDataBeforeUpdateFlag);
00276 
00277   
00279   itkSetClampMacro( NumberOfThreads, int, 1, ITK_MAX_THREADS );
00280   itkGetConstReferenceMacro( NumberOfThreads, int );
00282 
00284   MultiThreader * GetMultiThreader()
00285     {return m_Threader;}
00286 
00293   virtual void PrepareOutputs();
00294 
00295 protected:
00296   ProcessObject();
00297   ~ProcessObject();
00298   void PrintSelf(std::ostream& os, Indent indent) const;
00299   
00302   virtual void SetNthInput(unsigned int num, DataObject *input);
00303   virtual void AddInput(DataObject *input);
00304   virtual void RemoveInput(DataObject *input);
00305   itkSetMacro(NumberOfRequiredInputs,unsigned int);
00306   itkGetConstReferenceMacro(NumberOfRequiredInputs,unsigned int);
00308 
00314   virtual void PushBackInput(const DataObject *input);
00315   virtual void PopBackInput();
00316   virtual void PushFrontInput(const DataObject *input);
00317   virtual void PopFrontInput();
00319 
00320   
00322   void SetNumberOfInputs(unsigned int num);
00323 
00325   DataObject * GetInput(unsigned int idx);
00326   const DataObject * GetInput(unsigned int idx) const;
00328 
00331   virtual void SetNthOutput(unsigned int num, DataObject *output);
00332   virtual void AddOutput(DataObject *output);
00333   virtual void RemoveOutput(DataObject *output);
00334   itkSetMacro(NumberOfRequiredOutputs,unsigned int);
00335   itkGetConstReferenceMacro(NumberOfRequiredOutputs,unsigned int);
00337 
00339   void SetNumberOfOutputs(unsigned int num);
00340 
00342   DataObject * GetOutput(unsigned int idx);
00343   const DataObject * GetOutput(unsigned int idx) const;
00345 
00359   virtual void GenerateInputRequestedRegion();
00360 
00372   virtual void GenerateOutputRequestedRegion(DataObject *output);
00373 
00384   virtual void GenerateOutputInformation();
00385 
00387   virtual void GenerateData() {}
00388 
00393   virtual void PropagateResetPipeline();
00394 
00406   virtual void ReleaseInputs();
00407 
00416   virtual void CacheInputReleaseDataFlags();
00417 
00421   virtual void RestoreInputReleaseDataFlags();
00422 
00428   bool m_Updating;
00429 
00431   TimeStamp m_OutputInformationMTime;
00432 
00433 private:
00434   ProcessObject(const Self&); //purposely not implemented
00435   void operator=(const Self&); //purposely not implemented
00436 
00438   DataObjectPointerArray m_Inputs;
00439   unsigned int m_NumberOfRequiredInputs;
00440 
00442   std::vector<bool> m_CachedInputReleaseDataFlags;
00443 
00445   DataObjectPointerArray m_Outputs;
00446   unsigned int m_NumberOfRequiredOutputs;
00447 
00449   bool  m_AbortGenerateData;
00450   float m_Progress;
00451 
00454   MultiThreader::Pointer m_Threader;
00455   int m_NumberOfThreads;
00456 
00458   bool m_ReleaseDataBeforeUpdateFlag;
00459 
00461   friend class DataObject;
00462 };
00463 
00464 } // end namespace itk
00465 
00466 #endif
00467 
00468 

Generated at Mon Apr 14 14:02:24 2008 for ITK by doxygen 1.5.1 written by Dimitri van Heesch, © 1997-2000