OpenMind Interaction API

RegistrationGraph.write_sbatch_graphFunction
write_sbatch_graph(
    edges, param_path_fixed::Dict, param_path_moving::Dict, param::Dict;
    clear_cmd_dir::Bool=true,
    cpu_per_task_key::String="cpu_per_task", 
    memory_key::String="memory", 
    duration_key::String="duration",
    duration_julia_key::String="duration_julia",
    job_name_key::String="job_name",
    fixed_channel_key::String="ch_marker",
    moving_channel_key::String="ch_marker",
    head_dir_key::String="path_head_pos",
    om_data_key::String="path_om_data",
    om_scripts_key::String="path_om_scripts",
    nrrd_dir_key::String="path_dir_nrrd_filt",
    nrrd_om_dir_key::String="path_om_nrrd_filt",
    mask_dir_key::String="path_dir_mask",
    mask_om_dir_key::String="path_om_mask",
    reg_dir_key::String="path_dir_reg",
    reg_om_dir_key::String="path_om_reg",
    path_head_rotate_key::String="path_head_rotate",
    parameter_files_key::String="parameter_files",
    cmd_dir_key::String="path_dir_cmd",
    cmd_om_key::String="path_om_cmd",
    cmd_array_dir_key::String="path_dir_cmd_array",
    cmd_array_om_key::String="path_om_cmd_array"
)

Syncs data from local computer to a remote server and creates command files for elastix on that server.

WARNING: This program can permanently delete data if run with incorrect arguments.

Arguments

  • edges: List of registration problems to perform
  • param_path_fixed::Dict: Dictionary containing paths for the fixed images including:
    • get_basename: Function that maps channel and time point to NRRD filename
    • path_dir_cmd: Path to elastix command directory
    • path_om_cmd: Path to elastix command directory on the server
    • path_om_scripts: Path to directory to store scripts on the server
    • path_dir_cmd_array: Path to elastix array command directory
    • path_om_cmd_array: Path to elastix array command directory on the server
    • path_om_log: Path to log file on server
    • path_om_tmp: Path to temporary directory on server
    • path_om_env: Path to script to set environment variables
    • path_run_elastix: Path to script that runs elastix given command on the server
    • path_elastix: Path to elastix executable on the server
    • name_head_rotate_logfile: Name of head rotate log files
  • param_path_moving::Dict: Dictionary containing paths for the moving images including the same keys as with the fixed dictionary.
  • param::Dict: Dictionary containing parameters including:
    • email: Email to inform user of task termination. If nothing, no emails will be sent
    • use_sbatch: Use sbatch, rather than directly running code on the server. This should always be set to true on OpenMind
    • server_dtn: Address of server to transfer data to
    • user: Username on server
    • array_size: Size of sbatch array to use
    • partition: Priority of jobs on sbatch

Optional keyword arguments

  • clear_cmd_dir::Bool: Whether to clear the elastix command directory, useful if you are re-running registrations
  • cpu_per_task_key::String: Key in param to CPU cores per elastix task. Default cpu_per_task
  • memory_key::String: Key in param to memory per elastix task. Default memory
  • duration_key::String: Key in param to the duration of each elastix task. Default duration
  • duration_julia_key::String: Key in param to the duration of the Julia script that runs all elastix task. Default duration_julia
  • job_name_key::String: Key in param to the name of the elastix tasks. Default job_name
  • fixed_channel_key::String: Key in param to the fixed channel. Default ch_marker
  • moving_channel_key::String: Key in param to the moving channel. Default ch_marker
  • head_dir_key::String: Key in param_path_* to the head position of the worm. Default path_head_pos
  • om_data_key::String: Key in param_path_* to the path to sync the data on the server. Default path_om_data
  • om_scripts_key::String: Key in param_path_* to the path to sync the scripts on the server. Default `pathomscripts
  • nrrd_dir_key::String: Key in param_path_* to the path to the NRRD files. Default path_dir_nrrd_filt
  • nrrd_om_dir_key::String: Key in param_path_* to the path to the NRRD files on the server. Default path_om_nrrd_filt
  • mask_dir_key::String: Key in param_path_* to the mask path. Default path_dir_mask
  • mask_om_dir_key::String: Key in param_path_* to the mask path on the server. Default path_om_mask
  • reg_dir_key::String: Key in param_path_* to the registration output directory. Default path_dir_reg
  • reg_om_dir_key::String: Key in param_path_* to the registration output directory on the server. path_om_reg
  • path_head_rotate_key::String: Key in param_path_fixed to the path on the server to the head rotation python file. Default path_head_rotate
  • parameter_files_key::String: Key in param_path_fixed to the path on the server to the elastix parameter files. Default parameter_files
  • cmd_dir_key::String: Key in param_path_fixed to the local path to store the elastix scripts. Default path_dir_cmd
  • cmd_om_key::String: Key in param_path_fixed to the path on the server to store the elastix scripts. Default path_om_cmd
  • cmd_array_dir_key::String: Key in param_path_fixed to the local path to store the elastix array scripts. Default path_dir_cmd_array
  • cmd_array_om_key::String: Key in param_path_fixed to the path on the server to store the elastix array scripts. Default path_om_cmd_array
RegistrationGraph.run_elastix_openmindFunction
run_elastix_openmind(param_path::Dict, param::Dict; extra_cmd_paths=[])

Runs elastix on OpenMind. Requires julia to be installed under the relevant username and activated in the default ssh shell. Note that you cannot have multiple instances of this command running simultaneously with the same temp_dir. Returns the jobid of the Julia script-submission job.

Arguments

  • param_path::Dict: Dictionary of parameter paths including:
    • path_om_tmp: Path to temporary directory on OpenMind.
    • path_om_cmd: Path to elastix command directory on OpenMind.
    • path_om_cmd_array: Path to elastix array command directory on OpenMind.
  • param::Dict: Dictionary of parameter settings including:
    • user: OpenMind username
    • server: Login node address on OpenMind
    • partition: Partition to run elastix using (eg use-everything)
  • extra_cmd_paths (optional, default []): Extra paths to script files to run
RegistrationGraph.get_lockFunction
get_lock(param_path::Dict, param::Dict; lock_key::String="path_dir_lock")

Get a lock in param_path[lock_key]. Wait a minimum of param["lock_wait"] between successive lock checks.

RegistrationGraph.release_lockFunction
release_lock(param_path::Dict, param::Dict; lock_key::String="path_dir_lock")

Release a lock in param_path[lock_key].

RegistrationGraph.wait_for_elastixFunction
wait_for_elastix(param::Dict)

This function stalls until all the user's jobs on OpenMind are completed.

Arguments

  • param::Dict: Parameter dictionary including:
    • user: Username on OpenMind
    • server: Login node address on OpenMind
    • elx_wait_delay: Time to wait between checking whether elastix is done, in seconds
wait_for_elastix(param::Dict, jobid::Int)

This function stalls until the specified job is completed.

Arguments

  • param::Dict: Parameter dictionary including:
    • user: Username on OpenMind
    • server: Login node address on OpenMind
    • elx_wait_delay: Time to wait between checking whether elastix is done, in seconds
  • jobid::Int: Sbatch job ID of the Julia script-submission script
RegistrationGraph.get_squeue_statusFunction
get_squeue_status(param::Dict)

Gets the number of running and pending squeue commands from the given user.

Arguments

  • param::Dict: Parameter dictionary including:
    • user: Username on OpenMind
    • server: Login node address on OpenMind
get_squeue_status(param::Dict, jobid::Int)

Gets the number of running and pending squeue commands from the given user.

Arguments

  • param::Dict: Parameter dictionary including:
    • user: Username on OpenMind
    • server: Login node address on OpenMind
  • jobid::Int: Sbatch job ID of the Julia script-submission script
RegistrationGraph.sync_registered_dataFunction
sync_registered_data(param_path::Dict, param::Dict; reg_dir_key::String="path_dir_reg", reg_om_dir_key::String="path_om_reg")

Deletes unnecessary files, then syncs registration data from a remote compute server back to the local computer.

Arguments

  • param_path::Dict: Dictionary of paths
  • param::Dict: Dictionary of parameters including:
    • user: Username on OpenMind
    • server_dtn: Data transfer node address on OpenMind
  • reg_dir_key::String (optional, default path_dir_reg): Key in param_path to the path to the registration output directory
  • reg_om_dir_key::String (optional, default path_om_reg): Key in param_path to the path to the registration output directory on the server
RegistrationGraph.fix_param_pathsFunction
fix_param_paths(problems, param_path::Dict, param::Dict; reg_dir_key::String="path_dir_reg", n_resolution_key::String="reg_n_resolution")

Updates parameter paths in transform parameter files, to allow transformix to be run on them. Returns a dictionary of errors per problem and resolution.

Arguments

  • problems: Registration problems to update
  • param_path::Dict: Dictionary of paths including:
    • path_root_process: Path to data
    • path_om_data: Path to data on server
  • param::Dict: Dictionary of parameters
  • reg_dir_key::String (optional, default path_dir_reg): Key in param_path to the path to the registration output directory
  • n_resolution_key::String (optional, default reg_n_resolution): Key in param to array of number of registrations with each parameter file