58 std::vector<vtkPolyData*> iPolyData,
61 const unsigned int Dimension = 3;
62 typedef unsigned char PixelType;
64 typedef itk::Image< PixelType, Dimension > ImageType;
66 typedef std::list< vtkPolyData* > PolyDataListType;
67 PolyDataListType listOfPolydatas;
70 std::vector< double > bounds(Dimension*2);
71 for(
unsigned int i = 0; i<Dimension; ++i)
73 bounds[i*2] = std::numeric_limits<int>::max();
74 bounds[i*2+1] = std::numeric_limits<int>::min();
78 std::vector<vtkPolyData*>::iterator iterator = iPolyData.begin();
79 while(iterator != iPolyData.end())
81 double* boundsPointer = (*iterator)->GetBounds();
82 for(
unsigned int i = 0; i<Dimension; ++i)
84 if(boundsPointer[i*2] < bounds[i*2])
85 bounds[i*2] =
static_cast<int>(boundsPointer[i*2]);
86 if(boundsPointer[i*2 + 1] > bounds[i*2 +1])
87 bounds[i*2+1] =
static_cast<int>(boundsPointer[i*2+1]);
89 listOfPolydatas.push_back(*iterator);
93 ImageType::Pointer ITK_Full_Image = iImages->
getImageITK<PixelType, Dimension>(
96 itk::Vector<double> spacing = ITK_Full_Image->GetSpacing();
100 for(
unsigned int i = 0; i<Dimension; ++i)
102 bounds[i*2] = bounds[i*2] - 10*spacing[i];
103 bounds[i*2+1] = bounds[i*2+1] + 10*spacing[i];
108 ImageType::Pointer ITK_ROI_Image =
109 this->ITKExtractROI< PixelType, Dimension >( bounds, ITK_Full_Image);
112 MergerType::Pointer filter = MergerType::New();
113 filter->SetInputs( listOfPolydatas );
114 filter->SetNumberOfImages( 1 );
115 filter->SetFeatureImage( 0, ITK_ROI_Image );
118 std::vector<vtkPolyData*> oVector;
119 oVector.push_back(filter->GetOutput());
std::vector< vtkPolyData * > ApplyAlgo(GoImageProcessor *iImages, std::string iChannel, std::vector< vtkPolyData * > iPolyData, bool iIsInvertedOn)
return the vtkpolydata created by the algorithm
itk::Image< PixelType, VImageDimension >::Pointer getImageITK(std::string iIndex, bool iIsInverted=false)
get an ITK image (vs vtkImageData) given its index
class to be the interface between the shape algo for meshes, contours and set of contours and GoFigur...
std::string getChannelName(const unsigned int &iIndex)
get name of a channel given its index.
~QGoMeshMergeConvexHullAlgo()
void setObjectName(const QString &name)
QGoMeshMergeConvexHullAlgo(std::vector< vtkPoints * > *iSeeds, QWidget *iParent=0)
Interface between image reader and vtkImageData.