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

Update from imio to brainglobe_utils.IO.image #346

Merged
merged 3 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 3 additions & 16 deletions examples/user_volumetric_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,19 @@

"""

try:
import imio
except ImportError:
raise ImportError(
'You need imio to run this example: "pip install imio".\nFor more details: https://github.com/brainglobe/imio'
)

from pathlib import Path
import pooch

from brainglobe_space import AnatomicalSpace
from brainglobe_utils.IO.image.load import load_any
from myterial import blue_grey, orange
from rich import print
from vedo import Volume as VedoVolume

from brainrender import Scene
from brainrender.actors import Volume

print(f"[{orange}]Running example: {Path(__file__).name}")

# specify where the data are saved

retrieved_paths = pooch.retrieve(
url="https://api.mapzebrain.org/media/Lines/brn3cGFP/average_data/T_AVG_s356tTg.zip",
Expand All @@ -51,17 +43,12 @@
),
)

datafile = Path(retrieved_paths[1]) # [0] is zip file

if not datafile.exists():
raise ValueError(
"Before running this example you need to download the data for gene expression of the line brn3c:GFP from https://fishatlas.neuro.mpg.de/lines/"
)
datafile = Path(retrieved_paths[0]) # [0] is zip file


# 1. load the data
print("Loading data")
data = imio.load.load_any(datafile)
data = load_any(datafile)

# 2. aligned the data to the scene's atlas' axes
print("Transforming data")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dynamic = ["version"]
dependencies = [
"brainglobe-atlasapi>=2.0.1",
"brainglobe-space>=1.0.0",
"brainglobe-utils>=0.5.0",
"h5py",
"imio",
"k3d",
Expand Down
6 changes: 3 additions & 3 deletions tests/test_integration.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from importlib.resources import files
from pathlib import Path

import imio
import numpy as np
import pooch
import pytest
from brainglobe_space import AnatomicalSpace
from brainglobe_utils.IO.image.load import load_any
from vedo import Volume as VedoVolume

from brainrender import Animation, Scene, VideoMaker
Expand Down Expand Up @@ -318,8 +318,8 @@ def test_user_volumetric_data():
),
)

datafile = Path(retrieved_paths[1]) # [0] is zip file
data = imio.load.load_any(datafile)
datafile = Path(retrieved_paths[0])
data = load_any(datafile)
source_space = AnatomicalSpace("ira")
target_space = scene.atlas.space
transformed_data = source_space.map_stack_to(target_space, data)
Expand Down
Loading