Teaching material introducing Python scripting in the RayStation treatment planning
system. A set of small standalone example scripts (each built on RayStation's
connect scripting API) plus an accompanying slide deck,
Raystation Scripting Slides.pdf. Teaching material from 2020, not maintained.
Load_Patient.py/Change_Patient.py— queryPatientDBby MRN (with a fallback to the secondary database when the index service misses) and load the patient, then iterate its cases.Create_ROI.py/Create_External.py— create an ROI and generate an External geometry on an examination.Create_External_Across_patients.py— loop over a list of MRNs, creating an External ROI and its geometry on every examination of every case.Create_Rigid_Registration.py— compute a bone-weighted rigid image registration between the primary exam and every other exam in a case, then copy the primary exam's contoured ROI geometries to the other exams.Copy_Rois_To_Another_Within_Patient.py— copy ROI geometries between examinations within a patient.Export_Patient_List.py— batch DICOM export: read MRNs from a text file and export images plus RT structure sets per examination viaScriptableDicomExport.
The scripts must run inside RayStation's scripting environment (they start with
from connect import *, RayStation's ScriptClient module) — they will not run
as plain Python outside the TPS. Each script is self-contained; MRN lists and
export paths are hard-coded placeholders to edit before running.