19 #include <vtkPoints.h>
20 #include <vtkPolyVertex.h>
21 #include <vtkSmartPointer.h>
22 #include <vtkUnstructuredGrid.h>
24 #include <itkImageRegionIterator.h>
44 MITK_ERROR <<
"Wrong input image set" << std::endl;
50 m_NumberOfExtractedPoints = 0;
57 this->ProcessObject::SetNthInput(0, const_cast<mitk::Image *>(image));
62 if (this->GetNumberOfInputs() < 1)
68 return static_cast<const mitk::Image *
>(this->ProcessObject::GetInput(0));
73 if (this->GetNumberOfInputs() < 1)
79 return static_cast<mitk::Image *
>(this->ProcessObject::GetInput(0));
82 template <
typename TPixel,
unsigned int VImageDimension>
86 typename itk::ImageRegionConstIterator<InputImageType> it(image, image->GetRequestedRegion());
93 if (it.Get() >= m_Threshold)
98 imagePoint[0] = it.GetIndex()[0];
99 imagePoint[1] = it.GetIndex()[1];
100 imagePoint[2] = it.GetIndex()[2];
102 m_Geometry->IndexToWorld(imagePoint, worldPoint);
104 points->InsertNextPoint(worldPoint[0], worldPoint[1], worldPoint[2]);
105 m_NumberOfExtractedPoints++;
112 verts->GetPointIds()->SetNumberOfIds(m_NumberOfExtractedPoints);
113 for (
int i = 0; i < m_NumberOfExtractedPoints; i++)
115 verts->GetPointIds()->SetId(i, i);
121 uGrid->InsertNextCell(verts->GetCellType(), verts->GetPointIds());
122 uGrid->SetPoints(points);
124 m_UnstructGrid->SetVtkUnstructuredGrid(uGrid);
129 this->m_Threshold = threshold;
134 return this->m_Threshold;
141 m_UnstructGrid = this->GetOutput();
143 itkDebugMacro(<<
"GenerateOutputInformation()");
145 if (inputImage.IsNull())
virtual void GenerateData() override
void ExtractPoints(const itk::Image< TPixel, VImageDimension > *image)
const mitk::Image * GetInput(void) const
virtual void SetInput(const mitk::Image *image)
itk::Image< double, 3 > InputImageType
Image class for storing images.
ImageToUnstructuredGridFilter()
#define AccessByItk(mitkImage, itkImageTypeFunction)
Access a MITK image by an ITK image.
virtual 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...
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.
virtual ~ImageToUnstructuredGridFilter()
static itkEventMacro(BoundingShapeInteractionEvent, itk::AnyEvent) class MITKBOUNDINGSHAPE_EXPORT BoundingShapeInteractor Pointer New()
Basic interaction methods for mitk::GeometryData.