-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Time Of Flight reconstruction #304
Changes from 174 commits
d3aa6fc
cb2c46c
a4b815e
7c5ec7b
de8282b
3a25017
6d6b44b
2c068c2
a296248
8fa3169
000a398
53085f0
31dea95
3f4c94d
f22abd6
8683ef7
fafeefd
2b0691e
4645c15
99c8f7f
e4e5804
d0753e3
5a45c96
b1402b3
b70a0c1
2bd6cf8
d88e98c
0f0cccb
521be8d
854d121
fc1ca43
fa0daaa
66df042
9ac474e
7f778d1
dc0b293
11d9b04
b3f91c0
76994be
03012cd
4a2be32
df86c03
29c2c9c
970264b
31c3990
9b0c2c0
9fcf096
f0c8efa
eb8ecd9
17daf28
6be8e07
0981510
aa5f26e
72ffac3
c2e95ab
f2fe075
0ab8655
74baab9
ec0bdcd
f78bd17
e066ead
16518f9
6976945
439f62c
7437adf
8a34b4a
68b7dc6
37919a6
78a7c1c
6b8ae02
1a4faf2
aa50db5
f5478c6
60f2d37
974f148
581c2cd
2884a4d
cb75a8c
7e10e2c
f8dee64
8d8d5b4
f59a3ce
140b217
b449748
ecb4fd4
a7ac52f
3ae0730
21ec98e
9f4f2f7
e244cb4
84cee72
4cc2120
910ce5e
85d9472
855de84
3df95b1
c43e68f
ee64995
e802219
0d59a1d
1422b9d
dc5016c
e576981
3c9545b
c3630f1
7debbcf
769fecd
61de2b1
d02feaa
f41d184
b6bfb67
b6eb9ce
579227a
9ee89b4
4489198
9f82c8a
f452d10
1910184
c35cb4b
176d080
2b00be5
7416289
27fdcb8
79d97c4
6ee85ab
5f2ce06
0e3dc9c
1237a85
02af7d2
332ea57
3506af1
0690d0f
0af3702
580b78e
da618ed
19595b9
cc8ba97
6bacfb0
323806d
91f19a4
bcab3d6
2606b76
98643e3
2876fcb
c5af80e
370d7fe
75e275f
932e7ba
6f24052
855f065
a94ec57
a01dee3
74d0473
e308ba2
6575566
ca03154
d3d0c52
be953b3
fa27110
cb3934c
8dfba7b
59d1c58
3c29ea5
1d7ecf4
b3dad73
c5ce566
51642dc
f89c53b
1f28f91
62cebdd
7fdedf0
b0062ad
91d707b
b19b7cf
c086a1e
f3f940b
e480580
747fa97
60762a9
1732376
9b9eca9
4432943
93fe32b
08bb7a5
d3870ed
04b6623
56804ac
a4b4493
b71683e
229c07a
b579414
f27262c
6f03c22
36d25e3
bd49727
2ea7e18
351c29d
3d93969
e3a4e28
5e6b25d
4222556
8af448b
f017c9a
3846284
6b7a85e
01075f6
06bb31d
12e0fff
52808c3
64962b6
7e6dcf1
d458d36
809e59d
910490f
c7a2b15
dd7cca8
386a797
b0fac1e
b068bc8
0e5b7b3
2bcdc3e
005f70a
51d8c0b
1d38eb9
f396331
3ef019c
db42d85
d5aae0d
c653a1b
d60ba7b
a82bd90
3e1561a
4192f33
22949cb
fde976a
27a2516
572509a
6f63046
4a285ad
53dbdc1
4088ec3
ddd3e0c
a93870d
2cccf63
293d0f6
0818f69
be414b2
d7330dc
c6b36ed
0e11a8f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
OSMAPOSLParameters := | ||
objective function type:= PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin | ||
PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin Parameters:= | ||
list mode filename := PET_ACQ_small.l.hdr.STIR | ||
max ring difference num to process := 2 | ||
projector pair type := Matrix | ||
Projector Pair Using Matrix Parameters := | ||
Matrix type := Ray Tracing | ||
Ray tracing matrix parameters := | ||
; use multiple (almost) parallel LORs for every bin in the sinogram | ||
; to avoid discretisation artefacts | ||
number of rays in tangential direction to trace for each bin:= 3 | ||
; you could disable some symmetries if you have enough memory | ||
; this would for instance allow you to increase the number of subsets | ||
; do_symmetry_90degrees_min_phi:=0 | ||
End Ray tracing matrix parameters := | ||
End Projector Pair Using Matrix Parameters := | ||
|
||
Bin Normalisation type := From ProjData | ||
Bin Normalisation From ProjData := | ||
normalisation projdata filename:= my_acfs.hs | ||
End Bin Normalisation From ProjData:= | ||
|
||
;num_events_to_store := 100 | ||
recompute sensitivity :=1 | ||
use subset sensitivities:= 0 | ||
sensitivity filename:= my_sens_t_lm_pr_seg2.hv | ||
zoom := 1 | ||
|
||
additive sinogram := my_MLrandoms_f1.hs | ||
|
||
end PoissonLogLikelihoodWithLinearModelForMeanAndListModeDataWithProjMatrixByBin Parameters:= | ||
enforce initial positivity condition:= 1 | ||
number of subsets:= 1 | ||
number of subiterations:= 1 | ||
save estimates at subiteration intervals:= 1 | ||
output filename prefix := my_output_t_lm_pr_seg2 | ||
END := |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
#! /bin/sh | ||
# A script to check to see if Time Of Flight data are binned and used properly | ||
# | ||
# Copyright (C) 2016, University of Leeds | ||
# Copyright (C) 2017, University of Hull | ||
# This file is part of STIR. | ||
# | ||
# This file is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU Lesser General Public License as published by | ||
# the Free Software Foundation; either version 2.1 of the License, or | ||
# (at your option) any later version. | ||
|
||
# This file is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU Lesser General Public License for more details. | ||
# | ||
# See STIR/LICENSE.txt for details | ||
# | ||
# Author Nikos Efthimiou | ||
# | ||
|
||
# Scripts should exit with error code when a test fails: | ||
if [ -n "$TRAVIS" ]; then | ||
# The code runs inside Travis | ||
set -e | ||
fi | ||
|
||
echo This script should work with STIR version '>'3.0. If you have | ||
echo a later version, you might have to update your test pack. | ||
echo Please check the web site. | ||
echo | ||
|
||
if [ $# -eq 1 ]; then | ||
echo "Prepending $1 to your PATH for the duration of this script." | ||
PATH=$1:$PATH | ||
fi | ||
|
||
# first need to set this to the C locale, as this is what the STIR utilities use | ||
# otherwise, awk might interpret floating point numbers incorrectly | ||
LC_ALL=C | ||
export LC_ALL | ||
|
||
echo "=== create template sinogram. We'll use a test_scanner which is small and | ||
has TOF info" | ||
template_sino=my_test_scanner_template.hs | ||
cat > my_input.txt <<EOF | ||
test_scanner | ||
1 | ||
82 | ||
N | ||
|
||
|
||
|
||
EOF | ||
create_projdata_template ${template_sino} < my_input.txt > my_create_${template_sino}.log 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR running create_projdata_template. Check my_create_${template_sino}.log"; exit 1; | ||
fi | ||
|
||
export INPUT_ROOT_FILE=test_PET_GATE.root | ||
export EXCLUDE_RANDOM=1 | ||
export EXCLUDE_SCATTERED=1 | ||
|
||
INPUT=root_header.hroot TEMPLATE=$template_sino OUT_PROJDATA_FILE=my_tof_sinogram lm_to_projdata --test_timing_positions lm_to_projdata.par > my_write_TOF_values_${template_sino}.log 2>&1 | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "ERROR running lm_to_projdata --test_timing_positions. Check my_write_TOF_values_${template_sino}.log"; exit 1; | ||
fi | ||
|
||
echo "Comparing values in TOF sinogram ..." | ||
list_projdata_info --all my_tof_sinogram_f179g1d0b0.hs > my_sino_values_$template_sino.log 2>&1 | ||
if [ $? -ne 0 ]; then | ||
echo "ERROR running list_projdata_info. Check my_sino_values_$template_sino.log"; | ||
exit 1; | ||
fi | ||
|
||
|
||
TOF_bins=$(grep 'Total number of timing positions' my_sino_values_$template_sino.log | awk -F ':' '{ print $2 }') | ||
echo "Total number of TOF bins:" $TOF_bins | ||
|
||
Timming_Locations=$(grep 'Timing location' my_sino_values_$template_sino.log | awk -F ':' '{ print $2 }') | ||
echo "Timming_Locations:" $Timming_Locations | ||
|
||
Data_mins=$(grep 'Data min' my_sino_values_$template_sino.log | awk -F ':' '{ print $2 }') | ||
echo "Data mins:" $Data_mins | ||
|
||
Data_maxs=$(grep 'Data max' my_sino_values_$template_sino.log | awk -F ':' '{ print $2 }') | ||
echo "Data maxs:" $Data_maxs | ||
|
||
for i in $(seq 5) | ||
do | ||
if [ $(( $(($(($i-1)) - $((TOF_bins/2)))) - $((Data_mins[$i])))) -ne 0 ]; then | ||
echo "Wrong values in TOF sinogram. Error. $(( $(($(($i-1)) - $((TOF_bins/2)))) - $((Data_mins[$i]))))" | ||
exit 1 | ||
fi | ||
done | ||
|
||
|
||
echo | ||
echo '--------------- End of Time-Of-Flight tests -------------' | ||
echo | ||
echo "Everything seems to be fine !" | ||
echo 'You could remove all generated files using "rm -f my_* *.log"' | ||
exit 0 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
%% | ||
%Plot TOF bins. | ||
% Nikos Efthimiou. 2018/11/01 | ||
% University of Hull | ||
|
||
%This scripts loads LOR files, exported by test_time_of_flight from the disk and plots them. | ||
%% | ||
clc; clear all; | ||
%Path to TOF files. | ||
path_name ='/home/nikos/Desktop/conv_LOR/' | ||
KrisThielemans marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
pre_sort_files_in_path = dir(path_name) | ||
nums = [] | ||
names = [] | ||
|
||
for i = 1: size(pre_sort_files_in_path) | ||
cur_file = pre_sort_files_in_path(i).name | ||
if strfind (cur_file, 'glor') | ||
num = sscanf(cur_file,'glor_%d') | ||
% The following number can change accordingly. | ||
if ((mod(num,1)==0) || num == 500000000) | ||
nums{end+1} = int32(num); | ||
names{end+1} = cur_file; | ||
end | ||
|
||
end | ||
end | ||
|
||
clear cur_file | ||
sorted_filenames = cell(numel(nums),2); | ||
[Sorted_A, Index_A] = sort(cell2mat(nums)); | ||
sorted_filenames(:,2) = names(Index_A); | ||
|
||
% hold x values | ||
x_values = []; | ||
% hold the tof bins. | ||
y_tf_values = []; | ||
% hold the non tof LOR | ||
y__ntf_values = []; | ||
|
||
for i = 1 : size(sorted_filenames,1) | ||
cur_file = sorted_filenames{i,2}; | ||
|
||
if strfind (cur_file, 'glor') | ||
|
||
if strfind(cur_file, '500000000') | ||
cur_full_path = fullfile(path_name, cur_file); | ||
|
||
A = importdata(cur_full_path); | ||
y_ntf_values = A(:,2); | ||
else | ||
cur_full_path = fullfile(path_name, cur_file); | ||
|
||
A = importdata(cur_full_path); | ||
|
||
if size(x_values) == 0 | ||
x_values = A(:,1); | ||
end | ||
|
||
y_tf_values = [y_tf_values A(:,2)]; | ||
|
||
end | ||
end | ||
end | ||
|
||
sum_of_all_bins = sum(y_tf_values,2); | ||
x_v = x_values/0.299; | ||
|
||
%% Create Plot | ||
plot(x_v,y_tf_values(:,:), x_v, sum_of_all_bins, x_v, y_ntf_values) |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,8 +33,6 @@ option(BUILD_EXECUTABLES | |
option(BUILD_SHARED_LIBS | ||
"Use shared libraries" OFF) | ||
|
||
### Settings for external libraries | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. somehow removed. re-instate I guess (I haven't checked properly) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was weird. I merged with master and still this line did not re-appear. Only when I checked out the file. |
||
|
||
if (LLN_FOUND) | ||
set(HAVE_ECAT ON) | ||
message(STATUS "ECAT support enabled.") | ||
|
@@ -68,6 +66,16 @@ else() | |
message(STATUS "RDF support disabled.") | ||
endif() | ||
|
||
if (HDF5_FOUND) | ||
set(HAVE_HDF5 ON) | ||
message(STATUS "HDF5 support enabled.") | ||
add_definitions(-D HAVE_HDF5) | ||
include_directories(${HDF5_INCLUDE_DIRS}) | ||
|
||
else() | ||
message(STATUS "HDF5 support disabled.") | ||
endif() | ||
|
||
|
||
if (ITK_FOUND) | ||
message(STATUS "ITK libraries added.") | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include "stir/IO/GEHDF5Data.h" | ||
|
||
START_NAMESPACE_STIR | ||
|
||
shared_ptr<Scanner> | ||
GEHDF5Data::get_scanner_sptr() const | ||
{ | ||
return this->scanner_sptr; | ||
} | ||
|
||
shared_ptr<ExamInfo> | ||
GEHDF5Data::get_exam_info_sptr() const | ||
{ | ||
return this->exam_info_sptr; | ||
} | ||
|
||
void | ||
GEHDF5Data::open(const std::string& filename) | ||
{ | ||
this->file.openFile( filename, H5F_ACC_RDONLY ); | ||
|
||
warning("CListModeDataGESigna: " | ||
"Assuming this is GESigna, but couldn't find scan start time etc"); | ||
this->scanner_sptr.reset(new Scanner(Scanner::PETMR_Signa)); // for now we are assuming that the scanner is a PET/MR Signa | ||
// TODO: read scanner type from the dataset: "/HeaderData/ExamData/scannerDesc" | ||
this->exam_info_sptr.reset(new ExamInfo); | ||
} | ||
|
||
END_NAMESPACE_STIR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct name of file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🆗