write_strategy_factory
Module containing convenience function to create WriteStrategy.
create_write_strategy(write_type, tiled, write_func=None, write_extension=None, write_func_kwargs=None) #
Create a write strategy from convenient parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
write_type | (tiff, custom) | The data type to save as, includes custom. | "tiff" |
tiled | bool | Whether the prediction will be tiled or not. | required |
write_func | WriteFunc | If a known | None |
write_extension | str | If a known | None |
write_func_kwargs | dict of {str: any} | Additional keyword arguments to be passed to the save function. | None |
Returns:
| Type | Description |
|---|---|
WriteStrategy | A strategy for writing predicions. |
Notes
The write_func function signature must match that of the example below
The write_func_kwargs will be passed to the write_func doing the following:
Source code in src/careamics/lightning/callbacks/prediction_writer_callback/write_strategy_factory.py
select_write_extension(write_type, write_extension=None) #
Return an extension to add to file paths.
If write_type is "custom" then write_extension, otherwise the known write extension is selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
write_type | (tiff, custom) | The data type to save as, includes custom. | "tiff" |
write_extension | str | If a known | None |
Returns:
| Type | Description |
|---|---|
str | The extension to be added to file paths. |
Raises:
| Type | Description |
|---|---|
ValueError | If |
Source code in src/careamics/lightning/callbacks/prediction_writer_callback/write_strategy_factory.py
select_write_func(write_type, write_func=None) #
Return a function to write images.
If write_type is "custom" then write_func, otherwise the known write function is selected.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
write_type | (tiff, custom) | The data type to save as, includes custom. | "tiff" |
write_func | WriteFunc | If a known | None |
Returns:
| Type | Description |
|---|---|
WriteFunc | A function for writing images. |
Raises:
| Type | Description |
|---|---|
ValueError | If |
Notes
The write_func function signature must match that of the example below