nabu.stitching.overlap module

class nabu.stitching.overlap.OverlapStitchingStrategy(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

MEAN = 'mean'
COSINUS_WEIGHTS = 'cosinus weights'
LINEAR_WEIGHTS = 'linear weights'
CLOSEST = 'closest'
IMAGE_MINIMUM_DIVERGENCE = 'image minimum divergence'
HIGHER_SIGNAL = 'higher signal'
class nabu.stitching.overlap.OverlapKernelBase[source]

Bases: object

class nabu.stitching.overlap.ZStichOverlapKernel(frame_width: int, stitching_strategy: OverlapStitchingStrategy = OverlapStitchingStrategy.COSINUS_WEIGHTS, overlap_size: int = None, extra_params: dict | None = None)[source]

Bases: OverlapKernelBase

class used to define overlap between two scans and create stitch between frames (stitch function)

DEFAULT_HIGH_FREQUENCY_THRESHOLD = 2
property overlap_size: int
property img_2: ndarray
property weights_img_1: ndarray | None
property weights_img_2: ndarray | None
property stitching_strategy: OverlapStitchingStrategy
compute_weights()[source]
stitch(img_1, img_2, check_input=True) tuple[source]

Compute overlap region from the defined strategy

nabu.stitching.overlap.compute_image_minimum_divergence(img_1: ndarray, img_2: ndarray, high_frequency_threshold)[source]

Algorithm to improve treatment of high frequency.

It split the two images into two parts: high frequency and low frequency.

The two low frequency part will be stitched using a ‘sinusoidal’ / cosinus weights approach. When the two high frequency parts will be stitched by taking the lower divergent pixels

nabu.stitching.overlap.compute_image_higher_signal(img_1: ndarray, img_2: ndarray)[source]

the higher signal will pick pixel on the image having the higher signal. A use case is that if there is some artefacts on images which creates stripes (from scintillator artefacts for example) it could be removed from this method

nabu.stitching.overlap.check_overlaps(frames: tuple | ndarray, positions: tuple, axis: int, raise_error: bool)[source]

check over frames if there is a single overlap other juxtaposed frames (at most and at least)

Parameters:
  • frames – liste of ordered / sorted frames along axis to test (from higher to lower)

  • positions – positions of frames in 3D space as (position axis 0, position axis 1, position axis 2)

  • axis – axis to check

  • raise_error – if True then raise an error if two frames don’t have at least and at most one overlap. Else log an error