def __init__(self, parentFrame, parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self, parentFrame, parentClass)

        self._sourceFiducialList = None
        self._targetFiducialList = None

        self._currentFiducialList = None

        #top frame starts
        self._firstRowFrame = slicer.vtkKWFrame()

        # source frame starts
        self._sourcePointsFrame = slicer.vtkKWFrameWithLabel()

        self._addSourcePointButton = slicer.vtkKWPushButton()
        self._delSourcePointButton = slicer.vtkKWPushButton()
        self._sourcePointsList = slicer.vtkKWListBoxWithScrollbars()

        # target frame starts
        self._targetPointsFrame = slicer.vtkKWFrameWithLabel()

        self._addTargetPointButton = slicer.vtkKWPushButton()
        self._delTargetPointButton = slicer.vtkKWPushButton()
        self._targetPointsList = slicer.vtkKWListBoxWithScrollbars()

        #middle frame starts
        self._secondRowFrame = slicer.vtkKWFrame()

        #threshold frame starts
        self._thresholdFrame = slicer.vtkKWFrameWithLabel()
        self._thresholdSlider = slicer.vtkKWExtent()

        self._startButton = slicer.vtkKWPushButton()
        self._resetButton = slicer.vtkKWPushButton()
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._sourceFiducialList = None
        self._targetFiducialList = None

        self._currentFiducialList = None

        #top frame starts
        self._firstRowFrame = slicer.vtkKWFrame()

        # source frame starts
        self._sourcePointsFrame = slicer.vtkKWFrameWithLabel()

        self._addSourcePointButton = slicer.vtkKWPushButton()
        self._delSourcePointButton = slicer.vtkKWPushButton()
        self._sourcePointsList = slicer.vtkKWListBoxWithScrollbars()
   

        # target frame starts
        self._targetPointsFrame = slicer.vtkKWFrameWithLabel()

        self._addTargetPointButton = slicer.vtkKWPushButton()
        self._delTargetPointButton = slicer.vtkKWPushButton()
        self._targetPointsList = slicer.vtkKWListBoxWithScrollbars()

        #middle frame starts
        self._secondRowFrame = slicer.vtkKWFrame()

        #threshold frame starts
        self._thresholdFrame = slicer.vtkKWFrameWithLabel()
        self._thresholdSlider = slicer.vtkKWExtent()

        self._startButton = slicer.vtkKWPushButton()
        self._resetButton = slicer.vtkKWPushButton()
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._iterationsThumbwheel = slicer.vtkKWThumbWheel()
        self._weightsFrame = slicer.vtkKWFrameWithLabel()
        self._propagationScalingSpinBox = slicer.vtkKWSpinBoxWithLabel()
        self._curvatureScalingSpinBox = slicer.vtkKWSpinBoxWithLabel()
        self._advectionScalingSpinBox = slicer.vtkKWSpinBoxWithLabel()
        self._startButton = slicer.vtkKWPushButton()
        self._resetButton = slicer.vtkKWPushButton()
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._seedFiducialList = None

        self._firstRowFrame = slicer.vtkKWFrame()
        self._seedPointsFrame = slicer.vtkKWFrameWithLabel()
        self._addSeedPointButton = slicer.vtkKWPushButton()
        self._delSeedPointButton = slicer.vtkKWPushButton()
        self._seedPointsList = slicer.vtkKWListBoxWithScrollbars()
        self._startButton = slicer.vtkKWPushButton()
        self._resetButton = slicer.vtkKWPushButton()
    def __init__(self, parentFrame, parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self, parentFrame, parentClass)

        self._firstRowFrame = slicer.vtkKWFrame()

        self._isosurfaceLevelFrame = slicer.vtkKWFrameWithLabel()

        self._isosurfaceLevelThumbWheel = slicer.vtkKWThumbWheel()

        self._startButton = slicer.vtkKWPushButton()

        self._resetButton = slicer.vtkKWPushButton()
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._firstRowFrame = slicer.vtkKWFrame()

        self._isosurfaceLevelFrame = slicer.vtkKWFrameWithLabel()

        self._isosurfaceLevelThumbWheel = slicer.vtkKWThumbWheel()

        self._startButton = slicer.vtkKWPushButton()


        self._resetButton = slicer.vtkKWPushButton()
예제 #7
0
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        #top frame starts
        self._firstRowFrame = slicer.vtkKWFrame()

        #middle frame starts
        self._secondRowFrame = slicer.vtkKWFrame()

        #threshold frame starts
        self._thresholdFrame = slicer.vtkKWFrameWithLabel()
        self._thresholdSlider = slicer.vtkKWExtent()

        self._startButton = slicer.vtkKWPushButton()
        self._resetButton = slicer.vtkKWPushButton()
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._spinboxFrame = slicer.vtkKWFrameWithLabel()
        self._thrFrame = slicer.vtkKWFrameWithLabel()

        self._sigmaUnit  = slicer.vtkKWRadioButtonSetWithLabel()        

        self._sigmaMin = slicer.vtkKWSpinBoxWithLabel()
        self._sigmaMax = slicer.vtkKWSpinBoxWithLabel()
        self._numberOfSigmaSteps = slicer.vtkKWThumbWheel()
        self._alpha = slicer.vtkKWSpinBoxWithLabel()
        self._alpha2 = slicer.vtkKWSpinBoxWithLabel()

        self._startButton = slicer.vtkKWPushButton()
예제 #9
0
    def BuildGUI(self):
        SlicerVMTKAdvancedPageSkeleton.BuildGUI(self)

        self._firstRowFrame.SetParent(self._parentFrame)
        self._firstRowFrame.Create()

        self._secondRowFrame.SetParent(self._parentFrame)
        self._secondRowFrame.Create()

        self._thresholdFrame.SetParent(self._parentFrame)
        self._thresholdFrame.Create()
     

        self._thresholdSlider.SetParent(self._thresholdFrame.GetFrame())
        self._thresholdSlider.Create()


        self._startButton.SetParent(self._parentFrame)
        self._startButton.Create()


        self._resetButton.SetParent(self._parentFrame)
        self._resetButton.Create()

        self.UpdateGUIByState()

        slicer.TkCall("pack %s -side top -expand y -padx 2 -pady 2 -in %s" % (self._firstRowFrame.GetWidgetName(), self._parentFrame.GetWidgetName()))
        slicer.TkCall("pack %s -side top -expand y -padx 2 -pady 2 -in %s" % (self._secondRowFrame.GetWidgetName(), self._parentFrame.GetWidgetName()))

        slicer.TkCall("pack %s -side right -expand n -padx 2 -pady 2 -in %s" % (self._startButton.GetWidgetName(), self._parentFrame.GetWidgetName()))
        slicer.TkCall("pack %s -side right -expand n -padx 2 -pady 2 -in %s" % (self._resetButton.GetWidgetName(), self._parentFrame.GetWidgetName()))
        
        slicer.TkCall("pack %s -side left -expand y -padx 2 -pady 2 -in %s" % (self._thresholdFrame.GetWidgetName(), self._secondRowFrame.GetWidgetName()))
        slicer.TkCall("pack %s -side top -expand n -padx 2 -pady 2" % (self._thresholdSlider.GetWidgetName()))
예제 #10
0
    def AddGUIObservers(self):
        SlicerVMTKAdvancedPageSkeleton.AddGUIObservers(self)

        self._numberOfSigmaStepsTag = self._parentClass.AddObserverByNumber(
            self._numberOfSigmaSteps, vtkKWThumbWheel_ValueChangedEvent)
        self._numberOfIterationsTag = self._parentClass.AddObserverByNumber(
            self._numberOfIterations, vtkKWThumbWheel_ValueChangedEvent)
        self._numberOfDiffusionSubIterationsTag = self._parentClass.AddObserverByNumber(
            self._numberOfDiffusionSubIterations,
            vtkKWThumbWheel_ValueChangedEvent)
        self._sigmaMinTag = self._parentClass.AddObserverByNumber(
            self._sigmaMin.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._sigmaMaxTag = self._parentClass.AddObserverByNumber(
            self._sigmaMax.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._alphaTag = self._parentClass.AddObserverByNumber(
            self._alpha.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._betaTag = self._parentClass.AddObserverByNumber(
            self._beta.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._gammaTag = self._parentClass.AddObserverByNumber(
            self._gamma.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._cTag = self._parentClass.AddObserverByNumber(
            self._c.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._timestepTag = self._parentClass.AddObserverByNumber(
            self._timestep.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._epsilonTag = self._parentClass.AddObserverByNumber(
            self._epsilon.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._wstrengthTag = self._parentClass.AddObserverByNumber(
            self._wstrength.GetWidget(), vtkKWSpinBox_ValueChangedEvent)
        self._sensitivityTag = self._parentClass.AddObserverByNumber(
            self._sensitivity.GetWidget(), vtkKWSpinBox_ValueChangedEvent)

        self._startButtonTag = self._parentClass.AddObserverByNumber(
            self._startButton, vtkKWPushButton_InvokedEvent)
    def __init__(self, parentFrame, parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self, parentFrame, parentClass)

        self._firstRowFrame = slicer.vtkKWFrame()
        self._addSourcePointButton = slicer.vtkKWPushButton()
        self._addTargetPointButton = slicer.vtkKWPushButton()
        self._secondRowFrame = slicer.vtkKWFrame()
        self._thresholdFrame = slicer.vtkKWFrameWithLabel()
        self._thresholdSlider = slicer.vtkKWExtent()
        self._startButton = slicer.vtkKWPushButton()
        self._resetButton = slicer.vtkKWPushButton()

        self._sourceFiducialList = None
        self._targetFiducialList = None

        self._state = 0
    def UpdateGUI(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateGUI(self)

        node = self._parentClass.GetScriptedModuleNode()

        self._sourceFiducialList = None
        self._targetFiducialList = None

        if (node.GetParameter("CF_sourceFiducialList") != "None"
                and node.GetParameter("CF_sourceFiducialList")):
            self._sourceFiducialList = self._parentClass.GetLogic(
            ).GetMRMLScene().GetNodeByID(
                node.GetParameter("CF_sourceFiducialList"))

        if (node.GetParameter("CF_targetFiducialList") != "None"
                and node.GetParameter("CF_targetFiducialList")):
            self._targetFiducialList = self._parentClass.GetLogic(
            ).GetMRMLScene().GetNodeByID(
                node.GetParameter("CF_targetFiducialList"))

        self._state = node.GetParameter('CF_state')
        self.UpdateGUIByState()

        self._parentClass.SetUpdatingOn()
        self._thresholdSlider.SetExtent(
            node.GetParameter("CF_lowerThreshold"),
            node.GetParameter("CF_higherThreshold"), 0, 100, 0, 100)
        self._parentClass.SetUpdatingOff()
예제 #13
0
    def UpdateMRML(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateMRML(self)

        node = self._parentClass.GetScriptedModuleNode()

        if node:

            node.SetParameter('VED_numberOfSigmaSteps',
                              self._numberOfSigmaSteps.GetValue())
            node.SetParameter('VED_numberOfIterations',
                              self._numberOfIterations.GetValue())
            node.SetParameter('VED_numberOfDiffusionSubIterations',
                              self._numberOfDiffusionSubIterations.GetValue())
            node.SetParameter('VED_sigmaMin',
                              self._sigmaMin.GetWidget().GetValue())
            node.SetParameter('VED_sigmaMax',
                              self._sigmaMax.GetWidget().GetValue())
            node.SetParameter('VED_alpha', self._alpha.GetWidget().GetValue())
            node.SetParameter('VED_beta', self._beta.GetWidget().GetValue())
            node.SetParameter('VED_gamma', self._gamma.GetWidget().GetValue())
            node.SetParameter('VED_c', self._c.GetWidget().GetValue())
            node.SetParameter('VED_timestep',
                              self._timestep.GetWidget().GetValue())
            node.SetParameter('VED_epsilon',
                              self._epsilon.GetWidget().GetValue())
            node.SetParameter('VED_wstrength',
                              self._wstrength.GetWidget().GetValue())
            node.SetParameter('VED_sensitivity',
                              self._sensitivity.GetWidget().GetValue())
    def UpdateMRML(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateMRML(self)

        node = self._parentClass.GetScriptedModuleNode()

        node.SetParameter('IS_value',
                          self._isosurfaceLevelThumbWheel.GetValue())
    def DeleteFiducialListsFromScene(self, which):
        SlicerVMTKAdvancedPageSkeleton.DeleteFiducialListsFromScene(
            self, which)

        node = self._parentClass.GetScriptedModuleNode()

        if node:

            scene = self._parentClass.GetLogic().GetMRMLScene()

            if (which != 2):

                if self._sourceFiducialList != None:
                    if scene.IsNodePresent(self._sourceFiducialList):
                        # node is in scene, now delete
                        scene.RemoveNode(self._sourceFiducialList)
                        self._sourceFiducialList = None

            if (which != 1):

                if self._targetFiducialList != None:
                    if scene.IsNodePresent(self._targetFiducialList):
                        # node is in scene, now delete
                        scene.RemoveNode(self._targetFiducialList)
                        self._targetFiducialList = None
예제 #16
0
    def ProcessGUIEvents(self,caller,event):
        SlicerVMTKAdvancedPageSkeleton.ProcessGUIEvents(self,caller,event)

        if caller == self._numberOfSigmaSteps and event == vtkKWThumbWheel_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._numberOfIterations and event == vtkKWThumbWheel_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._numberOfDiffusionSubIterations and event == vtkKWThumbWheel_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._sigmaMin.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._sigmaMax.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._alpha.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._beta.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._gamma.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._timestep.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._epsilon.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._wstrength.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()
        elif caller == self._sensitivity.GetWidget() and event == vtkKWSpinBox_ValueChangedEvent:
            self._parentClass.UpdateMRML()

        elif caller == self._startButton and event == vtkKWPushButton_InvokedEvent:
            self.Execute()
            self._parentClass.UpdateMRML()
    def ProcessGUIEvents(self, caller, event):
        SlicerVMTKAdvancedPageSkeleton.ProcessGUIEvents(self, caller, event)

        if caller == self._addSourcePointButton and event == vtkKWPushButton_InvokedEvent:
            if self._parentClass.GetHelper().GetIsInteractiveMode() == 0:
                self.InitAddSourcePoint()
            elif self._parentClass.GetHelper().GetIsInteractiveMode() == 1:
                self.TeardownAddSourcePoint()

        elif caller == self._addTargetPointButton and event == vtkKWPushButton_InvokedEvent:
            if self._parentClass.GetHelper().GetIsInteractiveMode() == 0:
                self.InitAddTargetPoint()
            elif self._parentClass.GetHelper().GetIsInteractiveMode() == 1:
                self.TeardownAddTargetPoint()

        elif caller == self._startButton and event == vtkKWPushButton_InvokedEvent:
            self.Execute()
            self._parentClass.UpdateMRML()
        elif caller == self._resetButton and event == vtkKWPushButton_InvokedEvent:
            self.DeleteFiducialListsFromScene(0)
            self.Reset()
            self._parentClass.UpdateMRML()
        elif caller == self._thresholdSlider and event == vtkKWExtent_StartChangeEvent:
            self._parentClass.Threshold(self._thresholdSlider.GetExtent())
        elif caller == self._thresholdSlider and event == vtkKWExtent_EndChangeEvent:
            self._parentClass.UpdateMRML()
    def HandleClickInSliceWindowWithCoordinates(self, coordinates):
        SlicerVMTKAdvancedPageSkeleton.HandleClickInSliceWindowWithCoordinates(
            self, coordinates)

        coordinatesRAS = coordinates
        fiducial = self._currentFiducialList.AddFiducialWithXYZ(
            coordinatesRAS[0], coordinatesRAS[1], coordinatesRAS[2], 0)

        self._currentFiducialList.SetNthFiducialLabelText(
            fiducial, self._currentFiducialListLabel + str(fiducial))
        self._parentClass.GetHelper().debug("Fiducial Added! Only one needed!")

        self._parentClass.GetHelper().SetIsInteractiveMode(0, None)

        if self._currentFiducialListLabel == "SP":

            # one fiducial added to source points
            # disable source point button

            #re-change the button appeareance
            self._state = 1
            self.UpdateGUIByState()

            self._parentClass.UpdateMRML()

        elif self._currentFiducialListLabel == "TP":

            # one fiducial added to target points
            # disable target point button

            #re-change the button appeareance
            self._state = 2
            self.UpdateGUIByState()

            self._parentClass.UpdateMRML()
    def UpdateGUIByPreset(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateGUIByPreset(self)

        node = self._parentClass._moduleExistingSetsNodeSelector.GetSelected()

        if node:

            self.UpdateGUIReal(node)
예제 #20
0
    def UpdateGUI(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateGUI(self)

        node = self._parentClass.GetScriptedModuleNode()

        if node:

            self.UpdateGUIReal(node)
예제 #21
0
    def AddGUIObservers(self):
        SlicerVMTKAdvancedPageSkeleton.AddGUIObservers(self)

        self._thresholdSliderTag = self._parentClass.AddObserverByNumber(self._thresholdSlider, vtkKWExtent_EndChangeEvent)
        self._thresholdSliderRealtimeTag = self._parentClass.AddObserverByNumber(self._thresholdSlider, vtkKWExtent_StartChangeEvent)
        self._startButtonTag = self._parentClass.AddObserverByNumber(self._startButton,vtkKWPushButton_InvokedEvent)

        self._resetButtonTag = self._parentClass.AddObserverByNumber(self._resetButton,vtkKWPushButton_InvokedEvent)
예제 #22
0
    def UpdateMRML(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateMRML(self)

        node = self._parentClass.GetScriptedModuleNode()

        extentValues = self._thresholdSlider.GetExtent()
        node.SetParameter('TH_lowerThreshold', extentValues[0])
        node.SetParameter('TH_higherThreshold', extentValues[1])
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._firstRowFrame = slicer.vtkKWFrame()
        self._addSourcePointButton = slicer.vtkKWPushButton()
        self._addTargetPointButton = slicer.vtkKWPushButton()
        self._secondRowFrame = slicer.vtkKWFrame()
        self._thresholdFrame = slicer.vtkKWFrameWithLabel()
        self._thresholdSlider = slicer.vtkKWExtent()
        self._startButton = slicer.vtkKWPushButton()
        self._resetButton = slicer.vtkKWPushButton()

        self._sourceFiducialList = None
        self._targetFiducialList = None


        self._state = 0
    def Reset(self):
        SlicerVMTKAdvancedPageSkeleton.Reset(self)

        self._sourceFiducialList = None
        self._targetFiducialList = None

        self._state = 0
        self.UpdateGUIByState()
    def Reset(self):
        SlicerVMTKAdvancedPageSkeleton.Reset(self)

        self._numberOfSigmaSteps.SetValue(10)
        self._sigmaUnit.GetWidget().GetWidget(0).SetSelectedState(1)
        self._sigmaMin.GetWidget().SetValue(1.0)
        self._sigmaMax.GetWidget().SetValue(5.0)
        self._alpha.GetWidget().SetValue(0.5)
        self._alpha2.GetWidget().SetValue(2.0)
예제 #26
0
    def UpdateGUI(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateGUI(self)

        node = self._parentClass.GetScriptedModuleNode()
        self.UpdateGUIByState()

        self._parentClass.SetUpdatingOn()
        self._thresholdSlider.SetExtent(node.GetParameter("TH_lowerThreshold"),node.GetParameter("TH_higherThreshold"),0,100,0,100)
        self._parentClass.SetUpdatingOff()
예제 #27
0
    def RemoveGUIObservers(self):
        SlicerVMTKAdvancedPageSkeleton.RemoveGUIObservers(self)


        self._parentClass.RemoveObserver(self._thresholdSliderTag)
        self._parentClass.RemoveObserver(self._thresholdSliderRealtimeTag)

        self._parentClass.RemoveObserver(self._startButtonTag)
        self._parentClass.RemoveObserver(self._resetButtonTag)
예제 #28
0
    def Execute(self):
        SlicerVMTKAdvancedPageSkeleton.Execute(self)

        inVolume = self._parentClass._inVolumeSelector.GetSelected()
        outVolume = self._parentClass._outVolumeSelector.GetSelected()

        if not inVolume or not outVolume or not self.CheckForVmtkLibrary():
            slicer.Application.ErrorMessage(
                "No input volume or no output volume found. Aborting VED..\n")
            return
        else:

            sigmaMin = float(self._sigmaMin.GetWidget().GetValue())
            sigmaMax = float(self._sigmaMax.GetWidget().GetValue())
            numberOfSigmaSteps = int(self._numberOfSigmaSteps.GetValue())
            numberOfIterations = int(self._numberOfIterations.GetValue())
            numberOfDiffusionSubIterations = int(
                self._numberOfDiffusionSubIterations.GetValue())
            alpha = float(self._alpha.GetWidget().GetValue())
            beta = float(self._beta.GetWidget().GetValue())
            gamma = float(self._gamma.GetWidget().GetValue())
            c = float(self._c.GetWidget().GetValue())
            timestep = float(self._timestep.GetWidget().GetValue())
            epsilon = float(self._epsilon.GetWidget().GetValue())
            wstrength = float(self._wstrength.GetWidget().GetValue())
            sensitivity = float(self._sensitivity.GetWidget().GetValue())

            outVolumeImage = self._parentClass._logic.ApplyVED(
                inVolume.GetImageData(), sigmaMin, sigmaMax,
                numberOfSigmaSteps, alpha, beta, gamma, c, timestep, epsilon,
                wstrength, sensitivity, numberOfIterations,
                numberOfDiffusionSubIterations)

            matrix = slicer.vtkMatrix4x4()
            inVolume.GetIJKToRASMatrix(matrix)
            outVolume.SetAndObserveImageData(outVolumeImage)
            outVolume.SetIJKToRASMatrix(matrix)

            displayNode = inVolume.GetDisplayNode()
            if displayNode != None:
                newDisplayNode = displayNode.NewInstance()
                newDisplayNode.Copy(displayNode)
                slicer.MRMLScene.AddNodeNoNotify(newDisplayNode)
                outVolume.SetAndObserveDisplayNodeID(newDisplayNode.GetID())
                newDisplayNode.AutoWindowLevelOff()
                newDisplayNode.AutoWindowLevelOn()  # renew auto windowlevel

            appLogic = slicer.ApplicationLogic
            selectionNode = appLogic.GetSelectionNode()
            if inVolume.GetLabelMap():
                outVolume.SetLabelMap(1)
                selectionNode.SetReferenceActiveLabelVolumeID(
                    outVolume.GetID())
            else:
                selectionNode.SetReferenceActiveVolumeID(outVolume.GetID())
            appLogic.PropagateVolumeSelection()
예제 #29
0
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._spinboxFrame = slicer.vtkKWFrameWithLabel()

        self._sigmaMin = slicer.vtkKWSpinBoxWithLabel()
        self._sigmaMax = slicer.vtkKWSpinBoxWithLabel()
        self._numberOfSigmaSteps = slicer.vtkKWThumbWheel()
        self._alpha = slicer.vtkKWSpinBoxWithLabel()
        self._beta = slicer.vtkKWSpinBoxWithLabel()
        self._gamma = slicer.vtkKWSpinBoxWithLabel()
        self._timestep = slicer.vtkKWSpinBoxWithLabel()
        self._epsilon = slicer.vtkKWSpinBoxWithLabel()
        self._wstrength = slicer.vtkKWSpinBoxWithLabel()
        self._sensitivity = slicer.vtkKWSpinBoxWithLabel()
        self._numberOfIterations = slicer.vtkKWThumbWheel()
        self._numberOfDiffusionSubIterations = slicer.vtkKWThumbWheel()

        self._startButton = slicer.vtkKWPushButton()
    def UpdateGUI(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateGUI(self)

        node = self._parentClass.GetScriptedModuleNode()

        self.UpdateGUIByState()

        self._parentClass.SetUpdatingOn()
        self._isosurfaceLevelThumbWheel.SetValue(node.GetParameter("IS_value"))
        self._parentClass.SetUpdatingOff()
    def RemoveGUIObservers(self):
        SlicerVMTKAdvancedPageSkeleton.RemoveGUIObservers(self)

        self._parentClass.RemoveObserver(self._addSourcePointButtonTag)

        self._parentClass.RemoveObserver(self._addTargetPointButtonTag)

        self._parentClass.RemoveObserver(self._thresholdSliderTag)

        self._parentClass.RemoveObserver(self._startButtonTag)
        self._parentClass.RemoveObserver(self._resetButtonTag)
    def AddGUIObservers(self):
        SlicerVMTKAdvancedPageSkeleton.AddGUIObservers(self)

        self._isosurfaceLevelThumbWheelTag = self._parentClass.AddObserverByNumber(
            self._isosurfaceLevelThumbWheel, vtkKWThumbWheel_ValueChangedEvent)

        self._startButtonTag = self._parentClass.AddObserverByNumber(
            self._startButton, vtkKWPushButton_InvokedEvent)

        self._resetButtonTag = self._parentClass.AddObserverByNumber(
            self._resetButton, vtkKWPushButton_InvokedEvent)
    def AddGUIObservers(self):
        SlicerVMTKAdvancedPageSkeleton.AddGUIObservers(self)

        self._numberOfSigmaStepsTag = self._parentClass.AddObserverByNumber(self._numberOfSigmaSteps,vtkKWThumbWheel_ValueChangedEvent)
        self._sigmaUnit1Tag = self._parentClass.AddObserverByNumber(self._sigmaUnit.GetWidget().GetWidget(0),vtkKWRadioButton_SelectedStateChangedEvent)
        self._sigmaUnit2Tag = self._parentClass.AddObserverByNumber(self._sigmaUnit.GetWidget().GetWidget(1),vtkKWRadioButton_SelectedStateChangedEvent)
        self._sigmaMinTag = self._parentClass.AddObserverByNumber(self._sigmaMin.GetWidget(),vtkKWSpinBox_ValueChangedEvent)
        self._sigmaMaxTag = self._parentClass.AddObserverByNumber(self._sigmaMax.GetWidget(),vtkKWSpinBox_ValueChangedEvent)
        self._alphaTag = self._parentClass.AddObserverByNumber(self._alpha.GetWidget(),vtkKWSpinBox_ValueChangedEvent)
        self._alpha2Tag = self._parentClass.AddObserverByNumber(self._alpha2.GetWidget(),vtkKWSpinBox_ValueChangedEvent)


        self._startButtonTag = self._parentClass.AddObserverByNumber(self._startButton,vtkKWPushButton_InvokedEvent)
    def UpdateMRML(self):
        SlicerVMTKAdvancedPageSkeleton.UpdateMRML(self)

        node = self._parentClass.GetScriptedModuleNode()

        if node:

            node.SetParameter('SATO_numberOfSigmaSteps',self._numberOfSigmaSteps.GetValue())
            node.SetParameter('SATO_usePhysicalUnits',self._sigmaUnit.GetWidget().GetWidget(0).GetSelectedState())
            node.SetParameter('SATO_sigmaMin',self._sigmaMin.GetWidget().GetValue())
            node.SetParameter('SATO_sigmaMax',self._sigmaMax.GetWidget().GetValue())
            node.SetParameter('SATO_alpha',self._alpha.GetWidget().GetValue())
            node.SetParameter('SATO_alpha2',self._alpha2.GetWidget().GetValue())
    def __init__(self,parentFrame,parentClass):
        SlicerVMTKAdvancedPageSkeleton.__init__(self,parentFrame,parentClass)

        self._welcomeMessage = slicer.vtkKWTextWithHyperlinksWithScrollbars()