X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FImage.cxx;h=48b90740a68b7a0e6753c344ed32ee2528ac44b9;hb=00b54bc0344d74f31df8b93f7c28a07cfc8d6873;hp=d309a1120473af6ef85ab97cd85004bba6e6c908;hpb=b007dfbd638db86c5e8da53299da58f4c9d9e8b8;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Image.cxx b/lib/cpPlugins/Interface/Image.cxx index d309a11..48b9074 100644 --- a/lib/cpPlugins/Interface/Image.cxx +++ b/lib/cpPlugins/Interface/Image.cxx @@ -1,30 +1,18 @@ #include -#define ITK_MANUAL_INSTANTIATION -#include -#include -#include - -// ------------------------------------------------------------------------- -#define cpPlugins_Interface_Image_Dimension( d, dobj, func ) \ - if( dynamic_cast< itk::ImageBase< d >* >( dobj ) != NULL ) \ - this->func< d >( ) - -// ------------------------------------------------------------------------- -#define cpPlugins_Interface_Image_Pixel( p, d, dobj, func ) \ - if( dynamic_cast< itk::Image< p, d >* >( dobj ) != NULL ) \ - this->func< p, d >( ) - // ------------------------------------------------------------------------- -#define cpPlugins_Interface_Image_RGB( p, d, dobj, func ) \ - if( dynamic_cast< itk::Image< itk::RGBPixel< p >, d >* >( dobj ) != NULL ) \ - this->func< itk::RGBPixel< p >, d >( ) +void cpPlugins::Interface::Image:: +SetVTK( vtkObject* image ) +{ + // this->m_VTKObject = image; + std::cerr << "Image: TODO this!!!!" << std::endl; + std::exit( 1 ); +} // ------------------------------------------------------------------------- cpPlugins::Interface::Image:: Image( ) - : Superclass( ), - m_VTKImageData( NULL ) + : Superclass( ) { } @@ -34,75 +22,4 @@ cpPlugins::Interface::Image:: { } -// ------------------------------------------------------------------------- -std::string cpPlugins::Interface::Image:: -GetClassName( ) const -{ - return( "cpPlugins::Interface::Image" ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::Interface::Image:: -SetDataObject( itk::DataObject* dobj ) -{ - this->Superclass::SetDataObject( dobj ); - - // WARNING: Only 2 and 3 dimensions at this moment - cpPlugins_Interface_Image_Dimension( 2, dobj, _ConnectToVTK_0 ); - else cpPlugins_Interface_Image_Dimension( 3, dobj, _ConnectToVTK_0 ); -} - -// ------------------------------------------------------------------------- -vtkImageData* cpPlugins::Interface::Image:: -GetVTKImageData( ) const -{ - return( this->m_VTKImageData ); -} - -// ------------------------------------------------------------------------- -template< unsigned int D > -void cpPlugins::Interface::Image:: -_ConnectToVTK_0( ) -{ - itk::DataObject* dobj = this->Superclass::GetDataObject( ); - - cpPlugins_Interface_Image_Pixel( char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( unsigned char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( unsigned short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( unsigned int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( unsigned long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( float, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_Pixel( double, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( unsigned char, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( unsigned short, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( unsigned int, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( unsigned long, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( float, D, dobj, _ConnectToVTK_1 ); - else cpPlugins_Interface_Image_RGB( double, D, dobj, _ConnectToVTK_1 ); -} - -// ------------------------------------------------------------------------- -template< class P, unsigned int D > -void cpPlugins::Interface::Image:: -_ConnectToVTK_1( ) -{ - typedef itk::Image< P, D > _TImage; - typedef itk::ImageToVTKImageFilter< _TImage > _TFilter; - - _TImage* img = - dynamic_cast< _TImage* >( this->Superclass::GetDataObject( ) ); - typename _TFilter::Pointer filter = _TFilter::New( ); - filter->SetInput( img ); - filter->Update( ); - this->m_VTKImageData = filter->GetOutput( ); - this->m_Image2VTKImageData = filter; -} - // eof - $RCSfile$