Skip to content

Commit

Permalink
Rf/smoothing (#412)
Browse files Browse the repository at this point in the history
Add analysis-level option to XCP
  • Loading branch information
kahinimehta authored Aug 16, 2022
1 parent 37f566b commit 682b2a7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .circleci/RunPyTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ run_pytest_cmd () {
cwd_mount="-v ${PWD}/tests:/rundir:rw"
PYTEST_RUN="docker run --rm -ti -u $(id -u) -w /rundir --entrypoint pytest "
PYTEST_RUN+="${workdir_mount} ${patch_mount} ${cwd_mount} ${cfg_arg} ${bids_mount} ${output_mount} ${IMAGE} "
PYTEST_RUN+="--data_dir=/bids-input --output_dir=/out --working_dir=/work /rundir"
PYTEST_RUN+="--data_dir=/bids-input --output_dir=/out participant --working_dir=/work /rundir"

fi

Expand Down
6 changes: 3 additions & 3 deletions .circleci/get_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fi

# Edit these for project-wide testing
WGET="wget --retry-connrefused --waitretry=5 --read-timeout=20 --timeout=15 -t 0 -q"
LOCAL_PATCH=~/projects/xcp_d/xcp_d
LOCAL_PATCH=/Users/kahinim/Desktop/Repos/xcp_d/xcp_d
IMAGE=pennlinc/xcp_d:unstable

# Determine if we're in a CI test
Expand All @@ -32,7 +32,7 @@ run_xcpd_cmd () {
# test that uses
if [[ "${CIRCLECI}" = "true" ]]; then
# In circleci we're running from inside the container. call directly
XCPD_RUN="/usr/local/miniconda/bin/xcp_d ${bids_dir} ${output_dir} -w ${workdir}"
XCPD_RUN="/usr/local/miniconda/bin/xcp_d ${bids_dir} ${output_dir} participant -w ${workdir}"
else
patch_mount=""
if [[ -n "${LOCAL_PATCH}" ]]; then
Expand All @@ -50,7 +50,7 @@ run_xcpd_cmd () {
bids_mount="-v ${bids_dir}:/bids-input:ro"
output_mount="-v ${output_dir}:/out:rw"
workdir_mount="-v ${workdir}:/work:rw"
XCPD_RUN="docker run --rm -u $(id -u) ${workdir_mount} ${patch_mount} ${cfg_arg} ${bids_mount} ${output_mount} ${IMAGE} /bids-input /out -w /work"
XCPD_RUN="docker run --rm -u $(id -u) ${workdir_mount} ${patch_mount} ${cfg_arg} ${bids_mount} ${output_mount} ${IMAGE} /bids-input /out participant -w /work"

fi
echo "${XCPD_RUN} --nthreads ${NTHREADS} --omp-nthreads ${OMP_NTHREADS}"
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ install_requires =
brainsprite ~= 0.14.2
psutil >= 5.4
pybids >= 0.14.0
matplotlib ~= 3.3.4
pyyaml
templateflow ~= 0.6.1
sentry-sdk ~= 1.4.3
Expand Down
11 changes: 11 additions & 0 deletions xcp_d/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def get_parser():
action='store',
type=Path,
help='the output path for xcp_d')
parser.add_argument('analysis_level',
action='store',
type=Path,
help='the output path for xcp_d')

# optional arguments
parser.add_argument('--version', action='version', version=verstr)
Expand Down Expand Up @@ -482,6 +486,12 @@ def build_workflow(opts, retval):
'derivatives' / ('xcp_d-%s' % __version__.split('+')[0]))
retval['return_code'] = 1
return retval
if str(opts.analysis_level) != 'participant':
print (opts.analysis_level)
build_log.error(
'Please select analysis level "participant"')
retval['return_code'] = 1
return retval

# First check that fmriprep_dir looks like a BIDS folder
if opts.input_type == 'dcan':
Expand Down Expand Up @@ -623,6 +633,7 @@ def build_workflow(opts, retval):
smoothing=opts.smoothing,
params=opts.nuissance_regressors,
cifti=opts.cifti,
analysis_level=opts.analysis_level,
output_dir=str(output_dir),
head_radius=opts.head_radius,
custom_confounds=opts.custom_confounds,
Expand Down
4 changes: 4 additions & 0 deletions xcp_d/workflow/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def init_xcpd_wf(layout,
head_radius,
params,
subject_list,
analysis_level,
smoothing,
custom_confounds,
output_dir,
Expand Down Expand Up @@ -79,6 +80,7 @@ def init_xcpd_wf(layout,
brain_template,
subject_list,
smoothing,
analysis_level,
custom_confounds,
output_dir,
work_dir,
Expand All @@ -96,6 +98,8 @@ def init_xcpd_wf(layout,
BIDS dataset layout
despike: bool
afni depsike
analysis_level: str
only option is 'participant'
motion_filter_type: str
respiratory motion filter type: lp or notch
motion_filter_order: str
Expand Down

0 comments on commit 682b2a7

Please sign in to comment.