Skip to content

Commit 5925216

Browse files
committed
final merging of the FDA BMD algo
1 parent aebd736 commit 5925216

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

comp2comp/muscle_adipose_tissue/fda_muscle_adipose_tissue.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -553,12 +553,13 @@ def save_results(self, results):
553553
air_measured = np.mean(image[air_seg == 1])
554554
# if air roi is not between -1050 and -950, then continue
555555
if air_roi_values < -1050 or air_roi_values > -950:
556-
print("Air ROI: ", air_roi_values)
556+
print('Error, air ROI is not between -1050 and -950 HU, aborting scan.')
557+
print("Air ROI: {air_roi_values:1.f} HU")
557558
return
558559

559560
vat_measured = np.mean(image[vat_seg == 1])
560-
print("Air ROI: ", air_measured)
561-
print("VAT ROI: ", vat_measured)
561+
print(f"Air ROI: {air_measured:.1f} HU" )
562+
print(f"VAT ROI: {vat_measured:.1f} HU")
562563

563564
hu_vat = -95
564565
hu_air = -1000
@@ -590,4 +591,18 @@ def PredictDXAScores(self):
590591
dxa_scores.loc[0] = [average_calibrated_hu, int(binary_prediction), dxa_density_prediction, dxa_t_score_prediction, dxa_z_score_prediction, self.age]
591592
dxa_scores.to_csv(os.path.join(self.csv_output_dir, "dxa_predictions.csv"), index = False)
592593

594+
print('\n'*3)
595+
print('#'*80)
596+
print('BMD Report:')
597+
print('BMD score prediction: {} (T-score {} -1)\n'.format(
598+
"ABNORMAL" if binary_prediction else "NORMAL",
599+
"<" if binary_prediction else "≥",
600+
))
601+
print('Predicted Z and T-score (NOT FDA approved):')
602+
print(f'Predicted Z-score: {dxa_z_score_prediction:.1f}')
603+
print(f'Predicted T-score: {dxa_t_score_prediction:.1f}')
604+
605+
print('#'*80)
606+
print('\n'*3)
607+
593608
return spine_metrics

0 commit comments

Comments
 (0)