Skip to content
This repository has been archived by the owner on Feb 2, 2022. It is now read-only.

Commit

Permalink
Merge pull request #109 from StephenTerry/master
Browse files Browse the repository at this point in the history
Python3 fixes for structure volume calculation
  • Loading branch information
bastula authored Jan 29, 2018
2 parents 7de5e5c + b448f65 commit e80535e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dicompyler/dvhdata.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# It's assumed that the reference (prescription) dose is in cGy.

import numpy as np
from six import itervalues

class DVH:
"""Processes the dose volume histogram from DICOM DVH data."""
Expand Down Expand Up @@ -51,7 +52,7 @@ def CalculateVolume(structure):

n = 0
# Iterate over each plane in the structure
for sPlane in sPlanes.itervalues():
for sPlane in itervalues(sPlanes):

# Calculate the area for each contour in the current plane
contours = []
Expand All @@ -61,7 +62,7 @@ def CalculateVolume(structure):
# Create arrays for the x,y coordinate pair for the triangulation
x = []
y = []
for point in contour['contourData']:
for point in contour['data']:
x.append(point[0])
y.append(point[1])

Expand All @@ -70,7 +71,7 @@ def CalculateVolume(structure):
for i in range(0, len(x)-1):
cArea = cArea + x[i]*y[i+1] - x[i+1]*y[i]
cArea = abs(cArea / 2)
contours.append({'area':cArea, 'data':contour['contourData']})
contours.append({'area':cArea, 'data':contour['data']})

# Determine which contour is the largest
if (cArea > largest):
Expand Down

0 comments on commit e80535e

Please sign in to comment.