Anda di halaman 1dari 7

CTC–ask

A brief manual
version 1.1

Rickard O. Ottosson
Risø National Laboratory, Technical University of Denmark, Roskilde, Denmark
Copenhagen University Hospital Herlev, Department of Oncology (R),
Division of Radiophysics (52AA), Herlev, Denmark
email: rickard.ottosson@gmail.com
Copyright c 2011
Contents
1 Brief overview 2

2 Included files 2

3 Installation instructions 3

4 Brief usage guide 3

5 Possible issues 5

6 Example 5

1
1 Brief overview
CTC–ask (CT Create applying DICOM structure knowledge) is a toolbox written for MATLAB. The
purpose of CTC–ask is to convert CT data, in DICOM format, to Monte Carlo phantoms on the
format used by EGSnrc. CTC–ask utilizes a global density conversion, based on a piece–wise linear
HU–to–density–relationship, while using structure specific media conversion ramps (i.e. the list of
media eligible for assignment and their HU–ranges). Incorporation of the delineations contained in the
DICOM RS file enables separation into local compartments based on anatomical regions.
CTC–ask requires an installation of Emiliano Spezi’s DICOMRT-toolbox [3] .
A more detailed description of can be found in: R. O. Ottosson and C. F. Behrens (2011) [2] .
Authors may freely publish work utilizing CTC–ask. The proper references in such cases are
1. R. O. Ottosson and C. F. Behrens. CTC–ask: a new algorithm for conversion of CT numbers to
tissue parameters for Monte Carlo dose calculations applying DICOM RS knowledge. Phys Med
Biol, 56:N263–N274, 2011 [2] and
2. E. Spezi, D. G. Lewis and C. W. Smith. A DICOM–RT based toolbox for the evaluation and
verification of radiotherapy plans. Phys Med Biol, 47:4223–4232, 2002 [3] .

2 Included files
The following files are included in the distribution of CTC–ask.
i. manual.pdf — this manual
ii. CTC-ask functions:
CTC ask.m — the main function
CTCask buildMatList.m
CTCask createUnions.m
CTCask ctcreateStructure.m
CTCask deInterpCTMatrix.m
CTCask deleteEmptyStructs.m
CTCask density.m
CTCask generateDensRamp.m
CTCask generateMaterialRamp.m
CTCask getContour.m
CTCask getDICOMinfo.m
CTCask interpStructToDose.m
CTCask retrieveMaterialRamp.m
CTCask writeEgsphant.m
CTCask writeegs4phant.m

iii. template materialRamps:


AIR.mat
AIRLUNGTISSUE.mat
AIRLUNGTISSUEBONE.mat
AIRTISSUE.mat
AIRTISSUEBONE.mat
LUNGTISSUE.mat

2
LUNGTISSUEBONE.mat
TISSUE.mat
TISSUEBONE.mat

iv. misc:
comp struct.m — a function that compare structs
dicom-dict-mod.txt — a modified DICOM dictionary
polyfitn.m — fits a general polynomial regression model in n dimensions
uigetdir2.m — Standard dialog box for selecting a directory which remembers last selected direc-
tory

3 Installation instructions
1. unzip the entire content
2. In Matlab, click File → Set Path. . . → Add folder. . .

3. Navigate to the directory where you unzipped CTC–ask. Select the CTC–ask folder and click OK.
4. Click save in the previous window.

4 Brief usage guide


CTC–ask is executed by typing CTC ask from the MATLAB prompt. The main function has two
output variables: a material and a density matrix. Therefore, the proposed function call is:
[material, density] = CTC ask;

The code consists of a few blocks as illustrated by figure 1. Firstly, the CT–matrix, CT– and
dose–grid are read from the DICOM files. The bilinear CT–to–density relationship is calculated based
on data points submitted by the user. An option to use a pre–saved relationship is also provided. The
CT matrix is globally converted to a density matrix, with a grid corresponding to the dose–grid of
the DICOM RD file. The structures in the DICOM RS file are sorted according to structure types
(e.g. PTV, External, Avoidance etc.) and the user is queried for structure types to be considered. A
list of the structures with the desired types is created and presented to the user along with an option
to exclude specific structures. The external outline is a required structure and may not be excluded.
A logical mask is generated for each selected structure, that is, a logical matrix of the same shape
as the RD dose grid where true means that the voxel belongs to the specific structure. The user is
requested to input names and upper CT number bounds for the possible media (hereafter referred to
as a ramp–function) for each structure (the lower CT number bound of the first medium defaults to
-1000, while the ith (i>1) uses the upper CT number bound of the (i − 1)th medium). An option
to use a pre-saved ramp–function is also implemented. As every voxel is allowed to belong to only
one structure, the program iterates over the selected structures and generates a union–structure in
the regions where structure–overlaps exist. In case of structure–overlaps the ramp–function of the
overlapping structures are compared. If identical, the structure–union is assigned the ramp else the
user is queried to specify one. The voxels belonging to the overlapping area are set to false for the
overlapping parent–structures and to true for the generated structure–union. If any unions were found

3
Figure 1: General work–flow of CTC–ask.

during the iteration a recursive call of the function is made. Each structure undergoes a separate
conversion of CT number to media based on their ramp–function. A global media list is generated and
each structure correlated to the global list. An option to set voxels outside of the external outline to
air with zero density is implemented in order to emulate the procedure of treatment planning systems.
The media matrices are subsequently added to a global media matrix. Finally, the data is written to
an egs4phant file.
CTC–ask is distributed with default settings for the density ramp [1] . It is highly recommended that
the user measure the CT–number–to–density–relationship for the intended scanner and energy. Once
measured a density ramp can be generated using CTCask generateDensRamp. It is also highly recom-
mended to create materialRamps prior to conversion. A few template materialRamps are distributed
along with CTC–ask. New materialRamps can by generated using CTCask generateMaterialRamp.
The material matrix in an egs4phant is written slice by slice, where each slice consists of N rows and
each row consists of M undelimeted integers representing the material in that voxel. This limits the
number of possible materials to 9. In order to overcome this limit, a whitespace delimiter is introduced.
Example:
Before Now
111111 1 1 1 1 1 1
123211 1 2 3 2 1 1
134212 1 3 4 2 1 2
1108312 1 10 8 3 1 2
The last line will generate a problem as each integer is handled as an element and thus it would
contain too many elements. This problem is avoided by including a delimiter between elements.

4
This will, however, require modification of how the egs4phant files are read by DOSxyznrc. With-
out modification, M elements are read at once, and then each voxel is assigned the corresponding
integer. The following lines of code in dosxyznrc.mortran control how the phantomfile is read:
DO k=1,KMAX[
DO j=1,JMAX[
read(\$CTUnitNumber,:medformat:) (med(\$IR(i,j,k)),i=1,IMAX);
]
read(\$CTUnitNumber,*);
]

In the new format M no longer corresponds to the number of integers, but the number of ele-
ments. Therefore, we need to modify DOSxyznrc to read each element separately. The above lines in
dosxyznrc.mortran must be altered to the following:
DO k=1,KMAX[
DO j=1,JMAX[
read(\$CTUnitNumber,*) (med(\$IR(i,j,k)),i=1,IMAX);
]
read(\$CTUnitNumber,*);
]
It is good practice to make a back up copy of dosxyznrc.mortran before introducing any changes.
This will make it easy to revert to the old format. DOSxyznrc needs to be recompiled in order for the
alterations to take effect. This can be done by going into $EGS HOME/dosxyznrc and typing: make

5 Possible issues
The scripts have only been tested for a few cases, and only with DICOM data exported from Varian
Eclipse.

6 Example
For demonstration purposes a head and neck case was converted to egs4phant with and without any
constraints. In the first case, the constraints were: do not assign lung anywhere inside the external
contour and assign only air outside of the external contour. The result is shown, for a single transversal
slice, in figure 2. Two things in particular can be noted:

i. the unconstrained phantom was assigned lung to a large number of voxels outside of the external
contour and
ii. the unconstrained phantom was assigned lung to low density region within the external contour.

5
Figure 2: Transversal slice of the head and neck case showing media assignment with constrains, (left),
HU-map (center) and media assignment without any constraints (right). The colors correspond to air
(blue), lung (green), soft tissue (yellow) and bone (red).

References
[1] I. Kawrakow, M. Fippel, and K. Friedrich. 3D Electron Dose Calculation using a Voxel based
Monte Carlo Algorithm (VMC). Med Phys, 23:445–457, 1996.
[2] R. O. Ottosson and C. F. Behrens. CTC–ask: a new algorithm for conversion of CT numbers to
tissue parameters for Monte Carlo dose calculations applying DICOM RS knowledge. Phys Med
Biol, 56:N263–N274, 2011.
[3] E. Spezi, D. G. Lewis, and C. W. Smith. A DICOM-RT-based toolbox for the evaluation and
verification of radiotherapy plans. Phys Med Biol, 47:4223–4232, 2002.

Anda mungkin juga menyukai