@@ -313,134 +313,120 @@ def init_single_subject_qsiprep_wf(subject_id: str):
313
313
314
314
# Create the anatomical datasinks
315
315
anatomical_template = 'MNI152NLin6Asym'
316
- for anat_file in subject_data ['t1w' ]:
317
- workflow .add_nodes (
318
- [
319
- pe .Node (
320
- DerivativesDataSink (
321
- compress = True ,
322
- in_file = anat_file ,
323
- source_file = anat_file ,
324
- base_directory = config .execution .output_dir ,
325
- space = 'ACPC' ,
326
- desc = 'preproc' ,
327
- keep_dtype = True ,
328
- ),
329
- name = _get_wf_name (anat_file , 'ds_t1_preproc' ),
330
- run_without_submitting = True ,
316
+ anat_file = (subject_data ['t1w' ] + subject_data ['t2w' ])[0 ]
317
+ workflow .add_nodes (
318
+ [
319
+ pe .Node (
320
+ DerivativesDataSink (
321
+ compress = True ,
322
+ in_file = anat_file ,
323
+ source_file = anat_file ,
324
+ base_directory = config .execution .output_dir ,
325
+ space = 'ACPC' ,
326
+ desc = 'preproc' ,
327
+ keep_dtype = True ,
331
328
),
332
- pe . Node (
333
- DerivativesDataSink (
334
- compress = True ,
335
- in_file = anat_file ,
336
- source_file = anat_file ,
337
- base_directory = config . execution . output_dir ,
338
- space = 'ACPC' ,
339
- desc = 'brain' ,
340
- suffix = 'mask' ,
341
- ) ,
342
- name = _get_wf_name ( anat_file , 'ds_t1_mask' ) ,
343
- run_without_submitting = True ,
329
+ name = _get_wf_name ( anat_file , 'ds_t1_preproc' ),
330
+ run_without_submitting = True ,
331
+ ) ,
332
+ pe . Node (
333
+ DerivativesDataSink (
334
+ compress = True ,
335
+ in_file = anat_file ,
336
+ source_file = anat_file ,
337
+ base_directory = config . execution . output_dir ,
338
+ space = 'ACPC' ,
339
+ desc = 'brain' ,
340
+ suffix = 'mask' ,
344
341
),
345
- pe . Node (
346
- DerivativesDataSink (
347
- compress = True ,
348
- in_file = anat_file ,
349
- source_file = anat_file ,
350
- base_directory = config . execution . output_dir ,
351
- space = 'ACPC' ,
352
- suffix = 'dseg' ,
353
- ) ,
354
- name = _get_wf_name ( anat_file , 'ds_t1_seg' ) ,
355
- run_without_submitting = True ,
342
+ name = _get_wf_name ( anat_file , 'ds_t1_mask' ),
343
+ run_without_submitting = True ,
344
+ ) ,
345
+ pe . Node (
346
+ DerivativesDataSink (
347
+ compress = True ,
348
+ in_file = anat_file ,
349
+ source_file = anat_file ,
350
+ base_directory = config . execution . output_dir ,
351
+ space = 'ACPC' ,
352
+ suffix = 'dseg' ,
356
353
),
357
- pe . Node (
358
- DerivativesDataSink (
359
- compress = True ,
360
- in_file = anat_file ,
361
- source_file = anat_file ,
362
- base_directory = config . execution . output_dir ,
363
- space = 'ACPC' ,
364
- desc = 'aseg' ,
365
- suffix = 'dseg' ,
366
- ) ,
367
- name = _get_wf_name ( anat_file , 'ds_t1_aseg' ) ,
368
- run_without_submitting = True ,
354
+ name = _get_wf_name ( anat_file , 'ds_t1_seg' ),
355
+ run_without_submitting = True ,
356
+ ) ,
357
+ pe . Node (
358
+ DerivativesDataSink (
359
+ compress = True ,
360
+ in_file = anat_file ,
361
+ source_file = anat_file ,
362
+ base_directory = config . execution . output_dir ,
363
+ space = 'ACPC' ,
364
+ desc = 'aseg' ,
365
+ suffix = 'dseg' ,
369
366
),
370
- pe .Node (
371
- DerivativesDataSink (
372
- in_file = anat_file ,
373
- source_file = anat_file ,
374
- base_directory = config .execution .output_dir ,
375
- to = 'ACPC' ,
376
- mode = 'image' ,
377
- suffix = 'xfm' ,
378
- ** {'from' : anatomical_template },
379
- ),
380
- name = _get_wf_name (anat_file , 'ds_t1_mni_inv_warp' ),
381
- run_without_submitting = True ,
367
+ name = _get_wf_name (anat_file , 'ds_t1_aseg' ),
368
+ run_without_submitting = True ,
369
+ ),
370
+ pe .Node (
371
+ DerivativesDataSink (
372
+ in_file = anat_file ,
373
+ source_file = anat_file ,
374
+ base_directory = config .execution .output_dir ,
375
+ suffix = 'xfm' ,
376
+ extension = '.h5' ,
377
+ ** {'from' : anatomical_template , 'to' : 'ACPC' , 'mode' : 'image' },
382
378
),
383
- pe .Node (
384
- DerivativesDataSink (
385
- source_file = anat_file ,
386
- in_file = anat_file ,
387
- base_directory = config .execution .output_dir ,
388
- to = 'ACPC' ,
389
- mode = 'image' ,
390
- suffix = 'xfm' ,
391
- ** {'from' : 'anat' },
392
- ),
393
- name = _get_wf_name (anat_file , 'ds_t1_template_acpc_transforms' ),
394
- run_without_submitting = True ,
379
+ name = _get_wf_name (anat_file , 'ds_t1_mni_inv_warp' ),
380
+ run_without_submitting = True ,
381
+ ),
382
+ pe .Node (
383
+ DerivativesDataSink (
384
+ source_file = anat_file ,
385
+ in_file = text_file ,
386
+ base_directory = config .execution .output_dir ,
387
+ to = 'ACPC' ,
388
+ mode = 'image' ,
389
+ suffix = 'xfm' ,
390
+ extension = '.mat' ,
391
+ ** {'from' : 'anat' },
395
392
),
396
- pe .Node (
397
- DerivativesDataSink (
398
- in_file = anat_file ,
399
- source_file = anat_file ,
400
- base_directory = config .execution .output_dir ,
401
- to = 'anat' ,
402
- mode = 'image' ,
403
- suffix = 'xfm' ,
404
- ** {'from' : 'ACPC' },
405
- ),
406
- name = _get_wf_name (anat_file , 'ds_t1_template_acpc_inv_transforms' ),
407
- run_without_submitting = True ,
393
+ name = _get_wf_name (anat_file , 'ds_t1_template_acpc_transforms' ),
394
+ run_without_submitting = True ,
395
+ ),
396
+ pe .Node (
397
+ DerivativesDataSink (
398
+ in_file = text_file ,
399
+ source_file = anat_file ,
400
+ base_directory = config .execution .output_dir ,
401
+ to = 'anat' ,
402
+ mode = 'image' ,
403
+ suffix = 'xfm' ,
404
+ extension = '.mat' ,
405
+ ** {'from' : 'ACPC' },
408
406
),
409
- pe .Node (
410
- DerivativesDataSink (
411
- in_file = anat_file ,
412
- source_file = anat_file ,
413
- base_directory = config .execution .output_dir ,
414
- to = anatomical_template ,
415
- mode = 'image' ,
416
- suffix = 'xfm' ,
417
- ** {'from' : 'ACPC' },
418
- ),
419
- name = _get_wf_name (anat_file , 'ds_t1_mni_warp' ),
420
- run_without_submitting = True ,
407
+ name = _get_wf_name (anat_file , 'ds_t1_template_acpc_inv_transforms' ),
408
+ run_without_submitting = True ,
409
+ ),
410
+ pe .Node (
411
+ DerivativesDataSink (
412
+ in_file = anat_file ,
413
+ source_file = anat_file ,
414
+ base_directory = config .execution .output_dir ,
415
+ to = anatomical_template ,
416
+ mode = 'image' ,
417
+ suffix = 'xfm' ,
418
+ extension = '.h5' ,
419
+ ** {'from' : 'ACPC' },
421
420
),
422
- ]
423
- )
421
+ name = _get_wf_name (anat_file , 'ds_t1_mni_warp' ),
422
+ run_without_submitting = True ,
423
+ ),
424
+ ]
425
+ )
424
426
425
427
return clean_datasinks (workflow )
426
428
427
429
428
- def init_single_dwi_run_wf (dwi_file : str ):
429
- """Set up a single-run workflow for SimBIDS."""
430
- from niworkflows .engine .workflows import LiterateWorkflow as Workflow
431
-
432
- workflow = Workflow (name = _get_wf_name (dwi_file , 'single_run' ))
433
- workflow .__desc__ = ''
434
-
435
- # Fill in datasinks seen so far
436
- for node in workflow .list_node_names ():
437
- if node .split ('.' )[- 1 ].startswith ('ds_' ):
438
- workflow .get_node (node ).inputs .base_directory = config .execution .output_dir
439
- workflow .get_node (node ).inputs .source_file = dwi_file
440
-
441
- return workflow
442
-
443
-
444
430
def clean_datasinks (workflow : pe .Workflow ) -> pe .Workflow :
445
431
"""Overwrite ``out_path_base`` of DataSinks."""
446
432
for node in workflow .list_node_names ():
0 commit comments