Exemplo n.º 1
0
        sys.exit()

    # parse the arguments
    if not iter:
        iter = 10
    else:
        iter = int(iter)

    if metafile and os.path.exists(metafile):
        metadata = loadstar(metafile, dtype=datatype)
        tiltAngles = metadata['TiltAngle']
    else:
        tiltAngles = []
    # start reconstruction
    from pytom.tompy.io import read, write
    from nufft.reconstruction import fourier_2d1d_iter_reconstruct
    from pytom.reconstruction.reconstructionStructures import ProjectionList
    projections = ProjectionList()
    projections.loadDirectory(proj_dir, tiltAngles=tiltAngles)
    projections.sort()

    projs = []
    tilt_angles = []
    for p in projections:
        print(p.getTiltAngle(), p.getFilename())
        projs.append(read(p.getFilename()))
        tilt_angles.append(p.getTiltAngle())

    v = fourier_2d1d_iter_reconstruct(projs, tilt_angles, iter)
    write(output_filename, v)
Exemplo n.º 2
0
    if not aw:
        aw = 0
    else:
        aw = float(aw)

    if recOffset:
        recOffset = [int(i) for i in recOffset.split(",")]
    else:
        recOffset = [0., 0., 0.]

    try:
        numProcesses = int(numProcesses)
    except:
        numProcesses = 0

    projections = ProjectionList()
    if checkFileExists(projectionList):
        projections.fromXMLFile(projectionList)
    elif checkDirExists(projectionDirectory):
        projections.loadDirectory(projectionDirectory, metafile=metafile)
    else:
        raise RuntimeError(
            'Neither projectionList existed nor the projectionDirectory you specified! Abort'
        )

    import os

    if os.path.exists(os.path.join(projectionDirectory,
                                   'alignmentResults.txt')):
        alignResultFile = os.path.join(projectionDirectory,
                                       'alignmentResults.txt')
Exemplo n.º 3
0
        raise ValueError("The particle size has to be an even number.")

    peak_border = vol_size // 2 - max_shift
    if peak_border < 0:
        raise ValueError(
            "The given shiftStandardDeviation and peakBorderSize result in a maximal shift "
            "bigger than the given volume. Please use a bigger volume or a smaller maximal shift."
        )

    # Split particlelist based on filename
    # Map filename to right projection directory

    mpi = MPI()
    mpi.begin()

    projections = ProjectionList()
    projections.loadDirectory(proj_dir)
    projections.sort()

    # create the list of projectionfilenames and tiltangles
    proj = []
    tilt_angles = []

    for p in projections:
        proj.append(p.getFilename())
        tilt_angles.append(p.getTiltAngle())

    polish_particles(particleList,
                     proj_dir,
                     template,
                     coordinateBinning,
Exemplo n.º 4
0
    else:
        projBinning = 1

    if coordinateBinning:
        coordinateBinning = float(coordinateBinning)
    else:
        coordinateBinning = 1
    if not aw:
        aw = False

    if recOffset:
        recOffset = [int(i) for i in recOffset.split(",")]
    else:
        recOffset = [0., 0., 0.]

    projections = ProjectionList()
    if checkFileExists(projectionList):
        projections.fromXMLFile(projectionList)
    elif checkDirExists(projectionDirectory):
        projections.loadDirectory(projectionDirectory)
    else:
        raise RuntimeError(
            'Neither projectionList existed nor the projectionDirectory you specified! Abort'
        )

    if tomogram:
        vol = projections.reconstructVolume(dims=size,
                                            reconstructionPosition=recOffset,
                                            binning=projBinning,
                                            applyWeighting=aw)
        vol.write(tomogram)