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

A lightweight UI for medical visualizations #5: 2D Circular Slider #1222

Merged
merged 8 commits into from Apr 25, 2017

Conversation

ranveeraggarwal
Copy link
Contributor

@ranveeraggarwal ranveeraggarwal commented Apr 14, 2017

Continuing from #1205 and the fourth installment of #1111, this PR adds a Circular Slider element to the Viz module.

Complete blogpost here: http://ranveeraggarwal.com/blog/gsoc-2016-summary

To Do

  • Add tests.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 88.112% when pulling 075d182 on ranveeraggarwal:ui into d3cb337 on nipy:master.

@codecov-io
Copy link

codecov-io commented Apr 14, 2017

Codecov Report

Merging #1222 into master will increase coverage by 0.18%.
The diff coverage is 92.85%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1222      +/-   ##
=========================================
+ Coverage   85.92%   86.1%   +0.18%     
=========================================
  Files         221     223       +2     
  Lines       27270   27893     +623     
  Branches     2785    2828      +43     
=========================================
+ Hits        23431   24018     +587     
- Misses       3154    3177      +23     
- Partials      685     698      +13
Impacted Files Coverage Δ
dipy/viz/tests/test_ui.py 84.46% <73.91%> (-1.33%) ⬇️
dipy/viz/ui.py 91.97% <96.58%> (+1.2%) ⬆️
dipy/reconst/dki.py 96.82% <0%> (-0.82%) ⬇️
dipy/data/fetcher.py 40.35% <0%> (-0.63%) ⬇️
dipy/reconst/mapmri.py 90.25% <0%> (-0.22%) ⬇️
dipy/reconst/dti.py 96.5% <0%> (-0.01%) ⬇️
dipy/utils/six.py 45.71% <0%> (ø) ⬆️
dipy/reconst/tests/test_dki.py 100% <0%> (ø) ⬆️
dipy/data/__init__.py 89.54% <0%> (ø) ⬆️
dipy/reconst/tests/test_dki_micro.py 100% <0%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d3cb337...96cb3b7. Read the comment docs.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.03%) to 88.457% when pulling a2efb97 on ranveeraggarwal:ui into d3cb337 on nipy:master.

@Garyfallidis
Copy link
Contributor

Hi @MarcCote can you check this PR and see if it can be approved? In the meantime, Ranveer make sure you have no identation (or PEP 8) issues here.

Copy link
Contributor

@MarcCote MarcCote left a comment

Choose a reason for hiding this comment

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

So I started to make my review and decided to do some refactoring first, so DiskSlider2D ressembles more LineSlider2D.

See ranveeraggarwal#12

dipy/viz/ui.py Outdated
self.probe.SetPosition((
self.base_disk_center[0] + self.base_disk_radius,
self.base_disk_center[1]))
# /Probe
Copy link
Contributor

Choose a reason for hiding this comment

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

You can remove the /... ending comment.

dipy/viz/ui.py Outdated
float(dy) / float(dx)) * float(x2 - center[0])

d1 = (x1 - point[0])*(x1 - point[0]) + (y1 - point[1])*(y1 - point[1])
d2 = (x2 - point[0])*(x2 - point[0]) + (y2 - point[1])*(y2 - point[1])
Copy link
Contributor

Choose a reason for hiding this comment

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

PEP8: Spaces around *

dipy/viz/ui.py Outdated
return angle

def move_probe(self, click_position):
"""Moves the probe.
Copy link
Contributor

Choose a reason for hiding this comment

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

PEP8: Space after """

dipy/viz/ui.py Outdated

Parameters
----------
click_position: (float, float)
Copy link
Contributor

Choose a reason for hiding this comment

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

PEP8: make sure you put a space between the parameter name and:

dipy/viz/ui.py Outdated
return x2, y2

def get_angle(self, coordinates):
""" Gets the angle made with the X-Axis for calculating
Copy link
Contributor

Choose a reason for hiding this comment

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

PEP8: The short description should fit on one line. What about:

""" Gets the angle the cursor makes with the X-Axis

The angle varies between 0-360.
"""

dipy/viz/ui.py Outdated
perpendicular = -center[1] + coordinates[1]
base = -center[0] + coordinates[0]

angle = math.degrees(math.atan2(float(perpendicular), float(base)))
Copy link
Contributor

Choose a reason for hiding this comment

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

Use numpy instead of the math library.
angle = np.rad2deg(np.arctan2(perpendicular, base))

dipy/viz/ui.py Outdated
Position of the system.
base_disk_radius: float
Average radius of the base disk.
probe_outer_radius: int
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 we should use "handle" instead of "probe". What do you think?

@ranveeraggarwal
Copy link
Contributor Author

@MarcCote looks good, I just made the example clearer and initialised the disk actors to None (easier to understand, IMO). We can merge this once the tests are complete.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.2%) to 88.593% when pulling 96cb3b7 on ranveeraggarwal:ui into d3cb337 on nipy:master.

Copy link
Contributor

@MarcCote MarcCote left a comment

Choose a reason for hiding this comment

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

LGTM @Garyfallidis you can have a look.

@Garyfallidis
Copy link
Contributor

Cool, thanks @ranveeraggarwal. Let's move to the next PRs. :)

@Garyfallidis Garyfallidis merged commit 379ea81 into dipy:master Apr 25, 2017
ShreyasFadnavis pushed a commit to ShreyasFadnavis/dipy that referenced this pull request Sep 20, 2018
A lightweight UI for medical visualizations dipy#5: 2D Circular Slider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants