foa3d.input

class foa3d.input.CustomFormatter(prog, indent_increment=2, max_help_position=24, width=None)
foa3d.input.get_cli_parser()

Parse command line arguments.

Returns

cli_args – populated namespace of command line arguments

Return type

see ArgumentParser.parse_args

foa3d.input.get_frangi_config(cli_args, in_img)

Get Frangi filter configuration.

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

  • in_img (dict) –

    input image dictionary (extended)

    data: numpy.ndarray or NumPy memory-map object (axis order=(Z,Y,X) or (Z,Y,X,C) or (Z,C,Y,X))

    3D microscopy image

    ts_msk: numpy.ndarray (dtype=bool)

    tissue reconstruction binary mask

    ch_ax: int

    RGB image channel axis (either 1, 3, or None for grayscale images)

    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]

    name: str

    name of the 3D microscopy image

    is_vec: bool

    vector field flag

    shape: numpy.ndarray (shape=(3,), dtype=int)

    total image shape

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

    total image shape [μm]

    item_sz: int

    image item size [B]

Returns

frangi_cfg

Frangi filter configuration

alpha: float

plate-like score sensitivity

beta: float

blob-like score sensitivity

gamma: float

background score sensitivity

scales_px: numpy.ndarray (dtype=float)

Frangi filter scales [px]

scales_um: numpy.ndarray (dtype=float)

Frangi filter scales [μm]

smooth_sd: numpy.ndarray (shape=(3,), dtype=int)

3D standard deviation of the smoothing Gaussian filter [px]

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

pixel size [μm]

fb_thr: float or skimage.filters thresholding method

Frangi filter probability response threshold

bc_ch: int

neuronal bodies channel

fb_ch: int

myelinated fibers channel

msk_bc: bool

if True, mask neuronal bodies within the optionally provided channel

hsv_cmap: bool

generate HSV colormap of 3D fiber orientations

exp_all: bool

export all images

z_out: NumPy slice object

output z-range

Return type

dict

foa3d.input.get_image_info(cli_args)

Get microscopy image file path and format.

Parameters

cli_args (see ArgumentParser.parse_args) – populated namespace of command line arguments

Returns

  • 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

  • msk_mip (bool) – apply tissue reconstruction mask (binarized MIP)

foa3d.input.get_image_size(in_img)

Get information on the size of the input 3D microscopy image.

Parameters

in_img (dict) –

input image dictionary

data: numpy.ndarray or NumPy memory-map object (axis order=(Z,Y,X) or (Z,Y,X,C) or (Z,C,Y,X))

3D microscopy image

ch_ax: int

RGB image channel axis (either 1, 3, or None for grayscale images)

ts_msk: numpy.ndarray (dtype=bool)

tissue reconstruction binary mask

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

Return type

None

foa3d.input.get_resolution(cli_args)

Retrieve microscopy resolution information from command line arguments.

Parameters

cli_args (see ArgumentParser.parse_args) – populated namespace of command line arguments

Returns

  • px_sz (tuple (shape=(3,), dtype=float)) – pixel size [μm]

  • psf_fwhm (tuple (shape=(3,), dtype=float)) – 3D PSF FWHM [μm]

foa3d.input.get_resource_config(cli_args, frangi_cfg)

Retrieve resource usage configuration of the Foa3D tool.

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

  • frangi_cfg (dict) –

    Frangi filter configuration

    alpha: float

    plate-like score sensitivity

    beta: float

    blob-like score sensitivity

    gamma: float

    background score sensitivity

    scales_px: numpy.ndarray (dtype=float)

    Frangi filter scales [px]

    scales_um: numpy.ndarray (dtype=float)

    Frangi filter scales [μm]

    smooth_sd: numpy.ndarray (shape=(3,), dtype=int)

    3D standard deviation of the smoothing Gaussian filter [px]

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

    pixel size [μm]

    bc_ch: int

    neuronal bodies channel

    fb_ch: int

    myelinated fibers channel

    msk_bc: bool

    if True, mask neuronal bodies within the optionally provided channel

    hsv_cmap: bool

    generate HSV colormap of 3D fiber orientations

    exp_all: bool

    export all images

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

    3D image resize ratio

Return type

None

foa3d.input.load_data(in_img, tmp_dir, msk_mip=False)

Load 3D microscopy data.

Parameters
  • 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

  • tmp_dir (str) – path to temporary folder

  • msk_mip (bool) – apply tissue reconstruction mask (binarized MIP)

Return type

None

foa3d.input.load_microscopy_image(cli_args)

Load 3D microscopy image from TIFF, or ZetaStitcher .yml file. Alternatively, the processing pipeline accepts as input TIFF or NumPy files of fiber orientation vector data: in this case, the Frangi filter stage will be skipped.

Parameters

cli_args (see ArgumentParser.parse_args) – populated namespace of command line arguments

Returns

  • in_img (dict) –

    input image dictionary

    data: numpy.ndarray (axis order=(Z,Y,X) or (Z,Y,X,C) or (Z,C,Y,X))

    3D microscopy image

    ch_ax: int

    RGB image channel axis (either 1, 3, or None for grayscale images)

    ts_msk: numpy.ndarray (dtype=bool)

    tissue reconstruction binary mask

    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

    shape: numpy.ndarray (shape=(3,), dtype=int)

    total image shape

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

    total image shape [μm]

    item_sz: int

    image item size [B]

  • save_dirs (dict) – saving directories (‘frangi’: Frangi filter, ‘odf’: ODF analysis, ‘tmp’: temporary files)