#include <cpPluginsImageMeshFilters/TriangleMeshToBinaryImageFilter.h>
+#include <cpPlugins/BoundingBox.h>
#include <cpPlugins/Image.h>
#include <cpPlugins/Mesh.h>
: Superclass( )
{
this->_AddInput( "Input" );
+ this->_AddInput( "BoundingBox", false );
this->_AddOutput< cpPlugins::Image >( "Output" );
this->m_Parameters.ConfigureAsUint( "InsideValue" );
std::string cpPluginsImageMeshFilters::TriangleMeshToBinaryImageFilter::
_GD1( _TMesh* mesh )
{
+ typedef cpPlugins::BoundingBox _TBB;
typedef itk::Image< _TPixel, _TMesh::PointDimension > _TImage;
typedef itk::TriangleMeshToBinaryImageFilter< _TMesh, _TImage > _TFilter;
+ typedef typename _TImage::PointType _TPoint;
static const unsigned int PAD = 10;
_TFilter* filter = this->_CreateITK< _TFilter >( );
- auto bb = mesh->GetBoundingBox( );
- auto minBB = bb->GetMinimum( );
- auto maxBB = bb->GetMaximum( );
+ auto in_bb = dynamic_cast< _TBB* >( this->GetInputData( "BoundingBox" ) );
+ _TPoint minBB, maxBB;
+ if( in_bb == NULL )
+ {
+ auto bb = mesh->GetBoundingBox( );
+ minBB = bb->GetMinimum( );
+ maxBB = bb->GetMaximum( );
+ }
+ else
+ {
+ minBB = in_bb->GetMinimum< _TPoint >( );
+ maxBB = in_bb->GetMaximum< _TPoint >( );
+
+ } // fi
double lx = double( maxBB[ 0 ] - minBB[ 0 ] );
double ly = double( maxBB[ 1 ] - minBB[ 1 ] );