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

Add option to edit help text #441

Merged
merged 6 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Changelog

## v24.0.2
## v24.1.0

Enhancements:
- Add option to edit help text #441
- Update corner annotation with axis label #433
- Add title to ViewerCoordsDockWidget #422
- Adds methods to CILviewer and CILviewer2D #425
Expand Down
43 changes: 23 additions & 20 deletions Wrappers/Python/ccpi/viewer/CILViewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def __init__(self, callback):
self.AddObserver('LeftButtonReleaseEvent', self.OnLeftMouseRelease)
#self.AddObserver('RightButtonPressEvent', self.OnRightMousePress, -0.5)
#self.AddObserver('RightButtonReleaseEvent', self.OnRightMouseRelease, -0.5)
self.htext = None

def GetSliceOrientation(self):
return self._viewer.sliceOrientation
Expand Down Expand Up @@ -323,7 +324,7 @@ def DisplayHelp(self):
self.Render()
return

font_size = 24
font_size = 16

# Create the text mappers and the associated Actor2Ds.

Expand All @@ -340,25 +341,27 @@ def DisplayHelp(self):
# The text is on multiple lines and center-justified (both horizontal and
# vertical).
textMapperC = vtk.vtkTextMapper()
textMapperC.SetInput("Mouse Interactions:\n"
"\n"
" - Slice: Mouse Scroll\n"
" - Zoom: Right Mouse + Move Up/Down\n"
" - Pan: Middle Mouse Button + Move or Shift + Left Mouse + Move\n"
" - Adjust Camera: Left Mouse + Move\n"
" - Rotate: Ctrl + Left Mouse + Move\n"
"\n"
"Keyboard Interactions:\n"
"\n"
"h: Display this help\n"
"x: YZ Plane\n"
"y: XZ Plane\n"
"z: XY Plane\n"
"r: Save render to current_render.png\n"
"s: Toggle visibility of slice\n"
"v: Toggle visibility of volume render\n"
"c: Activates volume render clipping plane widget\n"
"a: Whole image Auto Window/Level\n")
if self.htext == None:
self.htext = """
Mouse Interactions:
- Slice: Mouse Scroll
- Zoom: Right Mouse + Move Up/Down
- Pan: Middle Mouse Button + Move or Shift + Left Mouse + Move
- Adjust Camera: Left Mouse + Move
- Rotate: Ctrl + Left Mouse + Move

Keyboard Interactions:
h: Display this help
x: YZ Plane
y: XZ Plane
z: XY Plane
r: Save render to current_render.png
s: Toggle visibility of slice
v: Toggle visibility of volume render
c: Activates volume render clipping plane widget
a: Whole image Auto Window/Level
"""
textMapperC.SetInput(self.htext)
tprop = textMapperC.GetTextProperty()
tprop.ShallowCopy(multiLineTextProp)
tprop.SetJustificationToLeft()
Expand Down
60 changes: 32 additions & 28 deletions Wrappers/Python/ccpi/viewer/CILViewer2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def __init__(self, callback):
self.dy = 0

self._reslicing_enabled = True
self.htext = None

@property
def reslicing_enabled(self):
Expand Down Expand Up @@ -896,7 +897,7 @@ def DisplayHelp(self):
self.Render()
return

font_size = 24
font_size = 16

# Create the text mappers and the associated Actor2Ds.

Expand All @@ -913,33 +914,36 @@ def DisplayHelp(self):
# The text is on multiple lines and center-justified (both horizontal and
# vertical).
textMapperC = vtk.vtkTextMapper()
textMapperC.SetInput("Mouse Interactions:\n"
"\n"
" - Slice: Mouse Scroll\n"
" - Quick Slice: Shift + Mouse Scroll\n"
" - Pick: Left Click\n"
" - Zoom: Shift + Right Mouse + Move Up/Down\n"
" - Pan: Ctrl + Right Mouse + Move\n"
" - Adjust Window: Alt+ Right Mouse + Move Up/Down\n"
" - Adjust Level: Alt + Right Mouse + Move Left/Right\n"
" Region of Interest (ROI):\n"
" - Create: Ctrl + Left Click\n"
" - Delete: Alt + Left Click\n"
" - Resize: Click + Drag handles\n"
" - Translate: Middle Mouse + Move within ROI\n"
"\n"
"Keyboard Interactions:\n"
"\n"
" - a: Whole image Auto Window/Level\n"
" - w: Region around cursor Auto Window/Level\n"
" - l: Line Profile at cursor\n"
" - s: Save Current Image\n"
" - x: YZ Plane\n"
" - y: XZ Plane\n"
" - z: XY Plane\n"
" - t: Tracing\n"
" - i: toggle interpolation of slice\n"
" - h: this help\n")
if self.htext == None:
self.htext = """
Mouse Interactions:
- Slice: Mouse Scroll
- Quick Slice: Shift + Mouse Scroll
- Pick: Left Click
- Zoom: Shift + Right Mouse + Move Up/Down
- Pan: Ctrl + Right Mouse + Move
- Adjust Window: Alt+ Right Mouse + Move Up/Down
- Adjust Level: Alt + Right Mouse + Move Left/Right

Region of Interest (ROI):
- Create: Ctrl + Left Click
- Delete: Alt + Left Click
- Resize: Click + Drag handles
- Translate: Middle Mouse + Move within ROI

Keyboard Interactions:
h: This help
x: YZ Plane
y: XZ Plane
z: XY Plane
a: Whole image Auto Window/Level
w: Region around cursor Auto Window/Level
l: Line Profile at cursor
s: Save Current Image
t: Tracing
i: Toggle interpolation of slice
"""
textMapperC.SetInput(self.htext)
tprop = textMapperC.GetTextProperty()
tprop.ShallowCopy(multiLineTextProp)
tprop.SetJustificationToLeft()
Expand Down
Loading