STIR  6.2.0
InputStreamWithRecordsFromUPENN.h
Go to the documentation of this file.
1 
9 /*
10  Copyright (C) 2020-2022 University of Pennsylvania
11  This file is part of STIR.
12 
13  SPDX-License-Identifier: Apache-2.0
14 
15  See STIR/LICENSE.txt for details
16 */
17 #ifndef __stir_IO_InputStreamWithRecordsFromUPENN_H__
18 #define __stir_IO_InputStreamWithRecordsFromUPENN_H__
19 
20 #include "stir/shared_ptr.h"
21 #include "stir/Succeeded.h"
22 #include "stir/RegisteredObject.h"
24 
25 START_NAMESPACE_STIR
26 
40 class InputStreamWithRecordsFromUPENN : public RegisteredObject<InputStreamWithRecordsFromUPENN>
41 {
42 public:
43  typedef std::vector<long long int>::size_type SavedPosition;
44 
46 
47  unsigned long int get_total_number_of_events(CListRecordPENN& record);
48 
49  virtual inline Succeeded create_output_file(const std::string ofilename) = 0;
50 
53  virtual Succeeded set_up();
54 
55  virtual Succeeded get_next_record(CListRecordPENN& record) = 0;
56 
58  virtual Succeeded reset() = 0;
59 
60  virtual SavedPosition save_get_position() = 0;
61 
62  virtual Succeeded set_get_position(const SavedPosition&) = 0;
63 
64  inline std::vector<std::streampos> get_saved_get_positions() const;
65 
66  inline void set_saved_get_positions(const std::vector<std::streampos>&);
67 
68  inline std::streambuf& get_stream()
69  { /*return &this->inputList;*/
70  }
71 
72  // virtual const PET::ListFileHeader* get_file_header() const = 0;
73 
74  virtual void set_current_record() = 0;
75 
76  virtual void set_new_record(const bool& d,
77  const short int& _dt,
78  const unsigned short int& _xa,
79  const unsigned short int& _xb,
80  const unsigned short int& _za,
81  const unsigned short int& _zb,
82  const unsigned short int& _ea,
83  const unsigned short int& _eb)
84  = 0;
85 
86 protected:
87  virtual void set_defaults();
88  virtual void initialise_keymap();
89  virtual bool post_processing();
90 
91  std::string filename;
92  std::streampos starting_stream_position;
93  std::vector<std::streampos> saved_get_positions;
94 
95  // uint8_t current_record[8];
96  const uint8_t* current_record;
97 
98  int eventSize = 0;
99 
100  int low_energy_window = 0;
101  int up_energy_window = 1000;
102 
103  int timeout = 0;
105  long unsigned int N;
107  long unsigned int abrupt_counter;
110  bool has_output = false;
123 };
124 
125 END_NAMESPACE_STIR
126 
127 #include "stir/IO/InputStreamWithRecordsFromUPENN.inl"
128 
129 #endif
long unsigned int N
Total number of events.
Definition: InputStreamWithRecordsFromUPENN.h:105
Declaration of class stir::Succeeded.
int maxE_chan
Maximum energy channel.
Definition: InputStreamWithRecordsFromUPENN.h:116
long unsigned int abrupt_counter
Stop after a predefined number of records, regardless of their type.
Definition: InputStreamWithRecordsFromUPENN.h:107
bool abrupt_stop
This is a lower counter to abruptly stop the listmode file.
Definition: InputStreamWithRecordsFromUPENN.h:112
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
int minE_chan
Minimum energy channel.
Definition: InputStreamWithRecordsFromUPENN.h:114
Base class for reading listmode files from the PENNPet Explorer scanner.
Definition: InputStreamWithRecordsFromUPENN.h:40
Classes for listmode events for the PENNPET Explorer scanner.
bool keep_delayed
In some processes it might be better to filter prompts and delayeds early.
Definition: InputStreamWithRecordsFromUPENN.h:122
Declaration of class stiir::RegisteredObject.
Helper class to provide registry mechanisms to a Base classSuppose you have a hierarchy of classes wi...
Definition: RegisteredObject.h:95
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition: Succeeded.h:43
bool keep_prompt
In some processes it might be better to filter prompts and delayeds early.
Definition: InputStreamWithRecordsFromUPENN.h:119