Skip to content

Commit

Permalink
updated version and cleaned up main file
Browse files Browse the repository at this point in the history
  • Loading branch information
tclose committed May 7, 2024
1 parent 1571802 commit 4adb412
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
4 changes: 2 additions & 2 deletions pydra/tasks/fastsurfer/latest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PACKAGE_VERSION = "v1"
PACKAGE_VERSION = "v2.2"

from .v1 import * # noqa
from .v2_2 import Fastsurfer # noqa
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import typing as ty
from pathlib import Path
from fileformats.generic import File, Directory
from fileformats.medimage import NiftiGz, MghGz
import os
from fileformats.medimage import MghGz


input_fields = [
(
Expand Down Expand Up @@ -209,27 +209,26 @@
name="Input", fields=input_fields, bases=(specs.ShellSpec,)
)

# DELETE this after checking that the subject_dir_path works...
# def subject_dir_path(subjects_dir: Path) -> Path:
# p = os.path.join(subjects_dir, "FS_outputs")
# print(Path(p))
# return Path(p)

def subject_dir_path(subjects_dir: Path):
return Path(subjects_dir) / "FS_outputs"


def norm_img_path(subjects_dir: Path):
return Path(subjects_dir) / "FS_outputs" / "mri" / "norm.mgz"


# # Update this section when Docker is being used
def aparcaseg_img_path(subjects_dir: Path):
return Path(subjects_dir) / "FS_outputs" / "mri" / "aparc+aseg.mgz"


def brainmask_img_path(subjects_dir: Path):
return Path(subjects_dir) / "FS_outputs" / "mri" / "brainmask.mgz"

output_fields = [
(

output_fields = [
(
"subjects_dir",
Directory,
{
Expand All @@ -246,8 +245,8 @@ def brainmask_img_path(subjects_dir: Path):
"callable": subject_dir_path,
},
),
(
"norm_img",
(
"norm_img",
MghGz,
{
"help_string": "norm image",
Expand All @@ -269,15 +268,14 @@ def brainmask_img_path(subjects_dir: Path):
"help_string": "brainmask.mgz image",
"callable": brainmask_img_path,
},
)

),
]
fastsurfer_output_spec = specs.SpecInfo(
name="Output", fields=output_fields, bases=(specs.ShellOutSpec,)
)


class fastsurfer(ShellCommandTask):
class Fastsurfer(ShellCommandTask):
"""
Examples
-------
Expand All @@ -290,4 +288,3 @@ class fastsurfer(ShellCommandTask):
input_spec = fastsurfer_input_spec
output_spec = fastsurfer_output_spec
executable = "run_fastsurfer.sh"

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from conftest import pass_after_timeout
import pytest
from fileformats.generic import File
from pydra.tasks.fastsurfer.v1 import fastsurfer
from pydra.tasks.fastsurfer.v2_2 import Fastsurfer


@pytest.mark.xfail
@pass_after_timeout(seconds=10)
def test_fastsurfer_1():
task = fastsurfer()
task = Fastsurfer()
task.inputs.subjects_dir = None
task.inputs.subject_id = None
task.inputs.T1_files = File.sample()
Expand Down

0 comments on commit 4adb412

Please sign in to comment.