• No results found

B. Lung contours extraction from 4DCT datasets

B.2.2. Lung contour extraction algorithm

Even though the aim was to implement a common algorithm to be used with all 4DCTs, some patient-specific parameters had to be used. For one patient, one additional step had to be implemented as well. First step consisted in simple low and high Hounsfield units (HU) threshold combined to volumetric selection (step 1 on Figure B.1). Table B.1 shows patient- specific threshold values that were used as low and high thresholds.

Table B.1.: Thresholds used to isolate lung tissue [HU] in the first step and minimal volumes [voxels] used to identify lungs in the fifth step.

Patient Lower Higher Minimal threshold threshold volume

1 -900 -650 30,000 2 -850 -400 30,000 3 -900 -600 50,000 4 -850 -400 30,000 5 -925 -500 500,000 6 -900 -500 100,000 7 -900 -500 100,000 8 -950 -700 100,000 9 -800 -450 100,000

However, even though lung tissue voxels were isolated, some parts of the couch as well as some other organ tissue whose values were comprised in the thresholding window were selected as well, meaning an additional step had to be performed. Volumetric selection was then implemented by using a 2D-Gaussian (equation B.1) on each CT-slice and selecting voxels comprised in the area where values were higher than 5.5.

2DG= 10 × ex p  −(x − x0) 2 2σx(y − y0) 2 2σy  (B.1)

where x0 and y0 are the coordinates of the center of the CT slice and σx=x0⁄2 and σy= y0⁄2. After those two first steps, the original CT cube was transformed into a binary cube containing lung tissue, but also other residual structures (limited due to the volumetric selection, see result of step 1 on figure B.1).

Combining dilating and eroding then permitted to remove the air cavities in the lung such as bronchioles and alveoli. The principle of dilating is, if a voxel binary value is equal to 0 (representing air), to set it to 1 if the distance to the nearest lung voxel is less than a given length (3 mm in this study). Eroding is the opposite: if a lung voxel is closer than a given length (3 mm again) to an air voxel, it is then set to 0. The dilating/eroding combination was done two times in a row (step 2 on figure B.1), followed by two other successive eroding steps (step 3 on figure B.1).

Figure B.1.: Description of the two different rigid registrations used to align weekly CTs. Blue steps are soft tissue rigid registration specific, green steps are bony anatomy rigid registration specific, striped steps are common to the two methods.

Those aimed at reducing the lung volumes enough (especially in the region located in the front of the chest where the two lungs almost touch each other) so that the two lungs can be separated in order to yield two different contours files containing the left and the right lung. It also permitted to remove the residual undesired structures such as the couch (see result of step 3 on figure B.1). That is why, for all patients but patient 3 (particular case described later in this section), lung separation and isolation was done automatically using those two eroding steps and size thresholds (see Table B.1 and step 4 on figure B.1) to ignore the undesired structures remaining in the binary cube, if the two eroding steps did not make them disappear, resulting in two binary files containing the left lung for one and the right lung for the other.

Figure B.2.: Diagram of the lungs representing the different lobes and segments, from Wikipedia. In the right lung (here on the left), the apical (AP), the posterior (P) and the anterior (AN) segments compose the superior lobe, the lateral (L) and the medial (M) segments the middle lobe and the superior (S), the medial-basal (MB), the anterior-basal (AB), the lateral-basal (LB) and the posterior-basal (PB) segments the inferior lobe. In the left lung (here on the right), the apico-posterior (APP) and the anterior (AN) segments compose the superior lobe, the inferior-lingular (IL) and superior-lingular (SL) segments the middle lobe and the superior (S), the anteromedial-basal (AMB), the lateral-basal (LB) and the posterior-basal (PB) seg- ments the inferior lobe.

In each of the two obtained binary cubes, the next step consisted in filling missing voxels (step 5 on figure B.1). For each voxel whose value was 0 in the binary cubes, the same voxel in the original CT was analyzed and if its value was in the same HU window as for step 1 (or slightly different), the voxel was set to 1 in the binary cube. All voxels in the same CT slice in a 3 by 3 neighborhood underwent the same tests, and if one of those corresponded to the same conditions, its neighborhood was also checked and so on. This was iterated slice by slice until all voxels were analyzed. Due to the carina and its HU which were similar to the lungs, this was not done in 3 dimensions because it would have linked the two lungs back together through the structure of the carina. To remove the last “air” values in each lung (“0” values), dilating and eroding were performed one time each (step 6 on figure B.1). Finally, the planning target volume (PTV) was subtracted to the corresponding lung file and each one of the two lung binary files was transformed into contour files using TRiP (step 7 on figure B.1). The final result can be observed on figure B.1.

As previously mentioned, one additional step had to be implemented for patient 3 in order to separate the two lungs. Because, for this patient, the lungs were very close on the ventral side, the dilating/eroding steps (step 2 on figure B.1) linked the two lungs together so that the following step (eroding two times: step 3 on figure B.1), even when performed 3 times, did not manage to yield the two separated lungs. It means that the two lungs were linked and that they were present on both left lung and right lung binary files, even after the normally successful separation step (step 4 of figure B.1). Thus a new step was placed directly after step 1 of figure B.1 and consisted in finding the minimal value of the projection of a CT slice on the horizontal axis. The aim was to find the location where the lungs almost touch each other in the front of the chest so that the coordinates can be used later (before step 7 of figure B.1) to separate them.