Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Add ReconScalars node to recon workflows #683

Merged
merged 9 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .circleci/ScalarMapper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

cat << DOC

Test the TORTOISE recon workflow
=================================

All supported reconstruction workflows get tested


Inputs:
-------
- qsiprep multi shell results (data/DSDTI_fmap)

DOC
set +e
source ./get_data.sh
TESTDIR=${PWD}
TESTNAME=scalar_mapper_test
get_config_data ${TESTDIR}
get_bids_data ${TESTDIR} multishell_output
CFG=${TESTDIR}/data/nipype.cfg

# Test MRtrix3 multishell msmt with ACT
setup_dir ${TESTDIR}/${TESTNAME}
TEMPDIR=${TESTDIR}/${TESTNAME}/work
OUTPUT_DIR=${TESTDIR}/${TESTNAME}/derivatives
BIDS_INPUT_DIR=${TESTDIR}/data/multishell_output/qsiprep
export FS_LICENSE=${TESTDIR}/data/license.txt
QSIPREP_CMD=$(run_qsiprep_cmd ${BIDS_INPUT_DIR} ${OUTPUT_DIR})

${QSIPREP_CMD} \
-w ${TEMPDIR} \
--recon-input ${BIDS_INPUT_DIR} \
--sloppy \
--stop-on-first-crash \
--recon-spec bundle_scalar_map \
--recon-only \
-vv
22 changes: 21 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,18 @@ jobs:
cd .circleci
bash PyAFQReconExternalTrk.sh

Recon_ScalarMap:
<<: *dockersetup
steps:
- checkout
- run: *runinstall
- run:
name: Test scalar_mapping workflow
no_output_timeout: 1h
command: |
cd .circleci
bash ScalarMapper.sh

Recon_AMICO:
<<: *dockersetup
resource_class: medium+
Expand Down Expand Up @@ -319,7 +331,7 @@ jobs:
echo "the command ``git fetch --tags --verbose`` and push"
echo "them to your fork with ``git push origin --tags``"
fi
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" wrapper/qsiprep_docker.py
sed -i -E "s/(__version__ = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" wrapper/qsiprep-container/qsiprep_docker.py
sed -i -E "s/(var version = )'[A-Za-z0-9.-]+'/\1'${CIRCLE_TAG:-$THISVERSION}'/" docs/citing.rst
sed -i "s/title = {qsiprep}/title = {qsiprep ${CIRCLE_TAG:-$THISVERSION}}/" qsiprep/data/boilerplate.bib
# Build docker image
Expand Down Expand Up @@ -609,6 +621,13 @@ workflows:
tags:
only: /.*/

- Recon_ScalarMap:
requires:
- build
filters:
tags:
only: /.*/

- deployable:
requires:
- build_docs
Expand All @@ -630,6 +649,7 @@ workflows:
- Recon_AMICO
- Recon_PYAFQ
- Recon_PYAFQExternalTrk
- Recon_ScalarMap
filters:
branches:
only: master
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies = [
"matplotlib",
"networkx ~= 2.8.8",
"nibabel >= 3.0.0",
"nilearn >= 0.10.1",
"nilearn == 0.10.1",
"nipype >= 1.3.1",
"numpy >= 1.18.5",
"pandas < 2.0.0",
Expand Down
55 changes: 55 additions & 0 deletions qsiprep/data/pipelines/bundle_scalar_map.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"name": "bundle_scalar_map",
"space" : "T1w",
"atlases": [ ],
"anatomical": [ ],
"nodes": [
{
"name": "DIPYdki",
"software": "Dipy",
"action": "DKI_reconstruction",
"input": "qsiprep",
"output_suffix": "DKI",
"parameters": {
"write_mif": false,
"write_fibgz": false
}
},
{
"name": "dsistudio_gqi",
"software": "DSI Studio",
"action": "reconstruction",
"input": "qsiprep",
"output_suffix": "gqi",
"parameters": {"method": "gqi"}
},
{
"name": "autotrackgqi",
"software": "DSI Studio",
"action": "autotrack",
"input": "dsistudio_gqi",
"output_suffix": "AutoTrackGQI",
"parameters": {
"track_id": "Fasciculus,Cingulum,Aslant,Corticos,Thalamic_R,Reticular,Optic,Fornix,Corpus",
"tolerance": "22,26,30",
"track_voxel_ratio": 2.0,
"yield_rate": 0.000001
}
},
{
"name": "gqi_scalars",
"software": "DSI Studio",
"action": "export",
"input": "dsistudio_gqi",
"output_suffix": "gqiscalar"
},
{
"name": "bundle_means",
"software": "qsiprep",
"action": "bundle_map",
"input": "autotrackgqi",
"scalars_from": ["gqi_scalars", "DIPYdki"],
"output_suffix": "bundlemap"
}
]
}
3 changes: 2 additions & 1 deletion qsiprep/interfaces/interchange.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class _ReconWorkflowInputsInputSpec(BaseInterfaceInputSpec):
class _ReconWorkflowInputsOutputSpec(TraitedSpec):
pass


class ReconWorkflowInputs(SimpleInterface):
input_spec = _ReconWorkflowInputsInputSpec
output_spec = _ReconWorkflowInputsOutputSpec
Expand Down Expand Up @@ -83,4 +84,4 @@ def _run_interface(self, runtime):

for name in anatomical_workflow_outputs:
_ReconAnatomicalDataInputSpec.add_class_trait(name, traits.Any)
_ReconAnatomicalDataOutputSpec.add_class_trait(name, traits.Any)
_ReconAnatomicalDataOutputSpec.add_class_trait(name, traits.Any)
Loading