X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FImage.hxx;h=ab2c5ea00c9b6399ce0afa635dd1bba997b50805;hb=273699a71c538630c162de031f0c95014319311d;hp=2f5f1d59a5071adee381adc82ef18361ad95d9fd;hpb=d1d816d1eaf980d5cd266798b8f7a0bbb089a383;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/Image.hxx b/lib/cpPlugins/Interface/Image.hxx index 2f5f1d5..ab2c5ea 100644 --- a/lib/cpPlugins/Interface/Image.hxx +++ b/lib/cpPlugins/Interface/Image.hxx @@ -1,8 +1,6 @@ #ifndef __CPPLUGINS__INTERFACE__IMAGE__HXX__ #define __CPPLUGINS__INTERFACE__IMAGE__HXX__ -#include - #include #include @@ -50,9 +48,16 @@ SetITK( itk::Object* object ) this->m_VTKObject = NULL; this->m_ITKvVTKConnection = NULL; this->Modified( ); + return; } // fi + // --------- TODO --------------- + typename I::DirectionType norm_dir; + norm_dir.SetIdentity( ); + image->SetDirection( norm_dir ); + // --------- TODO --------------- + // Connect it to VTK cpPlugins_VTKImage_Demangle_AllDims( I, char, image ); else cpPlugins_VTKImage_Demangle_AllDims( I, short, image ); @@ -112,21 +117,28 @@ void cpPlugins::Interface::Image:: _ITK_2_VTK( itk::Object* object ) { typedef itk::Image< P, D > _I; + typedef itk::ImageToVTKImageFilter< _I > _I2Vtk; - // Check if input object has the desired type + // Check (yes, again!!!) if input object has the desired type _I* image = dynamic_cast< _I* >( object ); if( image == NULL ) return; // Connect it to VTK - typename itk::ImageToVTKImageFilter< _I >::Pointer f = - itk::ImageToVTKImageFilter< _I >::New( ); + _I2Vtk* f = + dynamic_cast< _I2Vtk* >( this->m_ITKvVTKConnection.GetPointer( ) ); + if( f == NULL ) + { + typename _I2Vtk::Pointer nf = _I2Vtk::New( ); + this->m_ITKvVTKConnection = nf; + f = nf.GetPointer( ); + + } // fi f->SetInput( image ); f->Update( ); - // Keep objects + // Keep object track this->m_VTKObject = f->GetOutput( ); - this->m_ITKvVTKConnection = f; } #ifndef cpPlugins_Interface_EXPORTS