View Selection#

These are MBIRJAX functions are used for automated view selection.

View selection (VCLS) functions#

mbirjax.vcls.get_opt_views(ct_model, reference_object, num_selected_views, r_1=0.002, r_2=0.5, prev_selected_view_inds=array([], dtype=int64), priority_order=False, verbose=0, seed=None)[source]#

Compute the optimal view angles by minimizing the View Covariance Loss (VCL) using a stochastic greedy optimization algorithm. The VCL is defined in the following paper:

J. Lin, A. Ziabari, S. V. Venkatakrishnan, O. Rahman, G. T. Buzzard, C. A.Bouman, “Tomographic Sparse View Selection using the View Covariance Loss”, to appear in the IEEE Transactions on Pattern Analysis and Machine Intelligence, 2025.

Parameters:
  • ct_model (TomographyModel) – A CT model instance (e.g., ParallelBeamModel or ConeBeamModel) containing the system geometry and angles.

  • reference_object (ndarray) – 3D array representing the reference volume (e.g., ground truth).

  • num_selected_views (int) – Number of view angles to select.

  • r_1 (float, optional) – Voxel sampling rate in the reference object (default is 0.001).

  • r_2 (float, optional) – View sampling rate for stochastic minimization (default is 0.01).

  • prev_selected_view_inds (ndarray, optional) – 1D array of previously selected view indices. Defaults to an empty NumPy array.

  • priority_order (bool, optional) – If True, reorders the selected view indices from most to least important. Defaults to False.

  • verbose (int, optional) – Verbosity level. If > 0, visualizations of the covariance matrix and gamma vector will be shown.

  • seed (int, optional) – Random seed for deterministic behavior. If set, results will be reproducible.

Returns:

Tuple[ndarray, float]

A tuple containing:
  • A 1D NumPy array of the indices into the ct_model angles for the optimal view angles of shape (K,).

  • The scalar VCL value for the selected subset.

Example

>>> angles = np.linspace(0, np.pi, num=180, endpoint=False)
>>> sinogram_shape = (180, 128, 100)
>>> ct_model = mj.ParallelBeamModel(sinogram_shape, angles)
>>> ref_obj = np.random.rand(128, 128, 100)
>>> selected_angles_idx, vcl_value = get_opt_views(ct_model, ref_obj, num_selected_views=10)
>>> selected_angles = angles[selected_angles_idx]
>>> print(selected_angles.shape)
(10,)
mbirjax.vcls.show_image_with_projection_rays(image: ndarray, *, rotation_angles_deg: ndarray = None, rotation_angles_rad: ndarray = None, title: str = None) None[source]#

Display an image and overlay arrows pointing along the projection from source to detector for the given rotation angles. The angles are rotation angles using the convention of mbirjax objects: Looking down at the object with the detector at the top of the FoV, 0 degrees points from bottom to top of the object. As the rotation angle increases, the object rotates clockwise, which means that if the object is kept in a fixed view, then the projection angle rotates counterclockwise.

Exactly one of rotation_angles_deg or rotation_angles_rad must be provided (not both).

Parameters:
  • image (np.ndarray) – A 2D NumPy array representing the image.

  • rotation_angles_deg (np.ndarray, optional) – A 1D array of angles in degrees. Each angle is visualized as an arrow through the image center.

  • rotation_angles_rad (np.ndarray, optional) – A 1D array of angles in radians. Each angle is visualized as an arrow through the image center.

  • title (str, optional) – Optional title to display above the plot.

Returns:

None