Skip to content

Commit 2f521c3

Browse files
Merge pull request #1556 from KrisThielemans/BlocksMinorCleanup
Minor clean-up of ProjDataInfoBlocksOnCylindricalNoArcCorr
2 parents 1ebb4fc + 041f6de commit 2f521c3

6 files changed

+32
-147
lines changed

documentation/release_6.3.htm

+8-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,14 @@ <h3>New functionality</h3>
9898
</li>
9999

100100
<h3>Changed functionality</h3>
101-
101+
<ul>
102+
<li>
103+
Made 2 (deprecated) members of <code>ProjDataInfoBlocksOnCylindricalNoArcCorr</code> <code>private</code>
104+
and do some clean-up of which files to include.
105+
<br>
106+
<a href="https://github.com/UCL/STIR/pull/1556">PR #1556</a>
107+
</li>
108+
</ul>
102109

103110
<h3>Bug fixes</h3>
104111
<ul>

src/IO/interfile.cxx

+10-59
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

+1
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

+1-20
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

+12-35
Original file line numberDiff line numberDiff line change
@@ -24,52 +24,25 @@
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

3330
START_NAMESPACE_STIR
3431

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

9972
std::string parameter_info() const override;
10073

74+
private:
10175
//! \name set of obsolete functions to go between bins<->LORs (will disappear!)
10276
//@{
10377
Succeeded find_scanner_coordinates_given_cartesian_coordinates(int& det1,
@@ -111,6 +85,9 @@ class ProjDataInfoBlocksOnCylindricalNoArcCorr : public ProjDataInfoGenericNoArc
11185
const CartesianCoordinate3D<float>& coord_1,
11286
const CartesianCoordinate3D<float>& coord_2) const;
11387
//@}
88+
// give test classes access to the private members
89+
friend class ProjDataInfoTests;
90+
friend class BlocksTests;
11491

11592
private:
11693
bool blindly_equals(const root_type* const) const override;

src/include/stir/ProjDataInfoBlocksOnCylindricalNoArcCorr.inl

-32
This file was deleted.

0 commit comments

Comments
 (0)