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

Added navigation features to the sagittal and centerline GUI #1545

Merged
merged 23 commits into from Mar 27, 2018

Conversation

peristeri
Copy link
Contributor

The user can now navigate using the arrow keys. Also, update the canvas dragging
the mouse along the canvas.

Implements #1501

The user can now nagivate using the arrow keys. Also, update the canvas dragging
the mouse along the canvas.

Implements #1501
Copy link
Member

@jcohenadad jcohenadad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* BUG: label_vertebrae: Updated label disc value (fixes #1570)

* REF: fixed typo

* OPT: label_vertebrae: Added instructions above image for sagittal dialog (fixes #1563)
@peristeri
Copy link
Contributor Author

So in other words:

Navigating the sagittal plane: up/down traverses the axial plane and the left/right traverses the corrinal plane. And navigating the axial plane: up/down traverses the corrinal plane and left/right traverses the sagittal plane.

Is that correct?

@jcohenadad
Copy link
Member

i would sum up points as follows:

  • vertebral labeling: in fact, we don't need the axial view. Partly because it is not clear where (SI) it is located (no indication on the sag plane). So only left and right keys could be used to go R and L.
  • propseg: I don't see the need for using the keys there. Unless someone thinks otherwise? @benjamindeleener?
  • add indications on the screen about what keys to use and for what

@benjamindeleener
Copy link
Contributor

@jcohenadad @peristeri I agree for PropSeg. No need for keys control.

@peristeri peristeri added enhancement category: improves performance/results of an existing feature fix:minor labels Mar 23, 2018
@peristeri peristeri self-assigned this Mar 23, 2018
Copy link
Contributor

@perone perone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice ! I added some comments. I just missed function and classes docstrings documentation.

self.setWindowTitle(self.params.dialog_title)

def increment_vertical_nav(self):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is better to raise a NotImplementedError here and on the other abstract methods.

pass

def decrement_vertical_nav(self):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

pass

def increment_horizontal_nav(self):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

pass

def decrement_horizontal_nav(self):
pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

@@ -114,8 +114,26 @@ def _init_ui(self):
QtGui.QShortcut(QtGui.QKeySequence.Save, self, self.on_save_quit)
QtGui.QShortcut(QtGui.QKeySequence.Quit, self, self.close)

QtGui.QShortcut(QtGui.QKeySequence.MoveToNextChar, self, self.increment_vertical_nav)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a lot of shortcuts being added here, maybe it's worth creating mapping list like (keysequence, func) and then iterating over it on a loop to add the shortcuts.

self.setWindowTitle(self.params.dialog_title)

def increment_vertical_nav(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Functions without documentation.

@@ -138,15 +151,15 @@ def _init_controls(self, parent):
custom_mode.setToolTip('Manually select the axis slice on sagittal plane')
custom_mode.toggled.connect(self.on_toggle_mode)
custom_mode.mode = 'CUSTOM'
custom_mode.sagittal_title = 'Select an axial slice'
custom_mode.sagittal_title = 'Select an axial slice.\n%s' % self.params.subtitle
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using the new style string formatting, like the one below where you use the .format().

expected = [(15, 45, 33, 1), (30, 51, 35, 1), (60, 71, 31, 1)]
points = [(x + controller.INTERVAL, y, z) for x, y, z, _ in expected]
controller = self._init_auto()
expected = [(0, 45, 33, 1), (160, 51, 35, 1), (319, 71, 31, 1)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another reason to have namedtuple or something similar here, what is the fourth element on each of these tuples ?

for i in self.annotations:
i.remove()
self.annotations = []
if hasattr(self, 'annotations'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to always have this attribute here. And then you keep it as an empty list when there are no annotations. Then you can do something like:

for i in self.annotations:
    i.remove()
self.annotations.clear()

without having to do the check using hasattr().

if self._plot_points:
controller = self._parent._controller
logger.debug('Plotting points {}'.format(controller.points))
points = [x for x in controller.points if x[0] == controller.position[0]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to add some comments on what is happening here, why the except ValueError below is required, etc.

perone
perone previously approved these changes Mar 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement category: improves performance/results of an existing feature sct_viewer context:
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants