MathOnco / valis

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

register 3d images (X,Y,Z) and register from various objectives (x20 /x63) ? #133

Open Nal44 opened 1 week ago

Nal44 commented 1 week ago

Hi,

I have a set of IF multiplex that I want to register but they are X.Y.Z (3D volume) , Using the code you sent me before (using the ch00 then match to all other channels with the same name) can I use the code or modify it to work with 3D images ?

Thanks a lot, Antho

PS: also can I use valis to register images acquired from different objectives (x20 and x63) ? so scaling up/down before registering ?

Thanks

cdgatenbee commented 6 days ago

Hi @Nal44, Could you tell me a bit more about how the data is structured? Are you wanting to align several 3D volumes, each in a different file (i.e. each file has several Z planes)? Is a set of images, where each is a single Z-plane? Is everything in 1 file, but needs to be aligned a bit better? Regardless, I think that there should be some way to align 3D IF images.

Best,

Nal44 commented 6 days ago

Hi Chandler,

The first set is composed of several files 3D volumes (X,Y,Z), such as 5 individuals tif files (5 rounds per ROI) with 4 channels each (DAPI, beads, marker 1, marker 2). So each file as: 4 channels Z,X,Z (12 planes approx.), so need to align all rounds to let's say to the DAPI channel (00), then apply the transform to other channels per round.

The cells shifted slightly between the rounds since it was acquired using multiple ROIS...

For the other set, I have a 2d image (low mag ) and a higher one (x63 oil) on similar ROI.

The idea is to register the 2d image (lower magnification ) onto the 3D image (higher magnification), then save as a OME.TIFF with 5 channels aligned (3d as 3 channels + 2d (dapi+marker) =5 channels total).

Hence, it needs to be scaled then registered , so I can use a segmentation algorithm the get the masks on the 3D image and the registered 2d image and cross all markers for quantification .

Let me know if this is clear or need more explanation, Thanks a lot, Antho

cdgatenbee commented 4 days ago

Hi @Nal44, While it may be a little tricky, I think this should be possible. In the first case, if the individual planes within each volume do not need to be aligned, then it should be possible to align the DAPI channel in last plane of volume 1 to the DAPI channel in first plane volume 2, then last DAPI in volume 2 to first DAPI in volume 3, etc... If this sounds like what you had in mind, let me know, and I can try to put together some code. Even better would be if you could share a few images (at least 3, and they could be lower resolution), which would be very helpful in developing the code, since I don't have any images/volumes like this.

For the second set of images. I think what you would want to do is make the 3D image your reference image (Valis(reference_img_f="path/to/3D_volume")), so that the 2D image will be aligned to it. Since the 2D image is the one being warped, it should get scaled up to the same size as the 3D one. During the registration, both images will be rescaled to have similar sizes, so any differences in resolution in the full scale images shouldn't be an issue. So, for this dataset, maybe try that approach and let me know how it goes.

Best, -Chandler

Nal44 commented 4 days ago

Hi Chandler,

Thanks a lot, I don't think it will since the first and last planes are out of focus in generally when we do Z stack acquisitions, hence the middle plane might work better (focus plane).

The way I did was to take the first Serie, segment the nucleus in 3d, then use this mask to manually align the other series to the first (translations/rotations) and applied the the same operations to the corresponding channels for each round (not very effective). The result is ok, but not perfect as expected.

These images are from collaborators, hence I will check first with them if I can share them (these are cells it should be ok I believe).

For the second point I will try next week , I got delayed with too much work this week, Thanks a lot ;D. antho

Nal44 commented 4 days ago

Hi Chandler,

Files are uploading now. there are 5 files from one F02. The task is to align r2,r3r,4,r5 to R1 (all channels ) , files are X,Y,Z 4 channels.

Please let me know once received.

thanks a lot for the help /support ! Antho

cdgatenbee commented 22 hours ago

Hi @Nal44, Just wanted to let you know that I was able to download the images (thanks for sharing!). Also, thank you for letting me know that using the middle plane may be best, which should actually be easier than trying to use the first or last plane. There are a few small things I need to take care of, but I'll get to this asap, and will let you know how it goes.

Best, -Chandler

Nal44 commented 18 hours ago

Hi Chandler,

No probs, thank you for helping out ; D

Please let me know, antho