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: 2004/11/09 19:57:32 $
00007   Version:   $Revision: 1.74 $
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 
00115   std::vector<DataObjectPointer>::size_type GetNumberOfInputs() const
00116     {return m_Inputs.size();}
00117 
00125   virtual std::vector<DataObjectPointer>::size_type GetNumberOfValidRequiredInputs() const;
00126   
00130   DataObjectPointerArray& GetOutputs()
00131     { return m_Outputs; }
00132   std::vector<DataObjectPointer>::size_type GetNumberOfOutputs() const
00133     {return m_Outputs.size();}
00134       
00137   itkSetMacro(AbortGenerateData,bool);
00138 
00141   itkGetConstReferenceMacro(AbortGenerateData,bool);
00142   
00144   itkBooleanMacro(AbortGenerateData); 
00145   
00150   itkSetClampMacro(Progress,float,0.0,1.0);
00151 
00155   itkGetConstReferenceMacro(Progress,float);
00156 
00162   void UpdateProgress(float amount);
00163   
00182   virtual void Update();
00183 
00190   virtual void UpdateLargestPossibleRegion();
00191 
00204   virtual void UpdateOutputInformation();
00205 
00208   virtual void PropagateRequestedRegion(DataObject *output);
00209 
00211   virtual void UpdateOutputData(DataObject *output);
00212 
00213 
00221   virtual void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output)){};
00222   
00223 
00227   virtual void ResetPipeline();
00228 
00243   virtual DataObjectPointer MakeOutput(unsigned int idx);
00244   
00250   virtual void SetReleaseDataFlag(bool flag);
00251   virtual bool GetReleaseDataFlag() const;
00252   void ReleaseDataFlagOn() {this->SetReleaseDataFlag(true);}
00253   void ReleaseDataFlagOff() {this->SetReleaseDataFlag(false);}
00254 
00267   itkSetMacro(ReleaseDataBeforeUpdateFlag, bool);
00268   itkGetConstReferenceMacro(ReleaseDataBeforeUpdateFlag, bool);
00269   itkBooleanMacro(ReleaseDataBeforeUpdateFlag);
00270    
00271   
00273   itkSetClampMacro( NumberOfThreads, int, 1, ITK_MAX_THREADS );
00274   itkGetConstReferenceMacro( NumberOfThreads, int );
00275   
00277   MultiThreader * GetMultiThreader()
00278     {return m_Threader;}
00279 
00286   virtual void PrepareOutputs();
00287 
00288 protected:
00289   ProcessObject();
00290   ~ProcessObject();
00291   void PrintSelf(std::ostream& os, Indent indent) const;
00292   
00295   virtual void SetNthInput(unsigned int num, DataObject *input);
00296   virtual void AddInput(DataObject *input);
00297   virtual void RemoveInput(DataObject *input);
00298   itkSetMacro(NumberOfRequiredInputs,unsigned int);
00299   itkGetConstReferenceMacro(NumberOfRequiredInputs,unsigned int);
00300   
00302   void SetNumberOfInputs(unsigned int num);
00303 
00305   DataObject * GetInput(unsigned int idx);
00306   const DataObject * GetInput(unsigned int idx) const;
00307 
00310   virtual void SetNthOutput(unsigned int num, DataObject *output);
00311   virtual void AddOutput(DataObject *output);
00312   virtual void RemoveOutput(DataObject *output);
00313   itkSetMacro(NumberOfRequiredOutputs,unsigned int);
00314   itkGetConstReferenceMacro(NumberOfRequiredOutputs,unsigned int);
00315 
00317   void SetNumberOfOutputs(unsigned int num);
00318 
00320   DataObject * GetOutput(unsigned int idx);
00321   const DataObject * GetOutput(unsigned int idx) const;
00322 
00336   virtual void GenerateInputRequestedRegion();
00337   
00349   virtual void GenerateOutputRequestedRegion(DataObject *output);
00350 
00361   virtual void GenerateOutputInformation();
00362   
00364   virtual void GenerateData() {}
00365 
00369   virtual void PropagateResetPipeline();
00370 
00382   virtual void ReleaseInputs();
00383 
00392   virtual void CacheInputReleaseDataFlags();
00393 
00397   virtual void RestoreInputReleaseDataFlags();
00398   
00404   bool m_Updating;
00405 
00407   TimeStamp m_OutputInformationMTime;
00408 
00409 private:
00410   ProcessObject(const Self&); //purposely not implemented
00411   void operator=(const Self&); //purposely not implemented
00412 
00414   std::vector<DataObjectPointer> m_Inputs;
00415   unsigned int m_NumberOfRequiredInputs;
00416 
00418   std::vector<bool> m_CachedInputReleaseDataFlags;
00419   
00421   std::vector<DataObjectPointer> m_Outputs;
00422   unsigned int m_NumberOfRequiredOutputs;
00423   
00425   bool  m_AbortGenerateData;
00426   float m_Progress;
00427   
00430   MultiThreader::Pointer m_Threader;
00431   int m_NumberOfThreads;
00432 
00434   bool m_ReleaseDataBeforeUpdateFlag;
00435   
00437   friend class DataObject;
00438 };
00439 
00440 } // end namespace itk
00441 
00442 #endif
00443 

Generated at Wed May 24 23:53:27 2006 for ITK by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2000