diff --git a/setup.py b/setup.py index 897cc17bf..c0321a543 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ package_data={"totalsegmentator": ["resources/totalsegmentator_snomed_mapping.csv", "resources/contrast_phase_classifiers_2024_07_19.pkl", - "resources/modality_classifiers_2024_10_03.pkl"] + "resources/modality_classifiers_2024_10_04.pkl"] }, install_requires=[ 'torch>=2.1.2', diff --git a/totalsegmentator/bin/totalseg_get_modality.py b/totalsegmentator/bin/totalseg_get_modality.py index 24da148e0..124a258da 100644 --- a/totalsegmentator/bin/totalseg_get_modality.py +++ b/totalsegmentator/bin/totalseg_get_modality.py @@ -21,19 +21,11 @@ def get_features(nifti_img): data = nifti_img.get_fdata() mean = np.mean(data) - # mean = np.median(data) # slower than mean std = np.std(data) min = np.min(data) max = np.max(data) - # perc1 = np.percentile(data, 1) - # perc5 = np.percentile(data, 5) - # perc10 = np.percentile(data, 25) - # perc90 = np.percentile(data, 75) - # perc95 = np.percentile(data, 95) - # perc99 = np.percentile(data, 99) - # return [mean, median, std, min, max, perc1, perc5, perc10, perc90, perc95, perc99] # ~30s for big ct image - return [mean, std, min, max] # 5s for big ct image + return [mean, std, min, max] def get_modality(img: nib.Nifti1Image): @@ -45,10 +37,10 @@ def get_modality(img: nib.Nifti1Image): probability: float """ st = time.time() - features = get_features(img) - print(f"features took: {time.time() - st:.2f}s") + features = get_features(img) # 5s for big ct image + # print(f"features took: {time.time() - st:.2f}s") - classifier_path = pkg_resources.resource_filename('totalsegmentator', 'resources/modality_classifiers_2024_10_03.pkl') + classifier_path = pkg_resources.resource_filename('totalsegmentator', 'resources/modality_classifiers_2024_10_04.pkl') clfs = pickle.load(open(classifier_path, "rb")) # ensemble across folds diff --git a/totalsegmentator/resources/modality_classifiers_2024_10_03.pkl b/totalsegmentator/resources/modality_classifiers_2024_10_04.pkl similarity index 65% rename from totalsegmentator/resources/modality_classifiers_2024_10_03.pkl rename to totalsegmentator/resources/modality_classifiers_2024_10_04.pkl index 2dd6afea9..db6d2f879 100644 Binary files a/totalsegmentator/resources/modality_classifiers_2024_10_03.pkl and b/totalsegmentator/resources/modality_classifiers_2024_10_04.pkl differ