diff --git a/atlas_placement_hints/app/metadata/olfactory_bulb_metadata.json b/atlas_placement_hints/app/metadata/olfactory_bulb_metadata.json new file mode 100644 index 0000000..26d6763 --- /dev/null +++ b/atlas_placement_hints/app/metadata/olfactory_bulb_metadata.json @@ -0,0 +1,15 @@ +{ + "region": { + "name": "olfactory_bulb", + "query": "MOB", + "attribute": "acronym", + "with_descendants": true + + }, + "layers": { + "names": ["MOBgl", "MOBopl", "MOBmi", "MOBipl", "MOBgr"], + "queries": ["MOBgl", "MOBopl", "MOBmi", "MOBipl", "MOBgr"], + "attribute": "acronym", + "with_descendants": false + } +} diff --git a/atlas_placement_hints/app/placement_hints.py b/atlas_placement_hints/app/placement_hints.py index 5115a89..3bbe48b 100644 --- a/atlas_placement_hints/app/placement_hints.py +++ b/atlas_placement_hints/app/placement_hints.py @@ -340,3 +340,60 @@ def thalamus( output_dir, has_hemispheres=True, ) + + +@app.command() +@verbose_option +@common_atlas_options +@click.option( + "--metadata-path", + type=EXISTING_FILE_PATH, + required=False, + help=( + "(Optional) Path to the metadata json file. Defaults to " + f"`{METADATA_REL_PATH / 'olfactory_bulb_metadata.json'}`" + ), + default=str(METADATA_PATH / "olfactory_bulb_metadata.json"), +) +@click.option( + "--direction-vectors-path", + type=EXISTING_FILE_PATH, + required=True, + help=("Path to the olfactory bulb direction vectors file, e.g., `direction_vectors.nrrd`."), +) +@click.option( + "--output-dir", + required=True, + help="path of the directory to write. It will be created if it doesn't exist.", +) +@log_args(L) +def olfactory_bulb( + verbose, annotation_path, hierarchy_path, metadata_path, direction_vectors_path, output_dir +): + """Generate and save the placement hints of the mouse olfactory bulb. + Placement hints are saved under the names sepecified in + `app/metadata/olfactory_bulb_metadata.json`. + Default to: + \b + - `[PH]y.nrrd` + - `[PH]MOBgl.nrrd`, `[PH]MOBgr.nrrd`, `[PH]MOBipl.nrrd`, `[PH]MOBmi.nrrd`, `[PH]MOBopl.nrrd`, + A report together with an nrrd volume on problematic distance computations are generated + in `output_dir` under the names: + \b + - `distance_report.json` + - `_problematic_voxel_mask.nrrd` (mask of the voxels for which the computed + placement hints cannot be trusted). is the region name specified in + olfactory_bulb_metadata.json. Defaults to "olfactory_bulb". + The annotation file can contain the olfactory_bulb or a superset. + For the algorithm to work properly, some space should separate the boundary + of the olfactory_bulb from the boundary of its enclosing array. + """ + set_verbose(L, verbose) + + atlas = _create_layered_atlas(annotation_path, hierarchy_path, metadata_path) + _placement_hints( + atlas, + direction_vectors_path, + output_dir, + has_hemispheres=True, + )