Can I have two endoscope fly-window with dual 3D


(Timeanddoctor) #1

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


(Steve Pieper) #2

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


#3

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!


(Timeanddoctor) #4

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


(Timeanddoctor) #5

Thank you very much!
can you help me ?


(Timeanddoctor) #6

(Steve Pieper) #7

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


(Timeanddoctor) #8

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)

(Timeanddoctor) #9

Can I create a “Transform” between the “Camera” and “Camera1” to have a Synchronize-Fly-window.


(Andras Lasso) #10

@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.