## 2 Methodology
### Data Structure and Preprocessing  
The procedures and algorithms were implemented in MATLAB R2018b. The demos-based registration was implemented using the Image Processing Toolbox function called _imregdemons_. The computational experiments were done using a PC with 16.0 GB of RAM, a 64-bit Windows 10 operating system, and a 2.90 GHz processor. To validate the medical results, matRad was used. It is an open source cancer treatment planning toolkit which includes tools for radiation treatment planning of three-dimensional intensity-modulated radiation therapy [28] and is available on its public GitHub repository ([[http://www.matrad.org/](http://www.matrad.org/)]([http://www.matrad.org/](http://www.matrad.org/)), accessed on 24 June 2022).  
Two sets of images were used for the analysis. The first set is of 10 CT scans of the abdominal area (which will be referred to as scenarios from now on), each scan with a dimension of \(256\times 256\times 130\) corresponding to a patient with liver cancer. To check the accuracy of the contours obtained, we use segmentation data of the skin, liver, and clinical treatment volume (CTV), which will be called structures from now on. The second data set consists of five 3-D breast CT scans of one patient, each image stored at a \(512\times 512\times 65\) resolution. The following volumes were contoured: skin, right lung, left lung, heart, contralateral sinus, and CTV. This resolution results from preprocessing the original images as described below.  
Breast CT Acquisition in 4-D Format  
Since the five CT scans belong to the same patient, we construct an extension of scans that simulate the 4-D format for the five series, where the dimensions of the five scenarios are \(256\times 256\times 65\). Scenarios 1, 2, 4, and 5 are composed of 75 slices, while Scenario 3 was taken with 10 fewer slices. This implies that the dimensions per voxel in Scenario 3 are different compared to the other scenarios. Now, the demon algorithm is an iterative process where the objective function is a similarity measure. When comparing intensities, the columns of the voxels will not match between Scenario 1, the fixed scenario, and Scenario 3. This generates erroneous displacement vectors and in order to avoid this, the first ten remaining slices of scans 1, 2, 4, and 5 are removed so the five scenarios are equally resized and have the same voxel size. With this, the resolution per voxel is expected to be 1.5226 \(\times\) 1.5226 \(\times\) 3.  
To do this, we start with the loading of the first scenario with its respective contours, CT\({}_{1}\). Then, we attach the remaining scan volumes, CT\({}_{2}\), CT\({}_{3}\), CT\({}_{4}\), and CT\({}_{5}\), to the resulting array. Finally, the dicom information and the corresponding metadata from CT\({}_{2}\) to CT\({}_{5}\) are attached.  
Once the CT is obtained in 4-D format with five scenarios and six segmented structures in Scenario 1, which will be the fixed scenario, stored as segmented computed tomography (SCT), each structure in the SCTs is a set of linear positions that have their equivalent positions \(x\), \(y\), \(z\) in the cube, as seen in Figure 4.  
These images, processed in 4-D format, are used later for the contour-propagation algorithm, which allows for its implementation in matRad, given they have the CT and SCT instances.