def main_InteractivelySetParameters(): ####################################################################################################################### ############################################### User Parameters ###################################################### ####################################################################################################################### # GENFIRE's reconstruction parameters can be edited here by the user and run interactively, any inputs provided # by either the command line or the GUI will override these momentarily print ("starting main_InteractivelySetParameters") filename_projections = 'projections.mrc' #filename of projections, which should be size NxNxN_projections where N_projections is the number of projections filename_angles = 'angles.txt' #angles can be either a 1xN_projections array containing a single tilt series, or 3xN_projections array containing 3 Euler angles for each projections in the form [phi;theta;psi] filename_support = '' #NxNxN binary array specifying a region of 1's in which the reconstruction can exist filename_initialObject = None #initial object to use in reconstruction; set to None to provide no initial guess filename_results = 'GENFIRE_rec.mrc' #filename to save results resolutionExtensionSuppressionState = 2 # 1) Turn on resolution extension/suppression, 2) No resolution extension/suppression, 3) Just resolution extension numIterations = 100 #number of iterations to run in iterative reconstruction oversamplingRatio = 3 #input projections will be padded internally to match this oversampling ratio. If you prepad your projections, set this to 1 interpolationCutoffDistance = 0.7 #radius of spherical interpolation kernel (in pixels) within which to include measured datapoints doYouWantToDisplayFigure = True displayFigure = genfire.reconstruct.DisplayFigure() displayFigure.DisplayFigureON = doYouWantToDisplayFigure calculateRFree = True if filename_support is None: useDefaultSupport = True else: useDefaultSupport = False reconstruction_parameters = ReconstructionParameters() reconstruction_parameters.projections = filename_projections reconstruction_parameters.eulerAngles = filename_angles reconstruction_parameters.support = filename_support reconstruction_parameters.interpolationCutoffDistance = interpolationCutoffDistance reconstruction_parameters.numIterations = numIterations reconstruction_parameters.oversamplingRatio = oversamplingRatio reconstruction_parameters.displayFigure = displayFigure reconstruction_parameters.calculateRfree = calculateRFree reconstruction_parameters.resolutionExtensionSuppressionState = resolutionExtensionSuppressionState reconstruction_parameters.useDefaultSupport = useDefaultSupport if os.path.isfile(filename_results): # If a valid initial object was provided, use it reconstruction_parameters.initialObject = filename_results main(reconstruction_parameters)
interpolationCutoffDistance = float(interpolationCutoffDistance) except NameError as e: interpolationCutoffDistance = 0.7 #end reconstruction_parameters = ReconstructionParameters() reconstruction_parameters.projections = filename_projections reconstruction_parameters.eulerAngles = filename_angles reconstruction_parameters.support = filename_support reconstruction_parameters.interpolationCutoffDistance = interpolationCutoffDistance reconstruction_parameters.numIterations = numIterations reconstruction_parameters.oversamplingRatio = oversamplingRatio reconstruction_parameters.displayFigure = displayFigure reconstruction_parameters.calculateRfree = calculateRFree reconstruction_parameters.resolutionExtensionSuppressionState = resolutionExtensionSuppressionState reconstruction_parameters.methodState = methodState reconstruction_parameters.useDefaultSupport = useDefaultSupport if os.path.isfile(filename_results): # If a valid initial object was provided, use it reconstruction_parameters.initialObject = filename_results try: main(reconstruction_parameters) except (NameError, IOError): main(reconstruction_parameters) #end # try: # main(filename_projections, # filename_angles, # filename_support, # filename_results, # numIterations,