Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor clean-up of ProjDataInfoBlocksOnCylindricalNoArcCorr #1556

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion documentation/release_6.3.htm
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,14 @@ <h3>New functionality</h3>
</li>

<h3>Changed functionality</h3>

<ul>
<li>
Made 2 (deprecated) members of <code>ProjDataInfoBlocksOnCylindricalNoArcCorr</code> <code>private</code>
and do some clean-up of which files to include.
<br>
<a href="https://github.com/UCL/STIR/pull/1556">PR #1556</a>
</li>
</ul>

<h3>Bug fixes</h3>
<ul>
Expand Down
69 changes: 10 additions & 59 deletions src/IO/interfile.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1334,12 +1334,11 @@ write_basic_interfile_PDFS_header(const string& header_file_name, const string&
else
{
// !author Parisa Khateri
const shared_ptr<const ProjDataInfoBlocksOnCylindrical> proj_data_info_sptr
= dynamic_pointer_cast<const ProjDataInfoBlocksOnCylindrical>(pdfs.get_proj_data_info_sptr());
// generic (and hence BlocksOnCylindrical) scanner
const auto proj_data_info_sptr = dynamic_pointer_cast<const ProjDataInfoGeneric>(pdfs.get_proj_data_info_sptr());

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

const Scanner& scanner = *proj_data_info_sptr->get_scanner_ptr();
#if 0 // KT commented out. currently no get_ring_radius() anymore
if (fabs(proj_data_info_sptr->get_ring_radius()-
scanner.get_effective_ring_radius()) > .1)
warning("write_basic_interfile_PDFS_header: inconsistent effective ring radius:\n"
"\tproj_data_info has %g, scanner has %g.\n"
"\tThis really should not happen and signifies a bug.\n"
"\tYou will have a problem reading this data back in.",
proj_data_info_sptr->get_ring_radius(),
scanner.get_effective_ring_radius());
#endif
if (fabs(proj_data_info_sptr->get_ring_spacing() - scanner.get_ring_spacing()) > .1)
warning("write_basic_interfile_PDFS_header: inconsistent ring spacing:\n"
"\tproj_data_info has %g, scanner has %g.\n"
"\tThis really should not happen and signifies a bug.\n"
"\tYou will have a problem reading this data back in.",
proj_data_info_sptr->get_ring_spacing(),
scanner.get_ring_spacing());

output_header << scanner.parameter_info();

} // end of BlocksOnCylindrical scanner
else // generic scanner
} // end generic scanner
else if (!dynamic_pointer_cast<const ProjDataInfoSubsetByView>(pdfs.get_proj_data_info_sptr()))
{
const shared_ptr<const ProjDataInfoGeneric> proj_data_info_sptr
= dynamic_pointer_cast<const ProjDataInfoGeneric>(pdfs.get_proj_data_info_sptr());

if (proj_data_info_sptr != NULL)
{
output_header << "minimum ring difference per segment := ";
{
std::vector<int>::const_iterator seg = segment_sequence.begin();
output_header << "{ " << proj_data_info_sptr->get_min_ring_difference(*seg);
for (seg++; seg != segment_sequence.end(); seg++)
output_header << "," << proj_data_info_sptr->get_min_ring_difference(*seg);
output_header << "}\n";
}

output_header << "maximum ring difference per segment := ";
{
std::vector<int>::const_iterator seg = segment_sequence.begin();
output_header << "{ " << proj_data_info_sptr->get_max_ring_difference(*seg);
for (seg++; seg != segment_sequence.end(); seg++)
output_header << "," << proj_data_info_sptr->get_max_ring_difference(*seg);
output_header << "}\n";
}

const Scanner& scanner = *proj_data_info_sptr->get_scanner_ptr();

output_header << scanner.parameter_info();

} // end generic scanner
else if (!dynamic_pointer_cast<const ProjDataInfoSubsetByView>(pdfs.get_proj_data_info_sptr()))
{
error("write_basic_interfile_PDFS_header: cannot write subset data yet. Sorry");
}
else
{
error("write_basic_interfile_PDFS_header: Error casting the projdata to one of its geometries: "
"Cylindrical/BlocksOnCylindrical/Generic");
}
error("write_basic_interfile_PDFS_header: cannot write subset data yet. Sorry");
}
else
{
error("write_basic_interfile_PDFS_header: Error casting the projdata to one of its geometries: "
"Cylindrical/BlocksOnCylindrical/Generic");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "stir/LORCoordinates.h"
#include "stir/round.h"
#include "stir/DetectionPosition.h"
#include "stir/DetectionPositionPair.h"
#include "stir/error.h"
#include <iostream>
#include <fstream>
Expand Down
21 changes: 1 addition & 20 deletions src/buildblock/VoxelsOnCartesianGrid.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,28 +77,9 @@ find_sampling_and_z_size(float& z_sampling, float& s_sampling, int& z_size, cons
? proj_data_info_cyl_ptr->get_num_axial_poss(0)
: 2 * proj_data_info_cyl_ptr->get_num_axial_poss(0) - 1;
}
else if (const ProjDataInfoBlocksOnCylindrical* proj_data_info_blk_ptr
= dynamic_cast<const ProjDataInfoBlocksOnCylindrical*>(proj_data_info_ptr))
{
// the case of BlocksOnCylindrical data

z_sampling = proj_data_info_blk_ptr->get_ring_spacing() / 2;

// for 'span>1' case, we take z_size = number of sinograms in segment 0
// for 'span==1' case, we take 2*num_rings-1

// first check if we have segment 0
assert(proj_data_info_blk_ptr->get_min_segment_num() <= 0);
assert(proj_data_info_blk_ptr->get_max_segment_num() >= 0);

if (z_size < 0)
z_size = proj_data_info_blk_ptr->get_max_ring_difference(0) > proj_data_info_blk_ptr->get_min_ring_difference(0)
? proj_data_info_blk_ptr->get_num_axial_poss(0)
: 2 * proj_data_info_blk_ptr->get_num_axial_poss(0) - 1;
}
else if (const ProjDataInfoGeneric* proj_data_info_gen_ptr = dynamic_cast<const ProjDataInfoGeneric*>(proj_data_info_ptr))
{
// the case of Generic data
// the case of Generic (and therefore BlocksOnCylindrical) data

z_sampling = proj_data_info_gen_ptr->get_ring_spacing() / 2;

Expand Down
47 changes: 12 additions & 35 deletions src/include/stir/ProjDataInfoBlocksOnCylindricalNoArcCorr.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,52 +24,25 @@
#define __stir_ProjDataInfoBlocksOnCylindricalNoArcCorr_H__

#include "stir/ProjDataInfoGenericNoArcCorr.h"
#include "stir/ProjDataInfoBlocksOnCylindrical.h"
#include "stir/GeometryBlocksOnCylindrical.h"
#include "stir/DetectionPositionPair.h"
#include "stir/VectorWithOffset.h"
#include "stir/CartesianCoordinate3D.h"

START_NAMESPACE_STIR

class Succeeded;
class ProjDataInfoTests;
class BlocksTests;

/*!
\ingroup projdata
\brief Projection data info for data from a scanner with discrete dtectors organised by blocks

This class also contains some functions specific for (static) full-ring PET
This class also contains 2 deprecated functions specific for (static) full-ring PET
scanners. In this case, it is assumed that for 'raw' data (i.e. no mashing)
sinogram space is 'interleaved': 2 adjacent LOR_angles are
merged to 1 'view', while the corresponding bins are
interleaved:

\verbatim
before interleaving after interleaving
a00 a01 a02 ... view 0: a00 a10 a01 a11 ...
a10 a11 ...
a20 a21 a22 ... view 1: a20 a30 a21 a31 ...
a30 a31 ...
\endverbatim
This (standard) interleaving is done because for 'odd' LOR_angles there
is no LOR which goes through the origin.


\par Interchanging the 2 detectors

When the ring difference = 0 (i.e. a 2D - or direct - sinogram),
interchanging the 2 detectors does not change the LOR. This is why
(in 2D) one gets away with a full sinogram size of
num_views * 2 * num_views, where the size of 'detector-space' is
twice as large.
However, in 3D, interchanging the detectors, also interchanges the
rings. One has 2 options:
- have 1 sinogram with twice as many views, together with the rings
as 'unordered pair' (i.e. ring_difference is always >0)
- have 2 sinograms of the same size as in 2D, together with the rings
as 'ordered pair' (i.e. ring_difference can be positive and negative).
In STIR, we use the second convention.

*/
sinogram space is 'interleaved'. See documentation for ProjDataInfoCylindricalNoArcCorr.

\deprecated This class will be removed in v7.0.
*/
class ProjDataInfoBlocksOnCylindricalNoArcCorr : public ProjDataInfoGenericNoArcCorr
{
private:
Expand Down Expand Up @@ -98,6 +71,7 @@ class ProjDataInfoBlocksOnCylindricalNoArcCorr : public ProjDataInfoGenericNoArc

std::string parameter_info() const override;

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

private:
bool blindly_equals(const root_type* const) const override;
Expand Down
32 changes: 0 additions & 32 deletions src/include/stir/ProjDataInfoBlocksOnCylindricalNoArcCorr.inl

This file was deleted.

Loading