Skip to content

Commit

Permalink
Merge pull request #590 from rijobro/rel4_to_master_3
Browse files Browse the repository at this point in the history
update master to rel 4
  • Loading branch information
KrisThielemans committed Jun 20, 2020
2 parents 1df251c + 3d5513d commit eaa7987
Show file tree
Hide file tree
Showing 34 changed files with 960 additions and 187 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ option(DISABLE_NiftyPET_PROJECTOR "disable use of NiftyPET projector" OFF)

if(NOT DISABLE_ITK)
# See if we can find a compiled version of ITK (http://www.itk.org/)
find_package(ITK QUIET)
find_package(ITK 4.9 QUIET)
if (ITK_FOUND)
include(${ITK_USE_FILE})
endif()
Expand Down
58 changes: 53 additions & 5 deletions documentation/STIR-UsersGuide.tex
Original file line number Diff line number Diff line change
Expand Up @@ -678,13 +678,35 @@ \subsubsection{ROOT files as output by OpenGATE}
to specify the scanner (as this information is not stored in the ROOT file).
We tend to name this header \texttt{something.hroot} but this is not mandatory.

\textbf{Warning:} There is currently no check if the scanner information is correct. This
is dangerous for the geometry, but can also lead to crashes if the actual number of
blocks/crystals etc is larger than what is specified in the scanner info.

We currently support only ROOT output using the CylindricalPET and ECAT systems
from GATE.

\textbf{Warning:} There is a check of consistent scanner geometry information between \textit{STIR}
and OpenGATE as discrepancies can lead to crashes if the actual number of blocks/crystals etc is
larger than what is specified in the scanner info. However, this check requires the \texttt{.hroot}
file to accurately correspond to your GATE macro.

An OpenGATE scanner geometry is modular. For CylindricalPET, \textit{STIR} uses the conversion
scheme detailed in Table \ref{tab:STIR-OpenGATE_terminology}.

\begin{table}[h]
\centering
\begin{tabular}{ |c | c| }
\hline
\textbf{GATE} & \textbf{STIR} \\
\hline
Crystal & Crystal \\
Submodule & Block \\
Module & Bucket \\
Rsector & Buckets around the ring \\
\hline
\end{tabular}
\caption{A guide on the terminology equivalents between STIR and OpenGATE for CylindricalPET
scanner geometries.}
\label{tab:STIR-OpenGATE_terminology}
\end{table}


A full example is given in \texttt{examples/samples/root\_header.hroot}. Below are
2 shorter examples.
If the scanner is known to \texttt{stir::Scanner}, you can use this
Expand Down Expand Up @@ -714,18 +736,44 @@ \subsubsection{ROOT files as output by OpenGATE}
Distance between rings (cm) := 0.40625
Default bin size (cm) := 0.208626
Maximum number of non-arc-corrected bins := 344
Default number of arc-corrected bins := 344 ; default is same as previous value
View offset (degrees) := 0 ; default
GATE scanner type := GATE_Cylindrical_PET
GATE_Cylindrical_PET Parameters :=
; name of the actual ROOT file
name of data file := mysim.root
; See elsewhere for other parameters
; root tree chain to use
name of input TChain := Coincidences
; Gate scanner geometry terminology used to check scanner properties
number of Rsectors := 504
number of modules_X := 1
number of modules_Y := 1
number of modules_Z := 1
number of submodules_X := 1
number of submodules_Y := 1
number of submodules_Z := 1
number of crystals_X := 1
number of crystals_Y := 1
number of crystals_Z := 4
Singles readout depth := 1
exclude scattered events := 0
exclude random events := 0
offset (num of detectors) := 0
low energy window (keV) := 0 ; Default 0
upper energy window (keV):= 10000 ; Default 10000
End GATE_Cylindrical_PET Parameters :=
end ROOT header :=
\end{verbatim}

See \texttt{examples/samples/root\_headerECAT.hroot} for an example using the ECAT system.

There are some unfinished classes
available on the \textit{STIR} web-site to read \textit{LMF} format files,
in conjunction with the \textit{LMF} library. However, these might be obsolete
Expand Down
18 changes: 13 additions & 5 deletions documentation/release_4.1.htm
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<title>Summary of changes in STIR release 4.1.0 (dated ?/?/2020)</title>
<title>Summary of changes in STIR release 4.1</title>
</head>

<body>
<h1>Summary of changes in STIR release 4.1.0 (dated ?/?/2020)</h1>
<h1>Summary of changes in STIR release 4.1</h1>
<h2>Overall summary</h2>

<p>
Expand All @@ -24,7 +24,7 @@ <h2>Overall summary</h2>
DOI: <a href=https://doi.org/10.1016/j.ymeth.2020.01.005>10.1016/j.ymeth.2020.01.005</a>
</li>
<li>Richard Brown (UCL) for wrapping of NiftyPET's GPU functionality for projecting and unlisting</li>
<li>Robert Twyman (UCL) for Relative Difference Prior and computation of the log-likelihood modification</li>
<li>Robert Twyman (UCL) for Relative Difference Prior, computation of the log-likelihood modification, and GATE geometry check fixes. </li>
</ul>
</p>

Expand All @@ -48,7 +48,11 @@ <h3>New functionality</h3>

<h3>Changed functionality</h3>
<ul>
<li> Modification of log-likelihood computation to use more doubles, improving numerical stability, see <a href="https://github.com/UCL/STIR/pull/528">PR 528</a>.</li>
<li>Modification of log-likelihood computation to use more doubles, improving numerical stability, see <a href="https://github.com/UCL/STIR/pull/528">PR 528</a>.</li>
<li>Reconstruction algorithms perform now more checks during <code>set_up()</code> etc.
However, this means that <strong>you have to call <code>set_up()</code> also for analytic
reconstruction algorithms</strong>. (This was already documented, but not yet enforced).
</li>
</ul>
<h4>Python (and MATLAB) interface</h4>
none
Expand Down Expand Up @@ -93,6 +97,8 @@ <h3>Known problems</h3>
<h3>Minor bug fixes</h3>
<ul>
<li>
Changes to GATE/root cylindrical PET geometry interpretation,
see <a href="https://github.com/UCL/STIR/pull/569">PR 569</a>.</li>
</li>
</ul>

Expand All @@ -106,7 +112,9 @@ <h3>recon_test_pack changes</h3>

<h3>Other changes to tests</h3>
<ul>
<li></li>
<li>C++ tests for consistency of forward projection and reconstruction, executed via <tt>ctest</tt>.
This is on top of the <tt>recon_test_pack</tt>.
</li>
</ul>

<h3>Build system</h3>
Expand Down
33 changes: 6 additions & 27 deletions examples/samples/root_header.hroot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ROOT header :=

; More information regarding .hroot files may be found in the UsersGuide
originating system := User_defined_scanner
Number of rings := 4
Number of detectors per ring := 504
Expand All @@ -8,7 +9,8 @@ Average depth of interaction (cm) := 0.7
Distance between rings (cm) := 0.40625
Default bin size (cm) := 0.208626
Maximum number of non-arc-corrected bins := 344

Default number of arc-corrected bins := 344
View offset (degrees) := 0


GATE scanner type := GATE_Cylindrical_PET
Expand All @@ -18,9 +20,7 @@ name of data file := benchmarkPET.root

name of input TChain := Coincidences

; As the GATE repeaters.
; If you skip a level in GATE's hierarchy,
; use 1.
; Gate scanner geometry terminology used to check scanner properties
number of Rsectors := 504
number of modules_X := 1
number of modules_Y := 1
Expand All @@ -32,34 +32,13 @@ number of crystals_X := 1
number of crystals_Y := 1
number of crystals_Z := 4

;; From GATE's online documentation:
;; (http://wiki.opengatecollaboration.org/index.php/Users_Guide_V7.2:Digitizer_and_readout_parameters)
;; [...] the readout depth depends upon how the electronic readout functions.
;; If one PMT reads the four modules in the axial direction,
;; the depth should be set with the command:
;; /gate/digitizer/Singles/readout/setDepth 1
;
; In STIR terminology this will be used to define the number of crystals
; per singles unit.
Singles readout depth := 1

;
; If set the scattered events will be skipped
exclude scattered events := 0

;
; If set the random events will be skipped
exclude random events := 0

;
; STIR will try to align the data.
; If you have used non standart GATE axes,
; rotate using:
offset (num of detectors) := 0

; If want to deactivate set to [0, 1000]
low energy window (keV) := 0
upper energy window (keV):= 1000
low energy window (keV) := 0 ; Default 0
upper energy window (keV):= 10000 ; Default 10000

End GATE_Cylindrical_PET Parameters :=

Expand Down
33 changes: 6 additions & 27 deletions recon_test_pack/root_header.hroot
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
ROOT header :=

; More information regarding .hroot files may be found in the UsersGuide
originating system := User_defined_scanner
Number of rings := 4
Number of detectors per ring := 504
Expand All @@ -8,7 +9,8 @@ Average depth of interaction (cm) := 0.7
Distance between rings (cm) := 0.40625
Default bin size (cm) := 0.208626
Maximum number of non-arc-corrected bins := 344

Default number of arc-corrected bins := 344
View offset (degrees) := 0


GATE scanner type := GATE_Cylindrical_PET
Expand All @@ -18,9 +20,7 @@ name of data file := ${INPUT_ROOT_FILE}

name of input TChain := Coincidences

; As the GATE repeaters.
; If you skip a level in GATE's hierarchy,
; use 1.
; Gate scanner geometry terminology used to check scanner properties
number of Rsectors := 504
number of modules_X := 1
number of modules_Y := 1
Expand All @@ -32,34 +32,13 @@ number of crystals_X := 1
number of crystals_Y := 1
number of crystals_Z := 4

;; From GATE's online documentation:
;; (http://wiki.opengatecollaboration.org/index.php/Users_Guide_V7.2:Digitizer_and_readout_parameters)
;; [...] the readout depth depends upon how the electronic readout functions.
;; If one PMT reads the four modules in the axial direction,
;; the depth should be set with the command:
;; /gate/digitizer/Singles/readout/setDepth 1
;
; In STIR terminology this will be used to define the number of crystals
; per singles unit.
Singles readout depth := 1

;
; If set the scattered events will be skipped
exclude scattered events := ${EXCLUDE_SCATTERED}

;
; If set the random events will be skipped
exclude random events := ${EXCLUDE_RANDOM}

;
; STIR will try to align the data.
; If you have used non standart GATE axes,
; rotate using:
offset (num of detectors) := 0

; If want to deactivate set to [0, 10000]
low energy window (keV) := 0
upper energy window (keV):= 10000
low energy window (keV) := 0 ; Default 0
upper energy window (keV):= 10000 ; Default 10000

End GATE_Cylindrical_PET Parameters :=

Expand Down
2 changes: 1 addition & 1 deletion src/IO/stir_ecat7.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ make_pdfs_from_matrix_aux(SUBHEADERPTR sub_header_ptr,
pdi_ptr->set_num_axial_poss_per_segment(num_axial_poss_per_seg);

std::vector<int> segment_sequence_in_stream =
find_segment_sequence_in_stream(*pdi_ptr);
find_segment_sequence(*pdi_ptr);

Matval matval;
mat_numdoc(matrix->matnum, &matval);
Expand Down
55 changes: 22 additions & 33 deletions src/analytic/FBP2D/FBP2DReconstruction.cxx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Copyright (C) 2000 PARAPET partners
Copyright (C) 2000- 2012-01-09, Hammersmith Imanet Ltd
Copyright (C) 2013 University College London
Copyright (C) 2013, 2020 University College London
This file is part of STIR.
Expand Down Expand Up @@ -43,6 +43,7 @@
#include <algorithm>
#include "stir/IO/interfile.h"
#include "stir/info.h"
#include <boost/format.hpp>

#ifdef STIR_OPENMP
#include <omp.h>
Expand Down Expand Up @@ -115,39 +116,33 @@ ask_parameters()

bool FBP2DReconstruction::post_processing()
{
if (base_type::post_processing())
return true;
return post_processing_only_FBP2D_parameters();
return base_type::post_processing();
}

bool FBP2DReconstruction::post_processing_only_FBP2D_parameters()
Succeeded
FBP2DReconstruction::
set_up(shared_ptr <FBP2DReconstruction::TargetT > const& target_data_sptr)
{
if (base_type::set_up(target_data_sptr) == Succeeded::no)
return Succeeded::no;

if (fc_ramp<=0 || fc_ramp>.5000000001)
{
warning("Cut-off frequency has to be between 0 and .5 but is %g\n", fc_ramp);
return true;
}
error(boost::format("Cut-off frequency has to be between 0 and .5 but is %g") % fc_ramp);

if (alpha_ramp<=0 || alpha_ramp>1.000000001)
{
warning("Alpha parameter for ramp has to be between 0 and 1 but is %g\n", alpha_ramp);
return true;
}
error(boost::format("Alpha parameter for ramp has to be between 0 and 1 but is %g") % alpha_ramp);

if (pad_in_s<0 || pad_in_s>2)
{
warning("padding factor has to be between 0 and 2 but is %d\n", pad_in_s);
return true;
}
error(boost::format("padding factor has to be between 0 and 2 but is %d") % pad_in_s);

if (pad_in_s<1)
warning("Transaxial extension for FFT:=0 should ONLY be used when the non-zero data\n"
"occupy only half of the FOV. Otherwise aliasing will occur!");
warning("Transaxial extension for FFT:=0 should ONLY be used when the non-zero data\n"
"occupy only half of the FOV. Otherwise aliasing will occur!");

if (num_segments_to_combine>=0 && num_segments_to_combine%2==0)
{
warning("num_segments_to_combine has to be odd (or -1), but is %d\n", num_segments_to_combine);
return true;
}
error(boost::format("num_segments_to_combine has to be odd (or -1), but is %d") % num_segments_to_combine);

if (num_segments_to_combine==-1)
if (num_segments_to_combine==-1)
{
const shared_ptr<const ProjDataInfoCylindrical> proj_data_info_cyl_sptr =
dynamic_pointer_cast<const ProjDataInfoCylindrical>(proj_data_ptr->get_proj_data_info_sptr());
Expand All @@ -166,13 +161,10 @@ bool FBP2DReconstruction::post_processing_only_FBP2D_parameters()
}
}

if (is_null_ptr(back_projector_sptr))
{
warning("Back projector not set.\n");
return true;
}
if (is_null_ptr(back_projector_sptr))
error("Back projector not set.");

return false;
return Succeeded::yes;
}

std::string FBP2DReconstruction::method_info() const
Expand Down Expand Up @@ -207,9 +199,6 @@ FBP2DReconstruction(const shared_ptr<ProjData>& proj_data_ptr_v,
pad_in_s = pad_in_s_v;
num_segments_to_combine = num_segments_to_combine_v;
proj_data_ptr = proj_data_ptr_v;
// have to check here because we're not parsing
if (post_processing_only_FBP2D_parameters() == true)
error("FBP2D: Wrong parameter values. Aborting\n");
}

Succeeded
Expand Down

0 comments on commit eaa7987

Please sign in to comment.