Skip to content

Commit

Permalink
remove regions without mesh
Browse files Browse the repository at this point in the history
  • Loading branch information
adamltyson committed Oct 29, 2024
1 parent c308a90 commit 6c423b8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ def create_atlas(working_dir):
meshes_dir_path = atlas_path / "meshes"
meshes_dir_path.mkdir(exist_ok=True)

Check warning on line 94 in brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L91-L94

Added lines #L91 - L94 were not covered by tests

nmh = pd.read_csv(atlas_path / "neural_nomenclature_hierarchy.csv").values
nomenclature_hierarchy = pd.read_csv(

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

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L96

Added line #L96 was not covered by tests
atlas_path / "neural_nomenclature_hierarchy.csv"
).values
reference_id = pd.read_csv(atlas_path / "PrV_Atlas_Ontology.csv")

Check warning on line 99 in brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L99

Added line #L99 was not covered by tests

acronyms = reference_id["acronym"].values
Expand All @@ -114,7 +116,7 @@ def create_atlas(working_dir):
}
]

for row in nmh:
for row in nomenclature_hierarchy:
structure_hierarchy = []
unique_pairs = []
pairs = [(row[i], row[i + 1]) for i in range(0, len(row), 2)]
Expand Down Expand Up @@ -202,7 +204,8 @@ def create_atlas(working_dir):
" minutes",
)

# Create meshes dict
# Create meshes dict & hierarchy to match
hierarchy_with_mesh = []
meshes_dict = dict()
structs_with_mesh = []
for s in hierarchy:

Check warning on line 211 in brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L208-L211

Added lines #L208 - L211 were not covered by tests
Expand All @@ -220,11 +223,13 @@ def create_atlas(working_dir):
structs_with_mesh.append(s)
meshes_dict[s["id"]] = mesh_path

Check warning on line 224 in brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L223-L224

Added lines #L223 - L224 were not covered by tests

hierarchy_with_mesh.append(s)

Check warning on line 226 in brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L226

Added line #L226 was not covered by tests

print(

Check warning on line 228 in brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L228

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

for item in hierarchy:
for item in hierarchy_with_mesh:
item["id"] = int(item["id"])
item["structure_id_path"] = [int(i) for i in item["structure_id_path"]]

Check warning on line 234 in brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_atlasapi/atlas_generation/atlas_scripts/praire_vole.py#L232-L234

Added lines #L232 - L234 were not covered by tests

Expand All @@ -238,7 +243,7 @@ def create_atlas(working_dir):
root_id=ROOT_ID,
reference_stack=reference_volume,
annotation_stack=annotated_volume,
structures_list=hierarchy,
structures_list=hierarchy_with_mesh,
working_dir=working_dir,
hemispheres_stack=None,
cleanup_files=False,
Expand Down

0 comments on commit 6c423b8

Please sign in to comment.