@@ -252,6 +252,16 @@ def list_all_subjects(self):
252
252
"""
253
253
raise NotImplementedError
254
254
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
+
255
265
def postprocess (self , subject ):
256
266
"""Study-specific postprocessing steps
257
267
@@ -363,6 +373,34 @@ def get_subs_from_tsv_key(s3_key):
363
373
364
374
return all_subjects
365
375
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
+
366
404
def postprocess (self , subject ):
367
405
"""Move the T1 file back into the freesurfer directory.
368
406
@@ -417,6 +455,7 @@ def __init__(self, subject_id, study, site=None):
417
455
self ._valid = False
418
456
self ._organize_s3_keys ()
419
457
if self .valid :
458
+ self .study .filter_keys (self )
420
459
self ._s3_keys = self ._determine_directions (self ._s3_keys )
421
460
self ._files = None
422
461
0 commit comments