Closed grst closed 1 year ago
Hi Gregor,
I think your registration worked fine, I was able to do it on my end. There are just issues with the various software you have used to view the images.
Opening with napari fails
This is because the standard wsireg output is a pyramid OME-TIFF (even for small images) which the tiff readers of napari likely don't understand.
Zeiss ZEN fails
Likewise, Zeiss ZEN doesn't understand this format.
The images open fine in QuPath and if you read them as numpy arrays, you can open them in napari. Below extends your current script and shows how to open the images in napari
. There are some additional things you can do if you are working with WSIs to open image pyramids in napari.
from wsireg import WsiReg2D
import napari
from tifffile import imread
img0_fp = "/Users/nhp/Downloads/input_images/img0.tif"
img1_fp = "/Users/nhp/Downloads/input_images/img1.tif"
out_dir = "/Users/nhp/Downloads/input_images"
# initialize registration graph
reg_graph = WsiReg2D("my_reg_project", out_dir)
reg_graph.add_modality(
"img0",
img0_fp,
preprocessing={
"image_type": "BF",
"as_uint8": True,
"invert_intensity": True,
},
)
reg_graph.add_modality(
"img1",
img1_fp,
preprocessing={
"image_type": "BF",
"as_uint8": True,
"invert_intensity": True,
},
)
reg_graph.add_reg_path(
"img0",
"img1",
thru_modality=None,
reg_params=[
"rigid",
"affine",
# "nl",
],
)
reg_graph.register_images()
reg_graph.save_transformations()
out_images = reg_graph.transform_images(file_writer="ome.tiff")
# read in transformed image and original target image
img0_tformed = imread(out_images[0])
img1 = imread(img1_fp)
viewer = napari.Viewer()
viewer.add_image(img0_tformed, rgb=True)
viewer.add_image(img1, rgb=True)
https://github.com/NHPatterson/wsireg/assets/17855764/b3c61644-f29b-40cd-9c43-3def32291dc7
All the best, Heath
Hi Heath,
thank you so much for your quick response! This works for me :)
Cheers, Gregor
Description
I am trying to register these two images, following the tutorial.
When saving the aligned images with
transform_images()
, the generated outputome.tiff
file is corrupted. Opening with napari fails, when I open it in Zeiss ZEN it looks like this:As a side, the function docstring suggest that images can be saved to
zarr
by specifyingfile_writer="zarr"
, but this doesn't work and the source code suggests this is not implemented.What I Did
The input images are available here: input_images.zip