I am going to have two 3d fly-window just like right-left eye. Firstly, I am planing to create dual contacting endoscope windows.
can I have two endoscope
Hi -
The Endoscopy module was one of the first (maybe even the very first) scripted module in Slicer 4, so it doesnât have all the things we might want. So unless it gets reworked, it only supports a single flythrough setup and the state is not saved with the mrml scene.
Best,
Steve
You can create two parallel trajectories for two cameras respectively. The motion of two cameras should be synchronous. Modified scripted module is required to achieve this!
Thanks Steve Pieper.
can I change the self-detection code to achieve my aim
# Remove previous observer
if self.cameraNode and self.cameraNodeObserverTag:
self.cameraNode.RemoveObserver(self.cameraNodeObserverTag)
if self.camera and self.cameraObserverTag:
self.camera.RemoveObserver(self.cameraObserverTag)
newCamera = None
if newCameraNode:
newCamera = newCameraNode.GetCamera()
# Add CameraNode ModifiedEvent observer
self.cameraNodeObserverTag = newCameraNode.AddObserver(vtk.vtkCommand.ModifiedEvent, self.onCameraNodeModified)
# Add Camera ModifiedEvent observer
self.cameraObserverTag = newCamera.AddObserver(vtk.vtkCommand.ModifiedEvent, self.onCameraNodeModified)
self.cameraNode = newCameraNode
self.camera = newCamera
# Update UI
self.updateWidgetFromMRML()
def updateWidgetFromMRML(self):
if self.camera:
self.viewAngleSlider.value = self.camera.GetViewAngle()
if self.cameraNode:
pass
Thank you very much!
can you help me ?
Hi @timeanddoctor -
Itâs great if you want to try this out - I see you already have a fork of Slicer in your github account. If you start developing from there it will be easy to create âdiffâ links that show what edits you have made and people here can comment.
Best,
Steve
I add âsecond cameranodeâ and âeyesAngleSliderâ widget. And I have some troubles now.
First, did I should change the variable name from âcameraNodeSelectorâ to âcameraNodeSelector1â for Camera1.
# Camera node second selector
cameraNodeSelector = slicer.qMRMLNodeComboBox()
cameraNodeSelector.objectName = âcameraNodeSelectorâ
cameraNodeSelector.toolTip = âSelect a camera that will fly along this path.â
cameraNodeSelector.nodeTypes = [âvtkMRMLCameraNodeâ]
cameraNodeSelector.noneEnabled = False
cameraNodeSelector.addEnabled = False
cameraNodeSelector.removeEnabled = False
cameraNodeSelector.connect(âcurrentNodeChanged(bool)â, self.enableOrDisableCreateButton)
cameraNodeSelector.connect(âcurrentNodeChanged(vtkMRMLNode*)â, self.setCameraNode)
pathFormLayout.addRow(âCamera:â, cameraNodeSelector)
self.parent.connect(âmrmlSceneChanged(vtkMRMLScene*)â,
cameraNodeSelector, âsetMRMLScene(vtkMRMLScene*)â)
Second, the eyesAngleSlider seems wrong.
# View angle of left-right eyes slider
eyesAngleSlider = ctk.ctkSliderWidget()
eyesAngleSlider.connect('valueChanged(double)', self.eyesAngleSliderValueChanged)
eyesAngleSlider.decimals = 0
eyesAngleSlider.minimum = 1
eyesAngleSlider.maximum = 60
flythroughFormLayout.addRow("eyes Angle:", eyesAngleSlider)
Can I create a âTransformâ between the âCameraâ and âCamera1â to have a Synchronize-Fly-window.
@Davide_Punzo worked on synchronizing camera views. I think there is a solution for setting relative transforms between cameras but I donât remember how it can be configured.