Skip to main content
. Author manuscript; available in PMC: 2019 Apr 1.
Published in final edited form as: IEEE Trans Med Imaging. 2018 Apr;37(4):929–940. doi: 10.1109/TMI.2017.2775604

Algorithm 2.

Volumetric Threshold Search

1: Input: Integer values for upper and lower volumetric threshold bounds, maximum number of iterations max_iterations, if desired
2: Output: Volumetric threshold volume_thresh corresponding to the global minimum distribution fitting error
3: min_thresh = lower_bound, max_thresh = upper_bound, current_thresh = min_thresh
4: for i=l: max_iterations do
5: if i > 1 do
6:   current_thresh = max_thresh
7: else do
8:   sorting_indices = sort(errors, ‘ascending’)
9:   current_thresh = round(men(threshes(sorting_indices (1)), threshes(sorting_indices (2))))
10: end
11: past_threshes(i) = current_thresh
12: if past_threshes(i) = past_threshes(i−1) do
13:   break
14: end
15:  segment image using current_thresh
16:  generate histogram of volumetric data
17:  calculate fitting_error for Gamma distribution
18: past_errors(i) = sum(fltting_error)
19: end