cutright / DVH-Analytics

A DICOM Database Application for Radiation Oncology
Other
82 stars 30 forks source link

DVHs off by two bins #149

Closed cutright closed 3 years ago

cutright commented 3 years ago

https://github.com/cutright/DVH-Analytics/blob/fdd100f6f02102838ad611cc48140a487ba28102/dvha/models/dvh.py#L206-L216

>>> import numpy as np
>>> bins, width = 10, 5
>>> np.multiply(np.array(range(bins)) + width / 2.0, width).tolist()
[12.5, 17.5, 22.5, 27.5, 32.5, 37.5, 42.5, 47.5, 52.5, 57.5]

Should be the following (the key being swapping the add and multiply operations):

>>> np.add(np.arange(bins) * width, width / 2.0).tolist()
[2.5, 7.5, 12.5, 17.5, 22.5, 27.5, 32.5, 37.5, 42.5, 47.5]
cutright commented 3 years ago

Available in the v0.9.6 branch