Manager

class cellector.manager.CellectorManager(root_dir: Path | str, exclude_features: List[str] | None = None, num_rois: int | None = None)[source]

Bases: object

classmethod make_from_roi_processor(roi_processor: RoiProcessor, exclude_features: List[str] | None = None) CellectorManager[source]

Create a CellectorManager from an existing RoiProcessor.

CellectorManager is usually initialized from disk, but this method allows the user to create a new manager from an existing RoiProcessor object, which will include any features / criteria that are stored on disk and add any features that are in the RoiProcessor but not on disk yet. This is useful when pipelining the and using the CellectorManager class to store the results of processing a session

Parameters:
  • roi_processor (RoiProcessor) – RoiProcessor object to include features from and define the root directory.

  • exclude_features (Optional[List[str]]) – List of feature names to exclude from selection criteria

Returns:

Manager object with features and criteria from the RoiProcessor object.

Return type:

CellectorManager

add_feature(feature_name, feature_values)[source]

Add a new feature to the manager.

Parameters:
  • feature_name (str) – Name of the feature to add.

  • feature_values (np.ndarray) – Array of shape (num_rois,) with the feature values.

compute_idx_meets_criteria()[source]

Compute the index of cells meeting the criteria defined by the features.

compute_idx_selected()[source]

Compute the index of cells that are selected.

update_criteria(feature: str, criterion: List | ndarray)[source]

Update the criteria for a particular feature.

Parameters:
  • feature (str) – Feature name.

  • criterion (np.ndarray) – Array of shape (2,) with the minimum and maximum criteria or None for no criteria.

update_manual_labels(idx_roi: int, label: bool, active: bool)[source]

Update the manual labels for an ROI.

Parameters:
  • idx_roi (int) – Index of the ROI to update.

  • label (bool) – Whether the ROI is selected or not.

  • active (bool) – Whether to consider the manual label for this ROI.

save_features()[source]

Save the feature values to disk.

save_criteria()[source]

Save the criteria values to disk.

save_manual_selection()[source]

Save the manual selection labels to disk.

save_idx_selected()[source]

Save the indices of selected ROIs to disk.

save_all()[source]

Save all data to disk.