linumpy.io.thorlabs#
ThorOCT module for handling OCT data from ThorLabs PSOCT microscopes.
Classes#
Configuration for preprocessing OCT data. |
|
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.
- 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:
(str) (path)
(zipfile.ZipFile) (compressed_data)
(PreprocessingConfig) (config)
path (pathlib.Path | None)
compressed_data (zipfile.ZipFile | None)
config (PreprocessingConfig | None)
- Variables:
(np.ndarray) (second_polarization)
(np.ndarray)
(int) (ascan_averaging_value)
(int)
(int)
(xml.dom.minidom.Document) (header)
(list) (resolution)
(int)
- first_polarization: numpy.ndarray | None = None[source]#
- second_polarization: numpy.ndarray | None = 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:
- 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:
- static orient_volume_psoct(vol)[source]#
Transform the volume to RAS orientation.
- Parameters:
vol (numpy.ndarray)
- Return type: