Skip to content

Commit 041f6de

Browse files
clean-up some unnecessary #includes and code
ProjDataInfoBlocksOnCylindrical is identical to ProjDataInfoGeneric and should not be used any more. I removed some dynamic checks on ProjDataInfoBlocksOnCylindrical and use the fall-back to generic. Note however that this code was never used, as currently the ProjDataInfoCylindrical case will always be used.
1 parent a971677 commit 041f6de

File tree

5 files changed

+18
-114
lines changed

5 files changed

+18
-114
lines changed

documentation/release_6.3.htm

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ <h3>Changed functionality</h3>
101101
<ul>
102102
<li>
103103
Made 2 (deprecated) members of <code>ProjDataInfoBlocksOnCylindricalNoArcCorr</code> <code>private</code>
104+
and do some clean-up of which files to include.
104105
<br>
105106
<a href="https://github.com/UCL/STIR/pull/1556">PR #1556</a>
106107
</li>

src/IO/interfile.cxx

Lines changed: 10 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,12 +1334,11 @@ write_basic_interfile_PDFS_header(const string& header_file_name, const string&
13341334
else
13351335
{
13361336
// !author Parisa Khateri
1337-
const shared_ptr<const ProjDataInfoBlocksOnCylindrical> proj_data_info_sptr
1338-
= dynamic_pointer_cast<const ProjDataInfoBlocksOnCylindrical>(pdfs.get_proj_data_info_sptr());
1337+
// generic (and hence BlocksOnCylindrical) scanner
1338+
const auto proj_data_info_sptr = dynamic_pointer_cast<const ProjDataInfoGeneric>(pdfs.get_proj_data_info_sptr());
13391339

13401340
if (proj_data_info_sptr != NULL)
13411341
{
1342-
// BlocksOncylindrical scanners
13431342
output_header << "minimum ring difference per segment := ";
13441343
{
13451344
std::vector<int>::const_iterator seg = segment_sequence.begin();
@@ -1359,66 +1358,18 @@ write_basic_interfile_PDFS_header(const string& header_file_name, const string&
13591358
}
13601359

13611360
const Scanner& scanner = *proj_data_info_sptr->get_scanner_ptr();
1362-
#if 0 // KT commented out. currently no get_ring_radius() anymore
1363-
if (fabs(proj_data_info_sptr->get_ring_radius()-
1364-
scanner.get_effective_ring_radius()) > .1)
1365-
warning("write_basic_interfile_PDFS_header: inconsistent effective ring radius:\n"
1366-
"\tproj_data_info has %g, scanner has %g.\n"
1367-
"\tThis really should not happen and signifies a bug.\n"
1368-
"\tYou will have a problem reading this data back in.",
1369-
proj_data_info_sptr->get_ring_radius(),
1370-
scanner.get_effective_ring_radius());
1371-
#endif
1372-
if (fabs(proj_data_info_sptr->get_ring_spacing() - scanner.get_ring_spacing()) > .1)
1373-
warning("write_basic_interfile_PDFS_header: inconsistent ring spacing:\n"
1374-
"\tproj_data_info has %g, scanner has %g.\n"
1375-
"\tThis really should not happen and signifies a bug.\n"
1376-
"\tYou will have a problem reading this data back in.",
1377-
proj_data_info_sptr->get_ring_spacing(),
1378-
scanner.get_ring_spacing());
13791361

13801362
output_header << scanner.parameter_info();
13811363

1382-
} // end of BlocksOnCylindrical scanner
1383-
else // generic scanner
1364+
} // end generic scanner
1365+
else if (!dynamic_pointer_cast<const ProjDataInfoSubsetByView>(pdfs.get_proj_data_info_sptr()))
13841366
{
1385-
const shared_ptr<const ProjDataInfoGeneric> proj_data_info_sptr
1386-
= dynamic_pointer_cast<const ProjDataInfoGeneric>(pdfs.get_proj_data_info_sptr());
1387-
1388-
if (proj_data_info_sptr != NULL)
1389-
{
1390-
output_header << "minimum ring difference per segment := ";
1391-
{
1392-
std::vector<int>::const_iterator seg = segment_sequence.begin();
1393-
output_header << "{ " << proj_data_info_sptr->get_min_ring_difference(*seg);
1394-
for (seg++; seg != segment_sequence.end(); seg++)
1395-
output_header << "," << proj_data_info_sptr->get_min_ring_difference(*seg);
1396-
output_header << "}\n";
1397-
}
1398-
1399-
output_header << "maximum ring difference per segment := ";
1400-
{
1401-
std::vector<int>::const_iterator seg = segment_sequence.begin();
1402-
output_header << "{ " << proj_data_info_sptr->get_max_ring_difference(*seg);
1403-
for (seg++; seg != segment_sequence.end(); seg++)
1404-
output_header << "," << proj_data_info_sptr->get_max_ring_difference(*seg);
1405-
output_header << "}\n";
1406-
}
1407-
1408-
const Scanner& scanner = *proj_data_info_sptr->get_scanner_ptr();
1409-
1410-
output_header << scanner.parameter_info();
1411-
1412-
} // end generic scanner
1413-
else if (!dynamic_pointer_cast<const ProjDataInfoSubsetByView>(pdfs.get_proj_data_info_sptr()))
1414-
{
1415-
error("write_basic_interfile_PDFS_header: cannot write subset data yet. Sorry");
1416-
}
1417-
else
1418-
{
1419-
error("write_basic_interfile_PDFS_header: Error casting the projdata to one of its geometries: "
1420-
"Cylindrical/BlocksOnCylindrical/Generic");
1421-
}
1367+
error("write_basic_interfile_PDFS_header: cannot write subset data yet. Sorry");
1368+
}
1369+
else
1370+
{
1371+
error("write_basic_interfile_PDFS_header: Error casting the projdata to one of its geometries: "
1372+
"Cylindrical/BlocksOnCylindrical/Generic");
14221373
}
14231374
}
14241375

src/buildblock/ProjDataInfoBlocksOnCylindricalNoArcCorr.cxx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include "stir/LORCoordinates.h"
3030
#include "stir/round.h"
3131
#include "stir/DetectionPosition.h"
32+
#include "stir/DetectionPositionPair.h"
3233
#include "stir/error.h"
3334
#include <iostream>
3435
#include <fstream>

src/buildblock/VoxelsOnCartesianGrid.cxx

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -77,28 +77,9 @@ find_sampling_and_z_size(float& z_sampling, float& s_sampling, int& z_size, cons
7777
? proj_data_info_cyl_ptr->get_num_axial_poss(0)
7878
: 2 * proj_data_info_cyl_ptr->get_num_axial_poss(0) - 1;
7979
}
80-
else if (const ProjDataInfoBlocksOnCylindrical* proj_data_info_blk_ptr
81-
= dynamic_cast<const ProjDataInfoBlocksOnCylindrical*>(proj_data_info_ptr))
82-
{
83-
// the case of BlocksOnCylindrical data
84-
85-
z_sampling = proj_data_info_blk_ptr->get_ring_spacing() / 2;
86-
87-
// for 'span>1' case, we take z_size = number of sinograms in segment 0
88-
// for 'span==1' case, we take 2*num_rings-1
89-
90-
// first check if we have segment 0
91-
assert(proj_data_info_blk_ptr->get_min_segment_num() <= 0);
92-
assert(proj_data_info_blk_ptr->get_max_segment_num() >= 0);
93-
94-
if (z_size < 0)
95-
z_size = proj_data_info_blk_ptr->get_max_ring_difference(0) > proj_data_info_blk_ptr->get_min_ring_difference(0)
96-
? proj_data_info_blk_ptr->get_num_axial_poss(0)
97-
: 2 * proj_data_info_blk_ptr->get_num_axial_poss(0) - 1;
98-
}
9980
else if (const ProjDataInfoGeneric* proj_data_info_gen_ptr = dynamic_cast<const ProjDataInfoGeneric*>(proj_data_info_ptr))
10081
{
101-
// the case of Generic data
82+
// the case of Generic (and therefore BlocksOnCylindrical) data
10283

10384
z_sampling = proj_data_info_gen_ptr->get_ring_spacing() / 2;
10485

src/include/stir/ProjDataInfoBlocksOnCylindricalNoArcCorr.h

Lines changed: 5 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
#define __stir_ProjDataInfoBlocksOnCylindricalNoArcCorr_H__
2525

2626
#include "stir/ProjDataInfoGenericNoArcCorr.h"
27-
#include "stir/ProjDataInfoBlocksOnCylindrical.h"
28-
#include "stir/GeometryBlocksOnCylindrical.h"
29-
#include "stir/DetectionPositionPair.h"
3027
#include "stir/VectorWithOffset.h"
3128
#include "stir/CartesianCoordinate3D.h"
3229

@@ -40,39 +37,12 @@ class BlocksTests;
4037
\ingroup projdata
4138
\brief Projection data info for data from a scanner with discrete dtectors organised by blocks
4239
43-
This class also contains some functions specific for (static) full-ring PET
40+
This class also contains 2 deprecated functions specific for (static) full-ring PET
4441
scanners. In this case, it is assumed that for 'raw' data (i.e. no mashing)
45-
sinogram space is 'interleaved': 2 adjacent LOR_angles are
46-
merged to 1 'view', while the corresponding bins are
47-
interleaved:
48-
49-
\verbatim
50-
before interleaving after interleaving
51-
a00 a01 a02 ... view 0: a00 a10 a01 a11 ...
52-
a10 a11 ...
53-
a20 a21 a22 ... view 1: a20 a30 a21 a31 ...
54-
a30 a31 ...
55-
\endverbatim
56-
This (standard) interleaving is done because for 'odd' LOR_angles there
57-
is no LOR which goes through the origin.
58-
59-
60-
\par Interchanging the 2 detectors
61-
62-
When the ring difference = 0 (i.e. a 2D - or direct - sinogram),
63-
interchanging the 2 detectors does not change the LOR. This is why
64-
(in 2D) one gets away with a full sinogram size of
65-
num_views * 2 * num_views, where the size of 'detector-space' is
66-
twice as large.
67-
However, in 3D, interchanging the detectors, also interchanges the
68-
rings. One has 2 options:
69-
- have 1 sinogram with twice as many views, together with the rings
70-
as 'unordered pair' (i.e. ring_difference is always >0)
71-
- have 2 sinograms of the same size as in 2D, together with the rings
72-
as 'ordered pair' (i.e. ring_difference can be positive and negative).
73-
In STIR, we use the second convention.
74-
75-
*/
42+
sinogram space is 'interleaved'. See documentation for ProjDataInfoCylindricalNoArcCorr.
43+
44+
\deprecated This class will be removed in v7.0.
45+
*/
7646
class ProjDataInfoBlocksOnCylindricalNoArcCorr : public ProjDataInfoGenericNoArcCorr
7747
{
7848
private:

0 commit comments

Comments
 (0)