From d733b4661c82af361ec701b121b0de5825dfab28 Mon Sep 17 00:00:00 2001 From: "Mauro I. Dominguez" Date: Wed, 21 Dec 2022 18:11:25 -0300 Subject: [PATCH] ENH: Avoid decimation for models with small number of points fixes #9 --- OpenAnatomyExport/OpenAnatomyExport.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenAnatomyExport/OpenAnatomyExport.py b/OpenAnatomyExport/OpenAnatomyExport.py index cbd474d..821c90d 100644 --- a/OpenAnatomyExport/OpenAnatomyExport.py +++ b/OpenAnatomyExport/OpenAnatomyExport.py @@ -408,10 +408,12 @@ def addModelToRenderer(self, inputModelNode, outputModelNode, boostGouraudColor= self._temporaryExportNodes.append(self._decimationParameterNode) # Quadric decimation - if self.reductionFactor == 0.0: + if (self.reductionFactor == 0.0) or (inputModelNode.GetPolyData().GetNumberOfPoints() < 50): + # Models with very small number of points are not decimated, as the memory saving is + # negligible and the models may become severely distorted. outputModelNode.CopyContent(inputModelNode) else: - + # Temporary workaround (part 1/2): # VTK 9.0 OBJ writer creates invalid OBJ file if there are triangle # strips and normals but no texture coords.