| 
1 | 1 | .. _cst:  | 
2 | 2 | 
 
  | 
3 |  | -======================  | 
4 |  | -The cst Data Structure  | 
5 |  | -======================  | 
 | 3 | +==================  | 
 | 4 | +The cst cell Array  | 
 | 5 | +==================  | 
 | 6 | + | 
 | 7 | +The constraints of all defined volumes of interest (VOIs) are stored inside the ``cst`` cell array. It is structured as follows:  | 
 | 8 | + | 
 | 9 | +.. _cst-cell:  | 
 | 10 | + | 
 | 11 | +Screenshot of the cst-cell:  | 
 | 12 | +.. image:: /images/cstCellScreenshot.png  | 
 | 13 | +    :alt: Screenshot of the cst cell  | 
 | 14 | + | 
 | 15 | +.. list-table:: Structure of the cst cell array  | 
 | 16 | +    :header-rows: 1  | 
 | 17 | + | 
 | 18 | +    * - Column  | 
 | 19 | +      - Content  | 
 | 20 | +      - Description  | 
 | 21 | +    * - **1**  | 
 | 22 | +      - :ref:`VOI index <VolInd>`  | 
 | 23 | +      - Number to identify the VOI  | 
 | 24 | +    * - **2**  | 
 | 25 | +      - :ref:`VOI name <VolName>`  | 
 | 26 | +      - String describing the VOI  | 
 | 27 | +    * - **3**  | 
 | 28 | +      - :ref:`VOI type <VolType>`  | 
 | 29 | +      - Specification whether the VOI is an organ at risk (OAR), a target volume or should be ignored  | 
 | 30 | +    * - **4**  | 
 | 31 | +      - :ref:`Voxel indices <VoxInd>`  | 
 | 32 | +      - Vectors containing the indices of all voxels of the CT that are covered by the VOI. Stored as a cell array of vectors (for enabling handling of multiple scenarios)  | 
 | 33 | +    * - **5**  | 
 | 34 | +      - :ref:`Tissue parameters <TissParam>`  | 
 | 35 | +      - Structure containing information about the tissue of the VOI and its overlap priority  | 
 | 36 | +    * - **6**  | 
 | 37 | +      - :ref:`Dose objectives <DoseParam>`  | 
 | 38 | +      - Cell array containing information about the functions used to calculate the objective & constraint function value  | 
 | 39 | +    * - **7**  | 
 | 40 | +      - Precomputed Contours  | 
 | 41 | +      - After GUI startup, this column contains precomputed contour data for display  | 
 | 42 | + | 
 | 43 | +.. _VolInd:  | 
 | 44 | + | 
 | 45 | +VOI index  | 
 | 46 | +---------  | 
 | 47 | + | 
 | 48 | +All defined VOIs are enumerated starting with 0.  | 
 | 49 | + | 
 | 50 | +.. _VolName:  | 
 | 51 | + | 
 | 52 | +VOI name  | 
 | 53 | +--------  | 
 | 54 | + | 
 | 55 | +The VOI name is a string containing an organ name or a short description of the volume (e.g. ``BODY``, ``Liver``, ``GTV``, ...).  | 
 | 56 | + | 
 | 57 | +.. _VolType:  | 
 | 58 | + | 
 | 59 | +VOI type  | 
 | 60 | +--------  | 
 | 61 | + | 
 | 62 | +The VOI type specifies how the volume is considered during treatment planning:  | 
 | 63 | + | 
 | 64 | +.. list-table:: VOI types and their handling during treatment planning  | 
 | 65 | +    :header-rows: 1  | 
 | 66 | + | 
 | 67 | +    * - VOI type  | 
 | 68 | +      - Handling during treatment planning  | 
 | 69 | +    * - **TARGET**  | 
 | 70 | +      - The VOI will be covered with spot positions (protons / carbon ions) and bixels (photons) as defined in the :ref:`stf struct <stf>`. During the fluence optimization, it will be considered according to the defined :ref:`dose objectives <DoseParam>`.  | 
 | 71 | +    * - **OAR**  | 
 | 72 | +      - The VOI will not be covered with spot positions or bixels. During the fluence optimization, it will be considered according to the defined :ref:`dose objectives <DoseParam>`.  | 
 | 73 | +    * - **IGNORED**  | 
 | 74 | +      - The VOI will not be considered during the treatment planning.  | 
 | 75 | + | 
 | 76 | +.. _VoxInd:  | 
 | 77 | + | 
 | 78 | +Voxel indices  | 
 | 79 | +-------------  | 
 | 80 | + | 
 | 81 | +The indices of all voxels (of the :ref:`CT-cube <ct>`) that are covered by the VOI are stored in a vector within a cell array. I.e. we store the segmentation for the VOI as a binary mask, the polygon contour data is not part of matRad's standard data sets.  | 
 | 82 | +As the same voxel can be covered by more than one VOI, an overlap priority (see :ref:`tissue parameters <TissParam>`) is defined to handle potential discrepancies when calculating the objective function value and generating the :ref:`stf struct <stf>`.  | 
 | 83 | + | 
 | 84 | +.. _TissParam:  | 
 | 85 | + | 
 | 86 | +Tissue parameters  | 
 | 87 | +-----------------  | 
 | 88 | + | 
 | 89 | +.. image:: /images/cstCellTissueParametersScreenshot.png  | 
 | 90 | +    :alt: Screenshot of tissue parameters  | 
 | 91 | + | 
 | 92 | +Data can also be stored as in the :ref:`old format (see below) <DoseParamOld>`.  | 
 | 93 | + | 
 | 94 | +New constraints or objectives can be implemented by adding a respective class definition to the :mod:`matRad.optimization.+DoseConstraints` or :mod:`matRad.optimization.+DoseObjectives` folder.  | 
 | 95 | + | 
 | 96 | +.. _DoseParam:  | 
 | 97 | + | 
 | 98 | +Dose Objectives & Constraints since v2.10.0  | 
 | 99 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  | 
 | 100 | +matRad supports inverse planning based on the minimization of a weighted sum of objectives subject to non-linear yet differentiable hard constraints. The following kind of individual objectives are currently supported:  | 
 | 101 | + | 
 | 102 | +.. include:: ../includes/objtable.rst  | 
 | 103 | + | 
 | 104 | +Constraints are somewhat built around similar goals as obejctives:  | 
 | 105 | + | 
 | 106 | +.. include:: ../includes/constrtable.rst  | 
 | 107 | + | 
 | 108 | +When generating an objective / constraint from code, we suggest to wrap the instantiation of the objective/constraint in a ``struct()`` call, as shown in the first phantom example:  | 
 | 109 | + | 
 | 110 | +.. literalinclude:: ../../examples/matRad_example1_phantom.m  | 
 | 111 | +    :caption: examples/matRad_example1_phantom.m  | 
 | 112 | +    :lines: 47-49  | 
 | 113 | +    :lineno-match:  | 
 | 114 | +    :language: matlab  | 
 | 115 | + | 
 | 116 | + | 
 | 117 | +This will ensure that, when saving to a mat-file, we don't save the class object, which improves compatibility.  | 
 | 118 | + | 
 | 119 | +.. _DoseParamOld:  | 
 | 120 | + | 
 | 121 | +Before Version 2.10.0  | 
 | 122 | +~~~~~~~~~~~~~~~~~~~~~  | 
 | 123 | +In the earlier version, matRad stored the objectives and constraints defined for inverse planning as an array of structs. :func:`matRad_convertOldCstToNewCstObjectives` can be used to convert the old definition to the new format.  | 
 | 124 | + | 
 | 125 | +.. _defaultValues:  | 
 | 126 | + | 
 | 127 | +Default *cst*-values  | 
 | 128 | +--------------------  | 
 | 129 | + | 
 | 130 | +The patient data contained within matRad (*ALDERSON, BOXPHANTOM, HEAD_AND_NECK, LIVER, PROSTATE and TG119*) have default values defined within the *cst*-cell.   | 
 | 131 | +   | 
 | 132 | +These values are chosen to produce a reasonable treatment plan, when using coplanar and equidistant photon beams. They can be used as a reference point for more sophisticated treatment plans.  | 
0 commit comments