File IO API
Basic File Operations
ImageDataIO.back_one_dir — Functionback_one_dir(dir)Given a directory as input, outputs the parent directory.
ImageDataIO.get_filename — Functionget_filename(path_to_file)Given path to a file, outputs the filename.
Head Position File IO
ImageDataIO.read_head_pos — Functionfunction 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_problems — Functionload_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_file — Functionfunction 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 modifyparam_out::String: Path to modified parameter file outputsubstitutions::Dict: Dictionary of substitutions. For each key insubstitutions, if it is a key in the parameter file, replace its value with the value insubstitutions.is_universal::Bool(optional): If set to true, instead find/replace all instances of keys insubstitutionsregardless of if it is a key in the parameter file
ImageDataIO.read_parameter_file — Functionread_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 filekey::String: Value to readdtype::Type: Type of the value or elements of value (if it's an array)
NRRD File IO
ImageDataIO.read_nrrd — Functionread_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
ImageDataIO.read_activity — Functionread_activity(input)Reads ROI activities from input.
ImageDataIO.write_activity — Functionwrite_activity(activity, out)Writes list of ROI activities activity to output file out.
Centroids File IO
ImageDataIO.write_centroids — Functionwrite_centroids(centroids, out)Writes centroids to transformix-compatible file out
ImageDataIO.read_centroids_transformix — Functionread_centroids_transformix(input)Reads centroids from transformix output file input
ImageDataIO.read_centroids_roi — Functionread_centroids_roi(input)Reads centroids from write_centroids output file input
UNet IO
ImageDataIO.load_training_set — Functionload_training_set(h5_file::String)Loads training (or validation dataset) in 3D dataset h5_file::String. Returns raw, label, and weight fields.
ImageDataIO.load_predictions — Functionload_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_img — Functionresample_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 scalescales: 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.