Skip to content

Commit

Permalink
checking arguments of gamma_index
Browse files Browse the repository at this point in the history
  • Loading branch information
ongchi committed Nov 7, 2016
1 parent 18bbd4c commit 500451b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.ipynb_checkpoints
__pycache__
13 changes: 9 additions & 4 deletions DoseComparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
numerical evaluation of dose distributions comparison
:Date: 2016-11-06
:Version: 0.0.1
:Version: 0.0.2
:Author: ongchi
:Copyright: Copyright (c) 2016, ongchi
:License: BSD 3-Clause License
Expand All @@ -26,10 +26,15 @@ def gamma_index(refimg, tstimg, dta=1, dd=0.05):
:type dd: float
:rtype: numpy.ndarray
'''
diff = tstimg - refimg
# check for valid arguments
if refimg.shape != tstimg.shape:
raise Exception("ValueError: shape mismatch: refimg and tstimg must have the same shape")
if dta <= 0 or int(dta) != dta:
raise Exception("ValueError: dta is an integer greater than zero")
if dd <= 0 or dd >= 1:
raise Exception("ValueError: dd is a float number between 0 (exclusive) and 1 (exclusive)")

if dta == 0:
return diff, diff
diff = tstimg - refimg

gamma = np.ma.empty_like(diff)
gamma[:] = np.inf
Expand Down

0 comments on commit 500451b

Please sign in to comment.