def setup_data(self, request): ''' ''' img_dir = os.path.join(self.__tmp_dir,'input_images') seg_dir = os.path.join(self.__tmp_dir,'input_labels') if not os.path.exists(img_dir): os.mkdir(img_dir) if not os.path.exists(seg_dir): os.mkdir(seg_dir) # print request.files['img0'] # return # print request.files['img0'][0]['body'] for rf in request.files['img']: with open(os.path.join(img_dir, rf['filename']), 'wb') as f: f.write(rf['body']) for rf in request.files['seg']: with open(os.path.join(seg_dir, rf['filename']), 'wb') as f: f.write(rf['body']) print 'converting images', img_dir image_tile_calculator.run(img_dir, self.__mojo_dir) segmentation_tile_calculator.run(seg_dir, self.__mojo_dir) # now we need to refresh the datasources self.__logic.finish_setup()
import image_tile_calculator img_dir = '/tmp/img' mojo_dir = '/tmp/mojo' image_tile_calculator.run(img_dir, mojo_dir)