wsireg icon indicating copy to clipboard operation
wsireg copied to clipboard

Output resolution is not respected

Open leorrose opened this issue 1 year ago • 2 comments

  • wsireg version: 0.3.8
  • Python version: 3.10.13
  • Operating System: Windows

Description

When trying to register 3 imaging modalities i want the output resolution to be 1 micron. I state the output_res=1.0 for all modalities but it is not respected for the target modality and it has its original resolution.

What I Did

from wsireg.wsireg2d import WsiReg2D

reg_graph = WsiReg2D("rigid", "./test_reg")

reg_graph.add_modality(
    "modality_1", "./sample_data/mod_1/img.ome.tiff", image_res=0.221,
    preprocessing={"image_type": "BF"}, output_res=1.0
)

reg_graph.add_modality(
    "modality_2", "./sample_data/mod_2/img.ome.tiff", image_res=1.0,
    preprocessing={"image_type": "BF"}, output_res=1.0
)

reg_graph.add_modality(
    "modality_3", "./sample_data/mod_3/img.ome.tiff", image_res=1.6718,
    preprocessing={"image_type": "BF"}, output_res=1.0
)

reg_graph.add_reg_path(
    "modality_2",
    "modality_1",
    thru_modality=None,
    reg_params=["rigid"],
)

reg_graph.add_reg_path(
    "modality_3",
    "modality_1",
    thru_modality=None,
    reg_params=["rigid"],
)

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

leorrose avatar Feb 22 '24 10:02 leorrose

@NHPatterson Just adding a few more details.

This is how it looks when opening the images after registration in Napari:

image

I've also uploaded the sample data I used to the attached OneDrive link (due its size) if you want to play with it and figure why this happens.

leorrose avatar Apr 01 '24 11:04 leorrose

This issue is solved if I add downsampling to modality_1 when calling add_modality:

reg_graph.add_modality(
    "modality_1", "./sample_data/mod_1/img.ome.tiff", image_res=0.221,
    preprocessing={"image_type": "BF", 'downsampling': 2}, output_res=1.0
)

image

But if I add attachments (geojson) this doesn't solve the issue for example:

reg_graph.add_attachment_shapes(
    'modality_1', 'mod_1-annotations', './sample_data/mod_1/annotations.geojson'
)

image

leorrose avatar Apr 01 '24 11:04 leorrose