nabu.pipeline.helical.span_strategy module

class nabu.pipeline.helical.span_strategy.SpanStrategy(z_pix_per_proj, x_pix_per_proj, detector_shape_vh, phase_margin_pix, projection_angles_deg, require_redundancy=False, pixel_size_mm=0.1, z_offset_mm=0.0, logger=None, angular_tolerance_steps=0.0)[source]

Bases: object

This class does all the accounting for the reconstructible slices, giving for each one the list of the useful angles, of the vertical and horizontal shifts,and more …

Parameters:
  • z_pix_per_proj (array of floats) – an array of floats with one entry per projection, in pixel units. The values are the vertical displacements of the detector. An decreasing z means that the rotation axis is following the positive direction of the detector vertical axis, which is pointing toward the ground. In the experimental setup, the vertical detector axis is pointing toward the ground. Moreover the values are offsetted so that the first value is zero. The offset value, in millimiters is z_offset_mm and it is the vertical position of the sample stage relatively to the center of the detector. A negative z_offset_mm means that the sample stage is below the detector for the first projection, and this is almost always the case, because the sample is above the sample stage. A z_pix=0 value indicates that the translation-rotation stage “ground” is exactly at the beam height ( supposed to be near the central line of the detector) plus z_offset_mm. A positive z_pix means that the translation stage has been lowered, compared to the first projection, in order to scan higher parts of the sample. ( the sample is above the translation-rotation stage).

  • x_pix_per_proj (array of floats) –

    one entry per projection. The horizontal displacement of the detector respect to the rotation axis. A positive x means that the sample shadow on the detector is moving toward the left of the detector.

    (the detector is going right)

  • detector_shape_vh (a tuple of two ints) – the vertical and horizontal dimensions

  • phase_margin_pix (int) – the maximum margin needed for the different kernels (phase, unsharp..) otherwhere in the pipeline

  • projection_angles_deg (array of floats) – per each projection the rotation angle of the sample in degree.

  • require_redundancy (bool, optional, defaults to False) – It can be set to True, when there are dead zones in the detector. In this case the minimal required angular span is increased from 360 to 2*360 in order to enforce the necessary redundancy, which allows the correction of the dead zones. The lines which do not satisfy this requirement are not doable.

  • z_offset_mm (float) – the vertical position of the sample stage relatively to the center of the detector. A negative z_offset_mm means that the sample stage is below the detector for the first projection, and this is almost always the case, because the sample is above the sample stage.

  • pixel_size_mm (float, the pixel size in millimiters) – this value is used to give results in units of “ millimeters above the sample stage” Althougth internally all is calculated in pixel units, it is useful to incorporate such information in the spanstrategy object which will then be able to setup reconstruction informations according to several request formats: be they in sequential number of reconstructible slices, or millimeters above the stage.

  • angular_tolerance_steps (float, defaults to zero) – the angular tolerance, an angular width expressed in units of an angular step, which is tolerated in the criteria for deciding if a slice is reconstructable or not

  • logger (a logger, optional) –

sunshine_image

This will be an array of integer heights. We use a one-to-one correspondance beween these integers and slices in the reconstructed volume.

The value of a given item is the vertical coordinate of an horizontal line in in the dectector (or above or below (negative values) ). More precisely the line over which the corresponding slice gets projected at the beginning of the scan ( in other words for the first vertical translation entry of the z_pix_per_proj argument) Illustratively, a view height equal to zero corresponds to a slice which projects on row 0 when translation is given by the first value in self.z_pix_per_proj. Negative integers for the heights are possible too, according to the direction of translations, which may bring above or below the detector. ( Illustratively the values in z_pix_per_proj are alway positive for the simple fact that the sample is above the roto-translation stage and the stage must be lowered in height for the beam to hit the sample. A scan starts always from a positive z_pix translation but the z_pix value may either decrease or increase. In fact for practical reasons, after having done a scan in one direction it is convenient to scan also while coming back after a previous scan)

total_view_heights

A list wich will contain for every reconstructable heigth, listed in self.total_view_heights, and in the same order, a pair of two integer, the first is the first sequential number of the projection for which the height is projected inside the detector, the second integer is the last projection number for which the projection occurs inside the detector.

on_detector_projection_intervals

All like self.on_detector_projection_intervals, but considering also the margins (phase, unsharp, etc). so that the height is projected inside the detector but while keeping a safe phase_margin_pix distance from the upper and lower border of the detector.

within_margin_projection_intervals
This will contain projection number i_pro, the integer value given by

ceil(z_pix_per_proj[i_pro])

This array, together with the here below array self.fract_complement_to_integer_shift_v will be used for cropping when the data are collected for a given to be reconstructed chunk.

integer_shift_v

The fractional vertical shifts are positive floats < 1.0 pixels. This is the fractional part which, added to self.integer_shift_v, gives back z_pix_per_proj. Together with integer_shift_v, this array is meant to be used, by other modules, for cropping when the data are collected for a given to be reconstructed chunk.

get_doable_span()[source]

return an object with two properties: view_heights_minmax: containining minimum and maximum doable height ( detector reference at iproj=0) z_pix_minmax : containing minimum and maximum heights above the roto-translational sample stage

get_informative_string()[source]
get_chunk_info(span_v_absolute)[source]

This method returns an object containing all the informations that are needed to reconstruct the corresponding chunk

angle_index_span: a pair of integers indicating the start and the end of useful angles

in the array of all the scan angle self.projection_angles_deg

span_v: a pair of two integers indicating the start and end of the span relatively to the lowest value

of array self.total_view_heights

integer_shift_v: an array, containing for each one of the useful projections of the span,

the integer part of vertical shift to be used in cropping,

fract_complement_to_integer_shift_v :

the fractional remainder for cropping.

z_pix_per_proj: an array, containing for each to be used projection of the span

the vertical shift

x_pix_per_proj: ….the horizontal shit angles_rad : an array, for each useful projection of the chunk the angle in radian

Parameters:

span_v_absolute: tuple of integers
a pair of two integers

the first view height ( referred to the detector y axis at iproj=0) the second view height with the first height smaller than the second.