def checkT1s(T1_files, cw256=False):
 import sys
 import nibabel as nib
 from nipype.utils.filemanip import filename_to_list
 T1_files = filename_to_list(T1_files)
 if (len(T1_files) == 0):
  print "ERROR: No T1's Given"
  sys.exit((-1))
 shape = nib.load(T1_files[0]).shape
 for t1 in T1_files[1:]:
  if (nib.load(t1).shape != shape):
   print 'ERROR: T1s not the same size. Cannot process {0} and {1} together'.format(T1_files[0], t1)
   sys.exit((-1))
 origvol_names = ['{0:03d}.mgz'.format((i + 1)) for i in range(len(T1_files))]
 if ((not cw256) and any(((dim > 256) for dim in shape))):
  print 'Setting MRI Convert to crop images to 256 FOV'
  cw256 = True
 resample_type = ('cubic' if (len(T1_files) > 1) else 'interpolate')
 return (T1_files, cw256, resample_type, origvol_names)

def checkT1s ( T1_files , cw256 = False ) : import sys import nibabel as nib from nipype . utils . filemanip import filename_to_list T1_files = filename_to_list ( T1_files ) if ( len ( T1_files ) == 0 ) : print "ERROR: No T1's Given" sys . exit ( ( - 1 ) ) shape = nib . load ( T1_files [ 0 ] ) . shape for t1 in T1_files [ 1 : ] : if ( nib . load ( t1 ) . shape != shape ) : print 'ERROR: T1s not the same size. Cannot process {0} and {1} together' . format ( T1_files [ 0 ] , t1 ) sys . exit ( ( - 1 ) ) origvol_names = [ '{0:03d}.mgz' . format ( ( i + 1 ) ) for i in range ( len ( T1_files ) ) ] if ( ( not cw256 ) and any ( ( ( dim > 256 ) for dim in shape ) ) ) : print 'Setting MRI Convert to crop images to 256 FOV' cw256 = True resample_type = ( 'cubic' if ( len ( T1_files ) > 1 ) else 'interpolate' ) return ( T1_files , cw256 , resample_type , origvol_names )
verifying size of inputs and setting workflow parameters .