You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: MANUAL.md
+70-6Lines changed: 70 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@
2
2
3
3
## Working tree
4
4
5
-
One should perform calculations in a working folder e.g. `adaptfx/work`. There the instruction files can be specified by the user and `adaptfx` will automatically produce log files if the user wishes to.
5
+
The package ships a CLI with which calculations can be performed which will be explained here. One should perform calculations in a working folder e.g. `adaptfx/work`. There the instruction files can be specified by the user and `adaptfx` will automatically produce log files if the user wishes to.
6
+
7
+
The package also also provides a class that can be used in scripting mode. When using the package in scripts, a class creates an object with according attributes. To understand the attributes and behaviour of optimisation, read the doc-string of the `aft.py` script [here](src/adaptfx/aft.py)
6
8
7
9
## Format of the instruction file
8
10
The user specifies following elements of the dictionary for the main entries:
@@ -94,7 +96,7 @@ min_dose : float
94
96
max_dose : float
95
97
maximal physical doses to be delivered in one fraction.
96
98
The doses are aimed at PTV 95. If -1 the dose is adapted to the
97
-
remaining dose tumor dose to be delivered or the remaining OAR dose
99
+
remaining tumor BED to be delivered or the remaining OAR dose
98
100
allowed to be prescribed.
99
101
default: -1
100
102
```
@@ -136,24 +138,86 @@ sf_high : float
136
138
sf_stepsize: float
137
139
stepsize of the sparing factor stepsize.
138
140
sf_prob_threshold': float
139
-
probability threshold of the sparing factor occuring.
141
+
probability threshold of the sparing factor occuring
142
+
which defines the range of sparing factors.
140
143
inf_penalty : float
141
-
infinite penalty for certain undesired states.
144
+
define infinite penalty for undesired states
145
+
choose arbitrarily large compared to highest occuring reward.
142
146
plot_policy : int
143
147
starting from which fraction policy should be plotted.
144
148
plot_values : int
145
149
starting from which fraction value should be plotted.
146
150
plot_remains : int
147
151
starting from which fraction expected remaining number
148
152
of fractions should be plotted.
153
+
plot_probability : int
154
+
flag if the probability distribution should be plotted
149
155
```
150
156
151
-
# Example
157
+
> :warning: Note:\
158
+
> It is dangerous to use an upper and lower bound in `sf_low` and `sf_high`, as a truncated probability distribution may result that not accurately represents the environment model. Best is to set `sf_prob_threshold` to `1e-3` or lower or leave it at the default which is set at `1e-4`.
159
+
160
+
## Note on Plots
161
+
Policy, Value and Remaining number of fractions plots are calculated with the probability distribution in the fraction from which the plots should start. That is the value function that is known when iterating backwards through the fractions. E.g. the plotted policy starting to plot in the first fraction i.e `plot_policy = 1` and `prob_update = 0` is the policy which is known throughout the treatment, when observing only the first sparing factor. In the case of probability updating e.g `prob_update = 1` the plotted policy is the optimal policy for the probability distribution known when observing the first sparing factor. As the probability distribution changes also future optimal policies change and one has to keep in mind only policy with the constant probability distribution from fraction `1` is plotted.
162
+
163
+
Different is the probability plot: the probability is set for each fraction and updated with additional oberved sparing factors.
164
+
165
+
# AFT CLI
152
166
153
-
Outlined is an example instruction file for fraction minimisation. It simply is a `.json` that is translated into a python dictionary. An example can be found [here](work/oar_example.json)
167
+
Outlined is an example instruction file for fraction minimisation. It simply is a `.json` that is translated into a python dictionary. An example can be found [here](work/example_0.json)
154
168
155
169
This `.json` file can be called in with the CLI as:
156
170
157
171
```
158
172
$ aft -f work/oar_example.json
173
+
```
174
+
175
+
# AST CLI
176
+
There is also a second CLI that allows to plot sparing factors, policy functions, temporal Adaptive Fractionation Therapy etc.
Copy file name to clipboardExpand all lines: README.md
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,10 @@ A last addition is made with graphical user interfaces that facilitate the use o
124
124
> :warning: Note:\
125
125
> The interfaces are not optimized, and thus it is not recommended using them to further develop extensions.
126
126
127
+
### Reducing Number of Fractions
128
+
129
+
For the 2D algorithms there exist the possibility to reduce number of fractions. A constant $c$ can be chosen which introduces a reward (or rather a cost) linear to the number of fractions used to finish the treatment. The cost is added to the immediate reward returned by the environment in the current fraction. There exist a simulative model helping to estimate what the constant $c$ should be chosen in order for the treatment to finish on some target number of fractions $n_{\text{targ}}$. The function can be found [here](src/adaptfx/radiobiology.py) in `c_calc`.
130
+
127
131
### Probability Updating
128
132
129
133
The DP algorithm relies on a description of the environment to compute an optimal policy, in this case the probability distribution of the sparing factor $P(\delta)$, which we assume to be a Gaussian distribution truncated at $0$, with patient-specific parameters for mean and standard deviation. At the start of a treatment, only two sparing factors are available for that patient, from the planning scan and the first fraction. In each fraction, an additional sparing factor is measured, which can be used to calculate updated estimates $\mu_t$ and $\sigma_t$ for mean and standard deviation, respectively.
@@ -173,12 +177,12 @@ ImportError: No module named '_ctypes'
173
177
**Solution:** with the specific package manager of the Linux distribution install `libffi-dev` development tool. E.g. in Fedora Linux and derivatives install this tool
174
178
175
179
```
176
-
sudo dnf install libffi-devel
180
+
$ sudo dnf install libffi-devel
177
181
```
178
182
179
183
On Ubuntu:
180
184
```
181
-
sudo apt install libffi-dev
185
+
$ sudo apt install libffi-dev
182
186
```
183
187
184
188
### No GUI backend for `matplotlib`
@@ -195,19 +199,19 @@ No matching distribution found for tkinter
195
199
**Solution:** on Fedora Linux and derivative distributions one could solve this by either installing python tkinter
196
200
197
201
```
198
-
sudo dnf install python3-tkinter
202
+
$ sudo dnf install python3-tkinter
199
203
```
200
204
201
205
on Ubuntu
202
206
203
207
```
204
-
sudo apt-get install python3-tk
208
+
$ sudo apt-get install python3-tk
205
209
```
206
210
207
211
**Solution:** on MacOS and Linux one could instead use `pip` to install `pyqt`
0 commit comments