Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
KiT-RT
KiT-RT
Commits
19db932e
Commit
19db932e
authored
Nov 30, 2020
by
Steffen Schotthöfer
Browse files
added validation_tests
parent
2f29bd3e
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
code/tests/input/checkerboard_reference.vtk
deleted
100644 → 0
View file @
2f29bd3e
This diff is collapsed.
Click to expand it.
code/tests/input/extract_grayscale_image.py
0 → 100644
View file @
19db932e
# importing PIL
from
PIL
import
Image
import
pydicom
import
numpy
as
np
from
pydicom.pixel_data_handlers.util
import
apply_modality_lut
from
copy
import
deepcopy
def
main
():
image_name
=
"mini_phantom.png"
ending
=
image_name
.
split
(
'.'
)[
-
1
];
if
(
ending
==
'dcm'
):
#dicom ct image
dataset
=
pydicom
.
dcmread
(
image_name
)
hu
=
apply_modality_lut
(
dataset
.
pixel_array
,
dataset
)
density
=
(
dataset
.
RescaleIntercept
+
dataset
.
RescaleSlope
*
hu
)
/
1000
+
1
(
spacingX
,
spacingY
)
=
dataset
.
PixelSpacing
(
sizeX
,
sizeY
)
=
density
.
shape
dimensions
=
(
spacingX
*
sizeX
,
spacingY
*
sizeY
)
return
density
,
dimensions
else
:
# jpg or png
img
=
Image
.
open
(
image_name
).
convert
(
'L'
)
#image data
I
=
np
.
asarray
(
img
)
# image as greyscale
I
=
I
/
255
;
# rescale values to [0,1]
J
=
deepcopy
(
np
.
flipud
(
I
))
np
.
savetxt
(
"foo.csv"
,
J
,
delimiter
=
","
)
dimensions
=
(
1
,
1
)
# [cm]
return
J
,
dimensions
if
__name__
==
'__main__'
:
main
()
code/tests/input/validation_tests/MN_solver/checkerboard_MN.cfg
0 → 100644
View file @
19db932e
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Checkerboard Benchmarking File MN %
% Author <Steffen Schotthöfer> %
% Date 10.11.2020 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ---- File specifications ----
%
OUTPUT_DIR = ../../../result
OUTPUT_FILE = rtsn_test_checkerboard_MN
LOG_DIR = ../../../result/logs
MESH_FILE = ../meshes/checkerboard.su2
%
% ---- Problem specifications ----
%
PROBLEM = CHECKERBOARD
%
% ---- Solver specifications ----
%
CFL_NUMBER = 0.5
TIME_FINAL = 3.2
SOLVER = MN_SOLVER
MAX_MOMENT_SOLVER = 2
ENTROPY_FUNCTIONAL = MAXWELL_BOLTZMANN
ENTROPY_OPTIMIZER = NEWTON
%
% ----- Newton Solver Specifications ----
%
NEWTON_FAST_MODE = NO
NEWTON_ITER = 1000
NEWTON_EPSILON = 0.01
NEWTON_STEP_SIZE = 0.7
NEWTON_LINE_SEARCH_ITER = 1000
%
% ---- Boundary Conditions ----
%
BC_DIRICHLET = ( void )
%
% ---- Quadrature ----
%
QUAD_TYPE = GAUSS_LEGENDRE_TENSORIZED
QUAD_ORDER = 8
%
% ----- Output ----
%
VOLUME_OUTPUT = (MINIMAL)
code/tests/input/validation_tests/MN_solver/checkerboard_MN_reference.vtk
0 → 100644
View file @
19db932e
This diff is collapsed.
Click to expand it.
code/tests/input/validation_tests/MN_solver/linesource_MN_MB.cfg
0 → 100644
View file @
19db932e
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linesource Benchmarking File MN %
% Author <Steffen Schotthöfer> %
% Date 01.07.2020 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ---- File specifications ----
%
OUTPUT_DIR = ../../../result
OUTPUT_FILE = rtsn_test_linesource_MN_MB
LOG_DIR = ../../../result/logs
MESH_FILE = ../meshes/linesource.su2
%
% ---- Problem specifications ----
%
PROBLEM = LINESOURCE
SCATTER_COEFF = 1
%
% ---- Solver specifications ----
%
CFL_NUMBER = 0.7
TIME_FINAL = 0.2
SOLVER = MN_SOLVER
MAX_MOMENT_SOLVER = 2
ENTROPY_FUNCTIONAL = MAXWELL_BOLTZMANN
ENTROPY_OPTIMIZER = NEWTON
%
% ----- Newton Solver Specifications ----
%
NEWTON_FAST_MODE = NO
NEWTON_ITER = 1000
NEWTON_EPSILON = 0.01
NEWTON_STEP_SIZE = 0.7
NEWTON_LINE_SEARCH_ITER = 1000
%
% ---- Boundary Conditions ----
%
BC_DIRICHLET = ( void )
%
% ---- Quadrature ----
%
QUAD_TYPE = GAUSS_LEGENDRE_TENSORIZED
QUAD_ORDER = 8
%
% ----- Output ----
%
VOLUME_OUTPUT = (MINIMAL)
code/tests/input/validation_tests/MN_solver/linesource_MN_MB_reference.vtk
0 → 100644
View file @
19db932e
# vtk DataFile Version 4.2
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 61 double
-0.6 -0.6 0 0.6 -0.6 0 0.6 0.6 0
-0.6 0.6 0 0 0 0 -0.4 -0.6 0
-0.2 -0.6 0 6.6613381478e-16 -0.6 0 0.2 -0.6 0
0.4 -0.6 0 0.6 -0.4 0 0.6 -0.2 0
0.6 6.6613381478e-16 0 0.6 0.2 0 0.6 0.4 0
0.4 0.6 0 0.2 0.6 0 -6.6613381478e-16 0.6 0
-0.2 0.6 0 -0.4 0.6 0 -0.6 0.4 0
-0.6 0.2 0 -0.6 -6.6613381478e-16 0 -0.6 -0.2 0
-0.6 -0.4 0 -0.088332399106 0.43353121176 0 -0.43353121176 -0.088332399106 0
0.40841747107 -0.28277700638 0 0.098365396477 -0.42773865803 0 0.42773865803 0.098365396477 0
-0.29915252614 -0.43064559099 0 0.28277700638 0.40841747107 0 -0.43064559099 0.29915252614 0
-0.10013118828 -0.42759398766 0 -0.20781352442 -0.27458104075 0 -0.0060623725765 -0.26932681281 0
0.19654300579 -0.27981612736 0 -0.42855941329 0.10180335451 0 -0.27474194502 0.20809221879 0
-0.27627251382 0.017148940826 0 0.42968185474 -0.087368937613 0 0.25358983849 9.3513224001e-16 0
0.27719329831 0.19755340122 0 0.089041103842 0.43064728037 0 -9.3611199873e-16 0.25358983849 0
0.44021646687 0.29298768454 0 0.2928192853 -0.44065360504 0 -0.4176849844 -0.28566219856 0
-0.28567861737 0.4177134226 0 0.1 -0.12679491924 0 0.12679491924 0.1 0
-0.10384694829 0.12210748587 0 -0.12288196948 -0.10311927111 0 0.45358983849 -0.45358983849 0
-0.45358983849 -0.45358983849 0 0.45358983849 0.45358983849 0 -0.45358983849 0.45358983849 0
0.1476383677 0.28308824116 0 0.28288662677 -0.14773537411 0 -0.28834516088 -0.13980201577 0
-0.13980201577 0.28834516088 0
CELLS 96 384
3 38 48 32
3 34 47 30
3 42 45 31
3 36 46 27
3 44 51 50
3 38 60 48
3 34 59 47
3 39 52 51
3 27 58 36
3 31 57 42
3 50 51 4
3 41 50 49
3 51 52 4
3 49 52 35
3 6 33 30
3 33 35 34
3 8 28 7
3 11 40 27
3 13 29 12
3 18 25 17
3 23 26 22
3 37 38 32
3 16 43 31
3 21 37 32
3 33 34 30
3 37 39 38
3 11 27 10
3 6 30 5
3 7 33 6
3 16 31 15
3 21 32 20
3 25 44 43
3 26 39 37
3 28 33 7
3 25 43 17
3 26 37 22
3 28 35 33
3 29 41 40
3 12 40 11
3 29 40 12
3 17 43 16
3 22 37 21
3 28 36 35
3 29 42 41
3 49 50 4
3 4 52 49
3 14 45 13
3 9 46 8
3 19 48 18
3 24 47 23
3 28 46 36
3 29 45 42
3 13 45 29
3 23 47 26
3 8 46 28
3 18 48 25
3 5 54 0
3 10 53 1
3 15 55 2
3 20 56 3
3 0 54 24
3 1 53 9
3 2 55 14
3 3 56 19
3 40 58 27
3 43 57 31
3 35 52 34
3 39 51 38
3 48 60 25
3 47 59 26
3 50 57 44
3 49 58 41
3 36 49 35
3 42 50 41
3 14 55 45
3 9 53 46
3 19 56 48
3 24 54 47
3 30 54 5
3 27 53 10
3 31 55 15
3 32 56 20
3 25 60 44
3 26 59 39
3 41 58 40
3 44 57 43
3 46 53 27
3 47 54 30
3 45 55 31
3 48 56 32
3 42 57 50
3 36 58 49
3 44 60 51
3 39 59 52
3 52 59 34
3 51 60 38
CELL_TYPES 96
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
CELL_DATA 96
FIELD FieldData 1
radiation%20flux%20density 1 96 double
0.023075686389 0.023075686389 0.023075686389 0.023075686389 3.2567884905 0.023075686389 0.023075686389 2.9000325329 0.023075686389
0.023075686389 4.0517913501 3.1542357631 3.9630162161 2.7957825828 0.023075686389 0.023075686389 5.0580418059e-101 0.023075686389
5.0580418059e-101 1.6357402065e-101 1.6357402065e-101 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389 1.0925488099e-124
1.67533772e-128 4.807237643e-101 1.0925488099e-124 1.67533772e-128 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389
0.023075686389 0.023075686389 5.1070999977e-101 0.023075686389 3.5741746143e-101 3.353049222e-101 0.023075686389 0.023075686389 3.9616384051
3.9219732906 2.8869513693e-129 2.6164279107e-129 5.1807883453e-126 5.2355333002e-126 0.023075686389 0.023075686389 0.023075686389 0.023075686389
0.023075686389 0.023075686389 1.609494535e-180 1.609494535e-180 1.609494535e-180 1.609494535e-180 1.609494535e-180 1.609494535e-180 1.609494535e-180
1.609494535e-180 0.023075686389 0.023075686389 0.76456256015 0.79934508806 0.023075686389 0.023075686389 1.48065084 1.2673622482
0.65568641859 0.81185421685 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389
0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389 0.023075686389
0.023075686389 0.023075686389 1.2625328905 0.94584263198 0.023075686389 0.023075686389
POINT_DATA 61
FIELD FieldData 1
radiation%20flux%20density 1 61 double
1.609494535e-180 1.609494535e-180 1.609494535e-180 1.609494535e-180 3.9746048155 0.007691895463 0.007691895463 0.007691895463 0.007691895463
0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463
0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.007691895463 0.019229738658 0.019229738658
0.019779159762 0.019229738658 0.019229738658 0.019229738658 0.019779159762 0.019229738658 0.019229738658 0.14665683202 0.71420977012
0.12851080842 0.019229738658 0.15245392 0.78574121868 0.019229738658 0.88377988122 0.1545387748 0.019229738658 1.0115332134
0.019229738658 0.019229738658 0.019779159762 0.019779159762 2.2542506278 2.391433536 2.3223688935 2.1877550716 0.013845411833
0.013845411833 0.013845411833 0.013845411833 0.31459071711 0.27193299875 0.20762907551 0.27096712721
code/tests/input/validation_tests/MN_solver/linesource_MN_Quad.cfg
0 → 100644
View file @
19db932e
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Linesource Benchmarking File MN %
% Author <Steffen Schotthöfer> %
% Date 01.07.2020 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ---- File specifications ----
%
OUTPUT_DIR = ../../../result
OUTPUT_FILE = rtsn_test_linesource_MN_Quad
LOG_DIR = ../../../result/logs
MESH_FILE = ../meshes/linesource.su2
%
% ---- Problem specifications ----
%
PROBLEM = LINESOURCE
SCATTER_COEFF = 1
%
% ---- Solver specifications ----
%
CFL_NUMBER = 0.7
TIME_FINAL = 0.2
SOLVER = MN_SOLVER
MAX_MOMENT_SOLVER = 2
ENTROPY_FUNCTIONAL = QUADRATIC
ENTROPY_OPTIMIZER = NEWTON
%
% ----- Newton Solver Specifications ----
%
NEWTON_FAST_MODE = YES
%
% ---- Boundary Conditions ----
%
BC_DIRICHLET = ( void )
%
% ---- Quadrature ----
%
QUAD_TYPE = GAUSS_LEGENDRE_TENSORIZED
QUAD_ORDER = 8
%
% ----- Output ----
%
VOLUME_OUTPUT = (MINIMAL)
code/tests/input/validation_tests/MN_solver/linesource_MN_Quad_reference.vtk
0 → 100644
View file @
19db932e
# vtk DataFile Version 4.2
vtk output
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 61 double
-0.6 -0.6 0 0.6 -0.6 0 0.6 0.6 0
-0.6 0.6 0 0 0 0 -0.4 -0.6 0
-0.2 -0.6 0 6.6613381478e-16 -0.6 0 0.2 -0.6 0
0.4 -0.6 0 0.6 -0.4 0 0.6 -0.2 0
0.6 6.6613381478e-16 0 0.6 0.2 0 0.6 0.4 0
0.4 0.6 0 0.2 0.6 0 -6.6613381478e-16 0.6 0
-0.2 0.6 0 -0.4 0.6 0 -0.6 0.4 0
-0.6 0.2 0 -0.6 -6.6613381478e-16 0 -0.6 -0.2 0
-0.6 -0.4 0 -0.088332399106 0.43353121176 0 -0.43353121176 -0.088332399106 0
0.40841747107 -0.28277700638 0 0.098365396477 -0.42773865803 0 0.42773865803 0.098365396477 0
-0.29915252614 -0.43064559099 0 0.28277700638 0.40841747107 0 -0.43064559099 0.29915252614 0
-0.10013118828 -0.42759398766 0 -0.20781352442 -0.27458104075 0 -0.0060623725765 -0.26932681281 0
0.19654300579 -0.27981612736 0 -0.42855941329 0.10180335451 0 -0.27474194502 0.20809221879 0
-0.27627251382 0.017148940826 0 0.42968185474 -0.087368937613 0 0.25358983849 9.3513224001e-16 0
0.27719329831 0.19755340122 0 0.089041103842 0.43064728037 0 -9.3611199873e-16 0.25358983849 0
0.44021646687 0.29298768454 0 0.2928192853 -0.44065360504 0 -0.4176849844 -0.28566219856 0
-0.28567861737 0.4177134226 0 0.1 -0.12679491924 0 0.12679491924 0.1 0
-0.10384694829 0.12210748587 0 -0.12288196948 -0.10311927111 0 0.45358983849 -0.45358983849 0
-0.45358983849 -0.45358983849 0 0.45358983849 0.45358983849 0 -0.45358983849 0.45358983849 0
0.1476383677 0.28308824116 0 0.28288662677 -0.14773537411 0 -0.28834516088 -0.13980201577 0
-0.13980201577 0.28834516088 0
CELLS 96 384
3 38 48 32
3 34 47 30
3 42 45 31
3 36 46 27
3 44 51 50
3 38 60 48
3 34 59 47
3 39 52 51
3 27 58 36
3 31 57 42
3 50 51 4
3 41 50 49
3 51 52 4
3 49 52 35
3 6 33 30
3 33 35 34
3 8 28 7
3 11 40 27
3 13 29 12
3 18 25 17
3 23 26 22
3 37 38 32
3 16 43 31
3 21 37 32
3 33 34 30
3 37 39 38
3 11 27 10
3 6 30 5
3 7 33 6
3 16 31 15
3 21 32 20
3 25 44 43
3 26 39 37
3 28 33 7
3 25 43 17
3 26 37 22
3 28 35 33
3 29 41 40
3 12 40 11
3 29 40 12
3 17 43 16
3 22 37 21
3 28 36 35
3 29 42 41
3 49 50 4
3 4 52 49
3 14 45 13
3 9 46 8
3 19 48 18
3 24 47 23
3 28 46 36
3 29 45 42
3 13 45 29
3 23 47 26
3 8 46 28
3 18 48 25
3 5 54 0
3 10 53 1
3 15 55 2
3 20 56 3
3 0 54 24
3 1 53 9
3 2 55 14
3 3 56 19
3 40 58 27
3 43 57 31
3 35 52 34
3 39 51 38
3 48 60 25
3 47 59 26
3 50 57 44
3 49 58 41
3 36 49 35
3 42 50 41
3 14 55 45
3 9 53 46
3 19 56 48
3 24 54 47
3 30 54 5
3 27 53 10
3 31 55 15
3 32 56 20
3 25 60 44
3 26 59 39
3 41 58 40
3 44 57 43
3 46 53 27
3 47 54 30
3 45 55 31
3 48 56 32
3 42 57 50
3 36 58 49
3 44 60 51
3 39 59 52
3 52 59 34
3 51 60 38
CELL_TYPES 96
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5