Skip to main content

PyOCT: Imaging processing for coherent imaging

PyOCT is developed to conduct spectral-domain optical coherence tomography (SD-OCT) and digital holography microscopy imaging reconstruction.

OCT imaging reconstruction follows steps as:

  1. Reading Data
  2. Background Subtraction
  3. Spectral Resampling
  4. Comutational Aberration Correction (Alpha-correction)
  5. Camera Dispersion Correction (Beta-correction with camera calibration factors)
  6. Inverse Fourier Transform
  7. Obtain OCT Image

The OCT algorithms was developed initially in Prof. Steven G. Adie research lab at Cornell University using MATLAB. The DHM algorithms were developed in Prof. Peter So lat at MIT. Those codes were created and developed when I worked in Steve and Peter's lab, respectively. The reconstruction speed has been improved with matrix-operation. Compared with MATLAB, Python language have a much better performance in loading data from binary files tested only in our lab computer. Currently, PyOCT only supports python 3.0+.

This is the repository of codes that have been implemented with my own experience in coherent imaging, including optical coherence tomography (OCT) and digital holography microscopy (DHM), data process as well as miscellaneous tools that I used for my daily practice.

The codes are free to use for your own under the MIT license while if you want to publish any methods or algorithms that will be developed based on my codes, please make an inquiry in advance.

The example dataset can be download from OCT Example Dataset.

Quick start

PyOCT can be install using pip:

$pip install PyOCT

If you want to run the latest version of the code, you can install from git:

$python -m pip install -U git+git://github.com/NeversayEverLin/PyOCT.git

After successful installaiton, you can test program under python environment:

$from PyOCT import Test
$test = Test.OCTReconTest() 

To run the OCT imaging reconstruction, you can construct class OCTImagingProcessing() from PyOCTRecon module:

$from PyOCT import PyOCTRecon 
$OCTImage = PyOCTRecon.OCTImagingProcessing()  

Class OCTImagingProcessing require at least 3 positional arguments. All input parameters are:

  • root_dir: required, root directory path where OCT raw data located, ENDING WITHOUT /; e.g., root_dir = 'D:/cuda_practice/OCT_Recon/OCTdata'.
  • sampleID: required, sample data file name. ENDING WITHOUT _raw.bin; e.g., sampleID = 'OCT_100mV_2'.
  • bkgndID: required, background data file name, ending with _raw.bin; e.g., bkgndID = 'bkgnd_512_0_raw.bin'.
  • Sample_sub_path: optional, default as None; sub-directory where OCT raw data located. ENDING WITHOUT /.
  • Bkgnd_sub_path: optional, default as None; sub-directory where OCT bkgnd data located. ENDING WITHOUT /.
  • saveOption: optional, bool, default as False.
  • saveFolder: optional, name for folder to save data; default as None, which will save data in root directory.
  • datatype: optional,"real" or "complex", tell to save data or show data in complex format or single precison (float32) format.
  • verbose: optional, bool, default as True. If True, the data processing will show processing information during each step.
  • frames: optional, int, number of frames to read and process, defaults as 1.
  • alpha2, alpha3: optional, parameters for computational dispersion correction.
  • depths: optional, nuumpy.linspace() created array, depths to be processed, default as: np.linspace(1024,2047,1024), indicating procesing 1024th z-pixel to 2048-pixel.
  • gamma: optional, power factor to do plotting, default as 0.4.
  • wavelength: optional, nominal central wavelength of OCT laser source in unit of nm, default as 1300.
  • XYConversion: optional, 2 elements numpy array, calibration factor for galvo-scanning voltage to scanning field of view in x and y axis at unit of um/V, default as [660,660].
  • camera_matrix: optional, camera dispersion correction factor, numpy array as [c0,c1,c2,c3]; default as np.asarray([1.169980E3,1.310930E-1,-3.823410E-6,-7.178150E-10]) for 1300nm system.
  • start_frame: which frame to start reading and being processed. default is 1, indicating starting from first frame.
  • OptimizingDC: [Required Further Developement] optional, bool, optimizing dispersion correction to search optimized alpha2 and alpha3. default as False.

Class OCTImagingProcessing also provides several accesses/members to imaging processing data:

  • self.root_dir: root directory of data set
  • self.sampleID: sample ID
  • self.bkgndID: background ID
  • self.Settings: parameters of settings of reconstruction
  • self.OCTData: single precision OCT intensity data
  • self.data: complex OCT reconstruction data, only accessible when datatype is not "real".
  • self.InterferencePattern: interference fringes of OCT imaging
  • self.DepthProfile: depth profile (along z-axis) of reconstructed image
  • self.ShowXZ(OCTData): member function to show cross-section.

License

PyOCT is licensed under the terms of the MIT License (see the file LICENSE).

Metadata

Release files for PyOCT 4.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for PyOCT 4.0.0
File Size Uploaded Provenance Actions
pyoct-4.0.0.tar.gz 4.5 kB Without provenance Details for pyoct-4.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for PyOCT 4.0.0
File Interpreter ABI Platform Actions
pyoct-4.0.0-py3-none-any.whl Python 3 none any Details for pyoct-4.0.0-py3-none-any.whl

Total release size: 8.8 kB

Release files / pyoct-4.0.0.tar.gz

Download URL pyoct-4.0.0.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
6dcf8f3cea63ee78e5f9fa2a12e94b5bf44b89c1f6f6d0639c7e58e4e8b168cc
BLAKE2b-256 checksum
How to use checksums
fa679a973b9dc1010f910f1cce20f7cd03c96918c85b5146c677c6cf15600439
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / pyoct-4.0.0-py3-none-any.whl

Download URL pyoct-4.0.0-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8f61f9c0344b8626f15d76cc09eaf0f92e6c29dd63d8856425cfa35842a33220
BLAKE2b-256 checksum
How to use checksums
456c4e110eecbf6afac2564a2a8a40e41a80ba534bd21c02e08f68500c0b42b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Security for PyOCT 4.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

4.0.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page