NHPatterson / wsireg

multimodal whole slide image registration in a graph structure
MIT License
78 stars 8 forks source link

Alt text

Multi-modal whole slide image registration

Python Version PyPI version testpage Actions Status Code style: black Documentation Status

wsireg performs multi-modal or mono-modal whole slide image registration in a graph structure for complex registration tasks using elastix. For detailed introduction and installation and usage instructions see the docs.

Features

Installation

Install cross-platform Python packages with pip:

pip install wsireg

Usage

For detailed usage, see usage sections in documents, see documentation.

Example registering two images.

from wsireg.wsireg2d import WsiReg2D

# initialize registration graph
reg_graph = WsiReg2D("my_reg_project", "./project_folder")

# add registration images (modalities)
reg_graph.add_modality(
    "modality_fluo",
    "./data/im1.tiff",
    image_res=0.65,
    channel_names=["DAPI", "eGFP", "DsRed"],
    channel_colors=["blue", "green", "red"],
    preprocessing={
        "image_type": "FL",
        "ch_indices": [1],
        "as_uint8": True,
        "contrast_enhance": True,
    },
)

reg_graph.add_modality(
    "modality_brightfield",
    "./data/im2.tiff",
    image_res=1,
    preprocessing={"image_type": "BF", "as_uint8": True, "invert_intensity": True},
)

reg_graph.add_reg_path(
    "modality_fluo",
    "modality_brightfield",
    thru_modality=None,
    reg_params=["rigid", "affine"],
)

reg_graph.register_images()
reg_graph.save_transformations()
reg_graph.transform_images(file_writer="ome.tiff")

This will register the images and save them in the project output directory as tiled, pyramidal OME-TIFF. Original data types are respected for images.

Future support