freesurfer / surfa

Python utilities for medical image and surface-based analysis
27 stars 9 forks source link

support mgz warp #19

Closed yhuang43 closed 10 months ago

yhuang43 commented 10 months ago

Freesurfer now supports mgz warp file, which follows mgz format with these tags and data: TAG_GCAMORPH_GEOM : gcamorph image (source) geom & gcamorph atlas (target) geom TAG_GCAMORPH_META : data format (int), spacing (int), exp_k (double) TAG_GCAMORPH_LABELS : gcamorph label data TAG_GCAMORPH_AFFINE : gcamorph m_affine matrix The version number in mgz is now intent encoded: version = (intent & 0xff ) << 8) | MGH_VERSION MGH_VERSION = 1

Changes included in this commit:

  1. add read/write TAG_GCAMORPH_GEOM and TAG_GCAMORPH_META in Surfa MGHArrayIO class
  2. retrieve intent when MGHArrayIO::load(), encode intent in version number when MGHArrayIO:save()
  3. mgz warp related information is saved as the following fields in the FramedArray _metadata dict: intent, gcamorph_volgeom_src, gcamorph_volgeom_trg, warpfield_dtfmt, gcamorph_spacing, gcamorph_exp_k