Documentation
The Varian Veritas version 2.2 has three components: mainwindow, beamon and imaging.
Main window
The mainWindow
-
class
mainWindow.MainWindow(parent=None)[source]
The main window class is the entrance point for both DICOM-RT based
XML generation/modification as well as for the XML-from-scratch.
-
openBeamonHeader(cpdata=<models.CPData.CPData object>)[source]
Open the header part of XML generation. Header basically refers to
the header as well as part of the control point 0.
:param cpdata
cpdata=None: build XMLbeam file from scratch
cpdata=cpdata: process a previously generated XMLbeam file
-
openImagingWindow()[source]
Opens the imaging window, sending it data about
Whether inside treatment or outside treatment is wanted,
Based on the dropdown menu below the Imaging button.
-
plotXML()[source]
Plots the XML displayed, using the two dropdown
boxes + potentially the mlc text.
Majority of heavy lifting happens inside the plotXML.plot_fig function.
-
dcm2xml()[source]
Calls DICOM-RT to XML conversion function.
A message box conveys the completion of XML file generation.
Most logic occurs inside the dicom2xml function
-
loadFile(fileName)[source]
Calls beamonHeader to load an existing XML file in
the Control point windows
:param fileName:
The file is read as an xml tree and then imported into the cpdata structure
Functionalities
The MV beamON module
This class launches a window prompting user to enter header
info, that are part of first control point in the XMl beam.
The header info can entered in two ways: a) From scratch for a
new XML beam or b) Parsed from a pre-existing XMl beam created either
previously or generated from a DICOM-RT file.
Class constructor creates an instance control point window as well as variables
for saving velocity and tolerance tables.
In general, other than instantiation and execution, no other window should
should call any methods
On pressing OK, checks self.cp for any xml
data already read in and populates the next window
with the proper entries filled in.
Hides current window and returns accept code when finished
Data is passed to beamonCP in the _create_beamoncp() function
ON pressing cancel, closes the window without peforming any processing.
Show tolerance table window
Show velocity limit table window
-
class
beamon.beamonCP(xmlCP=None, parent=None, cpdata=<models.CPData.CPData object>)[source]
Create a control point window. control point window lets the user the enter
a set of value corresponding to the different mechanical axes.
In case of pre-existing XML beam this class lets the user modify it instead
When its job is done, it passes a populated cp_data structure to the caller via
self.get_data()
In general, only self.get_data() should be called by another object.
Other code is used as UI logic
-
get_data()[source]
Return all accumulated data
-
editAddCP()[source]
Commit changes made to the control point and add it to
the list of control points.
-
doneCP()[source]
All control points have been generated.
Tear down self.controlPoints and close window
-
openMlcFile()[source]
Add the MLC file from a text file.
This function assumes that MLCs are stored in a
text file with two lines corresponding to each
MLC leaves.
-
randomCpoint()[source]
Jump to any control point and populate the
control point window accordingly.
-
firstCP()[source]
Jump to the last control point of the XML beam.
-
lastCP()[source]
Jump to the first control point of the XML beam.
-
nextCP()[source]
Go to the next control point in the control point window.
-
prevCP()[source]
Show previous control point in control point window.
The kv and MV imaging module
-
class
imaging.cpImage(parent=None, infile='', image_only=None)[source]
Main imaging control point window. This window contains
kV, MV imaging points. The window also contains navigation option to
go backward and forward and determine how to
-
prevCP()[source]
Go to previous imaging control point after saving
data
-
nextCP()[source]
Save all the values for current control point and
jump to the next imaging control point.
:param fieldVars:
-
randomCP()[source]
Jump to random control point specified by gotoIndex
-
doneCP(file_name='')[source]
Copy the values for fractional imaging control points
from imaging sub-windows
-
openImageMode()[source]
Driver function for calling window corresponding to the
selected image mode. KV image mode has 7 different options while
MV image mode has 4 different option.
-
selectMode()[source]
Choose kV, MV or both sub-windows
Utility Functions
The dicom2xml module
-
class
utils.dicom2xml.Dicom2Xml(filename, outxml)[source]
-
getLeafJaws(leafJawsSequence, cp)[source]
Extract Mlc, X or Y jaws (if present)
and then add it to the existinXML string
-
findMlcModel(inMlc)[source]
Determine the MLCModel type. Currently NDS120, NDS120HD, NDS80 are supported.
:param inMlc: MLC array from the DICOM file
The dcm_qt_tree module
View DICOM files in a tree using Qt and PySide
-
class
utils.dcm_qt_tree.DicomTree(filename, model)[source]
-
get_patient_table()[source]
Creating patient information table
-
get_plan_table()[source]
Creating plan information table
-
show_tree()[source]
Retrive all dicom data and assign it to tree model structure
-
anonymize(dataset, new_person_name='anonymous', new_patient_id='id', remove_curves=True, remove_private_tags=True)[source]
Replace data element values to partly anonymize a DICOM file.
Note: completely anonymizing a DICOM file is very complicated; there
are many things this example code does not address. USE AT YOUR OWN RISK.
-
array_to_model(array)[source]
Manipulation of dicom tree data
-
recurse_dic_to_item(dic, parent, title='')[source]
Appending data into tree structure.
The plotXML module
-
utils.plotXML.plot_fig(ax, root, x_axis, y_axis, mlc_x, mlc_y)[source]
Plots Gantry Rotation (GantryRtn) as a function as a function of Monitor Units (MUs)
Also adds vertical lines where the kV or MV imaging points are scheduled.