Skip to content

Commit

Permalink
Merge pull request #561 from ANTsX/kk_error_check
Browse files Browse the repository at this point in the history
ENH: avoid kelly_kapowski returning GMP
  • Loading branch information
cookpa authored Mar 13, 2024
2 parents 78edec9 + 8e53271 commit e78edc2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ants/segmentation/kelly_kapowski.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def kelly_kapowski(s, g, w, its=45, r=0.025, m=1.5, gm_label=2, wm_label=3, **kw
s = s.clone('unsigned int')

d = s.dimension
outimg = g.clone()
outimg = g.clone() * 0.0
kellargs = {'d': d,
's': "[{},{},{}]".format(utils.get_pointer_string(s),gm_label,wm_label),
'g': g,
Expand All @@ -80,6 +80,11 @@ def kelly_kapowski(s, g, w, its=45, r=0.025, m=1.5, gm_label=2, wm_label=3, **kw

libfn = utils.get_lib_fn('KellyKapowski')
libfn(processed_kellargs)

# Check thickness is not still all zeros
if outimg.sum() == 0.0:
raise RuntimeError("KellyKapowski failed to compute thickness")

return outimg


Expand Down

0 comments on commit e78edc2

Please sign in to comment.