API

API

nd2read.jl

ND2Process.nd2dimFunction.
nd2dim(path_nd2)

Returns dim of the file in (x, y, z, t, c)

Arguments

  • path_nd2: .nd2 file to read
  • verbose: if true, print out the dimensions
source
ND2Process.nd2readFunction.
nd2read(path_nd2; ch=1, t=1)

Read the image at ch and t

Arguments

  • path_nd2: .nd2 file to read
  • ch: ch to read. First ch: 1
  • t: time point to read. Can be multiple. First t: 1
source
ND2Process.nd2previewFunction.
nd2preview(path_nd2; ch=1, return_data=false, z_crop=nothing)

Preview MIP of first, middle, and last time points in the .nd2 file

Arguments

  • path_nd2: .nd2 file to read
  • ch: ch to use. Default: 1 (first ch)
  • return_data: if true returns the 3 images as array
  • z_crop: selecting z range to use. e.g. 3:15 then only use slice 3 to 15
source
nd2preview_crop(stack::Array; θ, x_crop=nothing, y_crop=nothing,
    z_crop=nothing)

Preview MIP of rotatation and x, y, z cropping

Arguments

  • stack: array (e.g. returned from nd2preview with return_data=true)

containing 3 stacks

  • θ: yaw angle (lateral rotation)
  • x_crop: range of x to use
  • y_crop: range of y to use
  • z_crop: range of z to use
source

nd2convert.jl

ND2Process.nd2_to_mhdFunction.
nd2_to_mhd(path_nd2, path_save,
    spacing_lat, spacing_axi, generate_MIP::Bool;
    θ=nothing, x_crop::Union{Nothing, UnitRange{Int64}}=nothing,
    y_crop::Union{Nothing, UnitRange{Int64}}=nothing,
    z_crop::Union{Nothing, UnitRange{Int64}}=nothing, chs::Array{Int}=[1],
    MHD_dir_name="MHD", MIP_dir_name="MIP")

Saves nd2 into MHD files after rotating and cropping. Rotation is skipped if θ is set to nothing.

Arguments

  • path_nd2: path of .nd2 file to use
  • path_save: path of .h5 file to save
  • spacing_lat: lateral spacing (for logging)
  • spacing_axi: axial spacing (for logging)
  • generate_MIP: if true, save MIP in as preview
  • θ: yaw angle (lateral rotation, radian). nothing if no rotation
  • x_crop: x range to use. Full range if nothing
  • y_crop: y range to use. Full range if nothing
  • z_crop: z range to use. Full range if nothing
  • chs: ch to use
  • MHD_dir_name: name of the subfolder to save MHD files
  • MIP_dir_name: name of the subfolder to save MIP files
source
ND2Process.nd2_to_h5Function.
nd2_to_h5(path_nd2, path_save, spacing_lat, spacing_axi; θ=nothing,
    x_crop::Union{Nothing, UnitRange{Int64}}=nothing,
    y_crop::Union{Nothing, UnitRange{Int64}}=nothing,
    z_crop::Union{Nothing, UnitRange{Int64}}=nothing, chs::Array{Int}=[1])

Saves nd2 into HDF5 file after rotating and cropping. Rotation is skipped if θ is set to nothing. Note: indexing is 1 based. Array axis is in the following order: [x, y, z, t, c]. HDF5 file is chunked with: (x size, y size, z size, 1, 1, 1)

Arguments

  • path_nd2: path of .nd2 file to use
  • path_save: path of .h5 file to save
  • spacing_lat: lateral spacing (for logging)
  • spacing_axi: axial spacing (for logging)
  • θ: yaw angle (lateral rotation, rauab). nothing if no rotation
  • x_crop: x range to use. Full range if nothing
  • y_crop: y range to use. Full range if nothing
  • z_crop: z range to use. Full range if nothing
  • chs: ch to use
source