15 #include <vtkPoints.h> 16 #include <vtkPolyVertex.h> 17 #include <vtkSmartPointer.h> 18 #include <vtkUnstructuredGrid.h> 20 #include <itkImageRegionIterator.h> 40 MITK_ERROR <<
"Wrong input image set" << std::endl;
53 this->ProcessObject::SetNthInput(0, const_cast<mitk::Image *>(image));
58 if (this->GetNumberOfInputs() < 1)
64 return static_cast<const mitk::Image *
>(this->ProcessObject::GetInput(0));
69 if (this->GetNumberOfInputs() < 1)
75 return static_cast<mitk::Image *
>(this->ProcessObject::GetInput(0));
78 template <
typename TPixel,
unsigned int VImageDimension>
82 typename itk::ImageRegionConstIterator<InputImageType> it(image, image->GetRequestedRegion());
84 vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
89 if (it.Get() >= m_Threshold)
94 imagePoint[0] = it.GetIndex()[0];
95 imagePoint[1] = it.GetIndex()[1];
96 imagePoint[2] = it.GetIndex()[2];
100 points->InsertNextPoint(worldPoint[0], worldPoint[1], worldPoint[2]);
106 vtkSmartPointer<vtkPolyVertex> verts = vtkSmartPointer<vtkPolyVertex>::New();
111 verts->GetPointIds()->SetId(i, i);
114 vtkSmartPointer<vtkUnstructuredGrid> uGrid = vtkSmartPointer<vtkUnstructuredGrid>::New();
117 uGrid->InsertNextCell(verts->GetCellType(), verts->GetPointIds());
118 uGrid->SetPoints(points);
120 m_UnstructGrid->SetVtkUnstructuredGrid(uGrid);
125 this->m_Threshold = threshold;
130 return this->m_Threshold;
139 itkDebugMacro(<<
"GenerateOutputInformation()");
141 if (inputImage.IsNull())
void IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const
Convert (continuous or discrete) index coordinates of a vector vec_units to world coordinates (in mm)...
void GenerateData() override
::mitk::Image InputImageType
void ExtractPoints(const itk::Image< TPixel, VImageDimension > *image)
~ImageToUnstructuredGridFilter() override
virtual void SetInput(const mitk::Image *image)
int m_NumberOfExtractedPoints
Image class for storing images.
ImageToUnstructuredGridFilter()
#define AccessByItk(mitkImage, itkImageTypeFunction)
Access a MITK image by an ITK image.
mitk::Image::Pointer image
void GenerateOutputInformation() override
virtual bool IsInitialized() const
Check whether the data has been initialized, i.e., at least the Geometry and other header data has be...
const mitk::Image * GetInput(void) const
void SetThreshold(double threshold)
mitk::BaseGeometry * GetGeometry(int t=0) const
Return the geometry, which is a TimeGeometry, of the data as non-const pointer.
itk::SmartPointer< Self > Pointer