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

Problem with compose-dofs and approximate option #782

Open
iimog opened this issue Aug 5, 2022 · 0 comments
Open

Problem with compose-dofs and approximate option #782

iimog opened this issue Aug 5, 2022 · 0 comments

Comments

@iimog
Copy link

iimog commented Aug 5, 2022

When I try to compose two dof files with the -approximate option, the result is not as expected. Attached are all the files from this short reproducible example.
compose-dofs-reprex.zip

mirtk register im1.nii.gz im2.nii.gz -parin my.cfg -dofout 1_to_2.dof.gz
mirtk register im2.nii.gz im3.nii.gz -parin my.cfg -dofout 2_to_3.dof.gz
mirtk compose-dofs 1_to_2.dof.gz 2_to_3.dof.gz 1_to_3.dof.gz
mirtk compose-dofs 1_to_2.dof.gz 2_to_3.dof.gz 1_to_3_appr.dof.gz -approximate

While the first two dof files have a "control point lattice" of 29x29 and the 1_to_3.dof.gz contains both transformations, the 1_to_3_appr.dof.gz has just a single transformation with a lattice of 1x1. Also, applying transform-image on im1.nii.gz with the 1_to_3.dof.gz has the intended result while applying it with 1_to_3_appr.dof.gz has almost no effect.

As I need a dof file with a single transformation inside, I use

mirtk convert-dof 1_to_3.dof.gz 1_to_3_single.dof.gz

This works as intended.

I think, this problem has previously been reported on Gitter by @karllandheer on Feb 19 2021 22:14

I'm using the latest version of mirtk, compiled today (mirtk rev 973ce2f, built on Aug 5 2022)

Outputs of `mirtk info`
❯ mirtk info 1_to_2.dof.gz 
Multi-level FFD:
  Global transformation:
    tx  =   0.0000  ty  =   0.0000  tz  =   0.0000
    rx  =   0.0000  ry  =   0.0000  rz  =   0.0000
    sx  = 100.0000  sy  = 100.0000  sz  = 100.0000  
    sxy =   0.0000  syz =   0.0000  sxz =   0.0000  
  Local transformation (passive):
    3D B-spline FFD:
      Number of DOFs:          2523
      Number of CPs (active):  441
      Number of CPs (passive): 400
      Extrapolation mode:      Const
      Control point lattice:
        Size:             29 x         29
        Spacing:    10.00000 x   10.00000
        Origin:  [ -63.92842 ,   33.27434 ,  -54.88671 ,    0.00000]
        X-axis:  [  -0.61921 ,   -0.66309 ,   -0.42057]
        Y-axis:  [   0.44986 ,    0.13942 ,   -0.88215]
        Z-axis:  [  -0.64358 ,    0.73544 ,   -0.21197]


❯ mirtk info 2_to_3.dof.gz
Multi-level FFD:
  Global transformation:
    tx  =   0.0000  ty  =   0.0000  tz  =   0.0000
    rx  =   0.0000  ry  =   0.0000  rz  =   0.0000
    sx  = 100.0000  sy  = 100.0000  sz  = 100.0000  
    sxy =   0.0000  syz =   0.0000  sxz =   0.0000  
  Local transformation (passive):
    3D B-spline FFD:
      Number of DOFs:          2523
      Number of CPs (active):  441
      Number of CPs (passive): 400
      Extrapolation mode:      Const
      Control point lattice:
        Size:             29 x         29
        Spacing:    10.00000 x   10.00000
        Origin:  [ -63.92842 ,   33.27434 ,  -54.88671 ,    0.00000]
        X-axis:  [  -0.61921 ,   -0.66309 ,   -0.42057]
        Y-axis:  [   0.44986 ,    0.13942 ,   -0.88215]
        Z-axis:  [  -0.64358 ,    0.73544 ,   -0.21197]


❯ mirtk info 1_to_3.dof.gz
Fluid FFD:
  Global transformation:
    tx  =   0.0000  ty  =   0.0000  tz  =   0.0000
    rx  =   0.0000  ry  =   0.0000  rz  =   0.0000
    sx  = 100.0000  sy  = 100.0000  sz  = 100.0000  
    sxy =   0.0000  syz =   0.0000  sxz =   0.0000  
  Local transformation (passive):
    3D B-spline FFD:
      Number of DOFs:          2523
      Number of CPs (active):  441
      Number of CPs (passive): 400
      Extrapolation mode:      Const
      Control point lattice:
        Size:             29 x         29
        Spacing:    10.00000 x   10.00000
        Origin:  [ -63.92842 ,   33.27434 ,  -54.88671 ,    0.00000]
        X-axis:  [  -0.61921 ,   -0.66309 ,   -0.42057]
        Y-axis:  [   0.44986 ,    0.13942 ,   -0.88215]
        Z-axis:  [  -0.64358 ,    0.73544 ,   -0.21197]
  Local transformation (passive):
    3D B-spline FFD:
      Number of DOFs:          2523
      Number of CPs (active):  441
      Number of CPs (passive): 400
      Extrapolation mode:      Const
      Control point lattice:
        Size:             29 x         29
        Spacing:    10.00000 x   10.00000
        Origin:  [ -63.92842 ,   33.27434 ,  -54.88671 ,    0.00000]
        X-axis:  [  -0.61921 ,   -0.66309 ,   -0.42057]
        Y-axis:  [   0.44986 ,    0.13942 ,   -0.88215]
        Z-axis:  [  -0.64358 ,    0.73544 ,   -0.21197]
  Affine post-transformation:
    tx  =   0.0000  ty  =   0.0000  tz  =   0.0000
    rx  =   0.0000  ry  =   0.0000  rz  =   0.0000
    sx  = 100.0000  sy  = 100.0000  sz  = 100.0000  
    sxy =   0.0000  syz =   0.0000  sxz =   0.0000  


❯ mirtk info 1_to_3_appr.dof.gz 
Fluid FFD:
  Global transformation:
    tx  =   0.0000  ty  =   0.0000  tz  =   0.0000
    rx  =   0.0000  ry  =  -0.0000  rz  =   0.0000
    sx  = 100.0000  sy  = 100.0000  sz  = 100.0000  
    sxy =   0.0000  syz =   0.0000  sxz =   0.0000  
  Local transformation (passive):
    3D B-spline FFD:
      Number of DOFs:          3
      Number of CPs (active):  1
      Number of CPs (passive): 0
      Extrapolation mode:      Const
      Control point lattice:
        Size:              1 x          1
        Spacing:     0.00000 x    0.00000
        Origin:  [ -63.92842 ,   33.27434 ,  -54.88671 ,    0.00000]
        X-axis:  [  -0.61921 ,   -0.66309 ,   -0.42057]
        Y-axis:  [   0.44986 ,    0.13942 ,   -0.88215]
        Z-axis:  [  -0.64358 ,    0.73544 ,   -0.21197]
  Affine post-transformation:
    tx  =   0.0000  ty  =   0.0000  tz  =   0.0000
    rx  =   0.0000  ry  =  -0.0000  rz  =   0.0000
    sx  = 100.0000  sy  = 100.0000  sz  = 100.0000  
    sxy =   0.0000  syz =   0.0000  sxz =   0.0000  


❯ mirtk info 1_to_3_single.dof.gz 
Multi-level FFD:
  Global transformation:
    tx  =   0.0000  ty  =   0.0000  tz  =   0.0000
    rx  =  -0.0826  ry  =  -0.0266  rz  =  -0.0061
    sx  = 100.0275  sy  =  99.9523  sz  =  99.9112  
    sxy =  -0.0525  syz =   0.0757  sxz =  -0.0178  
  Local transformation (passive):
    3D B-spline FFD:
      Number of DOFs:          2523
      Number of CPs (active):  841
      Number of CPs (passive): 0
      Extrapolation mode:      Const
      Control point lattice:
        Size:             29 x         29
        Spacing:    10.00000 x   10.00000
        Origin:  [ -63.92842 ,   33.27434 ,  -54.88671 ,    0.00000]
        X-axis:  [  -0.61921 ,   -0.66309 ,   -0.42057]
        Y-axis:  [   0.44986 ,    0.13942 ,   -0.88215]
        Z-axis:  [  -0.64358 ,    0.73544 ,   -0.21197]
iimog added a commit to BioMeDS/ukbb_cardiac that referenced this issue Sep 1, 2022
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

No branches or pull requests

1 participant