Skip to content

Commit

Permalink
remove pymedphys gamma, way and way too slow. gatetools alternative m…
Browse files Browse the repository at this point in the history
…uch faster
  • Loading branch information
brenthuisman committed Sep 25, 2019
1 parent 8d61352 commit 3f4c57a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 27 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ Say you have a dose calculation and you want to have some DVH metrics (say, Dmax

* numpy
* pydicom
* optional: pymedphys

### Changelog

Expand Down
27 changes: 1 addition & 26 deletions medimage/ops_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,31 +188,6 @@ def crop_as(self,other,**kwargs):
# correct metadata:
self.header = copy.deepcopy(other.header)

def compute_gamma_2(self,other,dta=3.,dd=3., local=False):
'''
Requires pymedphys. Unfortunately, it's a _very_ slow calculation. Do not use unless you really have no other options.
'''

assert type(other)==type(self)
retval = self.copy()

gamma_options = {
'dose_percent_threshold': dd,
'distance_mm_threshold': dta,
'lower_percent_dose_cutoff': 20,
'interp_fraction': 5, # Should be 10 or more for more accurate results
'max_gamma': 15,
'random_subset': None,
'local_gamma': local,
'ram_available': 2**30 # 1 GB
}

from pymedphys.gamma import gamma_shell, gamma_dicom

retval.imdata = gamma_shell(tuple(self.get_axes_labels()), self.imdata, tuple(other.get_axes_labels()), other.imdata, **gamma_options)

return retval

def compute_gamma(self,other,dta=3.,dd=3., ddpercent=True,threshold=0.,defvalue=-1.,verbose=False):
"""
Compare two images with equal geometry, using the gamma index formalism as introduced by Daniel Low (1998).
Expand Down Expand Up @@ -293,4 +268,4 @@ def _reldiff2(dref,dtarget,ddref):
gimg.imdata = g.astype(np.float32).copy()
if verbose:
print("100% done! ")
return gimg
return gimg

0 comments on commit 3f4c57a

Please sign in to comment.