smrolfe
(Sara Rolfe)
September 15, 2021, 1:02am
1
The decimate tool in the Surface Toolbox produces the same output with or without the “Boundary deletion” checkbox selected. On debugging, it looks like there’s a typo in the parameter name here:
outputModel.AddDefaultStorageNode()
if parameterNode.GetParameter("cleaner") == "true":
self.updateProcess("Clean...")
SurfaceToolboxLogic.clean(outputModel, outputModel)
if parameterNode.GetParameter("decimation") == "true":
self.updateProcess("Decimation...")
SurfaceToolboxLogic.decimate(outputModel, outputModel,
reductionFactor=float(parameterNode.GetParameter("decimationReduction")),
decimateBoundary=parameterNode.GetParameter("decimationBoundary") == "true")
if parameterNode.GetParameter("smoothing") == "true":
self.updateProcess("Smoothing...")
method = parameterNode.GetParameter("smoothingMethod")
SurfaceToolboxLogic.smooth(outputModel, outputModel,
method=parameterNode.GetParameter("smoothingMethod"),
iterations=int(float(parameterNode.GetParameter("smoothingLaplaceIterations" if method=='Laplace' else "smoothingTaubinIterations"))),
laplaceRelaxationFactor=float(parameterNode.GetParameter("smoothingLaplaceRelaxation")),
taubinPassBand=float(parameterNode.GetParameter("smoothingTaubinPassBand")),
boundarySmoothing=parameterNode.GetParameter("smoothingBoundarySmoothing") == "true")
Which should be consistent with the definition here:
ScriptedLoadableModuleLogic.__init__(self)
self.updateProcessCallback = None
def setDefaultParameters(self, parameterNode):
"""
Initialize parameter node with default settings.
"""
defaultValues = [
("decimation", "false"),
("decimationReduction", "0.8"),
("decimationBoundaryDeletion", "true"),
("smoothing", "false"),
("smoothingMethod", "Taubin"),
("smoothingLaplaceIterations", "100"),
("smoothingLaplaceRelaxation", "0.5"),
("smoothingTaubinIterations", "30"),
("smoothingTaubinPassBand", "0.1"),
("smoothingBoundarySmoothing", "true"),
("normals", "false"),
("normalsAutoOrient", "false"),
("normalsFlip", "false"),
Changing the name on line 537 resolves the issue. I can submit a pull request with this change if this looks correct.
1 Like
lassoan
(Andras Lasso)
September 15, 2021, 1:12am
2
Good catch. Yes, please send a pull request (keep decimationBoundaryDeletion
). Thank you!
1 Like