Skip to content

In Memory Dataset

Source

In-memory dataset module.

InMemoryDataset

Bases: Dataset

Dataset storing data in memory and allowing generating patches from it.

Parameters:

Name Type Description Default
data_config CAREamics DataConfig

(see careamics.config.data_model.DataConfig) Data configuration.

required
inputs ndarray or list[Path]

Input data.

required
input_target ndarray or list[Path]

Target data, by default None.

None
read_source_func Callable

Read source function for custom types, by default read_tiff.

read_tiff
**kwargs Any

Additional keyword arguments, unused.

{}

get_data_statistics()

Return training data statistics.

This does not return the target data statistics, only those of the input.

Returns:

Type Description
tuple of list of floats

Means and standard deviations across channels of the training data.

split_dataset(percentage=0.1, minimum_patches=1)

Split a new dataset away from the current one.

This method is used to extract random validation patches from the dataset.

Parameters:

Name Type Description Default
percentage float

Percentage of patches to extract, by default 0.1.

0.1
minimum_patches int

Minimum number of patches to extract, by default 5.

1

Returns:

Type Description
CAREamics InMemoryDataset

New dataset with the extracted patches.

Raises:

Type Description
ValueError

If percentage is not between 0 and 1.

ValueError

If minimum_number is not between 1 and the number of patches.