#include <cpInstances/DataObjects/Image.h>
#include <cpInstances/DataObjects/Mesh.h>
+#include <vtkPolyData.h>
#include <itkTriangleMeshToBinaryImageFilter.h>
#include <cpExtensions/Algorithms/RasterContourFilter.h>
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 );
}
// -------------------------------------------------------------------------
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( );