Skip to content

Commit 9ed30a6

Browse files
committed
Merge remote-tracking branch 'upstream/master' into scatter_3d
2 parents 6b216f0 + a4b9269 commit 9ed30a6

40 files changed

+324
-150
lines changed

.appveyor.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@ skip_commits:
55
- .github/**/*
66
- '**/*.md'
77
- '**/*.html'
8+
- '**/*.htm'
89
- '**/*.tex'
910

1011
version: '{build}'
1112

1213
os:
14+
- Visual Studio 2022
15+
- Visual Studio 2019
1316
- Visual Studio 2015
14-
- Visual Studio 2013
1517

1618
platform:
1719
- x64
18-
- x86
1920

2021
configuration:
2122
- Release
@@ -24,14 +25,16 @@ build:
2425
verbosity: detailed
2526

2627
environment:
27-
BOOST_ROOT: C:\Libraries\boost_1_63_0
2828
CMAKE_INSTALL_PREFIX: C:\projects\stir\install\
2929

3030
build_script:
31+
# find boost on Appveyor. Version depends on VM
32+
- for /D %%d in (C:\Libraries\boost_*) do set BOOST_ROOT=%%d
33+
- echo Using Boost %BOOST_ROOT%
3134
- mkdir build
3235
- mkdir install
3336
- cd build
34-
- cmake.exe .. -DCMAKE_INSTALL_PREFIX="C:\projects\stir\install" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_CONFIGURATION_TYPES=%CONFIGURATION% -DSTIR_OPENMP=ON
37+
- cmake.exe .. -DCMAKE_INSTALL_PREFIX="C:\projects\stir\install" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DCMAKE_CONFIGURATION_TYPES=%CONFIGURATION% -DSTIR_OPENMP:BOOL=ON -DBUILD_DOCUMENTATION:BOOL=OFF
3538
- cmake.exe --build . --config %CONFIGURATION%
3639
- cmake.exe --build . --target install --config %CONFIGURATION%
3740

.github/workflows/build-test.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ on:
77
- '.appveyor.yml'
88
- '**/*.md'
99
- '**/*.html'
10+
- '**/*.htm'
1011
- '**/*.tex'
1112

1213
pull_request:
1314
branches: [ master ]
15+
paths-ignore:
16+
- '.appveyor.yml'
17+
- '**/*.md'
18+
- '**/*.html'
19+
- '**/*.htm'
20+
- '**/*.tex'
21+
1422
workflow_dispatch:
1523
inputs:
1624
debug_enabled:

CMakeLists.txt

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set(CMAKE_LEGACY_CYGWIN_WIN32 0)
1515
find_program(CCACHE_PROGRAM ccache)
1616
if(CCACHE_PROGRAM)
1717
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
18-
message(STATUS "ccache found, so we will use this.")
18+
message(STATUS "ccache found, so we will use it.")
1919
endif()
2020

2121

@@ -26,7 +26,11 @@ SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
2626
if (POLICY CMP0025)
2727
cmake_policy(SET CMP0025 NEW) # Compiler Id for Apple Clang is AppleClang, see STIR issue #531
2828
endif()
29-
29+
30+
if(POLICY CMP0074)
31+
cmake_policy(SET CMP0074 NEW) # find_package() uses <PackageName>_ROOT variables
32+
endif()
33+
3034
# add project source to cmake path such that it can use our find_package modules and .cmake files
3135
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/src/cmake;${CMAKE_MODULE_PATH}")
3236
include(src/cmake/SetC++Version.cmake)
@@ -104,7 +108,7 @@ option(DISABLE_UPENN "disable use of UPENN filetypes" OFF)
104108

105109
if(NOT DISABLE_ITK)
106110
# See if we can find a compiled version of ITK (http://www.itk.org/)
107-
find_package(ITK 4.9)
111+
find_package(ITK 4.9 CONFIG)
108112
if (ITK_FOUND)
109113
include(${ITK_USE_FILE})
110114
endif()
@@ -138,12 +142,12 @@ if(NOT DISABLE_HDF5)
138142
endif()
139143

140144
if(NOT DISABLE_NLOHMANN_JSON)
141-
find_package(nlohmann_json 3.2.0)# QUIET)
145+
find_package(nlohmann_json 3.2.0 CONFIG)# QUIET)
142146
if (nlohmann_json_FOUND)
143-
message(STATUS "nlohmann JSON library found.")
147+
message(STATUS "nlohmann JSON library ${nlohmann_json_VERSION} found.")
144148
set(HAVE_JSON ON)
145149
else()
146-
message(STATUS "nlohmann JSON library not found. Try and set nlohmann_json_DIR if you have it.")
150+
message(STATUS "nlohmann JSON library not found. Radionuclide support will be minimal.")
147151
endif()
148152
endif()
149153

@@ -193,14 +197,17 @@ endif()
193197

194198
# Parallelproj
195199
if(NOT DISABLE_Parallelproj_PROJECTOR)
196-
find_package(parallelproj 1.0)
200+
find_package(parallelproj 1.0 CONFIG)
197201
if (parallelproj_FOUND)
198202
set(STIR_WITH_Parallelproj_PROJECTOR ON)
199203
if (parallelproj_built_with_CUDA)
200204
message(STATUS "Found parallelproj ${parallelproj_VERSION} (will use its CUDA support)")
201205
else()
202206
message(STATUS "Found parallelproj ${parallelproj_VERSION} (but using its OpenMP version as it wasn't built with CUDA)")
203207
endif()
208+
if (parallelproj_VERSION VERSION_LESS 1.2.13)
209+
message(STATUS "If the above parallelproj info looks incorrect, upgrade it to at least 1.2.13")
210+
endif()
204211
endif()
205212
endif()
206213
if (STIR_WITH_Parallelproj_PROJECTOR)
@@ -237,9 +244,20 @@ WRITE_BASIC_PACKAGE_VERSION_FILE(${CMAKE_CURRENT_BINARY_DIR}/STIRConfigVersion.c
237244
# the installed files, not the source.
238245
set (STIR_INCLUDE_DIRS "include")
239246

240-
# install the registry sources
241-
install(FILES ${STIR_REGISTRIES} DESTINATION ${STIR_DATA_DIR}/src)
242247

248+
# Older CMake cannot import or export object libraries. So we have to export
249+
# the sources and tell the user to explicitly use STIR_REGISTRIES.
250+
# This will be set to either a list of source files, or a list of object files.
251+
# See STIRConfig.cmake.in on how we cope with this
252+
if (CMAKE_VERSION VERSION_LESS 3.12)
253+
message(WARNING "Your CMake version is older than 3.12. The STIR_REGISTRIES
254+
will be exported as source files only. Please upgrade CMake!")
255+
else()
256+
install(TARGETS stir_registries EXPORT STIRTargets DESTINATION lib)
257+
endif()
258+
259+
# install the registry sources for older CMake versions
260+
install(FILES ${STIR_REGISTRIES} DESTINATION ${STIR_DATA_DIR}/src)
243261
# set STIR_REGISTRIES to this location before export
244262
# first create a new variable.
245263
set(INSTALLED_STIR_REGISTRIES)
@@ -253,11 +271,12 @@ foreach(r ${STIR_REGISTRIES})
253271
endforeach()
254272
set(STIR_REGISTRIES ${INSTALLED_STIR_REGISTRIES})
255273

274+
# New create STIRConfig.cmake
256275
CONFIGURE_PACKAGE_CONFIG_FILE(
257276
src/cmake/STIRConfig.cmake.in
258277
"${CMAKE_BINARY_DIR}/STIRConfig.cmake"
259-
INSTALL_DESTINATION "${ConfigPackageLocation}"
260-
PATH_VARS STIR_INCLUDE_DIRS STIR_REGISTRIES # relocatable variables
278+
INSTALL_DESTINATION "${ConfigPackageLocation}"
279+
PATH_VARS STIR_INCLUDE_DIRS STIR_REGISTRIES # relocatable variables
261280
)
262281

263282
# create and install STIRTargets*.cmake for the installation-tree

LICENSE.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Licensing information for STIR 5.0.2
1+
Licensing information for STIR 5.1.0
22
----------------------------------
33

44
See for more info http://stir.sourceforge.net, section Registration.
@@ -67,11 +67,13 @@ Explicit list of files that carry the PARAPET license
6767
./src/include/stir/PixelsOnCartesianGrid.h
6868
./src/include/stir/IO/stir_ecat6.h
6969
./src/include/stir/IO/interfile.h
70+
./src/include/stir/IO/InputStreamWithRecordsFromUPENNbin.h
7071
./src/include/stir/IO/InterfileHeader.h
7172
./src/include/stir/IO/InterfileHeaderSiemens.h
7273
./src/include/stir/IO/ecat6_utils.h
7374
./src/include/stir/IO/stir_ecat_common.h
7475
./src/include/stir/IO/stir_ecat7.h
76+
./src/include/stir/IO/InputStreamWithRecordsFromUPENNtxt.h
7577
./src/include/stir/IO/ecat6_types.h
7678
./src/include/stir/ProjDataInfo.inl
7779
./src/include/stir/SegmentBySinogram.inl

documentation/STIR-UsersGuide.tex

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5679,6 +5679,31 @@ \section{
56795679

56805680
See the doxygen documentation for an overview of the directory tree with brief descriptions.
56815681

5682+
\section{Using STIR in an external C++ project
5683+
\label{sec:ExternalProjectC++}}
5684+
STIR exports its CMake settings. Therefore, an external project can do
5685+
\begin{verbatim}
5686+
find_package(STIR 5.1 CONFIG)
5687+
add_library(my_lib file1.cxx file2.cxx)
5688+
# my_lib uses STIR functionality
5689+
target_link_libraries(my_lib ${STIR_LIBRARIES})
5690+
add_executable(my_exe my_exe.cxx ${STIR_REGISTRIES})
5691+
target_link_libraries(my_exe my_lib)
5692+
\end{verbatim}
5693+
In addition, if your CMake is older than 3.12, you need to add
5694+
\begin{verbatim}
5695+
include_directories("${STIR_INCLUDE_DIRS}")
5696+
\end{verbatim}
5697+
to your CMake file to get the source code files listed in \texttt{STIR\_REGISTRIES} to compile.
5698+
For more recent CMake, this should not be necessary (as \texttt{STIR\_REGISTRIES} is set to
5699+
a list of compiled files).
5700+
5701+
Note that if CMake did not find the STIR files, you can point it to where they are installed.
5702+
For example, if you installed STIR with
5703+
\texttt{CMAKE\_INSTALL\_PREFIX=\$HOME/install}, set
5704+
\texttt{STIR\_DIR=\$HOME/install/lib/cmake}.
5705+
\footnote{This uses CMake Config mode for \texttt{find\_package}. There is no need for a \texttt{FindSTIR.cmake}}
5706+
56825707
\section{
56835708
Future developments and Support}
56845709

documentation/STIR-developers-overview.tex

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,36 +1245,22 @@ \subsection{How does the STIR implementation of registries work?}
12451245

12461246
\section{
12471247
Extending STIR with your own files \label{sect:extendingSTIR}}
1248+
(See the section on using STIR in an external project in the User's Guide if you just want to
1249+
use STIR functionality in your own work.)
12481250

1249-
If you want to add your own files to the libraries, or have your
1250-
own main programs, you can of course set-up your own directory
1251-
and
1252-
\begin{itemize}
1253-
\item
1254-
make sure that your compiler finds the STIR include files in \textbf{STIR/include}
1255-
\item
1256-
make sure that you link with all the necessary libraries
1257-
\item
1258-
make sure that you link with the *\_registries object files
1259-
\end{itemize}
1260-
1261-
All of this is made easier if you \textit{installed}
1262-
STIR after you built it (\textit{i.e.} used \texttt{make install} or built the \texttt{INSTALL}
1263-
target in your IDE).
1264-
1265-
Nevertheless, wipping up your own \textbf{CMakeLists.txt} is slightly painful, and when using the
1266-
above mechanism, it is impossible for STIR to call your own routines, \textit{e.g.} if you
1267-
added your own filter or prior and want to use that during reconstruction.
1268-
For a true integration with STIR, we provide the following alternative.
1251+
If you want to let STIR use your own
1252+
extra classes, \textit{e.g.} if you
1253+
added your own filter or prior and want to use that during reconstruction,
1254+
you can do this while keeping your own work independent of the STIR sources.
12691255

12701256
\begin{itemize}
1271-
\item Put all your files in a separate subdirectory or in \textbf{STIR/local} (the distribution
1257+
\item Put all your files in a separate folder (which can be outside the STIR tree) or in \textbf{STIR/src/local} (the distribution
12721258
will never contain any files in that directory). Let us call your directory
12731259
\textbf{mySTIRext} as an example.
12741260
\item Create a file \textbf{mySTIRext/extra\_stir\_dirs.cmake} with CMake statements,
12751261
in particular a list of your subdirectories. For instance,
12761262
\begin{verbatim}
1277-
# add include directory to compiler switches
1263+
# add my include directory to compiler switches (or better: use target_include_directories)
12781264
include_directories(include)
12791265
12801266
# check CMakeLists in next directories

documentation/history.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ <h1>History of public releases of the STIR software</h1>
1111
The following links give you a summary what has changed. However,
1212
the ChangeLog is the definite (but tedious) information.
1313
<ul >
14-
<li><a href="release_5.1.htm">version 5.1.0 (dated 5 Jan 2023)</a></li>
14+
<li><a href="release_5.1.htm">version 5.1.0 (dated 14 Jan 2023)</a></li>
1515
<li><a href="release_5.0.htm">version 5.0.2 (dated 26 May 2022)</a></li>
1616
<li><a href="release_5.0.htm">version 5.0.1 (dated 11 May 2022)</a></li>
1717
<li><a href="release_5.0.htm">version 5.0.0 (dated 22 March 2022)</a></li>

documentation/release_5.1.htm

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ <h2>Overall summary</h2>
4040

4141
<h2>Patch release info</h2>
4242
<ul>
43-
<li> 5.1.0 released ??/01/2023</li>
43+
<li> 5.1.0 released 14/01/2023</li>
4444
</ul>
4545

4646
<h2> Summary for end users (also to be read by developers)</h2>
@@ -130,12 +130,15 @@ <h3>Changed functionality</h3>
130130

131131
<h3>Build system and dependencies</h3>
132132
<ul>
133-
<li>STIR now requires parallelproj at least 1.0, although 1.2.10 or more recent is recommended.</li>
133+
<li>STIR now requires parallelproj at least 1.0, although 1.2.13 or more recent is recommended.</li>
134134
<li>
135135
ROOT versions until v6.24 supported C++11, subsequent versions require at least C++14.
136136
If ROOT v6.24 or later is detected, STIR will now use a minimum of C++14,
137137
see <a href="https://github.com/UCL/STIR/pull/1068/">PR #1068</a>.
138138
</li>
139+
<li>Various <code>find_package</code> statements and messages have been improved, see
140+
e.g. <a href="https://github.com/UCL/STIR/pull/1140/">PR #1140</a>.
141+
</li>
139142
</ul>
140143

141144

documentation/release_5.2.htm

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2+
<html>
3+
<head>
4+
<title>Summary of changes in STIR release 5.2</title>
5+
</head>
6+
7+
<body>
8+
<h1>Summary of changes in STIR release 5.2</h1>
9+
10+
<p>This version is 100% backwards compatible with STIR 5.0.
11+
</p>
12+
<h2>Overall summary</h2>
13+
14+
<p>Of course, there is also the usual code-cleanup and
15+
improvements to the documentation. See also <a href="https://github.com/UCL/STIR/milestone/6">the
16+
5.2 milestone on GitHub</a>.
17+
</p>
18+
<p>Overall code management and assistance by Kris Thielemans (UCL and ASC).</p>
19+
20+
<h2>Patch release info</h2>
21+
<ul>
22+
<li> 5.2.0 released ??/??/2023</li>
23+
</ul>
24+
25+
<h2> Summary for end users (also to be read by developers)</h2>
26+
27+
<h3>Bug fixes</h3>
28+
<ul>
29+
</ul>
30+
31+
<h3>New functionality</h3>
32+
<ul>
33+
</ul>
34+
35+
<h3>New examples</h3>
36+
<ul>
37+
</ul>
38+
39+
<h4>Python</h4>
40+
<ul>
41+
</ul>
42+
43+
<h3>Changed functionality</h3>
44+
<ul>
45+
<li>energy resolution functions and keywords have now more documentation. <code>Scanner::check_consistency</code> also checks if the energy resolution is less than 20 (as it is FWHM/reference_energy).
46+
<br /><a href="https://github.com/UCL/STIR/pull/1149/">PR #1149</a>.
47+
</li>
48+
</ul>
49+
50+
<h3>Build system and dependencies</h3>
51+
<ul>
52+
<li>We now use CMake's <a href=https://gitlab.kitware.com/cmake/community/-/wikis/doc/tutorials/Object-Library>OBJECT library feature</a> for the registries. This avoids re-compilation of the registries for every executable and therefore speeds-up building time. Use of STIR in an external project is not affected as long as the recommended practice was followed. This is now documented in the User's Guide.
53+
<br /><a href="https://github.com/UCL/STIR/pull/1141/">PR #1141</a>.
54+
</li>
55+
</ul>
56+
57+
58+
<h3>Known problems</h3>
59+
<ul>
60+
<li>See <a href=https://github.com/UCL/STIR/labels/bug>our issue tracker</a>.</li>
61+
</ul>
62+
63+
64+
<h3>Minor (?) bug fixes</h3>
65+
<ul>
66+
</ul>
67+
68+
<h3>Documentation changes</h3>
69+
<ul>
70+
</ul>
71+
72+
<h3>recon_test_pack changes</h3>
73+
<ul>
74+
</ul>
75+
76+
<h3>Other changes to tests</h3>
77+
<ul>
78+
<li><tt>test_Scanner.cxx</tt> tests for energy resolution. <a href="https://github.com/UCL/STIR/pull/1149/">PR #1149</a>.</li>
79+
</ul>
80+
</body>
81+
82+
</html>

examples/samples/PET_Interfile_header.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,13 @@ image duration (sec)[1] := 3
3838
image relative start time (sec)[1] := 1
3939

4040
number of energy windows:=1
41+
; lower/upper level (in keV)
4142
energy window lower level[1]:=425
4243
energy window upper level[1]:=650
4344

4445
Scanner parameters:=
4546
Scanner type := unknown
47+
; energy resolution as a fraction at the reference energy
4648
Energy resolution := 0.145
4749
Reference energy (in keV) := 511
4850

0 commit comments

Comments
 (0)