foa3d.output

foa3d.output.create_save_dirs(cli_args, in_img)

Create saving directory.

Parameters
  • cli_args (see ArgumentParser.parse_args) – updated namespace of command line arguments

  • in_img (dict) –

    input image dictionary
    fb_ch: int

    neuronal fibers channel

    bc_ch: int

    brain cell soma channel

    msk_bc: bool

    if True, mask neuronal bodies within the optionally provided channel

    psf_fwhm: numpy.ndarray (shape=(3,), dtype=float)

    3D FWHM of the PSF [μm]

    px_sz: numpy.ndarray (shape=(3,), dtype=float)

    pixel size [μm]

    path: str

    path to the 3D microscopy image

    name: str

    name of the 3D microscopy image

    fmt: str

    format of the 3D microscopy image

    is_tiled: bool

    True for tiled reconstructions aligned using ZetaStitcher

    is_vec: bool

    vector field flag

Returns

save_dirs

saving directories

frangi: Frangi filter

odf: ODF analysis

tmp: temporary data

Return type

dict

foa3d.output.save_array(fname, save_dir, nd_array, px_sz=None, fmt='tiff', ram=None)

Save array to file.

Parameters
  • fname (string) – output filename

  • save_dir (string) – saving directory string path

  • nd_array (NumPy memory-map object or HDF5 dataset) – data

  • px_sz (tuple) – pixel size (Z,Y,X) [um]

  • fmt (str) – output format

  • ram (float) – maximum RAM available

Return type

None

foa3d.output.save_frangi_arrays(save_dir, img_name, out_img, ram=None)

Save the output arrays of the Frangi filter stage to TIF files.

Parameters
  • save_dir (str) – saving directory string path

  • img_name (str) – name of the input microscopy image

  • out_img (dict) –

    fbr_vec: NumPy memory-map object (axis order=(Z,Y,X,C), dtype=float32)

    fiber orientation vector field

    fbr_vec_clr: NumPy memory-map object (axis order=(Z,Y,X,C), dtype=uint8)

    orientation colormap image

    fa_img: NumPy memory-map object (axis order=(Z,Y,X), dtype=uint8)

    fractional anisotropy image

    frangi_img: NumPy memory-map object (axis order=(Z,Y,X), dtype=uint8)

    Frangi-enhanced image (fiber probability)

    iso_fbr: NumPy memory-map object (axis order=(Z,Y,X), dtype=uint8)

    isotropic fiber image

    fbr_msk: NumPy memory-map object (axis order=(Z,Y,X), dtype=uint8)

    fiber mask image

    bc_msk: NumPy memory-map object (axis order=(Z,Y,X), dtype=uint8)

    neuron mask image

    px_sz: numpy.ndarray (shape=(3,), dtype=float)

    pixel size (Z,Y,X) [μm]

  • ram (float) – maximum RAM available

Return type

None

foa3d.output.save_odf_arrays(save_dir, img_name, odf_scale_um, px_sz, odf, bg, fbr_dnst, odi_pri, odi_sec, odi_tot, odi_anis)

Save the output arrays of the ODF analysis stage to TIF and Nifti files. Arrays tagged with ‘mrtrixview’ are preliminarily transformed so that ODF maps viewed in MRtrix3 are spatially consistent with the analyzed microscopy volume, and the output TIF files.

Parameters
  • save_dir (str) – saving directory string path

  • img_name (str) – name of the 3D microscopy image

  • odf_scale_um (float) – fiber ODF resolution (super-voxel side [μm])

  • px_sz (numpy.ndarray (shape=(3,), dtype=float)) – pixel size (Z,Y,X) [μm]

  • odf (NumPy memory-map object (axis order=(X,Y,Z,C), dtype=float32)) – ODF spherical harmonics coefficients

  • bg (NumPy memory-map object (axis order=(X,Y,Z), dtype=uint8)) – background for ODF visualization in MRtrix3

  • fbr_dnst (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – fiber orientation density [1/μm³]

  • odi_pri (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – primary orientation dispersion parameter

  • odi_sec (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – secondary orientation dispersion parameter

  • odi_tot (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – total orientation dispersion parameter

  • odi_anis (NumPy memory-map object (axis order=(Z,Y,X), dtype=float32)) – orientation dispersion anisotropy parameter

Return type

None