diff --git a/.github/workflows/check_format.yml b/.github/workflows/check_format.yml
new file mode 100644
index 000000000..a4ed9d35e
--- /dev/null
+++ b/.github/workflows/check_format.yml
@@ -0,0 +1,29 @@
+name: code format
+
+on:
+ push:
+ branches: [master]
+ pull_request:
+ branches: [master]
+
+jobs:
+ pre-commit:
+
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest]
+ python-version: ['3.10']
+ requires: ['latest']
+
+ steps:
+ - name: Check out repository
+ uses: actions/checkout@v4
+
+ - name: Set up Python ${{ matrix.python-version }}
+ uses: actions/setup-python@v5
+ with:
+ python-version: ${{ matrix.python-version }}
+
+ - name: Install and run pre-commit hooks
+ uses: pre-commit/action@v3.0.0
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 670b22db6..a3bdb5fb8 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -18,6 +18,7 @@ defaults:
jobs:
build:
runs-on: ${{ matrix.os }}
+ timeout-minutes: 60
defaults:
run:
shell: bash
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 958c651fb..dec382b2e 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,15 +14,12 @@ repos:
- id: check-merge-conflict
- id: check-vcs-permalinks
- id: detect-aws-credentials
+ args: [--allow-missing-credentials]
- id: detect-private-key
# - repo: https://github.com/grantjenks/blue
# rev: v0.9.1
# hooks:
# - id: blue
- - repo: https://github.com/pycqa/isort
- rev: 5.12.0
- hooks:
- - id: isort
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
@@ -49,3 +46,9 @@ repos:
- importlib_resources
args: ["fury"]
pass_filenames: false
+ - repo: https://github.com/astral-sh/ruff-pre-commit
+ rev: v0.1.7
+ hooks:
+ # Run the linter
+ - id: ruff
+ args: [ --fix ]
diff --git a/docs/examples/viz_advanced.py b/docs/examples/viz_advanced.py
index 2b8ff92fd..c6d815ba7 100644
--- a/docs/examples/viz_advanced.py
+++ b/docs/examples/viz_advanced.py
@@ -11,7 +11,6 @@
the main functions using the following modules.
"""
-import numpy as np
from dipy.data.fetcher import fetch_bundles_2_subjects, read_bundles_2_subjects
###############################################################################
@@ -36,6 +35,7 @@
#
# First we need to fetch and load some datasets.
from dipy.tracking.streamline import Streamlines
+import numpy as np
from fury import actor, ui, window
diff --git a/docs/examples/viz_bundles.py b/docs/examples/viz_bundles.py
index 147c1f70f..849b57043 100644
--- a/docs/examples/viz_bundles.py
+++ b/docs/examples/viz_bundles.py
@@ -7,9 +7,9 @@
which provides metrics and bundles.
"""
-import numpy as np
from dipy.data import fetch_bundles_2_subjects, read_bundles_2_subjects
from dipy.tracking.streamline import length, transform_streamlines
+import numpy as np
from fury import actor, window
diff --git a/docs/examples/viz_dt_ellipsoids.py b/docs/examples/viz_dt_ellipsoids.py
index d45536732..82c2362d0 100644
--- a/docs/examples/viz_dt_ellipsoids.py
+++ b/docs/examples/viz_dt_ellipsoids.py
@@ -12,12 +12,11 @@
"""
import itertools
-import numpy as np
-
from dipy.io.image import load_nifti
+import numpy as np
-from fury import window, actor, ui
-from fury.actor import _fa, _color_fa
+from fury import actor, ui, window
+from fury.actor import _color_fa, _fa
from fury.data import fetch_viz_dmri, read_viz_dmri
from fury.primitive import prim_sphere
diff --git a/docs/examples/viz_fiber_odf.py b/docs/examples/viz_fiber_odf.py
index de50c413e..de1470234 100644
--- a/docs/examples/viz_fiber_odf.py
+++ b/docs/examples/viz_fiber_odf.py
@@ -7,12 +7,12 @@
orientation distribution functions (ODF) using fury's odf_slicer.
"""
+from dipy.data import get_sphere
+from dipy.reconst.shm import sh_to_sf_matrix
import nibabel as nib
# First, we import some useful modules and methods.
import numpy as np
-from dipy.data import get_sphere
-from dipy.reconst.shm import sh_to_sf_matrix
from fury import actor, ui, window
from fury.data import fetch_viz_dmri, fetch_viz_icons, read_viz_dmri
diff --git a/docs/examples/viz_multithread.py b/docs/examples/viz_multithread.py
index a68e3ec37..33f0bf8c0 100644
--- a/docs/examples/viz_multithread.py
+++ b/docs/examples/viz_multithread.py
@@ -10,8 +10,8 @@
adds and removes elements from the scene.
"""
-import time
from threading import Thread
+import time
import numpy as np
diff --git a/docs/examples/viz_network.py b/docs/examples/viz_network.py
index 5ac3cc05b..38dbdca64 100644
--- a/docs/examples/viz_network.py
+++ b/docs/examples/viz_network.py
@@ -15,9 +15,7 @@
import numpy as np
-from fury import actor
-from fury import colormap as cmap
-from fury import window
+from fury import actor, colormap as cmap, window
from fury.data import fetch_viz_wiki_nw
###############################################################################
diff --git a/docs/examples/viz_network_animated.py b/docs/examples/viz_network_animated.py
index cbdd5c179..ffcb5c7bd 100644
--- a/docs/examples/viz_network_animated.py
+++ b/docs/examples/viz_network_animated.py
@@ -18,9 +18,7 @@
import numpy as np
-from fury import actor
-from fury import colormap as cmap
-from fury import window
+from fury import actor, colormap as cmap, window
from fury.utils import compute_bounds, update_actor, vertices_from_actor
###############################################################################
diff --git a/docs/examples/viz_no_interaction.py b/docs/examples/viz_no_interaction.py
index 56862bbda..ae51e9f49 100644
--- a/docs/examples/viz_no_interaction.py
+++ b/docs/examples/viz_no_interaction.py
@@ -12,9 +12,7 @@
# multiprocessing.set_start_method('spawn')
import numpy as np
-from fury import actor
-from fury import colormap as cmap
-from fury import window
+from fury import actor, colormap as cmap, window
from fury.data.fetcher import fetch_viz_wiki_nw
from fury.stream.client import FuryStreamClient
from fury.stream.server.main import web_server_raw_array
diff --git a/docs/examples/viz_roi_contour.py b/docs/examples/viz_roi_contour.py
index af3383ab1..bc9fcc84d 100644
--- a/docs/examples/viz_roi_contour.py
+++ b/docs/examples/viz_roi_contour.py
@@ -13,13 +13,13 @@
from dipy.reconst.shm import CsaOdfModel
try:
- from dipy.tracking.local import LocalTracking
from dipy.tracking.local import (
+ LocalTracking,
ThresholdTissueClassifier as ThresholdStoppingCriterion,
)
except ImportError:
- from dipy.tracking.stopping_criterion import ThresholdStoppingCriterion
from dipy.tracking.local_tracking import LocalTracking
+ from dipy.tracking.stopping_criterion import ThresholdStoppingCriterion
from dipy.tracking import utils
from dipy.tracking.streamline import Streamlines
diff --git a/docs/examples/viz_slice.py b/docs/examples/viz_slice.py
index 8a41b61b3..5a12553a7 100644
--- a/docs/examples/viz_slice.py
+++ b/docs/examples/viz_slice.py
@@ -8,8 +8,8 @@
import os
-import nibabel as nib
from dipy.data import fetch_bundles_2_subjects
+import nibabel as nib
from fury import actor, ui, window
diff --git a/docs/examples/viz_spinbox.py b/docs/examples/viz_spinbox.py
index 1c8c8d7e8..756d198f4 100644
--- a/docs/examples/viz_spinbox.py
+++ b/docs/examples/viz_spinbox.py
@@ -9,9 +9,10 @@
First, some imports.
"""
+import numpy as np
+
from fury import actor, ui, utils, window
from fury.data import fetch_viz_icons
-import numpy as np
##############################################################################
# First we need to fetch some icons that are included in FURY.
diff --git a/docs/examples/viz_tab.py b/docs/examples/viz_tab.py
index adcfcbdc9..6cabf95b9 100644
--- a/docs/examples/viz_tab.py
+++ b/docs/examples/viz_tab.py
@@ -27,6 +27,12 @@
tab_ui = ui.TabUI(position=(49, 94), size=(300, 300), nb_tabs=3, draggable=True)
+###############################################################################
+# We can also define the position of the Tab Bar.
+# By default the Tab Bar is positioned at top
+
+tab_ui.tab_bar_pos = 'bottom'
+
###############################################################################
# Slider Controls for a Cube for Tab Index 0
# ==========================================
diff --git a/docs/experimental/viz_canvas.py b/docs/experimental/viz_canvas.py
index b3da4f5b1..7f2a84a4e 100644
--- a/docs/experimental/viz_canvas.py
+++ b/docs/experimental/viz_canvas.py
@@ -2,8 +2,8 @@
import vtk
from vtk.util import numpy_support
-import fury.primitive as fp
from fury import actor, window
+import fury.primitive as fp
from fury.utils import (
get_actor_from_polydata,
numpy_to_vtk_colors,
diff --git a/docs/experimental/viz_molecular_demo.py b/docs/experimental/viz_molecular_demo.py
index a8155d41c..d72338a55 100644
--- a/docs/experimental/viz_molecular_demo.py
+++ b/docs/experimental/viz_molecular_demo.py
@@ -33,9 +33,7 @@
import numpy as np
-from fury import actor
-from fury import molecular as mol
-from fury import ui, window
+from fury import actor, molecular as mol, ui, window
###############################################################################
# Downloading the PDB file of the protein to be rendered (the user can change
diff --git a/docs/experimental/viz_multisdf.py b/docs/experimental/viz_multisdf.py
index 8ea5ed819..37a78c5b4 100644
--- a/docs/experimental/viz_multisdf.py
+++ b/docs/experimental/viz_multisdf.py
@@ -2,9 +2,9 @@
import vtk
from vtk.util import numpy_support
+from fury import actor, window
import fury.primitive as fp
import fury.shaders as fs
-from fury import actor, window
from fury.utils import get_actor_from_primitive
verts, faces = fp.prim_box()
diff --git a/docs/experimental/viz_shader_canvas.py b/docs/experimental/viz_shader_canvas.py
index 35d5ccb1d..b40c31926 100644
--- a/docs/experimental/viz_shader_canvas.py
+++ b/docs/experimental/viz_shader_canvas.py
@@ -1,6 +1,6 @@
import numpy as np
-import vtk
from scipy.spatial import Delaunay
+import vtk
from vtk.util import numpy_support
from fury.utils import (
diff --git a/docs/experimental/viz_shader_canvas_sk.py b/docs/experimental/viz_shader_canvas_sk.py
index b44505ae2..f2d29ed94 100644
--- a/docs/experimental/viz_shader_canvas_sk.py
+++ b/docs/experimental/viz_shader_canvas_sk.py
@@ -1,6 +1,6 @@
import numpy as np
-import vtk
from viz_shader_canvas import cube, disk, rectangle, rectangle2, square
+import vtk
from fury import actor, window
diff --git a/docs/experimental/viz_shader_faces.py b/docs/experimental/viz_shader_faces.py
index ef4ce532b..78d5bd08c 100644
--- a/docs/experimental/viz_shader_faces.py
+++ b/docs/experimental/viz_shader_faces.py
@@ -1,6 +1,6 @@
import numpy as np
-import vtk
from viz_shader_canvas import glyph_dot
+import vtk
from fury import actor, window
diff --git a/docs/experimental/viz_shader_parallax_truchet.py b/docs/experimental/viz_shader_parallax_truchet.py
index 3590e52f8..c2eecbf67 100644
--- a/docs/experimental/viz_shader_parallax_truchet.py
+++ b/docs/experimental/viz_shader_parallax_truchet.py
@@ -1,5 +1,5 @@
-import vtk
from viz_shader_canvas import cube
+import vtk
from fury import window
diff --git a/docs/experimental/viz_shader_perlin_noise.py b/docs/experimental/viz_shader_perlin_noise.py
index e1959c577..f4726a17f 100644
--- a/docs/experimental/viz_shader_perlin_noise.py
+++ b/docs/experimental/viz_shader_perlin_noise.py
@@ -1,7 +1,7 @@
import numpy as np
-import vtk
from scipy.spatial import Delaunay
from viz_shader_canvas import surface
+import vtk
from fury import window
diff --git a/docs/experimental/viz_shader_sines_1.py b/docs/experimental/viz_shader_sines_1.py
index 11df76469..c4ac860e6 100644
--- a/docs/experimental/viz_shader_sines_1.py
+++ b/docs/experimental/viz_shader_sines_1.py
@@ -1,5 +1,5 @@
-import vtk
from viz_shader_canvas import cube
+import vtk
from fury import window
diff --git a/docs/experimental/viz_shader_square.py b/docs/experimental/viz_shader_square.py
index cbaa0662e..42968ab1f 100644
--- a/docs/experimental/viz_shader_square.py
+++ b/docs/experimental/viz_shader_square.py
@@ -1,6 +1,6 @@
import numpy as np
-import vtk
from viz_shader_canvas import cube, square
+import vtk
from fury import actor, window
diff --git a/docs/experimental/viz_shader_texture.py b/docs/experimental/viz_shader_texture.py
index 0cb29ae98..eb67b9f1a 100644
--- a/docs/experimental/viz_shader_texture.py
+++ b/docs/experimental/viz_shader_texture.py
@@ -1,6 +1,6 @@
import numpy as np
-import vtk
from viz_shader_canvas import cube
+import vtk
from fury import window
from fury.utils import rgb_to_vtk
diff --git a/docs/experimental/viz_shader_wave.py b/docs/experimental/viz_shader_wave.py
index 46c7b2093..5020a3e99 100644
--- a/docs/experimental/viz_shader_wave.py
+++ b/docs/experimental/viz_shader_wave.py
@@ -1,5 +1,5 @@
-import vtk
from viz_shader_canvas import cube, disk, rectangle, square
+import vtk
from fury import actor, window
diff --git a/docs/source/_static/css/comp-soft.css b/docs/source/_static/css/comp-soft.css
index 7198f8892..a0702c4ee 100644
--- a/docs/source/_static/css/comp-soft.css
+++ b/docs/source/_static/css/comp-soft.css
@@ -51,7 +51,7 @@
width: var(--s);
min-width: var(--s);
margin: var(--m) var(--m) 0;
- height: var(--s);
+ height: var(--s);
font-size:initial;
border-radius: 50%;
background: white;
@@ -73,4 +73,4 @@
.comp-soft-image-holder img {
max-width: 80%;
-}
\ No newline at end of file
+}
diff --git a/docs/source/_static/css/custom.css b/docs/source/_static/css/custom.css
index 63b0b905a..fbdd89b63 100644
--- a/docs/source/_static/css/custom.css
+++ b/docs/source/_static/css/custom.css
@@ -161,7 +161,7 @@ html[data-theme="light"] {
--pst-color-navbar-link-hover: rgb(77, 171, 207);
}
-/* Log:3/3/24
+/* Log:3/3/24
With updating the pydata-theme, there was issue with the elements (They were underlined and colored by default, unlike previously), adding this code snippet helped fix the issue.
You wouldn't want the links to be colored as there is a dark mode now, which will conflict with the color that pydata is assigning*/
@@ -171,4 +171,4 @@ a, a:visited {
}
a:hover, a:active {
text-decoration: underline;
-}
\ No newline at end of file
+}
diff --git a/docs/source/_static/css/sponsors.css b/docs/source/_static/css/sponsors.css
index 0ef833868..e6a71ab64 100644
--- a/docs/source/_static/css/sponsors.css
+++ b/docs/source/_static/css/sponsors.css
@@ -55,4 +55,4 @@
.cite-wrapper {
margin: 20px 20px 0;
}
-}
\ No newline at end of file
+}
diff --git a/docs/source/_static/css/util.css b/docs/source/_static/css/util.css
index abdd6032e..38cfce855 100644
--- a/docs/source/_static/css/util.css
+++ b/docs/source/_static/css/util.css
@@ -2961,4 +2961,4 @@ iframe {border: none;}
.g-m-rows-3 {
grid-template-rows: repeat(3, 1fr);
}
-}
\ No newline at end of file
+}
diff --git a/docs/source/_static/vendor/display-card.css b/docs/source/_static/vendor/display-card.css
index 201269588..79dfa9945 100644
--- a/docs/source/_static/vendor/display-card.css
+++ b/docs/source/_static/vendor/display-card.css
@@ -120,7 +120,7 @@
.h-card__divider {
margin-top: -10px;
-
+
}
.h-card__data-background {
diff --git a/docs/source/_templates/home.html b/docs/source/_templates/home.html
index d40f65fb0..a5601ed88 100644
--- a/docs/source/_templates/home.html
+++ b/docs/source/_templates/home.html
@@ -228,7 +228,7 @@ Engineering
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -495,37 +495,37 @@ With FURY, it becomes simple to produce multipl
-
+
-
+
-
+
-
+
-
+
-
+
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 7b30fec2b..2ca85bd6c 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -17,10 +17,10 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
+from datetime import datetime
import os
import re
import sys
-from datetime import datetime
# Add current path
sys.path.insert(0, os.path.abspath('.'))
diff --git a/docs/source/ext/apigen.py b/docs/source/ext/apigen.py
index 118d04daa..8c575c095 100644
--- a/docs/source/ext/apigen.py
+++ b/docs/source/ext/apigen.py
@@ -19,9 +19,9 @@
# Stdlib imports
import ast
+from importlib import import_module
import os
import re
-from importlib import import_module
# suppress print statements (warnings for empty files)
DEBUG = True
diff --git a/docs/source/ext/build_modref_templates.py b/docs/source/ext/build_modref_templates.py
index ef96c6a00..1acea334f 100755
--- a/docs/source/ext/build_modref_templates.py
+++ b/docs/source/ext/build_modref_templates.py
@@ -2,8 +2,8 @@
"""Script to auto-generate our API docs.
"""
# stdlib imports
-import sys
from os.path import join as pjoin
+import sys
# local imports
from apigen import ApiDocWriter
diff --git a/docs/source/ext/github_tools.py b/docs/source/ext/github_tools.py
index 8e05caca7..2f56286df 100644
--- a/docs/source/ext/github_tools.py
+++ b/docs/source/ext/github_tools.py
@@ -4,13 +4,13 @@
Taken from ipython
"""
import argparse
+from datetime import datetime, timedelta
import json
import operator
import os
import re
-import sys
-from datetime import datetime, timedelta
from subprocess import check_output
+import sys
from urllib.request import Request, urlopen
# ----------------------------------------------------------------------------
diff --git a/docs/source/ext/prepare_gallery.py b/docs/source/ext/prepare_gallery.py
index a2234a51c..e328429f7 100644
--- a/docs/source/ext/prepare_gallery.py
+++ b/docs/source/ext/prepare_gallery.py
@@ -1,8 +1,8 @@
+from dataclasses import dataclass, field
import fnmatch
import os
-import shutil
-from dataclasses import dataclass, field
from pathlib import Path
+import shutil
from sphinx.util import logging
diff --git a/docs/source/posts/2020/2020-06-28-week-5-lenix.rst b/docs/source/posts/2020/2020-06-28-week-5-lenix.rst
index 6a9cc6816..2334fa9e3 100644
--- a/docs/source/posts/2020/2020-06-28-week-5-lenix.rst
+++ b/docs/source/posts/2020/2020-06-28-week-5-lenix.rst
@@ -13,7 +13,7 @@ This week, Spherical harmonics!
What did you do this week?
--------------------------
-The main task for the week was to include an implementation of spherical harmonics (upto the order of 4) as a FURY actor. This was the initial milestone to be achieved to work towards the support of using spherical harmonics as an visualization technique. I have added the GIFs for both the renders below. I also worked on a occlusion based lighting model.
+The main task for the week was to include an implementation of spherical harmonics (up to the order of 4) as a FURY actor. This was the initial milestone to be achieved to work towards the support of using spherical harmonics as an visualization technique. I have added the GIFs for both the renders below. I also worked on a occlusion based lighting model.
Spherical harmonics for different values of order and degree:
diff --git a/docs/source/posts/2023/2023-06-03-week-1-praneeth.rst b/docs/source/posts/2023/2023-06-03-week-1-praneeth.rst
index 53edfb263..5b9e9a5e9 100644
--- a/docs/source/posts/2023/2023-06-03-week-1-praneeth.rst
+++ b/docs/source/posts/2023/2023-06-03-week-1-praneeth.rst
@@ -38,4 +38,4 @@ Looking ahead, here's what I have planned for the upcoming week:
1. Completing PR `#790 `__ - Fixing Textbox Alignment
2. Wrapping up PR `#499 `__ - SpinBoxUI
-3. Initiating PR `#576 `__ - Icon Flaw in ComboBox
\ No newline at end of file
+3. Initiating PR `#576 `__ - Icon Flaw in ComboBox
diff --git a/docs/source/posts/2023/2023-06-05-week-1-joaodellagli.rst b/docs/source/posts/2023/2023-06-05-week-1-joaodellagli.rst
index 405c75bbf..2e09b29f6 100644
--- a/docs/source/posts/2023/2023-06-05-week-1-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-06-05-week-1-joaodellagli.rst
@@ -11,24 +11,24 @@ This Past Week
--------------
As mentioned in the last week's blogpost, the goal for that week was to investigate VTK's Framebuffer Object framework.
-An update on that is that indeed, VTK has one more low-level working `FBO class `_ that can be used inside FURY, however,
+An update on that is that indeed, VTK has one more low-level working `FBO class `_ that can be used inside FURY, however,
they come with some issues that I will explain further below.
My Current Problems
-------------------
-The problems I am having with these FBO implementations are first something related to how a FBO works, and second related to how VTK works.
+The problems I am having with these FBO implementations are first something related to how a FBO works, and second related to how VTK works.
In OpenGL, a custom user's FBO needs some things to be complete (usable):
1. At least one buffer should be attached. This buffer can be the color, depth or stencil buffer.
2. If no color buffer will be attached then OpenGL needs to be warned no draw or read operations will be done to that buffer. Otherwise, there should be at least one color attachment.
3. All attachments should have their memory allocated.
-4. Each buffer should have the same number of samples.
+4. Each buffer should have the same number of samples.
My first problem relies on the third requirement. VTK's implementation of FBO requires a `vtkTextureObject `_
as a texture attachment. I figured out how to work with this class, however, I cannot allocate memory for it, as its methods for it, `Allocate2D `_, `Create2D `_ and `Create2DFromRaw `_
-does not seem to work. Every time I try to use them, my program stops with no error message nor nothing.
+does not seem to work. Every time I try to use them, my program stops with no error message nor nothing.
For anyone interested in what is happening exactly, below is how I my tests are implemented:
::
@@ -43,11 +43,11 @@ For anyone interested in what is happening exactly, below is how I my tests are
|
| color_texture.Allocate2D(width, height, 4, vtk.VTK_UNSIGNED_CHAR) # here is where the code stops
-In contrast, for some reason, the methods for 3D textures, `Allocate3D `_ works just fine.
-I could use it as a workaround, but I do not wish to, as this just does not make sense.
+In contrast, for some reason, the methods for 3D textures, `Allocate3D `_ works just fine.
+I could use it as a workaround, but I do not wish to, as this just does not make sense.
My second problem relies on VTK. As VTK is a library that encapsulates some OpenGL functions in more palatable forms, it comes with some costs.
-Working with FBOs is a more low-level work, that requires strict control of some OpenGL states and specific functions that would be simpler if it was the main API here.
+Working with FBOs is a more low-level work, that requires strict control of some OpenGL states and specific functions that would be simpler if it was the main API here.
However, some of this states and functions are all spread and implicit through VTK's complex classes and methods, which doubles the time expended to make some otherwise simple instructions,
as I first need to dig in lines and lines of VTK's documentation, and worse, the code itself.
@@ -56,6 +56,6 @@ What About Next Week?
---------------------
For this next week, I plan to investigate further on why the first problem is happening. If that is accomplished, then things will be more simple, as it will be a lot easier for my project to move forward as I will finally be able
-to implement the more pythonic functions needed to finally render some kernel distributions onto my screen.
+to implement the more pythonic functions needed to finally render some kernel distributions onto my screen.
Wish me luck!
diff --git a/docs/source/posts/2023/2023-06-12-week-2-joaodellagli.rst b/docs/source/posts/2023/2023-06-12-week-2-joaodellagli.rst
index 9f22c9358..679f401b5 100644
--- a/docs/source/posts/2023/2023-06-12-week-2-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-06-12-week-2-joaodellagli.rst
@@ -12,9 +12,9 @@ Hello everybody, welcome to the week 2 of this project! I must admit I thought t
This Last Week's Effort
-----------------------
-Last week, I was facing some issues with a VTK feature essential so I could move forward with my project: Framebuffer Objects.
+Last week, I was facing some issues with a VTK feature essential so I could move forward with my project: Framebuffer Objects.
As described in my :doc:`last blogpost <2023-06-05-week-1-joaodellagli>`, for some reason the 2D allocation methods for it weren't working.
-In a meeting with my mentors, while we were discussing and searching through VTK's FramebufferObject and TextureObject documentation, and the code itself for the problem,
+In a meeting with my mentors, while we were discussing and searching through VTK's FramebufferObject and TextureObject documentation, and the code itself for the problem,
one TextureObject method caught my attention: `vtkTextureObject.SetContext() `_.
Where the Problem Was
@@ -39,18 +39,18 @@ will be present, so it lacked a line, that should be added after ``Bind()``:
::
- color_texture = vtk.vtkTextureObject()
- color_texture.Bind()
+ color_texture = vtk.vtkTextureObject()
+ color_texture.Bind()
color_texture.SetContext(manager.window) # set the context where the texture object will be present
- color_texture.SetDataType(vtk.VTK_UNSIGNED_CHAR)
- color_texture.SetInternalFormat(vtk.VTK_RGB)
+ color_texture.SetDataType(vtk.VTK_UNSIGNED_CHAR)
+ color_texture.SetInternalFormat(vtk.VTK_RGB)
color_texture.SetFormat(vtk.VTK_RGB)
- color_texture.SetMinificationFilter(0)
- color_texture.SetMagnificationFilter(0)
+ color_texture.SetMinificationFilter(0)
+ color_texture.SetMagnificationFilter(0)
-The code worked fine. But as my last blogpost showed, ``Allocate3D()`` method worked just fine without a (visible) problem, why is that?
+The code worked fine. But as my last blogpost showed, ``Allocate3D()`` method worked just fine without a (visible) problem, why is that?
Well, in fact, it **didn't work**. If we check the code for the ``Allocate2D()`` and ``Allocate3D()``, one difference can be spotted:
@@ -78,9 +78,9 @@ implementation made it harder for me and my mentors to realise what was happenin
This Week's Goals
-----------------
-After making that work, this week's goal is to render something to the Framebuffer Object, now that is working. To do that,
+After making that work, this week's goal is to render something to the Framebuffer Object, now that is working. To do that,
first I will need to do some offscreen rendering to it, and afterwards render what it was drawn to its color attachment, the Texture Object I
-was struggling to make work, into the screen, drawing its texture to a billboard. Also, I plan to start using vtkErrorMacro, as it seems like
+was struggling to make work, into the screen, drawing its texture to a billboard. Also, I plan to start using vtkErrorMacro, as it seems like
the main error interface when working with VTK, and that may make my life easier.
-See you next week!
\ No newline at end of file
+See you next week!
diff --git a/docs/source/posts/2023/2023-06-17-week-3-praneeth.rst b/docs/source/posts/2023/2023-06-17-week-3-praneeth.rst
index 071a0aafa..2779b58e2 100644
--- a/docs/source/posts/2023/2023-06-17-week-3-praneeth.rst
+++ b/docs/source/posts/2023/2023-06-17-week-3-praneeth.rst
@@ -31,4 +31,4 @@ I faced a challenge while working on the text justification. It took me several
What is coming up next?
-----------------------
-Next week, I have several tasks lined up. Firstly, I will be working on the **CardUI** PR `#398 `__. Additionally, I plan to complete the segregation of the scrollbar component, ensuring its independence and clarity. Lastly, I will be working on issue `#540 `__, which involves updating the use of the ``numpy_to_vtk_image_data`` utility function.
\ No newline at end of file
+Next week, I have several tasks lined up. Firstly, I will be working on the **CardUI** PR `#398 `__. Additionally, I plan to complete the segregation of the scrollbar component, ensuring its independence and clarity. Lastly, I will be working on issue `#540 `__, which involves updating the use of the ``numpy_to_vtk_image_data`` utility function.
diff --git a/docs/source/posts/2023/2023-06-19-week-3-joaodellagli.rst b/docs/source/posts/2023/2023-06-19-week-3-joaodellagli.rst
index a043a22fa..47babbff4 100644
--- a/docs/source/posts/2023/2023-06-19-week-3-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-06-19-week-3-joaodellagli.rst
@@ -7,34 +7,34 @@ Week 3: Watch Your Expectations
:category: gsoc
-Hello everyone, it's time for another weekly blogpost! This week,
+Hello everyone, it's time for another weekly blogpost! This week,
I will talk about how you should watch your expectations when working with any project.
This Last Week's Effort
-----------------------
-As I supposedly managed to make the texture allocation part working, this last week's goal was to render something to a FBO. Well, I could make
+As I supposedly managed to make the texture allocation part working, this last week's goal was to render something to a FBO. Well, I could make
textures work, but what I wasn't expecting and later realised, was that the FBO setup not working. Below I will describe where I got stuck.
Where the Problem Was
---------------------
-After getting the textures setup right, I was ready to render some color to the FBO. Well, I **was**, because I didn't expect
-I would have another problem, this time, with the FBO setup. As described in my :doc:`week 1 blogpost <2023-06-05-week-1-joaodellagli>`,
-a FBO needs some requirements to work. My current problem relies on the FBO method ``FBO.SetContext()``, that for some reason is not being able to generate the FBO.
+After getting the textures setup right, I was ready to render some color to the FBO. Well, I **was**, because I didn't expect
+I would have another problem, this time, with the FBO setup. As described in my :doc:`week 1 blogpost <2023-06-05-week-1-joaodellagli>`,
+a FBO needs some requirements to work. My current problem relies on the FBO method ``FBO.SetContext()``, that for some reason is not being able to generate the FBO.
Below, how the method is currently operating:
.. image:: https://raw.githubusercontent.com/JoaoDell/gsoc_assets/main/images/setcontext.png
:align: center
:alt: Image showing the SetContext's VTK implementation
-Apparently, the method is stuck before the ``this->CreateFBO()``, that can be checked when we call ``FBO.GetFBOIndex()``, that returns a ``0`` value,
-meaning the FBO was not generated by the ``glGenFramebuffers()`` function, that is inside the ``GetContext()`` method.
+Apparently, the method is stuck before the ``this->CreateFBO()``, that can be checked when we call ``FBO.GetFBOIndex()``, that returns a ``0`` value,
+meaning the FBO was not generated by the ``glGenFramebuffers()`` function, that is inside the ``GetContext()`` method.
This Week's Goals
-----------------
-As I got stuck again with this simple step, talking with my mentors we concluded that a plan B is needed for my GSoC participation as
-my current project is not having much progress. This plan B that I am gonna start working on this week involves working on `FURY Speed `_,
-a FURY addon that aims to develop optimized functions and algorithms to help speed up graphical applications. The suggestion was to
-work on a PR I submitted months ago, `#783 `_, in a way to integrate that into FURY Speed.
-Also, I plan to keep working on my current project to find the solution I will need to make the FBO usage work.
+As I got stuck again with this simple step, talking with my mentors we concluded that a plan B is needed for my GSoC participation as
+my current project is not having much progress. This plan B that I am gonna start working on this week involves working on `FURY Speed `_,
+a FURY addon that aims to develop optimized functions and algorithms to help speed up graphical applications. The suggestion was to
+work on a PR I submitted months ago, `#783 `_, in a way to integrate that into FURY Speed.
+Also, I plan to keep working on my current project to find the solution I will need to make the FBO usage work.
-Let's get to work!
\ No newline at end of file
+Let's get to work!
diff --git a/docs/source/posts/2023/2023-06-24-week-4-praneeth.rst b/docs/source/posts/2023/2023-06-24-week-4-praneeth.rst
index 0777ef8ba..3dd7306d6 100644
--- a/docs/source/posts/2023/2023-06-24-week-4-praneeth.rst
+++ b/docs/source/posts/2023/2023-06-24-week-4-praneeth.rst
@@ -27,4 +27,4 @@ No, fortunately, I didn't encounter any major obstacles or challenges during my
What is coming up next?
-----------------------
-Once the exams are over, I am eagerly looking forward to making a full comeback to development. My immediate plans include addressing the remaining issues in PR `#540 `_ and completing the pending tasks. I will also catch up on any missed discussions and sync up with the team to align our goals for the upcoming weeks.
\ No newline at end of file
+Once the exams are over, I am eagerly looking forward to making a full comeback to development. My immediate plans include addressing the remaining issues in PR `#540 `_ and completing the pending tasks. I will also catch up on any missed discussions and sync up with the team to align our goals for the upcoming weeks.
diff --git a/docs/source/posts/2023/2023-06-26-week-4-joaodellagli.rst b/docs/source/posts/2023/2023-06-26-week-4-joaodellagli.rst
index 97950b4eb..151b1c719 100644
--- a/docs/source/posts/2023/2023-06-26-week-4-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-06-26-week-4-joaodellagli.rst
@@ -12,11 +12,11 @@ Welcome again to another weekly blogpost! Today, let's talk about the importance
Last Week's Effort
-----------------------
So, last week my project was struggling with some supposedly simple in concept, yet intricate in execution issues. If you recall from
-my :doc:`last blogpost <2023-06-19-week-3-joaodellagli>`, I could not manage to make the Framebuffer Object setup work, as its method,
-``SetContext()``, wasn't being able to generate the FBO inside OpenGL. Well, after some (more) research about that as I also dived in my
-plan B, that involved studying numba as a way to accelerate a data structure I implemented on my PR `#783 `_,
-me and one of my mentors decided we needed a pair programming session, that finally happened on thursday. After that session,
-we could finally understand what was going on.
+my :doc:`last blogpost <2023-06-19-week-3-joaodellagli>`, I could not manage to make the Framebuffer Object setup work, as its method,
+``SetContext()``, wasn't being able to generate the FBO inside OpenGL. Well, after some (more) research about that as I also dived in my
+plan B, that involved studying numba as a way to accelerate a data structure I implemented on my PR `#783 `_,
+me and one of my mentors decided we needed a pair programming session, that finally happened on thursday. After that session,
+we could finally understand what was going on.
Where the Problem Was
---------------------
@@ -30,24 +30,24 @@ Apparently, for the FBO generation to work, it is first needed to initialize the
manager.initialize() # missing part that made everything work
FBO.SetContext(manager.window) # Sets the context for the FBO. Finally, it works
- FBO.PopulateFramebuffer(width, height, True, 1, vtk.VTK_UNSIGNED_CHAR, False, 24, 0) # And now I could populate the FBO with textures
+ FBO.PopulateFramebuffer(width, height, True, 1, vtk.VTK_UNSIGNED_CHAR, False, 24, 0) # And now I could populate the FBO with textures
This simple missing line of code was responsible for ending weeks of suffer, as after that, I called:
::
- print("FBO of index:", FBO.GetFBOIndex())
+ print("FBO of index:", FBO.GetFBOIndex())
print("Number of color attachments:", FBO.GetNumberOfColorAttachments())
-That outputted:
+That outputted:
::
FBO of index: 4
Number of color attachments: 1
-That means the FBO generation was successful! One explanation that seems reasonable to me on why was that happening is that, as it was
+That means the FBO generation was successful! One explanation that seems reasonable to me on why was that happening is that, as it was
not initialized, the context was being passed ``null`` to the ``SetContext()`` method, that returned without any warning of what was happening.
-Here, I would like to point out how my mentor was **essential** to this solution to come: I had struggled for some time with that, and could
-not find a way out, but a single session of synchronous pair programming where I could expose clearly my problem and talk to someone
+Here, I would like to point out how my mentor was **essential** to this solution to come: I had struggled for some time with that, and could
+not find a way out, but a single session of synchronous pair programming where I could expose clearly my problem and talk to someone
way more experienced than I, someone designated for that, was my way out of this torment, so value your mentors! Thanks Bruno!
@@ -55,6 +55,6 @@ This Week's Goals
-----------------
Now, with the FBO working, I plan to finally *render* something to it. For this week, I plan to come back to my original plan and
experiment with simple shaders just as a proof of concept that the FBO will be really useful for this project. I hope the road is less
-bumpier by now and I don't step on any other complicated problem.
+bumpier by now and I don't step on any other complicated problem.
-Wish me luck!
\ No newline at end of file
+Wish me luck!
diff --git a/docs/source/posts/2023/2023-07-01-week-5-praneeth.rst b/docs/source/posts/2023/2023-07-01-week-5-praneeth.rst
index 4563775ce..aab6ba6c6 100644
--- a/docs/source/posts/2023/2023-07-01-week-5-praneeth.rst
+++ b/docs/source/posts/2023/2023-07-01-week-5-praneeth.rst
@@ -12,7 +12,7 @@ What did you do this week?
Due to ongoing exams, my productivity was limited this week. However, I managed to find some time to explore and review a few PRs submitted by contributors:
1. Ellipsoid PR `#791 `_:
- This PR focuses on creating a new ellipsoid actor defined with SDF and raymarching techniques.
+ This PR focuses on creating a new ellipsoid actor defined with SDF and raymarching techniques.
2. Website Improvement PR `#812 `_:
This PR includes changes for the new compatibility section on the FURY home page.
@@ -25,4 +25,4 @@ Fortunately, I didn't encounter any major roadblocks or challenges that hindered
What is coming up next?
------------------------
-With the action points provided by my mentor, I will be dedicating the next week to completing those tasks.
\ No newline at end of file
+With the action points provided by my mentor, I will be dedicating the next week to completing those tasks.
diff --git a/docs/source/posts/2023/2023-07-03-week-5-joaodellagli.rst b/docs/source/posts/2023/2023-07-03-week-5-joaodellagli.rst
index 752ae0e35..65236da69 100644
--- a/docs/source/posts/2023/2023-07-03-week-5-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-07-03-week-5-joaodellagli.rst
@@ -12,13 +12,13 @@ Hello everyone, time for another weekly blogpost! Today, we will talk about taki
Last Week's Effort
------------------
After having the FBO properly set up, the plan was to finally *render* something to it. Well, I wished for a less bumpy road
-at my :doc:`last blogpost <2023-06-26-week-4-joaodellagli>` but as in this project things apparently tend to go wrong,
-of course the same happened with this step.
+at my :doc:`last blogpost <2023-06-26-week-4-joaodellagli>` but as in this project things apparently tend to go wrong,
+of course the same happened with this step.
Where the Problem Was
---------------------
-Days passed without anything being rendered to the FBO. The setup I was working on followed the simplest OpenGL pipeline of rendering to
+Days passed without anything being rendered to the FBO. The setup I was working on followed the simplest OpenGL pipeline of rendering to
an FBO:
1. Setup the FBO
@@ -27,9 +27,9 @@ an FBO:
4. Render to the FBO
5. Use the color attachment as texture attached to a billboard to render what was on the screen
-But it seems like this pipeline doesn't translate well into VTK. I paired again on wednesday with my mentors, Bruno and Filipi, to try to figure out
-where the problem was, but after hours we could not find it. Wednesday passed and then thursday came, and with thursday, a solution:
-Bruno didn't give up on the idea and dug deep on VTK's documentation until he found a workaround to do what we wanted, that was retrieving a
+But it seems like this pipeline doesn't translate well into VTK. I paired again on wednesday with my mentors, Bruno and Filipi, to try to figure out
+where the problem was, but after hours we could not find it. Wednesday passed and then thursday came, and with thursday, a solution:
+Bruno didn't give up on the idea and dug deep on VTK's documentation until he found a workaround to do what we wanted, that was retrieving a
texture from what was rendered to the screen and pass it as a texture to render to the billboard. To do it, he figured out we needed to use
a different class, `vtkWindowToImageFilter `_, a class that has the specific
job of doing exactly what I described above. Below, the steps to do it:
@@ -52,16 +52,16 @@ This is enough to bind to the desired actor a texture that corresponds to what w
This Week's Goals
-----------------
Having a solution to that, now its time to finally render some KDE's! This week's plans involve implementing the first version of a KDE
-calculation. For anyone interested in understanding what a Kernel Density Estimation is, here is a brief summary from this
+calculation. For anyone interested in understanding what a Kernel Density Estimation is, here is a brief summary from this
`Wikipedia page `_:
- In statistics, kernel density estimation (KDE) is the application of kernel smoothing for probability density estimation, i.e., a
- non-parametric method to estimate the probability density function of a random variable based on kernels as weights. KDE answers a
- fundamental data smoothing problem where inferences about the population are made, based on a finite data sample. In some fields
- such as signal processing and econometrics it is also termed the Parzen–Rosenblatt window method, after Emanuel Parzen and Murray
- Rosenblatt, who are usually credited with independently creating it in its current form. One of the famous applications of
- kernel density estimation is in estimating the class-conditional marginal densities of data when using a naive Bayes classifier,
+ In statistics, kernel density estimation (KDE) is the application of kernel smoothing for probability density estimation, i.e., a
+ non-parametric method to estimate the probability density function of a random variable based on kernels as weights. KDE answers a
+ fundamental data smoothing problem where inferences about the population are made, based on a finite data sample. In some fields
+ such as signal processing and econometrics it is also termed the Parzen–Rosenblatt window method, after Emanuel Parzen and Murray
+ Rosenblatt, who are usually credited with independently creating it in its current form. One of the famous applications of
+ kernel density estimation is in estimating the class-conditional marginal densities of data when using a naive Bayes classifier,
which can improve its prediction accuracy.
This complicated sentence can be translated into the below image:
@@ -70,8 +70,7 @@ This complicated sentence can be translated into the below image:
:align: center
:alt: KDE plot of 100 random points
-That is what a KDE plot of 100 random points looks like. The greener the area, the greater the density of points. The plan is to implement
+That is what a KDE plot of 100 random points looks like. The greener the area, the greater the density of points. The plan is to implement
something like that with the tools we now have available.
Let's get to work!
-
diff --git a/docs/source/posts/2023/2023-07-10-week-6-joaodellagli.rst b/docs/source/posts/2023/2023-07-10-week-6-joaodellagli.rst
index e9335c541..0cce36b45 100644
--- a/docs/source/posts/2023/2023-07-10-week-6-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-07-10-week-6-joaodellagli.rst
@@ -11,53 +11,53 @@ Hello everyone, time for a other weekly blogpost! Today, I will show you my curr
What I did Last Week
--------------------
-Last week I had the goal to implement KDE rendering to the screen (if you want to understand what this is, check my :doc:`last blogpost <2023-07-03-week-5-joaodellagli>`_).
+Last week I had the goal to implement KDE rendering to the screen (if you want to understand what this is, check my :doc:`last blogpost <2023-07-03-week-5-joaodellagli>`_).
After some days diving into the code, I finally managed to do it:
.. image:: https://raw.githubusercontent.com/JoaoDell/gsoc_assets/main/images/buffer_compose.png
:align: center
:alt: KDE render to a billboard
-This render may seem clean and working, but the code isn't exactly like that. For this to work, some tricks and work arounds needed to
+This render may seem clean and working, but the code isn't exactly like that. For this to work, some tricks and work arounds needed to
be done, as I will describe in the section below.
Also, I reviewed the shader part of Tania's PR `#791 `_, that implement ellipsoid actors inside
FURY. It was my first review of a PR that isn't a blogpost, so it was an interesting experience and I hope I can get better at it.
-It is important as well to point out that I had to dedicate myself to finishing my graduation capstone project's presentation that I will attend
+It is important as well to point out that I had to dedicate myself to finishing my graduation capstone project's presentation that I will attend
to this week, so I had limited time to polish my code, which I plan to do better this week.
Where the Problem Was
---------------------
-The KDE render basically works rendering the KDE of a point to a texture and summing that texture to the next render. For this to work,
-the texture, rendered to a billboard, needs to be the same size of the screen, otherwise the captured texture will include the black background.
-The problem I faced with that is that the billboard scaling isn't exactly well defined, so I had to guess for a fixed screen size
-(in this example, I worked with *600x600*) what scaling value made the billboard fit exactly inside the screen (it's *3.4*). That is far from ideal as I
-will need to modularize this behavior inside a function that needs to work for every case, so I will need to figure out a way to fix that
+The KDE render basically works rendering the KDE of a point to a texture and summing that texture to the next render. For this to work,
+the texture, rendered to a billboard, needs to be the same size of the screen, otherwise the captured texture will include the black background.
+The problem I faced with that is that the billboard scaling isn't exactly well defined, so I had to guess for a fixed screen size
+(in this example, I worked with *600x600*) what scaling value made the billboard fit exactly inside the screen (it's *3.4*). That is far from ideal as I
+will need to modularize this behavior inside a function that needs to work for every case, so I will need to figure out a way to fix that
for every screen size. For that, I have two options:
1. Find the scaling factor function that makes the billboard fit into any screen size.
2. Figure out how the scaling works inside the billboard actor to understand if it needs to be refactored.
The first seems ok to do, but it is kind of a work around as well. The second one is a good general solution, but it is a more delicate one,
-as it deals with how the billboard works and already existing applications of it may suffer problems if the scaling is changed.
-I will see what is better talking with my mentors.
+as it deals with how the billboard works and already existing applications of it may suffer problems if the scaling is changed.
+I will see what is better talking with my mentors.
-Another problem I faced (that is already fixed) relied on shaders. I didn't fully understood how shaders work inside FURY so I was
-using my own fragment shader implementation, replacing the already existing one completely. That was working, but I was having an issue
+Another problem I faced (that is already fixed) relied on shaders. I didn't fully understood how shaders work inside FURY so I was
+using my own fragment shader implementation, replacing the already existing one completely. That was working, but I was having an issue
with the texture coordinates of the rendering texture. As I completely replaced the fragment shader, I had to pass custom texture coordinates
-to it, resulting in distorted textures that ruined the calculations. Those issues motivated me to learn the shaders API, which allowed me
+to it, resulting in distorted textures that ruined the calculations. Those issues motivated me to learn the shaders API, which allowed me
to use the right texture coordinates and finally render the results you see above.
This Week's Goals
-----------------
-For this week, I plan to try a different approach Filipi, one of my mentors, told me to do. This approach was supposed to be the original
-one, but a communication failure lead to this path I am currently in. This approach renders each KDE calculation into its own billboard,
-and those are rendered together with additive blending. After this first pass, this render is captured into a texture and then rendered to
-another big billboard.
+For this week, I plan to try a different approach Filipi, one of my mentors, told me to do. This approach was supposed to be the original
+one, but a communication failure lead to this path I am currently in. This approach renders each KDE calculation into its own billboard,
+and those are rendered together with additive blending. After this first pass, this render is captured into a texture and then rendered to
+another big billboard.
-Also, I plan to refactor my draft PR `#804 `_ to make it more understandable, as its description still dates back to the time I was using the
+Also, I plan to refactor my draft PR `#804 `_ to make it more understandable, as its description still dates back to the time I was using the
flawed Framebuffer implementation, and my fellow GSoC contributors will eventually review it, and to do so, they will need to understand it.
-Wish me luck!
\ No newline at end of file
+Wish me luck!
diff --git a/docs/source/posts/2023/2023-07-15-week-7-praneeth.rst b/docs/source/posts/2023/2023-07-15-week-7-praneeth.rst
index db375bd7c..dfcf0e6f6 100644
--- a/docs/source/posts/2023/2023-07-15-week-7-praneeth.rst
+++ b/docs/source/posts/2023/2023-07-15-week-7-praneeth.rst
@@ -17,7 +17,7 @@ Text background greater than the actual maximum size:
:align: center
:alt: Text background greater than the actual maximum size in ComboBox2D
-Text offset from center:
+Text offset from center:
.. image:: https://github.com/fury-gl/fury/assets/64432063/0a3bc1e6-a566-4c08-9ca4-a191525b9c97
:align: center
@@ -33,4 +33,4 @@ While fixing the issues with the tests for the **TextBlock2D** bounding box, I e
What is coming up next?
-----------------------
-I will continue working on the **TreeUI** and resolve the **TextBlock2D** error to ensure both PRs progress smoothly.
\ No newline at end of file
+I will continue working on the **TreeUI** and resolve the **TextBlock2D** error to ensure both PRs progress smoothly.
diff --git a/docs/source/posts/2023/2023-07-17-week-7-joaodellagli.rst b/docs/source/posts/2023/2023-07-17-week-7-joaodellagli.rst
index 9237ec1d7..481ce9be2 100644
--- a/docs/source/posts/2023/2023-07-17-week-7-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-07-17-week-7-joaodellagli.rst
@@ -10,7 +10,7 @@ Hello everyone, welcome to another weekly blogpost! Let's talk about the current
Last Week's Effort
------------------
-Having accomplished a KDE rendering to a billboard last week, I was then tasked with trying a different approach to how the
+Having accomplished a KDE rendering to a billboard last week, I was then tasked with trying a different approach to how the
rendering was done. So, to recap, below was how I was doing it:
1. Render one point's KDE offscreen to a single billboard, passing its position and sigma to the fragment shader as uniforms.
@@ -21,7 +21,7 @@ rendering was done. So, to recap, below was how I was doing it:
6. Apply post processing effects (colormapping).
7. Render the result to the screen.
-This approach was good, but it had some later limitations and issues that would probably take more processing time and attention to details (correct matrix
+This approach was good, but it had some later limitations and issues that would probably take more processing time and attention to details (correct matrix
transformations, etc) than the ideal. The different idea is pretty similar, but with some differences:
1. Activate additive blending in OpenGL.
@@ -35,7 +35,7 @@ So I needed to basically do that.
Was it Hard?
------------
-Fortunately, it wasn't so hard to do it in the end. Following those steps turned out pretty smooth, and after some days,
+Fortunately, it wasn't so hard to do it in the end. Following those steps turned out pretty smooth, and after some days,
I had the below result:
.. image:: https://raw.githubusercontent.com/JoaoDell/gsoc_assets/main/images/final_2d_plot.png
@@ -52,14 +52,14 @@ This is a 2D KDE render of random 1000 points. For this I used the *"viridis"* c
:align: center
:alt: 3D KDE render
-After those results, I refactored my PR `#804 `_ to better fit its current status, and it is
+After those results, I refactored my PR `#804 `_ to better fit its current status, and it is
now ready for review. Success!
This Week's Goals
-----------------
-After finishing the first iteration of my experimental program, the next step is to work on an API for KDE rendering. I plan to meet
+After finishing the first iteration of my experimental program, the next step is to work on an API for KDE rendering. I plan to meet
with my mentors and talk about the details of this API, so expect an update next week. Also, I plan to take a better look on my fellow GSoC FURY
contributors work so when their PRs are ready for review, I will have to be better prepared for it.
-Let's get to work!
\ No newline at end of file
+Let's get to work!
diff --git a/docs/source/posts/2023/2023-07-22-week-8-praneeth.rst b/docs/source/posts/2023/2023-07-22-week-8-praneeth.rst
index c921698cc..5ac792a9b 100644
--- a/docs/source/posts/2023/2023-07-22-week-8-praneeth.rst
+++ b/docs/source/posts/2023/2023-07-22-week-8-praneeth.rst
@@ -24,4 +24,4 @@ The pair programming session with my mentor proved to be immensely helpful, as i
What is coming up next?
------------------------
-I will dedicate time to further enhancing the **TreeUI**. My focus will be on updating tree nodes and ensuring proper node positioning during movement.
\ No newline at end of file
+I will dedicate time to further enhancing the **TreeUI**. My focus will be on updating tree nodes and ensuring proper node positioning during movement.
diff --git a/docs/source/posts/2023/2023-07-24-week-8-joaodellagli.rst b/docs/source/posts/2023/2023-07-24-week-8-joaodellagli.rst
index a3b7af50d..e74031109 100644
--- a/docs/source/posts/2023/2023-07-24-week-8-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-07-24-week-8-joaodellagli.rst
@@ -7,53 +7,53 @@ Week 8: The Birth of a Versatile API
:category: gsoc
-Hello everyone, it's time for another weekly blogpost! Today, I am going to tell you all about how is the KDE API development going, and
+Hello everyone, it's time for another weekly blogpost! Today, I am going to tell you all about how is the KDE API development going, and
to show you the potential this holds for the future!
Last Week's Effort
------------------
-Last week I told you how I managed to render some KDE renders to the screen, both in 2D and 3D, as you may check by my last blogpost.
-My new task was, as I had this example working, to start the API development. In a meeting with Bruno, one of my mentors, we debated
+Last week I told you how I managed to render some KDE renders to the screen, both in 2D and 3D, as you may check by my last blogpost.
+My new task was, as I had this example working, to start the API development. In a meeting with Bruno, one of my mentors, we debated
on how could this work, reaching two options:
1. Implement the KDE in a single, simple actor.
2. Implement a KDE rendering manager, as a class.
-The first one would have the advantage of being simple and pretty straightforward, as a user would only need to call the actor and have
-it working on their hands, having the tradeoff of leaving some important steps for a clean API hidden and static. These steps I mention
-are related to how this rendering works, as I have previously :doc:`showed you <2023-07-03-week-5-joaodellagli>`, it relies on post-processing effects,
-which need an offscreen rendering, that for example are done by the *callback functions*.
+The first one would have the advantage of being simple and pretty straightforward, as a user would only need to call the actor and have
+it working on their hands, having the tradeoff of leaving some important steps for a clean API hidden and static. These steps I mention
+are related to how this rendering works, as I have previously :doc:`showed you <2023-07-03-week-5-joaodellagli>`, it relies on post-processing effects,
+which need an offscreen rendering, that for example are done by the *callback functions*.
In short, these functions are instructions the user gives to the interactor to run inside the interaction loop. Inside FURY there are tree
types of callbacks passed to the window interactor:
1. **Timer Callbacks**: Added to the window interactor, they are a set of instructions that will be called from time to time, with interval defined by the user.
2. **Window Callbacks**: Added directly to the window, they are a set of instructions called whenever an specific event is triggered.
-3. **Interactor Callbacks**: Added to the window interactor, they are a set of instructions called whenever an specific interaction, for example a mouse left-click, is triggered.
+3. **Interactor Callbacks**: Added to the window interactor, they are a set of instructions called whenever an specific interaction, for example a mouse left-click, is triggered.
-In this API, I will be using the *Interactor Callback*, set by the ``window.add_iren_callback()`` function, that will be called whenever a *Render*
-interaction is detected, and needs to be first passed to the onscreen manager.
+In this API, I will be using the *Interactor Callback*, set by the ``window.add_iren_callback()`` function, that will be called whenever a *Render*
+interaction is detected, and needs to be first passed to the onscreen manager.
-These details are more complicated, and would need, for example, for the user to pass the onscreen manager to the ``actor.kde()`` function.
+These details are more complicated, and would need, for example, for the user to pass the onscreen manager to the ``actor.kde()`` function.
Also, in the case of a kde actor not being used anymore and being declared, the callback then passed would still exist inside the manager and
be called even when the kde actor is not on screen anymore, which is not ideal.
-Knowing these problems, we thought of a second option, that would have the advantage of not leaving those details and steps behind. It has
-the tradeoff of maybe complicating things as it would need to be called after calling the effects manager, but as I will show you below,
-it is not that complicated *at all*.
+Knowing these problems, we thought of a second option, that would have the advantage of not leaving those details and steps behind. It has
+the tradeoff of maybe complicating things as it would need to be called after calling the effects manager, but as I will show you below,
+it is not that complicated *at all*.
-I also reviewed my fellow GSoC contributors PR's as well, PR `#810 `_ and
+I also reviewed my fellow GSoC contributors PR's as well, PR `#810 `_ and
`#803 `_. Bruno told me to take a look as well on `Conventional Commits `_ , a way to standardize
commits by prefixes, so I did that as well.
So how did it go?
-----------------
-Well, the implemented manager class is named ``EffectManager()`` and to initialize it you only need to pass the onscreen manager.
+Well, the implemented manager class is named ``EffectManager()`` and to initialize it you only need to pass the onscreen manager.
The onscreen manager is the standard FURY window manager you would use in a normal FURY-based program:
.. code-block:: python
-
+
# Onscreen manager setup
from fury import window
@@ -90,9 +90,9 @@ point:
:alt: 3D KDE render
After having that working, I experimented beyond. See, as I previously said, we are dealing here with *post-processing effects*, with KDE
-being only one of the many existing ones, as this `Wikipedia Page `_ on post processing shows.
-Knowing that, I tried one of the first filters I learned, the Laplacian one. This filter is, as its name hints, applying the
-`Discrete Laplace Operator `_ in an image. This filter shows sudden changes of value, a
+being only one of the many existing ones, as this `Wikipedia Page `_ on post processing shows.
+Knowing that, I tried one of the first filters I learned, the Laplacian one. This filter is, as its name hints, applying the
+`Discrete Laplace Operator `_ in an image. This filter shows sudden changes of value, a
good way to detect borders. The process is the same as the kde actor, requiring only the actor you want to apply the filter to.
Below, the result I got from applying that to a box actor:
@@ -107,7 +107,7 @@ after another? Well, the example below shows that is possible as well:
:align: center
:alt: Double laplacian application on the box actor.
-It still needs some tweaks and suffers from some bugs, but it works! Those represent important progress as it shows the versatility this
+It still needs some tweaks and suffers from some bugs, but it works! Those represent important progress as it shows the versatility this
API may present. I have also already implemented `grayscale` and `3x3 gaussian blur` as well:
.. image:: https://raw.githubusercontent.com/JoaoDell/gsoc_assets/main/images/gaussian_blur.png
@@ -120,8 +120,8 @@ API may present. I have also already implemented `grayscale` and `3x3 gaussian b
This Week's Goals
-----------------
-My plans for this week are to keep working and polishing the API, mainly the KDE part, so it can be ready for a first review.
+My plans for this week are to keep working and polishing the API, mainly the KDE part, so it can be ready for a first review.
When that is ready, I plan to experiment with more filters and make this more dynamic, maybe implementing a way to apply custom kernel
transformations, passed by the user, to the rendering process. This has been a really exciting journey and I am getting happy with the results!
-Wish me luck!
\ No newline at end of file
+Wish me luck!
diff --git a/docs/source/posts/2023/2023-07-29-week-9-praneeth.rst b/docs/source/posts/2023/2023-07-29-week-9-praneeth.rst
index 478a53e5e..a01a99aad 100644
--- a/docs/source/posts/2023/2023-07-29-week-9-praneeth.rst
+++ b/docs/source/posts/2023/2023-07-29-week-9-praneeth.rst
@@ -22,4 +22,4 @@ I encountered some peculiar test failures that were indirectly related to the *T
What is coming up next?
------------------------
-My next priority will be completing the *SpinBoxUI* now that the *TextBlock2D* is fixed and successfully integrated.
\ No newline at end of file
+My next priority will be completing the *SpinBoxUI* now that the *TextBlock2D* is fixed and successfully integrated.
diff --git a/docs/source/posts/2023/2023-07-31-week-9-joaodellagli.rst b/docs/source/posts/2023/2023-07-31-week-9-joaodellagli.rst
index d02d9fd2a..90605dcc3 100644
--- a/docs/source/posts/2023/2023-07-31-week-9-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-07-31-week-9-joaodellagli.rst
@@ -11,28 +11,28 @@ Hello everyone, it's time for another weekly blogpost! Today, I am going to upda
Last Week's Effort
------------------
-After having finished a first draft of the API that will be used for the KDE rendering, and showing how it could be used
-for other post-processing effects, my goal was to clean the code and try some details that would add to it so it could be better
+After having finished a first draft of the API that will be used for the KDE rendering, and showing how it could be used
+for other post-processing effects, my goal was to clean the code and try some details that would add to it so it could be better
complete. Having that in mind, I invested in three work fronts:
1. Fixing some bugs related to the rendering more than one post-processing effect actor.
2. Experimenting with other rendering kernels (I was using the *gaussian* one only).
-3. Completing the KDE render by renormalizing the values in relation to the number of points (one of the core KDE details).
+3. Completing the KDE render by renormalizing the values in relation to the number of points (one of the core KDE details).
Both three turned out more complicated than it initially seemed, as I will show below.
So how did it go?
-----------------
-The first one I did on monday-tuesday, and I had to deal with some issues regarding scaling and repositioning. Due to implementation
-choices, the final post-processed effects were rendered either bigger than they were in reality, or out of their original place.
-After some time dedicated to finding the root of the problems, I could fix the scaling issue, however I realised I would need to,
-probably, rethink the way the API was implemented. As this general post-processing effects is a side-project that comes as a consequence of
+The first one I did on monday-tuesday, and I had to deal with some issues regarding scaling and repositioning. Due to implementation
+choices, the final post-processed effects were rendered either bigger than they were in reality, or out of their original place.
+After some time dedicated to finding the root of the problems, I could fix the scaling issue, however I realised I would need to,
+probably, rethink the way the API was implemented. As this general post-processing effects is a side-project that comes as a consequence of
my main one, I decided to leave that investment to another time, as I would need to guarantee the quality of the second.
-The second was an easy and rather interesting part of my week, as I just needed to setup new kernel shaders. Based on
+The second was an easy and rather interesting part of my week, as I just needed to setup new kernel shaders. Based on
`scikit-learn KDE documentation `_, I could successfully implement the following kernels:
-* Gaussian
+* Gaussian
.. math::
K(x, y) = e^{\frac{-(x^2 + y^2)}{2\sigma^2}}
@@ -70,26 +70,26 @@ That outputted the following (beautiful) results for a set of 1000 random points
The third one is still being a trickier challenge. If you recall from my first blogposts, I spent something around *one month* trying to setup
-float framebuffer objects to FURY with VTK so I could use them in my project. After spending all of that time with no results,
-me and Bruno, my mentor, :doc:`found a way <2023-07-03-week-5-joaodellagli.rst>` to do what we wanted to do, but using a different VTK class,
-`vtkWindowToImageFilter `_. Well, it was a good workaround back then and
-it lead me all the way here, however now it is costing a price. The float framebuffers were an important part of the project because they
-would allow us to pass *32-bit float information* from one shader to another, which would be important as they would allow the densities to
+float framebuffer objects to FURY with VTK so I could use them in my project. After spending all of that time with no results,
+me and Bruno, my mentor, :doc:`found a way <2023-07-03-week-5-joaodellagli.rst>` to do what we wanted to do, but using a different VTK class,
+`vtkWindowToImageFilter `_. Well, it was a good workaround back then and
+it lead me all the way here, however now it is costing a price. The float framebuffers were an important part of the project because they
+would allow us to pass *32-bit float information* from one shader to another, which would be important as they would allow the densities to
have higher precision and more fidelity to the calculations. When rendering a KDE of a given set of points, we use the below function:
.. math::
KDE(x, y) = \frac{1}{n} \sum_{i = 0}^n K(x, y)
-If the number of points :math:`n` is big enough, some KDE results will be really low. This presents a real problem to our implementation because, without
-the float framebuffers, it is currently only being possible to pass *8-bit unsigned char* information, that only allows 256 values.
+If the number of points :math:`n` is big enough, some KDE results will be really low. This presents a real problem to our implementation because, without
+the float framebuffers, it is currently only being possible to pass *8-bit unsigned char* information, that only allows 256 values.
This is far from ideal, as low values would have alone densities low enough to disappear. This presented a problem as to renormalize the
densities, I was retrieving the texture to the CPU, calculating its minimum and maximum values, and passing to the fragment shader as uniforms
for the renormalization, which didn't work if the maximum values calculated were zero.
-One solution I thought to solve that was a really heavy workaround: if an unsigned float is 32-bit and I have exactly 4 8-bit
-unsigned chars, why not try to pack this float into these 4 chars? Well, this is an interesting approach which I figured out is already an
+One solution I thought to solve that was a really heavy workaround: if an unsigned float is 32-bit and I have exactly 4 8-bit
+unsigned chars, why not try to pack this float into these 4 chars? Well, this is an interesting approach which I figured out is already an
old one, being reported in `GPU Gems's chapter 12 `_.
-Unfortunately I haven't tried yet this implementation yet, and went for one I thought myself, which haven't exactly worked. I also tried
+Unfortunately I haven't tried yet this implementation yet, and went for one I thought myself, which haven't exactly worked. I also tried
this implementation from `Aras PranckeviÄŤius' website `_, which seems
to be working, even though not perfectly:
@@ -97,7 +97,7 @@ to be working, even though not perfectly:
:align: center
:alt: Noisy float to RGBA encoding
-As you can see, this implementation is *really noisy*. I think this has to deal with floating point rounding errors, so to try to mitigate
+As you can see, this implementation is *really noisy*. I think this has to deal with floating point rounding errors, so to try to mitigate
that, I experimented applying a *13x13 gaussian blur* to it. Below, what I got from that:
.. image:: https://raw.githubusercontent.com/JoaoDell/gsoc_assets/main/images/blurred_kde.png
@@ -108,9 +108,9 @@ That looks way better, even though not ideal yet.
This Week's Goals
-----------------
-Talking with my mentors, we decided it was better if I focused on the version without the renormalization for now, as it was already
-done and running fine. So for this week, I plan to clean my PR to finally have it ready for a first review, and maybe add to it a little
-UI tool to control the intensity of the densities. That should take me some time and discussion, but I hope for it to be ready by the
+Talking with my mentors, we decided it was better if I focused on the version without the renormalization for now, as it was already
+done and running fine. So for this week, I plan to clean my PR to finally have it ready for a first review, and maybe add to it a little
+UI tool to control the intensity of the densities. That should take me some time and discussion, but I hope for it to be ready by the
end of the week.
Let's get to work!
diff --git a/docs/source/posts/2023/2023-08-05-week-10-praneeth.rst b/docs/source/posts/2023/2023-08-05-week-10-praneeth.rst
index 4dfeff75b..96ebdefef 100644
--- a/docs/source/posts/2023/2023-08-05-week-10-praneeth.rst
+++ b/docs/source/posts/2023/2023-08-05-week-10-praneeth.rst
@@ -18,4 +18,4 @@ Thankfully, this week was quite smooth sailing without any major roadblocks.
What is coming up next?
-----------------------
-Looking ahead, my plan is to finalize the integration of the updated ``TextBlock`` and ``SpinBoxUI`` components. This entails making sure that everything works seamlessly together and is ready for the next stages of development.
\ No newline at end of file
+Looking ahead, my plan is to finalize the integration of the updated ``TextBlock`` and ``SpinBoxUI`` components. This entails making sure that everything works seamlessly together and is ready for the next stages of development.
diff --git a/docs/source/posts/2023/2023-08-07-week-10-joaodellagli.rst b/docs/source/posts/2023/2023-08-07-week-10-joaodellagli.rst
index 51beb1e9f..6ee105e93 100644
--- a/docs/source/posts/2023/2023-08-07-week-10-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-08-07-week-10-joaodellagli.rst
@@ -6,22 +6,22 @@ Week 10: Ready for Review!
:tags: google
:category: gsoc
-Hello everyone, it's time for another weekly blogpost!
+Hello everyone, it's time for another weekly blogpost!
Last Week's Effort
------------------
-After talking with my mentors, I was tasked with getting my API PR `#826 `_ ready for review,
-as it still needed some polishing, and the most important of all, it needed its tests working, as this was something I haven't invested time since its creation.
+After talking with my mentors, I was tasked with getting my API PR `#826 `_ ready for review,
+as it still needed some polishing, and the most important of all, it needed its tests working, as this was something I haven't invested time since its creation.
Having that in mind, I have spent the whole week cleaning whatever needed, writing the tests, and also writing a simple example of its
-usage. I also tried implementing a little piece of UI so the user could control the intensity of the bandwidth of the KDE render, but
+usage. I also tried implementing a little piece of UI so the user could control the intensity of the bandwidth of the KDE render, but
I had a little problem I will talk about below.
So how did it go?
-----------------
Fortunately, for the cleaning part, I didn't have any trouble, and my PR is finally ready for review! The most complicated part was to write the tests, as this is something that
-requires attention to understand what needs to be tested, exactly. As for the UI part, I managed to have a slider working for the
-intensity, however, it was crashing the whole program for a reason, so I decided to leave this idea behind for now.
+requires attention to understand what needs to be tested, exactly. As for the UI part, I managed to have a slider working for the
+intensity, however, it was crashing the whole program for a reason, so I decided to leave this idea behind for now.
Below, an example of how this should work:
.. image:: https://raw.githubusercontent.com/JoaoDell/gsoc_assets/main/images/slider.gif
@@ -31,7 +31,7 @@ Below, an example of how this should work:
This Week's Goals
-----------------
After a meeting with my mentors, we decided that this week's focus should be on finding a good usage example of the KDE rendering feature,
-to have it as a showcase of the capability of this API. Also, they hinted me some changes that need to be done regarding the API, so I
-will also invest some time on refactoring it.
+to have it as a showcase of the capability of this API. Also, they hinted me some changes that need to be done regarding the API, so I
+will also invest some time on refactoring it.
-Wish me luck!
\ No newline at end of file
+Wish me luck!
diff --git a/docs/source/posts/2023/2023-08-14-week-11-joaodellagli.rst b/docs/source/posts/2023/2023-08-14-week-11-joaodellagli.rst
index fd5c9dace..e3dc59bf1 100644
--- a/docs/source/posts/2023/2023-08-14-week-11-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-08-14-week-11-joaodellagli.rst
@@ -6,25 +6,25 @@ Week 11: A Refactor is Sometimes Needed
:tags: google
:category: gsoc
-Hello everyone, it's time for another weekly blogpost! Today I am going to share some updates on the API refactoring
+Hello everyone, it's time for another weekly blogpost! Today I am going to share some updates on the API refactoring
I was working on with my mentors.
Last Week's Effort
------------------
-As I shared with you :doc:`last week <2023-08-07-week-10-joaodellagli>`, the first draft of my API was finally ready for review, as
+As I shared with you :doc:`last week <2023-08-07-week-10-joaodellagli>`, the first draft of my API was finally ready for review, as
I finished tweaking some remaining details missing. I was tasked with finding a good example of the usage of the tools we proposed,
-and I started to do that, however after testing it with some examples, I figured out some significant bugs were to be fixed. Also,
-after some reviews and hints from some of my mentors and other GSoC contributors, we realised that some refactoring should be done,
-mainly focused on avoiding bad API usage from the user.
+and I started to do that, however after testing it with some examples, I figured out some significant bugs were to be fixed. Also,
+after some reviews and hints from some of my mentors and other GSoC contributors, we realised that some refactoring should be done,
+mainly focused on avoiding bad API usage from the user.
So how did it go?
-----------------
-Initially, I thought only one bug was the source of the issues the rendering presented, but it turned out to be two, which I will
-explain further.
+Initially, I thought only one bug was the source of the issues the rendering presented, but it turned out to be two, which I will
+explain further.
-The first bug was related to scaling and misalignment of the KDE render. The render of the points being post-processed was not only
+The first bug was related to scaling and misalignment of the KDE render. The render of the points being post-processed was not only
with sizes different from the original set size, but it was also misaligned, making it appear in positions different from the points'
-original ones. After some time spent, I figured out the bug was related to the texture coordinates I was using. Before, this is how
+original ones. After some time spent, I figured out the bug was related to the texture coordinates I was using. Before, this is how
my fragment shader looked:
.. code-block:: C
@@ -33,26 +33,26 @@ my fragment shader looked:
vec2 tex_coords = res_factor*normalizedVertexMCVSOutput.xy*0.5 + 0.5;
float intensity = texture(screenTexture, tex_coords).r;
-It turns out using this texture coordinates for *this case* was not the best choice, as even though it matches the fragment positions,
-the idea here was to render the offscreen window, which has the same size as the onscreen one, to the billboard actor. With that in mind,
-I realised the best choice was using texture coordinates that matched the whole screen positions, coordinates that were derived from the
+It turns out using this texture coordinates for *this case* was not the best choice, as even though it matches the fragment positions,
+the idea here was to render the offscreen window, which has the same size as the onscreen one, to the billboard actor. With that in mind,
+I realised the best choice was using texture coordinates that matched the whole screen positions, coordinates that were derived from the
``gl_FragCoord.xy``, being the division of that by the resolution of the screen, for normalization. Below, the change made:
.. code-block:: C
vec2 tex_coords = gl_FragCoord.xy/res;
float intensity = texture(screenTexture, tex_coords).r;
-
-This change worked initially, although with some problems, that later revealed the resolution of the offscreen window needed to be
+
+This change worked initially, although with some problems, that later revealed the resolution of the offscreen window needed to be
updated inside the callback function as well. Fixing that, it was perfectly aligned and scaled!
The second bug was related with the handling of the bandwidth, former sigma parameter. I realised I wasn't dealing properly with the option of the user passing only
-one single bandwidth value being passed, so when trying that, only the first point was being rendered. I also fixed that and it worked,
+one single bandwidth value being passed, so when trying that, only the first point was being rendered. I also fixed that and it worked,
so cheers!
-As I previously said, the bugs were not the only details I spent my time on last week. Being reviewed, the API design, even
-though simple, showed itself vulnerable to bad usage from the user side, requiring some changes. The changes suggested by mentors were,
-to, basically, take the ``kde`` method out of the ``EffectManager`` class, and create a new class from it inside an ``effects`` module,
+As I previously said, the bugs were not the only details I spent my time on last week. Being reviewed, the API design, even
+though simple, showed itself vulnerable to bad usage from the user side, requiring some changes. The changes suggested by mentors were,
+to, basically, take the ``kde`` method out of the ``EffectManager`` class, and create a new class from it inside an ``effects`` module,
like it was a special effects class. With this change, the KDE setup would go from:
.. code-block:: python
@@ -73,8 +73,8 @@ To:
em.add(kde_effect)
-Not a gain in line shortening, however, a gain in security, as preventing users from misusing the kde_actor. Something worth noting is
-that I learned how to use the ``functools.partial`` function, that allowed me to partially call the callback function with only some
+Not a gain in line shortening, however, a gain in security, as preventing users from misusing the kde_actor. Something worth noting is
+that I learned how to use the ``functools.partial`` function, that allowed me to partially call the callback function with only some
parameters passed.
diff --git a/docs/source/posts/2023/2023-08-19-week-12-praneeth.rst b/docs/source/posts/2023/2023-08-19-week-12-praneeth.rst
index d34b54ad0..f80ea0ebf 100644
--- a/docs/source/posts/2023/2023-08-19-week-12-praneeth.rst
+++ b/docs/source/posts/2023/2023-08-19-week-12-praneeth.rst
@@ -50,4 +50,3 @@ Among the challenges I faced, one notable instance involved addressing the visib
What is coming up next?
-----------------------
The ``FileDialog`` implementation is nearly finalized, and my plan is to work on any review, feedback or suggestions that might arise. Following this, I will shift my attention towards addressing the ``TreeUI``.
-
diff --git a/docs/source/posts/2023/2023-08-21-week-12-joaodellagli.rst b/docs/source/posts/2023/2023-08-21-week-12-joaodellagli.rst
index 83ad86cf4..3f8289135 100644
--- a/docs/source/posts/2023/2023-08-21-week-12-joaodellagli.rst
+++ b/docs/source/posts/2023/2023-08-21-week-12-joaodellagli.rst
@@ -6,21 +6,21 @@ Week 12: Now That is (almost) a Wrap!
:tags: google
:category: gsoc
-Hello everyone, it's time for another GSoC blogpost! Today, I am going to talk about some minor details I worked on last week on my
+Hello everyone, it's time for another GSoC blogpost! Today, I am going to talk about some minor details I worked on last week on my
project.
Last Week's Effort
------------------
-After the API refactoring was done last week, I focused on addressing the reviews I would get from it. The first issues I addressed was related to
-style, as there were some minor details my GSoC contributors pointed out that needed change. Also, I have addressed an issue I was having
-with the `typed hint` of one of my functions. Filipi, my mentor, showed me there is a way to have more than one typed hint in the same parameter,
+After the API refactoring was done last week, I focused on addressing the reviews I would get from it. The first issues I addressed was related to
+style, as there were some minor details my GSoC contributors pointed out that needed change. Also, I have addressed an issue I was having
+with the `typed hint` of one of my functions. Filipi, my mentor, showed me there is a way to have more than one typed hint in the same parameter,
all I needed to do was to use the `Union` class from the `typing` module, as shown below:
.. code-block:: python
from typing import Union as tUnion
from numpy import ndarray
-
+
def function(variable : tUnion(float, np.ndarray)):
pass
@@ -32,8 +32,8 @@ All went fine with no difficult at all, thankfully.
The Next Steps
--------------
-My next plans are, after having PR `#826 `_ merged, to work on the float encoding issue described in
-:doc:`this blogpost<2023-07-31-week-9-joaodellagli>`. Also, I plan to tackle the UI idea once again, to see if I can finally give the user
+My next plans are, after having PR `#826 `_ merged, to work on the float encoding issue described in
+:doc:`this blogpost<2023-07-31-week-9-joaodellagli>`. Also, I plan to tackle the UI idea once again, to see if I can finally give the user
a way to control the intensities of the distributions.
Wish me luck!
diff --git a/docs/source/posts/2023/2023-08-25-final-report-praneeth.rst b/docs/source/posts/2023/2023-08-25-final-report-praneeth.rst
index 0209ba61b..91824b8e2 100644
--- a/docs/source/posts/2023/2023-08-25-final-report-praneeth.rst
+++ b/docs/source/posts/2023/2023-08-25-final-report-praneeth.rst
@@ -45,7 +45,7 @@ Objectives Completed
- **SpinBoxUI:**
The ``SpinBoxUI`` element is essential for user interfaces as it allows users to pick a numeric value from a set range. While we had an active pull request (PR) to add this element, updates in the main code caused conflicts and required further changes for added features. At one point, we noticed that text alignment wasn't centered properly within the box due to a flaw. To fix this, we began a PR to adjust the alignment, but it turned into a larger refactoring of the ``TextBlock2D``, a core component connected to various parts. This was a complex task that needed careful handling. After sorting out the ``TextBlock2D``, we returned to the ``SpinBoxUI`` and made a few tweaks. Once we were confident with the changes, the PR was successfully merged after thorough review and testing.
-
+
**Pull Requests:**
- **SpinBoxUI (Merged)** - https://github.com/fury-gl/fury/pull/499
@@ -53,28 +53,28 @@ Objectives Completed
:height: 500
:align: center
:alt: SpinBoxUI
-
+
- **`TextBlock2D` Refactoring:**
This was a significant aspect of the GSoC period and occupied a substantial portion of the timeline. The process began when we observed misaligned text in the ``SpinBoxUI``, as previously discussed. The root cause of the alignment issue was the mispositioning of the text actor concerning the background actor. The text actor's independent repositioning based on justification conflicted with the static position of the background actor, leading to the alignment problem.
-
+
To address this, the initial focus was on resolving the justification issue. However, as the work progressed, we recognized that solely adjusting justification would not suffice. The alignment was inherently linked to the UI's size, which was currently retrieved only when a valid scene was present. This approach lacked scalability and efficiency, as it constrained size retrieval to scene availability.
-
+
To overcome these challenges, we devised a solution involving the creation of a bounding box around the ``TextBlock2D``. This bounding box would encapsulate the size information, enabling proper text alignment. This endeavor spanned several weeks of development, culminating in a finalized solution that underwent rigorous testing before being merged.
-
+
As a result of this refactoring effort, the ``TextBlock2D`` now offers three distinct modes:
-
+
1. **Fully Static Background:** This mode requires background setup during initialization.
2. **Dynamic Background:** The background dynamically scales based on the text content.
3. **Auto Font Scale Mode:** The font within the background box automatically scales to fill the available space.
-
+
An issue has been identified with ``TextBlock2D`` where its text actor aligns with the top boundary of the background actor, especially noticeable with letters like "g," "y," and "j". These letters extend beyond the baseline of standard alphabets, causing the text box to shift upwards.
-
+
However, resolving this matter is complex. Adjusting the text's position might lead to it touching the bottom boundary, especially in font scale mode, resulting in unexpected positioning and transformations. To address this, the plan is to defer discussions about this matter until after GSoC, allowing for thorough consideration and solutions.
-
+
For more detailed insights into the individual steps and nuances of this process, you can refer to the comprehensive weekly blog post provided below. It delves into the entire journey of this ``TextBlock2D`` refactoring effort.
-
+
**Pull Requests:**
- **Fixing Justification Issue - 1st Draft (Closed)** - https://github.com/fury-gl/fury/pull/790
- **Adding BoundingBox and fixing Justificaiton (Merged)** - https://github.com/fury-gl/fury/pull/803
@@ -86,7 +86,7 @@ Objectives Completed
:height: 500
:align: center
:alt: TextBlock2D Feature Demo
-
+
.. image:: https://github-production-user-asset-6210df.s3.amazonaws.com/64432063/254652569-94212105-7259-48da-8fdc-41ee987bda84.png
:height: 500
:align: center
@@ -96,7 +96,7 @@ Objectives Completed
We initially planned to make the scrollbar independent based on PR `#16 `_. The main goal was to avoid redundancy by not rewriting the scrollbar code for each element that requires it, such as the ``FileMenu2D``. However, upon further analysis, we realized that elements like the ``FileMenu2D`` and others utilize the ``Listbox2D``, which already includes an integrated scrollbar. We also examined other UI libraries and found that they also have independent scrollbars but lack a proper use case. Typically, display containers like ``Listbox2D`` are directly used instead of utilizing an independent scrollbar.
Based on these findings, we have decided to close all related issues and pull requests for now. If the need arises in the future, we can revisit this topic.
-
+
**Topic:** - https://github.com/fury-gl/fury/discussions/816
@@ -115,13 +115,13 @@ Other Objectives
**Pull Requests:**
- **CardUI (Merged)** - https://github.com/fury-gl/fury/pull/398
- **ComboBox Flaw (Merged)** - https://github.com/fury-gl/fury/pull/768
-
+
.. image:: https://user-images.githubusercontent.com/54466356/112532305-b090ef80-8dce-11eb-90a0-8d06eed55993.png
:height: 500
:align: center
:alt: CardUI
-
+
- **Updating Broken Website Links:**
I addressed an issue with malfunctioning links in the Scientific Section of the website. The problem emerged from alterations introduced in PR `#769 `_. These changes consolidated demos and examples into a unified "auto_examples" folder, and a toml file was utilized to retrieve this data and construct examples. However, this led to challenges with the paths employed in website generation. My responsibility was to rectify these links, ensuring they accurately direct users to the intended content.
@@ -135,11 +135,11 @@ Objectives in Progress
- **FileDialogUI:**
An existing ``FileDialog`` PR by Soham (`#294 `_) was worked upon. The primary task was to rebase the PR to match the current UI structure, resolving compatibility concerns with the older base. In PR `#832 `_, we detailed issues encompassing resizing ``FileDialog`` and components, addressing text overflow, fixing ``ZeroDivisionError``, and correcting ``ListBox2D`` item positioning. The PR is complete with comprehensive testing and documentation. Presently, it's undergoing review, and upon approval, it will be prepared for integration.
-
+
**Pull Requests:**
- **Soham's FileDialog (Closed)** - https://github.com/fury-gl/fury/pull/294
- **FileDialogUI (Under Review)** - https://github.com/fury-gl/fury/pull/832
-
+
.. image:: https://user-images.githubusercontent.com/64432063/263189092-6b0891d5-f0ef-4185-8b17-c7104f1a7d60.gif
:height: 500
@@ -149,10 +149,10 @@ Objectives in Progress
- **TreeUI:**
Continuing Antriksh's initial PR for ``TreeUI`` posed some challenges. Antriksh had set the foundation, and I picked up from there. The main issue was with the visibility of TreeUI due to updates in the ``set_visibility`` method of ``Panel2D``. These updates affected how ``TreeUI`` was displayed, and after investigating the actors involved, it was clear that the visibility features had changed. This took some time to figure out, and I had a helpful pair programming session with my mentor, Serge, to narrow down the problem. Now, I've updated the code to address this issue. However, I'm still a bit cautious about potential future problems. The PR is now ready for review.
-
+
**Pull Requests:**
- **TreeUI (In Progress)** - https://github.com/fury-gl/fury/pull/821
-
+
.. image:: https://user-images.githubusercontent.com/64432063/263237308-70e77ba0-1ce8-449e-a79c-d5e0fbb58b45.gif
:height: 500
diff --git a/docs/source/release_notes/releasev0.6.1.rst b/docs/source/release_notes/releasev0.6.1.rst
index e5889fd85..6f6593b8e 100644
--- a/docs/source/release_notes/releasev0.6.1.rst
+++ b/docs/source/release_notes/releasev0.6.1.rst
@@ -53,7 +53,7 @@ Pull Requests (15):
* :ghpull:`279`: Decreasing the size of the sun in solarsystem tutorial
* :ghpull:`273`: Python GSoC Weekly blogs
* :ghpull:`276`: Update Deprecated test
-* :ghpull:`272`: Python GSoC Blogs upto 19th July 2020
+* :ghpull:`272`: Python GSoC Blogs up to 19th July 2020
Issues (27):
@@ -83,4 +83,4 @@ Issues (27):
* :ghissue:`273`: Python GSoC Weekly blogs
* :ghissue:`277`: Sun
* :ghissue:`276`: Update Deprecated test
-* :ghissue:`272`: Python GSoC Blogs upto 19th July 2020
+* :ghissue:`272`: Python GSoC Blogs up to 19th July 2020
diff --git a/docs/upload_to_gh-pages.py b/docs/upload_to_gh-pages.py
index e0724a10b..4a71d0f11 100644
--- a/docs/upload_to_gh-pages.py
+++ b/docs/upload_to_gh-pages.py
@@ -10,12 +10,12 @@
# Imports
###############################################################################
import os
-import re
-import shutil
-import sys
from os import chdir as cd
from os.path import join as pjoin
+import re
+import shutil
from subprocess import PIPE, CalledProcessError, Popen, check_call
+import sys
if sys.version_info < (3, 4):
raise RuntimeError('Python 3.4 and above is required' ' for running this script')
diff --git a/fury/__init__.py b/fury/__init__.py
index 4ad440f81..5c4ee0347 100644
--- a/fury/__init__.py
+++ b/fury/__init__.py
@@ -18,8 +18,8 @@ def get_info(verbose=False):
with named parameters of interest
"""
- import sys
from os.path import dirname
+ import sys
import numpy
import scipy
diff --git a/fury/actor.py b/fury/actor.py
index 68cfbac0a..54eeced7d 100644
--- a/fury/actor.py
+++ b/fury/actor.py
@@ -1,12 +1,11 @@
"""Module that provide actors to render."""
+from functools import partial
import os
import warnings
-from functools import partial
import numpy as np
-import fury.primitive as fp
from fury import layout
from fury.actors.odf_slicer import OdfSlicerActor
from fury.actors.peak import PeakActor
@@ -34,8 +33,8 @@
ImageData,
ImageMapToColors,
ImageReslice,
- LinearExtrusionFilter,
LODActor,
+ LinearExtrusionFilter,
LookupTable,
LoopSubdivisionFilter,
Matrix4x4,
@@ -50,9 +49,9 @@
SplineFilter,
TextActor3D,
Texture,
+ TextureMapToPlane,
TexturedActor2D,
TexturedSphereSource,
- TextureMapToPlane,
Transform,
TransformPolyDataFilter,
TriangleFilter,
@@ -60,6 +59,7 @@
VectorText,
numpy_support,
)
+import fury.primitive as fp
from fury.shaders import (
add_shader_callback,
attribute_to_actor,
diff --git a/fury/actors/odf_slicer.py b/fury/actors/odf_slicer.py
index cf4315275..f4e570ec4 100644
--- a/fury/actors/odf_slicer.py
+++ b/fury/actors/odf_slicer.py
@@ -118,7 +118,7 @@ def display_extent(self, x1, x2, y1, y2, z1, z2):
(inclusive).
"""
mask = np.zeros(self.grid_shape, dtype=bool)
- mask[x1 : x2 + 1, y1 : y2 + 1, z1 : z2 + 1] = True
+ mask[x1: x2 + 1, y1: y2 + 1, z1: z2 + 1] = True
self.mask = mask
self._update_mapper()
@@ -173,7 +173,10 @@ def update_sphere(self, vertices, faces, B):
"""Dynamically change the sphere used for SH to SF projection.
"""
if self.B is None:
- raise ValueError("Can't update sphere when using " 'SF coefficients.')
+ raise ValueError(
+ "Can't update sphere when using "
+ 'SF coefficients.'
+ )
self.vertices = vertices
if self.affine is not None:
self.w_verts = self.vertices.dot(self.affine[:3, :3])
@@ -242,8 +245,9 @@ def _get_all_vertices(self, offsets, sph_dirs, sf):
if self.radial_scale:
# apply SF amplitudes to all sphere
# directions and offset each voxel
- return np.tile(sph_dirs, (len(offsets), 1)) * sf.reshape(-1, 1) + np.repeat(
- offsets, len(sph_dirs), axis=0
+ return (
+ np.tile(sph_dirs, (len(offsets), 1)) * sf.reshape(-1, 1)
+ + np.repeat(offsets, len(sph_dirs), axis=0)
)
# return scaled spheres offsetted by `offsets`
return np.tile(sph_dirs, (len(offsets), 1)) * self.scale + np.repeat(
@@ -271,7 +275,8 @@ def _generate_color_for_vertices(self, sf):
range_sf = sf.max(axis=-1) - sf.min(axis=-1)
rescaled = sf - sf.min(axis=-1, keepdims=True)
rescaled[range_sf > 0] /= range_sf[range_sf > 0][..., None]
- all_colors = create_colormap(rescaled.ravel(), self.colormap) * 255
+ all_colors = create_colormap(rescaled.ravel(), self.colormap) \
+ * 255
else:
all_colors = np.tile(
np.array(self.colormap).reshape(1, 3),
diff --git a/fury/actors/peak.py b/fury/actors/peak.py
index 3798b400a..0e6d6070a 100644
--- a/fury/actors/peak.py
+++ b/fury/actors/peak.py
@@ -91,9 +91,9 @@ def __init__(
xyz = np.asarray(center)
else:
xyz = w_pos[idx, :]
- valid_peaks = np.nonzero(np.abs(valid_dirs[idx, :, :]).max(axis=-1) > 0.0)[
- 0
- ]
+ valid_peaks = np.nonzero(
+ np.abs(valid_dirs[idx, :, :]).max(axis=-1) > 0.0
+ )[0]
for direction in valid_peaks:
if values is not None:
pv = values[center][direction]
@@ -152,14 +152,20 @@ def __init__(
uniform vec3 lowRanges;
uniform vec3 highRanges;
"""
- orient_to_rgb = import_fury_shader(pjoin('utils', 'orient_to_rgb.glsl'))
+ orient_to_rgb = import_fury_shader(
+ pjoin('utils', 'orient_to_rgb.glsl')
+ )
visible_cross_section = import_fury_shader(
pjoin('interaction', 'visible_cross_section.glsl')
)
- visible_range = import_fury_shader(pjoin('interaction', 'visible_range.glsl'))
+ visible_range = import_fury_shader(
+ pjoin('interaction', 'visible_range.glsl')
+ )
vs_dec = compose_shader([vs_var_dec, orient_to_rgb])
- fs_dec = compose_shader([fs_var_dec, visible_cross_section, visible_range])
+ fs_dec = compose_shader(
+ [fs_var_dec, visible_cross_section, visible_range]
+ )
vs_impl = """
centerVertexMCVSOutput = center;
@@ -292,11 +298,13 @@ def _orientation_colors(points, cmap='rgb_standard'):
"""
if cmap.lower() == 'rgb_standard':
col_list = [
- orient2rgb(points[i + 1] - points[i]) for i in range(0, len(points), 2)
+ orient2rgb(points[i + 1] - points[i])
+ for i in range(0, len(points), 2)
]
elif cmap.lower() == 'boys_standard':
col_list = [
- boys2rgb(points[i + 1] - points[i]) for i in range(0, len(points), 2)
+ boys2rgb(points[i + 1] - points[i])
+ for i in range(0, len(points), 2)
]
else:
raise ValueError(
@@ -359,7 +367,8 @@ def _peaks_colors_from_points(points, colors=None, points_per_line=2):
if len(colors) == num_lines:
pnts_colors = np.repeat(colors, points_per_line, axis=0)
if colors.ndim == 1: # Scalar per line
- color_array = numpy_support.numpy_to_vtk(pnts_colors, deep=True)
+ color_array = \
+ numpy_support.numpy_to_vtk(pnts_colors, deep=True)
colors_are_scalars = True
elif colors.ndim == 2: # RGB(A) color per line
global_opacity = 1 if colors.shape[1] == 3 else -1
@@ -409,12 +418,18 @@ def _points_to_vtk_cells(points, points_per_line=2):
this actor the creation of this array requires a 2 points padding
between indices.
"""
- offset = np.asarray(list(range(0, num_pnts + 1, points_per_line)), dtype=int)
+ offset = np.asarray(
+ list(range(0, num_pnts + 1, points_per_line)), dtype=int
+ )
vtk_array_type = numpy_support.get_vtk_array_type(connectivity.dtype)
cell_array.SetData(
- numpy_support.numpy_to_vtk(offset, deep=True, array_type=vtk_array_type),
- numpy_support.numpy_to_vtk(connectivity, deep=True, array_type=vtk_array_type),
+ numpy_support.numpy_to_vtk(
+ offset, deep=True, array_type=vtk_array_type
+ ),
+ numpy_support.numpy_to_vtk(
+ connectivity, deep=True, array_type=vtk_array_type
+ ),
)
cell_array.SetNumberOfCells(num_cells)
diff --git a/fury/actors/tensor.py b/fury/actors/tensor.py
index c4478554b..1270c23a0 100644
--- a/fury/actors/tensor.py
+++ b/fury/actors/tensor.py
@@ -422,7 +422,7 @@ def main_dir_uncertainty(evals, evecs, signal, sigma, b_matrix):
analysis described in [1]_. The idea is to estimate the variance of the
main eigenvector which corresponds to the main direction of diffusion,
directly from estimated D and its estimated covariance matrix
- :math:`\Delta D` (see [2]_, equation 4). The angle :math:`\\Theta`
+ :math:`\\Delta D` (see [2]_, equation 4). The angle :math:`\\Theta`
between the perturbed principal eigenvector of D,
:math:`\\epsilon_1+\\Delta\\epsilon_1`, and the estimated eigenvector
:math:`\\epsilon_1`, measures the angular deviation of the main fiber
diff --git a/fury/animation/tests/fares b/fury/animation/tests/fares
index b0bb73da9..22d4b906a 100644
--- a/fury/animation/tests/fares
+++ b/fury/animation/tests/fares
@@ -19,13 +19,13 @@ class myclass():
myclass.usren+=1
def __str__(self):
return f'collage name is {self.pname} , dof = {self.ccname}'
-
+
def print(self):
if self.pname in myclass.notallow:
print('not allowed')
else:
print(f'{self.pname} , {self.ccname}')
-
+
def allinfo():
print(f'the end of the class')
@classmethod
@@ -37,7 +37,7 @@ class student(myclass):
def __init__(self,name,cname,age):
super().__init__(name,cname)
self.age=age
-
+
def __str__(self):
return f'your name is {self.pname} ,course name = {self.ccname}, your age is {self.age}'
diff --git a/fury/animation/tests/test_timeline.py b/fury/animation/tests/test_timeline.py
index 41350eccf..8897ad0fe 100644
--- a/fury/animation/tests/test_timeline.py
+++ b/fury/animation/tests/test_timeline.py
@@ -3,10 +3,10 @@
import numpy as np
import numpy.testing as npt
-import fury.testing as ft
from fury.animation import Animation, Timeline
+import fury.testing as ft
from fury.ui import PlaybackPanel
-from fury.window import ShowManager, Scene
+from fury.window import Scene, ShowManager
def assert_not_equal(x, y):
diff --git a/fury/animation/timeline.py b/fury/animation/timeline.py
index 0a11d9698..710d08e89 100644
--- a/fury/animation/timeline.py
+++ b/fury/animation/timeline.py
@@ -1,8 +1,8 @@
import os
from time import perf_counter
-import numpy as np
from PIL import Image
+import numpy as np
from fury import window
from fury.animation.animation import Animation
diff --git a/fury/data/__init__.py b/fury/data/__init__.py
index 29ca1c49b..27af60fcf 100644
--- a/fury/data/__init__.py
+++ b/fury/data/__init__.py
@@ -1,16 +1,24 @@
"""Read or fetch test or example data."""
-from os.path import join as pjoin, dirname
-
-from fury.data.fetcher import (fetch_viz_cubemaps, read_viz_cubemap,
- fetch_viz_icons, fetch_viz_new_icons,
- read_viz_icons, fetch_viz_wiki_nw,
- fetch_viz_textures, read_viz_textures,
- fetch_viz_models, read_viz_models,
- fetch_viz_dmri, read_viz_dmri,
- fetch_gltf, read_viz_gltf,
- list_gltf_sample_models)
+from os.path import dirname, join as pjoin
+from fury.data.fetcher import (
+ fetch_gltf,
+ fetch_viz_cubemaps,
+ fetch_viz_dmri,
+ fetch_viz_icons,
+ fetch_viz_models,
+ fetch_viz_new_icons,
+ fetch_viz_textures,
+ fetch_viz_wiki_nw,
+ list_gltf_sample_models,
+ read_viz_cubemap,
+ read_viz_dmri,
+ read_viz_gltf,
+ read_viz_icons,
+ read_viz_models,
+ read_viz_textures,
+)
DATA_DIR = pjoin(dirname(__file__), 'files')
diff --git a/fury/data/fetcher.py b/fury/data/fetcher.py
index 1b784a42d..326d5f2ca 100644
--- a/fury/data/fetcher.py
+++ b/fury/data/fetcher.py
@@ -1,22 +1,20 @@
"""Fetcher based on dipy."""
-import os
-import sys
+import asyncio
import contextlib
-import warnings
-import json
-
-from os.path import join as pjoin, dirname
from hashlib import sha256
+import json
+import os
+from os.path import dirname, join as pjoin
+import platform
from shutil import copyfileobj
-
+import sys
import tarfile
+from urllib.request import urlopen
+import warnings
import zipfile
-from urllib.request import urlopen
-import asyncio
import aiohttp
-import platform
# Set a user-writeable file-system location to put files:
if 'FURY_HOME' in os.environ:
@@ -28,8 +26,10 @@
UW_RW_URL = \
"https://digital.lib.washington.edu/researchworks/bitstream/handle/"
-NEW_ICONS_DATA_URL = \
- "https://raw.githubusercontent.com/fury-gl/fury-data/master/icons/new_icons/"
+NEW_ICONS_DATA_URL = (
+ "https://raw.githubusercontent.com/fury-gl/fury-data/master/icons/"
+ "new_icons/"
+)
CUBEMAP_DATA_URL = \
"https://raw.githubusercontent.com/fury-gl/fury-data/master/cubemaps/"
@@ -183,7 +183,7 @@ def fetch_data(files, folder, data_size=None):
Raises if the sha checksum of the file does not match the expected
value. The downloaded file is not deleted when this error is raised.
-
+
"""
if not os.path.exists(folder):
print("Creating new folder %s" % (folder))
@@ -318,7 +318,6 @@ async def _download(session, url, filename, size=None):
Name of the downloaded file (e.g. BoxTextured.gltf)
size : int, optional
Length of the content in bytes
-
"""
if not os.path.exists(filename):
print(f'Downloading: {filename}')
@@ -414,7 +413,7 @@ def fetch_gltf(name=None, mode='glTF'):
-------
filenames : tuple
tuple of feteched filenames (list) and folder (str) path.
-
+
"""
if platform.system().lower() == "windows":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
@@ -458,11 +457,13 @@ def fetch_gltf(name=None, mode='glTF'):
["circle-pressed.png", "circle.png", "delete-pressed.png", "delete.png",
"drawing-pressed.png", "drawing.png", "line-pressed.png", "line.png",
"polyline-pressed.png", "polyline.png", "quad-pressed.png", "quad.png",
- "resize-pressed.png", "resize.png", "selection-pressed.png", "selection.png"],
+ "resize-pressed.png", "resize.png", "selection-pressed.png",
+ "selection.png"],
["circle-pressed.png", "circle.png", "delete-pressed.png", "delete.png",
"drawing-pressed.png", "drawing.png", "line-pressed.png", "line.png",
"polyline-pressed.png", "polyline.png", "quad-pressed.png", "quad.png",
- "resize-pressed.png", "resize.png", "selection-pressed.png", "selection.png"],
+ "resize-pressed.png", "resize.png", "selection-pressed.png",
+ "selection.png"],
["CD859F244DF1BA719C65C869C3FAF6B8563ABF82F457730ADBFBD7CA72DDB7BC",
"5896BDC9FF9B3D1054134D7D9A854677CE9FA4E64F494F156BB2E3F0E863F207",
"937C46C25BC38B62021B01C97A4EE3CDE5F7C8C4A6D0DB75BF4E4CACE2AF1226",
@@ -720,7 +721,7 @@ def read_viz_gltf(fname, mode='glTF'):
-------
path : str
Complete path of models.
-
+
"""
folder = pjoin(fury_home, 'glTF')
model = pjoin(folder, fname)
@@ -743,7 +744,7 @@ def list_gltf_sample_models():
model_names : list
Lists the name of glTF sample from
https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0
-
+
"""
DATA_DIR = pjoin(dirname(__file__), 'files')
with open(pjoin(DATA_DIR, 'KhronosGltfSamples.json'), 'r') as f:
diff --git a/fury/data/files/test_ui_tab_ui_top_position.json b/fury/data/files/test_ui_tab_ui_top_position.json
new file mode 100644
index 000000000..9934fd112
--- /dev/null
+++ b/fury/data/files/test_ui_tab_ui_top_position.json
@@ -0,0 +1 @@
+{"CharEvent": 0, "MouseMoveEvent": 1014, "KeyPressEvent": 0, "KeyReleaseEvent": 0, "LeftButtonPressEvent": 58, "LeftButtonReleaseEvent": 58, "RightButtonPressEvent": 10, "RightButtonReleaseEvent": 10, "MiddleButtonPressEvent": 0, "MiddleButtonReleaseEvent": 0}
\ No newline at end of file
diff --git a/fury/data/files/test_ui_tab_ui_top_position.log.gz b/fury/data/files/test_ui_tab_ui_top_position.log.gz
new file mode 100644
index 000000000..e7aebcdd7
Binary files /dev/null and b/fury/data/files/test_ui_tab_ui_top_position.log.gz differ
diff --git a/fury/data/tests/test_fetcher.py b/fury/data/tests/test_fetcher.py
index ba9e736f3..10f9a099c 100644
--- a/fury/data/tests/test_fetcher.py
+++ b/fury/data/tests/test_fetcher.py
@@ -1,9 +1,11 @@
+import json
import os
from os.path import join as pjoin
-import json
from urllib.request import urlopen
+
import numpy.testing as npt
-from fury.data import (fetch_gltf, read_viz_gltf, list_gltf_sample_models)
+
+from fury.data import fetch_gltf, list_gltf_sample_models, read_viz_gltf
if 'FURY_HOME' in os.environ:
fury_home = os.environ['FURY_HOME']
diff --git a/fury/deprecator.py b/fury/deprecator.py
index 0f3d81a1a..71607def0 100644
--- a/fury/deprecator.py
+++ b/fury/deprecator.py
@@ -9,9 +9,9 @@
"""
import functools
+from inspect import signature
import re
import warnings
-from inspect import signature
from fury import __version__
from fury.optpkg import optional_package
diff --git a/fury/gltf.py b/fury/gltf.py
index 4d06bea3e..5d1b782e6 100644
--- a/fury/gltf.py
+++ b/fury/gltf.py
@@ -4,9 +4,9 @@
import os
from typing import Dict # noqa
+from PIL import Image
import numpy as np
import pygltflib as gltflib
-from PIL import Image
from pygltflib.utils import glb2gltf, gltf2glb
from fury import actor, io, transform, utils
diff --git a/fury/io.py b/fury/io.py
index 5b64b8228..5e85345c1 100644
--- a/fury/io.py
+++ b/fury/io.py
@@ -1,10 +1,10 @@
import os
-import warnings
from tempfile import TemporaryDirectory as InTemporaryDirectory
from urllib.request import urlretrieve
+import warnings
-import numpy as np
from PIL import Image
+import numpy as np
from fury.lib import (
BMPReader,
@@ -24,9 +24,9 @@
PolyDataWriter,
STLReader,
STLWriter,
- Texture,
TIFFReader,
TIFFWriter,
+ Texture,
XMLPolyDataReader,
XMLPolyDataWriter,
numpy_support,
diff --git a/fury/lib.py b/fury/lib.py
index b780bd268..b9279f63c 100644
--- a/fury/lib.py
+++ b/fury/lib.py
@@ -1,3 +1,5 @@
+from vtkmodules.util import colors, numpy_support # type: ignore # noqa: F401
+from vtkmodules.util.misc import calldata_type # type: ignore # noqa: F401
import vtkmodules.vtkCommonCore as ccvtk # type: ignore
import vtkmodules.vtkCommonDataModel as cdmvtk # type: ignore
import vtkmodules.vtkCommonExecutionModel as cemvtk # type: ignore
@@ -11,21 +13,19 @@
import vtkmodules.vtkFiltersModeling as fmvtk # type: ignore
import vtkmodules.vtkFiltersSources as fsvtk # type: ignore
import vtkmodules.vtkFiltersTexture as ftvtk # type: ignore
-import vtkmodules.vtkImagingCore as icvtk # type: ignore
-import vtkmodules.vtkInteractionStyle as isvtk # type: ignore
import vtkmodules.vtkIOGeometry as iogvtk # type: ignore
import vtkmodules.vtkIOImage as ioivtk # type: ignore
import vtkmodules.vtkIOLegacy as iolvtk # type: ignore
import vtkmodules.vtkIOMINC as iomincvtk # type: ignore
import vtkmodules.vtkIOPLY as ioplyvtk # type: ignore
import vtkmodules.vtkIOXML as ioxmlvtk # type: ignore
+import vtkmodules.vtkImagingCore as icvtk # type: ignore
+import vtkmodules.vtkInteractionStyle as isvtk # type: ignore
import vtkmodules.vtkRenderingAnnotation as ravtk # type: ignore
import vtkmodules.vtkRenderingCore as rcvtk # type: ignore
import vtkmodules.vtkRenderingFreeType as rftvtk # type: ignore
import vtkmodules.vtkRenderingLOD as rlodvtk # type: ignore
import vtkmodules.vtkRenderingOpenGL2 as roglvtk # type: ignore
-from vtkmodules.util import colors, numpy_support # type: ignore # noqa: F401
-from vtkmodules.util.misc import calldata_type # type: ignore # noqa: F401
VTK_VERSION = ccvtk.vtkVersion.GetVTKVersion()
diff --git a/fury/molecular.py b/fury/molecular.py
index eb56c8574..692ff5193 100644
--- a/fury/molecular.py
+++ b/fury/molecular.py
@@ -13,9 +13,7 @@
VTK_UNSIGNED_SHORT,
Actor,
DataSetAttributes,
-)
-from fury.lib import Molecule as Mol
-from fury.lib import (
+ Molecule as Mol,
OpenGLMoleculeMapper,
PeriodicTable,
PolyData,
@@ -23,8 +21,8 @@
ProteinRibbonFilter,
SimpleBondPerceiver,
StringArray,
+ numpy_support as nps,
)
-from fury.lib import numpy_support as nps
from fury.utils import numpy_to_vtk_points
diff --git a/fury/shaders/base.py b/fury/shaders/base.py
index cb9b8b82b..8308f9efa 100644
--- a/fury/shaders/base.py
+++ b/fury/shaders/base.py
@@ -1,5 +1,5 @@
-import os
from functools import partial
+import os
from fury import enable_warnings
from fury.deprecator import deprecate_with_version
diff --git a/fury/shaders/lighting/principled/sheen.frag b/fury/shaders/lighting/principled/sheen.frag
index 31476d22a..b547f46be 100644
--- a/fury/shaders/lighting/principled/sheen.frag
+++ b/fury/shaders/lighting/principled/sheen.frag
@@ -3,4 +3,4 @@ vec3 evaluateSheen(float sheen, float sheenTint, vec3 tint,
{
vec3 tintMix = mix(vec3(1), tint, sheenTint);
return sheen * tintMix * schlickWeight;
-}
\ No newline at end of file
+}
diff --git a/fury/stream/client.py b/fury/stream/client.py
index 2d73e7a4e..613ca2dd2 100644
--- a/fury/stream/client.py
+++ b/fury/stream/client.py
@@ -1,12 +1,12 @@
+from functools import partial
import logging
import platform
import time
-from functools import partial
import numpy as np
import vtk
-from fury.stream.constants import _CQUEUE, PY_VERSION_8
+from fury.stream.constants import PY_VERSION_8, _CQUEUE
from fury.stream.tools import (
ArrayCircularQueue,
IntervalTimer,
diff --git a/fury/stream/constants.py b/fury/stream/constants.py
index 401c4989e..db659e554 100644
--- a/fury/stream/constants.py
+++ b/fury/stream/constants.py
@@ -1,5 +1,5 @@
-import sys
from collections import namedtuple
+import sys
PY_VERSION_8 = sys.version_info.minor >= 8
diff --git a/fury/stream/server/async_app.py b/fury/stream/server/async_app.py
index 90dae87fa..7a3d131b9 100644
--- a/fury/stream/server/async_app.py
+++ b/fury/stream/server/async_app.py
@@ -1,12 +1,12 @@
import asyncio
+from functools import partial
import json
import os
import weakref
-from functools import partial
import aiohttp
-import numpy as np
from aiohttp import MultipartWriter, WSCloseCode, web
+import numpy as np
try:
from aiortc import RTCPeerConnection, RTCSessionDescription
diff --git a/fury/stream/server/main.py b/fury/stream/server/main.py
index 40e485fc8..abdeb4569 100644
--- a/fury/stream/server/main.py
+++ b/fury/stream/server/main.py
@@ -1,10 +1,10 @@
# import os
# os.environ['PYTHONASYNCIODEBUG'] = '1'
# import logging
-import numpy as np
from aiohttp import web
+import numpy as np
-from fury.stream.constants import _CQUEUE, PY_VERSION_8
+from fury.stream.constants import PY_VERSION_8, _CQUEUE
from fury.stream.server.async_app import get_app
from fury.stream.tools import (
ArrayCircularQueue,
diff --git a/fury/stream/tools.py b/fury/stream/tools.py
index fe6d48c10..7abf2c325 100644
--- a/fury/stream/tools.py
+++ b/fury/stream/tools.py
@@ -1,13 +1,13 @@
+from abc import ABC, abstractmethod
import asyncio
import io
import logging
import multiprocessing
-import time
-from abc import ABC, abstractmethod
from threading import Timer
+import time
-import numpy as np
from PIL import Image, ImageDraw
+import numpy as np
from fury.stream.constants import PY_VERSION_8
diff --git a/fury/testing.py b/fury/testing.py
index 1c4fd939a..6edef0f43 100644
--- a/fury/testing.py
+++ b/fury/testing.py
@@ -1,17 +1,17 @@
"""Utilities for testing."""
+from contextlib import contextmanager
+from distutils.version import LooseVersion
+from functools import partial
import io
import json
import operator
import sys
import warnings
-from contextlib import contextmanager
-from distutils.version import LooseVersion
-from functools import partial
import numpy as np
-import scipy # type: ignore
from numpy.testing import assert_array_equal
+import scipy # type: ignore
@contextmanager
diff --git a/fury/tests/test_actors.py b/fury/tests/test_actors.py
index c09584301..691b96bd3 100644
--- a/fury/tests/test_actors.py
+++ b/fury/tests/test_actors.py
@@ -7,9 +7,7 @@
import pytest
from scipy.ndimage import center_of_mass
-from fury import actor
-from fury import primitive as fp
-from fury import shaders, window
+from fury import actor, primitive as fp, shaders, window
from fury.actor import grid
from fury.decorators import skip_linux, skip_osx, skip_win
from fury.deprecator import ExpiredDeprecationError
diff --git a/fury/tests/test_gltf.py b/fury/tests/test_gltf.py
index afd7a1a74..fd81dbecc 100644
--- a/fury/tests/test_gltf.py
+++ b/fury/tests/test_gltf.py
@@ -2,11 +2,11 @@
import os
import sys
+from PIL import Image
import numpy as np
import numpy.testing as npt
-import pytest
from packaging.version import parse
-from PIL import Image
+import pytest
from scipy.ndimage import center_of_mass
from scipy.version import short_version
diff --git a/fury/tests/test_interactor.py b/fury/tests/test_interactor.py
index 346dc4acb..5d6b95db3 100644
--- a/fury/tests/test_interactor.py
+++ b/fury/tests/test_interactor.py
@@ -5,9 +5,7 @@
import numpy.testing as npt
import pytest
-from fury import actor, interactor, ui
-from fury import utils as vtk_utils
-from fury import window
+from fury import actor, interactor, ui, utils as vtk_utils, window
from fury.data import DATA_DIR
from fury.decorators import skip_osx, skip_win
from fury.lib import VTK_VERSION, Actor2D, PolyDataMapper2D, RegularPolygonSource
diff --git a/fury/tests/test_io.py b/fury/tests/test_io.py
index 45dd8c018..99f2d8531 100644
--- a/fury/tests/test_io.py
+++ b/fury/tests/test_io.py
@@ -2,10 +2,10 @@
from os.path import join as pjoin
from tempfile import TemporaryDirectory as InTemporaryDirectory
+from PIL import Image
import numpy as np
import numpy.testing as npt
import pytest
-from PIL import Image
from fury.decorators import skip_osx
from fury.io import (
diff --git a/fury/tests/test_molecular.py b/fury/tests/test_molecular.py
index bc4a09510..bfe87c57c 100644
--- a/fury/tests/test_molecular.py
+++ b/fury/tests/test_molecular.py
@@ -1,8 +1,7 @@
import numpy as np
import numpy.testing as npt
-from fury import molecular as mol
-from fury import window
+from fury import molecular as mol, window
def test_periodic_table():
diff --git a/fury/tests/test_stream.py b/fury/tests/test_stream.py
index 0833c2d0f..9e9a6fe8a 100644
--- a/fury/tests/test_stream.py
+++ b/fury/tests/test_stream.py
@@ -1,7 +1,7 @@
import asyncio
+from importlib import reload
import sys
import time
-from importlib import reload
from unittest import mock
import numpy as np
diff --git a/fury/tests/test_testing.py b/fury/tests/test_testing.py
index 40293f96f..79c99b393 100644
--- a/fury/tests/test_testing.py
+++ b/fury/tests/test_testing.py
@@ -5,9 +5,9 @@
import numpy as np
import numpy.testing as npt
-import fury.testing as ft
from fury import window
from fury.lib import Actor2D
+import fury.testing as ft
from fury.ui.core import UI
diff --git a/fury/tests/test_thread.py b/fury/tests/test_thread.py
index 61e721681..1427ffb74 100644
--- a/fury/tests/test_thread.py
+++ b/fury/tests/test_thread.py
@@ -1,6 +1,6 @@
-import time
from threading import Thread
+import time
import numpy as np
import numpy.testing as npt
diff --git a/fury/tests/test_utils.py b/fury/tests/test_utils.py
index 821fa386c..07d5a2785 100644
--- a/fury/tests/test_utils.py
+++ b/fury/tests/test_utils.py
@@ -3,7 +3,6 @@
import numpy.testing as npt
import pytest
-import fury.primitive as fp
from fury import actor, utils, window
from fury.lib import (
VTK_DOUBLE,
@@ -21,6 +20,7 @@
numpy_support,
)
from fury.optpkg import optional_package
+import fury.primitive as fp
from fury.ui.containers import Panel2D
from fury.ui.core import UI
from fury.utils import (
diff --git a/fury/ui/containers.py b/fury/ui/containers.py
index f88a00634..e28399cd9 100644
--- a/fury/ui/containers.py
+++ b/fury/ui/containers.py
@@ -18,7 +18,7 @@
)
from fury.ui.core import UI, Rectangle2D, TextBlock2D
from fury.utils import rotate, set_input
-
+from warnings import warn
class Panel2D(UI):
"""A 2D UI Panel.
@@ -640,6 +640,7 @@ def __init__(
inactive_color=(0.5, 0.5, 0.5),
draggable=False,
startup_tab_id=None,
+ tab_bar_pos="top",
):
"""Init class instance.
@@ -661,7 +662,8 @@ def __init__(
startup_tab_id : int, optional
Tab to be activated and uncollapsed on startup.
by default None is activated/ all collapsed.
-
+ tab_bar_pos : str, optional
+ Position of the Tab Bar in the panel
"""
self.tabs = []
self.nb_tabs = nb_tabs
@@ -672,6 +674,7 @@ def __init__(
self.inactive_color = inactive_color
self.active_tab_idx = startup_tab_id
self.collapsed = True
+ self.tab_bar_pos = tab_bar_pos
super(TabUI, self).__init__()
self.position = position
@@ -737,8 +740,15 @@ def _get_size(self):
def update_tabs(self):
"""Update position, size and callbacks for tab panels."""
self.tab_panel_size = (self.size[0] // self.nb_tabs, int(0.1 * self.size[1]))
+ if self.tab_bar_pos.lower() not in ['top', 'bottom']:
+ warn("tab_bar_pos can only have value top/bottom")
+ self.tab_bar_pos = "top"
+
+ if self.tab_bar_pos.lower() == "top":
+ tab_panel_pos = [0.0, 0.9]
+ elif self.tab_bar_pos.lower() == "bottom":
+ tab_panel_pos = [0.0, 0.0]
- tab_panel_pos = [0.0, 0.9]
for tab_panel in self.tabs:
tab_panel.resize(self.tab_panel_size)
tab_panel.content_panel.position = self.position
@@ -776,7 +786,12 @@ def update_tabs(self):
tab_panel.content_panel.resize(self.content_size)
self.parent_panel.add_element(tab_panel, tab_panel_pos)
- self.parent_panel.add_element(tab_panel.content_panel, (0.0, 0.0))
+ if self.tab_bar_pos.lower() == "top":
+ self.parent_panel.add_element(tab_panel.content_panel,
+ (0.0, 0.0))
+ elif self.tab_bar_pos.lower() == "bottom":
+ self.parent_panel.add_element(tab_panel.content_panel,
+ (0.0, 0.1))
tab_panel_pos[0] += 1 / self.nb_tabs
def select_tab_callback(self, iren, _obj, _tab_comp):
diff --git a/fury/ui/elements.py b/fury/ui/elements.py
index 41b49de55..db67817f9 100644
--- a/fury/ui/elements.py
+++ b/fury/ui/elements.py
@@ -20,14 +20,14 @@
'SpinBox'
]
-import os
from collections import OrderedDict
from numbers import Number
+import os
from string import printable
from urllib.request import urlopen
-import numpy as np
from PIL import Image, UnidentifiedImageError
+import numpy as np
from fury.data import read_viz_icons
from fury.lib import Command
diff --git a/fury/ui/tests/test_containers.py b/fury/ui/tests/test_containers.py
index 0f18d9853..79edcd4a0 100644
--- a/fury/ui/tests/test_containers.py
+++ b/fury/ui/tests/test_containers.py
@@ -260,56 +260,57 @@ def test_ui_tab_ui(interactive=False):
tab_ui.tabs[0].title = 'Tab 1'
tab_ui.tabs[1].title = 'Tab 2'
tab_ui.tabs[2].title = 'Tab 3'
-
+
npt.assert_equal(tab_ui.tabs[0].title_bold, False)
npt.assert_equal(tab_ui.tabs[1].title_bold, False)
npt.assert_equal(tab_ui.tabs[2].title_bold, False)
-
+
tab_ui.tabs[0].title_bold = True
tab_ui.tabs[1].title_bold = False
tab_ui.tabs[2].title_bold = True
-
+
npt.assert_equal(tab_ui.tabs[0].title_bold, True)
npt.assert_equal(tab_ui.tabs[1].title_bold, False)
npt.assert_equal(tab_ui.tabs[2].title_bold, True)
-
+
npt.assert_equal(tab_ui.tabs[0].title_color, (.0, .0, .0))
npt.assert_equal(tab_ui.tabs[1].title_color, (.0, .0, .0))
npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, .0))
-
+
tab_ui.tabs[0].title_color = (1, 0, 0)
tab_ui.tabs[1].title_color = (0, 1, 0)
tab_ui.tabs[2].title_color = (0, 0, 1)
-
+
npt.assert_equal(tab_ui.tabs[0].title_color, (1., .0, .0))
npt.assert_equal(tab_ui.tabs[1].title_color, (.0, 1., .0))
npt.assert_equal(tab_ui.tabs[2].title_color, (.0, .0, 1.))
-
+
npt.assert_equal(tab_ui.tabs[0].title_font_size, 18)
npt.assert_equal(tab_ui.tabs[1].title_font_size, 18)
npt.assert_equal(tab_ui.tabs[2].title_font_size, 18)
-
+
tab_ui.tabs[0].title_font_size = 10
tab_ui.tabs[1].title_font_size = 20
tab_ui.tabs[2].title_font_size = 30
-
+
npt.assert_equal(tab_ui.tabs[0].title_font_size, 10)
npt.assert_equal(tab_ui.tabs[1].title_font_size, 20)
npt.assert_equal(tab_ui.tabs[2].title_font_size, 30)
-
+
npt.assert_equal(tab_ui.tabs[0].title_italic, False)
npt.assert_equal(tab_ui.tabs[1].title_italic, False)
npt.assert_equal(tab_ui.tabs[2].title_italic, False)
-
+
tab_ui.tabs[0].title_italic = False
tab_ui.tabs[1].title_italic = True
tab_ui.tabs[2].title_italic = False
-
+
npt.assert_equal(tab_ui.tabs[0].title_italic, False)
npt.assert_equal(tab_ui.tabs[1].title_italic, True)
npt.assert_equal(tab_ui.tabs[2].title_italic, False)
- tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']), (0.5, 0.5))
+ tab_ui.add_element(0, ui.Checkbox(['Option 1', 'Option 2']),
+ (0.5, 0.5))
tab_ui.add_element(1, ui.LineSlider2D(), (0.0, 0.5))
tab_ui.add_element(2, ui.TextBlock2D(), (0.5, 0.5))
@@ -345,7 +346,8 @@ def tab_change(tab_ui):
event_counter.monitor(tab_ui)
current_size = (800, 800)
- show_manager = window.ShowManager(size=current_size, title='Tab UI Test')
+ show_manager = window.ShowManager(size=current_size,
+ title='Tab UI Test')
show_manager.scene.add(tab_ui)
if interactive:
@@ -360,3 +362,111 @@ def tab_change(tab_ui):
npt.assert_equal(0, tab_ui.active_tab_idx)
npt.assert_equal(11, next(changes))
npt.assert_equal(5, next(collapses))
+
+
+def test_ui_tab_ui_position(interactive=False):
+ filename = 'test_ui_tab_ui_top_position'
+ recording_filename = pjoin(DATA_DIR, filename + '.log.gz')
+ expected_events_counts_filename = pjoin(DATA_DIR, filename + '.json')
+
+ tab_ui_top = ui.TabUI(
+ position=(50, 50), size=(300, 300), nb_tabs=3, draggable=True,
+ tab_bar_pos='top')
+
+ tab_ui_top.tabs[0].title = 'Tab 1'
+ tab_ui_top.tabs[1].title = 'Tab 2'
+ tab_ui_top.tabs[2].title = 'Tab 3'
+
+ tab_ui_top.add_element(0, ui.Checkbox(['Option 1', 'Option 2']),
+ (0.5, 0.5))
+ tab_ui_top.add_element(1, ui.LineSlider2D(), (0.0, 0.5))
+ tab_ui_top.add_element(2, ui.TextBlock2D(), (0.5, 0.5))
+
+ npt.assert_equal('Tab 1', tab_ui_top.tabs[0].title)
+ npt.assert_equal('Tab 2', tab_ui_top.tabs[1].title)
+ npt.assert_equal('Tab 3', tab_ui_top.tabs[2].title)
+
+ npt.assert_equal(3, tab_ui_top.nb_tabs)
+
+ npt.assert_equal((50, 50), tab_ui_top.position)
+ npt.assert_equal((300, 300), tab_ui_top.size)
+
+ with npt.assert_raises(IndexError):
+ tab_ui_top.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5))
+
+ with npt.assert_raises(IndexError):
+ tab_ui_top.remove_element(3, ui.TextBlock2D())
+
+ with npt.assert_raises(IndexError):
+ tab_ui_top.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5))
+
+ tab_ui_bottom = ui.TabUI(
+ position=(350, 50), size=(300, 300), nb_tabs=3, draggable=True,
+ tab_bar_pos='bottom')
+
+ tab_ui_bottom.tabs[0].title = 'Tab 1'
+ tab_ui_bottom.tabs[1].title = 'Tab 2'
+ tab_ui_bottom.tabs[2].title = 'Tab 3'
+
+ tab_ui_bottom.add_element(0, ui.Checkbox(['Option 1', 'Option 2']),
+ (0.5, 0.5))
+ tab_ui_bottom.add_element(1, ui.LineSlider2D(), (0.0, 0.5))
+ tab_ui_bottom.add_element(2, ui.TextBlock2D(), (0.5, 0.5))
+
+ npt.assert_equal('Tab 1', tab_ui_bottom.tabs[0].title)
+ npt.assert_equal('Tab 2', tab_ui_bottom.tabs[1].title)
+ npt.assert_equal('Tab 3', tab_ui_bottom.tabs[2].title)
+
+ npt.assert_equal(3, tab_ui_bottom.nb_tabs)
+
+ npt.assert_equal((350, 50), tab_ui_bottom.position)
+ npt.assert_equal((300, 300), tab_ui_bottom.size)
+
+ with npt.assert_raises(IndexError):
+ tab_ui_bottom.add_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5))
+
+ with npt.assert_raises(IndexError):
+ tab_ui_bottom.remove_element(3, ui.TextBlock2D())
+
+ with npt.assert_raises(IndexError):
+ tab_ui_bottom.update_element(3, ui.TextBlock2D(), (0.5, 0.5, 0.5))
+
+ collapses = itertools.count()
+ changes = itertools.count()
+
+ def collapse(tab_ui_top):
+ if tab_ui_top.collapsed or tab_ui_bottom.collapsed:
+ next(collapses)
+
+ def tab_change(tab_ui_top):
+ next(changes)
+
+ tab_ui_top.on_change = tab_change
+ tab_ui_top.on_collapse = collapse
+
+ tab_ui_bottom.on_change = tab_change
+ tab_ui_bottom.on_collapse = collapse
+
+ event_counter = EventCounter()
+ event_counter.monitor(tab_ui_top)
+ event_counter.monitor(tab_ui_bottom)
+
+ current_size = (800, 800)
+ show_manager = window.ShowManager(size=current_size,
+ title='Tab UI Test')
+ show_manager.scene.add(tab_ui_top)
+ show_manager.scene.add(tab_ui_bottom)
+
+ if interactive:
+ show_manager.record_events_to_file(recording_filename)
+ print(list(event_counter.events_counts.items()))
+ event_counter.save(expected_events_counts_filename)
+ else:
+ show_manager.play_events_from_file(recording_filename)
+ expected = EventCounter.load(expected_events_counts_filename)
+ event_counter.check_counts(expected)
+
+ npt.assert_equal(0, tab_ui_top.active_tab_idx)
+ npt.assert_equal(0, tab_ui_bottom.active_tab_idx)
+ npt.assert_equal(14, next(changes))
+ npt.assert_equal(5, next(collapses))
diff --git a/fury/ui/tests/test_core.py b/fury/ui/tests/test_core.py
index c056aba4b..3ee849216 100644
--- a/fury/ui/tests/test_core.py
+++ b/fury/ui/tests/test_core.py
@@ -1,6 +1,6 @@
"""Core module testing."""
-import warnings
from os.path import join as pjoin
+import warnings
import numpy as np
import numpy.testing as npt
diff --git a/fury/ui/tests/test_elements.py b/fury/ui/tests/test_elements.py
index fb6d3ebef..bd867fb29 100644
--- a/fury/ui/tests/test_elements.py
+++ b/fury/ui/tests/test_elements.py
@@ -1,8 +1,8 @@
"""Test for components module."""
import itertools
import os
-import shutil
from os.path import join as pjoin
+import shutil
from tempfile import TemporaryDirectory as InTemporaryDirectory
import numpy as np
diff --git a/fury/ui/tests/test_elements_callback.py b/fury/ui/tests/test_elements_callback.py
index 669c76a88..3a5503ff0 100644
--- a/fury/ui/tests/test_elements_callback.py
+++ b/fury/ui/tests/test_elements_callback.py
@@ -1,8 +1,8 @@
"""Test for components module."""
import itertools
import os
-import shutil
from os.path import join as pjoin
+import shutil
from tempfile import TemporaryDirectory as InTemporaryDirectory
import numpy as np
diff --git a/fury/window.py b/fury/window.py
index f86b22393..09267bddd 100644
--- a/fury/window.py
+++ b/fury/window.py
@@ -1,15 +1,15 @@
# -*- coding: utf-8 -*-
import gzip
-import time
from tempfile import TemporaryDirectory as InTemporaryDirectory
from threading import Lock
+import time
from warnings import warn
import numpy as np
from scipy import ndimage
-import fury.animation as anim
from fury import __version__ as fury_version
+import fury.animation as anim
from fury.interactor import CustomInteractorStyle
from fury.io import load_image, save_image
from fury.lib import (
diff --git a/pyproject.toml b/pyproject.toml
index b674d4aff..9395a0b50 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -74,7 +74,7 @@ doc = [
"texext",
"tomli; python_version < \"3.11\"",
]
-style = ["flake8", "blue", "isort", "pre-commit"]
+style = ["flake8", "blue", "ruff", "pre-commit"]
typing = ["mypy", "types-Pillow", "data-science-types"]
test = [
"coverage",
@@ -107,10 +107,9 @@ force-exclude = """
)
"""
-[tool.isort]
-profile = "black"
-line_length = 88
-extend_skip = ["_version.py", "externals", "*docs/experimental*"]
+[flake8]
+max-line-length = 88
+extend-exclude = ["_version.py", "externals", "*docs/experimental*"]
[tool.mypy]
python_version = "3.11"
diff --git a/requirements/README.md b/requirements/README.md
index a1f1052e3..fd6b436db 100644
--- a/requirements/README.md
+++ b/requirements/README.md
@@ -12,8 +12,8 @@
### Installing requirements
```bash
-$ pip install -U -r requirements/default.txt
-$ pip install -U -r requirements/optional.txt
+pip install -U -r requirements/default.txt
+pip install -U -r requirements/optional.txt
```
or
@@ -25,8 +25,8 @@ conda install --yes --file=requirements/default.txt --file=requirements/optional
### Running the tests
```bash
-$ pip install -U -r requirements/default.txt
-$ pip install -U -r requirements/test.txt
+pip install -U -r requirements/default.txt
+pip install -U -r requirements/test.txt
```
or
@@ -38,7 +38,7 @@ conda install --yes --file=requirements/default.txt --file=requirements/test.txt
### Running the Docs
```bash
-$ pip install -U -r requirements/default.txt
-$ pip install -U -r requirements/optional.txt
-$ pip install -U -r requirements/docs.txt
+pip install -U -r requirements/default.txt
+pip install -U -r requirements/optional.txt
+pip install -U -r requirements/docs.txt
```
diff --git a/ruff.toml b/ruff.toml
new file mode 100644
index 000000000..673eca617
--- /dev/null
+++ b/ruff.toml
@@ -0,0 +1,14 @@
+target-version = "py310"
+
+lint.select = [
+ "I", # isort
+]
+
+[lint.isort]
+case-sensitive = true
+combine-as-imports = true
+force-sort-within-sections = true
+no-sections = false
+order-by-type = true
+relative-imports-order = "closest-to-furthest"
+section-order = ["future", "standard-library", "third-party", "first-party", "local-folder"]