Exclude projections
About
This MR extends the ignore_projection
parameter to make it more user-friendly.
Currently, one has to provide projections indices to ignore from the scan. This is quite cumbersome ; most of the time users want to exclude an angular range or a set of angles.
API
The extended parameter can be:
-
ignore_projections={"indices": indices_list}
: ignore projections from their index (previous behavior) -
ignore_projections={"angles": angles_list}
: ignore projections from their angle (in degrees) -
ignore_projections={"range": angular_range_tuple}
: ignore an angular range
When passing ignore_projections=indices_list
(previous behavior), we fall-back on case (1) above with a deprecation warning.
Implementation
In TomoScan
objects, the projections are primarily identified by their index. For, example self.projections
is a dict in the form {index: data_url}
. So internally, everything will be done using projections indices.
So when passing a list of angles, one will need a mapping angle <-> proj_index
.
In NXTomoScan
, the indices are directly accessible with image_key
(ex. np.where(image_key == 0)
). On the other hand, angles are also accessible in self.rotation_angle
. So the mapping will be easy to do.
In EDFTomoScan
, things are a bit more complicated:
-
get_proj_urls()
has to be called first to get both indices and projection URL. We don't know all the projection indices until the full list is built:- There might be "jumps" in the file suffix used for index (eg.
frame_0010.edf, frame_0012.edf
) - The list of
DataUrl
is built usingos.listdir()
which returns files in arbitrary order
- There might be "jumps" in the file suffix used for index (eg.
- Therefore, the mapping
index <-> angle
cannot be done early at initialization. - Once the list of projections is built,
_reload_projections()
can be used to insert the "ignore projection" parameter