cellmap_flow.utils.data

Attributes

logger

Classes

ModelConfig

ScriptModelConfig

DaCapoModelConfig

FlyModelConfig

BioModelConfig

Config

CellMapModelConfig

Configuration class for a CellmapModel.

Functions

load_eval_model(num_channels, checkpoint_path)

check_config(config)

get_dacapo_channels(task)

get_dacapo_run_model(run_name, iteration)

concat_along_c(arrs, axes_list[, channel_axis_name])

Concatenate a list of arrays along the axis named channel_axis_name.

reorder_axes(→ tuple[numpy.ndarray, list[str]])

Reorder/remove axes so that the final array has axes in the desired order.

process_chunk_bioimage(self, idi, input_roi)

process_chunk_bioimage_test(self, idi, input_roi)

format_output_bioimage(self, output_sample[, ...])

parse_model_configs(→ List[ModelConfig])

Reads a YAML file that defines a list of model configs.

Module Contents

cellmap_flow.utils.data.logger
class cellmap_flow.utils.data.ModelConfig
property config
property output_dtype

Returns the output dtype of the model. If not defined, defaults to np.float32.

class cellmap_flow.utils.data.ScriptModelConfig(script_path, name=None, scale=None)
script_path
name = None
scale = None
property command
class cellmap_flow.utils.data.DaCapoModelConfig(run_name: str, iteration: int, name=None)
run_name
iteration
name = None
property command
cellmap_flow.utils.data.load_eval_model(num_channels, checkpoint_path)
class cellmap_flow.utils.data.FlyModelConfig(checkpoint_path: str, channels: [str], input_voxel_size: tuple, output_voxel_size: tuple, name: str = None, input_size=(178, 178, 178), output_size=(56, 56, 56))
name = None
checkpoint_path
channels
input_voxel_size
output_voxel_size
input_size = (178, 178, 178)
output_size = (56, 56, 56)
property command
property model
class cellmap_flow.utils.data.BioModelConfig(model_name: str, voxel_size, edge_length_to_process=None, name=None)
model_name
voxel_size
name = None
voxels_to_process = None
property command
load_input_information(model)
load_output_information(model)
get_axes_and_dims(sample)
get_spatial_dims(axes, dims)
get_input_slicer(input_axes)
cellmap_flow.utils.data.check_config(config)
class cellmap_flow.utils.data.Config
cellmap_flow.utils.data.get_dacapo_channels(task)
cellmap_flow.utils.data.get_dacapo_run_model(run_name, iteration)
cellmap_flow.utils.data.concat_along_c(arrs, axes_list, channel_axis_name='c')

Concatenate a list of arrays along the axis named channel_axis_name.

Parameters:
  • arrs (list of np.ndarray) – The list of arrays to concatenate.

  • axes_list (list of list of str) – The list of list-of-axis-names. axes_list[i] is the axis names corresponding to arrs[i].

  • channel_axis_name (str) – The name of the “channel” axis. Default is “c”.

Returns:

  • out (np.ndarray) – The concatenated array.

  • out_axes (list of str) – The list of axis names for the output array.

cellmap_flow.utils.data.reorder_axes(arr: numpy.ndarray, axes: list[str], desired_order: list[str] = ['z', 'y', 'x', 'c']) tuple[numpy.ndarray, list[str]]

Reorder/remove axes so that the final array has axes in the desired order.

  • Any axis not in desired_order is removed IF its size == 1,

otherwise a ValueError is raised. - If an axis from desired_order is missing, we insert a size-1 dimension in the correct position so the final shape has exactly 4 dimensions.

Parameters:
  • arr (np.ndarray) – Input array.

  • axes (list of str) – Axis labels corresponding to arr.shape in order.

Returns:

  • arr (np.ndarray) – The reshaped/reordered array with axes in desired_order.

  • out_axes (list of str) – The final axis labels, which should be exactly desired_order.

cellmap_flow.utils.data.process_chunk_bioimage(self, idi: cellmap_flow.image_data_interface.ImageDataInterface, input_roi: funlib.geometry.Roi)
cellmap_flow.utils.data.process_chunk_bioimage_test(self, idi: cellmap_flow.image_data_interface.ImageDataInterface, input_roi: funlib.geometry.Roi)
cellmap_flow.utils.data.format_output_bioimage(self, output_sample, output_names=None, output_axes=None)
cellmap_flow.utils.data.parse_model_configs(yaml_file_path: str) List[ModelConfig]

Reads a YAML file that defines a list of model configs. Validates them manually, then returns a list of constructed ModelConfig objects.

class cellmap_flow.utils.data.CellMapModelConfig(folder_path, name, scale=None)

Configuration class for a CellmapModel. Similar to DaCapoModelConfig, but uses a CellmapModel object to populate the necessary metadata and define a prediction function.

cellmap_model
name
scale = None
property command: str

You can either return a placeholder command or remove this property if not needed. For consistency with your DaCapoModelConfig, we return something minimal here.