Skip to content

The matRad coordinate system

palkma edited this page Nov 6, 2020 · 11 revisions

LPS coordinates

matRad uses the LPS (Left, Posterior, Superior) coordinate system

where the x-axis points towards the left patient-side, the y-axis towards the posterior direction and the z-axis towards the superior direction (see image below).

3D points, e.g. the isocenter in the pln struct or source and target points in the stf struct, directly follow the conventions of the LPS coordinate system: The first coordinate, e.g. pln.isoCenter(1) corresponds to the x coordinate, i.e. the coordinate in right-left direction. For the dose and ct cubes, however, which are stored as MATLAB 3D arrays, the second dimension corresponds to the x-coordinate, i.e. the coordinate in right-left direction, and the first dimension corresponds to the y-coordinate, i.e. the coordinate in anterior-posterior direction. We decided to make this permutation due to MATLAB's way to display two-dimensional matrices with the image command, which displays the first array dimension always along the vertical direction.

Coordinates of voxels

To enable fast access, we follow the convention that the center of the most right, anterior, inferior voxel in a cube has the coordinates (resolution.x|resolution.y|resolution.z). Consequently, the most right, anterior, inferior corner of the most right, anterior, inferior voxel is not located at (0|0|0) but at (resolution.x/2|resolution.y/2|resolution.z/2). Note that MATLAB has the inconvenient convention to display values along the first dimension of a two-dimensional array (myArray = rand(numOfElements1,numOfElements2)) along the vertical direction in a two-dimensional plot (e.g. imagesc(myArray) will show numOfElements1 along the vertical direction, i.e. the y axis according to intuition). To account for that we have to make a permutation when accessing data in three-dimensional cubes (e.g. valueXYZ = my3dArray(yIxmxIxmzIx)).

Gantry and couch rotation

The rotation of the gantry (Φ) and the couch (θ) are defined in the following way:

  • Gantry: Clockwise rotation around the z-axis
  • Couch: Counter-clockwise rotation around the y-axis

simple gantry rotation:

simple couch rotation:

simultaneous couch and gantry rotation: