fastpli.simulation.simpli.Simpli
- class Simpli(mpi_comm=None)[source]
Bases:
fastpli.simulation.__simpli.__Simpli
Simpli Class for simulating 3D-PLI images
Methods
add number of necessary boundary voxel from tilted images
calculates transmittance, direction and retardation
applies optical filters and resampling to image
applies optical resampling to image
calculates tilt analysis for direction, inclination and t_rel and additional fitting parameters
applies optical untilt to image with affine transformation
crop affected boundary pixel from tilted images
get number of affected boundary voxel from tilted images
Generation of discreticesd tissue.
Get all member variables which are properties as dictionary
get volume of interest
returns expected memory ussage
remove number of added boundary voxel from tilted images
Automatized hdf5 saving tissue and simulation pipeline
Generation of discreticesd tissue.
Automatized hdf5 saving simulation pipeline
Automatized hdf5 saving tissue pipeline
Saves class members without fiber_bundles in hdf5 file.
Set dictionary of variables to class members
set volume of interest
Attributes
absorption coefficient of the background
(3)-np.ndarray
(3)-np.ndarray
FiberBundles
[float]
flip light z-direction
birefringence optical axis interpolation True/False
float
noise model to apply on resampled image
get/set number of omp threads
optical_sigma of convolution to applie before resampled image
side length of pixel of resulting optical image in micro meter
step_size of light inside tissue in voxeln
list of spherical tilting angles [[theta, phi], ...] in radiant:
tissue refrection to include in tilting light path calculation
automatic untilting of images
bool
size length of voxel in micro meter
wavelength of light
- apply_epa(data, mask=None)
calculates transmittance, direction and retardation
- Parameters
data (np.ndarray) – images(x,y,rho)
mask (np.ndarray(bool)) – only True elements will be calculated
- Returns
res – transmittance, direction, retardation
- Return type
np.ndarray, np.ndarray, np.ndarray
- apply_optic(data, mp_pool=None)
applies optical filters and resampling to image
- Parameters
data (np.ndarray) – images(x,y,rho)
mp_pool (optional, multiprocessing.Pool)
- Returns
res – images in reduced size and applied noise model
- Return type
np.ndarray
- apply_optic_resample(data, shift=(0, 0), mp_pool=None)
applies optical resampling to image
- Parameters
data (np.ndarray) – images(x,y,rho)
mp_pool (optional, multiprocessing.Pool)
- Returns
res – images in reduced size
- Return type
np.ndarray
- apply_rofl(data, mask=None, mp_pool=None, grad_mode=False)
calculates tilt analysis for direction, inclination and t_rel and additional fitting parameters
- Parameters
data (np.ndarray) – images(x,y,rho)
mask (optional, np.ndarray(bool)) – only True elements will be calculated
mp_pool (optional, multiprocessing.Pool)
grad_mode (optional, bool) – activate gradient method inside rofl algorithm
- Returns
res – (np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray) directionmap, inclmap, trelmap, (dirdevmap, incldevmap, treldevmap, funcmap, itermap)
- Return type
np.ndarray, np.ndarray, np.ndarray,
- apply_untilt(data, theta, phi, mode='nearest')
applies optical untilt to image with affine transformation
- Parameters
data (np.ndarray) – images(x,y,rho)
theta (float) – polar angle
phi (float) – azimuthal angle
mode (str) – method of scipy.interpolate.griddata
- Returns
res – untilted images
- Return type
np.ndarray
- property background_absorption
absorption coefficient of the background
- Parameters
background_absorption (float)
- property dim
(3)-np.ndarray
- Type
dimension of volume in voxel
- property dim_origin
(3)-np.ndarray
- Type
origin of volume in micro meter
- property fiber_bundles
FiberBundles
- Type
get fiber_bundles
- property filter_rotations
[float]
- Type
list of filter rotation position in radiant
- property flip_z_beam
flip light z-direction
- Parameters
flip_z_beam (bool) – True or False
- generate_tissue(only_tissue=False)[source]
Generation of discreticesd tissue.
- Parameters
only_tissue (bool) – generates only first return value
- Returns
res – discreticed tissue, optical axis and tissue_properties
- Return type
np.ndarray, np.ndarray, np.ndarray
- get_dict()
Get all member variables which are properties as dictionary
- get_voi()
get volume of interest
- Returns
res – v_min: [x_min, y_min, z_min] v_max: [x_max, y_max, z_max]
- Return type
np.ndarray, np.ndarray
- property interpolate
birefringence optical axis interpolation True/False
- Returns
res – is the interpolation fo the birefringence optical axis activated
- Return type
bool
- property light_intensity
float
- Type
initial light intensity value in a.u.
- memory_usage(unit='MB', item='all')[source]
returns expected memory ussage
- Parameters
unit (str) – unit in ‘MB’ or ‘GB’
item (list(str)) – ‘all’ or only ‘tissue’
- Returns
res – expected memory ussage
- Return type
str
- property noise_model
noise model to apply on resampled image
- Parameters
fun (function)
- property omp_num_threads
get/set number of omp threads
- property optical_sigma
optical_sigma of convolution to applie before resampled image
- Parameters
optical_sigma (float) – in pixel size
- property pixel_size
side length of pixel of resulting optical image in micro meter
- run_pipeline(h5f=None, script=None, save=('tissue', 'optical_axis', 'data', 'optic', 'epa', 'mask', 'rofl'), crop_tilt=False, mp_pool=None)[source]
Automatized hdf5 saving tissue and simulation pipeline
- Parameters
script (np.ndarray) – save a script in h5f.attrs[‘script’]
save (list(str)) – name of parameters to save
crop_tilt (bool) – crop voxel outside of combined tilting view
mp_pool (multiprocessing.Pool)
- Returns
res – (np.ndarray,np.ndarray, np.ndarray) np.ndarray (tissue, optical_axis, tissue_properties), tilting_stack, (rofl_direction, rofl_incl, rofl_t_rel), fom
- Return type
(np.ndarray, np.ndarray, np.ndarray), np.ndarray,
- run_simulation(tissue, optical_axis, tissue_properties, theta, phi)[source]
Generation of discreticesd tissue.
- Parameters
tissue (np.ndarray) – discretized tissue array
optical_axis (np.ndarray) – discretized tissue array
tissue_properties (np.ndarray) – discretized tissue array
theta (float) – polar angle of tilting
phi (float) – azimuthal angle of tilting
- Returns
images – images of all rotation angles with a pixel size of voxel_size To calculate the optical resolution and noise apply_optics()
- Return type
np.ndarray
- run_simulation_pipeline(tissue, optical_axis, tissue_properties, h5f=None, save=('data', 'optic', 'epa', 'mask', 'rofl'), crop_tilt=False, mp_pool=None)[source]
Automatized hdf5 saving simulation pipeline
- Parameters
tissue (np.ndarray) – discretized tissue array
optical_axis (np.ndarray) – discretized tissue array
tissue_properties (np.ndarray) – discretized tissue array
h5f (hdf5-File)
save (list(str)) – name of parameters to save
crop_tilt (bool) – crop voxel outside of combined tilting view
mp_pool (multiprocessing.Pool)
- Returns
res – discreticed tissue, optical axis and tissue_properties
- Return type
np.ndarray, np.ndarray, np.ndarray
- run_tissue_pipeline(h5f=None, script=None, save=('tissue', 'optical_axis'))[source]
Automatized hdf5 saving tissue pipeline
- Parameters
h5f (hdf5-File)
script (np.ndarray) – save a script in h5f.attrs[‘script’]
save (list(str)) – name of parameters to save
- Returns
res – discreticed tissue, optical axis and tissue_properties
- Return type
np.ndarray, np.ndarray, np.ndarray
- save_parameter_h5(h5f, script=None)
Saves class members without fiber_bundles in hdf5 file.
- set_dict(data)
Set dictionary of variables to class members
- set_voi(v_min, v_max)
set volume of interest
- Parameters
v_min ((float,float,float)-array-like) – [x_min, y_min, z_min]
v_max ((float,float,float)-array-like) – [x_max, y_max, z_max]
- property step_size
step_size of light inside tissue in voxeln
- Parameters
step_size (float) – of light inside tissue in voxeln
- property tilts
list of spherical tilting angles [[theta, phi], …] in radiant:
- Parameters
tilts ([[float, float], …])
- property tissue_refrection
tissue refrection to include in tilting light path calculation
- Parameters
tissue_refrection (float)
- property untilt_sensor_view
automatic untilting of images
- Parameters
untilt_sensor_view (bool) – True or False
- property verbose
bool
- Type
additional information will be printed
- property voxel_size
size length of voxel in micro meter
- property wavelength
wavelength of light
- Parameters
wavelength (float) – in nano meter