Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Post-processing effects for FURY Effects API #850

Draft
wants to merge 34 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
35bbb98
Post processing functions file
JoaoDell Jul 19, 2023
ef06af3
docs?
JoaoDell Jul 19, 2023
110ad6b
feat: Introduces EffectManager Class
JoaoDell Jul 20, 2023
a09e262
feat: Opacity inclusion
JoaoDell Jul 20, 2023
bec5f0e
fix: Fixed sigma scale and spelling issues
JoaoDell Jul 21, 2023
b572b4b
fix: Usage of native colormap function and cleanups
JoaoDell Jul 21, 2023
269c4de
feat: Added remove_effect feature
JoaoDell Jul 21, 2023
fae89e1
feat: Added gaussian and laplacian filters
JoaoDell Jul 22, 2023
39f43b4
feat: Added grayscale effect and changed laplacian and gaussian calcu…
JoaoDell Jul 24, 2023
13687be
fix: Fixed gaussian blur issues
JoaoDell Jul 24, 2023
6be3ddc
fix!: Experimenting with multiple effects on the same render and some…
JoaoDell Jul 25, 2023
6dedaec
fix: Fixed textured_billboard positioning issues
JoaoDell Jul 25, 2023
bf1503c
fix: Fixed bugs and cleaned EffectManager class
JoaoDell Jul 27, 2023
fb024d8
refactor!: Refactored and cleaned the whole PR
JoaoDell Jul 27, 2023
edd06e8
Merge branch 'fury-gl:master' into feat/api-kde
JoaoDell Jul 27, 2023
7ecefeb
feat: Added 5 more kernels for the KDE rendering
JoaoDell Jul 27, 2023
68e520e
fix: Added sigma restraining condition
JoaoDell Jul 27, 2023
f0a3d6d
feat: Testing renormalization approaches to KDE
JoaoDell Jul 29, 2023
f35626e
fix!: Stabilizing approaches to renormalization
JoaoDell Jul 30, 2023
9ad1501
fix: Minor refactoring on effect manager
JoaoDell Jul 31, 2023
0ffaf28
feat!: Experimenting with intensity slider (unstable)
JoaoDell Aug 1, 2023
03299b1
Merge branch 'fury-gl:master' into feat/api-kde
JoaoDell Aug 1, 2023
bd335f1
fix: Camera position update
JoaoDell Aug 1, 2023
a173dfd
feat: Updating UI
JoaoDell Aug 2, 2023
25921c3
refactor: Added tracking of original actors of applied effects
JoaoDell Aug 3, 2023
2d72b48
fix: Trying to fix the noise
JoaoDell Aug 6, 2023
90069bf
build: Changed viz_laplacian.py effect manager lib
JoaoDell Aug 7, 2023
18bda11
feat: Hardcoded fullscreen billboard
JoaoDell Aug 10, 2023
6ff0f0b
feat: testing billboard properties
JoaoDell Aug 11, 2023
ca2e1e3
refactor: Toying around with zbuffer
JoaoDell Aug 13, 2023
82fbbb2
feat: Trying median filter
JoaoDell Aug 19, 2023
071b3b5
Merge branch 'fury-gl:master' into feat/api-kde-improve
JoaoDell Aug 27, 2023
a1f9eed
refactor: Refactoring branch for PR
JoaoDell Aug 27, 2023
e738df7
fix: Deleted useless program
JoaoDell Aug 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/experimental/viz_laplacian.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import numpy as np

from fury.actor import cube, sphere
from fury.actors.effect_manager_alt import EffectManager
from fury.window import (Scene, ShowManager, record)

def normalize(array : np.array, min : float = 0.0, max : float = 1.0, axis : int = 0):
"""Convert an array to a given desired range.

Parameters
----------
array : np.ndarray
Array to be normalized.
min : float
Bottom value of the interval of normalization. If no value is given, it is passed as 0.0.
max : float
Upper value of the interval of normalization. If no value is given, it is passed as 1.0.

Returns
-------
array : np.array
Array converted to the given desired range.
"""
if np.max(array) != np.min(array):
return ((array - np.min(array))/(np.max(array) - np.min(array)))*(max - min) + min
else:
raise ValueError(
"Can't normalize an array which maximum and minimum value are the same.")


width, height = (800, 800)

scene = Scene()
scene.set_camera(position=(0, 0, -10),
focal_point=(0.0,
0.0,
0.0),
view_up=(0.0, 0.0, 0.0))

manager = ShowManager(
scene,
"demo",
(width,
height))

manager.initialize()

offset = 1.0
cube_actor = cube(np.array([[0.0, 0.0, -1.0 + offset]]), colors = (1.0, 0.5, 0.0))
sphere_actor = sphere(np.array([[0.0, 0.0, 1.0 + offset], [1.0, 0.5, 1.0 + offset]]), (0.0, 1.0, 1.0), radii = 0.5)

effects = EffectManager(manager)
gauss_cube = effects.gaussian_blur(cube_actor, 1.0)
gray_sphere = effects.grayscale(sphere_actor, 1.0)

manager.scene.add(gray_sphere)
manager.scene.add(gauss_cube)

# effects.remove_effect(gauss_cube)

interactive = True

if interactive:
manager.start()

record(scene, out_path = "post_process.png", size = (800, 800))
Loading