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

itkDataObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkDataObject.h,v $
00005   Language:  C++
00006   Date:      $Date: 2005/12/03 22:15:25 $
00007   Version:   $Revision: 1.64.8.1 $
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 __itkDataObject_h
00021 #define __itkDataObject_h
00022 
00023 #include "itkObject.h"
00024 #include "itkSmartPointerForwardReference.h"
00025 #include "itkWeakPointer.h"
00026 #include "itkExceptionObject.h"
00027 
00028 namespace itk
00029 {
00030 
00031 class ProcessObject;
00032 class DataObject;
00033   
00034 /*--------------------Data Object Exceptions---------------------------*/
00035 
00037 class ITKCommon_EXPORT DataObjectError : public ExceptionObject
00038 {
00039 public:
00042   DataObjectError();
00043   
00045   virtual ~DataObjectError() throw() {}
00046   
00048   DataObjectError(const char *file, unsigned int lineNumber);
00049 
00051   DataObjectError(const std::string& file, unsigned int lineNumber);
00052 
00054   DataObjectError(const DataObjectError &orig);
00055 
00057   DataObjectError& operator=( const DataObjectError& orig);
00058 
00060   itkTypeMacro(DataObjectError, ExceptionObject);
00061 
00063   void SetDataObject(DataObject *dobj);
00064 
00066   DataObject* GetDataObject();
00067 
00068 protected:
00073   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00074     
00075 private:
00076   DataObject *m_DataObject;
00077 };
00078 
00079   
00083 class ITKCommon_EXPORT InvalidRequestedRegionError : public DataObjectError
00084 {
00085  public:
00087   InvalidRequestedRegionError();
00088   
00090   virtual ~InvalidRequestedRegionError() throw() {}
00091 
00093   InvalidRequestedRegionError(const char *file, unsigned int lineNumber);
00094 
00096   InvalidRequestedRegionError(const std::string& file, unsigned int lineNumber);
00097 
00099   InvalidRequestedRegionError(const InvalidRequestedRegionError &orig);
00100 
00102   InvalidRequestedRegionError& operator=( const InvalidRequestedRegionError& orig);
00103 
00105   itkTypeMacro(InvalidRequestedRegionError, DataObjectError);
00106 
00107 protected:
00112   virtual void PrintSelf(std::ostream& os, Indent indent) const;
00113   
00114 };
00115 
00116 
00117 /*----------------------------Data Object--------------------------------*/  
00118 
00261 class ITKCommon_EXPORT DataObject : public Object
00262 {
00263 public:
00265   typedef DataObject          Self;
00266   typedef Object  Superclass;
00267   typedef SmartPointer<Self>  Pointer;
00268   typedef SmartPointer<const Self>  ConstPointer;
00269   
00271   itkTypeMacro(DataObject,Object);
00272 
00278   void DisconnectPipeline();
00279   
00292   SmartPointerForwardReference<ProcessObject> GetSource() const;
00293 
00295   unsigned int GetSourceOutputIndex() const;
00296     
00299   virtual void Initialize();
00300 
00303   void SetReleaseDataFlag(bool flag)
00304     {
00305       m_ReleaseDataFlag = flag;
00306     }
00307   itkGetConstReferenceMacro(ReleaseDataFlag,bool);
00308   itkBooleanMacro(ReleaseDataFlag);
00309   
00313   static void SetGlobalReleaseDataFlag(const bool val);
00314   static bool GetGlobalReleaseDataFlag();
00315   void GlobalReleaseDataFlagOn() 
00316     {this->SetGlobalReleaseDataFlag(true);}
00317   void GlobalReleaseDataFlagOff() 
00318     {this->SetGlobalReleaseDataFlag(false);}
00319   
00324   void ReleaseData();
00325 
00328   bool ShouldIReleaseData() const;
00329 
00331   bool GetDataReleased() const 
00332     {return m_DataReleased;}
00333   
00344   virtual void Update();
00345 
00355   virtual void UpdateOutputInformation();
00356 
00359   virtual void PropagateRequestedRegion() throw (InvalidRequestedRegionError);
00360   virtual void UpdateOutputData();
00361   
00365   virtual void ResetPipeline();
00366 
00369   void SetPipelineMTime(unsigned long time) 
00370     {m_PipelineMTime = time;}
00371   itkGetConstReferenceMacro(PipelineMTime,unsigned long);
00372 
00374   virtual unsigned long GetUpdateMTime() const;
00375   
00384   virtual void PrepareForNewData() 
00385     {this->Initialize();}
00386 
00391   void DataHasBeenGenerated();
00392 
00393   
00397   virtual void SetRequestedRegionToLargestPossibleRegion() {};
00398 
00408   virtual bool RequestedRegionIsOutsideOfTheBufferedRegion()
00409     { return false; }
00410 
00423   virtual bool VerifyRequestedRegion() { return true; };
00424 
00434   virtual void CopyInformation(const DataObject*) {};
00435   
00441   virtual void SetRequestedRegion(DataObject *) {};
00442   
00448   virtual void Graft( const DataObject *) {};
00449   
00450 protected:
00451   DataObject();
00452   ~DataObject();
00453   void PrintSelf(std::ostream& os, Indent indent) const;
00454 
00456   virtual void PropagateResetPipeline();
00457   
00458 private:
00459   DataObject(const Self&); //purposely not implemented
00460   void operator=(const Self&); //purposely not implemented
00461 
00463   mutable WeakPointer<ProcessObject> m_Source; 
00464   mutable unsigned int m_SourceOutputIndex;
00465     
00467   TimeStamp m_UpdateMTime;  
00468 
00469   bool m_ReleaseDataFlag; //Data will release after use by a filter if on
00470   bool m_DataReleased; //Keep track of data release during pipeline execution
00471 
00474   unsigned long m_PipelineMTime;
00475 
00477   static bool m_GlobalReleaseDataFlag;
00478 
00483   bool ConnectSource(ProcessObject *s, unsigned int idx) const;
00484 
00493   bool DisconnectSource(ProcessObject *s, unsigned int idx) const;
00494   
00496   friend class ProcessObject;
00497   friend class DataObjectError;
00498   };
00499 
00500 } // end namespace itk
00501   
00502 #endif

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