Skip to content

Commit

Permalink
updated auto-generated yaml files with fileformats
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed Nov 21, 2023
1 parent 934d2f4 commit 9865f49
Show file tree
Hide file tree
Showing 44 changed files with 310 additions and 127 deletions.
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,5 @@ dmypy.json
# Mac garbarge
.DS_store

# Auto-generated version files
/pydra/tasks/freesurfer/_version.py
/fileformats/src/fileformats/medimage_freesurfer/_version.py
/fileformts/extras/fileformats/extras/medimage_freesurfer/_version.py

# Auto-converted (from Nipype) interfaces directory (needs to be stripped before packaging)
/pydra/tasks/freesurfer/auto
/pydra/tasks/freesurfer/_version.py
8 changes: 4 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
Pydra task package for freesurfer
===============================

.. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml/badge.svg
:target: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yaml
.. image:: https://codecov.io/gh/nipype/pydra-freesurfer/branch/main/graph/badge.svg?token=UIS0OGPST7
:target: https://codecov.io/gh/nipype/pydra-freesurfer
.. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/pythonpackage.yaml/badge.svg
:target: https://github.com/nipype/pydra-freesurfer/actions/workflows/pythonpackage.yaml
.. .. image:: https://codecov.io/gh/nipype/pydra-freesurfer/branch/main/graph/badge.svg?token=UIS0OGPST7
.. :target: https://codecov.io/gh/nipype/pydra-freesurfer
.. image:: https://img.shields.io/pypi/pyversions/pydra-freesurfer.svg
:target: https://pypi.python.org/pypi/pydra-freesurfer/
:alt: Supported Python versions
Expand Down
109 changes: 108 additions & 1 deletion fileformats/extras/fileformats/extras/medimage_freesurfer/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,108 @@
from ._version import __version__
from pathlib import Path
import typing as ty
from random import Random
from fileformats.core import FileSet
from fileformats.medimage_freesurfer import (
Orig,
Xfm,
Lta,
Stats,
Avg_curv,
Inflated,
Nofix,
Pial,
M3z,
Thickness,
Annot,
Label,
Ctab,
Out,
Area,
White,
Reg,
)


@FileSet.generate_sample_data.register
def gen_sample_orig_data(orig: Orig, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_xfm_data(xfm: Xfm, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_lta_data(lta: Lta, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_stats_data(stats: Stats, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_avg_curv_data(avg_curv: Avg_curv, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_inflated_data(inflated: Inflated, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_nofix_data(nofix: Nofix, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_pial_data(pial: Pial, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_m3z_data(m3z: M3z, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_thickness_data(thickness: Thickness, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_annot_data(annot: Annot, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_label_data(label: Label, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_ctab_data(ctab: Ctab, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_out_data(out: Out, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_area_data(area: Area, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_white_data(white: White, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError


@FileSet.generate_sample_data.register
def gen_sample_reg_data(reg: Reg, dest_dir: Path, seed: ty.Union[int, Random], stem: ty.Optional[str]):
raise NotImplementedError
2 changes: 1 addition & 1 deletion fileformats/extras/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "fileformats-medimage-freesurfer-extras"
description = "Classes for representing file formats used exclusively by the Freesurfer tool in Python classes for use in type hinting in data workflows"
description = "Extensions to add functionality to tool-specific *fileformats* classes"
readme = "README.rst"
requires-python = ">=3.8"
dependencies = [
Expand Down
11 changes: 4 additions & 7 deletions fileformats/src/README.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
FileFormats Extension - medimage-freesurfer
====================================
.. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/tests.yml/badge.svg
:target: https://github.com/nipype/pydra-medimage-freesurfer/actions/workflows/tests.yml
.. image:: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
:target: https://arcanaframework.github.io/fileformats/
:alt: Documentation Status
.. image:: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yml/badge.svg
:target: https://github.com/nipype/pydra-freesurfer/actions/workflows/ci-cd.yml

This is the "medimage-freesurfer" extension module for the
This is the "freesurfer" extension module for the
`fileformats <https://github.com/ArcanaFramework/fileformats-core>`__ package


Expand All @@ -15,7 +12,7 @@ Quick Installation

This extension can be installed for Python 3 using *pip*::

$ pip3 install fileformats-medimage-freesurfer
$ pip3 install fileformats-freesurfer

This will install the core package and any other dependencies

Expand Down
87 changes: 86 additions & 1 deletion fileformats/src/fileformats/medimage_freesurfer/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,86 @@
from ._version import __version__
from fileformats.generic import File


class Orig(File):
ext = ".orig"
binary = True


class Xfm(File):
ext = ".xfm"
binary = True


class Lta(File):
ext = ".lta"
binary = True


class Stats(File):
ext = ".stats"
binary = True


class Avg_curv(File):
ext = ".avg_curv"
binary = True


class Inflated(File):
ext = ".inflated"
binary = True


class Nofix(File):
ext = ".nofix"
binary = True


class Pial(File):
ext = ".pial"
binary = True


class M3z(File):
ext = ".m3z"
binary = True


class Thickness(File):
ext = ".thickness"
binary = True


class Annot(File):
ext = ".annot"
binary = True


class Label(File):
ext = ".label"
binary = True


class Ctab(File):
ext = ".ctab"
binary = True


class Out(File):
ext = ".out"
binary = True


class Area(File):
ext = ".area"
binary = True


class White(File):
ext = ".white"
binary = True


class Reg(File):
ext = ".reg"
binary = True
6 changes: 4 additions & 2 deletions fileformats/src/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ build-backend = "hatchling.build"

[project]
name = "fileformats-medimage-freesurfer"
description = "Classes for representing different file formats solely used by the 'freesurfer' tool in Python classes for use in type hinting in data workflows"
description = "Classes for representing different file formats in Python classes for use in type hinting in data workflows"
readme = "README.rst"
requires-python = ">=3.8"
dependencies = [
"fileformats >= 0.4"
"fileformats >= 0.4",
"fileformats-medimage > = 0.2"
]
license = {file = "LICENSE"}
authors = [
Expand Down Expand Up @@ -50,6 +51,7 @@ test = [
"pytest-env>=0.6.2",
"pytest-cov>=2.12.1",
"codecov",
"fileformats-medimage-medimage-extras",
]

[project.urls]
Expand Down
4 changes: 2 additions & 2 deletions nipype-auto-conv/generate
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ for fspath in sorted(SPECS_DIR.glob("**/*.yaml")):
auto_init += f"from .{module_name} import {converter.task_name}\n"


with open(auto_dir / "_version.py", "w") as f:
with open(PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto" / "_version.py", "w") as f:
f.write(
f"""# Auto-generated by {__file__}, do not edit as it will be overwritten
Expand All @@ -68,5 +68,5 @@ post_release = (nipype_version + nipype2pydra_version).replace(".", "")
"""
)

with open(auto_dir / "__init__.py", "w") as f:
with open(PKG_ROOT / "pydra" / "tasks" / PKG_NAME / "auto" / "__init__.py", "w") as f:
f.write(auto_init)
12 changes: 6 additions & 6 deletions nipype-auto-conv/specs/aparc_2_aseg.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ inputs:
out_file: medimage/mgh-gz
# type=file: Output aseg file
# type=file|default=<undefined>: Full path of file to save the output segmentation in
lh_white: generic/file
lh_white: medimage-freesurfer/pial
# type=file|default=<undefined>: Input file must be <subject_id>/surf/lh.white
rh_white: generic/file
rh_white: medimage-freesurfer/pial
# type=file|default=<undefined>: Input file must be <subject_id>/surf/rh.white
lh_pial: generic/file
lh_pial: medimage-freesurfer/pial
# type=file|default=<undefined>: Input file must be <subject_id>/surf/lh.pial
rh_pial: generic/file
rh_pial: medimage-freesurfer/pial
# type=file|default=<undefined>: Input file must be <subject_id>/surf/rh.pial
lh_ribbon: medimage/mgh-gz
# type=file|default=<undefined>: Input file must be <subject_id>/mri/lh.ribbon.mgz
rh_ribbon: medimage/mgh-gz
# type=file|default=<undefined>: Input file must be <subject_id>/mri/rh.ribbon.mgz
ribbon: medimage/mgh-gz
# type=file|default=<undefined>: Input file must be <subject_id>/mri/ribbon.mgz
lh_annotation: generic/file
lh_annotation: medimage-freesurfer/pial
# type=file|default=<undefined>: Input file must be <subject_id>/label/lh.aparc.annot
rh_annotation: generic/file
rh_annotation: medimage-freesurfer/pial
# type=file|default=<undefined>: Input file must be <subject_id>/label/rh.aparc.annot
filled: generic/file
# type=file|default=<undefined>: Implicit input filled file. Only required with FS v5.3.
Expand Down
2 changes: 1 addition & 1 deletion nipype-auto-conv/specs/ca_register.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ outputs:
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
out_file: generic/file
out_file: medimage-freesurfer/m3z
# type=file: The output file for CARegister
# type=file|default=<undefined>: The output volume for CARegister
callables:
Expand Down
6 changes: 3 additions & 3 deletions nipype-auto-conv/specs/concatenate_lta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ inputs:
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
in_lta1: generic/file
in_lta1: medimage-freesurfer/lta
# type=file|default=<undefined>: maps some src1 to dst1
out_file: generic/file
out_file: medimage-freesurfer/lta
# type=file: the combined LTA maps: src1 to dst2 = LTA2*LTA1
# type=file|default=<undefined>: the combined LTA maps: src1 to dst2 = LTA2*LTA1
tal_source_file: generic/file
Expand All @@ -69,7 +69,7 @@ outputs:
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
out_file: generic/file
out_file: medimage-freesurfer/lta
# type=file: the combined LTA maps: src1 to dst2 = LTA2*LTA1
# type=file|default=<undefined>: the combined LTA maps: src1 to dst2 = LTA2*LTA1
callables:
Expand Down
8 changes: 4 additions & 4 deletions nipype-auto-conv/specs/contrast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ inputs:
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
thickness: generic/file
thickness: medimage-freesurfer/thickness
# type=file|default=<undefined>: Input file must be <subject_id>/surf/?h.thickness
white: generic/file
white: medimage-freesurfer/white
# type=file|default=<undefined>: Input file must be <subject_id>/surf/<hemisphere>.white
annotation: generic/file
annotation: medimage-freesurfer/annot
# type=file|default=<undefined>: Input annotation file must be <subject_id>/label/<hemisphere>.aparc.annot
cortex: generic/file
cortex: medimage-freesurfer/label
# type=file|default=<undefined>: Input cortex label must be <subject_id>/label/<hemisphere>.cortex.label
orig: medimage/mgh-gz
# type=file|default=<undefined>: Implicit input file mri/orig.mgz
Expand Down
2 changes: 1 addition & 1 deletion nipype-auto-conv/specs/curvature.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inputs:
# from the nipype interface, but you may want to be more specific, particularly
# for file types, where specifying the format also specifies the file that will be
# passed to the field in the automatically generated unittests.
in_file: generic/file
in_file: medimage-freesurfer/pial
# type=file|default=<undefined>: Input file for Curvature
metadata:
# dict[str, dict[str, any]] - additional metadata to set on any of the input fields (e.g. out_file: position: 1)
Expand Down
Loading

0 comments on commit 9865f49

Please sign in to comment.