Skip to content

OME-Zarr v0.5 (Zarr v3) Review Updates #327

@srivarra

Description

@srivarra

Changes from the Review

suggestion(non-blocking)
We can call _echo_finished just once.

	skipped: bool = True
    if transformed is not None:
        _save_transformed(
            transformed,
            output_time_indices=output_time_index,
            output_channel_indices=output_channel_indices,
            output_position_path=output_position_path,
        )
        skipped = False

    _echo_finished(
    	time_index=input_time_index,
    	channel_index=input_channel_indices,
    	skipped=skipped,
    )

Originally posted by @srivarra in #301 (comment)

suggestion(if-minor)

Adding a protocol here in addition to the runtime check would be nice. The protocol would be good for IDEs / static analysis. You could also house examples of functions following the protocol in the docstring here.

from typing import Protocol, runtime_checkable

@runtime_checkable
class TransformFunction(Protocol):
    def __call__(
        self, 
        data: NDArray, 
        input_time_index: int | None = None,
        **kwargs: Any
    ) -> NDArray:
        """Transform image data.
        
        Parameters
        ----------
        data : NDArray
            CZYX or TCZYX image data to transform
        input_time_index : int, optional
            Time index for time-dependent transformations
        **kwargs
            Additional transformation parameters
            
        Returns
        -------
        NDArray
            Transformed data with same shape as input

		Examples
		--------
		>>> def double(data: NDArray, **kwargs) -> NDArray:
		...	    return data * 2
        """
        ...

def _apply_transform_to_czyx(
    func: TransformFunction,
    ...

Originally posted by @srivarra in #301 (comment)

Metadata

Metadata

Assignees

Labels

area: ngffOME-NGFF metadata, spec compliance, collectionsarea: zarrZarr integration, storage backends (zarr-python/tensorstore/zarrs)

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions