# load CSV file data=load_csv(input_csv) # columns: # Subject,Visit,Filename,Age,Gender,Scale # # setup R objects for performing linear modelling Subject = ro.FactorVector(data['Subject']) Visit = ro.FactorVector(data['Visit']) Age = ro.FloatVector(data['Age']) Gender = ro.FactorVector(data['Gender']) Scale = ro.FloatVector(data['Scale']) inp=pyezminc.parallel_input_iterator() out=pyezminc.parallel_output_iterator() # allocate R formula, saves time for interpreter fixed_effects = ro.Formula('Jacobian ~ I(Age^2) + Gender:I(Age^2) + Age + Gender:Age + Gender') random_effects = ro.Formula('~1|Subject') inp.open(data['Filename'],mask_file ) out.open(["output_roi_Intercept.mnc","output_roi_Age2.mnc","output_roi_Gender_Age2.mnc","output_roi_Age.mnc","output_roi_Gender_Age.mnc","output_roi_Gender.mnc", "output_roi_Intercept_t.mnc","output_roi_Age2_t.mnc","output_roi_Gender_Age2_t.mnc","output_roi_Age_t.mnc","output_roi_Gender_Age_t.mnc","output_roi_Gender_t.mnc" ],mask_file) # allocate space for input jacobian=np.zeros(shape=[inp.dim()],dtype=np.float64,order='C') # allocate space for output
# probably model didn't converge pass return result if __name__ == "__main__": max_jobs_queue = 100 inp = pyezminc.parallel_input_iterator() inp.open(data['Filename'], mask_file) # setup output iterator out = pyezminc.parallel_output_iterator() out.open([ "output_Intercept.mnc", "output_Age2.mnc", "output_Gender_Age2.mnc", "output_Age.mnc", "output_Gender_Age.mnc", "output_Gender.mnc", "output_Intercept_t.mnc", "output_Age2_t.mnc", "output_Gender_Age2_t.mnc", "output_Age_t.mnc", "output_Gender_Age_t.mnc", "output_Gender_t.mnc" ], mask_file) l = None # start iterators, not really needed inp.begin() out.begin()