Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 8a6e43b

Browse files
authored
Feat: Add Olfactory bulb (#19)
1 parent 317a1f2 commit 8a6e43b

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"region": {
3+
"name": "olfactory_bulb",
4+
"query": "MOB",
5+
"attribute": "acronym",
6+
"with_descendants": true
7+
8+
},
9+
"layers": {
10+
"names": ["MOBgl", "MOBopl", "MOBmi", "MOBipl", "MOBgr"],
11+
"queries": ["MOBgl", "MOBopl", "MOBmi", "MOBipl", "MOBgr"],
12+
"attribute": "acronym",
13+
"with_descendants": false
14+
}
15+
}

atlas_placement_hints/app/placement_hints.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,3 +340,60 @@ def thalamus(
340340
output_dir,
341341
has_hemispheres=True,
342342
)
343+
344+
345+
@app.command()
346+
@verbose_option
347+
@common_atlas_options
348+
@click.option(
349+
"--metadata-path",
350+
type=EXISTING_FILE_PATH,
351+
required=False,
352+
help=(
353+
"(Optional) Path to the metadata json file. Defaults to "
354+
f"`{METADATA_REL_PATH / 'olfactory_bulb_metadata.json'}`"
355+
),
356+
default=str(METADATA_PATH / "olfactory_bulb_metadata.json"),
357+
)
358+
@click.option(
359+
"--direction-vectors-path",
360+
type=EXISTING_FILE_PATH,
361+
required=True,
362+
help=("Path to the olfactory bulb direction vectors file, e.g., `direction_vectors.nrrd`."),
363+
)
364+
@click.option(
365+
"--output-dir",
366+
required=True,
367+
help="path of the directory to write. It will be created if it doesn't exist.",
368+
)
369+
@log_args(L)
370+
def olfactory_bulb(
371+
verbose, annotation_path, hierarchy_path, metadata_path, direction_vectors_path, output_dir
372+
):
373+
"""Generate and save the placement hints of the mouse olfactory bulb.
374+
Placement hints are saved under the names sepecified in
375+
`app/metadata/olfactory_bulb_metadata.json`.
376+
Default to:
377+
\b
378+
- `[PH]y.nrrd`
379+
- `[PH]MOBgl.nrrd`, `[PH]MOBgr.nrrd`, `[PH]MOBipl.nrrd`, `[PH]MOBmi.nrrd`, `[PH]MOBopl.nrrd`,
380+
A report together with an nrrd volume on problematic distance computations are generated
381+
in `output_dir` under the names:
382+
\b
383+
- `distance_report.json`
384+
- `<olfactory_bulb>_problematic_voxel_mask.nrrd` (mask of the voxels for which the computed
385+
placement hints cannot be trusted). <olfactory_bulb> is the region name specified in
386+
olfactory_bulb_metadata.json. Defaults to "olfactory_bulb".
387+
The annotation file can contain the olfactory_bulb or a superset.
388+
For the algorithm to work properly, some space should separate the boundary
389+
of the olfactory_bulb from the boundary of its enclosing array.
390+
"""
391+
set_verbose(L, verbose)
392+
393+
atlas = _create_layered_atlas(annotation_path, hierarchy_path, metadata_path)
394+
_placement_hints(
395+
atlas,
396+
direction_vectors_path,
397+
output_dir,
398+
has_hemispheres=True,
399+
)

0 commit comments

Comments
 (0)