def main(args): total_start = timeit.default_timer() print('Starting reconstruction of volume %s ...'%(args.substack_id)) substack = SubStack(args.indir,args.substack_id) substack.load_volume() tensor = substack.get_volume() # Changing the tensor so that it has a 6 pixel black padding. Hopefully it won't frick things up too much. Else, mail time. print("The shape of the tensor before padding: " + str(np.shape(tensor))) tensor = pad(tensor, 6) print("The shape of the tensor after padding: " + str(np.shape(tensor))) if not args.local_mean_std: print('Reading standardization data from', args.trainfile) h5 = tables.openFile(args.trainfile) Xmean = h5.root.Xmean[:].astype(np.float32) Xstd = h5.root.Xstd[:].astype(np.float32) h5.close() else: Xmean=None Xstd=None print('Starting semantic devonvolution of volume', args.substack_id) # Importing here to have a clean --help from keras.models import model_from_json model = model_from_json(open(args.model + '/architecture.json').read()) model.load_weights(args.model + '/weights.h5') minz = int(re.split('[a-zA-z0-9]*_',substack.info['Files'][0])[1].split('.tif')[0]) # Remove the margin, I have changed deconvolver to use a fized number instead of the extramargin. Hope it works. reconstruction = deconvolver.filter_volume(tensor, Xmean, Xstd, args.extramargin, model, args.speedup, do_cython=args.do_cython, trainfile=args.trainfile) imtensor.save_tensor_as_tif(reconstruction, args.outdir+'/'+args.substack_id, minz) print ("total time reconstruction: %s" %(str(timeit.default_timer() - total_start)))