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

added nadkarni_mri_mouselemur #411

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,317 @@
import time
from pathlib import Path

Check warning on line 2 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L1-L2

Added lines #L1 - L2 were not covered by tests

import mp
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC

  • we want to remove this way of parallelising mesh creation because it has caused us some problems?
  • if we did want to keep it, this should be import multiprocessing as mp?

import numpy as np
import pandas as pd
import pooch
from brainglobe_utils.IO.image import load_any
from rich.progress import track

Check warning on line 9 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L4-L9

Added lines #L4 - L9 were not covered by tests

from brainglobe_atlasapi.atlas_generation.mesh_utils import (

Check warning on line 11 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L11

Added line #L11 was not covered by tests
Region,
create_region_mesh,
)
from brainglobe_atlasapi.atlas_generation.wrapup import wrapup_atlas_from_data
from brainglobe_atlasapi.structure_tree_util import get_structures_tree

Check warning on line 16 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L15-L16

Added lines #L15 - L16 were not covered by tests

# Copy-paste this script into a new file and fill in the functions to package
# your own atlas.

### Metadata ###

# The minor version of the atlas in the brainglobe_atlasapi, this is internal,
# if this is the first time this atlas has been added the value should be 0
# (minor version is the first number after the decimal point, ie the minor
# version of 1.2 is 2)
__version__ = 0
PARALLEL = False

Check warning on line 28 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L27-L28

Added lines #L27 - L28 were not covered by tests
# The expected format is FirstAuthor_SpeciesCommonName, e.g. kleven_rat, or
# Institution_SpeciesCommonName, e.g. allen_mouse.
ATLAS_NAME = "nadkarni_mri_mouselemur"

Check warning on line 31 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L31

Added line #L31 was not covered by tests

# DOI of the most relevant citable document
CITATION = "https://doi.org/10.1016/j.dib.2018.10.067"

Check warning on line 34 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L34

Added line #L34 was not covered by tests

# The scientific name of the species, ie; Rattus norvegicus
SPECIES = "Microcebus murinus"

Check warning on line 37 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L37

Added line #L37 was not covered by tests

# The URL for the data files
ATLAS_LINK = (

Check warning on line 40 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L40

Added line #L40 was not covered by tests
"https://www.nitrc.org/frs/download.php/10867/MIRCen-Mouse"
"LemurAtlas_V0.01.tar.gz"
)

# The orientation of the **original** atlas data, in BrainGlobe convention:
ORIENTATION = "ria"

Check warning on line 46 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L46

Added line #L46 was not covered by tests

# The id of the highest level of the atlas. This is commonly called root or
# brain. Include some information on what to do if your atlas is not
# hierarchical
Comment on lines +48 to +50
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest that in general we remove copy-pasted comments and docstrings from the template script (or update them to make them more concrete and specific to this atlas), to aid legibility?

ROOT_ID = 9999

Check warning on line 51 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L51

Added line #L51 was not covered by tests
# The resolution of your volume in microns. Details on how to format this
# parameter for non isotropic datasets or datasets with multiple resolutions.
RESOLUTION = 91
BG_ROOT_DIR = Path.home() / "brainglobe_workingdir" / ATLAS_NAME
DOWNLOAD_DIR_PATH = BG_ROOT_DIR / "downloads"

Check warning on line 56 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L54-L56

Added lines #L54 - L56 were not covered by tests


def download_resources():

Check warning on line 59 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L59

Added line #L59 was not covered by tests
"""
Download the necessary resources for the atlas.

If possible, please use the Pooch library to retrieve any resources.
"""
# Define the path to the doggie bag
DOWNLOAD_DIR_PATH.mkdir(exist_ok=True)
known_hash = (

Check warning on line 67 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L66-L67

Added lines #L66 - L67 were not covered by tests
"327dd8efc73cc2c2ca34bc8b86a4afd88f083be283431e1fb3f063d901da9de3"
)
# Create a new doggie bag
pooch.retrieve(

Check warning on line 71 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L71

Added line #L71 was not covered by tests
ATLAS_LINK,
known_hash=known_hash,
path=DOWNLOAD_DIR_PATH,
processor=pooch.Untar(),
)


def retrieve_reference_and_annotation():

Check warning on line 79 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L79

Added line #L79 was not covered by tests
"""
Retrieve the desired reference and annotation as two numpy arrays.

Returns:
tuple: A tuple containing two numpy arrays. The first array is the
reference volume, and the second array is the annotation volume.
"""
reference = load_any(

Check warning on line 87 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L87

Added line #L87 was not covered by tests
DOWNLOAD_DIR_PATH
/ (
"af60cf392f8cd8b22925dddedada8e58-MIRCen-MouseLemurAtlas_V0.01.tar."
"gz.untar"
)
/ "MIRCen-MouseLemurAtlas_V0.01"
/ "MouseLemurHeadTemplate_91mu_V0.01.nii.gz"
)
annotation = load_any(

Check warning on line 96 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L96

Added line #L96 was not covered by tests
DOWNLOAD_DIR_PATH
/ (
"af60cf392f8cd8b22925dddedada8e58-MIRCen-MouseLemurAtlas_V0.01.tar."
"gz.untar"
)
/ "MIRCen-MouseLemurAtlas_V0.01"
/ "MouseLemurLabels_V0.01.nii.gz"
)
return reference, annotation

Check warning on line 105 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L105

Added line #L105 was not covered by tests


def retrieve_hemisphere_map():

Check warning on line 108 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L108

Added line #L108 was not covered by tests
"""
Retrieve a hemisphere map for the atlas.

If your atlas is asymmetrical, you may want to use a hemisphere map.
This is an array in the same shape as your template,
with 0's marking the left hemisphere, and 1's marking the right.

If your atlas is symmetrical, ignore this function.

Returns:
numpy.array or None: A numpy array representing the hemisphere map,
or None if the atlas is symmetrical.
"""
return None # Symmetrical

Check warning on line 122 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L122

Added line #L122 was not covered by tests


def retrieve_structure_information():

Check warning on line 125 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L125

Added line #L125 was not covered by tests
"""
This function should return a pandas DataFrame with information about your
atlas.

The DataFrame should be in the following format:

╭────┬───────────────────┬─────────┬───────────────────┬─────────────────╮
| id | name | acronym | structure_id_path | rgb_triplet |
| | | | | |
├────┼───────────────────┼─────────┼───────────────────┼─────────────────┤
| 997| root | root | [997] | [255, 255, 255] |
├────┼───────────────────┼─────────┼───────────────────┼─────────────────┤
| 8 | Basic cell groups | grey | [997, 8] | [191, 218, 227] |
├────┼───────────────────┼─────────┼───────────────────┼─────────────────┤
| 567| Cerebrum | CH | [997, 8, 567] | [176, 240, 255] |
╰────┴───────────────────┴─────────┴───────────────────┴─────────────────╯

Returns:
pandas.DataFrame: A DataFrame containing the atlas information.
"""
col_names = ["IDX", "R", "G", "B", "A", "VIS", "MSH", "LABEL"]
df = pd.read_csv(

Check warning on line 147 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L146-L147

Added lines #L146 - L147 were not covered by tests
DOWNLOAD_DIR_PATH
/ (
"af60cf392f8cd8b22925dddedada8e58-MIRCen-MouseLemurAtlas_V0.01.tar"
".gz.untar"
)
/ "MIRCen-MouseLemurAtlas_V0.01"
/ "MouseLemurLabelNames.txt",
comment="#",
delim_whitespace=True,
names=col_names,
header=None,
)
new_df = pd.DataFrame()
new_df["id"] = df["IDX"]
new_df["name"] = df["LABEL"]
new_df["acronym"] = df["LABEL"]
new_df["rgb_triplet"] = df[["R", "G", "B"]].values.tolist()
new_df["structure_id_path"] = new_df["id"].apply(lambda x: [ROOT_ID, x])
new_df["rgb_triplet"] = df[["R", "G", "B"]].values.tolist()
root = pd.DataFrame(

Check warning on line 167 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L160-L167

Added lines #L160 - L167 were not covered by tests
{
"id": [ROOT_ID],
"name": ["root"],
"acronym": ["root"],
"structure_id_path": [[ROOT_ID]],
"rgb_triplet": [[255, 255, 255]],
}
)
new_df = pd.concat([root, new_df]).reset_index(drop=True)
new_df = new_df[new_df["name"] != "Clear Label"].reset_index(drop=True)
return new_df.to_dict("records")

Check warning on line 178 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L176-L178

Added lines #L176 - L178 were not covered by tests
Comment on lines +160 to +178
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely!
Tangential comment: Do I understand correctly that this function processes a ITKsnap output segmentation?
If so (in a separate issue) we should make this a helper function (because ITK snap is our default for creating new annotations).



def retrieve_or_construct_meshes():

Check warning on line 181 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L181

Added line #L181 was not covered by tests
"""
This function should return a dictionary of ids and corresponding paths to
mesh files. Some atlases are packaged with mesh files, in these cases we
should use these files. Then this function should download those meshes.
In other cases we need to construct the meshes ourselves. For this we have
helper functions to achieve this.
"""
print("constructing meshes")

Check warning on line 189 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L189

Added line #L189 was not covered by tests

download_dir_path = BG_ROOT_DIR / "downloads"
meshes_dir_path = download_dir_path / "meshes"
meshes_dir_path.mkdir(exist_ok=True)

Check warning on line 193 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L191-L193

Added lines #L191 - L193 were not covered by tests

tree = get_structures_tree(structures)

Check warning on line 195 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L195

Added line #L195 was not covered by tests
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest we pass structures as an argument to this function (because otherwise we rely on structures existing in the global namespace, which is brittle?)


labels = np.unique(annotated_volume).astype(np.int32)
for key, node in tree.nodes.items():
if key in labels:
is_label = True

Check warning on line 200 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L197-L200

Added lines #L197 - L200 were not covered by tests
else:
is_label = False

Check warning on line 202 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L202

Added line #L202 was not covered by tests

node.data = Region(is_label)

Check warning on line 204 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L204

Added line #L204 was not covered by tests

# Mesh creation
closing_n_iters = 2 # not used for this atlas
decimate_fraction = 0.2 # not used for this atlas

Check warning on line 208 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L207-L208

Added lines #L207 - L208 were not covered by tests

smooth = False
start = time.time()
if PARALLEL:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned before, I suggest we remove the parallel if clause here.

pool = mp.Pool(mp.cpu_count() - 2)

Check warning on line 213 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L210-L213

Added lines #L210 - L213 were not covered by tests

try:
pool.map(

Check warning on line 216 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L215-L216

Added lines #L215 - L216 were not covered by tests
create_region_mesh,
[
(
meshes_dir_path,
node,
tree,
labels,
annotated_volume,
ROOT_ID,
closing_n_iters,
decimate_fraction,
smooth,
)
for node in tree.nodes.values()
],
)
except mp.pool.MaybeEncodingError:

Check warning on line 233 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L233

Added line #L233 was not covered by tests
# error with returning results from pool.map but we don't care
pass

Check warning on line 235 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L235

Added line #L235 was not covered by tests
else:
for node in track(

Check warning on line 237 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L237

Added line #L237 was not covered by tests
tree.nodes.values(),
total=tree.size(),
description="Creating meshes",
):
create_region_mesh(

Check warning on line 242 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L242

Added line #L242 was not covered by tests
(
meshes_dir_path,
node,
tree,
labels,
annotated_volume,
ROOT_ID,
closing_n_iters,
decimate_fraction,
smooth,
)
)

print(

Check warning on line 256 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L256

Added line #L256 was not covered by tests
"Finished mesh extraction in: ",
round((time.time() - start) / 60, 2),
" minutes",
)

# Create meshes dict
meshes_dict = dict()
structures_with_mesh = []
for s in structures:

Check warning on line 265 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L263-L265

Added lines #L263 - L265 were not covered by tests
# Check if a mesh was created
mesh_path = meshes_dir_path / f'{s["id"]}.obj'
if not mesh_path.exists():
print(f"No mesh file exists for: {s}, ignoring it")
continue

Check warning on line 270 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L267-L270

Added lines #L267 - L270 were not covered by tests
else:
# Check that the mesh actually exists (i.e. not empty)
if mesh_path.stat().st_size < 512:
print(f"obj file for {s} is too small, ignoring it.")
continue

Check warning on line 275 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L273-L275

Added lines #L273 - L275 were not covered by tests

structures_with_mesh.append(s)
meshes_dict[s["id"]] = mesh_path

Check warning on line 278 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L277-L278

Added lines #L277 - L278 were not covered by tests

print(

Check warning on line 280 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L280

Added line #L280 was not covered by tests
f"In the end, {len(structures_with_mesh)} "
"structures with mesh are kept"
)

return meshes_dict

Check warning on line 285 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L285

Added line #L285 was not covered by tests


### If the code above this line has been filled correctly, nothing needs to be
### edited below (unless variables need to be passed between the functions).
if __name__ == "__main__":
bg_root_dir = Path.home() / "brainglobe_workingdir" / ATLAS_NAME
bg_root_dir.mkdir(exist_ok=True)
download_resources()
reference_volume, annotated_volume = retrieve_reference_and_annotation()
hemispheres_stack = retrieve_hemisphere_map()
structures = retrieve_structure_information()
meshes_dict = retrieve_or_construct_meshes()

Check warning on line 297 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L290-L297

Added lines #L290 - L297 were not covered by tests

output_filename = wrapup_atlas_from_data(

Check warning on line 299 in brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/nadkarni_mri_mouselemur.py#L299

Added line #L299 was not covered by tests
atlas_name=ATLAS_NAME,
atlas_minor_version=__version__,
citation=CITATION,
atlas_link=ATLAS_LINK,
species=SPECIES,
resolution=(RESOLUTION,) * 3,
orientation=ORIENTATION,
root_id=ROOT_ID,
reference_stack=reference_volume,
annotation_stack=annotated_volume,
structures_list=structures,
meshes_dict=meshes_dict,
working_dir=bg_root_dir,
hemispheres_stack=None,
cleanup_files=False,
compress=True,
scale_meshes=True,
)
Loading