diff --git a/CHANGES.rst b/CHANGES.rst index 54ae40e..71b9f4f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -63,6 +63,18 @@ Unreleased replaces is no longer converted first, and planning a migrated template writes it no more. WHS's ``res-2`` ``atlas-v3`` image, a tissue map, becomes ``desc-tissues``. Closes templateflow/templateflow#203. +* The licenses of the migration to TemplateFlow 2.0 (``tfmanager.migrate.licensing``, T07): + the config's ``licenses.table`` gives the license of each template of the Archive, of + each atlas and of three subsets of files, citing its upstream statement (URL, a verbatim + quote, the evidence saved on 2026-12-05), or saying that there is none and TemplateFlow's + assertion stands. template_description.json takes the SPDX ``License``; LICENSE starts + with its ``SPDX-License-Identifier`` line, and the six missing LICENSE files are written + from the license texts; the ``License`` of JSON sidecars and the ``license`` of rows of + the atlases table follow their atlas or files; and ``docs/licenses/`` gets the text of + each other license in use. Texts that tfmanager does not bundle are under + ``migrate/config/licenses/``, each cited with its URL and sha256. A template or sidecar + without an entry keeps its License (M203); a license + without a text blocks a plan (M211). CHANGES entries say what changed in the licenses. * New warning TF118 redundant-entity: a ``desc``, ``seg`` or ``label`` that tells its file apart from no other file of the template (``res``, ``den``, ``hemi`` and ``cohort`` aside). Masks keep ``desc``, probabilistic segmentations keep ``label``, and diff --git a/setup.cfg b/setup.cfg index f2b9432..46274ff 100644 --- a/setup.cfg +++ b/setup.cfg @@ -41,6 +41,7 @@ tfmanager = migrate/config/*.yaml migrate/config/*.json migrate/config/tables/*.tsv + migrate/config/licenses/*.txt [options.packages.find] exclude = diff --git a/tfmanager/migrate/config.py b/tfmanager/migrate/config.py index 769cfb2..6227355 100644 --- a/tfmanager/migrate/config.py +++ b/tfmanager/migrate/config.py @@ -135,6 +135,51 @@ class Participants: evidence: str = '' +@dataclass(frozen=True) +class LicenseText: + """The text of a license that tfmanager does not bundle (``licenses.texts``).""" + + license: str + file: str + """Its file, under ``licenses/`` next to the config.""" + sha256: str + url: str + why: str + text: str = '' + + +@dataclass(frozen=True) +class License: + """The license of a template, an atlas or a subset of files (``licenses.table``). + + An entry with neither ``atlas`` nor ``files`` is the template's: its License field and its + LICENSE file (``license_file``: ``keep`` the text, after the ``replace`` edits, or + ``write`` the license's text). An atlas entry gives the License of the atlas; a ``files`` + entry, that of the ``count`` data files whose entities include ``files`` (declared in + JSON sidecars). + """ + + id: str + template: str + license: str + basis: str + """``upstream``, ``derived`` (from data under other terms) or ``templateflow`` (no source).""" + url: str + why: str + retrieved: str + quote: str = '' + evidence: tuple[str, ...] = () + atlas: str | None = None + files: dict = field(default_factory=dict) + count: int | None = None + license_file: str | None = None + replace: tuple[tuple[str, str], ...] = () + + @property + def scope(self) -> str: + return 'atlas' if self.atlas else 'files' if self.files else 'template' + + @dataclass(frozen=True) class Config: version: str @@ -148,8 +193,24 @@ class Config: layouts: tuple[Layout, ...] = () sources: tuple[Source, ...] = () participants: tuple[Participants, ...] = () + license_texts: tuple[LicenseText, ...] = () + licenses: tuple[License, ...] = () digest: str = '' + def licenses_for(self, template: str) -> list[License]: + return [item for item in self.licenses if item.template == template] + + def license_text(self, license: str) -> str | None: + """The text of a license: from the config, or bundled with tfmanager.""" + from ..add import BUNDLED_LICENSES + + for item in self.license_texts: + if item.license == license: + return item.text + if license in BUNDLED_LICENSES: + return (files('tfmanager') / 'data' / BUNDLED_LICENSES[license]).read_text() + return None + def atlas_label(self, template: str, label: str) -> str | None: for item in self.atlas_labels: if item['template'] == template and item['from'] == label: @@ -301,6 +362,95 @@ def _source_data(item: dict, base) -> tuple[bytes, list[str]]: return data, problems +def _license_texts(data: dict, base) -> tuple[list[LicenseText], list[str]]: + """The ``licenses.texts`` entries, read from ``licenses/`` next to the config.""" + from .. import licenses + + texts, problems, seen = [], [], set() + for item in data.get('licenses', {}).get('texts', []): + where = f'licenses.texts {item["license"]}' + result = licenses.check(item['license']) + if not result.valid or result.normalized != item['license'] or result.deprecated: + problems.append(f'{where}: not a canonical SPDX identifier.') + if item['license'] in seen: + problems.append(f'{where}: listed twice.') + seen.add(item['license']) + text = '' + if '..' in item['file'].split('/'): + problems.append(f'{where}: {item["file"]} leaves licenses/.') + else: + try: + raw = (base / 'licenses' / item['file']).read_bytes() + except OSError: + problems.append(f'{where}: no file licenses/{item["file"]}.') + else: + if hashlib.sha256(raw).hexdigest() != item['sha256']: + problems.append(f'{where}: licenses/{item["file"]} does not match its sha256.') + text = raw.decode() + texts.append(LicenseText(**{**item, 'text': text})) + return texts, problems + + +def _license_table(data: dict, texts: list[LicenseText]) -> tuple[list[License], list[str]]: + """The ``licenses.table`` entries, and what contradicts them.""" + from .. import licenses + from ..add import BUNDLED_LICENSES + + rs = load_ruleset() + have = {t.license for t in texts} | set(BUNDLED_LICENSES) + entries, problems = [], [] + for item in data.get('licenses', {}).get('table', []): + where = f'licenses.table {item["id"]}' + entry = License( + id=item['id'], + template=item['template'], + license=item['license'], + basis=item['basis'], + url=item['url'], + why=item['why'], + retrieved=str(item['retrieved']), + quote=item.get('quote', ''), + evidence=tuple(item.get('evidence', ())), + atlas=item.get('atlas'), + files=dict(item.get('files', {})), + count=item.get('count'), + license_file=item.get('license_file'), + replace=tuple((r['old'], r['new']) for r in item.get('replace', ())), + ) + entries.append(entry) + result = licenses.check(entry.license) + if not result.valid or result.normalized != entry.license or result.deprecated: + problems.append(f'{where}: {entry.license!r} is not a canonical SPDX expression.') + if not entry.quote and entry.basis != 'templateflow': + problems.append(f'{where}: quote the upstream statement (basis {entry.basis}).') + if (entry.scope == 'template') != (entry.license_file is not None): + problems.append(f'{where}: license_file is for the template entry, and only it.') + if entry.replace and entry.license_file != 'keep': + problems.append(f'{where}: replace edits a kept LICENSE.') + if (entry.scope == 'files') != (entry.count is not None): + problems.append(f'{where}: count is for files entries, and only them.') + unknown = sorted(set(entry.files) - set(rs.entities)) + if unknown: + problems.append(f'{where}: unknown entities {", ".join(unknown)}.') + if entry.license_file == 'write' and entry.license not in have: + problems.append(f'{where}: no text for {entry.license} (licenses.texts).') + keys = [(e.template, e.scope, e.atlas, tuple(sorted(e.files.items()))) for e in entries] + for i, key in enumerate(keys): + if keys.index(key) != i: + problems.append(f'licenses.table {entries[i].id}: a second entry for the same files.') + ids = [e.id for e in entries] + for dup in sorted({i for i in ids if ids.count(i) > 1}): + problems.append(f'licenses.table: the id {dup} is used twice.') + # Licenses other than the template's need their text in docs/licenses/ + own = {e.template: e.license for e in entries if e.scope == 'template'} + for entry in entries: + if entry.scope != 'template' and entry.license != own.get(entry.template): + for key in licenses.check(entry.license).identifiers: + if key not in have: + problems.append(f'licenses.table {entry.id}: no text for {key}.') + return entries, problems + + def load_config(path: str | Path | None = None, version: str = '2.0.0') -> Config: """Load and check a config (by default, the one shipped for ``version``). @@ -332,8 +482,18 @@ def load_config(path: str | Path | None = None, version: str = '2.0.0') -> Confi describe=dict(item.get('describe', {})), ) ) + texts, found = _license_texts(data, base) + problems += found + table, found = _license_table(data, texts) + problems += found if problems: raise ConfigError('\n'.join(problems)) + # The digest covers the files the config cites (tables, license texts) + digest = hashlib.sha256(text.encode()) + for item in sources: + digest.update(f'\0tables/{item.file}\0'.encode() + item.data) + for item in texts: + digest.update(f'\0licenses/{item.file}\0{item.text}'.encode()) return Config( version=data['version'], policies=data['policies'], @@ -395,7 +555,9 @@ def load_config(path: str | Path | None = None, version: str = '2.0.0') -> Confi ) for item in data.get('participants', []) ), - digest=hashlib.sha256(text.encode()).hexdigest(), + license_texts=tuple(texts), + licenses=tuple(table), + digest=digest.hexdigest(), ) diff --git a/tfmanager/migrate/config/2.0.0.yaml b/tfmanager/migrate/config/2.0.0.yaml index ebe4e4e..7990dc0 100644 --- a/tfmanager/migrate/config/2.0.0.yaml +++ b/tfmanager/migrate/config/2.0.0.yaml @@ -741,3 +741,954 @@ participants: OASIS-1 subjects (OAS1_xxxx; Marcus et al. 2007, doi 10.1162/jocn.2007.19.9.1498: "416 subjects aged 18 to 96 years"); M/F is the sex. 35 rows for 30 subjects: five were imaged twice; one row each, with the number of images (yours, 2026-12-05). + +# Licenses (T07). The table cites, for each template, each atlas and each subset of files with +# another license, the statement of the upstream distribution: its url, a verbatim quote and the +# evidence files (raw pages and downloads saved on 2026-12-05, paths relative to the evidence +# folder, kept outside the repository). basis: upstream (the distributor states it), derived +# (the distributor's license; the data it derives from state other terms, noted in why) or +# templateflow (no upstream statement: TemplateFlow's existing assertion). Texts that tfmanager +# does not bundle are under licenses/ next to this file, each with the sha256 of that file. +licenses: + texts: + - license: CC-BY-SA-4.0 + file: CC-BY-SA-4.0.txt + sha256: 28a9529c7d0bb4dc51f4bf5c116a3d16ef247a052f7591466768ddf563fd1cf5 + url: https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt + why: Verbatim plain-text legal code, as for the bundled CC-BY-4.0 text. + - license: GPL-2.0-or-later + file: GPL-2.0-or-later.txt + sha256: aaf135472f81c5b4a0dca9367e5bb5e9750032b5bebe5442b36e4c0a47430df3 + url: >- + https://github.com/spdx/license-list-data/blob/b8d6af45ad2fcfed61bb85a8ad068aa4a77eadf9/text/GPL-2.0-or-later.txt + why: Verbatim SPDX text (www.gnu.org refused the connection on 2026-12-05). + - license: MIT + file: MIT-CBIG.txt + sha256: 0e38f0e8b304f13de2ce2911320faaa08ced178e031d3bbebc3e4769762e5f50 + url: >- + https://github.com/ThomasYeoLab/CBIG/blob/634f676630929a71297852d01dd92a287103e861/LICENSE.md + why: >- + Verbatim LICENSE.md of CBIG, with its copyright line (the only MIT text the Archive + needs: the Schaefer2018 atlases). + - license: LicenseRef-HCPpipelines + file: LicenseRef-HCPpipelines.txt + sha256: 2c686e38603c7e1525e2a98a6de9d15ae6766e4ff850a2e759fbb2de7c6c6445 + url: >- + https://github.com/Washington-University/HCPpipelines/blob/ec7295569797d08deae36df1821bb07e40c65cea/LICENSE.md + why: >- + Verbatim. BSD-3-Clause in substance, but not an SPDX match (two extra commas; clause 3 + names Washington University in St. Louis and others). + - license: LicenseRef-FreeSurfer + file: LicenseRef-FreeSurfer.txt + sha256: 6f5bf1de9972b5830f68c1c367d337e99aa410f1164ce25f4085eddafb51e3c7 + url: >- + https://github.com/freesurfer/freesurfer/blob/fe590b4f10da6e92901cadab013e745e8d065796/LICENSE.txt + why: >- + The preface Part B (1)(b) requires ("All or portions of this licensed product..."), + then LICENSE.txt verbatim (sha256 + 632d404ea17b9101d9ac87cf8f09e651d18eb20d2cc0ba8dbee77e85b8516307). Not SPDX-listed: + 3D-Slicer-1.0 has the same words with other names. + - license: LicenseRef-FMRIB-FSL + file: LicenseRef-FMRIB-FSL.txt + sha256: 137735ac0d0f075d58e85642972692b92073711752b273e7de7ed38c6147a8eb + url: https://git.fmrib.ox.ac.uk/fsl/base/-/blob/master/LICENCE.FSL + why: >- + Verbatim LICENCE.FSL of fsl/base (last changed in commit + e0a2ea6089435c20b9ab7c250eb90c64c63b1f22, 2022-10-25). Named after FMRIB, because + SPDX's FSL-1.1 ids are the unrelated Functional Source License. + - license: LicenseRef-D99 + file: LicenseRef-D99.txt + sha256: a3fcde91ed78b67f51a10de6d6eed0fcc03bfe91686cba842cc8928569648e77 + url: https://afni.nimh.nih.gov/pub/dist/atlases/macaque/D99_Saleem/archive/macaqueatlas_1.2a/README.txt + why: >- + The first paragraphs of the D99 v1.2a README verbatim, up to the authors' contact + (README sha256 f1e2f2d37303a92aae05f1c0d4b7b3ce8f7e6ee0479dd4594ac42d4cd01c84e3). + - license: LicenseRef-Brainnetome + file: LicenseRef-Brainnetome.txt + sha256: af6a7e9d18beae65678bf05068fd8aedc4a60a9e6b0e856e8f401d9aa5d91bcc + url: https://atlas.brainnetome.org/download.html + why: >- + The legal agreement of the download page as text (heading and paragraph, tags removed; + page sha256 ddf11f4d4add6811530b58ea3e9cc3e0691d15667618f99cbeadacd642641768). + table: + # Templates + - id: Fischer344 + template: tpl-Fischer344 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.5281/zenodo.3900544 + quote: '"license": {"id": "cc-by-4.0"}' + evidence: [animal/zenodo-3900544.json, animal/zenodo-3555555-versions.json] + why: >- + Zenodo record of the template and its atlas (v4 of 10.5281/zenodo.3555555; every + version CC BY 4.0). The Archive said 'CC-by-nc-sa-4.0 International', a string shared + with MouseIn and WHS, and had no LICENSE. + license_file: write + - id: MNI152Lin + template: tpl-MNI152Lin + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/icbm-152lin/ + quote: >- + Permission to use, copy, modify, and distribute this software and its documentation + for any purpose and without fee is hereby granted, provided that the above copyright + notice appear in all copies. + evidence: [mni/nist_p798.html, mni/unz_icbm152_lin/COPYING] + why: >- + The MNI notice: SPDX HPND-UC plus a sentence on data loss and injury, so no exact + SPDX match. The SPM12 files have their own entry. + license_file: keep + replace: + - old: Copyright (C) 1991,1994-2020 The FIL Methods Group, Wellcome Centre for Human Neuroimaging. + new: Copyright (C) 1991,1994-2020 Wellcome Centre for Human Neuroimaging. + - old: |- + distribution within the SPM12 software, which is distributed under a GPL-2 license. + Please refer to the GPL-2 license text for further information on how you may use these materials. + new: |- + distribution within the SPM12 software, which is distributed under the GNU General Public License, + version 2 or (at your option) any later version (GPL-2.0-or-later). + Their JSON sidecars declare this license, and its text is in docs/licenses/GPL-2.0-or-later.txt. + - id: MNI152Lin-SPM12 + template: tpl-MNI152Lin + files: {desc: SPM12} + count: 6 + license: GPL-2.0-or-later + basis: upstream + retrieved: '2026-12-05' + url: https://github.com/spm/spm12/blob/03ac9473cad402407b6472228377c0167fdc54b8/LICENCE.txt + quote: either version 2 of the Licence, or (at your option) any later version + evidence: [mni/spm12_LICENCE.txt, mni/spm12_Contents.m, mni/gh_spm12_OldNorm_tree.html] + why: >- + SPM12 r7771's toolbox/OldNorm templates (T1, T2, PD, EPI, PET, SPECT). GPL on data + is a TF508 error: MNI152Lin does not flip until the FIL is asked (2026-12-02). + - id: MNI152NLin2009aAsym + template: tpl-MNI152NLin2009aAsym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/icbm-152-nonlinear-atlases-2009/ + quote: &mni-quote >- + Permission to use, copy, modify, and distribute this software and its documentation + for any purpose and without fee is hereby granted, provided that the above copyright + notice appear in all copies. + evidence: [mni/nist_p904.html, mni/unz_icbm152_09a_asym/COPYING] + why: &mni-why >- + The MNI notice: SPDX HPND-UC plus a sentence on data loss and injury, so no exact + SPDX match. + license_file: keep + - id: MNI152NLin2009aSym + template: tpl-MNI152NLin2009aSym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/icbm-152-nonlinear-atlases-2009/ + quote: *mni-quote + evidence: [mni/nist_p904.html, mni/unz_icbm152_09a_sym/COPYING] + why: *mni-why + license_file: keep + - id: MNI152NLin2009bAsym + template: tpl-MNI152NLin2009bAsym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/icbm-152-nonlinear-atlases-2009/ + quote: *mni-quote + evidence: [mni/nist_p904.html, mni/unz_icbm152_09b_asym/COPYING] + why: *mni-why + license_file: keep + - id: MNI152NLin2009bSym + template: tpl-MNI152NLin2009bSym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/icbm-152-nonlinear-atlases-2009/ + quote: *mni-quote + evidence: [mni/nist_p904.html, mni/unz_icbm152_09b_sym/COPYING] + why: *mni-why + license_file: keep + - id: MNI152NLin2009cAsym + template: tpl-MNI152NLin2009cAsym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/icbm-152-nonlinear-atlases-2009/ + quote: *mni-quote + evidence: [mni/nist_p904.html, mni/unz_icbm152_09c_asym/COPYING] + why: *mni-why + license_file: keep + - id: MNI152NLin2009cSym + template: tpl-MNI152NLin2009cSym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/icbm-152-nonlinear-atlases-2009/ + quote: *mni-quote + evidence: [mni/nist_p904.html, mni/unz_icbm152_09c_sym/COPYING] + why: *mni-why + license_file: keep + - id: MNI152NLin6Asym + template: tpl-MNI152NLin6Asym + license: LicenseRef-FMRIB-FSL + basis: upstream + retrieved: '2026-12-05' + url: https://fsl.fmrib.ox.ac.uk/fsl/docs/other/datasets.html + quote: >- + For licence information about the following atlases please refer to the main License + page. + evidence: + - mni/fsl_docs_datasets.html + - mni/fsl_docs_license.md + - mni/fsl_data_standard_tree_all.json + why: >- + FSL distributes the template (fsl/data_standard 2208.0, no LICENSE) and points to its + licence page, whose terms are for non-commercial use and which names no license for + MNI152. FSL's licence is the conservative reading (2026-12-05); the MNI publishes no + asymmetric 6th-generation model. The Archive said 'See LICENSE file' and had none. + license_file: write + - id: MNI152NLin6Sym + template: tpl-MNI152NLin6Sym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: >- + https://nist.mni.mcgill.ca/mni-icbm152-non-linear-6th-generation-symmetric-average-brain-stereotaxic-registration-model/ + quote: *mni-quote + evidence: [mni/nist_p858.html, mni/unz_icbm152_nl_VI/COPYING] + why: >- + The MNI notice (HPND-UC plus a sentence, no exact SPDX match). The page says + 1993-2009 and the zip's COPYING 1993-2004; the LICENSE keeps the page's years. + license_file: keep + - id: MNI305 + template: tpl-MNI305 + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/mni-average-brain-305-mri/ + quote: *mni-quote + evidence: [mni/nist_p957.html, mni/unz_mni305/COPYING] + why: *mni-why + license_file: keep + - id: MNIColin27 + template: tpl-MNIColin27 + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/colin-27-average-brain/ + quote: *mni-quote + evidence: [mni/nist_p935.html, mni/bic_colin27.html] + why: *mni-why + license_file: keep + - id: MNIInfant + template: tpl-MNIInfant + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/infant-atlases-0-4-5-years/ + quote: *mni-quote + evidence: [mni/nist_p1005.html] + why: *mni-why + license_file: keep + - id: MNIPediatricAsym + template: tpl-MNIPediatricAsym + license: LicenseRef-HPND-MNI + basis: upstream + retrieved: '2026-12-05' + url: https://nist.mni.mcgill.ca/pediatric-atlases-4-5-18-5y/ + quote: Copyright (C) 1993–2004 Vladimir S. Fonov, Louis Collins + evidence: [mni/nist_p974.html] + why: >- + The MNI notice (HPND-UC plus a sentence, no exact SPDX match), not 'MIT-derived' as + the Archive said. Upstream's years are 1993-2004; no upstream copy says 2019. + license_file: keep + replace: + - old: Copyright (C) 1993-2019 Vladimir S. Fonov + new: Copyright (C) 1993-2004 Vladimir S. Fonov + - id: MouseIn + template: tpl-MouseIn + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://osf.io/szyqe/ + quote: Please see the file named license.txt in the OSF Storage of this project. + evidence: + - animal/osf-license-563c1cf88c5e4a3877f9e96e.json + - animal/osf-szyqe-tpl-MouseIn-LICENSE.txt + - animal/osf-szyqe-tpl-MouseIn-template_description.json + why: >- + The project's license setting points to its license file; the only one is LICENSE, + CC BY-SA 4.0 (identical to the Archive's). The project's template_description.json + says 'CC-by-nc-sa-4.0 International', boilerplate shared with Fischer344 and WHS. + license_file: keep + - id: NKI + template: tpl-NKI + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.6084/m9.figshare.915436.v2 + quote: CC BY 4.0 + evidence: [human/figshare-oai-915436-oai_dc.xml, human/datacite-915436-v2.json] + why: >- + figshare's OAI-PMH and DataCite records (its REST API gives no license). The Archive + had no LICENSE. + license_file: write + - id: NMT31Sym + template: tpl-NMT31Sym + license: CC0-1.0 + basis: templateflow + retrieved: '2026-12-05' + url: https://afni.nimh.nih.gov/pub/dist/atlases/macaque/nmt/ + evidence: + - animal/afni-template_nmtv2.html + - atlas-other/nmt-v2.0-sym-tgz/NMT_v2.0_sym/readme.md + - atlas-other/afni-gh-LICENSE.txt + why: >- + No statement in the AFNI pages, the NMT v2 READMEs and tarballs, jms290/NMT or the + paper (AFNI's public domain notice covers its software). TemplateFlow's CC0 stays, + flagged (2026-12-05). + license_file: keep + - id: OASIS30ANTs + template: tpl-OASIS30ANTs + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.6084/m9.figshare.915436.v2 + quote: CC BY 4.0 + evidence: [human/figshare-oai-915436-oai_dc.xml, human/figshare-915436-v2.json] + why: >- + The record's license. Its description (v2) adds that the MICCAI 2012 data the + template derives from are 'released under the Creative Commons + Attribution-NonCommercial license (CC BY-NC)', no version: noted (2026-12-05). The + Archive had no LICENSE. + license_file: write + - id: PNC + template: tpl-PNC + license: CC-BY-4.0 + basis: templateflow + retrieved: '2026-12-05' + url: https://github.com/templateflow/tpl-PNC + evidence: [human/gh-templateflow-tpl-PNC.html, human/pmc-PMC4591095.html] + why: >- + TemplateFlow is the only distribution: the curator (PennBBL) uploaded the files on + 2018-12-15 and a maintainer added CC BY 4.0 on 2018-12-20. The source images are + dbGaP controlled-access. Kept, flagged (2026-12-05). + license_file: keep + - id: RESILIENT + template: tpl-RESILIENT + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://osf.io/u4gtw/ + quote: '"name":"CC-By Attribution 4.0 International"' + evidence: [animal/osf-license-563c1cf88c5e4a3877f9e96a.json, animal/europepmc-PMC8777032.xml] + why: >- + The OSF node license; the paper says the same. Its tissue labels derive from WHS v3, + now CC BY 4.0. + license_file: keep + - id: SUIT + template: tpl-SUIT + license: CC-BY-NC-3.0 + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/DiedrichsenLab/cerebellar_atlases/blob/6857dfa732de6dd60c94da2f84d0b15ccf316618/tpl-SUIT/LICENSE + quote: >- + The SUIT template, associated files and atlases are distributed under a Creative + Commons Attribution-NonCommercial 3.0 Unported License + evidence: + - animal/github-DiedrichsenLab_cerebellar_atlases-6857dfa732de6dd60c94da2f84d0b15ccf316618-tpl-SUIT_LICENSE + - animal/diedrichsenlab-suit_download.htm + why: >- + The LICENSE (identical to the Archive's) and the lab's download page agree. The + LICENSE also has an MNI-style permission paragraph about 'this software', and the + repository README says the atlases are 'CC BY': both noted (2026-12-05). + license_file: keep + - id: UNCInfant + template: tpl-UNCInfant + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://www.nitrc.org/frs/download.php/14897/UNCInfant012Atlases-2022-10-21.zip + quote: >- + The atlases are distributed under the Creative Commons Attribution license. See + LICENSE. + evidence: [human/unc-v2.6-ziptail/UNCInfant012Atlases.txt, human/unc-v2.6-ziptail/LICENSE] + why: >- + Release V2.6 (license added in V2.4, 2020-08-28); its LICENSE is identical to the + Archive's. The superseded 2014 release was for academic research only. + license_file: keep + - id: VALiDATe29 + template: tpl-VALiDATe29 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://www.nitrc.org/projects/validate29/ + quote: 'CC-BY: Attribution 4.0 International' + evidence: [animal/nitrc-validate29-download-12413-agreement.html, animal/nitrc-validate29-frs.html] + why: The download agreement of release 1.2 (file 12413); the Archive's field had no version. + license_file: keep + - id: WHS + template: tpl-WHS + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://www.nitrc.org/projects/whs-sd-atlas + quote: The atlas is shared under the CC BY 4.0 licence + evidence: + - animal/nitrc-whs-sd-atlas.html + - atlas-other/ebrains-kg-whs-v3-e80f9946.json + - animal/wayback-20190324152056-nitrc-whs-sd-atlas.html + why: >- + The current statement (2026-12-05): NC-SA in 2019-2020, when the Archive copied it, + BY-SA in 2022, CC BY 4.0 on NITRC and EBRAINS since 2024. The LICENSE was the + NC-SA text. + license_file: write + - id: dhcpAsym + template: tpl-dhcpAsym + license: CC-BY-4.0 + basis: templateflow + retrieved: '2026-12-05' + url: >- + https://brain-development.org/brain-atlases/atlases-from-the-dhcp-project/cortical-surface-atlas-bozek/ + evidence: + - human/brain-development-cortical-surface-atlas-bozek.html + - human/dhcpAsym-surface-template-ziptail/listing.txt + - human/gh-templateflow-issue-150-comments.json + why: >- + The page and its zip state no license; TemplateFlow added CC BY 4.0 on 2024-02-12. + Kept, flagged (2026-12-05). + license_file: keep + - id: dhcpSym + template: tpl-dhcpSym + license: CC-BY-4.0 + basis: templateflow + retrieved: '2026-12-05' + url: >- + https://brain-development.org/brain-atlases/atlases-from-the-dhcp-project/cortical-surface-template/ + evidence: + - human/brain-development-cortical-surface-template.html + - human/dhcpSym-template-ziptail/listing.txt + why: >- + The page and its zip state no license; TemplateFlow added CC BY 4.0 on 2024-02-09. + Kept, flagged (2026-12-05). + license_file: keep + - id: dhcpVol + template: tpl-dhcpVol + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.12751/g-node.d2b353 + quote: >- + This brain atlas is distributed under the terms of the [Creative Commons Attribution + 4.0 International][license] license. + evidence: [human/gin-dhcp-volumetric-atlas-groupwise-README.md, human/gin-doi-d2b353.html] + why: The GIN repository's README, LICENSE.md and DataCite record agree. + license_file: keep + - id: fsLR + template: tpl-fsLR + license: LicenseRef-HCPpipelines + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/Washington-University/HCPpipelines/blob/ec7295569797d08deae36df1821bb07e40c65cea/LICENSE.md + quote: >- + Redistribution and use in source and binary forms, with or without modification, + is permitted provided that the following conditions are met: + evidence: + - human/gh-hcppipelines-LICENSE.md-ec7295569797d08deae36df1821bb07e40c65cea.txt + - human/gh-hcppipelines-tree-ec7295569797d08deae36df1821bb07e40c65cea.json + why: >- + HCPpipelines' global/templates/standard_mesh_atlases, including the space-fsaverage + spheres of resample_fsaverage (derived from FreeSurfer's fsaverage). The six 32k + Conte69 surfaces (no license found) take the template's (2026-12-05). The Archive + said 'See LICENSE file' and had none. + license_file: write + - id: fsaverage + template: tpl-fsaverage + license: LicenseRef-FreeSurfer + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/freesurfer/freesurfer/blob/fe590b4f10da6e92901cadab013e745e8d065796/LICENSE.txt + quote: >- + Part B of this Agreement applies to downloads of software and/or data from + FreeSurfer. + evidence: + - human/gh-freesurfer-LICENSE.txt-fe590b4f10da6e92901cadab013e745e8d065796.txt + - human/fswiki-FreeSurferSoftwareLicense.html + why: >- + fsaverage ships with FreeSurfer, whose agreement covers its data and must come with + every copy, prefaced. The Archive said 'See LICENSE file' and had none. + license_file: write + - id: fsaverage-hcp + template: tpl-fsaverage + files: {desc: std} + count: 2 + license: LicenseRef-HCPpipelines + basis: derived + retrieved: '2026-12-05' + url: >- + https://github.com/Washington-University/HCPpipelines/blob/ec7295569797d08deae36df1821bb07e40c65cea/LICENSE.md + quote: >- + Redistribution and use in source and binary forms, with or without modification, + is permitted provided that the following conditions are met: + evidence: + - human/gh-hcppipelines-LICENSE.md-ec7295569797d08deae36df1821bb07e40c65cea.txt + - human/gh-hcppipelines-tree-ec7295569797d08deae36df1821bb07e40c65cea.json + why: >- + HCPpipelines' resample_fsaverage spheres (fsaverage.*_LR.spherical_std), derived from + FreeSurfer's (tpl-fsaverage/CHANGES). + - id: fsaverage-vaavg + template: tpl-fsaverage + files: {desc: vaavg} + count: 2 + license: LicenseRef-HCPpipelines + basis: derived + retrieved: '2026-12-05' + url: >- + https://github.com/Washington-University/HCPpipelines/blob/ec7295569797d08deae36df1821bb07e40c65cea/LICENSE.md + quote: >- + Redistribution and use in source and binary forms, with or without modification, + is permitted provided that the following conditions are met: + evidence: + - human/gh-hcppipelines-LICENSE.md-ec7295569797d08deae36df1821bb07e40c65cea.txt + - human/gh-hcppipelines-tree-ec7295569797d08deae36df1821bb07e40c65cea.json + why: >- + HCPpipelines' resample_fsaverage vertex areas (fsaverage.*.midthickness_va_avg), + derived from FreeSurfer's fsaverage (tpl-fsaverage/CHANGES). + - id: onavg + template: tpl-onavg + license: CC0-1.0 + basis: upstream + retrieved: '2026-12-05' + url: https://github.com/feilong/tpl-onavg/blob/653b7b5349b21e045e1973b2f494f8bd9a91393e/LICENSE + quote: Files of the onavg template are released under the CC0 license. + evidence: + - human/gh-feilong-tpl-onavg-LICENSE-653b7b5349b21e045e1973b2f494f8bd9a91393e.txt + - human/nature-s41592-024-02346-y.html + why: The upstream LICENSE is identical to the Archive's; the paper says the same. + license_file: keep + # Atlases + - id: Fischer344-Goerzen2020 + template: tpl-Fischer344 + atlas: Goerzen2020 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.5281/zenodo.3900544 + quote: '"license": {"id": "cc-by-4.0"}' + evidence: [atlas-other/zenodo-3900544.json] + why: Same Zenodo record as the template. + - id: 2009cAsym-DKT31 + template: tpl-MNI152NLin2009cAsym + atlas: DKT31 + license: CC-BY-4.0 + basis: derived + retrieved: '2026-12-05' + url: https://osf.io/kgdey/ + quote: '"name":"CC-By Attribution 4.0 International"' + evidence: + - atlas-mni/osf-node-kgdey.json + - atlas-mni/mindboggle-info-data.html + - atlas-mni/gh-nipreps-fmriprep-pr-1159.diff + why: >- + Mindboggle's DKT31 labels (CC BY 4.0), warped into the template by the fMRIPrep team + and posted on OSF (fvuh8), which states no license. + - id: 2009cAsym-DiFuMo + template: tpl-MNI152NLin2009cAsym + atlas: DiFuMo + license: CC-BY-4.0 + basis: templateflow + retrieved: '2026-12-05' + url: https://osf.io/k8w5s/ + evidence: + - atlas-mni/osf-node-k8w5s.json + - atlas-mni/gh-parietal-inria-difumo-repo.json + - atlas-mni/nilearn-0.7.1-difumo.rst + why: >- + No statement on OSF, the project site, GitHub or in the zips; nilearn's + 'non-commercial research' line is not the authors'. CC BY 4.0 as TemplateFlow's + assertion, in both templates; ask the authors in WP5 (2026-12-05). + - id: 2009cAsym-HOCPA + template: tpl-MNI152NLin2009cAsym + atlas: HOCPA + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://fsl.fmrib.ox.ac.uk/fsl/docs/license.html + quote: &ho-quote >- + The Cerebellum and Harvard-Oxford atlases, whilst not being the property of Oxford, + are released under the CC BY-SA 4.0 licence + evidence: &ho-evidence [atlas-mni/fsl-docs-license.html, atlas-mni/fsl-docs-commit-95b47776-diff.json] + why: &ho-why >- + FSL's current statement (since 2025-08-05; before, FSL's non-commercial licence). + ShareAlike applies to TemplateFlow's resampling. + - id: 2009cAsym-HOCPAL + template: tpl-MNI152NLin2009cAsym + atlas: HOCPAL + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://fsl.fmrib.ox.ac.uk/fsl/docs/license.html + quote: *ho-quote + evidence: [atlas-mni/fsl-docs-license.html, atlas-mni/nitrc-HarvardOxford-9902-listing.txt] + why: >- + FSL's current statement for the Harvard-Oxford atlases; the lateralized images exist + only in FSL 5's data, which states no license of its own. + - id: 2009cAsym-HOSPA + template: tpl-MNI152NLin2009cAsym + atlas: HOSPA + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://fsl.fmrib.ox.ac.uk/fsl/docs/license.html + quote: *ho-quote + evidence: *ho-evidence + why: *ho-why + - id: 2009cAsym-MASSP20 + template: tpl-MNI152NLin2009cAsym + atlas: MASSP20 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.21942/uva.27291579.v2 + quote: '"license": {"value": 1, "name": "CC BY 4.0"' + evidence: [atlas-mni/figshare-27291579.json, atlas-mni/figshare-27291579-massp_2p0-label-list.txt] + why: >- + MASSP 2.0 on the UvA figshare (all five records CC BY 4.0); its label list matches + the template's table. + - id: 2009cAsym-MIAL67ThalamicNuclei + template: tpl-MNI152NLin2009cAsym + atlas: MIAL67ThalamicNuclei + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.5281/zenodo.1405484 + quote: '"license": {"id": "cc-by-sa-4.0"}' + evidence: [atlas-mni/zenodo-1241074-redirected-to-1405484.json, atlas-mni/zenodo-1405484.html] + why: >- + The Zenodo record's license. The Archive's 'CC-BY-4' is the paper's; the record's + README says 'All rights reserved'. ShareAlike applies to the 2009cAsym version. + - id: 2009cAsym-Schaefer2018 + template: tpl-MNI152NLin2009cAsym + atlas: Schaefer2018 + license: MIT + basis: upstream + retrieved: '2026-12-05' + url: https://github.com/ThomasYeoLab/CBIG/blob/634f676630929a71297852d01dd92a287103e861/README.md + quote: &cbig-quote file for license rights and limitations (MIT). + evidence: &cbig-evidence + - atlas-mni/cbig-634f676630929a71297852d01dd92a287103e861-README.md + - atlas-mni/cbig-634f676630929a71297852d01dd92a287103e861-LICENSE.md + why: &cbig-why >- + CBIG's repository-wide MIT license (written for software; no statement on the data); + its copyright notice ships in docs/licenses. + - id: 2009cSym-CerebrA + template: tpl-MNI152NLin2009cSym + atlas: CerebrA + license: CC0-1.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.12751/g-node.be5e62 + quote: 'name: "Creative Commons CC0 1.0 Universal"' + evidence: [atlas-mni/gin-doi-CerebrA-datacite.yml, atlas-mni/gin-doi-CerebrA-LICENSE] + why: The GIN record; CerebrA derives from Mindboggle-101 labels (CC BY 4.0). + - id: 6Asym-Buckner2011 + template: tpl-MNI152NLin6Asym + atlas: Buckner2011 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/DiedrichsenLab/cerebellar_atlases/blob/6857dfa732de6dd60c94da2f84d0b15ccf316618/README.md + quote: &diedrichsen-quote >- + If not otherwise noted in the contributing paper, the atlases are distributed under + a Creative Commons CC BY (Attribution) license + evidence: &diedrichsen-evidence + - atlas-mni/diedrichsen-6857dfa732de6dd60c94da2f84d0b15ccf316618-README.md + - atlas-mni/diedrichsen-1b62fdc0954d34ed768ec36e81ce6a007dbe9e3c-README.md + - atlas-mni/gh-diedrichsenlab-commit-6857dfa.json + why: &diedrichsen-why >- + The current README (v1.2, 2026-09-12; CC BY-ND before, same data). It names no + version: CC BY 4.0, noted (2026-12-05). + - id: 6Asym-DiFuMo + template: tpl-MNI152NLin6Asym + atlas: DiFuMo + license: CC-BY-4.0 + basis: templateflow + retrieved: '2026-12-05' + url: https://osf.io/k8w5s/ + evidence: [atlas-mni/osf-node-k8w5s.json, atlas-mni/gh-parietal-inria-difumo-repo.json] + why: >- + TemplateFlow's resampling of the 2009cAsym DiFuMo; no upstream statement. CC BY 4.0 + as TemplateFlow's assertion, as in 2009cAsym (2026-12-05). + - id: 6Asym-Diedrichsen2009 + template: tpl-MNI152NLin6Asym + atlas: Diedrichsen2009 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/DiedrichsenLab/cerebellar_atlases/blob/6857dfa732de6dd60c94da2f84d0b15ccf316618/README.md + quote: *diedrichsen-quote + evidence: *diedrichsen-evidence + why: *diedrichsen-why + - id: 6Asym-HCP + template: tpl-MNI152NLin6Asym + atlas: HCP + license: LicenseRef-HCPpipelines + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/Washington-University/HCPpipelines/blob/ec7295569797d08deae36df1821bb07e40c65cea/LICENSE.md + quote: >- + Redistribution and use in source and binary forms, with or without modification, + is permitted provided that the following conditions are met: + evidence: [atlas-mni/hcppipelines-ec7295569797d08deae36df1821bb07e40c65cea-LICENSE.md] + why: HCPpipelines' global/templates (Atlas_ROIs), re-encoded by TemplateFlow. + - id: 6Asym-HOCPA + template: tpl-MNI152NLin6Asym + atlas: HOCPA + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://fsl.fmrib.ox.ac.uk/fsl/docs/license.html + quote: *ho-quote + evidence: *ho-evidence + why: *ho-why + - id: 6Asym-HOCPAL + template: tpl-MNI152NLin6Asym + atlas: HOCPAL + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://fsl.fmrib.ox.ac.uk/fsl/docs/license.html + quote: *ho-quote + evidence: [atlas-mni/fsl-docs-license.html, atlas-mni/nitrc-HarvardOxford-9902-listing.txt] + why: >- + FSL's current statement for the Harvard-Oxford atlases; the lateralized images exist + only in FSL 5's data, which states no license of its own. + - id: 6Asym-HOSPA + template: tpl-MNI152NLin6Asym + atlas: HOSPA + license: CC-BY-SA-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://fsl.fmrib.ox.ac.uk/fsl/docs/license.html + quote: *ho-quote + evidence: *ho-evidence + why: *ho-why + - id: 6Asym-Schaefer2018 + template: tpl-MNI152NLin6Asym + atlas: Schaefer2018 + license: MIT + basis: upstream + retrieved: '2026-12-05' + url: https://github.com/ThomasYeoLab/CBIG/blob/634f676630929a71297852d01dd92a287103e861/README.md + quote: *cbig-quote + evidence: *cbig-evidence + why: *cbig-why + - id: MouseIn-CCFv3 + template: tpl-MouseIn + atlas: CCFv3 + license: CC-BY-SA-4.0 + basis: derived + retrieved: '2026-12-05' + url: https://osf.io/szyqe/ + quote: Please see the file named license.txt in the OSF Storage of this project. + evidence: + - animal/osf-license-563c1cf88c5e4a3877f9e96e.json + - animal/osf-szyqe-tpl-MouseIn-LICENSE.txt + - atlas-other/allen-terms-of-use.html + why: >- + The template's license (same OSF project). The labels derive from the Allen CCFv3, + whose terms allow research or noncommercial use only: noted (2026-12-05). + - id: NMT31Sym-CHARM + template: tpl-NMT31Sym + atlas: CHARM + license: CC0-1.0 + basis: templateflow + retrieved: '2026-12-05' + url: https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/nonhuman/macaque_tempatl/atlas_charm.html + evidence: [atlas-other/afni-charm.html, atlas-other/nmt-v2.0-sym-tgz/NMT_v2.0_sym/readme.md] + why: No upstream statement; TemplateFlow's CC0, as for the template (2026-12-05). + - id: NMT31Sym-D99 + template: tpl-NMT31Sym + atlas: D99 + license: LicenseRef-D99 + basis: upstream + retrieved: '2026-12-05' + url: https://afni.nimh.nih.gov/pub/dist/atlases/macaque/D99_Saleem/archive/macaqueatlas_1.2a/README.txt + quote: >- + Note the atlas dataset may not be modified or redistributed without prior consent + from the authors. + evidence: [atlas-other/afni-d99-macaqueatlas_1.2a-README.txt, atlas-other/d99-v2.0-dist-tgz] + why: >- + The only statement found (D99 v1.2a); the D99 v2 and NMT v2 packages TemplateFlow + took it from state nothing. Recorded as is (2026-12-05). + - id: NMT31Sym-SARM + template: tpl-NMT31Sym + atlas: SARM + license: CC0-1.0 + basis: templateflow + retrieved: '2026-12-05' + url: https://afni.nimh.nih.gov/pub/dist/doc/htmldoc/nonhuman/macaque_tempatl/atlas_sarm.html + evidence: [atlas-other/afni-sarm.html, animal/afni-atlases-macaque-SARM-README.md] + why: No upstream statement; TemplateFlow's CC0, as for the template (2026-12-05). + - id: SUIT-Buckner2011 + template: tpl-SUIT + atlas: Buckner2011 + license: CC-BY-NC-3.0 + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/DiedrichsenLab/cerebellar_atlases/blob/6857dfa732de6dd60c94da2f84d0b15ccf316618/tpl-SUIT/LICENSE + quote: &suit-quote >- + The SUIT template, associated files and atlases are distributed under a Creative + Commons Attribution-NonCommercial 3.0 Unported License + evidence: &suit-evidence + - atlas-other/cerebellar_atlases-6857dfa-tpl-SUIT-LICENSE + - atlas-other/diedrichsenlab-suit-download.html + why: &suit-why >- + tpl-SUIT/LICENSE names the atlases and the download page agrees; the README's 'CC + BY' is noted (2026-12-05). + - id: SUIT-Diedrichsen2009 + template: tpl-SUIT + atlas: Diedrichsen2009 + license: CC-BY-NC-3.0 + basis: upstream + retrieved: '2026-12-05' + url: >- + https://github.com/DiedrichsenLab/cerebellar_atlases/blob/6857dfa732de6dd60c94da2f84d0b15ccf316618/tpl-SUIT/LICENSE + quote: *suit-quote + evidence: *suit-evidence + why: *suit-why + - id: UNCInfant-AAL + template: tpl-UNCInfant + atlas: AAL + license: CC-BY-4.0 + basis: derived + retrieved: '2026-12-05' + url: https://www.nitrc.org/frs/download.php/14897/UNCInfant012Atlases-2022-10-21.zip + quote: >- + The atlases are distributed under the Creative Commons Attribution license. See + LICENSE. + evidence: + - atlas-other/UNCInfant012Atlases-2022-10-21-zip/UNCInfant012Atlases-2022-10-21/UNCInfant012Atlases.pdf.txt + - atlas-other/UNCInfant012Atlases-2022-10-21-zip/UNCInfant012Atlases-2022-10-21/LICENSE + - atlas-other/aal_for_SPM8-zip/aal_for_SPM8/readme_aal8.txt + why: >- + UNC's release, which includes the infant AAL maps. The original AAL is under the + GPL, no version: noted (2026-12-05). + - id: VALiDATe29-VALiDATe + template: tpl-VALiDATe29 + atlas: VALiDATe + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://www.nitrc.org/projects/validate29/ + quote: 'CC-BY: Attribution 4.0 International' + evidence: [atlas-other/nitrc-validate29-download-12413.html] + why: Same release as the template. + - id: WHS-Osen2019 + template: tpl-WHS + atlas: Osen2019 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://www.nitrc.org/projects/whs-sd-atlas + quote: The atlas is shared under the CC BY 4.0 licence + evidence: [atlas-other/nitrc-whs-sd-atlas.html, atlas-other/ebrains-kg-whs-v3-e80f9946.json] + why: >- + The current statement on NITRC and EBRAINS (DataCite still says CC BY-SA 4.0 for + v3), 2026-12-05. + - id: fsaverage-Desikan2006 + template: tpl-fsaverage + atlas: Desikan2006 + license: LicenseRef-FreeSurfer + basis: upstream + retrieved: '2026-12-05' + url: &fs-url >- + https://github.com/freesurfer/freesurfer/blob/fe590b4f10da6e92901cadab013e745e8d065796/LICENSE.txt + quote: &fs-quote >- + Part B of this Agreement applies to downloads of software and/or data from + FreeSurfer. + evidence: [atlas-other/freesurfer-gh-fe590b4-LICENSE.txt, atlas-other/fswiki-CorticalParcellation.html] + why: >- + From FreeSurfer 7's fsaverage. The desc-curated version is marked as modified in its + sidecar, as the agreement's Part B (1)(d) asks. + - id: fsaverage-Destrieux2005 + template: tpl-fsaverage + atlas: Destrieux2005 + license: LicenseRef-FreeSurfer + basis: upstream + retrieved: '2026-12-05' + url: *fs-url + quote: *fs-quote + evidence: [atlas-other/freesurfer-gh-fe590b4-LICENSE.txt, atlas-other/fswiki-DestrieuxAtlasChanges.html] + why: &fs-why From FreeSurfer 7's fsaverage. + - id: fsaverage-Destrieux2009 + template: tpl-fsaverage + atlas: Destrieux2009 + license: LicenseRef-FreeSurfer + basis: upstream + retrieved: '2026-12-05' + url: *fs-url + quote: *fs-quote + evidence: [atlas-other/freesurfer-gh-fe590b4-LICENSE.txt, atlas-other/fswiki-DestrieuxAtlasChanges.html] + why: *fs-why + - id: fsaverage-Lausanne2018 + template: tpl-fsaverage + atlas: Lausanne2018 + license: CC-BY-4.0 + basis: upstream + retrieved: '2026-12-05' + url: https://doi.org/10.5281/zenodo.4593058 + quote: This dataset is licensed under CC BY 4.0. + evidence: [atlas-other/CMTKLIB-data-v1.1-README.md, atlas-other/CMTKLIB-data-v1.1-LICENSE] + why: CMTKLIB-data v1.1 (connectomicslab); the Archive's 'CC-BY-4' is not an SPDX id. + - id: fsaverage-Sabuncu2011 + template: tpl-fsaverage + atlas: Sabuncu2011 + license: LicenseRef-FreeSurfer + basis: upstream + retrieved: '2026-12-05' + url: *fs-url + quote: *fs-quote + evidence: [atlas-other/freesurfer-gh-fe590b4-LICENSE.txt, atlas-other/fswiki-Chubs.html] + why: *fs-why + - id: fsaverage-Schaefer2018 + template: tpl-fsaverage + atlas: Schaefer2018 + license: MIT + basis: upstream + retrieved: '2026-12-05' + url: https://github.com/ThomasYeoLab/CBIG/blob/634f676630929a71297852d01dd92a287103e861/README.md + quote: *cbig-quote + evidence: [atlas-other/CBIG-634f676-README.md, atlas-other/CBIG-634f676-LICENSE.md] + why: *cbig-why + - id: fsaverage-Yeo2011 + template: tpl-fsaverage + atlas: Yeo2011 + license: LicenseRef-FreeSurfer + basis: upstream + retrieved: '2026-12-05' + url: *fs-url + quote: *fs-quote + evidence: [atlas-other/freesurfer-gh-fe590b4-LICENSE.txt, atlas-other/fswiki-CorticalParcellation_Yeo2011.html] + why: From FreeSurfer 7's fsaverage (the sidecar says 'distributed by FreeSurfer 7'). + - id: fsaverage-brainnetome + template: tpl-fsaverage + atlas: brainnetome + license: LicenseRef-Brainnetome + basis: upstream + retrieved: '2026-12-05' + url: https://atlas.brainnetome.org/download.html + quote: >- + subject to proper attribution and an agreement to share alike, for use for + non-commercial purposes + evidence: [atlas-other/brainnetome-download.html, atlas-other/nitrc-bn_atlas.html] + why: >- + The download page's agreement, verbatim (the sidecar paraphrased it); it also limits + use to colleges, universities and non-profits. diff --git a/tfmanager/migrate/config/licenses/CC-BY-SA-4.0.txt b/tfmanager/migrate/config/licenses/CC-BY-SA-4.0.txt new file mode 100644 index 0000000..2d58298 --- /dev/null +++ b/tfmanager/migrate/config/licenses/CC-BY-SA-4.0.txt @@ -0,0 +1,428 @@ +Attribution-ShareAlike 4.0 International + +======================================================================= + +Creative Commons Corporation ("Creative Commons") is not a law firm and +does not provide legal services or legal advice. Distribution of +Creative Commons public licenses does not create a lawyer-client or +other relationship. Creative Commons makes its licenses and related +information available on an "as-is" basis. Creative Commons gives no +warranties regarding its licenses, any material licensed under their +terms and conditions, or any related information. Creative Commons +disclaims all liability for damages resulting from their use to the +fullest extent possible. + +Using Creative Commons Public Licenses + +Creative Commons public licenses provide a standard set of terms and +conditions that creators and other rights holders may use to share +original works of authorship and other material subject to copyright +and certain other rights specified in the public license below. The +following considerations are for informational purposes only, are not +exhaustive, and do not form part of our licenses. + + Considerations for licensors: Our public licenses are + intended for use by those authorized to give the public + permission to use material in ways otherwise restricted by + copyright and certain other rights. Our licenses are + irrevocable. Licensors should read and understand the terms + and conditions of the license they choose before applying it. + Licensors should also secure all rights necessary before + applying our licenses so that the public can reuse the + material as expected. Licensors should clearly mark any + material not subject to the license. This includes other CC- + licensed material, or material used under an exception or + limitation to copyright. More considerations for licensors: + wiki.creativecommons.org/Considerations_for_licensors + + Considerations for the public: By using one of our public + licenses, a licensor grants the public permission to use the + licensed material under specified terms and conditions. If + the licensor's permission is not necessary for any reason--for + example, because of any applicable exception or limitation to + copyright--then that use is not regulated by the license. Our + licenses grant only permissions under copyright and certain + other rights that a licensor has authority to grant. Use of + the licensed material may still be restricted for other + reasons, including because others have copyright or other + rights in the material. A licensor may make special requests, + such as asking that all changes be marked or described. + Although not required by our licenses, you are encouraged to + respect those requests where reasonable. More considerations + for the public: + wiki.creativecommons.org/Considerations_for_licensees + +======================================================================= + +Creative Commons Attribution-ShareAlike 4.0 International Public +License + +By exercising the Licensed Rights (defined below), You accept and agree +to be bound by the terms and conditions of this Creative Commons +Attribution-ShareAlike 4.0 International Public License ("Public +License"). To the extent this Public License may be interpreted as a +contract, You are granted the Licensed Rights in consideration of Your +acceptance of these terms and conditions, and the Licensor grants You +such rights in consideration of benefits the Licensor receives from +making the Licensed Material available under these terms and +conditions. + + +Section 1 -- Definitions. + + a. Adapted Material means material subject to Copyright and Similar + Rights that is derived from or based upon the Licensed Material + and in which the Licensed Material is translated, altered, + arranged, transformed, or otherwise modified in a manner requiring + permission under the Copyright and Similar Rights held by the + Licensor. For purposes of this Public License, where the Licensed + Material is a musical work, performance, or sound recording, + Adapted Material is always produced where the Licensed Material is + synched in timed relation with a moving image. + + b. Adapter's License means the license You apply to Your Copyright + and Similar Rights in Your contributions to Adapted Material in + accordance with the terms and conditions of this Public License. + + c. BY-SA Compatible License means a license listed at + creativecommons.org/compatiblelicenses, approved by Creative + Commons as essentially the equivalent of this Public License. + + d. Copyright and Similar Rights means copyright and/or similar rights + closely related to copyright including, without limitation, + performance, broadcast, sound recording, and Sui Generis Database + Rights, without regard to how the rights are labeled or + categorized. For purposes of this Public License, the rights + specified in Section 2(b)(1)-(2) are not Copyright and Similar + Rights. + + e. Effective Technological Measures means those measures that, in the + absence of proper authority, may not be circumvented under laws + fulfilling obligations under Article 11 of the WIPO Copyright + Treaty adopted on December 20, 1996, and/or similar international + agreements. + + f. Exceptions and Limitations means fair use, fair dealing, and/or + any other exception or limitation to Copyright and Similar Rights + that applies to Your use of the Licensed Material. + + g. License Elements means the license attributes listed in the name + of a Creative Commons Public License. The License Elements of this + Public License are Attribution and ShareAlike. + + h. Licensed Material means the artistic or literary work, database, + or other material to which the Licensor applied this Public + License. + + i. Licensed Rights means the rights granted to You subject to the + terms and conditions of this Public License, which are limited to + all Copyright and Similar Rights that apply to Your use of the + Licensed Material and that the Licensor has authority to license. + + j. Licensor means the individual(s) or entity(ies) granting rights + under this Public License. + + k. Share means to provide material to the public by any means or + process that requires permission under the Licensed Rights, such + as reproduction, public display, public performance, distribution, + dissemination, communication, or importation, and to make material + available to the public including in ways that members of the + public may access the material from a place and at a time + individually chosen by them. + + l. Sui Generis Database Rights means rights other than copyright + resulting from Directive 96/9/EC of the European Parliament and of + the Council of 11 March 1996 on the legal protection of databases, + as amended and/or succeeded, as well as other essentially + equivalent rights anywhere in the world. + + m. You means the individual or entity exercising the Licensed Rights + under this Public License. Your has a corresponding meaning. + + +Section 2 -- Scope. + + a. License grant. + + 1. Subject to the terms and conditions of this Public License, + the Licensor hereby grants You a worldwide, royalty-free, + non-sublicensable, non-exclusive, irrevocable license to + exercise the Licensed Rights in the Licensed Material to: + + a. reproduce and Share the Licensed Material, in whole or + in part; and + + b. produce, reproduce, and Share Adapted Material. + + 2. Exceptions and Limitations. For the avoidance of doubt, where + Exceptions and Limitations apply to Your use, this Public + License does not apply, and You do not need to comply with + its terms and conditions. + + 3. Term. The term of this Public License is specified in Section + 6(a). + + 4. Media and formats; technical modifications allowed. The + Licensor authorizes You to exercise the Licensed Rights in + all media and formats whether now known or hereafter created, + and to make technical modifications necessary to do so. The + Licensor waives and/or agrees not to assert any right or + authority to forbid You from making technical modifications + necessary to exercise the Licensed Rights, including + technical modifications necessary to circumvent Effective + Technological Measures. For purposes of this Public License, + simply making modifications authorized by this Section 2(a) + (4) never produces Adapted Material. + + 5. Downstream recipients. + + a. Offer from the Licensor -- Licensed Material. Every + recipient of the Licensed Material automatically + receives an offer from the Licensor to exercise the + Licensed Rights under the terms and conditions of this + Public License. + + b. Additional offer from the Licensor -- Adapted Material. + Every recipient of Adapted Material from You + automatically receives an offer from the Licensor to + exercise the Licensed Rights in the Adapted Material + under the conditions of the Adapter's License You apply. + + c. No downstream restrictions. You may not offer or impose + any additional or different terms or conditions on, or + apply any Effective Technological Measures to, the + Licensed Material if doing so restricts exercise of the + Licensed Rights by any recipient of the Licensed + Material. + + 6. No endorsement. Nothing in this Public License constitutes or + may be construed as permission to assert or imply that You + are, or that Your use of the Licensed Material is, connected + with, or sponsored, endorsed, or granted official status by, + the Licensor or others designated to receive attribution as + provided in Section 3(a)(1)(A)(i). + + b. Other rights. + + 1. Moral rights, such as the right of integrity, are not + licensed under this Public License, nor are publicity, + privacy, and/or other similar personality rights; however, to + the extent possible, the Licensor waives and/or agrees not to + assert any such rights held by the Licensor to the limited + extent necessary to allow You to exercise the Licensed + Rights, but not otherwise. + + 2. Patent and trademark rights are not licensed under this + Public License. + + 3. To the extent possible, the Licensor waives any right to + collect royalties from You for the exercise of the Licensed + Rights, whether directly or through a collecting society + under any voluntary or waivable statutory or compulsory + licensing scheme. In all other cases the Licensor expressly + reserves any right to collect such royalties. + + +Section 3 -- License Conditions. + +Your exercise of the Licensed Rights is expressly made subject to the +following conditions. + + a. Attribution. + + 1. If You Share the Licensed Material (including in modified + form), You must: + + a. retain the following if it is supplied by the Licensor + with the Licensed Material: + + i. identification of the creator(s) of the Licensed + Material and any others designated to receive + attribution, in any reasonable manner requested by + the Licensor (including by pseudonym if + designated); + + ii. a copyright notice; + + iii. a notice that refers to this Public License; + + iv. a notice that refers to the disclaimer of + warranties; + + v. a URI or hyperlink to the Licensed Material to the + extent reasonably practicable; + + b. indicate if You modified the Licensed Material and + retain an indication of any previous modifications; and + + c. indicate the Licensed Material is licensed under this + Public License, and include the text of, or the URI or + hyperlink to, this Public License. + + 2. You may satisfy the conditions in Section 3(a)(1) in any + reasonable manner based on the medium, means, and context in + which You Share the Licensed Material. For example, it may be + reasonable to satisfy the conditions by providing a URI or + hyperlink to a resource that includes the required + information. + + 3. If requested by the Licensor, You must remove any of the + information required by Section 3(a)(1)(A) to the extent + reasonably practicable. + + b. ShareAlike. + + In addition to the conditions in Section 3(a), if You Share + Adapted Material You produce, the following conditions also apply. + + 1. The Adapter's License You apply must be a Creative Commons + license with the same License Elements, this version or + later, or a BY-SA Compatible License. + + 2. You must include the text of, or the URI or hyperlink to, the + Adapter's License You apply. You may satisfy this condition + in any reasonable manner based on the medium, means, and + context in which You Share Adapted Material. + + 3. You may not offer or impose any additional or different terms + or conditions on, or apply any Effective Technological + Measures to, Adapted Material that restrict exercise of the + rights granted under the Adapter's License You apply. + + +Section 4 -- Sui Generis Database Rights. + +Where the Licensed Rights include Sui Generis Database Rights that +apply to Your use of the Licensed Material: + + a. for the avoidance of doubt, Section 2(a)(1) grants You the right + to extract, reuse, reproduce, and Share all or a substantial + portion of the contents of the database; + + b. if You include all or a substantial portion of the database + contents in a database in which You have Sui Generis Database + Rights, then the database in which You have Sui Generis Database + Rights (but not its individual contents) is Adapted Material, + including for purposes of Section 3(b); and + + c. You must comply with the conditions in Section 3(a) if You Share + all or a substantial portion of the contents of the database. + +For the avoidance of doubt, this Section 4 supplements and does not +replace Your obligations under this Public License where the Licensed +Rights include other Copyright and Similar Rights. + + +Section 5 -- Disclaimer of Warranties and Limitation of Liability. + + a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE + EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS + AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF + ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, + IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, + WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR + PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, + ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT + KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT + ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. + + b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE + TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, + NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, + INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, + COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR + USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN + ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR + DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR + IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. + + c. The disclaimer of warranties and limitation of liability provided + above shall be interpreted in a manner that, to the extent + possible, most closely approximates an absolute disclaimer and + waiver of all liability. + + +Section 6 -- Term and Termination. + + a. This Public License applies for the term of the Copyright and + Similar Rights licensed here. However, if You fail to comply with + this Public License, then Your rights under this Public License + terminate automatically. + + b. Where Your right to use the Licensed Material has terminated under + Section 6(a), it reinstates: + + 1. automatically as of the date the violation is cured, provided + it is cured within 30 days of Your discovery of the + violation; or + + 2. upon express reinstatement by the Licensor. + + For the avoidance of doubt, this Section 6(b) does not affect any + right the Licensor may have to seek remedies for Your violations + of this Public License. + + c. For the avoidance of doubt, the Licensor may also offer the + Licensed Material under separate terms or conditions or stop + distributing the Licensed Material at any time; however, doing so + will not terminate this Public License. + + d. Sections 1, 5, 6, 7, and 8 survive termination of this Public + License. + + +Section 7 -- Other Terms and Conditions. + + a. The Licensor shall not be bound by any additional or different + terms or conditions communicated by You unless expressly agreed. + + b. Any arrangements, understandings, or agreements regarding the + Licensed Material not stated herein are separate from and + independent of the terms and conditions of this Public License. + + +Section 8 -- Interpretation. + + a. For the avoidance of doubt, this Public License does not, and + shall not be interpreted to, reduce, limit, restrict, or impose + conditions on any use of the Licensed Material that could lawfully + be made without permission under this Public License. + + b. To the extent possible, if any provision of this Public License is + deemed unenforceable, it shall be automatically reformed to the + minimum extent necessary to make it enforceable. If the provision + cannot be reformed, it shall be severed from this Public License + without affecting the enforceability of the remaining terms and + conditions. + + c. No term or condition of this Public License will be waived and no + failure to comply consented to unless expressly agreed to by the + Licensor. + + d. Nothing in this Public License constitutes or may be interpreted + as a limitation upon, or waiver of, any privileges and immunities + that apply to the Licensor or You, including from the legal + processes of any jurisdiction or authority. + + +======================================================================= + +Creative Commons is not a party to its public +licenses. Notwithstanding, Creative Commons may elect to apply one of +its public licenses to material it publishes and in those instances +will be considered the “Licensor.” The text of the Creative Commons +public licenses is dedicated to the public domain under the CC0 Public +Domain Dedication. Except for the limited purpose of indicating that +material is shared under a Creative Commons public license or as +otherwise permitted by the Creative Commons policies published at +creativecommons.org/policies, Creative Commons does not authorize the +use of the trademark "Creative Commons" or any other trademark or logo +of Creative Commons without its prior written consent including, +without limitation, in connection with any unauthorized modifications +to any of its public licenses or any other arrangements, +understandings, or agreements concerning use of licensed material. For +the avoidance of doubt, this paragraph does not form part of the +public licenses. + +Creative Commons may be contacted at creativecommons.org. + diff --git a/tfmanager/migrate/config/licenses/GPL-2.0-or-later.txt b/tfmanager/migrate/config/licenses/GPL-2.0-or-later.txt new file mode 100644 index 0000000..17cb286 --- /dev/null +++ b/tfmanager/migrate/config/licenses/GPL-2.0-or-later.txt @@ -0,0 +1,117 @@ +GNU GENERAL PUBLIC LICENSE +Version 2, June 1991 + +Copyright (C) 1989, 1991 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + +Preamble + +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. + +To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. + +For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. + +We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. + +Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. + +Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. + +The precise terms and conditions for copying, distribution and modification follow. + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + +0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. + +1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. + + c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. + +4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. + +6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. + +7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. + +10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +END OF TERMS AND CONDITIONS + +How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + one line to give the program's name and an idea of what it does. Copyright (C) yyyy name of author + + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. + +signature of Ty Coon, 1 April 1989 Ty Coon, President of Vice diff --git a/tfmanager/migrate/config/licenses/LicenseRef-Brainnetome.txt b/tfmanager/migrate/config/licenses/LicenseRef-Brainnetome.txt new file mode 100644 index 0000000..fc3126e --- /dev/null +++ b/tfmanager/migrate/config/licenses/LicenseRef-Brainnetome.txt @@ -0,0 +1,3 @@ +Please read the following legal agreement: + +The information, images and data on this website are the property of the Brainetome Center. Our center is willing to make this information available to researchers, scientists and others at colleges, universities, not-for-profit foundations and other similar institutions free of charge, subject to proper attribution and an agreement to share alike, for use for non-commercial purposes. Brainetome Center will consider granting a license to individuals and entities that wish to use the information, images and data for commercial purposes. Such requests should be made to Dr. Lingzhong Fan by e-mail: lzfan@nlpr.ia.ac.cn diff --git a/tfmanager/migrate/config/licenses/LicenseRef-D99.txt b/tfmanager/migrate/config/licenses/LicenseRef-D99.txt new file mode 100644 index 0000000..200500f --- /dev/null +++ b/tfmanager/migrate/config/licenses/LicenseRef-D99.txt @@ -0,0 +1,14 @@ +Welcome to the D99 macaque atlas. This text file briefly describes the files released with this atlas. +If you have questions regarding the use of any of these files, please contact the authors. You may also +post messages to the AFNI messageboard for AFNI specific questions.If you make use of the template +or atlas in your research, we ask you cite this paper: + + "Three-dimensional digital template atlas of the macaque brain" + Reveley, Gruslys, Ye, Samaha, Glen, Russ, Saad, Seth, Leopold, Saleem, + Cerebral Cortex, 2016, in press + +Note the atlas dataset may not be modified or redistributed without prior +consent from the authors. + +Please contact glend@mail.nih.gov or saleemks@mail.nih.gov with questions, +comments and suggestions. diff --git a/tfmanager/migrate/config/licenses/LicenseRef-FMRIB-FSL.txt b/tfmanager/migrate/config/licenses/LicenseRef-FMRIB-FSL.txt new file mode 100644 index 0000000..132caab --- /dev/null +++ b/tfmanager/migrate/config/licenses/LicenseRef-FMRIB-FSL.txt @@ -0,0 +1,50 @@ + FMRIB Software Library, Release 6.0 (c) 2018, The University of + Oxford (the "Software") + + The Software remains the property of Oxford University Innovation + ("the University"). + + The Software is distributed "AS IS" under this Licence solely for + non-commercial use in the hope that it will be useful, but in order + that the University as a charitable foundation protects its assets for + the benefit of its educational and research purposes, the University + makes clear that no condition is made or to be implied, nor is any + warranty given or to be implied, as to the accuracy of the Software, + or that it will be suitable for any particular purpose or for use + under any specific conditions. Furthermore, the University disclaims + all responsibility for the use which is made of the Software. It + further disclaims any liability for the outcomes arising from using + the Software. + + The Licensee agrees to indemnify the University and hold the + University harmless from and against any and all claims, damages and + liabilities asserted by third parties (including claims for + negligence) which arise directly or indirectly from the use of the + Software or the sale of any products based on the Software. + + No part of the Software may be reproduced, modified, transmitted or + transferred in any form or by any means, electronic or mechanical, + without the express permission of the University. The permission of + the University is not required if the said reproduction, modification, + transmission or transference is done without financial return, the + conditions of this Licence are imposed upon the receiver of the + product, and all original and amended source code is included in any + transmitted product. You may be held legally responsible for any + copyright infringement that is caused or encouraged by your failure to + abide by these terms and conditions. + + You are not permitted under this Licence to use this Software + commercially. Use for which any financial return is received shall be + defined as commercial use, and includes (1) integration of all or part + of the source code or the Software into a product for sale or license + by or on behalf of Licensee to third parties or (2) use of the + Software or any derivative of it for research with the final aim of + developing software products for sale or license to a third party or + (3) use of the Software or any derivative of it for research with the + final aim of developing non-software products for sale or license to a + third party, or (4) use of the Software to provide any service to an + external organisation for which payment is received. If you are + interested in using the Software commercially, please contact Oxford + University Innovation ("OUI"), the technology transfer company of the + University, to negotiate a licence. Contact details are: + fsl@innovation.ox.ac.uk quoting Reference Project 9564, FSL. diff --git a/tfmanager/migrate/config/licenses/LicenseRef-FreeSurfer.txt b/tfmanager/migrate/config/licenses/LicenseRef-FreeSurfer.txt new file mode 100644 index 0000000..04e5ee0 --- /dev/null +++ b/tfmanager/migrate/config/licenses/LicenseRef-FreeSurfer.txt @@ -0,0 +1,195 @@ +All or portions of this licensed product (such portions are the "Software") have been +obtained under license from The General Hospital Corporation "MGH" and are subject to +the following terms and conditions: + + FreeSurfer Software License Agreement ("Agreement") + Version 1.0 (February 2011) + +This Agreement covers contributions to and downloads from the +FreeSurfer project ("FreeSurfer") maintained by The General Hospital +Corporation, Boston MA, USA ("MGH"). Part A of this Agreement applies to +contributions of software and/or data to FreeSurfer (including making +revisions of or additions to code and/or data already in FreeSurfer). Part +B of this Agreement applies to downloads of software and/or data from +FreeSurfer. Part C of this Agreement applies to all transactions with +FreeSurfer. If you distribute Software (as defined below) downloaded from +FreeSurfer, all of the paragraphs of Part B of this Agreement must be +included with and apply to such Software. + +Your contribution of software and/or data to FreeSurfer (including prior +to the date of the first publication of this Agreement, each a +"Contribution") and/or downloading, copying, modifying, displaying, +distributing or use of any software and/or data from FreeSurfer +(collectively, the "Software") constitutes acceptance of all of the +terms and conditions of this Agreement. If you do not agree to such +terms and conditions, you have no right to contribute your +Contribution, or to download, copy, modify, display, distribute or use +the Software. + +PART A. CONTRIBUTION AGREEMENT - License to MGH with Right to Sublicense +("Contribution Agreement"). + +1. As used in this Contribution Agreement, "you" means the individual + contributing the Contribution to FreeSurfer and the institution or + entity which employs or is otherwise affiliated with such + individual in connection with such Contribution. + +2. This Contribution Agreement applies to all Contributions made to + FreeSurfer, including without limitation Contributions made prior to + the date of first publication of this Agreement. If at any time you + make a Contribution to FreeSurfer, you represent that (i) you are + legally authorized and entitled to make such Contribution and to + grant all licenses granted in this Contribution Agreement with + respect to such Contribution; (ii) if your Contribution includes + any patient data, all such data is de-identified in accordance with + U.S. confidentiality and security laws and requirements, including + but not limited to the Health Insurance Portability and + Accountability Act (HIPAA) and its regulations, and your disclosure + of such data for the purposes contemplated by this Agreement is + properly authorized and in compliance with all applicable laws and + regulations; and (iii) you have preserved in the Contribution all + applicable attributions, copyright notices and licenses for any + third party software or data included in the Contribution. + +3. Except for the licenses granted in this Agreement, you reserve all + right, title and interest in your Contribution. + +4. You hereby grant to MGH, with the right to sublicense, a + perpetual, worldwide, non-exclusive, no charge, royalty-free, + irrevocable license to use, reproduce, make derivative works of, + display and distribute the Contribution. If your Contribution is + protected by patent, you hereby grant to MGH, with the right to + sublicense, a perpetual, worldwide, non-exclusive, no-charge, + royalty-free, irrevocable license under your interest in patent + rights covering the Contribution, to make, have made, use, sell and + otherwise transfer your Contribution, alone or in combination with + any other code. + +5. You acknowledge and agree that MGH may incorporate your + Contribution into FreeSurfer and may make FreeSurfer available to members + of the public on an open source basis under terms substantially in + accordance with the Software License set forth in Part B of this + Agreement. You further acknowledge and agree that MGH shall + have no liability arising in connection with claims resulting from + your breach of any of the terms of this Agreement. + +6. YOU WARRANT THAT TO THE BEST OF YOUR KNOWLEDGE YOUR CONTRIBUTION + DOES NOT CONTAIN ANY CODE THAT REQURES OR PRESCRIBES AN "OPEN + SOURCE LICENSE" FOR DERIVATIVE WORKS (by way of non-limiting + example, the GNU General Public License or other so-called + "reciprocal" license that requires any derived work to be licensed + under the GNU General Public License or other "open source + license"). + +PART B. DOWNLOADING AGREEMENT - License from MGH with Right to Sublicense +("Software License"). + +1. As used in this Software License, "you" means the individual + downloading and/or using, reproducing, modifying, displaying and/or + distributing the Software and the institution or entity which + employs or is otherwise affiliated with such individual in + connection therewith. The General Hospital Corporation ("MGH") + hereby grants you, with right to sublicense, with + respect to MGH's rights in the software, and data, if any, + which is the subject of this Software License (collectively, the + "Software"), a royalty-free, non-exclusive license to use, + reproduce, make derivative works of, display and distribute the + Software, provided that: + +(a) you accept and adhere to all of the terms and conditions of this +Software License; + +(b) in connection with any copy of or sublicense of all or any portion +of the Software, all of the terms and conditions in this Software +License shall appear in and shall apply to such copy and such +sublicense, including without limitation all source and executable +forms and on any user documentation, prefaced with the following +words: "All or portions of this licensed product (such portions are +the "Software") have been obtained under license from The General Hospital +Corporation "MGH" and are subject to the following terms and +conditions:" + +(c) you preserve and maintain all applicable attributions, copyright +notices and licenses included in or applicable to the Software; + +(d) modified versions of the Software must be clearly identified and +marked as such, and must not be misrepresented as being the original +Software; and + +(e) you consider making, but are under no obligation to make, the +source code of any of your modifications to the Software freely +available to others on an open source basis. + +2. The license granted in this Software License includes without + limitation the right to (i) incorporate the Software into + proprietary programs (subject to any restrictions applicable to + such programs), (ii) add your own copyright statement to your + modifications of the Software, and (iii) provide additional or + different license terms and conditions in your sublicenses of + modifications of the Software; provided that in each case your use, + reproduction or distribution of such modifications otherwise + complies with the conditions stated in this Software License. + +3. This Software License does not grant any rights with respect to + third party software, except those rights that MGH has been + authorized by a third party to grant to you, and accordingly you + are solely responsible for (i) obtaining any permissions from third + parties that you need to use, reproduce, make derivative works of, + display and distribute the Software, and (ii) informing your + sublicensees, including without limitation your end-users, of their + obligations to secure any such required permissions. + +4. The Software has been designed for research purposes only and has + not been reviewed or approved by the Food and Drug Administration + or by any other agency. YOU ACKNOWLEDGE AND AGREE THAT CLINICAL + APPLICATIONS ARE NEITHER RECOMMENDED NOR ADVISED. Any + commercialization of the Software is at the sole risk of the party + or parties engaged in such commercialization. You further agree to + use, reproduce, make derivative works of, display and distribute + the Software in compliance with all applicable governmental laws, + regulations and orders, including without limitation those relating + to export and import control. + +5. The Software is provided "AS IS" and neither MGH nor any + contributor to the software (each a "Contributor") shall have any + obligation to provide maintenance, support, updates, enhancements + or modifications thereto. MGH AND ALL CONTRIBUTORS SPECIFICALLY + DISCLAIM ALL EXPRESS AND IMPLIED WARRANTIES OF ANY KIND INCLUDING, + BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR + A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + MGH OR ANY CONTRIBUTOR BE LIABLE TO ANY PARTY FOR DIRECT, + INDIRECT, SPECIAL, INCIDENTAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY ARISING IN ANY WAY + RELATED TO THE SOFTWARE, EVEN IF MGH OR ANY CONTRIBUTOR HAS + BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. TO THE MAXIMUM + EXTENT NOT PROHIBITED BY LAW OR REGULATION, YOU FURTHER ASSUME ALL + LIABILITY FOR YOUR USE, REPRODUCTION, MAKING OF DERIVATIVE WORKS, + DISPLAY, LICENSE OR DISTRIBUTION OF THE SOFTWARE AND AGREE TO + INDEMNIFY AND HOLD HARMLESS MGH AND ALL CONTRIBUTORS FROM AND + AGAINST ANY AND ALL CLAIMS, SUITS, ACTIONS, DEMANDS AND JUDGMENTS + ARISING THEREFROM. + +6. None of the names, logos or trademarks of MGH or any of + MGH's affiliates or any of the Contributors, or any funding + agency, may be used to endorse or promote products produced in + whole or in part by operation of the Software or derived from or + based on the Software without specific prior written permission + from the applicable party. + +7. Any use, reproduction or distribution of the Software which is not + in accordance with this Software License shall automatically revoke + all rights granted to you under this Software License and render + Paragraphs 1 and 2 of this Software License null and void. + +8. This Software License does not grant any rights in or to any + intellectual property owned by MGH or any Contributor except + those rights expressly granted hereunder. + +PART C. MISCELLANEOUS + +This Agreement shall be governed by and construed in accordance with +the laws of The Commonwealth of Massachusetts without regard to +principles of conflicts of law. This Agreement shall supercede and +replace any license terms that you may have agreed to previously with +respect to FreeSurfer. + diff --git a/tfmanager/migrate/config/licenses/LicenseRef-HCPpipelines.txt b/tfmanager/migrate/config/licenses/LicenseRef-HCPpipelines.txt new file mode 100644 index 0000000..5338fe9 --- /dev/null +++ b/tfmanager/migrate/config/licenses/LicenseRef-HCPpipelines.txt @@ -0,0 +1,56 @@ +# HCP Pipelines + +## License (except for files/folders mentioned below in ["Other licenses"](#other-licenses) + +Human Connectome Project [Pipelines][Pipelines] = THIS SOFTWARE + +Copyright (c) 2011-2021 [The Human Connectome Project][HCP] and [The Connectome Coordination Facility][CCF] + +Redistribution and use in source and binary forms, with or without modification, +is permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, + this list of conditions, and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions, and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* The names of Washington University in St. Louis, the University of Minnesota, + Oxford University, the Human Connectome Project (or HCP), or any contributors + to this software may *not* be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS +OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + + +[HCP]: https://www.humanconnectome.org +[Pipelines]: https://github.com/Washington-University/HCPpipelines +[CCF]: https://www.humanconnectome.org + +## Other licenses + +`global/matlab/@gifti` is copyright Guillaume Flandin, released under GPL v2+, see `global/matlab/@gifti/gifti-1.6/LICENCE` + +`global/matlab/cifti-matlab/@xmltreemod` is copyright Guillaume Flandin, released under LGPL v3+, see `global/matlab/cifti-matlab/@xmltreemod/LICENSE` + +`global/matlab/cifti-matlab/private/read_nifti2_hdr.m` is adapted from a file from ft_cifti, and is additionally copyright Robert Oostenveld, released under either BSD 2-clause or GPL v3+, see `global/matlab/cifti-matlab/LICENSE` + +`global/fsl/etc/matlab` is copyright The University of Oxford, released under BSD 2-clause, see `global/fsl/etc/matlab/LICENSE` + +`tICA/scripts/FastICA_25` is copyright Aalto University, released under GPL v2, see `tICA/scripts/FastICA_25/LICENSE` + +`tICA/scripts/icasso122` is copyright Juha Vesanto, Johan Himberg and the SOM toolbox programming team, released under GPL v2+, see `tICA/scripts/icasso122/README_license.txt` + +Compiled matlab binaries are released under some combination of these licenses, with some or all of the above copyright holders, as some of these matlab source files are compiled into them. + diff --git a/tfmanager/migrate/config/licenses/MIT-CBIG.txt b/tfmanager/migrate/config/licenses/MIT-CBIG.txt new file mode 100644 index 0000000..09a7f8c --- /dev/null +++ b/tfmanager/migrate/config/licenses/MIT-CBIG.txt @@ -0,0 +1,7 @@ +Copyright (c) 2016 Computational Brain Imaging Group (CBIG) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/tfmanager/migrate/config/schema.json b/tfmanager/migrate/config/schema.json index 20b723c..ceb202c 100644 --- a/tfmanager/migrate/config/schema.json +++ b/tfmanager/migrate/config/schema.json @@ -234,9 +234,72 @@ }, "dependentRequired": {"set": ["evidence"]} } + }, + "licenses": { + "type": "object", + "additionalProperties": false, + "properties": { + "texts": { + "type": "array", + "items": { + "type": "object", + "required": ["license", "file", "sha256", "url", "why"], + "additionalProperties": false, + "properties": { + "license": {"type": "string", "minLength": 1}, + "file": {"type": "string", "pattern": "^[A-Za-z0-9][A-Za-z0-9_.+-]*\\.txt$"}, + "sha256": {"type": "string", "pattern": "^[0-9a-f]{64}$"}, + "url": {"$ref": "#/$defs/url"}, + "why": {"type": "string", "minLength": 10} + } + } + }, + "table": { + "type": "array", + "items": { + "type": "object", + "required": ["id", "template", "license", "basis", "url", "retrieved", "why"], + "additionalProperties": false, + "properties": { + "id": {"type": "string", "pattern": "^[A-Za-z0-9-]+$"}, + "template": {"$ref": "#/$defs/template"}, + "atlas": {"type": "string", "pattern": "^[A-Za-z0-9]+$"}, + "files": { + "type": "object", + "minProperties": 1, + "additionalProperties": {"type": "string", "pattern": "^[A-Za-z0-9+]+$"} + }, + "count": {"type": "integer", "minimum": 1}, + "license": {"type": "string", "minLength": 1}, + "basis": {"enum": ["upstream", "derived", "templateflow"]}, + "url": {"$ref": "#/$defs/url"}, + "quote": {"type": "string", "minLength": 10}, + "evidence": {"type": "array", "minItems": 1, "items": {"type": "string"}}, + "retrieved": {"type": "string", "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"}, + "why": {"type": "string", "minLength": 10}, + "license_file": {"enum": ["keep", "write"]}, + "replace": { + "type": "array", + "minItems": 1, + "items": { + "type": "object", + "required": ["old", "new"], + "additionalProperties": false, + "properties": { + "old": {"type": "string", "minLength": 1}, + "new": {"type": "string", "minLength": 1} + } + } + } + }, + "not": {"required": ["atlas", "files"]} + } + } + } } }, "$defs": { + "url": {"type": "string", "pattern": "^https://"}, "template": {"type": "string", "pattern": "^tpl-[A-Za-z0-9]+$"}, "column": {"type": "string", "minLength": 1}, "snake": {"pattern": "^[a-z][a-z0-9_]*$"}, diff --git a/tfmanager/migrate/content.py b/tfmanager/migrate/content.py index 00b8aa9..41d50e6 100644 --- a/tfmanager/migrate/content.py +++ b/tfmanager/migrate/content.py @@ -11,6 +11,8 @@ * T06: template_description.json takes the ``res`` blocks of the res plan, ``RRID:`` prefixes, ``Funding`` as a list, cohort ages as ``[min, max]`` with their units, and DOIs as URLs; +* T07: licenses, from the config's cited table (:mod:`.licensing`): the License of the + template, LICENSE with its SPDX header, the License of sidecars, ``docs/licenses`` texts; * T10: files written by hand (README.md, ``docs/``); * T08: the generated files (atlas descriptions, cohorts table); * T09: ``.gitattributes`` (the config's text); @@ -42,18 +44,20 @@ from .findings import Finding from .headers import HeaderIndex from .labels import LabelIndex +from .licensing import LICENSES_DIR, changes_item, plan_licenses from .lookups import check_labels, plan_tables from .names import NamePlan from .res import ResPlan from .snapshot import Snapshot -#: Every transform, by code (T04 and T07 come with the licenses) +#: Every transform, by code (T04 comes with the atlases table) TRANSFORMS = { 'T01': 'Lookup tables in BIDS columns and format; extra columns described in sidecars.', 'T02': 'Lookup tables written from their upstream source.', 'T03': 'The participants table: participant_id, source_id, and a JSON sidecar.', 'T05': 'References to files follow the renames, in JSON files.', 'T06': 'template_description.json in the form of TemplateFlow 2.0.', + 'T07': 'Licenses: SPDX License, LICENSE header and text, sidecars, docs/licenses texts.', 'T08': 'Generated files: atlas descriptions and the cohorts table.', 'T09': '.gitattributes: binary files and GIFTI in the annex, text files in git.', 'T10': 'Files written by hand (README.md, docs/).', @@ -331,6 +335,7 @@ def changes_entry( references: list[str], edited: dict[str, list[str]], created: list[str], + licenses: str | None = None, ) -> str: """T11: the entry of CHANGES (BIDS form: version and date, then indented items). @@ -360,6 +365,8 @@ def changes_entry( phrases.append(f'BIDSVersion {rs.bids_version}, TemplateFlowVersion {rs.version}') if phrases: items.append(f'{DESCRIPTION}: {"; ".join(phrases)}.') + if licenses: + items.append(licenses) if references: files = _count(len(references), 'JSON file') items.append(f'References to renamed files follow the new names in {files}.') @@ -369,7 +376,9 @@ def changes_entry( items.append(f'New files: {", ".join(created)}.') lines = [f'{version} {date}'] for item in items: - lines += textwrap.wrap(item, 86, initial_indent=' - ', subsequent_indent=' ') + lines += textwrap.wrap( + item, 86, initial_indent=' - ', subsequent_indent=' ', break_on_hyphens=False + ) return '\n'.join(lines) + '\n' @@ -445,6 +454,9 @@ def plan_content( if isinstance(desc, dict): work.write(DESCRIPTION, dump_json(description(desc, names.res)).encode(), 'T06') + # T07 + plan.findings += plan_licenses(snapshot.name, work.files, work.write, config, rs) + # T10, then T08 for path, data in sorted((authored or {}).items()): if work.files.get(path, b'') is None: @@ -488,7 +500,18 @@ def plan_content( changes = work.files.get('CHANGES', b'') or b'' text = changes.decode('utf-8', 'replace') if plan.flip and not text.lstrip().startswith(f'{rs.version} '): - fields = changed_fields(before or {}, work.json(DESCRIPTION) or {}) + # The licenses have their own item (T07's sidecars and texts too) + fields = [ + f for f in changed_fields(before or {}, work.json(DESCRIPTION) or {}) if f != 'License' + ] + licensing = changes_item( + config, snapshot.name, work.base, work.files, work.done, (before or {}).get('License') + ) + t07 = { + p + for p, codes in work.done.items() + if codes == ['T07'] and (p.startswith(LICENSES_DIR) or p.endswith('.json')) + } removed = len(names.removed) + len(names.merged) + len(work.deleted) entry = changes_entry( rs.version, @@ -499,7 +522,10 @@ def plan_content( fields=fields, references=sorted(p for p, codes in work.done.items() if 'T05' in codes), edited=edited, - created=sorted(p for p in work.files if p not in work.base and p != 'CHANGES'), + created=sorted( + p for p in work.files if p not in work.base and p != 'CHANGES' and p not in t07 + ), + licenses=licensing, ) old = text.lstrip('\n') work.write('CHANGES', (entry + ('\n' + old if old else '')).encode(), 'T11') diff --git a/tfmanager/migrate/findings.py b/tfmanager/migrate/findings.py index 323671c..fdb1f5a 100644 --- a/tfmanager/migrate/findings.py +++ b/tfmanager/migrate/findings.py @@ -21,6 +21,7 @@ 'M113': (True, 'A decision of the config also matches a new name (it would apply again).'), 'M201': (False, 'README.md is missing: written by hand (T10), the template cannot flip.'), 'M202': (False, 'A segmentation has no lookup table: T02 writes it from its source, or TODO.'), + 'M203': (False, 'A template or atlas has no license in the config: its License stays as is.'), 'M204': (True, 'A generated file cannot be computed (its metadata cannot be read).'), 'M205': (False, 'The result is not strict-clean: versions and CHANGES stay as they are.'), 'M206': (True, 'A lookup table does not describe its image: values or volumes without row.'), @@ -28,6 +29,7 @@ 'M208': (False, 'The values of a segmentation are not integers, or carry a scale factor.'), 'M209': (True, 'A table matches no layout of the config, or several, or cannot convert.'), 'M210': (False, 'The GIFTI files of a surface atlas disagree on its label table.'), + 'M211': (True, 'A license text is needed but neither tfmanager nor the config has it.'), } diff --git a/tfmanager/migrate/licensing.py b/tfmanager/migrate/licensing.py new file mode 100644 index 0000000..23f7107 --- /dev/null +++ b/tfmanager/migrate/licensing.py @@ -0,0 +1,311 @@ +"""T07: licenses, from the cited table of the config (``licenses``). + +* template_description.json takes the License of the template's entry; +* LICENSE starts with ``SPDX-License-Identifier: ``, a blank line and its text: the + text it has (``keep``, after the entry's ``replace`` edits; a header it had is dropped) or + the license's text (``write``, from the config or bundled with tfmanager); +* JSON sidecars that state a License take that of the entry of their files, or of their + atlas (otherwise M203: the value stays); +* the files of a ``files`` entry declare its license in JSON sidecars: one per directory and + suffix when such a sidecar reaches those files only, one per file otherwise; +* the rows of the atlases table take the license of their atlas's entry (T08 then generates + the atlas descriptions from them); +* ``docs/licenses/.txt`` holds the text of each license that the sidecars or the atlases + table use and the template's License does not include (M211 when no text is known). +""" + +from __future__ import annotations + +import json +from collections import defaultdict + +from .. import licenses +from ..generate import atlas_label +from ..naming import FileName, parse, serialize +from ..ruleset import RuleSet +from ..tables import NA, dump_json, read_tsv, write_tsv +from ..validate.licenses import LICENSES_DIR +from .config import Config, License +from .findings import Finding +from .lookups import Write + +DESCRIPTION = 'template_description.json' +LICENSE = 'LICENSE' +CODE = 'T07' + + +def license_file(expression: str, text: str) -> str: + """A LICENSE: the SPDX header, a blank line and the text. + + >>> license_file('CC0-1.0', 'Text.') + 'SPDX-License-Identifier: CC0-1.0\\n\\nText.\\n' + """ + return f'SPDX-License-Identifier: {expression}\n\n{_ended(text)}' + + +def strip_header(text: str) -> str: + """The text of a LICENSE without its SPDX header line (and the blank lines after it). + + >>> strip_header('SPDX-License-Identifier: MIT\\n\\nText.\\n') + 'Text.\\n' + >>> strip_header('Text.\\n') + 'Text.\\n' + """ + if licenses.header(text) is None: + return text.lstrip('\n') + return text.lstrip('').partition('\n')[2].lstrip('\n') + + +def apply_edits(text: str, edits: tuple[tuple[str, str], ...]) -> tuple[str, list[str]]: + """Apply the ``replace`` edits of an entry: each old text must occur once. + + An old text that is absent while its new text is there was replaced already. + + >>> apply_edits('a b', (('a', 'c'),)) + ('c b', []) + >>> apply_edits('c b', (('a', 'c'),)) + ('c b', []) + >>> apply_edits('d b', (('a', 'c'),))[1] + ["'a' is not in LICENSE."] + """ + problems = [] + for old, new in edits: + count = text.count(old) + if count == 1: + text = text.replace(old, new) + elif count > 1: + problems.append(f'{old!r} is {count} times in LICENSE.') + elif new not in text: + problems.append(f'{old!r} is not in LICENSE.') + return text, problems + + +def _ended(text: str) -> str: + return text if text.endswith('\n') else text + '\n' + + +def _json(files: dict[str, bytes | None], path: str): + data = files.get(path) + if data is None: + return None + try: + return json.loads(data) + except ValueError: + return None # reported by TF300 + + +def _ids(expression) -> set[str]: + if not isinstance(expression, str): + return set() + result = licenses.check(expression) + return set(result.identifiers) if result.valid else set() + + +def _sidecar_path(dirname: str, entities: dict, suffix: str, order: list[str]) -> str: + name = serialize(FileName(path='', entities=entities, suffix=suffix, extension='.json'), order) + return f'{dirname}/{name}' if dirname else name + + +def _under(path_dir: str, dirname: str) -> bool: + return not dirname or path_dir == dirname or path_dir.startswith(dirname + '/') + + +def _sidecars( + entry: License, parsed: dict[str, FileName], order: list[str] +) -> tuple[list[str], str | None]: + """The sidecars that declare the license of a ``files`` entry (or why there are none).""" + data = {p: f for p, f in parsed.items() if f.extension != '.json' and f.suffix} + hits = sorted( + (p for p, f in data.items() if entry.files.items() <= f.entities.items()), key=str.encode + ) + if len(hits) != entry.count: + return [], f'{len(hits)} files match {entry.files}, not {entry.count}.' + groups: dict[tuple[str, str], list[FileName]] = defaultdict(list) + for path in hits: + f = parsed[path] + groups[f.dirname, f.suffix].append(f) + out = [] + for (dirname, suffix), group in sorted(groups.items()): + common = { + k: v + for k, v in group[0].entities.items() + if all(g.entities.get(k) == v for g in group) + } + reach = { + p + for p, f in data.items() + if f.suffix == suffix + and _under(f.dirname, dirname) + and common.items() <= f.entities.items() + } + if reach == {g.path for g in group}: + out.append(_sidecar_path(dirname, common, suffix, order)) + else: + out += [_sidecar_path(g.dirname, g.entities, suffix, order) for g in group] + return out, None + + +def plan_licenses( + template: str, + files: dict[str, bytes | None], + write: Write, + config: Config, + rs: RuleSet, +) -> list[Finding]: + """T07 on the files of a template (after the renames and the other transforms).""" + findings: list[Finding] = [] + entries = config.licenses_for(template) + own = next((e for e in entries if e.scope == 'template'), None) + by_atlas = {e.atlas: e for e in entries if e.scope == 'atlas'} + subsets = [e for e in entries if e.scope == 'files'] + parsed = {p: parse(p) for p in sorted(files, key=str.encode)} + parsed = {p: f for p, f in parsed.items() if f.is_bids} + + # template_description.json and LICENSE + if own is None: + message = 'No license in the config: License and LICENSE stay as they are.' + findings.append(Finding('M203', DESCRIPTION, message)) + else: + desc = _json(files, DESCRIPTION) + if isinstance(desc, dict) and desc.get('License') != own.license: + write(DESCRIPTION, dump_json({**desc, 'License': own.license}).encode(), CODE) + text = None + if own.license_file == 'write': + text = config.license_text(own.license) + if text is None: + message = f'No text for {own.license} (licenses.texts).' + findings.append(Finding('M211', LICENSE, message)) + elif files.get(LICENSE) is None: + what = 'annexed' if LICENSE in files else 'missing' + message = f'license_file is keep, but LICENSE is {what}.' + findings.append(Finding('M108', f'licenses/{own.id}', message)) + else: + text, problems = apply_edits(strip_header(files[LICENSE].decode()), own.replace) + for problem in problems: + findings.append(Finding('M108', f'licenses/{own.id}', problem)) + if text is not None: + write(LICENSE, license_file(own.license, text).encode(), CODE) + + # Every atlas entry has files (atlases without entry: M203 where a sidecar says License) + labels = {f.entities['atlas'] for f in parsed.values() if 'atlas' in f.entities} + for label in sorted(set(by_atlas) - labels): + message = f'No file of the template has the atlas {label}.' + findings.append(Finding('M108', f'licenses/{by_atlas[label].id}', message)) + + # The License that JSON sidecars state follows their entry + def entry_of(f: FileName) -> License | None: + for entry in subsets: + if entry.files.items() <= f.entities.items(): + return entry + return by_atlas.get(f.entities.get('atlas')) + + for path, f in parsed.items(): + data = _json(files, path) if f.extension == '.json' else None + if not isinstance(data, dict) or 'License' not in data: + continue + entry = entry_of(f) + if entry is None: + message = f'No license in the config for its files: License {data["License"]!r} stays.' + findings.append(Finding('M203', path, message)) + elif data['License'] != entry.license: + write(path, dump_json({**data, 'License': entry.license}).encode(), CODE) + + # Subsets of files: sidecars + for entry in subsets: + paths, problem = _sidecars(entry, parsed, rs.order) + if problem: + findings.append(Finding('M108', f'licenses/{entry.id}', problem)) + for path in paths: + data = {} if path not in files else _json(files, path) + if not isinstance(data, dict): + message = f'{path} is not a JSON object (or is annexed).' + findings.append(Finding('M108', f'licenses/{entry.id}', message)) + elif path not in files or data.get('License') != entry.license: + write(path, dump_json({**data, 'License': entry.license}).encode(), CODE) + + # The atlases table: each row takes the license of its atlas's entry + atlases = f'{template}_atlases.tsv' + if files.get(atlases) is not None and by_atlas: + table = read_tsv(files[atlases]) + rows = [] + for row in table.rows: + entry = by_atlas.get(atlas_label(row.get('atlas_id', NA))) + rows.append(row if entry is None else {**row, 'license': entry.license}) + if 'atlas_id' in table.columns and rows != table.rows: + columns = table.columns + if 'license' not in columns: + columns = [*columns[:2], 'license', *columns[2:]] + write(atlases, write_tsv(columns, rows).encode(), CODE) + + # docs/licenses: the texts of the licenses that parts of the template use + desc = _json(files, DESCRIPTION) + template_ids = _ids(desc.get('License')) if isinstance(desc, dict) else set() + used: set[str] = set() + for path in sorted(files, key=str.encode): + data = _json(files, path) if path.endswith('.json') and path != DESCRIPTION else None + if isinstance(data, dict) and 'License' in data and parse(path).is_bids: + used |= _ids(data['License']) + if files.get(atlases) is not None: + table = read_tsv(files[atlases]) + if 'license' in table.columns: + for value in table.column('license'): + used |= _ids(value) + for key in sorted(used - template_ids): + path = f'{LICENSES_DIR}{key}.txt' + text = config.license_text(key) + if text is not None: + write(path, _ended(text).encode(), CODE) + elif files.get(path) is None: + message = f'{key} is used, but neither tfmanager nor the config has its text.' + findings.append(Finding('M211', path, message)) + return findings + + +def _listed(items: list[str]) -> str: + return items[0] if len(items) == 1 else f'{", ".join(items[:-1])} and {items[-1]}' + + +def changes_item( + config: Config, + template: str, + before: dict[str, bytes | None], + after: dict[str, bytes | None], + done: dict[str, list[str]], + old: object, +) -> str | None: + """T11: what the entry of CHANGES says about licenses (``None``: nothing changed). + + ``before`` and ``after`` are the files before and after the transforms, ``done`` the + transforms that wrote each, ``old`` the License the template had. + """ + parts = [] + desc = _json(after, DESCRIPTION) + new = desc.get('License') if isinstance(desc, dict) else None + if new is not None and new != old: + parts.append(f'License {new}' + ('' if old is None else f' (was {old!r})')) + own = next((e for e in config.licenses_for(template) if e.scope == 'template'), None) + was, now = before.get(LICENSE), after.get(LICENSE) + if now is not None and now != was and CODE in done.get(LICENSE, ()): + if was is None or (own is not None and own.license_file == 'write'): + parts.append(f'LICENSE holds the text of {new}') + elif strip_header(was.decode()) == strip_header(now.decode()): + parts.append('LICENSE starts with its SPDX-License-Identifier line') + else: + parts.append( + 'LICENSE starts with its SPDX-License-Identifier line, parts of its text updated' + ) + ours = sorted(p for p, codes in done.items() if CODE in codes) + sidecars = [p for p in ours if p.endswith('.json') and p != DESCRIPTION] + if sidecars: + parts.append(f'License of {len(sidecars)} JSON sidecar{"s" if len(sidecars) > 1 else ""}') + atlases = f'{template}_atlases.tsv' + if atlases in ours and before.get(atlases) is not None: + was = {row.get('atlas_id'): row.get('license') for row in read_tsv(before[atlases]).rows} + rows = read_tsv(after[atlases]).rows + count = sum(row.get('license') != was.get(row.get('atlas_id')) for row in rows) + parts.append(f'License of {count} atlas{"es" if count > 1 else ""} in {atlases}') + texts = [p[len(LICENSES_DIR) : -len('.txt')] for p in ours if p.startswith(LICENSES_DIR)] + if texts: + what = 'texts' if len(texts) > 1 else 'text' + parts.append(f'{LICENSES_DIR} has the {what} of {_listed(texts)}') + return f'Licenses: {"; ".join(parts)}.' if parts else None diff --git a/tfmanager/tests/test_migrate_content.py b/tfmanager/tests/test_migrate_content.py index 69b5e5b..3f284a9 100644 --- a/tfmanager/tests/test_migrate_content.py +++ b/tfmanager/tests/test_migrate_content.py @@ -9,7 +9,7 @@ import pytest -from tfmanager.migrate.config import CONFIG_DIR, Config, ConfigError, Edit, load_config +from tfmanager.migrate.config import CONFIG_DIR, Config, ConfigError, Edit, License, load_config from tfmanager.migrate.content import TRANSFORMS, changes_entry, description, plan_content from tfmanager.migrate.engine import plan_template, res_table from tfmanager.migrate.findings import CODES @@ -31,6 +31,19 @@ version='2.0.0', policies={'res_key': 'zoom', 'content_change': 'freeze', 'flip': 'when-clean'}, gitattributes=GITATTRIBUTES, + licenses=( + License( + id='Test', + template='tpl-Test', + license='CC0-1.0', + basis='upstream', + url='https://example.org/test', + why='The license of the test template.', + retrieved='2027-01-01', + quote='No rights reserved.', + license_file='keep', + ), + ), ) DESC = { 'Identifier': 'Test', @@ -317,9 +330,10 @@ def test_config_edits(tmp_path, problem, items): def test_documented_codes(): - assert set(TRANSFORMS) == {'T01', 'T02', 'T03', 'T05', 'T06', 'T08', 'T09', 'T10', 'T11'} - assert {'M201', 'M204', 'M205'} <= set(CODES) + assert set(TRANSFORMS) == {f'T{i:02d}' for i in range(1, 12)} - {'T04'} + assert {'M201', 'M203', 'M204', 'M205', 'M211'} <= set(CODES) assert not CODES['M201'][0] and not CODES['M205'][0] and CODES['M204'][0] + assert not CODES['M203'][0] and CODES['M211'][0] @pytest.fixture(scope='module') @@ -339,10 +353,12 @@ def test_golden_res(archive): def test_archive(archive): - """What the transforms write; the errors that remain (PR 5c, WP5).""" + """What the transforms write; the errors that remain (PR 5c2, WP5).""" snapshots, plans = archive assert [name for name, p in plans.items() if p.blocked] == [] - assert {name for name, p in plans.items() if p.content.flip} == set() + # Strict-clean with their licenses (and a README.md) + flip = {'tpl-MNI152NLin6Sym', 'tpl-MNI305', 'tpl-MNIColin27', 'tpl-onavg'} + assert {name for name, p in plans.items() if p.content.flip} == flip done = Counter( c for p in plans.values() for codes in p.content.transforms.values() for c in codes ) @@ -351,8 +367,10 @@ def test_archive(archive): 'T02': 31, 'T03': 4, 'T05': 7, - 'T06': 28, + 'T06': 29, + 'T07': 85, 'T08': 14, + 'T11': 4, 'Diedrichsen2009-source': 1, } errors = Counter( @@ -360,12 +378,12 @@ def test_archive(archive): ) # fmt: off assert errors == { - 'TF301': 9, 'TF310': 50, 'TF314': 30, 'TF340': 24, - 'TF502': 41, 'TF504': 6, 'TF505': 24, 'TF601': 11, 'TF608': 11, + 'TF301': 5, 'TF310': 50, 'TF314': 26, 'TF340': 24, + 'TF508': 6, 'TF601': 11, 'TF608': 11, } findings = Counter(f.code for p in plans.values() for f in p.findings) assert findings == { - 'M201': 24, 'M205': 30, 'M207': 6, 'M208': 6, 'M210': 2, + 'M201': 24, 'M205': 26, 'M207': 6, 'M208': 6, 'M210': 2, } # fmt: on frozen = sorted(f'{n}/{o}' for n, p in plans.items() for o, v in p.rows.items() if v == NA) diff --git a/tfmanager/tests/test_migrate_licensing.py b/tfmanager/tests/test_migrate_licensing.py new file mode 100644 index 0000000..c5bbffc --- /dev/null +++ b/tfmanager/tests/test_migrate_licensing.py @@ -0,0 +1,313 @@ +"""T07: licenses from the cited table of the config, and the checks of that table.""" + +import hashlib +import json +from dataclasses import replace +from importlib.resources import files + +import pytest +import yaml + +from tfmanager.migrate.config import ( + CONFIG_DIR, + ConfigError, + License, + LicenseText, + load_config, +) +from tfmanager.migrate.findings import CODES +from tfmanager.migrate.licensing import changes_item +from tfmanager.migrate.snapshot import Snapshot +from tfmanager.tests.test_migrate_content import CONFIG, DESC, README, T, plan, template, written + +OWN = CONFIG.licenses[0] +MIT = 'Copyright (c) 2016 Someone\n\nPermission is hereby granted, free of charge.\n' +MIT_TEXT = LicenseText( + license='MIT', + file='MIT.txt', + sha256=hashlib.sha256(MIT.encode()).hexdigest(), + url='https://example.org/mit', + why='The upstream text.', + text=MIT, +) + + +def entry(id_, license, **fields) -> License: + return License( + id=id_, + template=T, + license=license, + basis='upstream', + url='https://example.org/x', + why='Its upstream says so.', + retrieved='2027-01-01', + quote='Under these terms.', + **fields, + ) + + +def config(*entries, own=OWN): + return replace(CONFIG, licenses=(own, *entries), license_texts=(MIT_TEXT,)) + + +def codes(p): + """The findings of T07.""" + return sorted((f.code, f.path) for f in p.findings if f.code in ('M108', 'M203', 'M211')) + + +def again(p, snap, cfg): + """Plan the result of ``p`` again.""" + return plan(Snapshot(T, p.entries(snap), tuple(p.fragment)), config=cfg) + + +def test_write(): + """``write``: the license's text after the header; the License follows the entry.""" + desc = {**DESC, 'License': 'CC-by-nc-sa-4.0 International'} + snap = template({f'{T}_res-1_T1w.nii.gz': None, 'LICENSE': 'Old terms.\n'}, desc) + cfg = config(own=replace(OWN, license='CC-BY-4.0', license_file='write')) + p = plan(snap, config=cfg) + bundled = (files('tfmanager') / 'data' / 'CC-BY.LICENSE').read_text() + assert p.content.files['LICENSE'].decode() == ( + f'SPDX-License-Identifier: CC-BY-4.0\n\n{bundled.rstrip()}\n' + ) + assert written(p, 'template_description.json')['License'] == 'CC-BY-4.0' + assert p.content.transforms['LICENSE'] == ('T07',) + assert codes(p) == [] + assert again(p, snap, cfg).content.writes == {} + + +def test_keep(): + """``keep``: the text the template has, after the replace edits, with its header.""" + license = 'Copyright (C) 1993-2019 Someone.\nPermission is granted.\n' + snap = template({f'{T}_res-1_T1w.nii.gz': None, 'LICENSE': license}) + cfg = config(own=replace(OWN, replace=(('1993-2019', '1993-2004'),))) + p = plan(snap, config=cfg) + assert p.content.files['LICENSE'] == ( + b'SPDX-License-Identifier: CC0-1.0\n\n' + b'Copyright (C) 1993-2004 Someone.\nPermission is granted.\n' + ) + assert codes(p) == [] + # Done already: nothing to write, no finding + assert again(p, snap, cfg).content.writes == {} + assert codes(again(p, snap, cfg)) == [] + # A header that disagrees is replaced + snap = template({'LICENSE': 'SPDX-License-Identifier: MIT\n\nPermission is granted.\n'}) + p = plan(snap, config=config()) + assert p.content.files['LICENSE'] == ( + b'SPDX-License-Identifier: CC0-1.0\n\nPermission is granted.\n' + ) + # An edit that matches nothing; no LICENSE to keep + cfg = config(own=replace(OWN, replace=(('1990', '1991'),))) + assert codes(plan(template({'LICENSE': 'Terms.\n'}), config=cfg)) == [ + ('M108', 'licenses/Test') + ] + entries = {k: v for k, v in template({}).entries.items() if k != 'LICENSE'} + assert codes(plan(Snapshot(T, entries), config=config())) == [('M108', 'licenses/Test')] + + +def test_no_entry(): + """A template without license entry keeps its License and LICENSE (M203).""" + desc = {**DESC, 'License': 'CC-BY'} + snap = template({'LICENSE': 'Terms.\n', 'README.md': README}, desc) + p = plan(snap, config=replace(CONFIG, licenses=())) + assert codes(p) == [('M203', 'template_description.json')] + assert 'LICENSE' not in p.content.writes + assert written(p, 'template_description.json')['License'] == 'CC-BY' + + +def test_sidecars(): + """Sidecars that say License follow their atlas; other licenses get their text.""" + snap = template( + { + f'{T}_atlas-A_res-1_dseg.nii.gz': None, + f'{T}_atlas-A_dseg.json': json.dumps({'Name': 'A', 'License': 'See LICENSE file'}), + f'{T}_atlas-B_res-1_dseg.nii.gz': None, + f'{T}_atlas-B_dseg.json': json.dumps({'License': 'LicenseRef-Other'}), + f'{T}_atlas-C_res-1_dseg.nii.gz': None, + } + ) + cfg = config(entry('A', 'MIT', atlas='A'), entry('C', 'CC0-1.0', atlas='C')) + p = plan(snap, config=cfg) + assert written(p, f'{T}_atlas-A_dseg.json') == {'Name': 'A', 'License': 'MIT'} + assert written(p, f'{T}_atlas-B_dseg.json') == {'License': 'LicenseRef-Other'} + assert p.content.files['docs/licenses/MIT.txt'] == MIT.encode() + assert codes(p) == [ + ('M203', f'{T}_atlas-B_dseg.json'), + ('M211', 'docs/licenses/LicenseRef-Other.txt'), + ] + assert not CODES['M203'][0] and CODES['M211'][0] + # An entry for an atlas the template does not have + cfg = config(entry('D', 'MIT', atlas='D')) + assert codes(plan(template({}), config=cfg)) == [('M108', 'licenses/D')] + + +def test_atlases_table(): + """The rows of the atlases table take their atlas's license, and so do its descriptions.""" + path = f'{T}_atlases.tsv' + files = { + f'{T}_atlas-A_res-1_dseg.nii.gz': None, + f'{T}_atlas-B_res-1_dseg.nii.gz': None, + path: 'atlas_id\tname\tlicense\natlas-A\tA\tCC-BY-4.0\natlas-B\tB\tCC0-1.0\n', + } + snap, cfg = template(files), config(entry('A', 'MIT', atlas='A')) + p = plan(snap, config=cfg) + assert p.content.files[path] == ( + b'atlas_id\tname\tlicense\natlas-A\tA\tMIT\natlas-B\tB\tCC0-1.0\n' + ) + assert p.content.transforms[path] == ('T07',) + assert written(p, 'atlas-A_description.json')['License'] == 'MIT' + assert p.content.files['docs/licenses/MIT.txt'] == MIT.encode() + assert 'docs/licenses/CC-BY-4.0.txt' not in p.content.files + before = {k: e.content for k, e in snap.entries.items()} + item = changes_item(cfg, T, before, p.content.files, p.content.transforms, 'CC0-1.0') + assert item == (f'Licenses: License of 1 atlas in {path}; docs/licenses/ has the text of MIT.') + assert again(p, snap, cfg).content.writes == {} + # A table without a license column gets one, after atlas_id and name + files[path] = 'atlas_id\tname\natlas-A\tA\natlas-B\tB\n' + p = plan(template(files), config=cfg) + assert p.content.files[path] == b'atlas_id\tname\tlicense\natlas-A\tA\tMIT\natlas-B\tB\tn/a\n' + + +def test_files(): + """A subset of files declares its license in one sidecar per directory and suffix.""" + spheres = [f'{T}_hemi-{h}_den-10k_desc-x_sphere.surf.gii' for h in 'LR'] + others = [f'{T}_hemi-L_den-10k_sphere.surf.gii', f'{T}_res-1_desc-x_T1w.nii.gz'] + snap = template(dict.fromkeys(spheres + others)) + cfg = config(entry('X', 'MIT', files={'desc': 'x', 'den': '10k'}, count=2)) + p = plan(snap, config=cfg) + assert written(p, f'{T}_den-10k_desc-x_sphere.json') == {'License': 'MIT'} + assert p.content.files['docs/licenses/MIT.txt'] == MIT.encode() + assert codes(p) == [] + assert again(p, snap, cfg).content.writes == {} + # Not as many files as the entry says + cfg = config(entry('X', 'MIT', files={'desc': 'x'}, count=2)) + assert codes(plan(snap, config=cfg)) == [('M108', 'licenses/X')] + # A sidecar for the root files would also reach the cohort's: one sidecar per file + cohort = f'cohort-1/{T}_cohort-1_hemi-L_den-10k_desc-x_sphere.surf.gii' + snap = template(dict.fromkeys([*spheres, cohort])) + cfg = config(entry('X', 'MIT', files={'desc': 'x'}, count=3)) + p = plan(snap, config=cfg) + assert sorted(path for path in p.content.writes if path.endswith('.json')) == [ + f'cohort-1/{T}_cohort-1_hemi-L_den-10k_desc-x_sphere.json', + 'template_description.json', + f'{T}_hemi-L_den-10k_desc-x_sphere.json', + f'{T}_hemi-R_den-10k_desc-x_sphere.json', + ] + + +@pytest.fixture +def write_config(tmp_path): + """A config: the head of 2.0.0.yaml and a licenses section; MIT.txt under licenses/.""" + head = (CONFIG_DIR / '2.0.0.yaml').read_text().split('\natlas_labels:')[0] + (tmp_path / 'licenses').mkdir() + (tmp_path / 'licenses' / 'MIT.txt').write_text(MIT) + + def write(section): + path = tmp_path / 'c.yaml' + path.write_text(head + '\n' + yaml.safe_dump({'licenses': section})) + return load_config(path) + + return write + + +TEXT = { + 'license': 'MIT', + 'file': 'MIT.txt', + 'sha256': MIT_TEXT.sha256, + 'url': 'https://example.org/mit', + 'why': 'The upstream text.', +} +ROW = { + 'id': 'A', + 'template': T, + 'license': 'MIT', + 'basis': 'upstream', + 'url': 'https://example.org/a', + 'quote': 'Under the MIT license.', + 'retrieved': '2027-01-01', + 'why': 'Its upstream says so.', + 'license_file': 'write', +} +ATLAS = {k: v for k, v in ROW.items() if k != 'license_file'} + + +def test_config(write_config): + config = write_config({'texts': [TEXT], 'table': [ROW]}) + assert config.license_text('MIT') == MIT + assert config.license_text('CC0-1.0').startswith('CC0 1.0 Universal') + assert config.license_text('LicenseRef-X') is None + assert [e.scope for e in config.licenses_for(T)] == ['template'] + + +@pytest.mark.parametrize( + ('section', 'message'), + [ + ({'texts': [{**TEXT, 'sha256': '0' * 64}]}, 'does not match its sha256'), + ({'texts': [{**TEXT, 'file': 'GPL.txt'}]}, 'no file licenses/GPL.txt'), + ({'texts': [TEXT, TEXT]}, 'listed twice'), + ({'texts': [{**TEXT, 'license': 'mit'}]}, 'not a canonical SPDX'), + ({'texts': [TEXT], 'table': [{**ROW, 'license': 'CC-BY-4'}]}, 'not a canonical SPDX'), + ({'table': [ROW]}, 'no text for MIT'), + ({'texts': [TEXT], 'table': [{**ATLAS, 'basis': 'derived', 'quote': ''}]}, 'quote'), + ({'texts': [TEXT], 'table': [{**ROW, 'atlas': 'A'}]}, 'license_file is for'), + ({'texts': [TEXT], 'table': [{**ROW, 'files': {'desc': 'x'}}]}, 'count is for'), + ( + {'texts': [TEXT], 'table': [{**ATLAS, 'files': {'bogus': 'x'}, 'count': 1}]}, + 'unknown entities bogus', + ), + ( + {'texts': [TEXT], 'table': [{**ROW, 'replace': [{'old': 'a', 'new': 'b'}]}]}, + 'replace edits a kept LICENSE', + ), + ({'texts': [TEXT], 'table': [ROW, {**ROW, 'url': 'https://b.org'}]}, 'used twice'), + ({'texts': [TEXT], 'table': [ROW, {**ROW, 'id': 'B'}]}, 'a second entry'), + ( + { + 'table': [ + {**ROW, 'license': 'CC0-1.0'}, + {**ATLAS, 'id': 'B', 'atlas': 'A', 'license': 'LicenseRef-X'}, + ] + }, + 'no text for LicenseRef-X', + ), + ], +) +def test_config_errors(write_config, section, message): + with pytest.raises(ConfigError, match=message): + write_config(section) + + +def test_bundled_texts(): + """The license texts of the config are the files it cites (sha256 checked at load).""" + config = load_config() + assert {t.license for t in config.license_texts} >= {'GPL-2.0-or-later', 'MIT'} + for item in config.license_texts: + data = (CONFIG_DIR / 'licenses' / item.file).read_bytes() + assert hashlib.sha256(data).hexdigest() == item.sha256 + assert item.text == data.decode() + # Every template has its entry; every entry cites its evidence + own = [e for e in config.licenses if e.scope == 'template'] + assert len(own) == len({e.template for e in config.licenses}) == 30 + assert all(e.evidence for e in config.licenses) + + +def test_changes(): + """The entry of CHANGES has an item on the licenses.""" + desc = {**DESC, 'License': 'CC0'} + files = { + f'{T}_res-1_T1w.nii.gz': None, + f'{T}_res-1_desc-x_T1w.nii.gz': None, + f'{T}_res-1_desc-x_T1w.json': json.dumps({'License': 'See LICENSE file'}), + 'LICENSE': 'No rights reserved.\n', + 'README.md': README, + } + cfg = config(entry('X', 'MIT', files={'desc': 'x'}, count=1)) + p = plan(template(files, desc), config=cfg) + assert p.content.flip + text = p.content.files['CHANGES'].decode() + assert ( + " - Licenses: License CC0-1.0 (was 'CC0'); LICENSE starts with its\n" + ' SPDX-License-Identifier line; License of 1 JSON sidecar; docs/licenses/ has the\n' + ' text of MIT.\n' + ) in text + assert 'New files: ' not in text and 'License as' not in text diff --git a/tfmanager/tests/test_migrate_tables.py b/tfmanager/tests/test_migrate_tables.py index 1339f7a..5116b7f 100644 --- a/tfmanager/tests/test_migrate_tables.py +++ b/tfmanager/tests/test_migrate_tables.py @@ -18,11 +18,13 @@ from tfmanager.migrate.engine import plan_template from tfmanager.migrate.findings import CODES from tfmanager.migrate.labels import LabelIndex, Labels, table_id +from tfmanager.tests.test_migrate_content import CONFIG as BASE from tfmanager.tests.test_migrate_content import DATE, GRID2, T, annexed, facts, template CONFIG = Config( version='2.0.0', policies={'res_key': 'zoom', 'content_change': 'freeze', 'flip': 'when-clean'}, + licenses=BASE.licenses, ) @@ -301,10 +303,27 @@ def test_sources(tmp_path): } head = (CONFIG_DIR / '2.0.0.yaml').read_text().split('\natlas_labels:')[0] + license = { + 'id': 'Test', + 'template': T, + 'license': 'CC0-1.0', + 'basis': 'upstream', + 'url': 'https://example.org/test', + 'quote': 'No rights reserved.', + 'retrieved': '2027-01-01', + 'why': 'The license of the test template.', + 'license_file': 'keep', + } + def config(**changes): path = tmp_path / 'c.yaml' path.write_text( - head + '\ntables:\n sources:\n - ' + json.dumps({**entry, **changes}) + '\n' + head + + '\ntables:\n sources:\n - ' + + json.dumps({**entry, **changes}) + + '\nlicenses:\n table:\n - ' + + json.dumps(license) + + '\n' ) return load_config(path)