File IO API

Basic File Operations

Head Position File IO

ImageDataIO.read_head_posFunction
function read_head_pos(head_path::String)

Reads the worm head position from the file head_path::String. Returns a dictionary mapping frame => head position of the worm at that frame.

Registration File IO

ImageDataIO.load_registration_problemsFunction
load_registration_problems(edge_file_paths::Array{String,1})

Loads a set of registration problems into an array.

Arguments:

  • edge_file_paths::Array{String, 1}: paths containing registration problems
ImageDataIO.modify_parameter_fileFunction
function modify_parameter_file(param_in::String, param_out::String, substitutions::Dict; is_universal=false)

Modifies an elastix transform parameter file.

Arguments

  • param_in::String: Path to parameter file to modify
  • param_out::String: Path to modified parameter file output
  • substitutions::Dict: Dictionary of substitutions. For each key in substitutions, if it is a key in the parameter file, replace its value with the value in substitutions.
  • is_universal::Bool (optional): If set to true, instead find/replace all instances of keys in substitutions regardless of if it is a key in the parameter file
ImageDataIO.read_parameter_fileFunction
read_parameter_file(parameter_file_path::String, key::String, dtype::Type)

Reads a value from a paremeter file.

Arguments

  • parameter_fiile_path::String: Path to parameter file
  • key::String: Value to read
  • dtype::Type: Type of the value or elements of value (if it's an array)

NRRD File IO

ImageDataIO.read_nrrdFunction
read_nrrd(rootpath, img_prefix, nrrd_path, frame, channel)

Reads NRRD file from $(rootpath)/$(nrrd_path)/$(img_prefix)_t$(channel).nrrd and outputs resulting image.

Activity IO

Centroids File IO

UNet IO

ImageDataIO.load_training_setFunction
load_training_set(h5_file::String)

Loads training (or validation dataset) in 3D dataset h5_file::String. Returns raw, label, and weight fields.

ImageDataIO.load_predictionsFunction
load_predictions(h5_file::String; threshold=nothing)

Loads UNet predictions in 3D dataset h5_file::String. If the file has a fourth dimension, assumes predictions are stored in its second entry. Returns the portion of predictions field corresponding to foreground. Can optionally set threshold to binarize predictions.

ImageDataIO.resample_imgFunction

resample_img(img, scales; dtype="raw")

Scales an image down by using linear interpolation for the raw image, and bkg-gap priority interpoalation for the labels.

Arguments

  • img: image to scale
  • scales: array of factors to scale down (bin) by in each dimension. Must be positive.

Optional keyword arguments

  • dtype::String: type of data - either "raw", "label", or "weight". Default raw.