From b8c83716fa84e9a4d9d19bff310fa1c4172be7ce Mon Sep 17 00:00:00 2001 From: =?utf8?q?Leonardo=20Fl=C3=B3rez-Valencia?= Date: Mon, 20 Feb 2017 15:51:28 -0500 Subject: [PATCH] ... --- .../ITKRasterFilters/RasterImageFilter.cxx | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) 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( ); -- 2.45.0