@@ -340,3 +340,60 @@ def thalamus(
340
340
output_dir ,
341
341
has_hemispheres = True ,
342
342
)
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