Skip to content

Commit

Permalink
another TPTBox update
Browse files Browse the repository at this point in the history
  • Loading branch information
Hendrik-code committed Feb 8, 2024
1 parent 571c501 commit 20c0099
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spineps/utils/proc_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from ants.utils.convert_nibabel import from_nibabel
from scipy.ndimage import center_of_mass
from TPTBox import NII, Logger_Interface
from TPTBox.core.np_utils import np_bbox_binary, np_count_nonzero, np_dilate_msk, np_unique
from TPTBox.core.np_utils import np_bbox_binary, np_count_nonzero, np_dilate_msk, np_unique, np_volume
from tqdm import tqdm


Expand Down Expand Up @@ -138,10 +138,10 @@ def clean_cc_artifacts(
# majority voting
dilated_m[dilated_m != 0] = 1
mult = mask_arr * dilated_m
labels, count = np.unique(mult, return_counts=True)
labels = labels[1:]
count = count[1:]
newlabel = labels[np.argmax(count)]
volumes = np_volume(mult)
nlabels = volumes.keys()
volumes_values = volumes.values()
newlabel = nlabels[np.argmax(volumes_values)]
result_arr[mask_cc_l != 0] = newlabel
logger.print(log_string + f"labeled as {newlabel}") if verbose else None
# print(labels, count)
Expand Down

0 comments on commit 20c0099

Please sign in to comment.