Skip to content

Commit

Permalink
ENH: Add conversion parameter to enable/disable end capping
Browse files Browse the repository at this point in the history
Add "End capping" conversion parameter to vtkPlanarContourToClosedSurfaceConversionRule.
1 (default) = close surface by generating end caps.
0 = leave contours open on surface exterior.

Re #178
  • Loading branch information
Sunderlandkyl committed Jan 28, 2021
1 parent 31b8308 commit 21f2321
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ vtkPlanarContourToClosedSurfaceConversionRule::vtkPlanarContourToClosedSurfaceCo

this->ConversionParameters[this->GetDefaultSliceThicknessParameterName()] = std::make_pair("0.0",
"Default thickness for contours if slice spacing cannot be calculated.");
this->ConversionParameters[this->GetEndCappingParameterName()] = std::make_pair("1",
"Create end cap to close surface inside contours on the top and bottom of the structure. 1 (default) = close surface by generating end caps. 0 = leave contours open on surface exterior.");
}

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -311,7 +313,10 @@ bool vtkPlanarContourToClosedSurfaceConversionRule::Convert(vtkDataObject* sourc
}

// Triangulate all contours which are exposed.
this->EndCapping(inputContoursCopy, outputPolygons, lineTriganulatedToAbove, lineTriganulatedToBelow);
if (vtkVariant(this->GetConversionParameter(this->GetEndCappingParameterName())).ToInt() == true)
{
this->EndCapping(inputContoursCopy, outputPolygons, lineTriganulatedToAbove, lineTriganulatedToBelow);
}

// Initialize the output data.
closedSurfacePolyData->SetPoints(outputPoints);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class VTK_SLICER_DICOMRTIMPORTEXPORT_CONVERSIONRULES_EXPORT vtkPlanarContourToCl
vtkSegmentationConverterRule* CreateRuleInstance() override;

static const std::string GetDefaultSliceThicknessParameterName() { return "Default slice thickness"; };
static const std::string GetEndCappingParameterName() { return "End capping"; };

/// Constructs representation object from representation name for the supported representation classes
/// (typically source and target representation VTK classes, subclasses of vtkDataObject)
Expand Down

0 comments on commit 21f2321

Please sign in to comment.