def brain_extraction(input_filename, output_filename=None): print 'Brain extraction ...' if output_filename == None: filename_save = input_filename.split('.')[0]+'_bet.nii.gz' else: filename_save = os.path.abspath(output_filename) bet(input_filename, filename_save,options=' -R -F -f .2 -g 0') print "Saving to:", filename_save return filename_save
if root.endswith('MPRAGE_1_from_structual_T1Space'): # anatomy bet base_dir = root+'/' #filename = 'T1_anatomy.nii.gz' filename = 'fbrain1_mprage1.nii.gz' base_filename = base_dir + filename #bet(base_filename, root+'/fbrain0_mprage1_bet.nii.gz',options=' -R -f .2 -g 0') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .4 -g -0.05 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .2 -g -0.02 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .1 -g -0.02 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .15 -g 0.0 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -R -f .2 -g 0.0 -c 151 177 90') bet(base_filename, root+'/bet_new.nii.gz',options=' -R -f .2 -g 0.0 -c 151 177 90') ''' if root.endswith('DTI'): #difusion tensor image - brain extraction base_dir = root+'/' filename = 'raw.nii.gz' base_filename = base_dir + filename bet(base_filename, root+'/raw_bet.nii.gz',options=' -R -F -f .2 -g 0') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .4 -g -0.05 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .2 -g -0.02 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .1 -g -0.02 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -F -f .15 -g 0.0 -c 151 177 90') #bet(base_filename, root+'/rawbet.nii.gz',options=' -R -f .2 -g 0.0 -c 151 177 90')