I am testing a script that performs several registrations and calculates the similarity coefficients for each of them.
To do so, before each registration I clear the scene using slicer.mrmlScene.Clear(0), and here the issue arises: the similarity coefficients are calculated only for the first run and, after the clean-up, never again.
Reading the source of the module, I see that in the calculateSegmentSimilarity function, only the self.segmentComparisonNode node has a check of its current presence in the scene. This check is not performed for the self.diceTableNode node
|
if self.diceTableNode is None: |
nor for the
self.hausdorffTableNode node
|
if self.hausdorffTableNode is None: |
which means that, after the clean-up, the module still thinks that those tables are in the scene but, after having calculated the coefficients, finds no table in which storing them.
This can be easily fixed by adding the same check on those two nodes:
if self.diceTableNode is None or self.hausdorffTableNode.GetScene() is None:
and
if self.hausdorffTableNode is None or self.hausdorffTableNode.GetScene() is None:
I am testing a script that performs several registrations and calculates the similarity coefficients for each of them.
To do so, before each registration I clear the scene using
slicer.mrmlScene.Clear(0), and here the issue arises: the similarity coefficients are calculated only for the first run and, after the clean-up, never again.Reading the source of the module, I see that in the
calculateSegmentSimilarityfunction, only theself.segmentComparisonNodenode has a check of its current presence in the scene. This check is not performed for theself.diceTableNodenodeSegmentRegistration/ProstateMRIUSContourPropagation/ProstateMRIUSContourPropagation.py
Line 1096 in 4b19e2c
nor for the
self.hausdorffTableNodenodeSegmentRegistration/ProstateMRIUSContourPropagation/ProstateMRIUSContourPropagation.py
Line 1100 in 4b19e2c
which means that, after the clean-up, the module still thinks that those tables are in the scene but, after having calculated the coefficients, finds no table in which storing them.
This can be easily fixed by adding the same check on those two nodes:
if self.diceTableNode is None or self.hausdorffTableNode.GetScene() is None:and
if self.hausdorffTableNode is None or self.hausdorffTableNode.GetScene() is None: