]> 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 6dcfae1e4ec236ba539842f00d0e3e5f67779030..89a990f7e573f8b4d03011c1e0fb9b8c649afe24 100644 (file)
@@ -36,18 +36,23 @@ 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( )
-        { return( dynamic_cast< _TType* >( this->m_ITK.GetPointer( ) ) ); }
+        {
+          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
         {
+          if( this->m_ITK.GetPointer( ) == NULL )
+            this->_UpdateITK( );
           return(
             dynamic_cast< const _TType* >( this->m_ITK.GetPointer( ) )
             );
@@ -55,11 +60,17 @@ namespace cpPlugins
 
       template< class _TType = vtkObjectBase >
       inline _TType* GetVTK( )
-        { return( dynamic_cast< _TType* >( this->m_VTK.GetPointer( ) ) ); }
+        {
+          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
         {
+          if( this->m_VTK.GetPointer( ) == NULL )
+            this->_UpdateVTK( );
           return(
             dynamic_cast< const _TType* >( this->m_VTK.GetPointer( ) )
             );
@@ -69,6 +80,9 @@ namespace cpPlugins
       Object( );
       virtual ~Object( );
 
+      virtual void _UpdateITK( ) const;
+      virtual void _UpdateVTK( ) const;
+
     private:
       // Purposely not implemented
       Object( const Self& );