Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions ZFrameRegistrationWithROI/ZFrameRegistrationWithROI.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ def setup(self):
ScriptedLoadableModuleWidget.setup(self)
self.logic = ZFrameRegistrationWithROILogic()
self.setupSliceWidgets()
self.annotationLogic = slicer.modules.annotations.logic()
self.zFrameRegistrationClass = OpenSourceZFrameRegistration
self.roiObserverTag = None
self.coverTemplateROI = None
Expand Down Expand Up @@ -193,7 +192,7 @@ def addROIObserver(self):
@vtk.calldata_type(vtk.VTK_OBJECT)
def onNodeAdded(caller, event, calldata):
node = calldata
if isinstance(node, slicer.vtkMRMLAnnotationROINode):
if isinstance(node, slicer.vtkMRMLMarkupsROINode):
self.removeROIObserver()
self.coverTemplateROI = node
self.runZFrameRegistrationButton.enabled = self.isRegistrationPossible()
Expand All @@ -210,13 +209,12 @@ def removeROIObserver(self):
self.roiObserverTag = slicer.mrmlScene.RemoveObserver(self.roiObserverTag)

def setROIMode(self, mode):
mrmlScene = self.annotationLogic.GetMRMLScene()
selectionNode = mrmlScene.GetNthNodeByClass(0, "vtkMRMLSelectionNode")
selectionNode.SetReferenceActivePlaceNodeClassName("vtkMRMLAnnotationROINode")
selectionNode = slicer.mrmlScene.GetNthNodeByClass(0, "vtkMRMLSelectionNode")
selectionNode.SetReferenceActivePlaceNodeClassName("vtkMRMLMarkupsROINode")
if mode == False:
self.annotationLogic.StopPlaceMode(False)
slicer.mrmlScene.GetNodeByID("vtkMRMLInteractionNodeSingleton").SwitchToViewTransformMode() # stop place mode
else:
self.annotationLogic.StartPlaceMode(False)
slicer.modules.markups.logic().StartPlaceMode(False)

def onApplyZFrameRegistrationButtonClicked(self):
self.retryZFrameRegistrationButton.enabled = True
Expand Down Expand Up @@ -440,7 +438,7 @@ def test_ZFrameRegistrationWithROI1(self):
self.delayDisplay('Finished with loading')

zFrameRegistrationLogic = ZFrameRegistrationWithROILogic()
ROINode = slicer.vtkMRMLAnnotationROINode()
ROINode = slicer.vtkMRMLMarkupsROINode()
ROINode.SetName("ROINodeForCropping")
ROICenterPoint = [-6.91920280456543, 15.245062828063965, -101.13504791259766]
ROINode.SetXYZ(ROICenterPoint)
Expand Down Expand Up @@ -545,4 +543,4 @@ def onSplitterClick(self):

print(sys.argv)

slicelet = ZFrameRegistrationWithROISlicelet()
slicelet = ZFrameRegistrationWithROISlicelet()