@@ -278,6 +278,25 @@ def transform_derivative(wf_name, label, reg_tool, num_cpus, num_ants_cores,
278278 return wf
279279
280280
281+ def convert_pedir (pedir ):
282+ '''FSL Flirt requires pedir input encoded as an int'''
283+ conv_dct = {'x' : 1 , 'y' : 2 , 'z' : 3 , 'x-' : - 1 , 'y-' : - 2 , 'z-' : - 3 ,
284+ 'i' : 1 , 'j' : 2 , 'k' : 3 , 'i-' : - 1 , 'j-' : - 2 , 'k-' : - 3 ,
285+ '-x' : - 1 , '-i' : - 1 , '-y' : - 2 ,
286+ '-j' : - 2 , '-z' : - 3 , '-k' : - 3 }
287+
288+ if isinstance (pedir , bytes ):
289+ pedir = pedir .decode ()
290+ if not isinstance (pedir , str ):
291+ raise Exception ("\n \n Phase-encoding direction must be a "
292+ "string value.\n \n Value: {0}"
293+ "\n \n " .format (pedir ))
294+ if pedir not in conv_dct .keys ():
295+ raise Exception ("\n \n Invalid phase-encoding direction "
296+ "entered: {0}\n \n " .format (pedir ))
297+ return conv_dct [pedir ]
298+
299+
281300def create_fsl_flirt_linear_reg (name = 'fsl_flirt_linear_reg' ):
282301
283302 linear_register = pe .Workflow (name = name )
@@ -683,26 +702,6 @@ def create_register_func_to_anat(config, phase_diff_distcor=False,
683702 if config .registration_workflows ['functional_registration' ]['coregistration' ]['arguments' ] is not None :
684703 linear_reg .inputs .args = config .registration_workflows ['functional_registration' ]['coregistration' ]['arguments' ]
685704
686- # if fieldmap_distortion:
687-
688- def convert_pedir (pedir ):
689- # FSL Flirt requires pedir input encoded as an int
690- conv_dct = {'x' : 1 , 'y' : 2 , 'z' : 3 , 'x-' : - 1 , 'y-' : - 2 , 'z-' : - 3 ,
691- 'i' : 1 , 'j' : 2 , 'k' : 3 , 'i-' : - 1 , 'j-' : - 2 , 'k-' : - 3 ,
692- '-x' : - 1 , '-i' : - 1 , '-y' : - 2 ,
693- '-j' : - 2 , '-z' : - 3 , '-k' : - 3 }
694-
695- if isinstance (pedir , bytes ):
696- pedir = pedir .decode ()
697- if not isinstance (pedir , str ):
698- raise Exception ("\n \n Phase-encoding direction must be a "
699- "string value.\n \n Value: {0}"
700- "\n \n " .format (pedir ))
701- if pedir not in conv_dct .keys ():
702- raise Exception ("\n \n Invalid phase-encoding direction "
703- "entered: {0}\n \n " .format (pedir ))
704- return conv_dct [pedir ]
705-
706705 if phase_diff_distcor :
707706 register_func_to_anat .connect (
708707 inputNode_pedir , ('pedir' , convert_pedir ),
@@ -973,24 +972,6 @@ def bbreg_args(bbreg_target):
973972 inputspec , 'linear_reg_matrix' ,
974973 bbreg_func_to_anat , 'in_matrix_file' )
975974
976- def convert_pedir (pedir ):
977- # FSL Flirt requires pedir input encoded as an int
978- conv_dct = {'x' : 1 , 'y' : 2 , 'z' : 3 , 'x-' : - 1 , 'y-' : - 2 , 'z-' : - 3 ,
979- 'i' : 1 , 'j' : 2 , 'k' : 3 , 'i-' : - 1 , 'j-' : - 2 , 'k-' : - 3 ,
980- '-x' : - 1 , '-i' : - 1 , '-y' : - 2 ,
981- '-j' : - 2 , '-z' : - 3 , '-k' : - 3 }
982-
983- if isinstance (pedir , bytes ):
984- pedir = pedir .decode ()
985- if not isinstance (pedir , str ):
986- raise Exception ("\n \n Phase-encoding direction must be a "
987- "string value.\n \n Value: {0}"
988- "\n \n " .format (pedir ))
989- if pedir not in conv_dct .keys ():
990- raise Exception ("\n \n Invalid phase-encoding direction "
991- "entered: {0}\n \n " .format (pedir ))
992- return conv_dct [pedir ]
993-
994975 if phase_diff_distcor :
995976 register_bbregister_func_to_anat .connect (
996977 inputNode_pedir , ('pedir' , convert_pedir ),
0 commit comments