Skip to content
This repository has been archived by the owner on Mar 17, 2024. It is now read-only.

feat: add cal_min/cal_max/colorbar_visible reactive props #6

Merged
merged 2 commits into from
Feb 21, 2024

Conversation

manzt
Copy link
Collaborator

@manzt manzt commented Feb 21, 2024

from ipyniivue_experimental import AnyNiivue, SliceType
# based on https://niivue.github.io/niivue/features/additive.voxels.html

volumes = [
    {   "path": "../images/mni152.nii.gz" },
    {
        "path": "../images/narps-4965_9U7M-hypo1_unthresh.nii.gz",
        "colormap": "red",
        "cal_min": 2,
        "cal_max": 4,
    },
    {
        "path": "../images/narps-4735_50GV-hypo1_unthresh.nii.gz",
        "colormap": "green",
        "cal_min": 2,
        "cal_max": 4,
    },
]
nv = AnyNiivue(
    back_color=(1, 1, 1, 1),
    show_3D_crosshair=True,
    is_colorbar=True,
)
nv.load_volumes(volumes)
nv
import ipywidgets

nv.volumes[0].colorbar_visible = False
sred = ipywidgets.FloatSlider(min=0.1, max=0.4, step=0.01, value=0.2)
ipywidgets.link((sred, "value"), (nv.volumes[1], "cal_min"))
sgreen = ipywidgets.FloatSlider(min=0.1, max=0.4, step=0.01, value=0.2)
ipywidgets.link((sgreen, "value"), (nv.volumes[2], "cal_min"))
ipywidgets.HBox([sred, sgreen])

@manzt
Copy link
Collaborator Author

manzt commented Feb 21, 2024

Screen Recording 2024-02-21 at 1 18 28 PM

@kolibril13
Copy link
Collaborator

image works on my side as well, great work!

js/widget.js Outdated Show resolved Hide resolved
@manzt manzt mentioned this pull request Mar 15, 2024
5 tasks
@manzt manzt merged commit 0f0bc7b into main Feb 21, 2024
@manzt manzt deleted the manzt/volume-props branch February 21, 2024 18:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants