Skip to content

ENH: Add Hammers atlas support with license consent gate #334

Description

@mnoergaard

Summary

Add support for the Hammers adult brain atlas as an atlas-based segmentation option in PETPrep, preferably using tpl-MNI152NLin2009cAsym through TemplateFlow.

Relevant source pages:

Proposed work

  1. Convert the Hammers atlas data from the brain-development.org distribution to a BIDS-compatible atlas layout.
  2. Register/transform the Hammers atlas into a TemplateFlow template space, ideally tpl-MNI152NLin2009cAsym at res-01, preserving integer labels with nearest-neighbor interpolation.
  3. Add the converted atlas image, label table, metadata/provenance, citation, and license/terms information to the appropriate TemplateFlow/template data location if redistribution is allowed.
  4. Add a PETPrep atlas config entry, likely in petprep/data/segmentation/atlases.json, so users can select the atlas with --seg Hammers or another agreed atlas name.
  5. Integrate the query through the existing TemplateFlow-backed atlas machinery in petprep/utils/atlas.py and petprep/workflows/pet/segmentation.py.
  6. Document the new option in docs/usage.rst, including the atlas source, citation, labels, and license/terms requirements.

License / terms consent requirement

The Hammers atlas terms require explicit user acceptance before use. PETPrep should not silently run the Hammers workflow or pre-cache/distribute restricted files unless the redistribution and downstream use terms clearly permit it.

Suggested implementation:

  • Add an explicit non-interactive opt-in, for example --accept-hammers-atlas-terms and/or PETPREP_ACCEPT_HAMMERS_ATLAS_TERMS=1.
  • If --seg Hammers is requested and consent has not been provided, fail early with a clear error that links to the terms page.
  • Optionally, when PETPrep is run interactively with a TTY, ask the user to answer yes/no after showing the terms URL. In non-interactive runs, require the explicit flag/env var.
  • Record the consent state and terms URL in the run configuration/logs for provenance.
  • If the terms do not permit redistribution in TemplateFlow or Docker images, avoid adding the data to PETPrep images and instead support consent-gated download or user-provided local paths.

This pattern would be more robust than relying only on an interactive prompt, because PETPrep is often run in Docker, Apptainer/Singularity, and cluster/batch environments where prompts can hang jobs.

Acceptance criteria

  • Hammers atlas is available as a documented PETPrep segmentation option.
  • Atlas image and labels are BIDS/TemplateFlow compatible and validated.
  • The atlas is transformed into anatomical space through the existing atlas workflow.
  • PETPrep refuses to execute the Hammers atlas workflow unless the user has explicitly accepted the atlas terms.
  • Documentation includes source links, terms/license information, citation guidance, and an example command.
  • Tests cover atlas config/query behavior and the consent-gating behavior.

Open questions

  • What exact PETPrep option name should be used: Hammers, Hammers95, or another BIDS/TemplateFlow-friendly atlas identifier?
  • Are the Hammers terms compatible with redistributing the transformed atlas through TemplateFlow and/or PETPrep Docker images?
  • Should consent apply only when downloading/using the atlas, or also when pre-cached TemplateFlow data already exists locally?
  • Which Hammers atlas variant/files from brain-development.org should be considered canonical for PETPrep?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions