Skip to content

utils

linc_convert.modalities.psoct._utils

make_json

make_json(oct_meta)

Make json from OCT metadata.

Expected input:

Image medium: 60% TDE Center Wavelength: 1294.84nm Axial resolution: 4.9um Lateral resolution: 4.92um FOV: 3x3mm Voxel size: 3x3x3um Depth focus range: 225um Number of focuses: 2 Focus #: 2 Slice thickness: 450um. Number of slices: 75 Slice #:23 Modality: dBI

struct_arr_to_dict

struct_arr_to_dict(arr)

Convert a NumPy structured array (single record) to a dictionary.

Returns:

Type Description
dict: Dictionary mapping field names to their values.

find_experiment_params

find_experiment_params(exp_file)

Load experiment parameters from a .mat file, detecting if it's a Fiji experiment.

Returns:

Type Description
tuple:
  • dict: Experiment parameters.
  • bool: True if it's a Fiji experiment, False otherwise.

Raises:

Type Description
ValueError: If no experiment key is found in the file.

mat_vars

mat_vars(mat_file)

Yield variable names from a .mat file, excluding internal variables.

Yields:

Type Description
str: Variable names not starting with '__'.

atleast_2d_trailing

atleast_2d_trailing(arr)

Ensure the input is at least 2D by adding a new axis at the end if needed.

If the input is 1D, it becomes shape (N, 1). If the input is 0D (scalar), it becomes shape (1, 1). If it's already 2D or more, it's returned unchanged.

Returns:

Type Description
np.ndarray: A 2D or higher NumPy array with at least two dimensions.