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: - criteria : list
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: - criteria : dictionary
Label names and criteria for each label.
-
get_eXcluded
(self, X)[source]¶ Get the calculated value of the eXcluded column.
This is useful for comparison with the original classifier implementation.
Parameters: - X : pandas.DataFrame
Object features from the object list file.
Returns: - numpy.ndarray
Calculated eXcluded score from the classifier.
-
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_df : pandas.DataFrame
Dataframe containing the x, y offsets from motion correction.
- max_shift : float
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_stack : numpy.ndarray
The array from the maxInt_masks file showing the object masks.
- border : list
[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_data : pandas.DataFrame
Object list data.
- rois : list
List of RoiMasks.
Returns: - list
The list of rois reordered to index the same as object_data.