Skip to content

Commit

Permalink
When extrapolating eroded voxels take mean of all nonzero voxels in k…
Browse files Browse the repository at this point in the history
…ernel which are within the image (if any)
  • Loading branch information
mcraig-ibme committed Aug 20, 2018
1 parent b6bc12e commit d78653b
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions asl_functions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -838,20 +838,14 @@ Matrix extrapolate_avg(Matrix data_in, Matrix mask_in, int neighbour_size)
int row_begin = y_index_on_matrix - off_set;
int row_end = y_index_on_matrix + off_set;

// If it is out of boundary then continue
if (column_begin <= 0 || column_end <= 0 || row_begin <= 0 || row_end <= 0)
{
continue;
}

float sum = 0;
int non_zero_count = 0;

for (int m = column_begin; m <= column_end; m++)
{
for (int n = row_begin; n <= row_end; n++)
{
if (data_in.element(m, n) != 0)
if ((m >= 0) && (n >= 0) && (m < x) && (n < y) && (data_in.element(m, n) != 0))
{
sum = sum + data_in.element(m, n);
non_zero_count++;
Expand Down

0 comments on commit d78653b

Please sign in to comment.