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

Commit 639bb27

Browse files
author
Adam Richie-Halford
committed
Use WNavNorm dir from Site-CBIC
1 parent 2afab2c commit 639bb27

File tree

4 files changed

+45
-7
lines changed

4 files changed

+45
-7
lines changed

dmriprep/__init__.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
import errno
1010
import logging
1111
import os
12+
import warnings
13+
14+
# Filter warnings that are visible whenever you import another package that
15+
# was compiled against an older numpy than is installed.
16+
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
17+
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
1218

1319
from . import data
1420
from . import io

dmriprep/data.py

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,16 @@ def list_all_subjects(self):
252252
"""
253253
raise NotImplementedError
254254

255+
def filter_keys(self, subject):
256+
"""Study-specific S3 key filtering
257+
258+
Parameters
259+
----------
260+
subject : dmriprep.data.Subject
261+
subject instance
262+
"""
263+
raise NotImplementedError
264+
255265
def postprocess(self, subject):
256266
"""Study-specific postprocessing steps
257267
@@ -363,6 +373,34 @@ def get_subs_from_tsv_key(s3_key):
363373

364374
return all_subjects
365375

376+
def filter_keys(self, subject):
377+
"""Filter S3 keys based on HBN specific vagaries
378+
379+
HBN Site-CBIC has multiple anatomy folders due to
380+
motion correction software at the scanner level.
381+
If subject.site == "Site-CBIC" then choose only the
382+
anatomy files in the T1W_VNavNorm files
383+
384+
Parameters
385+
----------
386+
subject : dmriprep.data.Subject
387+
subject instance
388+
"""
389+
if subject.site == "Site-CBIC":
390+
t1w_keys = subject.s3_keys['t1w']
391+
freesurfer_keys = subject.s3_keys['freesurfer']
392+
correct_dir = "T1w_VNavNorm"
393+
394+
subject._s3_keys['t1w'] = list(filter(
395+
lambda x: correct_dir in x,
396+
t1w_keys
397+
))
398+
399+
subject._s3_keys['freesurfer'] = list(filter(
400+
lambda x: correct_dir in x,
401+
freesurfer_keys
402+
))
403+
366404
def postprocess(self, subject):
367405
"""Move the T1 file back into the freesurfer directory.
368406
@@ -417,6 +455,7 @@ def __init__(self, subject_id, study, site=None):
417455
self._valid = False
418456
self._organize_s3_keys()
419457
if self.valid:
458+
self.study.filter_keys(self)
420459
self._s3_keys = self._determine_directions(self._s3_keys)
421460
self._files = None
422461

dmriprep/qc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import matplotlib.pyplot as plt
1111

1212

13-
1413
def reorient_array(data, aff):
1514
# rearrange the matrix to RAS orientation
1615
orientation = nib.orientations.io_orientation(aff)

dmriprep/run.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
11
import os.path as op
22
from shutil import copyfile
3-
import warnings
4-
5-
# Filter warnings that are visible whenever you import another package that
6-
# was compiled against an older numpy than is installed.
7-
warnings.filterwarnings("ignore", message="numpy.dtype size changed")
8-
warnings.filterwarnings("ignore", message="numpy.ufunc size changed")
93

104

115
def run_dmriprep(dwi_file, bvec_file, bval_file,

0 commit comments

Comments
 (0)