STIR 6.4.0
ProjDataFromStream.inl
Go to the documentation of this file.
1//
2//
15/*
16 Copyright (C) 2000 PARAPET partners
17 Copyright (C) 2000 - 2009-06-22, Hammersmith Imanet Ltd
18 Copyright (C) 2012-06-06 - 2013, Kris Thielemans
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
26START_NAMESPACE_STIR
27
28// ProjDataFromStream::ProjDataFromStream()
29//{}
30
31ProjDataFromStream::StorageOrder
33{
34 return storage_order;
35}
36
37int
38ProjDataFromStream::find_segment_index_in_sequence(const int segment_num) const
39{
40 std::vector<int>::const_iterator iter = std::find(segment_sequence.begin(), segment_sequence.end(), segment_num);
41 // TODO do some proper error handling here
42 assert(iter != segment_sequence.end());
43 return static_cast<int>(iter - segment_sequence.begin());
44}
45
46std::streamoff
48{
49 return offset;
50}
51
54{
55 return on_disk_data_type;
56}
57
60{
61 return on_disk_byte_order;
62}
63
64std::vector<int>
66{
67 return segment_sequence;
68}
69
70std::vector<int>
72{
73 return timing_poss_sequence;
74}
75
76#if 0
77// this does not make a lot of sense. How to compare files etc. ?
78bool
79ProjDataFromStream::operator ==(const ProjDataFromStream& proj)
80{
81
82 return
83 (*get_proj_data_info_sptr())== *(proj.get_proj_data_info_sptr())&&
84 (scale_factor ==proj.scale_factor)&&
85 (get_segment_sequence_in_stream()==proj.get_segment_sequence_in_stream())&&
86 (get_offset_in_stream()==proj.get_offset_in_stream()) &&
87 (on_disk_data_type == proj.get_data_type_in_stream())&&
88 (get_byte_order_in_stream() == proj.get_byte_order_in_stream()) ;
89}
90
91#endif
92
93END_NAMESPACE_STIR
This class provides member functions to find out what byte-order your machine is and to swap numbers.
Definition ByteOrder.h:100
virtual shared_ptr< const ProjDataInfo > get_proj_data_info_sptr() const
Get shared pointer to ProjData info.
Definition DataWithProjDataInfo.cxx:37
provides names for some numeric types and methods for finding their properties.
Definition NumericType.h:55
A class which reads/writes projection data from/to a (binary) stream.
Definition ProjDataFromStream.h:57
NumericType get_data_type_in_stream() const
Get the data_type in the stream.
Definition ProjDataFromStream.inl:53
std::vector< int > get_segment_sequence_in_stream() const
Get the segment sequence.
Definition ProjDataFromStream.inl:65
ByteOrder get_byte_order_in_stream() const
Get the byte order.
Definition ProjDataFromStream.inl:59
std::vector< int > get_timing_poss_sequence_in_stream() const
Get the timing bins sequence.
Definition ProjDataFromStream.inl:71
StorageOrder get_storage_order() const
Obtain the storage order.
Definition ProjDataFromStream.inl:32
std::streamoff get_offset_in_stream() const
Get the offset -Changed into streamoff from int.
Definition ProjDataFromStream.inl:47