Data Visualization API
RegistrationGraph.make_diff_pngs — Functionmake_diff_pngs(param_path::Dict, param::Dict, get_basename::Function,
fixed::Integer, moving::Integer; proj_dim::Integer=3,
fixed_ch_key::String="ch_marker", regdir_key::String="path_dir_reg",
nrrd_key="path_dir_nrrd_filt", result::Union{Nothing,String}=nothing,
contrast_f::Real=1, contrast_m::Real=1, swap_colors::Bool=false
)Makes PNG files to visualize how well the registration worked, by overlaying fixed and moving images. The fixed image will be red and the moving image will be green, so yellow indicates good registration.
Arguments
param_path::Dict: Dictionary containing paths to filesparam::Dict: Dictionary containing parameter settingreg_n_resolution, an array of registration resolutions for each parameter file (eg for affine regstration with 3 resolutions and bspline registration with 4 resolutions, this would be[3,4])get_basename::Function: Function mapping two timepoints to the base NRRD filename corresponding to them.fixed::Integer: timestamp (frame number) of fixed imagemoving::Integer: timestamp (frame number) of moving image
Optional keyword arguments
proj_dim::Integer: Dimension to project data. Default 3 (z-dimension)fixed_ch_key::Integer: Key inparamto channel for the fixed image. Defaultch_marker. (The moving image is the image automatically generated from the registration.)regdir_key::String: Key inparam_pathcorresponding to the registration directory. Defaultpath_dir_reg.nrrd_key::String: Key inparam_pathcorresponding to the NRRD directory. Defaultpath_dir_nrrd_filt.result::String: Name of resulting file. If left as default it the same as the corresponding NRRD file.contrast_f::Real: Contrast of fixed image portion of PNG. Default 1.contrast_m::Real: Contrast of moving image portion of PNG. Default 1.swap_colors::Bool: If set totrue, fixed image will be green and moving image will be red.
RegistrationGraph.make_diff_pngs_base — Functionmake_diff_pngs_base(
param_path::Dict, param::Dict, get_basename::Function,
fixed::Integer, moving::Integer; proj_dim::Integer=3,
regdir_key::String="path_dir_reg", nrrd_key="path_dir_nrrd_filt",
moving_ch_key::String="ch_marker", fixed_ch_key::String="ch_marker",
contrast_f::Real=1, contrast_m::Real=1, swap_colors::Bool=false, png_name="noreg.png"
)Makes PNG files before registration, directly comparing two frames. The fixed image will be red and the moving image will be green, so yellow indicates good registration.
Arguments
param_path::Dict: Dictionary containing paths to filesparam::Dict: Dictionary containing parameter settingsget_basename::Function: Function mapping two timepoints to the base NRRD filename corresponding to them.fixed::Integer: timestamp (frame number) of fixed imagemoving::Integer: timestamp (frame number) of moving image
Optional keyword arguments
proj_dim::Integer: Dimension to project data. Default 3 (z-dimension)regdir_key::String: Key inparam_pathcorresponding to the registration directory. Defaultpath_dir_reg.nrrd_key::String: Key inparam_pathcorresponding to the NRRD directory. Defaultpath_dir_nrrd_filt.moving_ch_key::Integer: Key inparamcorresponding to channel for the moving image. Defaultch_marker.fixed_ch_key::Integer: Key inparamcorresponding to channel for the fixed image. Defaultch_marker.contrast_f::Real: Contrast of fixed image portion of PNG. Default 1.contrast_m::Real: Contrast of moving image portion of PNG. Default 1.swap_colors::Bool: If set totrue, fixed image will be green and moving image will be red.png_name::String: Name of output file. Defaultnoreg.png
RegistrationGraph.nrrd_to_png — Functionnrrd_to_png(nrrd_path, png_path; proj_dim=3)Converts an nrrd file at nrrd_path::String into a PNG file, saved to path png_path::String, using maximum intensity projection. The optional argument proj_dim (default 3) can be changed to project in a different dimension.
RegistrationGraph.visualize_roi_predictions — Functionvisualize_roi_predictions(
img_roi, img_roi_regmap, img, img_regmap;
color_brightness::Real=0.3, plot_size=(600,600), roi_match=Dict(), unmatched_color=nothing,
make_rgb=false, highlight_rois=[], highlight_regmap_rois=[], highlight_color=RGB.(0,0,1),
contrast::Real=2, semantic::Bool=false, z_offset::Integer=0
)Visualizes a comparison between an ROI image and a registration-mapped version.
Arguments
img_roi: ROI image in the fixed frameimg_roi_regmap: moving frame ROI image registration-mapped to the fixed frameimg: raw image in the fixed frameimg_regmap: raw image in the moving frame
Optional keyword arguments
color_brightness::Real: brightness of ROI colors. Default 0.3.plot_size: size of plot. Default (600, 600)roi_match: matches between ROIs in the two frames, as a dictionary whose keys are ROIs in the moving frame and whose values are the corresponding ROIs in the fixed frame.unmatched_color: If set, all ROIs in the moving frame without a corresponding match in the fixed frame will be this color.make_rgb: If set, will generate red vs green display of ROI locations.highlight_rois: A list of ROIs in the fixed frame to be highlighted.highlight_regmap_rois: A list of ROIs in the moving frame to be highlighted.highlight_color: Highlight color, as an RGB. Default blue, akaRGB.(0,0,1)contrast::Real: Contrast of raw images. Default 2.semantic::Bool: If set to true,img_regmapshould instead be a semantic segmentation of the fixed frame image. Default false.z_offset::Integer: z-offset of the moving image relative to the fixed image; the moving image will be shifted towards z=0 by this amount.
RegistrationGraph.view_roi_regmap — Functionview_roi_regmap(img_roi, img_roi_regmap; color_brightness::Real=0.3, plot_size=(600,600))Plots instance segmentation image and registration-mapped instance segmentation on the same plot, where each object is given a different color, the original image is shades of red, and the registration-mapped image is shades of green.
Arguments
img_roi: 3D instance segmentation imageimg_roi_regmap: 3D instance segmentation image from another frame, mapped via registration.
Optional keyword arguments
color_brightness::Real: minimum RGB value (out of 1) that an object will be plotted with. Default 0.3plot_size: size of the plot. Default (600,600)
RegistrationGraph.gen_regmap_rgb — Functiongen_regmap_rgb(img_roi, img_roi_regmap; color_brightness::Real=1)Generates a colormap that encodes the difference between the ROI image and the registration-mapped version using shades of red and green.
Arguments
img_roi: ROI image in the fixed frameimg_roi_regmap: moving frame ROI image registration-mapped to the fixed frame
Optional keyword arguments
color_brightness::Real: maximum brightness of ROIs. Default 1.
RegistrationGraph.make_rgb_arr — Functionmake_rgb_arr(red, green, blue)Makes a PyPlot-compatible RGB array out of red, green, and blue channels.
RegistrationGraph.plot_centroid_match — Functionplot_centroid_match(fixed_img, matches, centroids_actual, centroids_inferred)Plots fixed, and inferred moving, centroids over the fixed worm image. Additionally, draws lines between matched centroids.
Arguments
fixed_image: fixed image of the worm (2D)matches: List of pairs of centroids (which are tuples of (x,y) coordinates) that match.centroids_actual: centroids determined directly from the fixed imagecentroids_inferred: centroids determined from the moving image, and then mapped onto the fixed image via registration.