|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Extracts label-boundary polygonal surfaces from a multi-label segmentation group image using vtkSurfaceNets3D. More...
#include <mitkMultiLabelSurfaceNetsExtractor.h>
Public Types | |
| using | LabelValueType = MultiLabelSegmentation::LabelValueType |
Public Member Functions | |
| MultiLabelSurfaceNetsExtractor () | |
| ~MultiLabelSurfaceNetsExtractor () | |
| MultiLabelSurfaceNetsExtractor (const MultiLabelSurfaceNetsExtractor &)=delete | |
| MultiLabelSurfaceNetsExtractor & | operator= (const MultiLabelSurfaceNetsExtractor &)=delete |
| void | SetSmoothing (bool smoothing) |
| Set whether constrained smoothing is applied. More... | |
| bool | GetSmoothing () const |
| vtkSmartPointer< vtkPolyData > | Extract (vtkImageData *groupImage, const std::vector< LabelValueType > &labelValues) |
| Extract the boundary surface for the given labels of a single group image. More... | |
| std::map< LabelValueType, vtkSmartPointer< vtkPolyData > > | ExtractPerLabel (vtkImageData *groupImage, const std::vector< LabelValueType > &labelValues) |
| Per-label variant. Returns one polydata per label, restricted to that label's exterior faces (vtkSurfaceNets3D OUTPUT_STYLE_SELECTED). More... | |
Static Public Member Functions | |
| static vtkSmartPointer< vtkMatrix4x4 > | GetImageToWorldMatrix (const BaseGeometry *geometry) |
| Build the image-local-frame to world-frame transform for the polydata produced by Extract. More... | |
Extracts label-boundary polygonal surfaces from a multi-label segmentation group image using vtkSurfaceNets3D.
Used by MultiLabelSegmentationVtkMapper3D for live 3D rendering and by the "Convert to polygon model" action for one-shot mitk::Surface generation. vtkSurfaceNets3D extracts all labels in a single threaded pass and shares cells between adjacent regions, producing gap-free, label-aware meshes.
Output cells carry a 2-component "BoundaryLabels" cell-data array that vtkSurfaceNets3D writes; component 0 holds the foreground label of each face (background or higher labels go to component 1).
The class also encapsulates a workaround for a vtkSurfaceNets3D bug in VTK 9.5.2, where the boundary cache may be reused without populating the local newScalars, causing TransformMeshType to dereference null in the smoothed path.
Definition at line 50 of file mitkMultiLabelSurfaceNetsExtractor.h.
Definition at line 53 of file mitkMultiLabelSurfaceNetsExtractor.h.
| mitk::MultiLabelSurfaceNetsExtractor::MultiLabelSurfaceNetsExtractor | ( | ) |
| mitk::MultiLabelSurfaceNetsExtractor::~MultiLabelSurfaceNetsExtractor | ( | ) |
|
delete |
| vtkSmartPointer<vtkPolyData> mitk::MultiLabelSurfaceNetsExtractor::Extract | ( | vtkImageData * | groupImage, |
| const std::vector< LabelValueType > & | labelValues | ||
| ) |
Extract the boundary surface for the given labels of a single group image.
| groupImage | vtkImageData of one group of a MultiLabelSegmentation (typically obtained via Image::GetVtkImageData(timeStep)). |
| labelValues | The labels to include. An empty list returns an empty mesh. |
| std::map<LabelValueType, vtkSmartPointer<vtkPolyData> > mitk::MultiLabelSurfaceNetsExtractor::ExtractPerLabel | ( | vtkImageData * | groupImage, |
| const std::vector< LabelValueType > & | labelValues | ||
| ) |
Per-label variant. Returns one polydata per label, restricted to that label's exterior faces (vtkSurfaceNets3D OUTPUT_STYLE_SELECTED).
Smoothing is applied across all labels in the input list, so the per-label output keeps consistent boundaries with adjacent labels. Labels with no boundary in the group are absent from the returned map.
|
static |
Build the image-local-frame to world-frame transform for the polydata produced by Extract.
vtkSurfaceNets3D operates on the raw vtkImageData (origin (0,0,0), identity direction, image spacing already applied) and returns polydata in that local frame. The returned 4x4 matrix is the [direction | origin] transform that places those coordinates back into world space. The live 3D mapper applies it as the actor's UserMatrix; consumers of the polydata that bypass the rendering pipeline (e.g. the convert-to-surface action) should bake it into the polydata via vtkTransformPolyDataFilter.
| bool mitk::MultiLabelSurfaceNetsExtractor::GetSmoothing | ( | ) | const |
|
delete |
| void mitk::MultiLabelSurfaceNetsExtractor::SetSmoothing | ( | bool | smoothing | ) |
Set whether constrained smoothing is applied.
When on (default) the output is smoothed triangles; when off the output is the raw axis-aligned voxel-boundary quads.