MathOnco / valis

Virtual Alignment of pathoLogy Image Series
https://valis.readthedocs.io/en/latest/
MIT License
119 stars 29 forks source link

Error with registration when I use a cropped version of the image #136

Open msberges opened 3 months ago

msberges commented 3 months ago

Normally I am working with images that have the same cellular tissue two or more times. The problem I have is that the medical notes are only in one of them.

image

Sometimes when I do the registration it is registered with another of the cellular tissues where there are no annotations, so when I transfer them from one image to another it does not do it well.

For this reason, one way to solve it is to crop the original image with only the cellular tissue of interest (a roi).

image (I know that some annotations are missing in this example, it is for another reason and it should not affect the register)

But when doing this the normal registration has stopped working in most cases.

VH23B003503A00100_non_rigid_overlap 0_VH23B003503A001002 1_VH23B003503A001004 VH23B003503A001004 VH23B003503A001002

I do not understand what is happening. When there were two cellular tissues, the record was done well but just with the one that had no annotations, but when there is only one, the record goes terribly wrong.

Anyone know what might be happening? Could cropping the image have affected the registration in any way?

cdgatenbee commented 3 months ago

Hi @msberges,

Sorry you're running into this issue, but could you please clarify a few things for me?

I think this extra info will help narrow down what's going wrong here.

Best, -Chandler

msberges commented 3 months ago

What I mean is that, as seen in the first image, I have many mrxs files that when opened with qupath have the same tissue repeated 2, 3 or 4 times (it is the same cellular tissue, but not exactly the same photo) . This only happens to me with the HE stain, not with the HER2, KI67, etc. stains.

Another example: HE stain: image RE stain: image

As can also be seen in the image of the first comment, the annotations are only in one of the cellular tissues (in this case in the one below). image

If I ask the program to register the images, sometimes the image in HER2, KI67... will overlap with the tissue above, the one that has no annotations. Therefore, when transferring them, the program will do it wrong.

For this reason I crop the images to only keep the cellular tissue that has the annotations. The problem is that by having one image cropped and the other not, the low quality versions used in the registry have the tissue area with a very different resolution. That's why in processed images, the uncropped image looks so blocky compared to the cropped one.

The solution I found for this problem, to always ensure a good register, is to crop the two ROIs in both images and adjust the annotations at each step. Here an example of hat I did: From the original source image to the cropped source image: Crop_con todas las anotaciones por el npArray From the cropped source image to the cropped target image: Traspaso de annotaciones entre 2 imagenes cropeadas From the cropped target image to the original target image: traspaso de anotaciones entre la target recortada y la original

This is the solution that I have found and it works very well, although it is probably not the most efficient.