STIR 6.5.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
30#include "stir/Bin.h"
33#include "stir/LORCoordinates.h"
34#include <iostream>
35#include <vector>
36
37START_NAMESPACE_STIR
38
51
52template <typename elemT>
53inline std::ostream& operator<<(std::ostream& str, const VectorWithOffset<elemT>& v);
54
64template <int num_dimensions, typename coordT>
65inline std::ostream& operator<<(std::ostream& str, const BasicCoordinate<num_dimensions, coordT>& v);
66
78template <typename elemT>
79inline std::ostream& operator<<(std::ostream& str, const std::vector<elemT>& v);
80
90inline std::ostream&
91operator<<(std::ostream& out, const Bin& bin)
92{
93 return out << "[segment_num=" << bin.segment_num() << ", axial_pos_num=" << bin.axial_pos_num()
94 << ", view_num=" << bin.view_num() << ", tangential_pos_num=" << bin.tangential_pos_num()
95 << ", timing_pos_num=" << bin.timing_pos_num() << ", time_frame_num=" << bin.time_frame_num()
96 << ", value=" << bin.get_bin_value() << "]";
97}
98
108template <class T>
109inline std::ostream&
110operator<<(std::ostream& out, const DetectionPosition<T>& det_pos)
111{
112 return out << "[tangential=" << det_pos.tangential_coord() << ", axial=" << det_pos.axial_coord()
113 << ", radial=" << det_pos.radial_coord() << "]";
114}
115
125template <class T>
126inline std::ostream&
127operator<<(std::ostream& out, const DetectionPositionPair<T>& det_pos)
128{
129 return out << "[pos1=" << det_pos.pos1() << ", pos2=" << det_pos.pos2() << ", timing_pos=" << det_pos.timing_pos() << "]";
130}
131
141template <class T>
142inline std::ostream&
143operator<<(std::ostream& out, const LORAs2Points<T>& lor)
144{
145 return out << "[pos1=" << lor.p1() << ", pos2=" << lor.p2() << "]";
146}
147
157template <class T>
158inline std::ostream&
159operator<<(std::ostream& out, const LORInAxialAndNoArcCorrSinogramCoordinates<T>& lor)
160{
161 return out << "[z1=" << lor.z1() << ", z2=" << lor.z2() << ", phi=" << lor.phi() << ", beta=" << lor.beta()
162 << ", is_swapped=" << lor.is_swapped() << "]";
163}
164
180template <typename elemT>
181inline std::istream& operator>>(std::istream& str, std::vector<elemT>& v);
182
207template <typename elemT>
208inline std::istream& operator>>(std::istream& str, VectorWithOffset<elemT>& v);
209
226template <int num_dimensions, typename coordT>
227inline std::istream& operator>>(std::istream& str, BasicCoordinate<num_dimensions, coordT>& v);
228
229END_NAMESPACE_STIR
230
231#include "stir/stream.inl"
232
233#endif
This file declares class stir::BasicCoordinate and some functions acting on stir::BasicCoordinate obj...
Declaration of class stir::Bin.
Declaration of class stir::DetectionPositionPair.
Declaration of class stir::DetectionPosition.
defines various classes for specifying a line in 3 dimensions
defines the stir::VectorWithOffset class
A class for storing coordinates and value of a single projection bin.
Definition Bin.h:49
int time_frame_num() const
get time-frame number (1-based)
Definition Bin.inl:82
float get_bin_value() const
get the value after forward projection
Definition Bin.inl:123
int tangential_pos_num() const
get tangential position number
Definition Bin.inl:76
int axial_pos_num() const
get axial position number
Definition Bin.inl:70
A class for storing 2 coordinates-sets of a detection, together with a timing-position index (for TOF...
Definition DetectionPositionPair.h:41
A class for storing coordinates of a detection.
Definition DetectionPosition.h:61
A class for LORs.
Definition LORCoordinates.h:296
A class for LORs.
Definition LORCoordinates.h:511
bool is_swapped() const override
Return if the LOR direction is opposite from normal.
Definition LORCoordinates.h:571
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 view_num() const
get view number for const objects
Definition ViewgramIndices.inl:36
Input/output of basic vector-like types to/from streams.