Giter VIP home page Giter VIP logo

fury's People

Contributors

antrikshmisri avatar arokem avatar chrls98 avatar clarkszw avatar devmessias avatar dmreagan avatar filipinascimento avatar ganimtron-10 avatar garyfallidis avatar guaje avatar joaodell avatar kakashihatakae avatar karandeepsj avatar lenixlobo avatar m-agour avatar maharshi-gor avatar marccote avatar matthew-brett avatar nasimanousheh avatar nibba2018 avatar paulnicolashunter avatar ranveeraggarwal avatar saransh0905 avatar skoudoro avatar sreekarchigurupati avatar suntzunami avatar tushar5526 avatar tvcastillod avatar xantric avatar xtanion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fury's Issues

How to resolve python-vtk6 link issues in Ubuntu

From @Garyfallidis on November 2, 2015 0:54

Moving back to python-vtk6 from vtk5(python-vtk) creates an error

<ipython-input-1-b7e11aadda62> in <module>()
----> 1 import vtk

/usr/lib/python2.7/dist-packages/vtk/__init__.py in <module>()
37 
38 # --------------------------------------
---> 39 from vtkCommonCore import *
40 from vtkCommonMath import *
41 from vtkCommonMisc import *

/usr/lib/python2.7/dist-packages/vtk/vtkCommonCore.py in <module>()
----> 1 from vtkCommonCorePython import *

ImportError: No module named vtkCommonCorePython

The resolution was to relink the broken so files

So I went to /usr/lib/x86_64-linux-gnu and ran for i in *-6.0.so.6.0; do sudo ln -s $i ${i/-6.0.so.6.0/-6.0.so}; done. 

(May need sudo first too)

The rest of the discussion is found here
http://stackoverflow.com/questions/13495285/importerror-no-module-named-vtkcommonpython

Copied from original issue: dipy/dipy#759

GLTF 2.0

here some good news about GLTF 2.0 that we need to study and play with.
Potential use for a dynamic scene on our documentation.

fvtk contour function ignores voxsz parameter

From @mick-d on May 12, 2015 22:34

When trying to display an ROI, fvtk render the slice in the same place, even when provided with a different voxsz parameter.
In my case the following two commands provided the same results:

cc_ROI_actor = fvtk.contour(my_ROI_data, levels=[1], colors=[(1., 1., 0.)], opacities=[1.], voxsz=(2.5, 2.5, 2.5)) 
r = fvtk.ren()
fvtk.add(r, cc_ROI_actor)
fvtk.show(r)
cc_ROI_actor = fvtk.contour(my_ROI_data, levels=[1], colors=[(1., 1., 0.)], opacities=[1.]) 
fvtk.clear(r)
fvtk.add(r, cc_ROI_actor)
fvtk.show(r)

Copied from original issue: dipy/dipy#647

Tests Documentation

  • Add instructions for running the tests on the documentation
  • Add instructions for running the tests on the main README

Fix DeprecationWarning

We have to fix this 2 warnings:

/Users/skab/Software/fury/fury/window.py:942: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
  flags[i] = np.any(np.all(im == col, axis=-1))

/Users/skab/Software/fury/fury/window.py:274: DeprecationWarning: Class 'fury.window.add' is deprecated, instead use class 'fury.window.Scene.add'.
  " use class 'fury.window.Scene.add'.", DeprecationWarning)

Possibly remove or rename on_change

Let's say you build a LineSlider2D

linesl = LineSlider2D()
def callback(slider):
    do something

linesl.on_change = callback

that should work.
But if you want to connect to a specific event. You need to do

linesl.handle_events(volume_slider.handle.actor)
volume_slider.on_left_mouse_button_released = callback2

But now callback2 needs a different signature

def callback2(iren, obj, slider):
     do something
     iren.force_render()

It becomes quite misleading to have two types of supported callbacks.
Furthermore, it is strange that the LineSlider needs to call handle_events first. Other UI components do not require that.

Finally, what on_change means for people? Is it click, is it move, is it dragged, is it all together?

Dipy visualization with missing (?) affine parameter

From @mick-d on May 12, 2015 22:30

I would like to add slices and other elements in dipy fvtk visualization but no affine parameter is available for element such as dipy.viz.fvtk.slicer. The voxsz parameter helps rescaling but what about rotation/translation/etc.?

Copied from original issue: dipy/dipy#646

Slicer problem + clamping

from @gauvinalexandre February 28, 2016 08:15

I discovered a major contradiction and bug in the value scaling and lookup table making of the slicer feature. I found the way to make it work. Therefore, the behavior of the slicer changed and the test_fvtk_actors fails, probably with reason. It has to be adapted. I'll need help, since I don't know how to interpret the error. Also, there were some mistakes in the doc-strings. I took the occasion to clean the code. I've tested the Slicer with VTK 5 and 6 the best I could and ran the fvtk_actor test. Everything looks good.

Created as reminder of dipy/dipy#944

Dipy visualization (fvtk) crash when saving series of images

From @mick-d on May 12, 2015 22:29

I wrote a script to save a series of slice visualization (ellipsoids) with dipy vtk module (fvtk). However after a few slices (around 6) python crashes with only error message "Segmentation fault (core dumped)".

The script goes:

tenmodel = dti.TensorModel(my_gradient_table)
tenfit = tenmodel.fit(my_masked_dwi_data)
RGB = color_fa(my_FA_image, tenfit.evecs)
sphere = get_sphere('symmetric724')
ren = fvtk.ren()
for iSlice in range(0,tenfit.evals.shape[2]):
    fvtk.add(ren, fvtk.tensor(tenfit.evals[:,:,iSlice:iSlice+1], tenfit.evecs[:,:,iSlice:iSlice+1], RGB_scaled[:,:,iSlice:iSlice+1], sphere))
    fvtk.record(ren, n_frames=1, out_path='slice_'+("%03d" % iSlice)+'.png', size=(1000, 1000)) 
    fvtk.clear(ren) 

Copied from original issue: dipy/dipy#645

Save from active window?

It used to be possible to save from an active window by hitting the 's' button. Was that functionality deprecated/altered? How do I now save from an active window?

dipy test failed on mac osx sierra with ananoda python.

From @TakafumiYano on May 22, 2018 18:6

Description

dipy test failed on mac osx sierra with ananoda python. I installed dipy 0.14 on mac osx with conda command, but it failed to pass the test.

[error log]
FAIL: dipy.viz.tests.test_widgets.test_button_and_slider_widgets

Traceback (most recent call last):
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/util.py", line 620, in newfunc
return func(*arg, **kw)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/decorators.py", line 147, in skipper_func
return f(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/testing/decorators.py", line 68, in test_with_xvfb
my_test(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/viz/tests/test_widgets.py", line 123, in test_button_and_slider_widgets
npt.assert_equal(report.objects, 4)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/utils.py", line 416, in assert_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: 6
DESIRED: 4

FAIL: dipy.viz.tests.test_window.test_order_transparent

Traceback (most recent call last):
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/util.py", line 620, in newfunc
return func(*arg, **kw)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/decorators.py", line 147, in skipper_func
return f(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/testing/decorators.py", line 68, in test_with_xvfb
my_test(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/viz/tests/test_window.py", line 211, in test_order_transparent
npt.assert_equal(arr[150, 150][1] > arr[150, 150][0], True)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/utils.py", line 416, in assert_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: False
DESIRED: True


Ran 703 tests in 590.324s

FAILED (SKIP=8, failures=2)
Out[2]: <nose.result.TextTestResult run=703 errors=0 failures=2>

Way to reproduce

  1. installing the anaconda (python 3.6)
  2. conda install -c conda-forge dipy
  3. conda install vtk
  4. ipython
  5. import dipy
  6. dipy.test()

Copied from original issue: dipy/dipy#1532

generating directed arrows

Hello,
I have been trying to generate directed arrows using fury's arrow function but it doesn't seem to work. I ended up writing a function on my own for the same.
I think it would a good addition to fury.

directed_arrow

contour_from_label

Description

like contour_from_roi, add the possibility to create the contours of a labeled array.

Hide/Ignore numpy_vtk support warning

As you can see here, the warning above appears a lot. Since this warning has been fixed on VTK master, we should hide it.

/home/travis/envs/miniconda/envs/testenv/lib/python3.6/site-packages/vtk/util/numpy_support.py:137: FutureWarning: Conversion of the second argument of issubdtype from `complex` to `np.complexfloating` is deprecated. In future, it will be treated as `np.complex128 == np.dtype(complex).type`.
    assert not numpy.issubdtype(z.dtype, complex), \

Restructuring ui and actors module

Description

ui.py and actors.py start to be huge so it would good to start some thinking on this file restructuration. We need to convert them to package and submodule.

It would be good to do a short meeting (30-45min) this week or next week to talk about it. If you have some suggestion, feel free to describe your proposition here.

What do you think @MarcCote @ranveeraggarwal @Garyfallidis @dmreagan? Thank you in advance for your feedback.

Slider vertical layout

Description

Currently, the slider layout is only horizontal. It will be good to allow the vertical slider.

VTK and Python 3 support in fvtk

From @grlee77 on January 29, 2016 23:15

It looks like the soon to be released VTK 7 finally supports Python 3! However, vtkVolumeTextureMapper2D is now deprecated in VTK7 so it can no longer be used in fvtk.volume (see here: http://www.vtk.org/Wiki/VTK/API_Changes_6_3_0_to_7_0_0 ). I am not sure what is an equivalent replacement if any. The good news is that it seems minimal changes to fvtk will be required to support VTK 7.

I ran many examples and the tests for VTK7 from the current release branch and things are looking pretty good. I propose a few minor fixes (mostly related to Python 3, not VTK 7) in #853

I only got two test failures with VTK 7 / Python 3.4:

ERROR: dipy.viz.tests.test_fvtk.test_fvtk_functions
----------------------------------------------------------------------

File "/media/Data1/src_repositories/my_git/dipy/dipy/viz/fvtk.py", line 494, in volume
    mapper = vtk.vtkVolumeTextureMapper2D()
AttributeError: 'module' object has no attribute 'vtkVolumeTextureMapper2D'

That one is avoided via b99d107227058b7e8bc58c8f1f64810f69d74235

However I am not sure what is causing the issue in this one:

FAIL: dipy.viz.tests.test_fvtk_window.test_order_transparent
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/lee8rx/anaconda/envs/py34/lib/python3.4/site-packages/nose-1.3.7-py3.4.egg/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/lee8rx/anaconda/envs/py34/lib/python3.4/site-packages/nose-1.3.7-py3.4.egg/nose/util.py", line 620, in newfunc
    return func(*arg, **kw)
  File "/home/lee8rx/anaconda/envs/py34/lib/python3.4/site-packages/numpy/testing/decorators.py", line 146, in skipper_func
    return f(*args, **kwargs)
  File "/home/lee8rx/anaconda/envs/py34/lib/python3.4/site-packages/dipy/testing/decorators.py", line 68, in test_with_xvfb
    my_test()
  File "/home/lee8rx/anaconda/envs/py34/lib/python3.4/site-packages/dipy/viz/tests/test_fvtk_window.py", line 224, in test_order_transparent
    npt.assert_equal(arr[150, 150][0] > arr[150, 150][1], True)
  File "/home/lee8rx/anaconda/envs/py34/lib/python3.4/site-packages/numpy/testing/utils.py", line 355, in assert_equal
    raise AssertionError(msg)
AssertionError:
Items are not equal:
 ACTUAL: False
 DESIRED: True

The images produced look like this:

green_front.png
green_front

red_front.png
red_front

Copied from original issue: dipy/dipy#854

Reorienting peak_slicer and ODF_slicer

From @Garyfallidis on July 7, 2017 19:10

This is a reminder that I have not implemented yet the part that applies the rotational parts of the affines in the ODFs and peak_directions. When you move from native coordinates to world coordinates there are usually some rotations and scales involved. I am currently not applying those.

Copied from original issue: dipy/dipy#1295

Improvements from VTK 8.2.0?

Kitware has announced the release of VTK 8.2.0. Is there anything FURY should take advantage of?

Relevant bits include:

VTK Python modules have been restructured to support importing specific modules without importing all of VTK. This improves import speeds substantially. To use this, import vtkmodules package instead of vtk.

Added support for testing OpenGL capabilities at run time on windows and falling back to Mesa software rendering (see vtkTestOpenGLVersion.h)

One can now modify or use custom shaders with the GPU volume mapper to tweak final rendering.

Improved the usability of custom volume shaders in vtkOpenGLGPURaycastMapper by allowing to declare and set the value of custom uniform variables through a new class (vtkOpenGLUniforms).

The default method for handling translucent rendering is now a single pass order independent simulated translucency approach which yields much nicer results than the previous alpha blending approach.

The 3D Glyph mapper has been updated and it can now take in four component vectors and better handle rotations.

PolyData based mappers now support multi-texturing

Support for Oculus touch controllers added

The hardware accelerated volume mapper can now assign a special intensity value for voxels in the clipped area. This can be used to generate smooth surface shaded faces at the clipping interface.

The volume mapper can now directly render isosurfaces, saving the time and memory usually reserved to first extract isosurface geometry.

We now have a tone mapping render pass. This is an elegant way to handle scenes like those in the real world that have high luminosity ranges.

Plans for viz module

From @Garyfallidis on June 1, 2018 21:28

Here some ideas for moving forward with the viz module. These are the notes after a call that I had with @MarcCote.

  • Currently the UI elements have on_xxx callbacks as attributes that can be set any time. We would like to have something similar for all the different actors too. For now you can connect an actor and it's callback using ShowManager.iren.add_callback.

  • Timer_callbacks are currently added at the level of the ShowManager (see PR #1528). It maybe beneficial for simplicity to add a the generic add_callback function at the level of ShowManager rather iren.

  • Hovering event is currently not working very well. Needs some thinking.

  • Splitting of the viz module is scheduled for the next coming weeks and definitely before release 0.15.
    @skoudoro and myself will lead the split. New project name is currently pending. Let us know if you have ideas.

  • @karandeepSJ, @ranveeraggarwal and @naveenkumarmarri will have to update their PRs after recent merge of #1492

  • Simple image and track interface will be added by @Garyfallidis

  • The grid system will be added by @MarcCote.

  • A 3D orbital menu needs to be refactored by @ranveeraggarwal

  • Shaders will be added by @dmreagan, @thechargedneutron and myself. Others more than welcome to contribute.

  • The record events mechanism in tests needs to be reconsidered. It is currently difficult to replicate the test. Maybe we should be using our own timer_callbacks (see tests of #1528) . Will have to put some use cases down and see what we can get.

  • Support for old vtk versions (< vtk 8.1) should be removed. With the new PYPI installers for VTK packaging is much easier. And the code can become simpler.

@MarcCote and all, update here if we some information is missing.

Copied from original issue: dipy/dipy#1544

Reorienting peak_slicer and ODF_slicer

From @Garyfallidis on July 7, 2017 19:10

This is a reminder that I have not implemented yet the part that applies the rotational parts of the affines in the ODFs and peak_directions. When you move from native coordinates to world coordinates there are usually some rotations and scales involved. I am currently not applying those.

Copied from original issue: dipy/dipy#1295

--random_colors not distinguishable

When I visualize multiple tracts in .trk format with the flag --random_colors, it is hard to distinguish overlapping tracts since they have similar colors (in the case of 4 tracts, 2 are purple and two are green). It would be better to have distinguishable colors.

Rename Renderer to Scene

Hello all,

I suggest renaming Renderer to SceneManager or just Scene. We can keep Renderer for backwords compatibility for long time. Scene seems a much more informative name.

I further suggest renaming ShowManager to Show and the same for upcoming TimelineManager to be just Timeline.

Double slider handles not at right position when window starts

Notice that the handles are not aligned with the track. This happens when the application starts. When the handles are being dragged then they go to the correct position.

image

Here is some small snippet to replicate the issue

from fury import actor, window, ui

axes = actor.axes()

scene = window.Scene()
scene.add(axes)

showm = window.ShowManager(scene=scene, size=(1200, 900))

dslider = ui.LineDoubleSlider2D(shape="square")

panel = ui.Panel2D(size=(400, 400))

panel.add_element(dslider, (40, 40))

scene.add(panel)

showm.initialize()
showm.render()
showm.start()

@karandeepSJ can you help/advise?

dipy test failed on mac osx sierra with ananoda python.

From @TakafumiYano on May 22, 2018 18:6

Description

dipy test failed on mac osx sierra with ananoda python. I installed dipy 0.14 on mac osx with conda command, but it failed to pass the test.

[error log]
FAIL: dipy.viz.tests.test_widgets.test_button_and_slider_widgets

Traceback (most recent call last):
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/util.py", line 620, in newfunc
return func(*arg, **kw)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/decorators.py", line 147, in skipper_func
return f(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/testing/decorators.py", line 68, in test_with_xvfb
my_test(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/viz/tests/test_widgets.py", line 123, in test_button_and_slider_widgets
npt.assert_equal(report.objects, 4)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/utils.py", line 416, in assert_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: 6
DESIRED: 4

FAIL: dipy.viz.tests.test_window.test_order_transparent

Traceback (most recent call last):
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/nose/util.py", line 620, in newfunc
return func(*arg, **kw)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/decorators.py", line 147, in skipper_func
return f(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/testing/decorators.py", line 68, in test_with_xvfb
my_test(*args, **kwargs)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/dipy/viz/tests/test_window.py", line 211, in test_order_transparent
npt.assert_equal(arr[150, 150][1] > arr[150, 150][0], True)
File "/Users/takafumi/.pyenv/versions/anaconda3-5.0.0/lib/python3.6/site-packages/numpy/testing/utils.py", line 416, in assert_equal
raise AssertionError(msg)
AssertionError:
Items are not equal:
ACTUAL: False
DESIRED: True


Ran 703 tests in 590.324s

FAILED (SKIP=8, failures=2)
Out[2]: <nose.result.TextTestResult run=703 errors=0 failures=2>

Way to reproduce

  1. installing the anaconda (python 3.6)
  2. conda install -c conda-forge dipy
  3. conda install vtk
  4. ipython
  5. import dipy
  6. dipy.test()

Copied from original issue: dipy/dipy#1532

window.record() resolution limit

From @dmreagan on February 9, 2018 18:43

Description

window.record() can be used to save a render to a PNG image. If you set the size to be higher than your monitor size, the resulting image will be capped to just under your monitor's resolution. For example, if you set size=(5000, 5000), but your monitor's resolution is (1920, 1080), the image width will end up being something like 1916 pixels.

Way to reproduce

Run any viz example that saves a render with window.record(), but change the size to be very high. Tested on Windows and Mac with VTK 7.

Copied from original issue: dipy/dipy#1420

Strange behavior in Linux only machines concerning event_recording and testing

Description

Some tests fail in Linux and pass in Windows and Mac. Unexpected. Tests pass in Travis too with virtualgl and mesa.

Here are the reported failures in Ubuntu 18.04 64 with Nvidia GeForce GTX 1070 GPU.

=================================== FAILURES ===================================
_____________________________ test_ui_button_panel _____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:273: in test_ui_button_panel
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239b06ba8>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239b064e0>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'RightButtonReleaseEvent'.
E            ACTUAL: 0
E            DESIRED: 3

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_______________________________ test_ui_textbox ________________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:305: in test_ui_textbox
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239a87470>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239a87518>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'KeyPressEvent'.
E            ACTUAL: 0
E            DESIRED: 62

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
____________________________ test_ui_ring_slider_2d ____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:518: in test_ui_ring_slider_2d
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb230692e80>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb230692a58>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'MouseMoveEvent'.
E            ACTUAL: 0
E            DESIRED: 341

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_______________________________ test_ui_checkbox _______________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:596: in test_ui_checkbox
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239b06da0>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239b06ef0>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'LeftButtonPressEvent'.
E            ACTUAL: 9
E            DESIRED: 10

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_____________________________ test_ui_radio_button _____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:667: in test_ui_radio_button
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb239a47d30>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb239a47400>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'LeftButtonPressEvent'.
E            ACTUAL: 4
E            DESIRED: 8

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
______________________________ test_ui_listbox_2d ______________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:744: in test_ui_listbox_2d
    event_counter.check_counts(expected)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <fury.tests.test_ui.EventCounter object at 0x7fb23e30ff60>
expected = <fury.tests.test_ui.EventCounter object at 0x7fb2306ded68>

    def check_counts(self, expected):
        npt.assert_equal(len(self.events_counts),
                         len(expected.events_counts))
    
        # Useful loop for debugging.
        msg = "{}: {} vs. {} (expected)"
        for event, count in expected.events_counts.items():
            if self.events_counts[event] != count:
                print(msg.format(event, self.events_counts[event], count))
    
        msg = "Wrong count for '{}'."
        for event, count in expected.events_counts.items():
            npt.assert_equal(self.events_counts[event], count,
>                            err_msg=msg.format(event))
E           AssertionError: 
E           Items are not equal: Wrong count for 'LeftButtonReleaseEvent'.
E            ACTUAL: 6
E            DESIRED: 8

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:75: AssertionError
_____________________________ test_ui_file_menu_2d _____________________________

args = (), kwargs = {}

    def test_with_xvfb(*args, **kwargs):
        if use_xvfb:
            from xvfbwrapper import Xvfb
            display = Xvfb(width=1920, height=1080)
            display.start()
>       my_test(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

interactive = False

    @xvfb_it
    def test_ui_file_menu_2d(interactive=False):
        filename = "test_ui_file_menu_2d"
        recording_filename = pjoin(DATA_DIR, filename + ".log.gz")
        expected_events_counts_filename = pjoin(DATA_DIR, filename + ".pkl")
    
        # Create temporary directory and files
>       os.mkdir(os.path.join(os.getcwd(), "testdir"))
E       FileExistsError: [Errno 17] File exists: '/home/elef/testdir'

anaconda3/lib/python3.7/site-packages/fury/tests/test_ui.py:845: FileExistsError
_________________________________ test_record __________________________________

args = (), kwargs = {}

    def skipper_func(*args, **kwargs):
        """Skipper for normal test functions."""
        if skip_val():
            raise SkipTest(get_msg(f, msg))
        else:
>           return f(*args, **kwargs)

anaconda3/lib/python3.7/site-packages/numpy/testing/_private/decorators.py:155: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
anaconda3/lib/python3.7/site-packages/fury/decorators.py:60: in test_with_xvfb
    my_test(*args, **kwargs)
anaconda3/lib/python3.7/site-packages/fury/tests/test_window.py:349: in test_record
    test_content()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

filename = 'fury.png', colors_found = (True, True)

    def test_content(filename='fury.png', colors_found=(True, True)):
        npt.assert_equal(os.path.isfile(filename), True)
        arr = io.load_image(filename)
        report = window.analyze_snapshot(arr, colors=[(0, 255, 0),
                                                      (255, 0, 0)])
>       npt.assert_equal(report.objects, 3)
E       AssertionError: 
E       Items are not equal:
E        ACTUAL: 0
E        DESIRED: 3

anaconda3/lib/python3.7/site-packages/fury/tests/test_window.py:342: AssertionError


Ways to reproduce

[If reporting a bug, please include the following important information:]

  • Code example
    Just run all the tests
  • Operating system and versions (run python -c "from fury import get_info; print(get_info()")
In [1]: import fury; fury.get_info()                                                                                                                                                     
Out[1]: 
{'fury_version': '0.3.0',
 'pkg_path': '/home/elef/anaconda3/lib/python3.7/site-packages/fury',
 'commit_hash': '29293e40eb6229ef9079009f2c705fd54850c06a',
 'sys_version': '3.7.3 | packaged by conda-forge | (default, Jul  1 2019, 21:52:21) \n[GCC 7.3.0]',
 'sys_executable': '/home/elef/anaconda3/bin/python',
 'sys_platform': 'linux',
 'numpy_version': '1.15.4',
 'scipy_version': '1.2.1',
 'vtk_version': '8.1.2',
 'matplotlib_version': '3.0.2',
 'dipy_version': '1.0.0dev'}

Changes to actor.dots, actor.point, actor.sphere

FURY has 3 actors which perform similar tasks: dots, point, and sphere. I propose the following changes.

  1. Remove point. It simply calls sphere with different default values. I don't think we need a simpler version of sphere as long as we make the options clear in the docs.

  2. In sphere, rename centers to center, colors to color, radii to radius. If sphere is singular, so too should be its parameters. Again, just make sure the docs are clear that arrays can be provided for multiple spheres.

  3. Rename dots to point. To me, dots implies 2D dots on a page. Point follows both the mathematical concept and the OpenGL primitive. Also expose VTK's ability to display fake spheres through vtkProperty.SetRenderPointsAsSpheres().

Bonus idea: should we combine all three into one actor with a parameter for display type which accepts: point, fake_sphere, and sphere?

Test_order_transparent failed with VTK 8.2.0

Description

It seems that one of our tests is failing because of VTK 8.2.0. We need to check the color rendering with VTK 8.2 and then, we may have to update this test.

Below, the error that you can find here

        # therefore the green component must have a higher value (in RGB terms)
>       npt.assert_equal(arr[150, 150][1] > arr[150, 150][0], True)
E       AssertionError: 
E       Items are not equal:
E        ACTUAL: False
E        DESIRED: True

Improve Checkbox initialisation

Description

Currently, it is quite hard to initialize checkbox on a specific state. By default, they are unchecked, but we want them already checked sometimes.

dipy.viz.colormap crash on single fibers

From @samuelstjean on February 18, 2016 13:54

---------------------------------------------------------------------------
UnboundLocalError                         Traceback (most recent call last)
<ipython-input-740-27f8ba00858a> in <module>()
     17 stream_actor2 = actor.line(bundle_native2, meth, linewidth=0.1,
     18                            lookup_colormap=lut_cmap)
---> 19 mean_bund_actor = actor.streamtube(mean_fiber_aligned, lookup_colormap=lut_cmap)
     20 
     21 ax_actor = actor.slicer(meth, np.eye(4))

/home/samuel/python/dipy/viz/actor.pyc in streamtube(lines, colors, opacity, linewidth, tube_sides, lod, lod_points, lod_points_size, spline_subdiv, lookup_colormap)
    280     """
    281     # Poly data with lines and colors
--> 282     poly_data, is_colormap = lines_to_vtk_polydata(lines, colors)
    283     next_input = poly_data
    284 

/home/samuel/python/dipy/viz/utils.pyc in lines_to_vtk_polydata(lines, colors)
    258     #           - if/else tested and work in normal simple case
    259     if colors is None:  # set automatic rgb colors
--> 260         cols_arr = line_colors(lines)
    261         colors_mapper = np.repeat(lines_range, points_per_line, axis=0)
    262         vtk_colors = numpy_to_vtk_colors(255 * cols_arr[colors_mapper])

/home/samuel/python/dipy/viz/colormap.pyc in line_colors(streamlines, cmap)
    249     if cmap == 'rgb_standard':
    250         col_list = [orient2rgb(streamline[-1] - streamline[0])
--> 251                     for streamline in streamlines]
    252 
    253     if cmap == 'boys_standard':

/home/samuel/python/dipy/viz/colormap.pyc in orient2rgb(v)
    231         orient = np.abs(v / orientn)
    232 
--> 233     return orient
    234 
    235 

UnboundLocalError: local variable 'orient' referenced before assignment

Granted, that is my fault as I was giving it an array instead of a (single element) list, but it only checks for input of dimension 1 or 2, and crash weirdly if that is not the case as seen above.

Copied from original issue: dipy/dipy#928

viz.ui.FileMenu2D

From @MarcCote on August 15, 2018 12:42

Description

The FileMenu2D class, introduced in #1592, could be refactored to avoid reimplementing scrolling and selection logic that are already done in ListBox2D component. Also, the scroll_callback is responsible for updating the colors of the text in the slots which seems weird. It would be better if the scroll only tells which slots should be displayed on the screen, then let the slots decides how to render themselves.

Related comments

dipy/dipy#1570 (comment)
dipy/dipy#1570 (comment)

Copied from original issue: dipy/dipy#1618

Update Shader system

We should update our shader system by using VtkShaderProperty and vtkShaderProgram and not anymore the mapper

With VTK 6.3, streamlines color map bar text disappears when using streamtubes

From @gauvinalexandre on April 24, 2017 13:22

I have tested this with VTK 5.8 and the bugs does not happen, so it seems to be version specific. Here is the simple code snippet to reproduce de bug:

import numpy as np
from dipy.viz import window, actor
from dipy.data import fetch_bundles_2_subjects, read_bundles_2_subjects
from dipy.tracking.streamline import transform_streamlines

fetch_bundles_2_subjects()
dix = read_bundles_2_subjects(subj_id='subj_1', metrics=['fa'],
                              bundles=['cg.left', 'cst.right'])

affine = dix['affine']
bundle = dix['cg.left']
bundle_native = transform_streamlines(bundle, np.linalg.inv(affine))
fa = dix['fa']

renderer = window.Renderer()
renderer.set_camera(position=(-176.42, 118.52, 128.20),
                    focal_point=(113.30, 128.31, 76.56),
                    view_up=(0.18, 0.00, 0.98))

stream_actor = actor.line(bundle_native, fa, linewidth=0.1)
bar = actor.scalar_bar()

renderer.add(stream_actor)
renderer.add(bar)
window.record(renderer, out_path="streamlines.png", size=(600, 600))

renderer.clear()

stream_actor = actor.streamtube(bundle_native, fa, linewidth=0.1)
bar = actor.scalar_bar()

renderer.add(stream_actor)
renderer.add(bar)
window.record(renderer, out_path="streamtubes.png", size=(600, 600))

I'm running on dipy from the master branch updated at the moment of submitting this issue.

Copied from original issue: dipy/dipy#1232

fvtk.label won't show up if called twice

From @samuelstjean on April 24, 2014 15:3

Try this :

from dipy.viz import fvtk
r=fvtk.ren()
l=fvtk.label(r)
fvtk.add(r,l)
fvtk.show(r)

You get origin in white, show it again, and you only get a black scene (on my computer).
fvtk.show(r) # nothing happens :(

I'm on ubuntu 12.04, could be a vtk problem or a rendering problem, points show up fine for example and don't exibit this behavior.

Copied from original issue: dipy/dipy#353

VTK dependency on installation

I am getting the following when installing fury with pip install fury:

$pip install fury
Collecting fury
  Downloading https://files.pythonhosted.org/packages/07/9e/4099ac335a9c4a5190e8bb26b0facbf55d54b9d725c008849fd4b5806d26/fury-0.1.3-py3-none-any.whl (121kB)
    100% |████████████████████████████████| 122kB 6.0MB/s 
Requirement already satisfied: numpy>=1.7.1 in ./.virtualenvs/dipy_to_fury/lib/python3.7/site-packages (from fury) (1.15.4)
Requirement already satisfied: scipy>=0.9 in ./.virtualenvs/dipy_to_fury/lib/python3.7/site-packages (from fury) (1.1.0)
Collecting vtk>=8.1.0 (from fury)
  Could not find a version that satisfies the requirement vtk>=8.1.0 (from fury) (from versions: )
No matching distribution found for vtk>=8.1.0 (from fury)

This is on a Mac with OS 10.14 and Python 3.7. This might be a Python version thing -- it might take a little while until we have VTK for Python 3.7

Warning window did not resize in the allotted time

When changing the size of a window I often get this message (here shown in Ubuntu 18.04)
You can replicate using this tutorial /home/elef/Devel/fury/docs/tutorials/viz_slice.py

Warning: In /work/standalone-x64-build/VTK-source/Rendering/OpenGL2/vtkXOpenGLRenderWindow.cxx, line 992
vtkXOpenGLRenderWindow (0x55782343d870): warning window did not resize in the allotted time

Basically, run the tutorial with interaction and change the size of the window.

viz_ui.py example needs expansion

Currently the many UI components are hidden under one list box which makes it hard to figure out until you actually run the example and interact with it. We need to expand this tutorial to show all major interfaces with multiple figures and also show the File dialogue and load/save options.

DOC: sphinx_gallery master branch is required

At the moment, the master branch of sphinx_gallery is needed in order to build the docs (sphinx_gallery.scrapers will be missing otherwise). That means installing the requirements/docs.txt won't work as it will install sphinx_gallery v0.2.0.

viz.ui.ListBoxItem2D text overflow

From @karandeepSJ on June 17, 2018 7:3

Description

If the text provided to a ListBoxItem2D object is longer than its width, then the text overflows out of the background and out of the list-box. It should go upto the width and replace the remaining characters by a "..."

Way to reproduce

import dipy.viz.ui as ui
import dipy.viz.window as window
values = ['abcdefghijklmnopqrstuvwxyz']
listbox = ui.ListBox2D(values=values, size=(300, 300))
sm=window.ShowManager(size=(600,600))
sm.ren.add(listbox)
sm.start()

Copied from original issue: dipy/dipy#1569

Improve doc generation

Description

Currently, the doc generation works on master but not on a pull request.
This failing is due to access permission when we fetch some GitHub info.

We need to make this point smarter. One solution is to play with Sphinx build option. Look at sphinx-gallery to get some ideas and look at the way to add template variable dynamically

module 'fury.window' has no attribute 'Scene'

Description

Hi,

I am going through the tutorial examples for Fury (version 0.1.4) and while running the code for the example 'Using a timer', I got the following error message:

import fury
import numpy as np
from fury import window, actor, ui
import itertools

xyz = 10 * np.random.rand(100, 3)
colors = np.random.rand(100, 4)
radii = np.random.rand(100) + 0.5

scene = window.Scene()
Traceback (most recent call last):

File "", line 10, in
scene = window.Scene()

AttributeError: module 'fury.window' has no attribute 'Scene'

Thanks for your help,

Vinny

Improve Checkbox options access

Description

Currently, it is quite hard to get access to a specific options since it is a list. 2 strategies to make it simpler:

  1. transform options attribute (from list to dict)
  2. create a method on CheckBoxUI to get access to a specific option

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.