Skip to content

Commit

Permalink
Add Chen version as an option for autotrack (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcieslak authored Jan 13, 2025
1 parent 8b76ea3 commit 0e40c3b
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ orbs:

.dockersetup: &dockersetup
docker:
- image: pennlinc/qsirecon_build:24.10.3
- image: pennlinc/qsirecon_build:25.1.0
working_directory: /src/qsirecon

runinstall: &runinstall
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ RUN pip install build
RUN apt-get update && \
apt-get install -y --no-install-recommends git

FROM pennlinc/qsirecon_build:24.10.3
FROM pennlinc/qsirecon_build:25.1.0

# Install qsirecon
COPY . /src/qsirecon
Expand Down
31 changes: 30 additions & 1 deletion qsirecon/interfaces/dsi_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,22 @@ class _AutoTrackInputSpec(DSIStudioCommandLineInputSpec):
output_dir = traits.Str(
"cwd", argstr="%s", usedefault=True, desc="Forces DSI Studio to write results in cwd"
)
_boilerplate_traits = ["track_id", "track_voxel_ratio", "tolerance", "yield_rate"]
tip_iterations = traits.Int(
16,
usedefault=False,
desc="Topologically-informed pruning iterations",
argstr="--tip_iteration=%d",
)
template = traits.Int(
0, usedefault=True, argstr="--template=%d", desc="Must be 0 for autotrack"
)
_boilerplate_traits = [
"track_id",
"track_voxel_ratio",
"tolerance",
"yield_rate",
"tip_iteration",
]


class _AutoTrackOutputSpec(TraitedSpec):
Expand Down Expand Up @@ -760,6 +775,20 @@ def _list_outputs(self):
return outputs


class _ChenAutoTrackInputSpec(_AutoTrackInputSpec):
pass


class _ChenAutoTrackOutputSpec(_AutoTrackOutputSpec):
pass


class ChenAutoTrack(AutoTrack):
input_spec = _ChenAutoTrackInputSpec
output_spec = _ChenAutoTrackOutputSpec
_cmd = "dsi_studio_chen --action=atk"


class _AggregateAutoTrackResultsInputSpec(BaseInterfaceInputSpec):
expected_bundles = InputMultiObject(traits.Str())
trk_files = InputMultiObject(File(exists=True))
Expand Down
13 changes: 11 additions & 2 deletions qsirecon/workflows/recon/dsi_studio.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
DSI_STUDIO_VERSION,
AggregateAutoTrackResults,
AutoTrack,
ChenAutoTrack,
DSIStudioAtlasGraph,
DSIStudioCreateSrc,
DSIStudioExport,
Expand Down Expand Up @@ -306,9 +307,13 @@ def init_dsi_studio_autotrack_registration_wf(
omp_nthreads = config.nipype.omp_nthreads
workflow = Workflow(name=name)

dsi_studio_version = params.pop("dsi_studio_version", "hou")

_AutoTrack = AutoTrack if dsi_studio_version == "hou" else ChenAutoTrack

# Run autotrack on only one bundle. The important part is getting the map.gz
registration_atk = pe.Node(
AutoTrack(num_threads=omp_nthreads, track_id="Association_ArcuateFasciculusL"),
_AutoTrack(num_threads=omp_nthreads, track_id="Association_ArcuateFasciculusL"),
name="registration_atk",
n_procs=omp_nthreads,
)
Expand Down Expand Up @@ -402,9 +407,13 @@ def init_dsi_studio_autotrack_wf(
workflow = Workflow(name=name)
workflow.__desc__ = desc + bundle_desc

dsi_studio_version = params.pop("dsi_studio_version", "hou")

_AutoTrack = AutoTrack if dsi_studio_version == "hou" else ChenAutoTrack

# Run autotrack!
actual_trk = pe.Node(
AutoTrack(num_threads=omp_nthreads, **params), name="actual_trk", n_procs=omp_nthreads
_AutoTrack(num_threads=omp_nthreads, **params), name="actual_trk", n_procs=omp_nthreads
) # An extra thread is needed

# Create a single output
Expand Down

0 comments on commit 0e40c3b

Please sign in to comment.