ngio 0.4.0a4__tar.gz → 0.4.0b1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ngio-0.4.0a4 → ngio-0.4.0b1}/PKG-INFO +1 -1
- ngio-0.4.0b1/docs/api/iterators.md +17 -0
- ngio-0.4.0b1/docs/api/ngio/io_pipes.md +3 -0
- ngio-0.4.0b1/docs/api/ngio/iterators.md +3 -0
- ngio-0.4.0b1/docs/api/ngio/transforms.md +3 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/getting_started/2_images.md +14 -3
- ngio-0.4.0b1/docs/getting_started/6_iterators.md +14 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/index.md +7 -6
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/tutorials/create_ome_zarr.ipynb +1 -1
- ngio-0.4.0b1/docs/tutorials/feature_extraction.ipynb +168 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/tutorials/hcs_exploration.ipynb +0 -10
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/tutorials/image_processing.ipynb +54 -5
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/tutorials/image_segmentation.ipynb +107 -17
- {ngio-0.4.0a4 → ngio-0.4.0b1}/mkdocs.yml +6 -1
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/common/_dimensions.py +209 -189
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/common/_roi.py +2 -2
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/experimental/iterators/__init__.py +0 -2
- ngio-0.4.0b1/src/ngio/experimental/iterators/_abstract_iterator.py +390 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/experimental/iterators/_feature.py +84 -41
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/experimental/iterators/_image_processing.py +7 -36
- ngio-0.4.0b1/src/ngio/experimental/iterators/_mappers.py +48 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/experimental/iterators/_segmentation.py +7 -38
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_abstract_image.py +60 -5
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_image.py +2 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_label.py +2 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_masked_image.py +22 -17
- ngio-0.4.0b1/src/ngio/io_pipes/__init__.py +75 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/io_pipes/_io_pipes.py +93 -18
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/io_pipes/_io_pipes_masked.py +17 -10
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/io_pipes/_io_pipes_roi.py +10 -1
- ngio-0.4.0b1/src/ngio/io_pipes/_io_pipes_types.py +56 -0
- ngio-0.4.0b1/src/ngio/io_pipes/_ops_axes.py +344 -0
- ngio-0.4.0b1/src/ngio/io_pipes/_ops_slices.py +446 -0
- ngio-0.4.0b1/src/ngio/io_pipes/_ops_slices_utils.py +196 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/io_pipes/_ops_transforms.py +1 -1
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/io_pipes/_zoom_transform.py +5 -5
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/__init__.py +0 -2
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/ngio_specs/__init__.py +0 -2
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/ngio_specs/_axes.py +7 -131
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/utils/_datasets.py +5 -0
- ngio-0.4.0b1/tests/unit/common/test_dimensions.py +161 -0
- ngio-0.4.0b1/tests/unit/common/test_roi.py +201 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/images/test_images.py +3 -3
- ngio-0.4.0b1/tests/unit/io_pipes/test_axes_ops.py +48 -0
- ngio-0.4.0b1/tests/unit/io_pipes/test_slicing_ops.py +112 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/iterators/test_iterators.py +26 -1
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/ome_zarr_meta/test_unit_ngio_specs.py +0 -49
- ngio-0.4.0a4/docs/tutorials/feature_extraction.ipynb +0 -118
- ngio-0.4.0a4/src/ngio/experimental/iterators/_abstract_iterator.py +0 -170
- ngio-0.4.0a4/src/ngio/io_pipes/__init__.py +0 -49
- ngio-0.4.0a4/src/ngio/io_pipes/_io_pipes_utils.py +0 -299
- ngio-0.4.0a4/src/ngio/io_pipes/_ops_axes.py +0 -146
- ngio-0.4.0a4/src/ngio/io_pipes/_ops_slices.py +0 -218
- ngio-0.4.0a4/tests/unit/common/test_dimensions.py +0 -89
- ngio-0.4.0a4/tests/unit/common/test_roi.py +0 -40
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.copier-answers.yml +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.gitattributes +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.github/ISSUE_TEMPLATE.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.github/TEST_FAIL_TEMPLATE.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.github/dependabot.yml +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.github/pull_request_template.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.github/workflows/build_docs.yml +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.github/workflows/ci.yml +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.gitignore +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/.pre-commit-config.yaml +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/CHANGELOG.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/LICENSE +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/README.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/_typos.toml +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/hcs.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/images.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/ngio/common.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/ngio/hcs.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/ngio/images.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/ngio/ngio.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/ngio/tables.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/ngio/utils.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/ome_zarr_container.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/api/tables.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/changelog.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/code_of_conduct.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/contributing.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/getting_started/0_quickstart.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/getting_started/1_ome_zarr_containers.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/getting_started/3_tables.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/getting_started/4_masked_images.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/getting_started/5_hcs.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/backend.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/overview.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/table_types/condition_table.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/table_types/custom_table.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/table_types/feature_table.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/table_types/generic_table.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/table_types/masking_roi_table.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/docs/table_specs/table_types/roi_table.md +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/pyproject.toml +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/common/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/common/_masking_roi.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/common/_pyramid.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/common/_synt_images_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/common/_zoom.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/experimental/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/experimental/iterators/_rois_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/hcs/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/hcs/_plate.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_create.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_create_synt_container.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_ome_zarr_container.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/images/_table_ops.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/io_pipes/_match_shape.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/_meta_handlers.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/ngio_specs/_channels.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/ngio_specs/_dataset.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/ngio_specs/_ngio_hcs.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/ngio_specs/_ngio_image.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/ngio_specs/_pixel_size.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/v04/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/v04/_custom_models.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/ome_zarr_meta/v04/_v04_spec_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/mask.png +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/nuclei.png +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/resources/20200812-CardiomyocyteDifferentiation14-Cycle1_B03/raw.jpg +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/resources/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/resources/resource_model.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/_abstract_table.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/_tables_container.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_abstract_backend.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_anndata.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_anndata_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_csv.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_json.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_non_zarr_backends.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_parquet.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_table_backends.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/backends/_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/v1/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/v1/_condition_table.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/v1/_feature_table.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/v1/_generic_table.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/tables/v1/_roi_table.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/transforms/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/transforms/_zoom.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/utils/__init__.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/utils/_errors.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/utils/_fractal_fsspec_store.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/utils/_logger.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/src/ngio/utils/_zarr_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/conftest.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_c1yx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_cyx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_czyx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tcyx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tczyx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tyx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_tzyx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_yx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/labels/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/labels/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/labels/label/.zattrs +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/labels/label/.zgroup +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/labels/label/0/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/images/test_image_zyx.zarr/labels/label/1/.zarray +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/meta/base_ome_zarr_image_meta.json +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/meta/base_ome_zarr_image_meta_wrong_axis_order.json +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/meta/base_ome_zarr_label_meta.json +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/meta/base_ome_zarr_well_meta.json +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/data/v04/meta/ome_zarr_well_path_normalization_meta.json +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/common/test_pyramid.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/common/test_transforms.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/hcs/test_plate.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/hcs/test_well.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/images/test_create.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/images/test_masked_images.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/images/test_omezarr_container.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/images/test_table_ops.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/ome_zarr_meta/test_image_handler.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/ome_zarr_meta/test_unit_v04_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/tables/test_backends.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/tables/test_backends_utils.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/tables/test_feature_table.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/tables/test_generic_table.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/tables/test_masking_roi_table_v1.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/tables/test_roi_table_v1.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/tables/test_table_group.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/utils/test_download_datasets.py +0 -0
- {ngio-0.4.0a4 → ngio-0.4.0b1}/tests/unit/utils/test_zarr_utils.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Iterators API Reference
|
|
2
|
+
|
|
3
|
+
## ImageProcessingIterator
|
|
4
|
+
|
|
5
|
+
::: ngio.experimental.iterators.ImageProcessingIterator
|
|
6
|
+
|
|
7
|
+
## SegmentationIterator
|
|
8
|
+
|
|
9
|
+
::: ngio.experimental.iterators.SegmentationIterator
|
|
10
|
+
|
|
11
|
+
## MaskedSegmentationIterator
|
|
12
|
+
|
|
13
|
+
::: ngio.experimental.iterators.MaskedSegmentationIterator
|
|
14
|
+
|
|
15
|
+
## FeatureExtractorIterator
|
|
16
|
+
|
|
17
|
+
::: ngio.experimental.iterators.FeatureExtractorIterator
|
|
@@ -96,7 +96,7 @@ Once you have the `Image` object, you can access the image data as a:
|
|
|
96
96
|
The `get_as_*` can also be used to slice the image data, and query specific axes in specific orders:
|
|
97
97
|
|
|
98
98
|
```pycon exec="true" source="console" session="get_started"
|
|
99
|
-
>>> image_slice = image.get_as_numpy(
|
|
99
|
+
>>> image_slice = image.get_as_numpy(channel_selection="DAPI", x=slice(0, 128), axes_order=["t", "z", "y", "x", "c"]) # Get a specific channel and axes order
|
|
100
100
|
>>> image_slice.shape
|
|
101
101
|
>>> print(image_slice.shape) # markdown-exec: hide
|
|
102
102
|
```
|
|
@@ -113,14 +113,14 @@ A minimal example of how to use the `get_array` and `set_array` methods:
|
|
|
113
113
|
|
|
114
114
|
```python exec="true" source="material-block" session="get_started"
|
|
115
115
|
# Get the image data as a numpy array
|
|
116
|
-
data = image.get_as_numpy(
|
|
116
|
+
data = image.get_as_numpy(channel_selection="DAPI", x=slice(0, 128), y=slice(0, 128), axes_order=["z", "y", "x", "c"])
|
|
117
117
|
|
|
118
118
|
# Modify the image data
|
|
119
119
|
some_function = lambda x: x # markdown-exec: hide
|
|
120
120
|
data = some_function(data)
|
|
121
121
|
|
|
122
122
|
# Set the modified image data
|
|
123
|
-
image.set_array(data,
|
|
123
|
+
image.set_array(data, channel_selection="DAPI", x=slice(0, 128), y=slice(0, 128), axes_order=["z", "y", "x", "c"])
|
|
124
124
|
image.consolidate() # Consolidate the changes to all resolution levels, see below for more details
|
|
125
125
|
```
|
|
126
126
|
|
|
@@ -131,6 +131,17 @@ image.consolidate() # Consolidate the changes to all resolution levels, see belo
|
|
|
131
131
|
```
|
|
132
132
|
This will write the changes to the OME-Zarr file at all resolution levels.
|
|
133
133
|
|
|
134
|
+
### World coordinates slicing
|
|
135
|
+
|
|
136
|
+
To read or write a specific region of the image defined in world coordinates, you can use the `Roi` object.
|
|
137
|
+
|
|
138
|
+
```pycon exec="true" source="console" session="get_started"
|
|
139
|
+
>>> from ngio import Roi
|
|
140
|
+
>>> roi = Roi(x=34.1, y=10, x_length=321.6, y_length=330) # Define a ROI in world coordinates
|
|
141
|
+
>>> image.get_roi_as_numpy(roi) # Get the image data in the ROI as a numpy array
|
|
142
|
+
>>> print(image.get_roi_as_numpy(roi).shape) # markdown-exec: hide
|
|
143
|
+
```
|
|
144
|
+
|
|
134
145
|
## Labels
|
|
135
146
|
|
|
136
147
|
`Labels` represent segmentation masks that identify objects in the image. In ngio `Labels` are similar to `Images` and can
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# 6. Iterators
|
|
2
|
+
|
|
3
|
+
When building image processing pipelines it is often useful to iterate over specific regions of the image, for example to process the image in smaller tiles or to process only specific regions of interest (ROIs).
|
|
4
|
+
|
|
5
|
+
Moreover, when working with OME-Zarr Images it is often useful to set specific broadcasting rules for the iteration, for example to iterate over all z-planes or iterate over all timepoints.
|
|
6
|
+
|
|
7
|
+
Ngio provides a set of `Iterator` classes that can be used for this purpose. We provide iterators four basic iterators:
|
|
8
|
+
|
|
9
|
+
* The `SegmentationIterator` is designed to build segmentation pipelines, where an input image is processed to produce a segmentation mask. An example use case on how to use the `SegmentationIterator` can be found in the [Image Segmentation Tutorial](../tutorials/image_segmentation.ipynb).
|
|
10
|
+
* The `MaskedSegmentationIterator` is similar to the `SegmentationIterator`, but it uses a masking roi table to restrict the segmentation to masks. This is useful when you want to segment only specific regions of the image, for example, segmenting cells only within a specific tissue region. An example use case on how to use the `MaskedSegmentationIterator` can be found in the [Image Segmentation Tutorial](../tutorials/image_segmentation.ipynb).
|
|
11
|
+
* The `ImageProcessingIterator` is designed to build image processing pipelines, where an input image is processed to produce a new image. An example use case on how to use the `ImageProcessingIterator` can be found in the [Image Processing Tutorial](../tutorials/image_processing.ipynb).
|
|
12
|
+
* The `FeatureExtractionIterator` is read-only iterator designed to iterate over pairs of images and labels to extract features from the image based on the labels. An example use case on how to use the `FeatureExtractionIterator` can be found in the [Feature Extraction Tutorial](../tutorials/feature_extraction.ipynb).
|
|
13
|
+
|
|
14
|
+
A set of more complete example can be found in the [Fractal Tasks Template](https://github.com/fractal-analytics-platform/fractal-tasks-template).
|
|
@@ -17,11 +17,12 @@ Ngio's mission is to streamline working with OME-Zarr files by providing a simpl
|
|
|
17
17
|
|
|
18
18
|
- Extract and analyze specific regions of interest
|
|
19
19
|
- Tight integration with [Fractal's table framework](https://BioVisionCenter.github.io/fractal-tasks-core/tables/)
|
|
20
|
+
- Extensible & modular allowing users to define custom table schemas and on disk serialization
|
|
20
21
|
|
|
21
|
-
### 🔄 Scalable Data Processing
|
|
22
|
+
### 🔄 Scalable Data Processing
|
|
22
23
|
|
|
23
|
-
- Powerful iterators for
|
|
24
|
-
-
|
|
24
|
+
- Powerful iterators for building scalable and generalizable image processing pipelines
|
|
25
|
+
- Extensible mapping mechanism for custom parallelization strategies
|
|
25
26
|
|
|
26
27
|
## Getting Started
|
|
27
28
|
|
|
@@ -43,14 +44,14 @@ Currently, ngio only supports OME-Zarr v0.4. Support for version 0.5 and higher
|
|
|
43
44
|
- ✅ OME-Zarr metadata handling and validation
|
|
44
45
|
- ✅ Image and label access across pyramid levels
|
|
45
46
|
- ✅ ROI and table support
|
|
47
|
+
- ✅ Image processing iterators
|
|
46
48
|
- ✅ Streaming from remote sources
|
|
47
49
|
- ✅ Documentation and examples
|
|
48
50
|
|
|
49
51
|
### Upcoming Features
|
|
50
52
|
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
- Support for OME-Zarr v0.5 and Zarr v3
|
|
53
|
+
- Support for OME-Zarr v0.5 and Zarr v3 (via `zarr-python` v3)
|
|
54
|
+
- Enhanced performance optimizations (parallel iterators, optimized io strategies)
|
|
54
55
|
|
|
55
56
|
## Contributors
|
|
56
57
|
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"id": "3",
|
|
53
53
|
"metadata": {},
|
|
54
54
|
"source": [
|
|
55
|
-
"## Adding
|
|
55
|
+
"## Adding a ROI table to an OME-Zarr image\n",
|
|
56
56
|
"\n",
|
|
57
57
|
"Often, is useful to add ROIs to OME-Zarr images to be able to retrieve them later. \n",
|
|
58
58
|
"This can be done using the `ngio` library as follows."
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# Feature Extraction\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"This sections will cover how to extract regionprops features from an image using `ngio`, `skimage`. Moreover we will also write the features to a table in the ome-zarr container.\n",
|
|
10
|
+
"\n",
|
|
11
|
+
"# Step 1: Open the OME-Zarr Container"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
"cell_type": "code",
|
|
16
|
+
"execution_count": null,
|
|
17
|
+
"metadata": {},
|
|
18
|
+
"outputs": [],
|
|
19
|
+
"source": [
|
|
20
|
+
"import numpy as np\n",
|
|
21
|
+
"import pandas as pd\n",
|
|
22
|
+
"from skimage import measure\n",
|
|
23
|
+
"\n",
|
|
24
|
+
"\n",
|
|
25
|
+
"def extract_features(image: np.ndarray, label: np.ndarray) -> pd.DataFrame:\n",
|
|
26
|
+
" \"\"\"Basic feature extraction using skimage.measure.regionprops_table.\"\"\"\n",
|
|
27
|
+
" label = label.squeeze(-1) # Remove the channel axis if present\n",
|
|
28
|
+
" roi_feat_table = measure.regionprops_table(\n",
|
|
29
|
+
" label_image=label,\n",
|
|
30
|
+
" intensity_image=image,\n",
|
|
31
|
+
" properties=[\n",
|
|
32
|
+
" \"label\",\n",
|
|
33
|
+
" \"area\",\n",
|
|
34
|
+
" \"mean_intensity\",\n",
|
|
35
|
+
" \"max_intensity\",\n",
|
|
36
|
+
" \"min_intensity\",\n",
|
|
37
|
+
" ],\n",
|
|
38
|
+
" )\n",
|
|
39
|
+
" return pd.DataFrame(roi_feat_table)"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"cell_type": "code",
|
|
44
|
+
"execution_count": null,
|
|
45
|
+
"metadata": {},
|
|
46
|
+
"outputs": [],
|
|
47
|
+
"source": [
|
|
48
|
+
"from pathlib import Path\n",
|
|
49
|
+
"\n",
|
|
50
|
+
"from ngio import open_ome_zarr_container\n",
|
|
51
|
+
"from ngio.utils import download_ome_zarr_dataset\n",
|
|
52
|
+
"\n",
|
|
53
|
+
"# Download the dataset\n",
|
|
54
|
+
"download_dir = Path(\".\").absolute().parent.parent / \"data\"\n",
|
|
55
|
+
"hcs_path = download_ome_zarr_dataset(\"CardiomyocyteTinyMip\", download_dir=download_dir)\n",
|
|
56
|
+
"image_path = hcs_path / \"B\" / \"03\" / \"0\"\n",
|
|
57
|
+
"\n",
|
|
58
|
+
"# Open the ome-zarr container\n",
|
|
59
|
+
"ome_zarr = open_ome_zarr_container(image_path)"
|
|
60
|
+
]
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"cell_type": "markdown",
|
|
64
|
+
"metadata": {},
|
|
65
|
+
"source": [
|
|
66
|
+
"## Step 2: Setup the inputs"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"cell_type": "code",
|
|
71
|
+
"execution_count": null,
|
|
72
|
+
"metadata": {},
|
|
73
|
+
"outputs": [],
|
|
74
|
+
"source": [
|
|
75
|
+
"from ngio.transforms import ZoomTransform\n",
|
|
76
|
+
"\n",
|
|
77
|
+
"# First we will need the image object and the FOVs table\n",
|
|
78
|
+
"image = ome_zarr.get_image()\n",
|
|
79
|
+
"\n",
|
|
80
|
+
"# Get the nuclei label\n",
|
|
81
|
+
"nuclei = ome_zarr.get_label(\"nuclei\")\n",
|
|
82
|
+
"\n",
|
|
83
|
+
"# In this example we the image is available at an higher resolution than the nuclei\n",
|
|
84
|
+
"print(f\"Image dimensions: {image.dimensions}, pixel size: {image.pixel_size}\")\n",
|
|
85
|
+
"print(f\"Nuclei dimensions: {nuclei.dimensions}, pixel size: {nuclei.pixel_size}\")\n",
|
|
86
|
+
"\n",
|
|
87
|
+
"# We need to setup a transform to resample the nuclei to the image resolution\n",
|
|
88
|
+
"zoom_transform = ZoomTransform(\n",
|
|
89
|
+
" input_image=nuclei,\n",
|
|
90
|
+
" target_image=image,\n",
|
|
91
|
+
" order=\"nearest\", # Nearest neighbor interpolation for labels\n",
|
|
92
|
+
")"
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"cell_type": "markdown",
|
|
97
|
+
"metadata": {},
|
|
98
|
+
"source": [
|
|
99
|
+
"## Step 3: Use the FeatureExtractorIterator to create a feature table"
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"cell_type": "code",
|
|
104
|
+
"execution_count": null,
|
|
105
|
+
"metadata": {},
|
|
106
|
+
"outputs": [],
|
|
107
|
+
"source": [
|
|
108
|
+
"from ngio.experimental.iterators import FeatureExtractorIterator\n",
|
|
109
|
+
"from ngio.tables import FeatureTable\n",
|
|
110
|
+
"\n",
|
|
111
|
+
"iterator = FeatureExtractorIterator(\n",
|
|
112
|
+
" input_image=image,\n",
|
|
113
|
+
" input_label=nuclei,\n",
|
|
114
|
+
" label_transforms=[zoom_transform],\n",
|
|
115
|
+
" axes_order=[\"y\", \"x\", \"c\"],\n",
|
|
116
|
+
")\n",
|
|
117
|
+
"\n",
|
|
118
|
+
"feat_table = []\n",
|
|
119
|
+
"for image_data, label_data, roi in iterator.iter_as_numpy():\n",
|
|
120
|
+
" print(f\"Processing ROI: {roi}\")\n",
|
|
121
|
+
" roi_feat_table = extract_features(image=image_data, label=label_data)\n",
|
|
122
|
+
" feat_table.append(roi_feat_table)\n",
|
|
123
|
+
"\n",
|
|
124
|
+
"# Concatenate all the dataframes into a single one\n",
|
|
125
|
+
"feat_table = pd.concat(feat_table)\n",
|
|
126
|
+
"feat_table = FeatureTable(table_data=feat_table, reference_label=\"nuclei\")\n",
|
|
127
|
+
"ome_zarr.add_table(\"nuclei_regionprops\", feat_table)"
|
|
128
|
+
]
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"cell_type": "markdown",
|
|
132
|
+
"metadata": {},
|
|
133
|
+
"source": [
|
|
134
|
+
"### Sanity Check: Read the Table back"
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"cell_type": "code",
|
|
139
|
+
"execution_count": null,
|
|
140
|
+
"metadata": {},
|
|
141
|
+
"outputs": [],
|
|
142
|
+
"source": [
|
|
143
|
+
"ome_zarr.get_table(\"nuclei_regionprops\").lazy_frame.collect()"
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
],
|
|
147
|
+
"metadata": {
|
|
148
|
+
"kernelspec": {
|
|
149
|
+
"display_name": "dev",
|
|
150
|
+
"language": "python",
|
|
151
|
+
"name": "python3"
|
|
152
|
+
},
|
|
153
|
+
"language_info": {
|
|
154
|
+
"codemirror_mode": {
|
|
155
|
+
"name": "ipython",
|
|
156
|
+
"version": 3
|
|
157
|
+
},
|
|
158
|
+
"file_extension": ".py",
|
|
159
|
+
"mimetype": "text/x-python",
|
|
160
|
+
"name": "python",
|
|
161
|
+
"nbconvert_exporter": "python",
|
|
162
|
+
"pygments_lexer": "ipython3",
|
|
163
|
+
"version": "3.11.13"
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"nbformat": 4,
|
|
167
|
+
"nbformat_minor": 2
|
|
168
|
+
}
|
|
@@ -102,16 +102,6 @@
|
|
|
102
102
|
"print(test_plate)\n",
|
|
103
103
|
"print(f\"Rows: {test_plate.rows}, Columns: {test_plate.columns}\")"
|
|
104
104
|
]
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"cell_type": "markdown",
|
|
108
|
-
"metadata": {},
|
|
109
|
-
"source": []
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"cell_type": "markdown",
|
|
113
|
-
"metadata": {},
|
|
114
|
-
"source": []
|
|
115
105
|
}
|
|
116
106
|
],
|
|
117
107
|
"metadata": {
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"For this example we will apply gaussian blur to an image.\n",
|
|
12
12
|
"\n",
|
|
13
13
|
"\n",
|
|
14
|
-
"
|
|
14
|
+
"## Step 1: Setup\n",
|
|
15
15
|
"\n",
|
|
16
16
|
"We will first create a simple function to apply gaussian blur to an image. This function will take an image and a sigma value as input and return the blurred image."
|
|
17
17
|
]
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"cell_type": "markdown",
|
|
99
99
|
"metadata": {},
|
|
100
100
|
"source": [
|
|
101
|
-
"
|
|
101
|
+
"## Step 4: Apply the gaussian blur and consolidate the processed image"
|
|
102
102
|
]
|
|
103
103
|
},
|
|
104
104
|
{
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"cell_type": "markdown",
|
|
131
131
|
"metadata": {},
|
|
132
132
|
"source": [
|
|
133
|
-
"
|
|
133
|
+
"### Plot the results\n",
|
|
134
134
|
"\n",
|
|
135
135
|
"Finally, we can visualize the original and blurred images using `matplotlib`."
|
|
136
136
|
]
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
"cell_type": "markdown",
|
|
165
165
|
"metadata": {},
|
|
166
166
|
"source": [
|
|
167
|
-
"## Out of memory processing\n",
|
|
167
|
+
"## Step 5: Out of memory processing\n",
|
|
168
168
|
"\n",
|
|
169
169
|
"Sometimes we want to apply some simple processing to larger than memory images. In this case, we can use the `dask` library to process the image in chunks. In `ngio` we can simply query the data as a `dask` array and apply the desired processing function to it."
|
|
170
170
|
]
|
|
@@ -180,6 +180,9 @@
|
|
|
180
180
|
"\n",
|
|
181
181
|
"def dask_gaussian_blur(image: da.Array, sigma: float) -> da.Array:\n",
|
|
182
182
|
" \"\"\"Apply gaussian blur to a dask array.\"\"\"\n",
|
|
183
|
+
" # This will itroduce some edge artifacts at chunk boundaries\n",
|
|
184
|
+
" # In a real application, consider using map_overlap to mitigate this\n",
|
|
185
|
+
" # With appropriate depth based on sigma\n",
|
|
183
186
|
" return da.map_blocks(gaussian_blur, image, dtype=image.dtype, sigma=sigma)\n",
|
|
184
187
|
"\n",
|
|
185
188
|
"\n",
|
|
@@ -191,7 +194,53 @@
|
|
|
191
194
|
{
|
|
192
195
|
"cell_type": "markdown",
|
|
193
196
|
"metadata": {},
|
|
194
|
-
"source": [
|
|
197
|
+
"source": [
|
|
198
|
+
"## Step 6. Image Processing Iterators\n",
|
|
199
|
+
"\n",
|
|
200
|
+
"`ngio` provides an alternative way to process large images using iterators. This API is not meant to replace `dask` but to provide a simple way to iterate over arbitrary regions, moreover it provides a simple way to implement default broadcasting behaviors."
|
|
201
|
+
]
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"cell_type": "code",
|
|
205
|
+
"execution_count": null,
|
|
206
|
+
"metadata": {},
|
|
207
|
+
"outputs": [],
|
|
208
|
+
"source": [
|
|
209
|
+
"from ngio.experimental.iterators import ImageProcessingIterator\n",
|
|
210
|
+
"\n",
|
|
211
|
+
"iterator = ImageProcessingIterator(\n",
|
|
212
|
+
" input_image=image,\n",
|
|
213
|
+
" output_image=blurred_image,\n",
|
|
214
|
+
" axes_order=[\"c\", \"z\", \"y\", \"x\"],\n",
|
|
215
|
+
")\n",
|
|
216
|
+
"\n",
|
|
217
|
+
"# After initializing the iterator, the iterator will have created\n",
|
|
218
|
+
"# will iterate over the entire image.\n",
|
|
219
|
+
"print(f\"Iterator after initialization: {iterator}\")\n",
|
|
220
|
+
"\n",
|
|
221
|
+
"# Iterate over an arbitrary region of interest table\n",
|
|
222
|
+
"# We can use the product method that performs a cartesian product\n",
|
|
223
|
+
"# between the iterator and the table.\n",
|
|
224
|
+
"table = ome_zarr.get_roi_table(\"FOV_ROI_table\")\n",
|
|
225
|
+
"iterator = iterator.product(table)\n",
|
|
226
|
+
"print(f\"Iterator after product with table: {iterator}\")\n",
|
|
227
|
+
"\n",
|
|
228
|
+
"# We can explicitly set a broadcasting behavior\n",
|
|
229
|
+
"# For example we can iterate over all zyx planes, and broadcast all the other\n",
|
|
230
|
+
"# spatial dimensions\n",
|
|
231
|
+
"iterator = iterator.by_zyx()\n",
|
|
232
|
+
"\n",
|
|
233
|
+
"# Finally (if needed) we can check if the regions are not-overlapping\n",
|
|
234
|
+
"iterator.require_no_regions_overlap()\n",
|
|
235
|
+
"# We can also check if the regions lay on non-overlapping chunks\n",
|
|
236
|
+
"iterator.require_no_chunks_overlap()\n",
|
|
237
|
+
"\n",
|
|
238
|
+
"# Now we can map the gaussian blur function to the iterator\n",
|
|
239
|
+
"iterator.map_as_numpy(lambda x: gaussian_blur(x, sigma=sigma))\n",
|
|
240
|
+
"\n",
|
|
241
|
+
"# No need to consolidate, the iterator takes care of that\n",
|
|
242
|
+
"# after all the regions have been processed"
|
|
243
|
+
]
|
|
195
244
|
}
|
|
196
245
|
],
|
|
197
246
|
"metadata": {
|
|
@@ -76,6 +76,8 @@
|
|
|
76
76
|
"metadata": {},
|
|
77
77
|
"outputs": [],
|
|
78
78
|
"source": [
|
|
79
|
+
"from ngio.experimental.iterators import SegmentationIterator\n",
|
|
80
|
+
"\n",
|
|
79
81
|
"# First we will need the image object and the FOVs table\n",
|
|
80
82
|
"image = ome_zarr.get_image()\n",
|
|
81
83
|
"roi_table = ome_zarr.get_roi_table(\"FOV_ROI_table\")\n",
|
|
@@ -84,30 +86,36 @@
|
|
|
84
86
|
"\n",
|
|
85
87
|
"label = ome_zarr.derive_label(\"new_label\", overwrite=True)\n",
|
|
86
88
|
"\n",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
89
|
+
"# Setup the segmentation iterator\n",
|
|
90
|
+
"seg_iterator = SegmentationIterator(\n",
|
|
91
|
+
" input_image=image,\n",
|
|
92
|
+
" output_label=label,\n",
|
|
93
|
+
" channel_selection=\"DAPI\",\n",
|
|
94
|
+
" axes_order=[\"z\", \"y\", \"x\"],\n",
|
|
95
|
+
")\n",
|
|
96
|
+
"seg_iterator = seg_iterator.product(roi_table)\n",
|
|
97
|
+
"\n",
|
|
98
|
+
"# Make sure that if other axes are present they are iterated over\n",
|
|
99
|
+
"seg_iterator = seg_iterator.by_zyx()\n",
|
|
91
100
|
"\n",
|
|
101
|
+
"max_label = 0 # We will use this to avoid label collisions\n",
|
|
102
|
+
"for image_data, label_writer in seg_iterator.iter_as_numpy():\n",
|
|
92
103
|
" roi_segmentation = otsu_threshold_segmentation(\n",
|
|
93
104
|
" image_data, max_label\n",
|
|
94
105
|
" ) # Segment the image\n",
|
|
95
106
|
"\n",
|
|
96
107
|
" max_label = roi_segmentation.max() # Get the max label for the next iteration\n",
|
|
97
108
|
"\n",
|
|
98
|
-
" label
|
|
99
|
-
"
|
|
100
|
-
"
|
|
109
|
+
" label_writer(patch=roi_segmentation) # Write the segmentation back to the label\n",
|
|
110
|
+
"\n",
|
|
111
|
+
"# No need to consolidate, the iterator does it automatically after the last write"
|
|
101
112
|
]
|
|
102
113
|
},
|
|
103
114
|
{
|
|
104
115
|
"cell_type": "markdown",
|
|
105
116
|
"metadata": {},
|
|
106
117
|
"source": [
|
|
107
|
-
"
|
|
108
|
-
"\n",
|
|
109
|
-
"The `new_label` has data only at a single resolution lebel. To consolidate the segmentation to all other levels we will \n",
|
|
110
|
-
"need to call the `consolidate` method."
|
|
118
|
+
"### Plot the segmentation"
|
|
111
119
|
]
|
|
112
120
|
},
|
|
113
121
|
{
|
|
@@ -116,14 +124,100 @@
|
|
|
116
124
|
"metadata": {},
|
|
117
125
|
"outputs": [],
|
|
118
126
|
"source": [
|
|
119
|
-
"
|
|
127
|
+
"import matplotlib.pyplot as plt\n",
|
|
128
|
+
"import numpy as np\n",
|
|
129
|
+
"from matplotlib.colors import ListedColormap\n",
|
|
130
|
+
"\n",
|
|
131
|
+
"rand_cmap = np.random.rand(1000, 3)\n",
|
|
132
|
+
"rand_cmap[0] = 0\n",
|
|
133
|
+
"rand_cmap = ListedColormap(rand_cmap)\n",
|
|
134
|
+
"\n",
|
|
135
|
+
"fig, axs = plt.subplots(2, 1, figsize=(8, 4))\n",
|
|
136
|
+
"axs[0].set_title(\"Original image\")\n",
|
|
137
|
+
"axs[0].imshow(image.get_as_numpy(c=0, z=1, axes_order=[\"y\", \"x\"]), cmap=\"gray\")\n",
|
|
138
|
+
"axs[1].set_title(\"Final segmentation\")\n",
|
|
139
|
+
"axs[1].imshow(label.get_as_numpy(z=1, axes_order=[\"y\", \"x\"]), cmap=rand_cmap)\n",
|
|
140
|
+
"for ax in axs:\n",
|
|
141
|
+
" ax.axis(\"off\")\n",
|
|
142
|
+
"plt.tight_layout()\n",
|
|
143
|
+
"plt.show()"
|
|
120
144
|
]
|
|
121
145
|
},
|
|
122
146
|
{
|
|
123
147
|
"cell_type": "markdown",
|
|
124
148
|
"metadata": {},
|
|
125
149
|
"source": [
|
|
126
|
-
"##
|
|
150
|
+
"## Step 4: Masked image segmentation\n",
|
|
151
|
+
"\n",
|
|
152
|
+
"In this example we will use a mask to restrict the segmentation to certain areas of the image.\n",
|
|
153
|
+
"In this case we will create a simple mask for illustration purposes, but in a real case scenario the mask could come\n",
|
|
154
|
+
"from another segmentation mask."
|
|
155
|
+
]
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"cell_type": "code",
|
|
159
|
+
"execution_count": null,
|
|
160
|
+
"metadata": {},
|
|
161
|
+
"outputs": [],
|
|
162
|
+
"source": [
|
|
163
|
+
"# Create a basic mask for illustration purposes\n",
|
|
164
|
+
"mask = ome_zarr.derive_label(\"mask\", overwrite=True)\n",
|
|
165
|
+
"mask_data = mask.get_as_numpy(axes_order=[\"z\", \"y\", \"x\"])\n",
|
|
166
|
+
"mask_data[:, 200:-200, 500:2000] = 1\n",
|
|
167
|
+
"mask_data[:, 200:-200, 3000:-500] = 2\n",
|
|
168
|
+
"mask_data[:, 600:-600, 1200:-1000] = 0\n",
|
|
169
|
+
"mask_data[:, 700:-700, 1600:-1500] = 3\n",
|
|
170
|
+
"mask.set_array(mask_data, axes_order=[\"z\", \"y\", \"x\"])\n",
|
|
171
|
+
"mask.consolidate()\n",
|
|
172
|
+
"\n",
|
|
173
|
+
"fig, axs = plt.subplots(2, 1, figsize=(8, 4))\n",
|
|
174
|
+
"axs[0].set_title(\"Original image\")\n",
|
|
175
|
+
"axs[0].imshow(image.get_as_numpy(c=0, z=1, axes_order=[\"y\", \"x\"]), cmap=\"gray\")\n",
|
|
176
|
+
"axs[1].set_title(\"Mask\")\n",
|
|
177
|
+
"axs[1].imshow(mask.get_as_numpy(z=1, axes_order=[\"y\", \"x\"]), cmap=rand_cmap)\n",
|
|
178
|
+
"for ax in axs:\n",
|
|
179
|
+
" ax.axis(\"off\")\n",
|
|
180
|
+
"plt.tight_layout()\n",
|
|
181
|
+
"plt.show()"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"cell_type": "code",
|
|
186
|
+
"execution_count": null,
|
|
187
|
+
"metadata": {},
|
|
188
|
+
"outputs": [],
|
|
189
|
+
"source": [
|
|
190
|
+
"from ngio.experimental.iterators import MaskedSegmentationIterator\n",
|
|
191
|
+
"\n",
|
|
192
|
+
"# First we will need the masked image object\n",
|
|
193
|
+
"# (that contains the masking table information inside)\n",
|
|
194
|
+
"image = ome_zarr.get_masked_image(masking_label_name=\"mask\")\n",
|
|
195
|
+
"\n",
|
|
196
|
+
"# Second we need to derive a new label image to use as target for the segmentation\n",
|
|
197
|
+
"label = ome_zarr.derive_label(\"masked_new_label\", overwrite=True)\n",
|
|
198
|
+
"\n",
|
|
199
|
+
"# Setup the masked segmentation iterator\n",
|
|
200
|
+
"seg_iterator = MaskedSegmentationIterator(\n",
|
|
201
|
+
" input_image=image,\n",
|
|
202
|
+
" output_label=label,\n",
|
|
203
|
+
" channel_selection=\"DAPI\",\n",
|
|
204
|
+
" axes_order=[\"z\", \"y\", \"x\"],\n",
|
|
205
|
+
")\n",
|
|
206
|
+
"\n",
|
|
207
|
+
"# Make sure that if other axes are present they are iterated over\n",
|
|
208
|
+
"seg_iterator = seg_iterator.by_zyx()\n",
|
|
209
|
+
"\n",
|
|
210
|
+
"max_label = 0 # We will use this to avoid label collisions\n",
|
|
211
|
+
"for image_data, label_writer in seg_iterator.iter_as_numpy():\n",
|
|
212
|
+
" roi_segmentation = otsu_threshold_segmentation(\n",
|
|
213
|
+
" image_data, max_label\n",
|
|
214
|
+
" ) # Segment the image\n",
|
|
215
|
+
"\n",
|
|
216
|
+
" max_label = roi_segmentation.max() # Get the max label for the next iteration\n",
|
|
217
|
+
"\n",
|
|
218
|
+
" label_writer(patch=roi_segmentation) # Write the segmentation back to the label\n",
|
|
219
|
+
"\n",
|
|
220
|
+
"# No need to consolidate, the iterator does it automatically after the last write"
|
|
127
221
|
]
|
|
128
222
|
},
|
|
129
223
|
{
|
|
@@ -136,10 +230,6 @@
|
|
|
136
230
|
"import numpy as np\n",
|
|
137
231
|
"from matplotlib.colors import ListedColormap\n",
|
|
138
232
|
"\n",
|
|
139
|
-
"rand_cmap = np.random.rand(1000, 3)\n",
|
|
140
|
-
"rand_cmap[0] = 0\n",
|
|
141
|
-
"rand_cmap = ListedColormap(rand_cmap)\n",
|
|
142
|
-
"\n",
|
|
143
233
|
"fig, axs = plt.subplots(2, 1, figsize=(8, 4))\n",
|
|
144
234
|
"axs[0].set_title(\"Original image\")\n",
|
|
145
235
|
"axs[0].imshow(image.get_as_numpy(c=0, z=1, axes_order=[\"y\", \"x\"]), cmap=\"gray\")\n",
|
|
@@ -112,6 +112,7 @@ nav:
|
|
|
112
112
|
- getting_started/3_tables.md
|
|
113
113
|
- getting_started/4_masked_images.md
|
|
114
114
|
- getting_started/5_hcs.md
|
|
115
|
+
- getting_started/6_iterators.md
|
|
115
116
|
|
|
116
117
|
- Tutorials:
|
|
117
118
|
- tutorials/create_ome_zarr.ipynb
|
|
@@ -136,13 +137,17 @@ nav:
|
|
|
136
137
|
- "Images": api/images.md
|
|
137
138
|
- "HCS": api/hcs.md
|
|
138
139
|
- "Tables": api/tables.md
|
|
140
|
+
- "Iterators": api/iterators.md
|
|
139
141
|
- "ngio":
|
|
140
142
|
- "ngio": api/ngio/ngio.md
|
|
143
|
+
- "ngio.common": api/ngio/common.md
|
|
144
|
+
- "ngio.io_pipes": api/ngio/io_pipes.md
|
|
145
|
+
- "ngio.iterators": api/ngio/iterators.md
|
|
141
146
|
- "ngio.images": api/ngio/images.md
|
|
142
147
|
- "ngio.tables": api/ngio/tables.md
|
|
143
148
|
- "ngio.hcs": api/ngio/hcs.md
|
|
149
|
+
- "ngio.transforms": api/ngio/transforms.md
|
|
144
150
|
- "ngio.utils": api/ngio/utils.md
|
|
145
|
-
- "ngio.common": api/ngio/common.md
|
|
146
151
|
- changelog.md
|
|
147
152
|
|
|
148
153
|
- Contributing:
|