Skip to content

Commit ec0db72

Browse files
Set default value for half_block = 0 when reading ROOT files (#1012)
Set default value for half_block = 0 and introduce STIR_ROOT_ROTATION_AS_V4 Co-authored-by: Kris Thielemans <[email protected]>
1 parent 06a68d1 commit ec0db72

5 files changed

Lines changed: 29 additions & 0 deletions

File tree

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ endif()
141141
# Legacy options
142142
option(STIR_PROJECTORS_AS_V3 "Enable STIR version 3 legacy code" OFF)
143143
option(STIR_LEGACY_IGNORE_VIEW_OFFSET "Ignore using scanner view-offset (or intrinsic azimuthal tilt), as in STIR 4 or earlier" OFF)
144+
option(STIR_ROOT_ROTATION_AS_V4 "Ignore the changes to the ROOT rotation introduced in STIR version 5" OFF)
144145

145146
# NiftyPET projector
146147
if(NOT DISABLE_NiftyPET_PROJECTOR OR NOT DISABLE_Parallelproj_PROJECTOR)

documentation/release_5.0.htm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,15 @@ <h3>Backward incompatibities</h3>
339339
scanners, this will fill in the detector maps etc.
340340
You will get a run-time exception if you forgot to do this.
341341
</li>
342+
<li>
343+
Rotational changes to STIR's interface to ROOT files, <a href=https://github.com/UCL/STIR/pull/1012>PR #1012</a>. In previous versions (roughly) half a bucket,
344+
<code>(module_repeater_y * submodule_repeater_y * crystal_repeater_y) /2 - 1)</code>
345+
in the <tt>Cylindrical</tt> case, was subtracted from the crystalIDs, in an attempt to rotate
346+
the scanner. However, this was incompatible with the STIR code to find normalisation factors,
347+
and could be surprising for odd numbers etc.
348+
Rotations should use the new view offset support described above.
349+
Backwards compatibility can be maintained with the CMake switch, <tt>STIR_ROOT_ROTATION_AS_V4</tt>.
350+
</li>
342351
</ul>
343352

344353
<h3>New functionality</h3>

src/IO/InputStreamFromROOTFileForCylindricalPET.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,10 @@ get_next_record(CListRecordROOT& record)
112112

113113
// GATE counts crystal ID =0 the most negative. Therefore
114114
// ID = 0 should be negative, in Rsector 0 and the mid crystal ID be 0 .
115+
#if STIR_ROOT_ROTATION_AS_V4
115116
crystal1 -= half_block;
116117
crystal2 -= half_block;
118+
#endif
117119

118120
// Add offset
119121
crystal1 += offset_dets;
@@ -146,6 +148,13 @@ InputStreamFromROOTFileForCylindricalPET::set_defaults()
146148
module_repeater_y = -1;
147149
module_repeater_z = -1;
148150
rsector_repeater = -1;
151+
#if STIR_ROOT_ROTATION_AS_V4
152+
half_block = module_repeater_y * submodule_repeater_y * crystal_repeater_y / 2 - 1;
153+
if (half_block < 0 )
154+
half_block = 0;
155+
#else
156+
half_block = 0;
157+
#endif
149158
}
150159

151160
void

src/IO/InputStreamFromROOTFileForECATPET.cxx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ get_next_record(CListRecordROOT& record)
9696

9797
// GATE counts crystal ID =0 the most negative. Therefore
9898
// ID = 0 should be negative, in Rsector 0 and the mid crystal ID be 0 .
99+
#if STIR_ROOT_ROTATION_AS_V4
99100
crystal1 -= half_block;
100101
crystal2 -= half_block;
102+
#endif
101103

102104
// Add offset
103105
crystal1 += offset_dets;
@@ -125,6 +127,13 @@ InputStreamFromROOTFileForECATPET::set_defaults()
125127
base_type::set_defaults();
126128
block_repeater_y = -1;
127129
block_repeater_z = -1;
130+
#if STIR_ROOT_ROTATION_AS_V4
131+
half_block = crystal_repeater_y / 2 - 1;
132+
if (half_block < 0 )
133+
half_block = 0;
134+
#else
135+
half_block = 0;
136+
#endif
128137
}
129138

130139
void

src/cmake/STIRConfig.h.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,6 @@ namespace stir {
8888
#endif
8989

9090
#cmakedefine STIR_PROJECTORS_AS_V3
91+
#cmakedefine STIR_ROOT_ROTATION_AS_V4
9192
#cmakedefine STIR_LEGACY_IGNORE_VIEW_OFFSET
9293
#endif // __stir_config__H__

0 commit comments

Comments
 (0)