+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPlugins::DataObjects::Image::
+_ITK_2_VTK_0( _TImage* image )
+{
+ cpPlugins_Demangle_Image_ScalarPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, );
+ cpPlugins_Demangle_Image_ColorPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, );
+ cpPlugins_Demangle_Image_VectorPixels( image, _ITK_2_VTK_1, _TImage::ImageDimension, );
+ {
+ this->m_VTK = NULL;
+ this->m_ITKvVTK = NULL;
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TImage >
+void cpPlugins::DataObjects::Image::
+_ITK_2_VTK_1( _TImage* image )
+{
+ typedef itk::ImageToVTKImageFilter< _TImage > _TFilter;
+ _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
+ if( f == NULL )
+ {
+ typename _TFilter::Pointer nf = _TFilter::New( );
+ this->m_ITKvVTK = nf;
+ f = nf.GetPointer( );
+
+ } // fi
+ f->SetInput( image );
+ f->Update( );
+
+ // Keep object track
+ this->m_ITK = image;
+ this->m_VTK = f->GetOutput( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPixel >
+bool cpPlugins::DataObjects::Image::
+_VTK_2_ITK_0( vtkImageData* image )
+{
+ bool success = false;
+ unsigned int dim = image->GetDataDimension( );
+#ifdef cpPlugins_CONFIG_VISUAL_DIMENSIONS_2
+ if( dim == 2 ) success = this->_VTK_2_ITK_1< _TPixel, 2 >( image );
+#endif // cpPlugins_CONFIG_VISUAL_DIMENSIONS_2
+#ifdef cpPlugins_CONFIG_VISUAL_DIMENSIONS_3
+ if( dim == 3 ) success = this->_VTK_2_ITK_1< _TPixel, 3 >( image );
+#endif // cpPlugins_CONFIG_VISUAL_DIMENSIONS_2
+ return( success );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPixel, unsigned int _VDim >
+bool cpPlugins::DataObjects::Image::
+_VTK_2_ITK_1( vtkImageData* image )
+{
+ typedef itk::Image< _TPixel, _VDim > _TImage;
+ typedef itk::VTKImageToImageFilter< _TImage > _TFilter;
+ _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
+ if( f == NULL )
+ {
+ typename _TFilter::Pointer nf = _TFilter::New( );
+ this->m_ITKvVTK = nf;
+ f = nf.GetPointer( );
+
+ } // fi
+ f->SetInput( image );
+ f->Update( );
+
+ // Keep object track
+ this->m_VTK = image;
+ this->m_ITK = f->GetOutput( );
+ return( true );
+}
+