This repository mainly uses ITK to generate DRR, as well as the corresponding keypoints, detection boxes, and segmentation mask annotations. The generated dataset can be used for pre-trained model training to improve the robustness of deep learning.
see details
- Detection(verse mask format)
- Segmantation(verse mask format)
- Keypoints dataset generate
- 3D visualization(2024-07-13-complete!)
Preliminary preparation
Official zip download address
windows:You can skip this step without installing ITK.
linux:Need to compile and install ITK tool, for specific installation can refer to itkSoftwareGuide.
Here is my install process.
Dataset preparation
Detection(Each vertebra is separated in mask format)
python main_drr_detection_dataset.py -c config/detection_config.yml
Detection datasets to generate specific parameter descriptions
The generated json file will be automatically saved after each CT generation. Due to accidental termination or active interruption, the generation can continue, and it is necessary to continue to generate and re-run the command
python main_drr_detection_dataset.py -c config/detection_config.yml
Note:the CT that has been projected in the json file will be automatically detected, starting from the CT that has not been projected.
Sometimes, we main generate single ct wrong, but we don't want to regenerate all cts' drrs. So if you need regenerate the specified cts, just add the ct name in regenerate ct name list. Then run the follow Similar command.Or if you need regenerate all the drrs, just input -r all.
python main_drr_detection_dataset.py -c config/detection_config.yml -r ["du_xiang.nii.gz"]
python main_drr_detection_dataset.py -c config/detection_config.yml -r all # if -r==all then will regenerate all cts drrs.
Segmantation(Each vertebra is separated in mask format)
Running the command:
python main_drr_segmentation_dataset.py -c config/segmentation_config.yml
Segmentation datasets to generate specific parameter descriptions
The generated json file will be automatically saved after each CT generation. Due to accidental termination or active interruption, the generation can continue, and it is necessary to continue to generate and re-run the command
python main_drr_segmentation_dataset.py -c config/segmentation_config.yml
Note:The CT that has been projected in the json file will be automatically detected, and the CT that has not been projected will be started from the CT that has not been projected.
Sometimes, we main generate single ct wrong, but we don't want to regenerate all cts' drrs. So if you need regenerate the specified cts, just add the ct name in regenerate ct name list. Then run the follow Similar command.Or if you need regenerate all the drrs, just input -r all.
python main_drr_segmentation_dataset.py -c config/segmentation_config.yml -r ["du_xiang.nii.gz"]
python main_drr_segmentation_dataset.py -c config/segmentation_config.yml -r all # if -r==all then will regenerate all cts drrs.
Visualize 3d mask and point in 2d image.
python visual_tools/vis_3d_point_and_mask.py