if verbose: print "Initialize stacks" avg_stack = None max_int_stack = None max_dev_stack = None max_col_diff_stack = None median_stack = None if avg_stack_file is not None: avg_stack = np.zeros((h,w,c), dtype='double') avg_stack = avg_stack + img if max_int_stack_file is not None: max_int_stack = np.zeros((h,w,c), dtype=img.dtype) max_int_stack = max_int_stack + img # Maximum intensities need to be 32-bit to prevent overflow max_pix_intensities = np.zeros((h,w), dtype='uint32') max_pix_intensities = max_pix_intensities + img.sum(axis=2) if max_dev_stack_file is not None: max_dev_stack = np.zeros((h,w,c), dtype=img.dtype) max_dev_stack = max_dev_stack + img max_pix_deviations = np.zeros((h,w), dtype='uint16') max_pix_deviations = max_pix_deviations + img.std(axis=2) if max_col_diff_stack_file is not None: max_col_diff_stack = np.zeros((h,w,c), dtype=img.dtype) max_col_diff_stack = max_col_diff_stack + img max_col_diffs = img.max(axis=2)-img.min(axis=2) if median_stack_file is not None: # Import HDF5 library import h5py median_stack = np.zeros((h,w,c), dtype=img.dtype) # Create a HDF5 file for temporary storage space for median stack # calculations. The file is memorymapped, so access from the