DeepSlice package
Module contents
- class DeepSlice.DSModel(species)
Bases:
objectInitialises a DeepSlice model for a given species :param species: the species of the brain to be processed, must be one of “mouse”, “rat” :type species: str
- adjust_angles(ML: Union[int, float], DV: Union[int, float])
Adjusts the Mediolateral (ML) and Dorsoventral (DV) angles of all sections to the specified values.
- Parameters:
ML ([int, float]) – the Mediolateral angle to set
DV ([int, float]) – the Dorsoventral angle to set
- enforce_index_order()
reorders the section depths (oy) in the predictions such that they align with the section indexes
- enforce_index_spacing(section_thickness: Optional[Union[int, float]] = None)
Space evenly according to the section indexes, if these indexes do not represent the precise order in which the sections were cut, this will lead to less accurate predictions. Section indexes must account for missing sections (ie, if section 3 is missing indexes must be 1, 2, 4).
- Parameters:
section_thickness (Union[int, float], optional) – the thickness of the sections in microns, defaults to None
- load_QUINT(filename)
Load a QUINT compatible JSON or XML.
- Parameters:
filename (str) – the name of the file to load
- predict(image_directory: str, ensemble: Optional[bool] = None, section_numbers: bool = True, legacy_section_numbers=False)
predicts the atlas position for a folder full of histological brain sections
- Parameters:
image_directory (str) – the directory containing the brain sections
ensemble (bool, optional) – whether to use multiple models, this will default to True when available, defaults to None
section_numbers (bool, optional) – whether this dataset includes section numbers (as the last three digits of the filename) , defaults to True
legacy_section_numbers (bool, optional) – a legacy setting which parses section numbers how old DeepSlice used to, defaults to False
- propagate_angles(method='weighted_mean')
Calculates the average Mediolateral and Dorsoventral angles for all sections.
- save_predictions(filename)
Save the predictions to a QuickNII compatible JSON file.
- Parameters:
filename (str) – the name of the file to save to
- set_bad_sections(bad_sections: list)
sets the bad sections for a given brain. Must be run after predict()
- Parameters:
bad_sections (list) – A list of bad sections to ignore when calculating angles and spacing