https://github.com/sjswerdloff/rtregistrationcalc
Calculates the 6DOF in IEC 61217 based on SRO, RTSS from in room imaging, and Plan
https://github.com/sjswerdloff/rtregistrationcalc
Last synced: 7 months ago
JSON representation
Calculates the 6DOF in IEC 61217 based on SRO, RTSS from in room imaging, and Plan
- Host: GitHub
- URL: https://github.com/sjswerdloff/rtregistrationcalc
- Owner: sjswerdloff
- License: apache-2.0
- Created: 2023-06-07T14:22:43.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-10T07:44:35.000Z (7 months ago)
- Last Synced: 2024-11-10T08:27:03.348Z (7 months ago)
- Language: Python
- Size: 34.2 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# rtregistrationcalc
Calculates the 6DOF in IEC 61217 based on SRO, RTSS from in room imaging, and PlanInvocation:
Command Line:
```bash
python compute_6dof_from_reg_rtss_plan.py sro_filename rtss_filename rtionplan_filename
```GUI:
```bash
python gui.py
```The algorithm for Table Top Corrections calculation (for MOSAIQ appears to be):
Apply the inverse rotation of the registration matrix to the difference of
the planned isocenter (in reference CT coordinates) and the translation specified in the 4x4 registration matrix.
Subtract that from the SetupIsocenter
Convert from DICOM Patient coordinates to IEC 61217 Table Top Coordinates:Code from `compute_6dof_from_reg_rtss_plan.py`:
```python
rotation_inverse = rotation_matrix.transpose() # nice feature of rotation matrices
reg_translation = four_by_four_matrix[0:3, 3]
delta_plan = plan_iso_dicom_patient - reg_translation
translate_dicom_patient = setup_iso_dicom_patient - rotation_inverse.dot(delta_plan)
translate_iec = convert_dicom_patient_to_iec(translate_dicom_patient, patient_position)
```The order of decomposition is driven by the `rotation_matrix_to_euler_angles()` function containg the following code:
```python
_x = math.atan2(rotation_matrix[2, 1], rotation_matrix[2, 2])
_y = math.atan2(-rotation_matrix[2, 0], _sy)
_z = math.atan2(rotation_matrix[1, 0], rotation_matrix[0, 0])
```To specify a different order of decomposition, one must generate the analytic representation (sin() and cos() for each rotation angle) and multiply in the desired order, then extract the original angles by determining which elements in combination represent the tangent of said Euler Angles.