rmlseg package¶
Submodules¶
rmlseg.rmlseg module¶
Main module, where all the main functions can be found.
@author: Henri DER SARKISSIAN, Nicola VIGANÒ
-
rmlseg.rmlseg.
denoise
(img, iterations=50, lambda_tv=0.01, lambda_smooth=0.01, img_max=255.0, data_type=<class 'numpy.float32'>)[source]¶ This function denoises the input image, based on the given TV and smoothnes constraint weights.
It returns a denoised image.
- Parameters
img – The image (np.array_like)
iterations – Number of iterations (int)
lambda_tv – Weight of the TV regularization (float, default: 1e-2)
lambda_smooth – Weight of the smoothing regularization (float, default: 1e-2)
img_max – renormalization value (float, default: 255.0)
data_type – Expected data type (np.dtype, default: np.float32)
- Returns
a denoised image
- Return type
np.array_like
-
rmlseg.rmlseg.
estimate_rhos
(p, projs, img, rhos0=None, iterations=100, dataterm_norm_p=1)[source]¶ This function estimates the levelset values from the current segmentation and the available projections.
It returns the etimated rhos.
- Parameters
p – Projector from tomo module
projs – The object projections (np.array_like)
img – The segmented image (np.array_like)
rhos0 – Initial estimation of the rhos (np.array_like, default: None)
iterations – Number of iterations (int)
dataterm_norm_p – l_p norm of the data term (int, default: 1)
- Returns
estimated rhos
- Return type
np.array_like
-
rmlseg.rmlseg.
refine_rre
(img, rhos, local_rre, iterations=50, lambda_tv=1.0, weight_norm_p=1, dataterm_norm_p=1, data_type=<class 'numpy.float32'>)[source]¶ This function computes the refinement of the segmented image, based on the given locally reconstructed residual.
It returns the refined image.
- Parameters
img – The image (np.array_like)
rhos – Expected levels (np.array_like)
local_rre – Locally reconstructed residual error (np.array_like)
iterations – Number of iterations (int)
lambda_tv – Weight of the TV regularization (float, default: 1.0)
weight_norm_p – l_p norm of the weights (int, default: 1)
dataterm_norm_p – l_p norm of the data term (int, default: 1)
data_type – Expected data type (np.dtype, default: np.float32)
- Returns
a refined regularized image
- Return type
np.array_like
-
rmlseg.rmlseg.
regularize_levelsets
(img, rhos, iterations=50, lambda_tv=0.1, lambda_smooth=None, weight_norm_p=2, dataterm_norm_p=1, lower_limit=None, upper_limit=None, data_type=<class 'numpy.float32'>)[source]¶ This function computes the regularization of the input image, based on the given expected level values and regularization weights.
It returns the regularized image.
- Parameters
img – The image (np.array_like)
rhos – Expected levels (np.array_like)
iterations – Number of iterations (int)
lambda_tv – Weight of the TV regularization (float, default: 1e-1)
lambda_smooth – Weight of the smoothing regularization (float, default: None)
weight_norm_p – l_p norm of the weights (int, default: 2)
dataterm_norm_p – l_p norm of the data term (int, default: 1)
lower_limit – Lower limit of the image, used for clipping (float, default: None)
upper_limit – Upper limit of the image, used for clipping (float, default: None)
data_type – Expected data type (np.dtype, default: np.float32)
- Returns
a regularized image
- Return type
np.array_like
-
rmlseg.rmlseg.
segment_levelset
(img, rhos, *args, **kwds)[source]¶ This function computes the simple segmentation of the input image, based on the given expected level values and regularization weights.
It returns the segmented image.
- Parameters
img – The image (np.array_like)
rhos – Expected levels (np.array_like)
iterations – Number of iterations (int)
lambda_tv – Weight of the TV regularization (float, default: 1e-2)
lambda_smooth – Weight of the smoothing regularization (float, default: None)
weight_norm_p – l_p norm of the weights (int, default: 2)
dataterm_norm_p – l_p norm of the data term (int, default: 1)
lower_limit – Lower limit of the image, used for clipping (float, default: None)
upper_limit – Upper limit of the image, used for clipping (float, default: None)
- Returns
a segmented image
- Return type
np.array_like
-
rmlseg.rmlseg.
segment_simple
(img, rhos)[source]¶ This function computes the simple segmentation of the input image, based on the given expected level values.
It returns the regularized image.
- Parameters
img – The image (np.array_like)
rhos – Expected levels (np.array_like)
- Returns
The segmented image
- Return type
np.array_like
rmlseg.tomo module¶
Basic tomography operations, including a projector class.
@author: Nicola VIGANÒ
rmlseg.util module¶
Utility functions for the use of the package functionality.
@author: Nicola VIGANÒ
-
rmlseg.util.
estimate_local_rre
(seg_vol, rhos, projs, angles)[source]¶ This function estimates the local Reconstructed Residual Error (RRE) for the given segmentation.
- Parameters
seg_vol – The segmentation (np.array_like)
rhos – The segmentation target levels (np.array_like)
projs – The projection data (np.array_like)
angles – Corresponding angles of the projections (np.array_like)
- Returns
The corresponding RRE
- Return type
np.array_like
-
rmlseg.util.
reconstruct_simple_2D
(rec_vol_shape, projs, angles)[source]¶ This function computes a simple FBP reconstruction of the projections from the given projection data and corresponding angles, for the given recontruction shape.
- Parameters
rec_vol_shape – The output reconstruction shape (np.array_like)
projs – The projection data (np.array_like)
angles – Corresponding angles of the projections (np.array_like)
- Returns
The reconstructed image
- Return type
np.array_like
-
rmlseg.util.
refine_rre
(seg_vol, rhos, rre)[source]¶ This function refines the segmentation using the RRE.
- Parameters
seg_vol – The segmentation (np.array_like)
rhos – The segmentation target levels (np.array_like)
rre – The pixel-wise RRE (np.array_like)
- Returns
The segmented image
- Return type
np.array_like
-
rmlseg.util.
segment_denoise
(rec_vol, rhos)[source]¶ This function computes the segmentation of the denoised image.
- Parameters
rec_vol – The reconstruction (np.array_like)
rhos – The segmentation target levels (np.array_like)
- Returns
The segmented image
- Return type
np.array_like
-
rmlseg.util.
segment_levelset
(rec_vol, rhos)[source]¶ This function computes the segmentation of the relaxed levelset based regularization.
- Parameters
rec_vol – The reconstruction (np.array_like)
rhos – The segmentation target levels (np.array_like)
- Returns
The segmented image
- Return type
np.array_like
Module contents¶
Top-level package for PyRMLSeg.