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: 2002/11/16 15:35:09 $
00007   Version:   $Revision: 1.64 $
00008 
00009   Copyright (c) 2002 Insight 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 
00078 class ITK_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 
00196   void ComputeEstimatedPipelineMemorySize( DataObject *output,
00197              unsigned long size[3] );
00198 
00204   virtual void ComputeEstimatedOutputMemorySize( DataObject *output,
00205              unsigned long *inputSize,
00206              unsigned long size[2] );
00207 
00215   virtual void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output)){};
00216   
00217 
00221   virtual void ResetPipeline();
00222 
00237   virtual DataObjectPointer MakeOutput(unsigned int idx);
00238   
00242   virtual void SetReleaseDataFlag(bool flag);
00243   virtual bool GetReleaseDataFlag();
00244   void ReleaseDataFlagOn() {SetReleaseDataFlag(true);}
00245   void ReleaseDataFlagOff() {SetReleaseDataFlag(false);}
00246   
00248   itkSetClampMacro( NumberOfThreads, int, 1, ITK_MAX_THREADS );
00249   itkGetConstReferenceMacro( NumberOfThreads, int );
00250   
00252   MultiThreader * GetMultiThreader()
00253     {return m_Threader;}
00254 
00255 protected:
00256   ProcessObject();
00257   ~ProcessObject();
00258   void PrintSelf(std::ostream& os, Indent indent) const;
00259   
00262   virtual void SetNthInput(unsigned int num, DataObject *input);
00263   virtual void AddInput(DataObject *input);
00264   virtual void RemoveInput(DataObject *input);
00265   itkSetMacro(NumberOfRequiredInputs,unsigned int);
00266   itkGetConstReferenceMacro(NumberOfRequiredInputs,unsigned int);
00267   
00281   virtual void GenerateInputRequestedRegion();
00282   
00294   virtual void GenerateOutputRequestedRegion(DataObject *output);
00295 
00300   virtual void PrepareOutputs();
00301 
00312   virtual void GenerateOutputInformation();
00313   
00316   virtual void SetNthOutput(unsigned int num, DataObject *output);
00317   virtual void AddOutput(DataObject *output);
00318   virtual void RemoveOutput(DataObject *output);
00319   itkSetMacro(NumberOfRequiredOutputs,unsigned int);
00320   itkGetConstReferenceMacro(NumberOfRequiredOutputs,unsigned int);
00321   
00323   virtual void GenerateData() {}
00324 
00326   void SetNumberOfInputs(unsigned int num);
00327 
00329   DataObject * GetInput(unsigned int idx);
00330 
00332   void SetNumberOfOutputs(unsigned int num);
00333 
00335   DataObject * GetOutput(unsigned int idx);
00336 
00339   virtual void PropagateResetPipeline();
00340 
00346   bool m_Updating;
00347 
00349   TimeStamp m_InformationTime;
00350 
00351 private:
00352   ProcessObject(const Self&); //purposely not implemented
00353   void operator=(const Self&); //purposely not implemented
00354 
00356   std::vector<DataObjectPointer> m_Inputs;
00357   unsigned int m_NumberOfRequiredInputs;
00358   
00360   std::vector<DataObjectPointer> m_Outputs;
00361   unsigned int m_NumberOfRequiredOutputs;
00362   
00364   bool  m_AbortGenerateData;
00365   float m_Progress;
00366   
00369   MultiThreader::Pointer m_Threader;
00370   int m_NumberOfThreads;
00371   
00373   friend class DataObject;
00374 };
00375 
00376 } // end namespace itk
00377 
00378 #endif
00379 

Generated at Fri May 21 01:15:13 2004 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000