Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Commit 8edec28

Browse files
committed
fix: updated qc to connect eddy_quad to report.json
1 parent 8d1c93a commit 8edec28

File tree

4 files changed

+21
-6
lines changed

4 files changed

+21
-6
lines changed

dmriprep/data.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,6 +425,16 @@ def postprocess(self, subject):
425425
stdout=fnull,
426426
stderr=subprocess.STDOUT)
427427

428+
# if the site is CBIC, then the freesurfer directory has an additional level.
429+
# move that level up by 1 (e.g. removing the T1w_VNavNorm folder
430+
if subject.site == 'Site-CBIC':
431+
newpath = freesurfer_path.replace('T1w_VNavNorm/', '')
432+
move_cmd = 'mv {oldpath} {newpath}'.format(oldpath=freesurfer_path, newpath=newpath)
433+
fnull1 = open(os.devnull, 'w')
434+
subprocess.call(move_cmd.split(),
435+
stdout=fnull1,
436+
stderr=subprocess.STDOUT)
437+
428438

429439
class Subject:
430440
"""A single dMRI study subject"""

dmriprep/qc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os.path as op
44
from dipy.segment.mask import median_otsu
55
from io import BytesIO
6-
from nipype.utils.filemanip import save_json
6+
from nipype.utils.filemanip import save_json, load_json
77
import base64
88
import matplotlib
99
matplotlib.use('agg')
@@ -212,6 +212,7 @@ def createB0_ColorFA_Mask_Sprites(b0_file, colorFA_file, mask_file):
212212
def create_report_json(dwi_corrected_file, eddy_rms, eddy_report,
213213
color_fa_file, anat_mask_file,
214214
outlier_indices,
215+
eddy_qc_file,
215216
outpath=op.abspath('./report.json')):
216217

217218
report = {}
@@ -229,6 +230,7 @@ def create_report_json(dwi_corrected_file, eddy_rms, eddy_report,
229230
report['eddy_report'] = f.readlines()
230231

231232
report['eddy_params'] = np.genfromtxt(eddy_rms).tolist()
232-
233+
eddy_qc = load_json(eddy_qc_file)
234+
report['eddy_quad'] = eddy_qc
233235
save_json(outpath, report)
234236
return outpath

dmriprep/run.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -752,23 +752,26 @@ def binarize_aparc(aparc_aseg):
752752
wf.connect(reslice_orig_to_dwi, 'out_file', datasink, 'dmriprep.anat.@T1w')
753753

754754
def report_fn(dwi_corrected_file, eddy_rms, eddy_report,
755-
color_fa_file, anat_mask_file, outlier_indices):
755+
color_fa_file, anat_mask_file, outlier_indices,
756+
eddy_qc_file):
756757
from dmriprep.qc import create_report_json
757758

758759
report = create_report_json(dwi_corrected_file, eddy_rms, eddy_report,
759-
color_fa_file, anat_mask_file, outlier_indices)
760+
color_fa_file, anat_mask_file, outlier_indices,
761+
eddy_qc_file)
760762
return report
761763

762764
report_node = pe.Node(niu.Function(
763765
input_names=['dwi_corrected_file', 'eddy_rms',
764766
'eddy_report', 'color_fa_file',
765-
'anat_mask_file', 'outlier_indices'],
767+
'anat_mask_file', 'outlier_indices', 'eddy_qc_file'],
766768
output_names=['report'],
767769
function=report_fn
768770
), name="reportJSON")
769771

770772
# for the report, lets show the eddy corrected (full volume) image
771773
wf.connect(voltransform, "transformed_file", report_node, 'dwi_corrected_file')
774+
wf.connect(eddy_quad, 'out_qc_json', report_node, 'eddy_qc_file')
772775

773776
# add the rms movement output from eddy
774777
wf.connect(prep, "fsl_eddy.out_movement_rms", report_node, 'eddy_rms')

kubernetes/setup_gcp_kubernetes_dmriprep.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ CLUSTERNAME=dmriprep
1515
gcloud config set compute/zone $ZONE
1616

1717
# start the cluster!
18-
gcloud beta container clusters create $CLUSTERNAME --machine-type n1-highmem-4 --enable-autoscaling --max-nodes=$MAX_NODES --num-nodes 2 --cluster-version latest --node-labels dmriprep/node-purpose=core
18+
gcloud beta container clusters create $CLUSTERNAME --machine-type n1-highmem-4 --enable-autoscaling --max-nodes=$MAX_NODES --num-nodes 1 --cluster-version latest --node-labels dmriprep/node-purpose=core

0 commit comments

Comments
 (0)