linumpy.io.thorlabs#

ThorOCT module for handling OCT data from ThorLabs PSOCT microscopes.

Classes#

PreprocessingConfig

Configuration for preprocessing OCT data.

ThorOCT

Handle OCT data from ThorLabs PSOCT microscopes.

Module Contents#

class linumpy.io.thorlabs.PreprocessingConfig[source]#

Configuration for preprocessing OCT data.

Variables:
  • (bool) (return_complex) – If True, return the raw complex data. If False, return its magnitude instead.

  • default=320) (crop_first_index (int,) – Index along the first dimension (depth) at which to start cropping.

  • default=750) (crop_second_index (int,) – Index along the first dimension (depth) at which to end cropping.

  • default=True) (erase_polarization_2 (bool,) – If True, discard the original raw data array after extracting the complex data.

  • default=False) (erase_polarization_1 (bool,) – If True, do not keep polarization-1 data in memory.

  • default=True) – If True, do not keep polarization-2 data in memory.

return_complex: bool[source]#
crop_first_index: int = 320[source]#
crop_second_index: int = 750[source]#
erase_raw_data: bool = True[source]#
erase_polarization_1: bool = False[source]#
erase_polarization_2: bool = True[source]#
class linumpy.io.thorlabs.ThorOCT(path=None, compressed_data=None, config=None)[source]#

Handle OCT data from ThorLabs PSOCT microscopes.

Provides methods to load, process, and extract metadata and data from compressed files.

Parameters:
Variables:
path = None[source]#
compressed_data[source]#
first_polarization: numpy.ndarray | None = None[source]#
second_polarization: numpy.ndarray | None = None[source]#
size_x = None[source]#
size_y = None[source]#
size_z = None[source]#
header = None[source]#
resolution = [][source]#
ascan_averaging_value = None[source]#
config = None[source]#
load()[source]#

Load the data from the compressed file and extract the header and the complex data.

Raises:

ValueError – If no valid data source is provided.:

Return type:

None

load_and_process(file)[source]#

Load raw data from the file and preprocess it.

Parameters:

file (str) – File path in the compressed data.

Returns:

Fully processed data array.

Return type:

np.ndarray

static extract_positions_from_scan(scan_file_path=None)[source]#

Extract the raw and index x, y positions from the .scan file.

Parameters:

scan_file_path (str or None) – Path to the .scan file.

Returns:

- tuple

Return type:

A tuple containing two lists - index positions and raw positions.

static get_psoct_tiles_ids(tiles_directory, number_of_angles=2)[source]#

Get the .scan file and all .oct files from the tiles_directory.

Parameters:
  • tiles_directory (str) – Path to the directory containing the OCT tiles.

  • number_of_angles (int) – Number of acquisition angles.

Returns:

  • - positions (positions of the tiles in 3d)

  • - grouped_files (list of file paths ordered by angles.)

Raises:

- ValueError – If the directory or required files are missing.:

Return type:

tuple

static orient_volume_psoct(vol)[source]#

Transform the volume to RAS orientation.

Parameters:

vol (numpy.ndarray)

Return type:

numpy.ndarray