state_action#
Source code: armscan_env/envs/state_action.py
- class LabelmapStateAction(*, normalized_action_arr: numpy.ndarray, labels_2d_slice: numpy.ndarray, optimal_position: numpy.ndarray | ManipulatorAction | None = None, optimal_labelmap: numpy.ndarray | None = None)[source]#
- labels_2d_slice: ndarray#
Two-dimensional slice of the labelmap, i.e., an array of shape (N, M) with integer values. Each integer represents a different label (bone, nerve, etc.)
- normalized_action_arr: ndarray#
Flat normalized array representing a subset (projection) of two angles and two translations.
- optimal_labelmap: ndarray | None = None#
The labelmap at the optimal position. May be None if the optimal position is not known.
- optimal_position: ndarray | ManipulatorAction | None = None#
The optimal position for the 2D slice, i.e., the position where the slice is the most informative. May be None if the optimal position is not known.
- class ManipulatorAction(*, rotation: tuple[float, float] | numpy.ndarray, translation: tuple[float, float] | numpy.ndarray)[source]#
- classmethod from_normalized_array(action: ndarray, angle_bounds: tuple[float, float], translation_bounds: tuple[float | None, float | None]) Self [source]#
Converts a 1D array to a ManipulatorAction. If angle_bounds is not None, the angles will be unnormalized using the provided bounds.
- rotation: tuple[float, float] | ndarray#
Array of shape (2,) representing two angles in degrees (z_rot, x_rot). The angles will take values between -180 and 180 deg.
- classmethod sample(rotation_range: tuple[float, float] = (10.0, 0.0), translation_range: tuple[float, float] = (10.0, 10.0)) Self [source]#
- to_normalized_array(rotation_bounds: tuple[float, float], translation_bounds: tuple[float | None, float | None]) ndarray [source]#
Converts the action to a 1D array. If angle_bounds is not None, the angles will be normalized to the range [-1, 1] using the provided bounds.
- translation: tuple[float, float] | ndarray#
Array of shape (2,) representing two translations (x_trans, y_trans) in mm.