STIR  6.2.0
stream.h
Go to the documentation of this file.
1 //
2 //
13 /*
14  Copyright (C) 2000 PARAPET partners
15  Copyright (C) 2000-2009 Hammersmith Imanet Ltd
16  Copyright (C) 2013 Kris Thielemans
17  Copyright (C) 2023, 2024 University College London
18 
19  This file is part of STIR.
20 
21  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
22 
23  See STIR/LICENSE.txt for details
24 */
25 #ifndef __stir_stream_H__
26 #define __stir_stream_H__
27 
28 #include "stir/VectorWithOffset.h"
29 #include "stir/BasicCoordinate.h"
30 #include "stir/Bin.h"
31 #include "stir/DetectionPosition.h"
33 #include <iostream>
34 #include <vector>
35 
36 START_NAMESPACE_STIR
37 
51 template <typename elemT>
52 inline std::ostream& operator<<(std::ostream& str, const VectorWithOffset<elemT>& v);
53 
63 template <int num_dimensions, typename coordT>
64 inline std::ostream& operator<<(std::ostream& str, const BasicCoordinate<num_dimensions, coordT>& v);
65 
77 template <typename elemT>
78 inline std::ostream& operator<<(std::ostream& str, const std::vector<elemT>& v);
79 
89 inline std::ostream&
90 operator<<(std::ostream& out, const Bin& bin)
91 {
92  return out << "[segment_num=" << bin.segment_num() << ", axial_pos_num=" << bin.axial_pos_num()
93  << ", view_num=" << bin.view_num() << ", tangential_pos_num=" << bin.tangential_pos_num()
94  << ", timing_pos_num=" << bin.timing_pos_num() << ", time_frame_num=" << bin.time_frame_num()
95  << ", value=" << bin.get_bin_value() << "]";
96 }
97 
107 template <class T>
108 inline std::ostream&
109 operator<<(std::ostream& out, const DetectionPosition<T>& det_pos)
110 {
111  return out << "[tangential=" << det_pos.tangential_coord() << ", axial=" << det_pos.axial_coord()
112  << ", radial=" << det_pos.radial_coord() << "]";
113 }
114 
124 template <class T>
125 inline std::ostream&
126 operator<<(std::ostream& out, const DetectionPositionPair<T>& det_pos)
127 {
128  return out << "[pos1=" << det_pos.pos1() << ", pos2=" << det_pos.pos2() << ", timing_pos=" << det_pos.timing_pos() << "]";
129 }
130 
147 template <typename elemT>
148 inline std::istream& operator>>(std::istream& str, std::vector<elemT>& v);
149 
174 template <typename elemT>
175 inline std::istream& operator>>(std::istream& str, VectorWithOffset<elemT>& v);
176 
193 template <int num_dimensions, typename coordT>
194 inline std::istream& operator>>(std::istream& str, BasicCoordinate<num_dimensions, coordT>& v);
195 
196 END_NAMESPACE_STIR
197 
198 #include "stir/stream.inl"
199 
200 #endif
float get_bin_value() const
get the value after forward projection
Definition: Bin.inl:123
This file declares class stir::BasicCoordinate and some functions acting on stir::BasicCoordinate obj...
std::istream & operator>>(std::istream &str, BasicCoordinate< num_dimensions, coordT > &v)
Inputs a coordinate from a stream.
Definition: stream.inl:131
int view_num() const
get view number for const objects
Definition: ViewgramIndices.inl:36
Declaration of class stir::DetectionPosition.
int time_frame_num() const
get time-frame number (1-based)
Definition: Bin.inl:82
A class for storing coordinates and value of a single projection bin.
Definition: Bin.h:48
Declaration of class stir::Bin.
std::ostream & operator<<(std::ostream &out, const DetectionPositionPair< T > &det_pos)
Outputs a DetectionPosition to a stream.Output is of the form.
Definition: stream.h:126
defines the stir::VectorWithOffset class
int segment_num() const
get segment number for const objects
Definition: SegmentIndices.inl:32
int timing_pos_num() const
get TOF index for const objects
Definition: SegmentIndices.inl:44
int tangential_pos_num() const
get tangential position number
Definition: Bin.inl:76
class BasicCoordinate<int num_dimensions, typename coordT> defines num_dimensions -dimensional coordi...
Definition: BasicCoordinate.h:53
Input/output of basic vector-like types to/from streams.
int axial_pos_num() const
get axial position number
Definition: Bin.inl:70
Declaration of class stir::DetectionPositionPair.