diff --git a/CHANGES.rst b/CHANGES.rst index 3ae6154..68421a8 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -10,6 +10,13 @@ Unreleased becomes 2.0.0 once every template is at 2.0.0. ``--check`` changes nothing and exits with 1 when there are files to write. * ``tfmgr add`` writes the generated files of the template before validating it. +* New command ``tfmgr migrate headers ARCHIVE [--needs] [-o TSV]`` reads, with nibabel, the + facts of image headers that the migration to TemplateFlow 2.0 needs (grids of volumes + without ``res``, volumes of 4D probabilistic segmentations, GIFTI intents), from an + Archive checkout whose image data are present (``--needs`` lists the files to fetch). + The table is keyed by md5, so migration plans need no image data; the facts of the + Archive are shipped with tfmanager (``migrate/data/headers-2.0.0.tsv``). Snapshots of + templates, from the v2 skeleton zip or from a checkout, have the same fingerprint. * New internals for ``tfmgr generate`` and ``tfmgr migrate``: ``GitTree`` reads a template from a git commit without checking it out, ``collect_archive`` gathers what the Archive's files and checks need from its templates, and ``renames_problems`` checks a diff --git a/setup.cfg b/setup.cfg index ed7ebfe..c5befb1 100644 --- a/setup.cfg +++ b/setup.cfg @@ -37,6 +37,7 @@ tfmanager = data/*.LICENSE schema/*.json schema/*.yaml + migrate/data/*.tsv [options.packages.find] exclude = diff --git a/tfmanager/cli.py b/tfmanager/cli.py index 4ca1d50..a8902c3 100644 --- a/tfmanager/cli.py +++ b/tfmanager/cli.py @@ -234,6 +234,79 @@ def generate(kind, path, check): raise SystemExit(1 if check and found else 0) +@cli.group() +def migrate(): + """Move the Archive's templates to TemplateFlow 2.0 (names and metadata).""" + + +@migrate.command() +@click.argument('archive', type=click.Path(exists=True, file_okay=False), default='.') +@click.option( + '-t', '--template', 'templates', multiple=True, help='Only this template (tpl-