API Reference
Core
Core data models and tile operations. This module contains the fundamental building blocks: Tile (a single image tile with position, size, and loader), TiledImage (a collection of tiles forming one image), and functions for parsing tiles from DataFrames or building them programmatically.
Key exports: Tile, TiledImage, TileSlice, TileFOVGroup, hcs_images_from_dataframe, single_images_from_dataframe, tiled_image_from_tiles, build_dummy_tile.
ome_zarr_converters_tools.core
Core utility module for OME-Zarr converters tools.
Tile
Bases: BaseModel, Generic[CollectionInterfaceType, ImageLoaderInterfaceType]
A tile representing a region of an image to be converted.
This model is a complete definition of a tile, including its position, size, how to load the image data, and additional metadata. This model is the basic entry point for defining what regions of an acquisition to convert.
Attributes:
-
fov_name(str) –Name of the field of view (FOV) this tile belongs to.
-
start_x(float) –Starting position in the X dimension.
-
start_y(float) –Starting position in the Y dimension.
-
start_z(float) –Starting position in the Z dimension.
-
start_c(int) –Starting position in the C (channel) dimension.
-
start_t(float) –Starting position in the T (time) dimension.
-
length_x(float) –Length of the tile in the X dimension.
-
length_y(float) –Length of the tile in the Y dimension.
-
length_z(float) –Length of the tile in the Z dimension.
-
length_c(int) –Length of the tile in the C (channel) dimension.
-
length_t(float) –Length of the tile in the T (time) dimension.
-
collection(CollectionInterfaceType) –Collection model defining how to build the path to the image(s).
-
image_loader(ImageLoaderInterfaceType) –Image loader model defining how to load the image data.
-
acquisition_details(AcquisitionDetails) –Acquisition specific details that will be used to validate and convert the tile.
-
attributes(dict[str, AttributeType]) –Additional attributes for the these will be passed to the fractal image list as key-value pairs.
Source code in ome_zarr_converters_tools/core/_tile.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
find_data_type(resource: Any | None = None) -> str
Find the data type of the image data.
Source code in ome_zarr_converters_tools/core/_tile.py
to_roi() -> Roi
Convert the Tile to a Roi.
Source code in ome_zarr_converters_tools/core/_tile.py
TileFOVGroup
Bases: BaseModel, Generic[ImageLoaderInterfaceType]
Group of TileSlices belonging to the same acquisition FOV.
Source code in ome_zarr_converters_tools/core/_tile_region.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
load_data(resource: Any | None = None) -> np.ndarray
Load the full image data for this FOV group using.
Source code in ome_zarr_converters_tools/core/_tile_region.py
load_data_dask(resource: Any | None = None, chunks: tuple[int, ...] | None = None) -> da.Array
Load the full image data for this FOV group using Dask.
Source code in ome_zarr_converters_tools/core/_tile_region.py
ref_slice() -> TileSlice[ImageLoaderInterfaceType]
Get a reference TileSlice for this FOV group.
Source code in ome_zarr_converters_tools/core/_tile_region.py
roi() -> Roi
Get the global ROI covering all TileSlices in the FOV group.
shape() -> tuple[int, ...]
Get the shape of the FOV group by computing the union of all regions.
TileSlice
Bases: BaseModel, Generic[ImageLoaderInterfaceType]
The smallest unit of a tiled image.
Usually corresponds to the minimal unit in which the source data can be loaded (e.g., a single tiff file from the microscope).
Source code in ome_zarr_converters_tools/core/_tile_region.py
from_tile(tile: Tile) -> Self
classmethod
Create a TileSlice from a Tile.
load_data(*, axes: list[CANONICAL_AXES_TYPE], resource: Any | None = None) -> np.ndarray
Load the image data for this TileSlice using the image loader.
Source code in ome_zarr_converters_tools/core/_tile_region.py
TiledImage
Bases: BaseModel, Generic[CollectionInterfaceType, ImageLoaderInterfaceType]
A TiledImage is the unit that will be converted into an OME-Zarr image.
Can contain multiple TileFOVGroups, each containing multiple TileSlices or it can directly contain a single TileFOVGroup.
Source code in ome_zarr_converters_tools/core/_tile_region.py
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 | |
pixel_size: PixelSize
property
Return the PixelSize of the TiledImage.
add_tile(tile: Tile, add_translation: bool = False) -> None
Add a Tile to the TiledImage as a TileRegion.
Source code in ome_zarr_converters_tools/core/_tile_region.py
group_by_fov() -> list[TileFOVGroup[ImageLoaderInterfaceType]]
Group TileSlices by field of view name.
Source code in ome_zarr_converters_tools/core/_tile_region.py
load_data(resource: Any | None = None) -> np.ndarray
Load the full image data for this TiledImage using the image loaders.
Source code in ome_zarr_converters_tools/core/_tile_region.py
load_data_dask(resource: Any | None = None, chunks: tuple[int, ...] | None = None) -> da.Array
Load the full image data for this TiledImage using Dask.
Source code in ome_zarr_converters_tools/core/_tile_region.py
roi() -> Roi
Get the global ROI covering all TileSlices in the TiledImage.
shape() -> tuple[int, ...]
Get the shape of the TiledImage by computing the union of all regions.
hcs_images_from_dataframe(*, tiles_table: pd.DataFrame, acquisition_details: AcquisitionDetails, plate_name: str | None = None, acquisition_id: int = 0) -> list[Tile]
Build a list of TiledImages belonging to an HCS acquisition.
Parameters:
-
tiles_table(DataFrame) –DataFrame containing the tiles table.
-
acquisition_details(AcquisitionDetails) –AcquisitionDetails model for the acquisition.
-
plate_name(str | None, default:None) –Optional name of the plate.
-
acquisition_id(int, default:0) –Acquisition index.
Source code in ome_zarr_converters_tools/core/_table.py
join_url_paths(base_url: str, *paths: str) -> str
Join multiple path components to a base URL.
This is used instead of os.path.join or pathlib.Path to ensure support for both local and S3 URLs.
Source code in ome_zarr_converters_tools/models/_url_utils.py
local_url_to_path(url: str) -> Path
Convert a local URL to a Path object.
single_images_from_dataframe(*, tiles_table: pd.DataFrame, acquisition_details: AcquisitionDetails) -> list[Tile]
Build a list of TiledImages belonging to an HCS acquisition.
Parameters:
-
tiles_table(DataFrame) –DataFrame containing the tiles table.
-
acquisition_details(AcquisitionDetails) –AcquisitionDetails model for the acquisition.
Source code in ome_zarr_converters_tools/core/_table.py
tiled_image_from_tiles(*, tiles: list[Tile], converter_options: ConverterOptions, resource: Any | None = None) -> list[TiledImage]
Create a TiledImage from a dictionary.
Parameters:
-
tiles(list[Tile]) –List of Tile models to build the TiledImage from.
-
converter_options(ConverterOptions) –ConverterOptions model for the conversion.
-
resource(Any | None, default:None) –Optional resource to assist in processing.
Returns:
-
list[TiledImage]–A list of TiledImage models created from the tiles.
Source code in ome_zarr_converters_tools/core/_tile_to_tiled_images.py
Models
Configuration models, collection types, and image loaders. This module defines the Pydantic models used to configure the conversion pipeline (ConverterOptions, AcquisitionDetails), the collection types that determine output structure (ImageInPlate, SingleImage), and the image loader interface for custom formats.
Key exports: ConverterOptions, AcquisitionDetails, ChannelInfo, ImageInPlate, SingleImage, ImageLoaderInterface, DefaultImageLoader, TilingMode, WriterMode, OverwriteMode, AlignmentCorrections, OmeZarrOptions.
ome_zarr_converters_tools.models
Models and types definitions for the ome_zarr_converters_tools.
AcquisitionDetails
Bases: BaseModel
Details about the acquisition.
These attributes are known and fixed prior to conversion. (Either parsed from metadata or manually serialized by the user beforehand.)
Source code in ome_zarr_converters_tools/models/_acquisition.py
validate_axes(v: list[CANONICAL_AXES_TYPE]) -> list[CANONICAL_AXES_TYPE]
classmethod
Validate that axes are in canonical order.
Source code in ome_zarr_converters_tools/models/_acquisition.py
ChannelInfo
Bases: BaseModel
Channel information.
Source code in ome_zarr_converters_tools/models/_acquisition.py
channel_label: str
instance-attribute
Label of the channel.
colors: DefaultColors = DefaultColors.blue
class-attribute
instance-attribute
The color associated with the channel, e.g. for visualization purposes.
wavelength_id: str | None = None
class-attribute
instance-attribute
The wavelength ID of the channel. This field can be used in some tasks as alternative to channel_label, e.g. for multiplexed acquisitions it can be used for applying illumination correction based on wavelength ID instead of channel name.
ConverterOptions
Bases: BaseModel
Options for the OME-Zarr conversion process.
Source code in ome_zarr_converters_tools/models/_converter_options.py
alignment_correction: StagePositionCorrections = Field(default_factory=StagePositionCorrections, title='Alignment Corrections')
class-attribute
instance-attribute
Alignment correction options.
omezarr_options: OmeZarrOptions = Field(default_factory=OmeZarrOptions, title='OME-Zarr Options')
class-attribute
instance-attribute
Options specific to OME-Zarr writing.
temp_json_options: TempJsonOptions = Field(default_factory=TempJsonOptions, title='Temporary JSON Options')
class-attribute
instance-attribute
Options for temporary JSON storage.
tiling_mode: TilingMode = Field(default=(TilingMode.AUTO), title='Tiling Mode')
class-attribute
instance-attribute
Tiling mode to use during conversion.
- Auto: Automatically determine if Snap to Grid is possible, otherwise use Snap to Corners.
- Snap to Grid: Tile images to fit a regular grid. This is only possible if image positions align to a grid (potentially with overlap).
- Snap to Corners: Tile images to fit a grid defined by the corner positions.
- Inplace: Write tiles in their original positions without tiling. This may lead to artifacts if microscope stage positions are not precise.
- No Tiling: Each field of view is written as a single OME-Zarr.
tiling_tolerance: float = Field(default=0, ge=0, title='Tiling Tolerance (in pixels)')
class-attribute
instance-attribute
Tolerance in pixels for determining if Snap to Grid is possible. This accounts for minor jitter in microscope stage positions when determining if Snap to Grid tiling can be applied.
writer_mode: WriterMode = Field(default=(WriterMode.BY_FOV), title='Writer Mode')
class-attribute
instance-attribute
Mode for writing data during conversion.
- By Tile: Write data one tile at a time. This consumes less memory, but may be slower.
- By Tile (Using Dask): Write tiles in parallel using Dask. This is usually faster than writing by tile sequentially, but may consume more memory.
- By FOV: Write data one field of view at a time. This may the best compromise between speed and memory usage in most cases.
- By FOV (Using Dask): Write fields of view in parallel using Dask. This is usually faster than writing by FOV sequentially, but may consume more memory.
- In Memory: Load all data into memory before writing.
DataTypeEnum
DefaultImageLoader
Bases: ImageLoaderInterface
Source code in ome_zarr_converters_tools/models/_loader.py
load_data(resource: Any = None) -> np.ndarray
Load the image data as a NumPy array.
Source code in ome_zarr_converters_tools/models/_loader.py
FixedSizeChunking
Bases: BaseModel
Chunking strategy with fixed chunk sizes.
Source code in ome_zarr_converters_tools/models/_converter_options.py
c_chunk: int = Field(default=1, ge=1, title='Chunk Size for C')
class-attribute
instance-attribute
Chunk size for C dimension.
mode: Literal['Fixed Size'] = 'Fixed Size'
class-attribute
instance-attribute
Fixed size chunking.
t_chunk: int = Field(default=1, ge=1, title='Chunk Size for T')
class-attribute
instance-attribute
Chunk size for T dimension.
xy_chunk: int = Field(default=4096, ge=1, title='Chunk Size for XY')
class-attribute
instance-attribute
Chunk size for XY dimensions.
z_chunk: int = Field(default=10, ge=1, title='Chunk Size for Z')
class-attribute
instance-attribute
Chunk size for Z dimension.
FovBasedChunking
Bases: BaseModel
Chunking strategy that matches the field of view.
Source code in ome_zarr_converters_tools/models/_converter_options.py
c_chunk: int = Field(default=1, ge=1, title='Chunk Size for C')
class-attribute
instance-attribute
Chunk size for C dimension.
mode: Literal['Same as FOV'] = 'Same as FOV'
class-attribute
instance-attribute
Chunking based on FOV size.
t_chunk: int = Field(default=1, ge=1, title='Chunk Size for T')
class-attribute
instance-attribute
Chunk size for T dimension.
xy_scaling: Scalings = Field(default=(Scalings.ONE), title='XY Scaling Factor')
class-attribute
instance-attribute
Scaling factor for XY chunk size. If set to 1, chunk size matches FOV size. If set to 0.5, chunk size is half the FOV size (smaller chunks, more files). If set to 2, chunk size is double the FOV size (larger chunks, less files).
z_chunk: int = Field(default=10, ge=1, title='Chunk Size for Z')
class-attribute
instance-attribute
Chunk size for Z dimension.
OmeZarrOptions
Bases: BaseModel
Options specific to OME-Zarr writing.
Source code in ome_zarr_converters_tools/models/_converter_options.py
chunks: ChunkingStrategy = Field(default_factory=FovBasedChunking, title='Chunking Strategy')
class-attribute
instance-attribute
Chunking strategy to use.
ngff_version: NgffVersions = DefaultNgffVersion
class-attribute
instance-attribute
Version of the OME-NGFF specification to target.
num_levels: int = Field(default=5, ge=1)
class-attribute
instance-attribute
Number of resolution levels to create.
table_backend: BackendType = Field(default=(BackendType.ANNDATA), title='Table Backend')
class-attribute
instance-attribute
Backend type for storing tables.
StageOrientation
Bases: BaseModel
Stage orientation corrections.
Source code in ome_zarr_converters_tools/models/_acquisition.py
flip_x: bool = Field(default=False, title='Flip X')
class-attribute
instance-attribute
Whether to flip the position along the X axis.
flip_y: bool = Field(default=False, title='Flip Y')
class-attribute
instance-attribute
Whether to flip the position along the Y axis.
swap_xy: bool = Field(default=False, title='Swap XY')
class-attribute
instance-attribute
Whether to swap the positions along the X and Y axes.
StagePositionCorrections
Bases: BaseModel
Alignment correction for stage positions.
Source code in ome_zarr_converters_tools/models/_converter_options.py
align_t: bool = Field(default=False, title='Align T')
class-attribute
instance-attribute
Whether to align the positions in the T axis by FOV. This addresses minor imprecision that often occurs during image acquisition.
align_xy: bool = Field(default=False, title='Align XY')
class-attribute
instance-attribute
Whether to align the positions in the XY plane by FOV. This addresses minor imprecision that often occurs during image acquisition.
align_z: bool = Field(default=False, title='Align Z')
class-attribute
instance-attribute
Whether to align the positions in the Z axis by FOV. This addresses minor imprecision that often occurs during image acquisition.
default_axes_builder(is_time_series: bool) -> list[CANONICAL_AXES_TYPE]
join_url_paths(base_url: str, *paths: str) -> str
Join multiple path components to a base URL.
This is used instead of os.path.join or pathlib.Path to ensure support for both local and S3 URLs.
Source code in ome_zarr_converters_tools/models/_url_utils.py
local_url_to_path(url: str) -> Path
Convert a local URL to a Path object.
Pipelines
Pipeline functions for aggregation, registration, filtering, validation, and writing. This module orchestrates the full conversion flow: aggregating tiles into images, running registration steps, applying filters, and writing the final OME-Zarr datasets. It also provides extension points for custom filters, validators, and registration steps.
Key exports: tiles_aggregation_pipeline, tiled_image_creation_pipeline, build_default_registration_pipeline, apply_registration_pipeline, apply_filter_pipeline, add_filter, add_registration_func, add_validator.
ome_zarr_converters_tools.pipelines
Pipeline modules for OME-Zarr converters tools.
add_collection_handler(*, function: SetupCollectionFunction, collection_type: str | None = None, overwrite: bool = False) -> None
Register a new collection setup handler.
The collection setup handler is responsible for setting up the collection structure and metadata in the Zarr group.
Parameters:
-
collection_type(str | None, default:None) –Name of the collection setup handler. By convention, the name of the CollectionInterfaceType, e.g., 'SingleImage' or 'ImageInPlate'.
-
function(SetupCollectionFunction) –Function that performs the collection setup step.
-
overwrite(bool, default:False) –Whether to overwrite an existing collection setup step with the same name.
Source code in ome_zarr_converters_tools/pipelines/_collection_setup.py
add_filter(*, function: FilterFunctionProtocol, name: str | None = None, overwrite: bool = False) -> None
Register a new filter.
Parameters:
-
name(str | None, default:None) –Name of the registration step.
-
function(FilterFunctionProtocol) –Function that performs the registration step.
-
overwrite(bool, default:False) –Whether to overwrite an existing registration step with the same name.
Source code in ome_zarr_converters_tools/pipelines/_filters.py
add_registration_func(function: Callable[..., TiledImage], name: str, overwrite: bool = False) -> None
Register a new registration step function.
Parameters:
-
name(str) –Name of the registration step.
-
function(Callable[..., TiledImage]) –Function that performs the registration step.
-
overwrite(bool, default:False) –Whether to overwrite an existing registration step.
Source code in ome_zarr_converters_tools/pipelines/_registration_pipeline.py
add_validator(function: ValidatorFunctionProtocol, name: str | None = None, overwrite: bool = False) -> None
Register a new validator function.
Parameters:
-
name(str | None, default:None) –Name of the registration step.
-
function(ValidatorFunctionProtocol) –Function that performs the registration step.
-
overwrite(bool, default:False) –Whether to overwrite an existing registration step with the same name.
Source code in ome_zarr_converters_tools/pipelines/_validators.py
setup_ome_zarr_collection(*, tiled_images: list[TiledImage], collection_type: str, zarr_dir: str, ngff_version: NgffVersions = DefaultNgffVersion, overwrite_mode: OverwriteMode = OverwriteMode.NO_OVERWRITE) -> None
Set up the collection in the Zarr group using the specified handler.
Parameters:
-
tiled_images(list[TiledImage]) –List of TiledImage to set up the collection for.
-
collection_type(str) –Type of collection setup handler to use.
-
zarr_dir(str) –The base directory for the zarr data.
-
ngff_version(NgffVersions, default:DefaultNgffVersion) –NGFF version to use for the collection setup.
-
overwrite_mode(OverwriteMode, default:NO_OVERWRITE) –Overwrite mode to use for the collection setup.
Returns:
-
None–The list of TiledImage after applying the collection setup handler.
Source code in ome_zarr_converters_tools/pipelines/_collection_setup.py
tiled_image_creation_pipeline(*, zarr_url: str, tiled_image: TiledImage, registration_pipeline: list[RegistrationStep], converter_options: ConverterOptions, writer_mode: WriterMode, overwrite_mode: OverwriteMode, resource: Any | None = None) -> OmeZarrContainer
Write a TiledImage from a dictionary.
Source code in ome_zarr_converters_tools/pipelines/_tiled_image_creation_pipeline.py
tiles_aggregation_pipeline(tiles: list[Tile], *, converter_options: ConverterOptions, filters: Sequence[FilterModel] | None = None, validators: Sequence[ValidatorStep] | None = None, resource: Any | None = None) -> list[TiledImage]
Process tiles and aggregates them into TiledImages.
This function applies optional filters to the input tiles and then constructs TiledImage models from the processed tiles.
Parameters:
-
tiles(list[Tile]) –List of Tile models to process.
-
converter_options(ConverterOptions) –ConverterOptions model for the conversion.
-
filters(Sequence[FilterModel] | None, default:None) –Optional sequence of filter steps to apply to the tiles.
-
validators(Sequence[ValidatorStep] | None, default:None) –Optional sequence of validator steps to apply to the tiles.
-
resource(Any | None, default:None) –Optional resource to assist in processing.
Returns:
-
list[TiledImage]–A list of TiledImage models created from the processed tiles.
Source code in ome_zarr_converters_tools/pipelines/_tiles_aggregation_pipeline.py
write_tiled_image_as_zarr(*, zarr_url: str, tiled_image: TiledImage, converter_options: ConverterOptions, writer_mode: WriterMode, overwrite_mode: OverwriteMode, resource: Any | None = None) -> OmeZarrContainer
Write a TiledImage as a Zarr file.
Parameters:
-
zarr_url(str) –URL to write the Zarr file to.
-
tiled_image(TiledImage) –TiledImage model to write.
-
converter_options(ConverterOptions) –Options for the OME-Zarr conversion.
-
writer_mode(WriterMode) –Mode for writing the data.
-
overwrite_mode(OverwriteMode) –Mode to handle existing data.
-
resource(Any | None, default:None) –Optional resource to pass to the image loaders.
Returns:
-
OmeZarrContainer(OmeZarrContainer) –The written OME-Zarr container.
Source code in ome_zarr_converters_tools/pipelines/_write_ome_zarr.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
Fractal Integration
Utilities for building Fractal platform tasks. This module provides setup_images_for_conversion() (init task) and generic_compute_task() (compute task factory) for parallelizing conversions across a Fractal cluster.
Key exports: setup_images_for_conversion, generic_compute_task, ConvertParallelInitArgs, AcquisitionOptions.
ome_zarr_converters_tools.fractal
API for building OME-Zarr converters tasks for Fractal.
AcquisitionOptions
Bases: BaseModel
Acquisition options for conversion.
These are option that can be specified per acquisition. by the user at conversion time. This is not to be confused with AcquisitionDetails, this model is used in fractal tasks to override/update details from AcquisitionDetails model.
Source code in ome_zarr_converters_tools/fractal/_models.py
axes: str | None = None
class-attribute
instance-attribute
Axes to use for the image data, e.g. "czyx".
channels: list[ChannelInfo] | None = None
class-attribute
instance-attribute
List of channel information.
condition_table_path: str | None = None
class-attribute
instance-attribute
Optional path to a condition table CSV file.
data_type: DataTypeEnum | None = Field(default=None, title='Data Type')
class-attribute
instance-attribute
Data type of the image data.
filters: list[ImplementedFilters] = Field(default_factory=list)
class-attribute
instance-attribute
List of filters to apply.
pixel_info: PixelSizeModel | None = Field(default=None, title='Pixel Size Information')
class-attribute
instance-attribute
Pixel size information.
stage_corrections: StageOrientation = Field(default_factory=StageOrientation, title='Stage Corrections')
class-attribute
instance-attribute
Stage orientation corrections.
to_axes_list() -> list[CANONICAL_AXES_TYPE] | None
Convert axes string to list of axes.
Source code in ome_zarr_converters_tools/fractal/_models.py
update_acquisition_details(acquisition_details: AcquisitionDetails) -> AcquisitionDetails
Update AcquisitionDetails model with options from this model.
Parameters:
-
acquisition_details(AcquisitionDetails) –AcquisitionDetails model to update.
Returns:
-
AcquisitionDetails–Updated AcquisitionDetails model.
Source code in ome_zarr_converters_tools/fractal/_models.py
ConvertParallelInitArgs
Bases: BaseModel
Arguments for the compute task.
Source code in ome_zarr_converters_tools/fractal/_models.py
PixelSizeModel
Bases: BaseModel
Pixel size model.
Source code in ome_zarr_converters_tools/fractal/_models.py
pixelsize: float
instance-attribute
Pixel size in micrometers.
t_spacing: float
instance-attribute
Time spacing in seconds.
z_spacing: float
instance-attribute
Z spacing in micrometers.
cleanup_if_exists(temp_json_url: str)
Clean up the temporary JSON directory if it exists.
If cleaning up is not possible, log an error message, but do not raise.
Parameters:
-
temp_json_url(str) –The URL to the temporary JSON directory.
Source code in ome_zarr_converters_tools/fractal/_json_utils.py
converters_tools_models(base: str = 'ome_zarr_converters_tools') -> list[tuple[str, str, str]]
Get all input models for Fractal tasks API.
Returns:
-
list[tuple[str, str, str]]–List of input models.
Source code in ome_zarr_converters_tools/fractal/_models.py
dump_to_json(temp_json_url: str, tiled_image: TiledImage) -> str
Create a pickle file for the tiled image.
Source code in ome_zarr_converters_tools/fractal/_json_utils.py
generic_compute_task(*, zarr_url: str, init_args: ConvertParallelInitArgs, collection_type: type[CollectionInterfaceType], image_loader_type: type[ImageLoaderInterfaceType], resource: Any = None) -> ImageListUpdateDict
Initialize the task to convert a LIF plate to OME-Zarr.
Parameters:
-
zarr_url(str) –URL to the OME-Zarr file.
-
init_args(ConvertParallelInitArgs) –Arguments from the initialization task.
-
collection_type(type[CollectionInterfaceType]) –The collection type to use when loading the TiledImage.
-
image_loader_type(type[ImageLoaderInterfaceType]) –The image loader type to use when loading the TiledImage.
-
resource(Any, default:None) –The resource to associate with the context model.
Source code in ome_zarr_converters_tools/fractal/_compute_task.py
remove_json(tiled_image_json_dump_url: str)
Clean up the JSON file and the directory if it is empty.
Parameters:
-
tiled_image_json_dump_url(str) –The URL to the json file.
Source code in ome_zarr_converters_tools/fractal/_json_utils.py
setup_images_for_conversion(tiled_images: list[TiledImage], *, zarr_dir: str, collection_type: str, converter_options: ConverterOptions, overwrite_mode: OverwriteMode = OverwriteMode.NO_OVERWRITE, ngff_version: NgffVersions = DefaultNgffVersion) -> list[dict]
Setup the OME-Zarr collection from converted tiled images.
This function run all the necessary steps to setup before parallel conversion. - Build the OME-Zarr collection structure. - Build the parallelization list (used by the fractal compute task).
Parameters:
-
tiled_images(list[TiledImage]) –List of TiledImageWithContext models that have been converted.
-
zarr_dir(str) –The base directory for the zarr data.
-
collection_type(str) –The type of collection to set up.
-
converter_options(ConverterOptions) –The converter options to use during conversion.
-
overwrite_mode(OverwriteMode, default:NO_OVERWRITE) –The overwrite mode to use when writing the data.
-
ngff_version(NgffVersions, default:DefaultNgffVersion) –The NGFF version to use when setting up the collection.
Source code in ome_zarr_converters_tools/fractal/_init_task.py
tiled_image_from_json(tiled_image_json_dump_url: str, collection_type: type[CollectionInterfaceType], image_loader_type: type[ImageLoaderInterfaceType]) -> TiledImage
Load the json TiledImage object.
Since TiledImage is a generic model, we need to specify the concrete types when loading it from json otherwise pydantic cannot infer them.
Parameters:
-
tiled_image_json_dump_url(str) –The URL to the json file.
-
collection_type(type[CollectionInterfaceType]) –The concrete collection type of the TiledImage.
-
image_loader_type(type[ImageLoaderInterfaceType]) –The concrete image loader type of the TiledImage.
Returns:
-
TiledImage(TiledImage) –The loaded TiledImage object.