Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3D and 2D view not consistent #409

Open
DanicaSTFC opened this issue May 22, 2024 · 2 comments
Open

3D and 2D view not consistent #409

DanicaSTFC opened this issue May 22, 2024 · 2 comments

Comments

@DanicaSTFC
Copy link
Collaborator

DanicaSTFC commented May 22, 2024

It could happen here, so maybe viewer issue

self.camera.SetViewUp(0, -1, 0)
if not self.axes_initialised:
self.camera.Azimuth(180)

Change camera view

self.resetCameraToDefault()

if new_slice_orientation == SLICE_ORIENTATION_XY:
# Equivalent to pressing z
if orientation == SLICE_ORIENTATION_YZ:
self.FlipCameraPosition(True)
camera.Elevation(90)
elif orientation == SLICE_ORIENTATION_XZ:
camera.Elevation(-90)
self.FlipCameraPosition(True)
camera.SetViewUp(0, -1, 0)
elif new_slice_orientation == SLICE_ORIENTATION_XZ:
# Equivalent to pressing y
if orientation == SLICE_ORIENTATION_XY:
camera.Elevation(90)
self.FlipCameraPosition(True)
elif orientation == SLICE_ORIENTATION_YZ:
camera.Azimuth(90)
camera.SetViewUp(0, 0, -1)
elif new_slice_orientation == SLICE_ORIENTATION_YZ:
# Equivalent to pressing x
if orientation == SLICE_ORIENTATION_XY:
camera.Azimuth(270)
elif orientation == SLICE_ORIENTATION_XZ:
self.FlipCameraPosition(True)
camera.Azimuth(90)
camera.SetViewUp(0, 0, -1)

Issue opened in iDVC, but needs to be resolved in the viewer. See TomographicImaging/iDVC#240 (comment)

@DanicaSTFC DanicaSTFC added this to the Version 24.0.0 milestone May 22, 2024
@DanicaSTFC DanicaSTFC moved this to 🔖 To do in iDVC Planning May 22, 2024
@DanicaSTFC DanicaSTFC moved this from 🔖 To do to 📋 On hold in iDVC Planning May 22, 2024
@paskino
Copy link
Collaborator

paskino commented May 24, 2024

This would change the camera elevation but, it doesn't work very well as the orientation marker doesn't get updated. See the VTK Text book

# do a full Elevation + 180 degrees
camera = vtk.vtkCamera()

camera.DeepCopy(self.getCamera())
camera.Elevation(180)

self.getRenderer().SetActiveCamera(camera)
om = self.orientation_marker.GetOrientationMarker()
om.Modified()
self.renWin.Render()

@DanicaSTFC DanicaSTFC assigned paskino and unassigned paskino Jun 5, 2024
@DanicaSTFC DanicaSTFC removed the status in iDVC Planning Jun 10, 2024
@DanicaSTFC DanicaSTFC removed this from the Version 24.0.0 milestone Jun 10, 2024
@paskino
Copy link
Collaborator

paskino commented Jun 12, 2024

in the toolbar3d branch I change the position of the camera (as here) and create an animation with an orbit around the object.

Possibly what's missing is adjustCamera

camera = vtk.vtkCamera()
camera.SetFocalPoint(FocalPoint)
camera.SetViewUp(ViewUp)
camera.SetPosition(*NewLocation)
viewer.ren.SetActiveCamera(camera)
viewer.adjustCamera()
import time
time.sleep(0.05)
print("render frame {} angle {}".format(x, angle))
print('Camera Position: {}'.format(NewLocation))
rp = numpy.sqrt(((NewLocation[0]-FocalPoint[0])**2)
+(NewLocation[1]-FocalPoint[1])**2)
print ('Camera trajectory radius {}'.format(rp))
viewer.saveRender('test_{}'.format(x))
#Rendering and saving the render
viewer.getRenderer().Render()
viewer.renWin.Render()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants