Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: SyN landmarks. #413

Merged
merged 2 commits into from
Nov 18, 2022
Merged

WIP: SyN landmarks. #413

merged 2 commits into from
Nov 18, 2022

Conversation

ntustison
Copy link
Member

@ntustison ntustison commented Nov 18, 2022

Hey @stnava , can you check this when you have some time? Below is a toy example I've been using. Note that the return value is a list of transforms with transforms[0] being the forward transform and transforms[1] being the reverse transform.

import ants
import numpy as np
domain_image = ants.image_read(ants.get_ants_data("r16"))
grid = ants.create_warped_grid(domain_image, grid_directions=(True, True))

fixed = np.array([[50.0,50.0],[200.0,50.0],[50.0,200.0]])
moving = np.array([[75.0,75.0],[175.0,75.0],[75.0,175.0]])
xfrms = ants.fit_transform_to_paired_points(moving, fixed, transform_type="syn", domain_image=domain_image, 
                 mesh_size=10, number_of_fitting_levels=6, number_of_compositions=100, composition_step_size=0.1)
warped_grid = xfrms[0].apply_to_image(grid)
ants.plot(warped_grid)
warped_grid = xfrms[1].apply_to_image(grid)
ants.plot(warped_grid)

@stnava
Copy link
Member

stnava commented Nov 18, 2022

looks good - here is the example I used as a grad student:

fixed = np.array([[50.0,50.0],[200.0,50.0],[200.0,200.0]])
moving = np.array([[50.0,50.0],[50.0,200.0],[200.0,200.0]])

@stnava
Copy link
Member

stnava commented Nov 18, 2022

my example "breaks" the inversion .... it used to work with the "uni-directional" option ie with what was called "diffeo" ... I think "diffeo" is now broken.

since you are working on this, I would like to request a

fwd, inv = ants.integrate_velocity_field( field, time_step  )

function ... that will let us do very related things but with direct optimization of the flow field .... I also think it will perform better for these types of cases ... although this example is an extreme case, it would be nice to have something that worked for it.

@ntustison
Copy link
Member Author

Great idea, @stnava. I'll work on that.

So I'll merge this since it appears to be working. Also, I discovered the "brokenness" of the diffeo option earlier and it's included in this merge. Once you update, let me know if it's fixed or if I need to dig further.

@ntustison ntustison merged commit 69ab00a into master Nov 18, 2022
@ntustison ntustison deleted the synlandmarks branch November 18, 2022 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants