X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FImage.cxx;fp=lib%2FcpPlugins%2FImage.cxx;h=994e643880bccc3c0dd382b10b865039e698adfb;hb=201c5026430f9bcc33f9db6a39f5d03db096c860;hp=0000000000000000000000000000000000000000;hpb=aa77db36cc1d87ba014c982a235239c3c87224f3;p=cpPlugins.git diff --git a/lib/cpPlugins/Image.cxx b/lib/cpPlugins/Image.cxx new file mode 100644 index 0000000..994e643 --- /dev/null +++ b/lib/cpPlugins/Image.cxx @@ -0,0 +1,66 @@ +#include + +#include +#include +#include + +// ------------------------------------------------------------------------- +void cpPlugins::Image:: +SetITK( itk::LightObject* o ) +{ + this->Superclass::SetITK( o ); + bool s = this->_ITK_2_VTK_0_Scalar< 2 >( o ); + if( !s ) s = this->_ITK_2_VTK_0_Scalar< 3 >( o ); + if( !s ) s = this->_ITK_2_VTK_0_Color< 2 >( o ); + if( !s ) s = this->_ITK_2_VTK_0_Color< 3 >( o ); + if( !s ) + { + this->m_VTKObject = NULL; + this->m_ITKvVTK = NULL; + + } // fi + this->Modified( ); +} + +// ------------------------------------------------------------------------- +void cpPlugins::Image:: +SetVTK( vtkObjectBase* o ) +{ + this->Superclass::SetVTK( o ); + std::cerr << "Image: TODO this!!!!" << std::endl; + std::exit( 1 ); +} + +// ------------------------------------------------------------------------- +cpPlugins::Image:: +Image( ) + : Superclass( ) +{ +} + +// ------------------------------------------------------------------------- +cpPlugins::Image:: +~Image( ) +{ +} + +// ------------------------------------------------------------------------- +void cpPlugins::Image:: +_CreateVTKActor( ) const +{ + vtkImageData* image = + const_cast< vtkImageData* >( this->GetVTK< vtkImageData >( ) ); + if( image != NULL ) + { + vtkImageSliceMapper* mapper = vtkImageSliceMapper::New( ); + vtkImageActor* actor = vtkImageActor::New( ); + mapper->SetInputData( image ); + actor->SetMapper( mapper ); + actor->GetProperty( )->SetInterpolationTypeToNearest( ); + this->m_Actor = actor; + mapper->Delete( ); + + } // fi +} + +// eof - $RCSfile$