Skip to content

Commit

Permalink
modified to elininate circular import error, removed get_scene() beca…
Browse files Browse the repository at this point in the history
…use it is redundant when get_actor() alreadt exists
  • Loading branch information
robinroy03 committed Mar 11, 2024
1 parent 78f8135 commit 724ee56
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
4 changes: 3 additions & 1 deletion docs/examples/viz_play_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def timer_callback(_caller, _timer_event):

# Creating a TexturedCube with different textures on all 6 sides.
cube = actor.TexturedCube(*rgb_images)
scene = cube.get_scene()
scene = window.Scene()
cube_actor = cube.get_actor()
scene.add(cube_actor)
show_manager = window.ShowManager(scene, size=(1280, 720), reset_camera=False)
show_manager.add_timer_callback(True, int(1/60), timer_callback)
show_manager.start()
22 changes: 7 additions & 15 deletions fury/actor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np

import fury.primitive as fp
from fury import layout, window
from fury import layout
from fury.actors.odf_slicer import OdfSlicerActor
from fury.actors.peak import PeakActor
from fury.actors.tensor import double_cone, main_dir_uncertainty, tensor_ellipsoid
Expand Down Expand Up @@ -3958,8 +3958,7 @@ def uncertainty_cone(


class TexturedCube:
"""Class to work with textured cube.
"""
"""Class to work with textured cube."""

def __init__(self, negx, negy, negz, posx, posy, posz):
"""Initializes a TexturedCube object.
Expand All @@ -3978,6 +3977,7 @@ def __init__(self, negx, negy, negz, posx, posy, posz):
Input 2D RGB or RGBA array. Dtype should be uint8.
posz : ndarray
Input 2D RGB or RGBA array. Dtype should be uint8.
"""

self.planes = [PlaneSource() for _ in range(6)]
Expand Down Expand Up @@ -4049,21 +4049,12 @@ def __init__(self, negx, negy, negz, posx, posy, posz):
actor.SetMapper(mapper)
actor.SetTexture(texture_object)

Check warning on line 4050 in fury/actor.py

View check run for this annotation

Codecov / codecov/patch

fury/actor.py#L4049-L4050

Added lines #L4049 - L4050 were not covered by tests

def get_scene(self):
"""Returns
-------
self.scene : window.Scene"""

self.scene = window.Scene()
for actor in self.actors:
self.scene.add(actor)

return self.scene

def get_actor(self):
"""Returns
-------
assembled_actor : Actor"""
assembled_actor : Actor
"""

assembled_actor = Assembly()

Check warning on line 4059 in fury/actor.py

View check run for this annotation

Codecov / codecov/patch

fury/actor.py#L4059

Added line #L4059 was not covered by tests
for actor_ in self.actors:
Expand All @@ -4090,6 +4081,7 @@ def texture_update(self, show_manager, negx, negy, negz, posx, posy, posz):
Input 2D RGB or RGBA array. Dtype should be uint8.
posz : ndarray
Input 2D RGB or RGBA array. Dtype should be uint8.
"""

self.image_grids = [negx, negy, negz, posx, posy, posz]

Check warning on line 4087 in fury/actor.py

View check run for this annotation

Codecov / codecov/patch

fury/actor.py#L4087

Added line #L4087 was not covered by tests
Expand Down

0 comments on commit 724ee56

Please sign in to comment.