]> Creatis software - cpPlugins.git/blobdiff - lib/cpPlugins/BaseObjects/Object.h
Cast image filter added. ROI filter modified.
[cpPlugins.git] / lib / cpPlugins / BaseObjects / Object.h
index 4d0ab88105fde6369e979fc6f0085928435f4d7d..89a990f7e573f8b4d03011c1e0fb9b8c649afe24 100644 (file)
@@ -36,27 +36,53 @@ namespace cpPlugins
       void SetViewCoords( float x, float y );
 
       virtual void Modified( ) const cpPlugins_OVERRIDE;
-      virtual itk::ModifiedTimeType GetMTime( ) const cpPlugins_OVERRIDE;
 
       virtual void SetITK( itk::LightObject* o );
       virtual void SetVTK( vtkObjectBase* o );
 
       template< class _TType = itk::LightObject >
-        inline _TType* GetITK( );
+      inline _TType* GetITK( )
+        {
+          if( this->m_ITK.GetPointer( ) == NULL )
+            this->_UpdateITK( );
+          return( dynamic_cast< _TType* >( this->m_ITK.GetPointer( ) ) );
+        }
 
       template< class _TType = itk::LightObject >
-        inline const _TType* GetITK( ) const;
+      inline const _TType* GetITK( ) const
+        {
+          if( this->m_ITK.GetPointer( ) == NULL )
+            this->_UpdateITK( );
+          return(
+            dynamic_cast< const _TType* >( this->m_ITK.GetPointer( ) )
+            );
+        }
 
       template< class _TType = vtkObjectBase >
-        inline _TType* GetVTK( );
+      inline _TType* GetVTK( )
+        {
+          if( this->m_VTK.GetPointer( ) == NULL )
+            this->_UpdateVTK( );
+          return( dynamic_cast< _TType* >( this->m_VTK.GetPointer( ) ) );
+        }
 
       template< class _TType = vtkObjectBase >
-        inline const _TType* GetVTK( ) const;
+      inline const _TType* GetVTK( ) const
+        {
+          if( this->m_VTK.GetPointer( ) == NULL )
+            this->_UpdateVTK( );
+          return(
+            dynamic_cast< const _TType* >( this->m_VTK.GetPointer( ) )
+            );
+        }
 
     protected:
       Object( );
       virtual ~Object( );
 
+      virtual void _UpdateITK( ) const;
+      virtual void _UpdateVTK( ) const;
+
     private:
       // Purposely not implemented
       Object( const Self& );
@@ -74,8 +100,6 @@ namespace cpPlugins
 
 } // ecapseman
 
-#include <cpPlugins/BaseObjects/Object.hxx>
-
 #endif // __cpPlugins__BaseObjects__Object__h__
 
 // eof - $RCSfile$