magmap.io.export_rois module

ROI exporter for MagellanMapper.

Convert images and corresponding database entries into formats for machine learning algorithms or other applications.

magmap.io.export_rois.blobs_to_csv(blobs, path)[source]

Exports blob coordinates and radius to CSV file, compressed with GZIP.

Parameters:
  • blobs – Blobs array, assumed to be in [[z, y, x, radius, …], …] format.

  • path – Path to blobs file. The CSV file will be the same as this path except replacing the extension with .csv.gz.

magmap.io.export_rois.export_rois(db, img5d, channel, path, padding=None, unit_factor=None, truth_mode=None, exp_name=None)[source]

Export all ROIs from database.

If the current processing profile includes isotropic interpolation, the ROIs will be resized to make isotropic according to this factor.

Parameters:
  • db (ClrDB) – Database from which to export.

  • img5d (Image5d) – Image5d image with the ROIs.

  • channel (List[int]) – Channels to export; currently only the first channel is used.

  • path (str) – Path with filename base from which to save the exported files.

  • padding (Optional[List[int]], default: None) – Padding in x,y,z to exclude from the ROI; defaults to None.

  • unit_factor (Optional[float], default: None) – Linear conversion factor for units (eg 1000.0 to convert um to mm).

  • truth_mode (Optional[TruthDBModes], default: None) – Truth mode enum; defaults to None.

  • exp_name (Optional[str], default: None) – Name of experiment to export; defaults to None to export all experiments in db.

Return type:

DataFrame

Returns:

ROI metrics in a data frame.

magmap.io.export_rois.load_roi_files(db, path)[source]
magmap.io.export_rois.make_roi_paths(path, roi_id, channel, make_dirs=False)[source]