NHPatterson / wsireg

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

GeoJSON parsing error in Qupath for files after applying registration #71

Open leorrose opened 7 months ago

leorrose commented 7 months ago

Description

When trying to register 3 imaging modalities with attachments (geojson) some of them are not readable in Qupath after the registration but are readable before registration.

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_attachment_shapes(
    'modality_1', 'mod_1-annotations', './sample_data/mod_1/annotations.geojson'
)

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_attachment_shapes(
    'modality_2', 'mod_2-vds', './sample_data/mod_2/vds.geojson'
)

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_attachment_shapes(
    'modality_3', 'mod_3-vds', './sample_data/mod_3/vds.geojson'
)

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_shapes()
reg_graph.transform_images(file_writer="ome.tiff")

The sample data i used can be found in this OneDrive link (due its size) if you want to play with it and figure why this happens. For example the vds.geojson in mod_2 is readable before but not after.