MATLAB code for reducing spatial resolution of histopathology images. Image datasets used:
dataset_parameters.m
: returns struct calledparams
containing previously determined parameters of imaging system used to capture publicly available datasets. Takes a single required argument:dataset
- (required) string, one of 'BreaKHis4X', 'BreaKHis10X', 'BreaKHis20X', 'BreaKHis40X', 'BACH', 'CAMELYON16-UMCU', 'CAMELYON16-RUMC', 'PCam'params
struct containsNA_H
(original NA of system),M_obj
(magnification of objective),M_relay
(magnification of any relay used, 1 otherwise,d_pixel
(physical size of camera pixel in metres),f
(focal length of objective),img_ext
(expected extension of image files in dataset),scale_factor
(integer number by which to upscale images if necessary, e.g. for PCam)
NA_estimation.m
: code demonstrating process used to estimate NA_H for all datasets. While this callsdataset_parameters
, it does not use the stored value ofNA_H
for that dataset for computation. It is overlaid on the resulting plot to illustrate how the value was obtained for each dataset. Takes the following arguments:dataset
- (required) string, one of 'BreaKHis4X', 'BreaKHis10X', 'BreaKHis20X', 'BreaKHis40X', 'BACH', 'CAMELYON16-UMCU', 'CAMELYON16-RUMC', 'PCam'cutoff_min
- (optional, default 10) integer, divisor of camera sampling frequencyf_s
to set minimum cutoff frequency forNA_H
estimationshow_estimation
- (optional, defaultfalse
) boolean flag of whether to display images during NA estimation (for debugging)
NA_degradation.m
: script for systematically degrading images in a given dataset according to the degraded NA valueNA_L
based on the system parameters returned bydataset_parameters
. Takes the following arguments:dataset
- (required) string, one of 'BreaKHis4X', 'BreaKHis10X', 'BreaKHis20X', 'BreaKHis40X', 'BACH', 'CAMELYON16-UMCU', 'CAMELYON16-RUMC', 'PCam'NA_L
- (required) positive float, should also be less than NA_H for this script to make sense but this is not currently enforcedsave_images
- (optional, defaulttrue
) boolean flag of whether to save degraded images to disksanity_check
- (optional, defaultfalse
) boolean flag of whether to show PSF/MTF of system to ensure things are sensibleplot_fft
- (optional, defaultfalse
) boolean flag of whether to show image spectra of original/degraded images to ensure things are sensibleQ
- (optional, default 10) integer, quantization/padding factor of pupil field size to ensure FFTs are computed correctly
Tested on Windows 10 using MATLAB R2021a. Requires Image Processing Toolbox to be installed.
To cite this code, please use the following: