jlevy44 / PathFlow-MixMatch

Don't mix, match! Simple utilities for improved registration of Histopathology Whole Slide Images.
10 stars 6 forks source link

How to get the transformation matrix? #24

Open gmh1033286494 opened 3 years ago

gmh1033286494 commented 3 years ago

Hi, I'm trying to do the image registration for large WSI on the lower level which is faster. Then, I want to apply the transformation matrix back to Level 1 in order to registrar the original WSI. So how can I get the transformation matrix after I've done the registration. Thank you very much. Looking forward to your advice.

jlevy44 commented 3 years ago

Hey sorry to have missed this issue; I believe you're looking for this, yes? https://github.com/jlevy44/PathFlow-MixMatch/blob/master/pathflow_mixmatch/cli.py#L198

gmh1033286494 commented 3 years ago

Hey sorry to have missed this issue; I believe you're looking for this, yes? https://github.com/jlevy44/PathFlow-MixMatch/blob/master/pathflow_mixmatch/cli.py#L198

I think I got the matrix by letting the def affine_register return the transformation.transformationmatrix. I don't know whether I did it right. I am trying to apply this matrix to the level 0 of my original WSI. What I am working on is to perform image registration with 2 80000*120000 size WSI. Now I can only use pathflow-mixmatch with --no segement analysis True_. If I turn it off, it will show error: n_components=4 must be between 0 and min(n_samples, n_features)=2 with svd_solver='full'. According to your code I think with --no segement analysis False, there will be some difference on the results and the proccessing speed. I am now using level 5 5000*7000 size with iterration 1000. This will take about 5 minutes with GPU. I am just wondering I can use a larger level and spend less time with --no segement analysis False

jlevy44 commented 3 years ago

..If the image is from #26 , you'll probably want to run it with no_segment_analysis set to true... You could also think about downsampling the image, extracting the transformation matrix and/or transformation parameters, then upsampling the displacement field or applying the parameters on the entire matrix, but this would be for a coarse alignment. The nonlinear deformations allow for pyramidal upsampling of the displacement so as to fine-tune them though requires particular attention to the upsampling and kernel parameters