Neuron registration¶
Registration of .swc neuronal representations to high resolution mouse brain images
This script is intended to be used at the command line and will save the final registration results after applying the whole-image registrations from steps 1 and 2 to a set of .swc files representing neurons. This script performs step 3 of 3 in the registration pipeline.
- step3_atlas_registration.main()¶
Command line arguments¶
- datasetstr
The name of the dataset to be registered. This will be included in the names of the majority of the output files.
- orientationchar
The portion of the brain captured by this dataset (W - whole, L - left hemisphere, R - right hemisphere)
- -neuron_dirstr
The path to a directory containing all the .swc neuron representations for this dataset
- -low_to_high_dirstr
The path to a directory containing all the low-to-high resolution transforms (.npz) computed in Step 2
- -tformstr
The path to the low-res-to-atlas transform file (.npz) computed in Step 1
- -low_img_pathslist of str
List of all of the file paths pointing to the location(s) of the low resolution mouse brain images (.npz) in Anterior to Posterior order, for this dataset
- -low_img_idslist of str
List of slice id numbers associated with each slab in ‘-low_img_paths’
- -high_img_pathslist of str
List of all of the file paths pointing to the location(s) of the low resolution mouse brain images (.npz) in Anterior to Posterior order, for this dataset
- -high_img_idsstr
List of slice id numbers associated with each high-res image; Must be of the form ‘[[a],…,[b,c]]’ where each element of the list is a single or tuple consisting of alphanumeric strings
- -outdirstr
The path to the directory where all outputs will be stored
- -atlas_pathslist of 4 str
List of 3 allen atlas .vtk files, and 1 Yongsoo atlas .csv file. In order, these files are named (1) ara_nissl_50.vtk, (2) average_template_50.vtk, (3) UPenn_labels_reoriented_origin.vtk, and (4) atlas_info_KimRef_FPbasedLabel_v2.7.csv
- -mask_pathslist of str
The file paths to any manual segmentations to be used for registration performance quantification
- -mask_indslist of int
The index of low_img_paths which corresponds to the respective mask_paths
- -toggle_segbool
Default - True; If present, atlas segmentations will be included in the QC output figures
- -toggle_cpbool
Default - True; If present, atlas segmentation will highlight the subregions of the Caudoputamen
- -toggle_lowbool
Default - True; If present, QC output figures will include the low resolution image
- -toggle_highbool
Default - True; If present, QC output figures will include the high resolution image
- -toggle_neuronsbool
Default - True; If present, QC output figures will include the registered neurons
- –zeroMeanbool
Default - True; If present, use the zero mean convention when loading input data
- -e_pathstr
The location of the custom Python library ‘emlddmm’, which can be cloned from GitHub at https://github.com/twardlab/emlddmm
- -d_pathstr
The location of the custom Python library ‘donglab_workflows’, which be cloned from GitHub at https://github.com/twardlab/donglab_workflows
- raises Exception:
If the number of low resolution image paths does not equal the number of low resolution image IDs
- raises Exception:
If high_img_ids is not provided AND the number of high resolution image paths does not equal the amount of low resolution image paths (Whole brain) or double this amount (Hemisphere brain)
- raises Exception:
If the number of high resolution image paths does not equal the number of high resolution image IDs
- raises Exception:
If the total number of singles and tuples of the high image IDs does not equal the number of low image IDs