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/05/10 22:56:17 $
00007   Version:   $Revision: 1.62 $
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   unsigned int GetNumberOfInputs() const
00102     {return m_Inputs.size();}
00103   
00107   DataObjectPointerArray& GetOutputs()
00108     { return m_Outputs; }
00109   unsigned int 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 
00191   virtual void PrepareOutputs();
00192 
00194   virtual void UpdateOutputData(DataObject *output);
00195 
00202   void ComputeEstimatedPipelineMemorySize( DataObject *output,
00203              unsigned long size[3] );
00204 
00210   virtual void ComputeEstimatedOutputMemorySize( DataObject *output,
00211              unsigned long *inputSize,
00212              unsigned long size[2] );
00213 
00224   virtual void GenerateOutputInformation();
00225 
00233   virtual void EnlargeOutputRequestedRegion(DataObject *itkNotUsed(output)){};
00234   
00248   virtual void GenerateInputRequestedRegion();
00249   
00261   virtual void GenerateOutputRequestedRegion(DataObject *output);
00262 
00266   virtual void ResetPipeline();
00267 
00282   virtual DataObjectPointer MakeOutput(unsigned int idx);
00283   
00287   virtual void SetReleaseDataFlag(bool flag);
00288   virtual bool GetReleaseDataFlag();
00289   void ReleaseDataFlagOn() {SetReleaseDataFlag(true);}
00290   void ReleaseDataFlagOff() {SetReleaseDataFlag(false);}
00291   
00293   itkSetClampMacro( NumberOfThreads, int, 1, ITK_MAX_THREADS );
00294   itkGetConstReferenceMacro( NumberOfThreads, int );
00295   
00297   MultiThreader * GetMultiThreader()
00298     {return m_Threader;}
00299 
00300 protected:
00301   ProcessObject();
00302   ~ProcessObject();
00303   void PrintSelf(std::ostream& os, Indent indent) const;
00304   
00307   virtual void SetNthInput(unsigned int num, DataObject *input);
00308   virtual void AddInput(DataObject *input);
00309   virtual void RemoveInput(DataObject *input);
00310   itkSetMacro(NumberOfRequiredInputs,unsigned int);
00311   itkGetConstReferenceMacro(NumberOfRequiredInputs,unsigned int);
00312   
00315   virtual void SetNthOutput(unsigned int num, DataObject *output);
00316   virtual void AddOutput(DataObject *output);
00317   virtual void RemoveOutput(DataObject *output);
00318   itkSetMacro(NumberOfRequiredOutputs,unsigned int);
00319   itkGetConstReferenceMacro(NumberOfRequiredOutputs,unsigned int);
00320   
00322   virtual void GenerateData() {}
00323 
00325   void SetNumberOfInputs(unsigned int num);
00326 
00328   DataObject * GetInput(unsigned int idx);
00329 
00331   void SetNumberOfOutputs(unsigned int num);
00332 
00334   DataObject * GetOutput(unsigned int idx);
00335 
00338   virtual void PropagateResetPipeline();
00339 
00345   bool m_Updating;
00346 
00348   TimeStamp m_InformationTime;
00349 
00350 private:
00351   ProcessObject(const Self&); //purposely not implemented
00352   void operator=(const Self&); //purposely not implemented
00353 
00355   std::vector<DataObjectPointer> m_Inputs;
00356   unsigned int m_NumberOfRequiredInputs;
00357   
00359   std::vector<DataObjectPointer> m_Outputs;
00360   unsigned int m_NumberOfRequiredOutputs;
00361   
00363   bool  m_AbortGenerateData;
00364   float m_Progress;
00365   
00368   MultiThreader::Pointer m_Threader;
00369   int m_NumberOfThreads;
00370   
00372   friend class DataObject;
00373 };
00374 
00375 } // end namespace itk
00376 
00377 #endif
00378 

Generated at Wed Mar 12 01:13:09 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000