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.
38 lines
No EOL
863 B
Python
38 lines
No EOL
863 B
Python
"""
|
||
LABEL_MAP: 一般脊椎與label對應的順序,若是自己標記的需要額外修改定義。
|
||
ALLOWED_DIAMETERS: 螺絲直徑範圍。
|
||
ALLOWED_LENGTHS: 螺絲長度範圍。
|
||
OVERLAP_THRESH: 圓柱體與骨頭接觸的比例(0-1),若低於這個閾值則會重跑。
|
||
spacing: 影像的spacing。
|
||
"""
|
||
|
||
LABEL_MAP = {
|
||
1: "C1", 2: "C2", 3: "C3", 4: "C4", 5: "C5", 6: "C6", 7: "C7",
|
||
8: "T1", 9: "T2", 10: "T3", 11: "T4", 12: "T5", 13: "T6", 14: "T7",
|
||
15: "T8", 16: "T9", 17: "T10", 18: "T11", 19: "T12",
|
||
20: "L1", 21: "L2", 22: "L3", 23: "L4", 24: "L5"
|
||
}
|
||
ALLOWED_DIAMETERS = [
|
||
# 3.5,
|
||
# 4.0,
|
||
4.5,
|
||
5.0,
|
||
5.5,
|
||
6.0,
|
||
6.5,
|
||
# 7.0,
|
||
# 7.5,
|
||
]
|
||
ALLOWED_LENGTHS = [
|
||
25,
|
||
30,
|
||
35,
|
||
40,
|
||
45,
|
||
# 50,
|
||
# 60,
|
||
# 70,
|
||
# 80,
|
||
]
|
||
OVERLAP_THRESH = 0.50
|
||
DEFAULT_SPACING = [0.5, 0.5, 0.5] |