34 #ifndef __QGoMeshWaterShedAlgo_h
35 #define __QGoMeshWaterShedAlgo_h
41 #include "QGoGUILibConfigure.h"
42 #include "vtkSmartPointer.h"
43 #include "vtkPolyData.h"
44 #include "vtkImageData.h"
45 #include "vtkTransform.h"
46 #include "vtkTransformPolyDataFilter.h"
66 bool iIsInvertedOn =
false);
70 template <
class TPixel >
75 const std::vector<double>& iCenter,
76 typename itk::Image< TPixel, 3 >::Pointer iImages)
78 assert( iCenter.size() == 3);
80 const unsigned int ImageDimension = 3;
82 typedef TPixel PixelType;
84 typedef itk::Image< PixelType, ImageDimension > ImageType;
85 typedef typename ImageType::Pointer ImagePointer;
90 std::vector< double > bounds( 2 * ImageDimension, 0. );
92 for(
unsigned int dim = 0; dim < ImageDimension; dim++ )
94 bounds[k++] = iCenter[dim] - 2. * radius;
95 bounds[k++] = iCenter[dim] + 2. * radius;
99 ImagePointer ITK_ROI_Image =
100 this->ITKExtractROI< PixelType, ImageDimension >( bounds, iImages );
113 ItkOutPut = Filter.GetOutput3D();
117 vtkImageData * FilterOutPutToVTK =
120 ImageDimension>( ItkOutPut );
123 vtkPolyData* temp_output = this->
ExtractPolyData(FilterOutPutToVTK, 0.5);
124 FilterOutPutToVTK->Delete();
127 vtkPolyData* mesh = vtkPolyData::New();
128 mesh->DeepCopy( temp_output );
QGoAlgoParameter< double > * m_Beta
QGoMeshWaterShedAlgo(std::vector< vtkPoints * > *iSeeds, int iMaxThreshold, QWidget *iParent=0)
QGoAlgoParameter< int > * m_ThresMin
Output3DType::Pointer Output3DPointer
vtkPolyData * ApplyWaterShedFilter(const std::vector< double > &iCenter, typename itk::Image< TPixel, 3 >::Pointer iImages)
class to be the interface between the watershed algo for meshes and GoFigure
QGoAlgoParameter< int > * m_ThresMax
std::vector< vtkPolyData * > ApplyAlgo(GoImageProcessor *iImages, std::string iChannel, bool iIsInvertedOn=false)
return the vtkpolydata created by the algorithm
std::vector< vtkPolyData * > ExtractPolyData(std::vector< vtkImageData * > &iInputImage, const double &iThreshold)
QGoAlgoParameter< double > * m_CorrThres
QGoAlgoParameter< double > * m_Radius
QGoAlgoParameter< double > * m_Alpha
Watershed segmentation algorithm implementation. Can generate contours and meshes. Will generate 2D objects if m_Dimension<2, 3D objects in the other case.
Interface between image reader and vtkImageData.
vtkImageData * ConvertITK2VTK(typename itk::Image< PixelType, VImageDimension >::Pointer iInput)
void Apply3DFilter(typename itk::Image< TPixel, 3 >::Pointer iITKInput, const int &iThresMin, const int &iThresMax, const double &iCorrTresh, const double &iAlpha, const double &iBeta)
class to be the interface between the watershed algo for meshes and GoFigure