Skip to content

Commit

Permalink
feat: add HU calculation for CT segmentations to align with PET funct…
Browse files Browse the repository at this point in the history
…ionality
  • Loading branch information
LalithShiyam committed Dec 9, 2024
1 parent a18fd9d commit c7d3714
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
28 changes: 21 additions & 7 deletions moosez/moosez.py
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,28 @@ def moose_subject(subject: str, subject_index: int, number_of_subjects: int, mod
SimpleITK.WriteImage(resampled_segmentation, segmentation_image_path)
output_manager.log_update(f" - Prediction complete for {model_workflow.target_model} within {round((time.time() - model_time_start)/ 60, 1)} min.")

# ----------------------------------
# EXTRACT VOLUME STATISTICS
# ----------------------------------
output_manager.spinner_update(f'[{subject_index + 1}/{number_of_subjects}] Extracting CT volume statistics for {subject_name} ({model_workflow.target_model})...')
# -----------------------------------------------
# EXTRACT VOLUME STATISTICS AND HOUNSFIELD UNITS
# -----------------------------------------------
output_manager.spinner_update(
f'[{subject_index + 1}/{number_of_subjects}] Extracting CT volume statistics for {subject_name} ({model_workflow.target_model})...')
output_manager.log_update(f' - Extracting volume statistics for {model_workflow.target_model}')
out_csv = os.path.join(stats_dir, model_workflow.target_model.multilabel_prefix + subject_name + '_ct_volume.csv')
image_processing.get_shape_statistics(resampled_segmentation, model_workflow.target_model, out_csv)
output_manager.spinner_update(f'{constants.ANSI_GREEN} [{subject_index + 1}/{number_of_subjects}] CT volume extracted for {subject_name}! {constants.ANSI_RESET}')
out_vol_stats_csv = os.path.join(stats_dir,
model_workflow.target_model.multilabel_prefix + subject_name + '_ct_volume.csv')
image_processing.get_shape_statistics(resampled_segmentation, model_workflow.target_model,
out_vol_stats_csv)
output_manager.spinner_update(
f'{constants.ANSI_GREEN} [{subject_index + 1}/{number_of_subjects}] CT volume extracted for {subject_name}! {constants.ANSI_RESET}')
time.sleep(1)
output_manager.spinner_update(
f'[{subject_index + 1}/{number_of_subjects}] Extracting CT hounsfield statistics for {subject_name} ({model_workflow.target_model})...')
output_manager.log_update(f' - Extracting hounsfield statistics for {model_workflow.target_model}')
out_hu_stats_csv = os.path.join(stats_dir,
model_workflow.target_model.multilabel_prefix + subject_name + '_ct_hu_values.csv')
image_processing.get_intensity_statistics(image, resampled_segmentation, model_workflow.target_model,
out_hu_stats_csv)
output_manager.spinner_update(
f'{constants.ANSI_GREEN} [{subject_index + 1}/{number_of_subjects}] CT hounsfield statistics extracted for {subject_name}! {constants.ANSI_RESET}')
time.sleep(1)

# ----------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='moosez',
version="3.0.6",
version="3.0.7",
author='Lalith Kumar Shiyam Sundar | Sebastian Gutschmayer | Manuel Pires',
author_email='[email protected]',
description='An AI-inference engine for 3D clinical and preclinical whole-body segmentation tasks',
Expand Down

0 comments on commit c7d3714

Please sign in to comment.