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

Projects
None yet
5 participants
@ranveeraggarwal
Member

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

This comment has been minimized.

coveralls commented Apr 14, 2017

Coverage Status

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

@codecov-io

This comment has been minimized.

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

This comment has been minimized.

coveralls commented Apr 15, 2017

Coverage Status

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

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Apr 18, 2017

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.

@MarcCote

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

See ranveeraggarwal#12

self.probe.SetPosition((
self.base_disk_center[0] + self.base_disk_radius,
self.base_disk_center[1]))
# /Probe

This comment has been minimized.

@MarcCote

MarcCote Apr 20, 2017

Contributor

You can remove the /... ending comment.

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])

This comment has been minimized.

@MarcCote

MarcCote Apr 20, 2017

Contributor

PEP8: Spaces around *

return angle
def move_probe(self, click_position):
"""Moves the probe.

This comment has been minimized.

@MarcCote

MarcCote Apr 20, 2017

Contributor

PEP8: Space after """

Parameters
----------
click_position: (float, float)

This comment has been minimized.

@MarcCote

MarcCote Apr 20, 2017

Contributor

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

return x2, y2
def get_angle(self, coordinates):
""" Gets the angle made with the X-Axis for calculating

This comment has been minimized.

@MarcCote

MarcCote Apr 20, 2017

Contributor

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.
"""
perpendicular = -center[1] + coordinates[1]
base = -center[0] + coordinates[0]
angle = math.degrees(math.atan2(float(perpendicular), float(base)))

This comment has been minimized.

@MarcCote

MarcCote Apr 20, 2017

Contributor

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

Position of the system.
base_disk_radius: float
Average radius of the base disk.
probe_outer_radius: int

This comment has been minimized.

@MarcCote

MarcCote Apr 20, 2017

Contributor

I think we should use "handle" instead of "probe". What do you think?

@ranveeraggarwal ranveeraggarwal referenced this pull request Apr 21, 2017

Merged

Refactoring #12

@ranveeraggarwal

This comment has been minimized.

Member

ranveeraggarwal commented Apr 21, 2017

@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

This comment has been minimized.

coveralls commented Apr 21, 2017

Coverage Status

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

@MarcCote

LGTM @Garyfallidis you can have a look.

@Garyfallidis

This comment has been minimized.

Member

Garyfallidis commented Apr 25, 2017

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

@Garyfallidis Garyfallidis merged commit 379ea81 into nipy:master Apr 25, 2017

4 checks passed

codecov/patch 92.85% of diff hit (target 85.92%)
Details
codecov/project 86.1% (+0.18%) compared to d3cb337
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
coverage/coveralls Coverage increased (+0.2%) to 88.593%
Details

ShreyasFadnavis pushed a commit to ShreyasFadnavis/dipy that referenced this pull request Sep 20, 2018

Merge pull request nipy#1222 from ranveeraggarwal/ui
A lightweight UI for medical visualizations nipy#5: 2D Circular Slider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment