From: Leonardo Flórez-Valencia Date: Mon, 20 Feb 2017 20:51:28 +0000 (-0500) Subject: ... X-Git-Tag: v0.1~6 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?p=cpPlugins.git;a=commitdiff_plain;h=b8c83716fa84e9a4d9d19bff310fa1c4172be7ce ... --- diff --git a/plugins/ITKRasterFilters/RasterImageFilter.cxx b/plugins/ITKRasterFilters/RasterImageFilter.cxx index 2332714..097566c 100644 --- a/plugins/ITKRasterFilters/RasterImageFilter.cxx +++ b/plugins/ITKRasterFilters/RasterImageFilter.cxx @@ -2,6 +2,7 @@ #include #include +#include #include #include @@ -32,10 +33,19 @@ cpPluginsITKRasterFilters::RasterImageFilter:: void cpPluginsITKRasterFilters::RasterImageFilter:: _GenerateData( ) { - auto o = this->GetInputData( "Input" ); - cpPlugins_Demangle_Mesh_Meshes_1( o, _GD0_2D, 2 ) - cpPlugins_Demangle_Mesh_Meshes_1( o, _GD0_3D, 3 ) - this->_Error( "Invalid input image dimension." ); + auto mesh = this->GetInputData< vtkPolyData >( "Input" ); + double bounds[ 6 ]; + mesh->GetBounds( bounds ); + double zdiff = std::fabs( bounds[ 5 ] - bounds[ 4 ] ); + if( zdiff > 1e-5 ) + { + cpPlugins_Demangle_Mesh_Meshes_1( + this->GetInputData( "Input" ), _GD0_3D, 3 + ) + this->_Error( "Invalid input image dimension." ); + } + else + this->_GD0_2D( mesh ); } // ------------------------------------------------------------------------- @@ -73,7 +83,12 @@ _GD1_2D( _TMesh* mesh ) filter->SetTemplate( this->GetInputData< _TBaseImage >( "TemplateImage" ) ); filter->ClearPoints( ); for( unsigned long i = 0; i < mesh->GetNumberOfPoints( ); ++i ) - filter->AddPoint( mesh->GetPoint( i ) ); + { + double pnt[ 3 ]; + mesh->GetPoint( i, pnt ); + filter->AddPoint( pnt ); + + } // rof // Execute and connect output filter->Update( );