40 #include "vtkPolyDataWriter.h"
59 std::vector<vtkPolyData*> iPolyData,
62 const unsigned int Dimension = 3;
63 typedef unsigned char PixelType;
64 typedef itk::Image< PixelType, Dimension > ImageType;
68 std::vector<vtkPolyData*> oVector;
70 std::vector< double > bounds(6);
71 double* boundsPointer = iPolyData[0]->GetBounds();
72 for(
unsigned int i = 0; i<Dimension; ++i)
74 bounds[i*2] =
static_cast<int>(boundsPointer[i*2]);
75 bounds[i*2+1] =
static_cast<int>(boundsPointer[i*2+1]);
78 typedef SplitterType::PointSetType PointSetType;
79 PointSetType::Pointer seeds = PointSetType::New();
81 ImageType::PointType itk_pt;
84 for(
size_t id = 0;
id < this->
m_Seeds->size();
id++ )
88 (*this->
m_Seeds)[
id]->GetPoint(i, vtk_pt);
90 if( vtk_pt[0] > bounds[0] && vtk_pt[0] < bounds[1]
91 && vtk_pt[1] > bounds[2] && vtk_pt[1] < bounds[3]
92 && vtk_pt[2] > bounds[4] && vtk_pt[2] < bounds[5])
94 itk_pt[0] = vtk_pt[0];
95 itk_pt[1] = vtk_pt[1];
96 itk_pt[2] = vtk_pt[2];
97 std::cout << itk_pt[0] <<
"-" << itk_pt[1] <<
"-" << itk_pt[2] << std::endl;
98 seeds->SetPoint( position, itk_pt );
106 ImageType::Pointer ITK_Full_Image = iImages->
getImageITK<PixelType, Dimension>(
109 itk::Vector<double> spacing = ITK_Full_Image->GetSpacing();
113 for(
unsigned int i = 0; i<Dimension; ++i)
115 bounds[i*2] = bounds[i*2] - 10*spacing[i];
116 bounds[i*2+1] = bounds[i*2+1] + 10*spacing[i];
120 ImageType::Pointer ITK_ROI_Image =
121 this->ITKExtractROI< PixelType, Dimension >( bounds, ITK_Full_Image);
123 SplitterType::Pointer filter = SplitterType::New();
125 filter->SetNumberOfImages( 1 );
126 filter->SetMesh( iPolyData[0] );
127 filter->SetFeatureImage( 0,
130 filter->SetSeeds( seeds );
132 oVector = filter->GetOutputs();
itk::Image< PixelType, VImageDimension >::Pointer getImageITK(std::string iIndex, bool iIsInverted=false)
get an ITK image (vs vtkImageData) given its index
std::string getChannelName(const unsigned int &iIndex)
get name of a channel given its index.
std::vector< vtkPoints * > * m_Seeds
unsigned int GetNumberOfPoints() const
void setObjectName(const QString &name)
QGoMeshSplitDanielssonDistanceAlgo(std::vector< vtkPoints * > *iSeeds, QWidget *iParent=0)
std::vector< vtkPolyData * > ApplyAlgo(GoImageProcessor *iImages, std::string iChannel, std::vector< vtkPolyData * > iPolyData, bool iIsInvertedOn)
return the vtkpolydata created by the algorithm
Interface between image reader and vtkImageData.
class to be the interface between the shape algo for meshes, contours and set of contours and GoFigur...
~QGoMeshSplitDanielssonDistanceAlgo()