Implement a more robust scoring mechanism for screw optimization and
add functionality to generate synthetic X-ray projections (AP and
lateral views) from CT data.
Key changes:
- core: add `generate_cylinder_butt_torch` to create a mask for the
screw entrance (0.25mm) to exempt it from bone-breaching penalties.
- core: update `cl_score_torch_xfr` to include a diameter preference
bonus and utilize the entrance mask.
- core: adjust optimizer bounds and scoring weights to favor larger
diameter screws and improve convergence.
- xfr_cbt_native: implement `render_xray_projections` to generate
synthetic AP and lateral X-ray images for visualization.
- visualization: enhance `render_bone_figure` with semi-transparent
spinous process rendering and improved depth sorting for screws.
- xfr_debug: improve level detection to support arbitrary lumbar
levels (L1-L9) and add safe volume-level cleanup for CBT writing.
- config: update allowed diameters and lengths constants.
Refactor the cylinder parameter selection and optimization process to
improve accuracy and robustness.
- Implement `snap_to_discrete_values_xfr` using a KDTree for efficient
mapping of continuous diameter and length values to a predefined
set of discrete points.
- Update `objective_function_xfr` to use the new snapping mechanism
and introduce a weighted loss component for diameter and length.
- Adjust PSO optimization bounds and search ranges in `run_pso_torch_xfr`
to better align with image dimensions and anatomical constraints.
- Refine scoring logic in `cl_score_torch_xfr` with updated penalty
weights for overlaps and out-of-bone voxels.
- Update `config/constant.py` with new allowed diameter and length
ranges.
- Improve `imaging/preprocessing.py` by making `PROGRESS_FILE` a
parameter to allow per-output-directory progress tracking.
- Update `xfr_debug.py` with improved error handling and directory
paths for batch processing.