Skip to content

Instantly share code, notes, and snippets.

@cpinter
Last active September 27, 2022 09:56
Show Gist options
  • Save cpinter/0f0502d15e0572e7f0cdaaddd26b0e41 to your computer and use it in GitHub Desktop.
Save cpinter/0f0502d15e0572e7f0cdaaddd26b0e41 to your computer and use it in GitHub Desktop.
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
from slicer.util import VTKObservationMixin
#
# CalibrationPhantomSegmentation
#
class CalibrationPhantomSegmentation(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Calibration Phantom Segmentation"
self.parent.categories = []
self.parent.dependencies = ['Segmentations']
self.parent.contributors = []
self.parent.helpText = ""
#
# CalibrationPhantomSegmentationWidget
#
class CalibrationPhantomSegmentationWidget(ScriptedLoadableModuleWidget, VTKObservationMixin):
def __init__(self, parent=None):
"""
Called when the user opens the module the first time and the widget is initialized.
"""
ScriptedLoadableModuleWidget.__init__(self, parent)
VTKObservationMixin.__init__(self) # needed for parameter node observation
self.logic = None
self._parameterNode = None
self._updatingGUIFromParameterNode = False
def setup(self):
"""
Called when the user opens the module the first time and the widget is initialized.
"""
ScriptedLoadableModuleWidget.setup(self)
# Create logic class. Logic implements all computations that should be possible to run
# in batch mode, without a graphical user interface.
self.logic = CalibrationPhantomSegmentationLogic()
#
# CalibrationPhantomSegmentationLogic
#
class CalibrationPhantomSegmentationLogic(ScriptedLoadableModuleLogic):
def __init__(self):
"""
Called when the logic class is instantiated. Can be used for initializing member variables.
"""
ScriptedLoadableModuleLogic.__init__(self)
#
# CalibrationPhantomSegmentationTest
#
class CalibrationPhantomSegmentationTest(ScriptedLoadableModuleTest):
def setUp(self):
""" Do whatever is needed to reset the state - typically a scene clear will be enough.
"""
slicer.mrmlScene.Clear()
def runTest(self):
"""Run as few or as many tests as needed here.
"""
self.setUp()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment