Beispiel #1
0
def _replace_settings(settings, config, file_name='config.ini'):

    # Replace the dictionary
    config['USER'] = {
    # General
    'single_images':settings.single_images,
    'autoload_images':settings.autoload_images,
    'auto_background':settings.auto_background,
    'dark_theme':settings.dark_theme,
    # Image
    'crop_image':settings.crop_image,
    'crop_size':settings.crop_size,
    'correct_signed':settings.correct_signed,
    'correction_type':settings.correction_type,
    'background_type':settings.background_type,
    'correct_intensity':settings.correct_intensity,
    'intensity_correction_type':settings.intensity_correction_type,
    'correct_newtab':settings.correct_newtab,
    # Scale
    'space_scale':settings.space_scale,
    'space_unit':settings.space_unit,
    'frame_rate':settings.frame_rate,
    # Other(s)
    'tracker':settings.tracker,
    }

    # Get the path to the config file
    file_path = getConfigPath(file_name=file_name)

    # Save the file
    with open(file_path, 'w') as configfile:
        config.write(configfile)
Beispiel #2
0
def _open_config_file(file_name='display_track_config.ini'):

    # Get the path to the config file
    file_path = getConfigPath(file_name=file_name)

    # Initialise the config file if it does not exist
    if not os.path.exists(file_path):
        _init_default_config(file_path=file_path)

    # Load the content of the file
    config = configparser.RawConfigParser()
    config.read(file_path)

    return config
Beispiel #3
0
def deleteTracker(tracker_name, file_name='trackers_config.ini'):

    # Get the content
    config = _open_config_file(file_name=file_name)

    # Delete the selected tracker
    config.remove_section(tracker_name)

    # Get the path to the config file
    file_path = getConfigPath(file_name=file_name)

    # Save the file
    with open(file_path, 'w') as configfile:
        config.write(configfile)
Beispiel #4
0
def _replace_settings(settings, config, file_name='display_track_config.ini'):

    # Replace the dictionary
    config['DISPLAY'] = {
        # Positions
        'show_positions': settings.show_positions,
        'current_position': settings.current_position,
        'color_position': settings.color_position,
        # Paths
        'show_paths': settings.show_paths,
        'current_path': settings.current_path,
        'color_path': settings.color_path,
    }

    # Get the path to the config file
    file_path = getConfigPath(file_name=file_name)

    # Save the file
    with open(file_path, 'w') as configfile:
        config.write(configfile)
Beispiel #5
0
def _replace_settings(settings, config, file_name='trackers_config.ini'):

    # Extract data
    tracker_name = settings.name
    settings = settings.session

    # Replace the dictionary
    config[tracker_name] = {
        # Object
        'diameter': settings.diameter,
        'minmass': settings.minmass,
        'maxsize': settings.maxsize,
        'separation': settings.separation,
        'percentile': settings.percentile,
        'invert': settings.invert,
        # Filter
        'noise_size': settings.noise_size,
        'smoothing_size': settings.smoothing_size,
        'threshold': settings.threshold,
        'preprocess': settings.preprocess,
        'topn': settings.topn,
        # Other
        'characterize': settings.characterize,
        'engine': settings.engine,
        # Trajectory
        'search_range': settings.search_range,
        'memory': settings.memory,
        'adaptive_stop': settings.adaptive_stop,
        'adaptive_step': settings.adaptive_step,
        'neighbor_strategy': settings.neighbor_strategy,
        'link_strategy': settings.link_strategy,
        'filter_stubs': settings.filter_stubs,
    }

    # Get the path to the config file
    file_path = getConfigPath(file_name=file_name)

    # Save the file
    with open(file_path, 'w') as configfile:
        config.write(configfile)