Skip to content

Commit

Permalink
Merge pull request #346 from brainglobe/brainglobe-utils
Browse files Browse the repository at this point in the history
Update from imio to brainglobe_utils.IO.image
  • Loading branch information
alessandrofelder authored May 15, 2024
2 parents fe39118 + c3acbc4 commit 04d579a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 19 deletions.
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 @@ -52,17 +44,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 @@ -319,8 +319,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

0 comments on commit 04d579a

Please sign in to comment.