YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
Data Preprocessing
The original ACDC dataset is provided as 4D cardiac MRI data, including the temporal dimension. For this project, the original 4D cine MRI data were converted into 3D volumes by stacking temporal frames along the z-axis.The processed dataset should be organized as follows:
├─ datas/
│ ├─ ACDC4D/
│ │ ├─ img/
│ │ │ ├─ patient001_3d.nii.gz
│ │ │ ├─ patient002_3d.nii.gz
│ │ │ └─ ...
│ │ └─ seg/
│ │ ├─ patient001_3d.nii.gz
│ │ ├─ patient002_3d.nii.gz
│ │ └─ ...
Run Preprocessing:
cd datas
python preprocess.py
After execution, the processed data will be saved automatically to:
├─ datas/
│ ├─ processed/
│ │ ├─ patient001/
│ │ │ ├─ patient001_sa_image.nii.gz
│ │ │ └─ patient001_sa_image-seg.nii.gz
│ │ └─ patient002/
│ │ ├─ patient002_sa_image.nii.gz
│ │ └─ patient002_sa_image-seg.nii.gz
...
Preprocessing Pipeline:
The preprocessing pipeline consists of three main steps.
Step 1: Z-axis Cropping
The apical and basal slices with limited anatomical information are removed.
Step 2: Spacing Resampling
The cropped image and segmentation mask are resampled to a unified voxel spacing: (0.9375, 0.9375, 0.2451)
Step 3: Cardiac Region Cropping
The cardiac region is extracted based on the segmentation mask. The final in-plane image size is: 200 × 200.
Inference
The inference pipeline uses the pretrained classification model to perform cardiac disease classification.
The input data should be the preprocessed volumes generated by preprocess.py.
Run Inference
cd ..
For stage1, run:
python main_cine_class.py \
--model_cls_file ./checkpoints/ACDC_stage1.pth \
--network_cls_file ./stage1_model/cine_class_config.py \
--csv_path ./datas/acdc_gt_stage1.csv
For stage2, run:
python main_cine_class.py \
--model_cls_file ./checkpoints/ACDC_stage2.pth \
--network_cls_file ./stage2_model/cine_class_config.py \
--csv_path ./datas/acdc_gt_stage2.csv
Output
The prediction results will be saved to ./results as a CSV file containing:
- id: Patient ID
- pred_cls: Predicted class label
- gt: Ground-truth label
- avg_pred: Averaged prediction probabilities
- preds_prob: Prediction probabilities for each sliding-window crop