allensdk.internal.brain_observatory.roi_filter_utils module¶
- class allensdk.internal.brain_observatory.roi_filter_utils.TrainingLabelClassifier(criteria)[source]¶
Bases:
object
Very basic threshold_based classifier.
Has a decision function that is just the number of distinct criteria met by the classifier. Criteria are defined as a list of strings used with pandas.DataFrame.eval.
- Parameters:
- criterialist
List of evaluation strings.
- class allensdk.internal.brain_observatory.roi_filter_utils.TrainingMultiLabelClassifier(criteria=None)[source]¶
Bases:
object
Multilabel classifier using groups of TrainingLabelClassifiers.
This was used to generate labeling for training the original SVM for classification.
- Parameters:
- criteriadictionary
Label names and criteria for each label.
- allensdk.internal.brain_observatory.roi_filter_utils.calculate_max_border(motion_df, max_shift)[source]¶
Calculate motion boundary from frame offsets.
When the motion correction algorithm fails to find sufficient matches, it generates very large frame offsets. The use of max_shift avoids filtering too many cells due to the large offsets, with the tradeoff that those frames will be noise.
- Parameters:
- motion_dfpandas.DataFrame
Dataframe containing the x, y offsets from motion correction.
- max_shiftfloat
Maximum shift to allow when considering motion correction. Any larger shifts are considered outliers.
- Returns:
- list
[right_shift, left_shift, down_shift, up_shift]
- allensdk.internal.brain_observatory.roi_filter_utils.get_indices_by_distance(object_list_points, mask_points)[source]¶
Find indices of nearest neighbor matches.
Require a distance of 0 (perfect match) and a unique match between masks and object_list entries.
- allensdk.internal.brain_observatory.roi_filter_utils.get_rois(segmentation_stack, border=None)[source]¶
Extract a list of rois from the segmentation data array.
- Parameters:
- segmentation_stacknumpy.ndarray
The array from the maxInt_masks file showing the object masks.
- borderlist
[right_shift, left_shift, down_shift, up_shift] bounding box determined from motion correction.
- Returns:
- list
List of RoiMask objects.
- allensdk.internal.brain_observatory.roi_filter_utils.order_rois_by_object_list(object_data, rois)[source]¶
Reorder rois by matching bounding boxes to object list.
- Parameters:
- object_datapandas.DataFrame
Object list data.
- roislist
List of RoiMasks.
- Returns:
- list
The list of rois reordered to index the same as object_data.