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: 2003/09/10 14:29:05 $ 00007 Version: $Revision: 1.56 $ 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 00135 class ITKCommon_EXPORT DataObject : public Object 00136 { 00137 public: 00139 typedef DataObject Self; 00140 typedef Object Superclass; 00141 typedef SmartPointer<Self> Pointer; 00142 typedef SmartPointer<const Self> ConstPointer; 00143 00145 itkTypeMacro(DataObject,Object); 00146 00152 void DisconnectPipeline() const; 00153 00166 SmartPointerForwardReference<ProcessObject> GetSource() const; 00167 00169 unsigned int GetSourceOutputIndex() const; 00170 00173 virtual void Initialize(); 00174 00177 itkSetMacro(ReleaseDataFlag,bool); 00178 itkGetMacro(ReleaseDataFlag,bool); 00179 itkBooleanMacro(ReleaseDataFlag); 00180 00184 static void SetGlobalReleaseDataFlag(const bool val); 00185 static bool GetGlobalReleaseDataFlag(); 00186 void GlobalReleaseDataFlagOn() 00187 {this->SetGlobalReleaseDataFlag(true);} 00188 void GlobalReleaseDataFlagOff() 00189 {this->SetGlobalReleaseDataFlag(false);} 00190 00195 void ReleaseData(); 00196 00199 bool ShouldIReleaseData() const; 00200 00202 bool GetDataReleased() const 00203 {return m_DataReleased;} 00204 00215 virtual void Update(); 00216 00225 virtual void UpdateOutputInformation() = 0; 00226 00228 virtual void PropagateRequestedRegion() throw (InvalidRequestedRegionError); 00229 virtual void UpdateOutputData(); 00230 00234 virtual void ResetPipeline(); 00235 00237 void SetPipelineMTime(unsigned long time) 00238 {m_PipelineMTime = time;} 00239 itkGetConstMacro(PipelineMTime,unsigned long); 00240 00249 virtual void PrepareForNewData() 00250 {this->Initialize();} 00251 00256 void DataHasBeenGenerated(); 00257 00258 00262 virtual void SetRequestedRegionToLargestPossibleRegion() = 0; 00263 00273 virtual bool RequestedRegionIsOutsideOfTheBufferedRegion() = 0; 00274 00285 virtual bool VerifyRequestedRegion() = 0; 00286 00296 virtual void CopyInformation(const DataObject*) {}; 00297 00301 virtual void SetRequestedRegion(DataObject *data) = 0; 00302 00303 protected: 00304 DataObject(); 00305 ~DataObject(); 00306 void PrintSelf(std::ostream& os, Indent indent) const; 00307 00309 virtual void PropagateResetPipeline(); 00310 00311 // Was the update extent propagated down the pipeline? 00312 bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion; 00313 00314 // First update, the update region will be set to the largest possible 00315 // region. 00316 bool m_RequestedRegionInitialized; 00317 00318 private: 00319 DataObject(const Self&); //purposely not implemented 00320 void operator=(const Self&); //purposely not implemented 00321 00323 mutable WeakPointer<ProcessObject> m_Source; 00324 mutable unsigned int m_SourceOutputIndex; 00325 00327 TimeStamp m_UpdateTime; 00328 00329 bool m_ReleaseDataFlag; //Data will release after use by a filter if on 00330 bool m_DataReleased; //Keep track of data release during pipeline execution 00331 00334 unsigned long m_PipelineMTime; 00335 00337 static bool m_GlobalReleaseDataFlag; 00338 00343 void ConnectSource(ProcessObject *s, unsigned int idx) const; 00344 00353 void DisconnectSource(ProcessObject *s, unsigned int idx) const; 00354 00356 friend class ProcessObject; 00357 friend class DataObjectError; 00358 }; 00359 00360 } // end namespace itk 00361 00362 #endif

Generated at Sat Mar 31 02:16:56 2007 for ITK by doxygen 1.3.8 written by Dimitri van Heesch, © 1997-2000