ANTs icon indicating copy to clipboard operation
ANTs copied to clipboard

Beginnings of a default set up for reproducible registration in antsx

Open stnava opened this issue 3 years ago • 7 comments

goal

Provide a generally agreed upon and easily accessible set of registration parameters that support reproducible results with multi-threading

proposed solution

  1. set random seed to 1 (though still allow user to control this)
  2. Use GC metric for translation/rigid/affine
  3. Use CC metric for deformable ( radius 2 for quick settings )

example implementation

See ANTsPy example (somewhat tested): here

issues

  • We don’t know how well this setup will perform for “in the wild” data

  • GC is not as general as MI

note

This function can help to some extent with the limitations of correlation metrics:

def rank_intensity( x, method='max' ):
    fim = ants.get_mask( x )
    fir = rankdata( (x*fim).numpy(), method=method )
    fir = fir - 1
    fir = fir.reshape( fi.shape )
    rimg = ants.from_numpy( fir.astype(float)  )
    rimg = ants.iMath(rimg,"Normalize")
    return( ants.copy_image_info( x, rimg ) )

It transforms intensities to reduce impact of outlier intensities or the effects of “unusual” histogram shapes.

For T1, the transformed image still looks “good” … not sure about other modalities.

what would need to be done

  • standardize parameters if the ones I've proposed are not agreeable
  • propagate the same approach to .sh scripts and ANTsR
  • verify results are reproducible across runs and n-threads for each implementation
  • potentially implement a specific version for MI as well where multi-modal registration is concerned
  • alternatively, implement a reproducible variant of the MI metric --- doable by truncating precision but this may be a fragile solution and some other approach (unknown) may be better

any thoughts appreciated.

stnava avatar May 10 '21 18:05 stnava

Yeah, I'm guessing the ANTsPy antsRegistrationSyNQuickRepro option is a good option. I agree that it should be propagated to ANTsR and the .sh scripts. We can even do that before we agree upon parameters. Is anybody else working on that? If not, I can add it to my to-do list and get to it pretty quickly.

ntustison avatar May 11 '21 18:05 ntustison

my preliminary relatively large scale (2000 images) testing looks ok for these parameters .... will look more soon but perhaps it would be worth putting a beta version into ANTsR, at least, if not ANTs.

stnava avatar May 11 '21 22:05 stnava

Okay, I'll put that on my to-do list to get to quickly. Will let you know when I finish.

ntustison avatar May 11 '21 22:05 ntustison

https://github.com/ANTsX/ANTsRCore/pull/132

and

https://github.com/ANTsX/ANTs/pull/1190

ntustison avatar May 12 '21 02:05 ntustison

nice - I also added rank_intensity/rankIntensity to antspy/R .... remains to be seen how useful they are.

stnava avatar May 12 '21 12:05 stnava

Updated the wiki to mention the new script options

https://github.com/ANTsX/ANTs/wiki/antsRegistration-reproducibility-issues

cookpa avatar May 17 '21 18:05 cookpa

Linking to Discourse thread

https://discourse.itk.org/t/multi-threads-registration-reproducibility/4030/13

cookpa avatar Jun 14 '21 16:06 cookpa