forked from raysearchlabs/dicomutils
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plotting.py
25 lines (20 loc) · 876 Bytes
/
plotting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 09:14:42 2013
@author: rickarad
"""
import matplotlib.pyplot as pp
import numpy as np
import modules
def plot_roi_in_cp(beam, cp, roi_contour, study):
contours = modules.get_contours_in_bld(beam, roi_contour, study)
for c in contours[cp.ControlPointIndex]:
pp.plot(list(c[0]) + [c[0][0]], list(c[1]) + [c[1][0]])
def plot_cp(beam, cp):
plot_leaves(modules.getblds(beam.BLDs)['MLCX'].LeafPositionBoundaries,
modules.getblds(cp.BLDPositions)['MLCX'].LeafJawPositions)
def plot_leaves(boundaries, positions):
b = boundaries
p = positions
pp.barh(b[:-1], p[:60]-np.min(p)+1, np.diff(b)-0.1*np.min(np.diff(b)), np.min(p)-1, alpha=0.4)
pp.barh(b[:-1], p[60:]-np.max(p)-1, np.diff(b)-0.1*np.min(np.diff(b)), np.max(p)+1, alpha=0.4)