Beispiel #1
0
def testingParameters():
    """
    Create a Spliner parameters object for FISTA deconvolution.
    """
    if settings.use_fista:
        params = parameters.ParametersSplinerFISTA()
    else:
        params = parameters.ParametersSplinerSTD()

    params.setAttr("max_frame", "int", -1)
    params.setAttr("start_frame", "int", -1)

    params.setAttr("background_sigma", "float", 8.0)
    params.setAttr("camera_gain", "float", settings.camera_gain)
    params.setAttr("camera_offset", "float", settings.camera_offset)
    params.setAttr("find_max_radius", "int", 15)
    params.setAttr("iterations", "int", settings.iterations)
    params.setAttr("pixel_size", "float", settings.pixel_size)
    params.setAttr("max_z", "float", 1.0)
    params.setAttr("min_z", "float", -1.0)
    params.setAttr("no_fitting", "int", 1)

    params.setAttr("sigma", "float", 1.5)
    params.setAttr("spline", "filename", "psf.spline")
    params.setAttr("threshold", "float", 6.0)

    # FISTA.
    if settings.use_fista:
        params.setAttr("use_fista", "int", settings.use_fista)
        params.setAttr("fista_iterations", "int", 500)
        params.setAttr("fista_lambda", "float", 20.0)
        params.setAttr("fista_number_z", "int", 5)
        params.setAttr("fista_threshold", "float", 500.0)
        params.setAttr("fista_timestep", "float", 0.1)

        params.setAttr("rb_radius", "float", 10.0)
        params.setAttr("rb_sigma", "float", 1.0)

    # Standard
    else:
        params.setAttr("z_value", "float-array", [-0.6, -0.3, 0.0, 0.3, 0.6])

    # Don't do tracking.
    params.setAttr("descriptor", "string", "1")
    params.setAttr("radius", "float", "0.0")

    # Don't do drift-correction.
    params.setAttr("d_scale", "int", 2)
    params.setAttr("drift_correction", "int", 0)
    params.setAttr("frame_step", "int", 500)
    params.setAttr("z_correction", "int", 0)

    # 'peak_locations' testing.
    if hasattr(settings, "peak_locations") and (settings.peak_locations
                                                is not None):
        params.setAttr("peak_locations", "filename", settings.peak_locations)

    return params
Beispiel #2
0
def analyze(movie_name, mlist_name, settings_name):
    parameters = params.ParametersSpliner().initFromFile(settings_name,
                                                         warnings=False)
    if (parameters.getAttr("use_fista", 0) != 0):
        parameters = params.ParametersSplinerFISTA().initFromFile(
            settings_name)
        finder = find_peaks_fista.SplinerFISTAFinderFitter(parameters)
    else:
        parameters = params.ParametersSplinerSTD().initFromFile(settings_name)
        finder = find_peaks_std.SplinerFinderFitter(parameters)
    std_analysis.standardAnalysis(finder, movie_name, mlist_name, parameters)
Beispiel #3
0
def analyze(movie_name, mlist_name, settings_name):

    # Load parameters.
    parameters = params.ParametersSpliner().initFromFile(settings_name,
                                                         warnings=False)

    # Check for v1.0 parameters.
    if not (parameters.hasAttr("camera_gain")
            or parameters.hasAttr("camera_calibration")):
        raise Exception(
            "Camera parameters are missing. Version 1.0 parameters?")

    # Create appropriate finding and fitting object.
    if (parameters.getAttr("use_fista", 0) != 0):
        parameters = params.ParametersSplinerFISTA().initFromFile(
            settings_name)
        finder = find_peaks_fista.initFindAndFit(parameters)
    else:
        parameters = params.ParametersSplinerSTD().initFromFile(settings_name)
        finder = find_peaks_std.initFindAndFit(parameters)

    # Create appropriate reader.
    if parameters.hasAttr("camera_offset"):
        frame_reader = analysisIO.FrameReaderStd(movie_file=movie_name,
                                                 parameters=parameters)
    else:
        frame_reader = analysisIO.FrameReaderSCMOS(movie_file=movie_name,
                                                   parameters=parameters)

    # Create movie reader (uses frame reader).
    movie_reader = analysisIO.MovieReader(frame_reader=frame_reader,
                                          parameters=parameters)

    # Create localization file writer.
    data_writer = analysisIO.DataWriterHDF5(data_file=mlist_name,
                                            parameters=parameters,
                                            sa_type="Spliner")

    std_analysis.standardAnalysis(finder, movie_reader, data_writer,
                                  parameters)
Beispiel #4
0
def testingParameters():
    """
    Create a Spliner parameters object for CS deconvolution.
    """
    if (settings.decon_method == "ADMM"):
        params = parameters.ParametersSpliner()
        params.update(parameters.ParametersADMM())
        params.update(parameters.ParametersRollingBall())
    elif (settings.decon_method == "3denseSTORM"):
        params = parameters.ParametersSpliner()
        params.update(parameters.Parameters3denseSTORM())
        params.update(parameters.ParametersRollingBall())
    elif (settings.decon_method == "FISTA"):
        params = parameters.ParametersSpliner()
        params.update(parameters.ParametersFISTA())
        params.update(parameters.ParametersRollingBall())
    else:
        params = parameters.ParametersSplinerSTD()

    params.setAttr("max_frame", "int", -1)
    params.setAttr("start_frame", "int", -1)

    params.setAttr("background_sigma", "float", 8.0)
    params.setAttr("camera_gain", "float", settings.camera_gain)
    params.setAttr("camera_offset", "float", settings.camera_offset)
    params.setAttr("find_max_radius", "int", 15)
    params.setAttr("iterations", "int", settings.iterations)
    params.setAttr("pixel_size", "float", settings.pixel_size)
    params.setAttr("max_z", "float", 1.0)
    params.setAttr("min_z", "float", -1.0)
    params.setAttr("no_fitting", "int", 1)

    params.setAttr("sigma", "float", 1.5)
    params.setAttr("spline", "filename", "psf.spline")
    params.setAttr("threshold", "float", 6.0)

    # ADMM.
    if (settings.decon_method == "ADMM"):
        params.setAttr("decon_method", "string", settings.decon_method)
        params.setAttr("admm_iterations", "int", settings.cs_iterations)
        params.setAttr("admm_lambda", "float", 10.0)
        params.setAttr("admm_number_z", "int", 5)
        params.setAttr("admm_rho", "float", 0.1)
        params.setAttr("admm_threshold", "float", 500.0)

        params.setAttr("background_estimator", "string", "RollingBall")
        params.setAttr("rb_radius", "float", 10.0)
        params.setAttr("rb_sigma", "float", 1.0)

    # 3denseSTORM
    elif (settings.decon_method == "3denseSTORM"):
        params.setAttr("decon_method", "string", settings.decon_method)
        params.setAttr("ds3_beta", "float", 2.44)
        params.setAttr("ds3_eta", "float", 9.0e-3)
        params.setAttr("ds3_iterations", "int", settings.cs_iterations)
        params.setAttr("ds3_micro", "float", 0.1)
        params.setAttr("ds3_number_z", "int", 5)
        params.setAttr("ds3_threshold", "float", 500.0)

        params.setAttr("background_estimator", "string", "RollingBall")
        params.setAttr("rb_radius", "float", 10.0)
        params.setAttr("rb_sigma", "float", 1.0)

    # FISTA
    elif (settings.decon_method == "FISTA"):
        params.setAttr("decon_method", "string", settings.decon_method)
        params.setAttr("fista_iterations", "int", settings.cs_iterations)
        params.setAttr("fista_lambda", "float", 20.0)
        params.setAttr("fista_number_z", "int", 5)
        params.setAttr("fista_threshold", "float", 500.0)
        params.setAttr("fista_timestep", "float", 0.25)

        params.setAttr("background_estimator", "string", "RollingBall")
        params.setAttr("rb_radius", "float", 10.0)
        params.setAttr("rb_sigma", "float", 1.0)

    # Standard
    else:
        params.setAttr("z_value", "float-array", [-0.6, -0.3, 0.0, 0.3, 0.6])

    # Don't do tracking.
    params.setAttr("descriptor", "string", "1")
    params.setAttr("radius", "float", "0.0")

    # Don't do drift-correction.
    params.setAttr("d_scale", "int", 2)
    params.setAttr("drift_correction", "int", 0)
    params.setAttr("frame_step", "int", 500)
    params.setAttr("z_correction", "int", 0)

    # 'peak_locations' testing.
    if hasattr(settings, "peak_locations") and (settings.peak_locations
                                                is not None):
        params.setAttr("peak_locations", "filename", settings.peak_locations)

    return params