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.
24 lines
No EOL
652 B
Python
24 lines
No EOL
652 B
Python
import os
|
|
|
|
from imaging.preprocessing import process_dataset
|
|
|
|
data_root = '/mnt/1220/Public/dataset/Spine/CTSpine1K/data/'
|
|
label_root = '/mnt/1220/Public/dataset/Spine/CTSpine1K/label/'
|
|
output_dir = '/mnt/1248/open2/cyrou/CBT/Seg/Resample/standardized-xfr-2/'
|
|
|
|
label_map = {
|
|
'colon': 'conlon',
|
|
'COVID-19': 'COVID-19',
|
|
'HNSCC-3DCT-RT_neck': 'HNSCC-3DCT-RT_neck',
|
|
'liver': 'Liver',
|
|
}
|
|
|
|
def main():
|
|
|
|
for key, value in label_map.items():
|
|
data_dir = os.path.join(data_root, key)
|
|
label_dir = os.path.join(label_root, value)
|
|
process_dataset(data_dir, label_dir, output_dir)
|
|
|
|
if __name__ == '__main__':
|
|
main() |