mantidimaging.core.data.imagestack module#
- class mantidimaging.core.data.imagestack.ImageStack(data: ndarray | SharedArray, filenames: list[Path] | None = None, indices: list[int] | Indices | None = None, metadata: dict[str, Any] | None = None, sinograms: bool = False, name: str | None = None)[source]#
Bases:
object- copy(flip_axes: bool = False) ImageStack[source]#
- copy_roi(roi: SensibleROI) ImageStack[source]#
- static create_empty_image_stack(shape: tuple[int, ...], dtype: npt.DTypeLike, metadata: dict[str, Any]) ImageStack[source]#
- create_geometry(angles: ProjectionAngles, geom_type: GeometryType = GeometryType.PARALLEL3D) None[source]#
Creates a Geometry of given type belonging to the ImageStack Angles should be given in radians
- create_geometry_from_cil_acq(acquisition_geometry: AcquisitionGeometry) None[source]#
Creates a Geometry belong to the ImageStack from a CIL AcquisitionGeometry object.
- property data: ndarray#
Get a reference to the internal numpy array holding the image data
Note
Do not hold on to this reference longer than the lifetime of the ImageStack. ImageStack use the operating system’s shared memory, which will be freed when the ImageStack has no remaining references. A reference to this array will not keep that shared memory alive.
- property dtype: dtype#
- property full_stack_shape: tuple[int, ...] | None#
The original shape of the stack irrespective of preview subsetting. For preview subsets: Returns the full shape instead of the sliced shape.
Property should be set when preview is updated, allowing operations to validate against the stacks full shape instead of the preview subset shape.
- Returns:
The full shape of the stack as a tuple of ints (z, y, x) or None if not set.
- property log_file: InstrumentLog | None#
- property proj180deg: ImageStack | None#
- projection_angles() ProjectionAngles | None[source]#
Return projection angles from actual data sources (log files or manually loaded files).
- This method returns angles that were either:
Explicitly set via projection_angles setter
Read from a log file during data loading
- Returns:
Real projection angles if they were found, None otherwise.
- property projections: ndarray#
- set_geometry_panels() None[source]#
Updates the geometry’s panel data based on its parent ImageStack’s array data if both geometry and array data are present.
Set the number of pixels and the pixel size for the geometry panel based on the current width and height of the image stack.
- Side effects:
Modifies self.geometry by updating its panel configuration.
- set_projection_angles(angles: ProjectionAngles) None[source]#
Assigns a set of projection angles to the image stack and updates the associated geometry.
This method validates that the number of provided angles matches the number of images in the stack. If the geometry object is present, it updates its angles accordingly.
- Parameters:
angles – An object containing the projection angles to assign, in radians.
- Raises:
RuntimeError – If the number of angles does not match the number of images in the stack.
- Side effects:
Updates the internal projection angles and, if available, updates the geometry’s angles.
- property shutter_count_file: ShutterCount | None#
- sino_as_image_stack(index: int) ImageStack[source]#
A single sinogram slice as an ImageStack in projection ordering
- property sinograms: ndarray#
- slice_as_image_stack(index: int) ImageStack[source]#
A slice, either projection or sinogram depending on current ordering
- exception mantidimaging.core.data.imagestack.StackNotFoundError(message: str, log_level: int = 40)[source]#
Bases:
RuntimeError