STIR 6.4.0
LmToProjData.h
Go to the documentation of this file.
1#ifndef __stir_listmode_LmToProjData_H__
2#define __stir_listmode_LmToProjData_H__
3//
4//
17/*
18 Copyright (C) 2000- 2009, Hammersmith Imanet Ltd
19 Copyright (C) 2017, University of Hull
20 Copyright (C) 2019, National Physical Laboratory
21 Copyright (C) 2019, 2021, University College of London
22 This file is part of STIR.
23
24 SPDX-License-Identifier: Apache-2.0
25
26 See STIR/LICENSE.txt for details
27*/
28
30#include "stir/ProjDataInfo.h"
32#include "stir/ParsingObject.h"
34
36
37START_NAMESPACE_STIR
38
39class ListEvent;
40class ListTime;
41
166
168{
169public:
171
172 LmToProjData(const char* const par_filename);
173
175
176 LmToProjData();
177
184
194 void set_template_proj_data_info_sptr(shared_ptr<const ProjDataInfo>);
196
200 shared_ptr<const ProjDataInfo> get_template_proj_data_info_sptr() const;
201
203
204 virtual void set_input_data(const shared_ptr<ExamData>&);
206
207 virtual void set_input_data(const std::string& filename);
208#if 0
210
211 virtual ListModeData& get_input_data() const;
212#endif
213
214 void set_output_filename_prefix(const std::string&);
215 std::string get_output_filename_prefix() const;
216
218
219 void set_output_projdata_sptr(shared_ptr<ProjData>&);
220
221 void set_store_prompts(bool);
222 bool get_store_prompts() const;
223 void set_store_delayeds(bool);
224 bool get_store_delayeds() const;
226
227 double get_last_processed_lm_rel_time() const;
228 void set_num_segments_in_memory(int);
229 int get_num_segments_in_memory() const;
230 void set_num_events_to_store(long int);
231 long int get_num_events_to_store() const;
232 void set_time_frame_definitions(const TimeFrameDefinitions&);
233 const TimeFrameDefinitions& get_time_frame_definitions() const;
235
237
238 virtual Succeeded set_up() override;
239
241
242 virtual void process_data() override;
243
244#if 0
249 void run_tof_test_function();
250#endif
251
252protected:
254
255 virtual void start_new_time_frame(const unsigned int new_frame_num);
256
258 virtual void process_new_time_event(const ListTime&);
259
261
266 virtual void get_bin_from_event(Bin& bin, const ListEvent&) const;
267
269
272 int get_compression_count(const Bin& bin) const;
273
275
278 void do_post_normalisation(Bin& bin) const;
279
281
282 void set_defaults() override;
283 void initialise_keymap() override;
284 bool post_processing() override;
286
288 //{@
289 std::string input_filename;
290 std::string output_filename_prefix;
291 std::string template_proj_data_name;
293
295 bool do_pre_normalisation;
296 bool store_prompts;
297 bool store_delayeds;
298
299 int num_segments_in_memory;
300 int num_timing_poss_in_memory;
301 long int num_events_to_store;
302 int max_segment_num_to_process;
303
305
307
308 shared_ptr<ProjDataInfo> template_proj_data_info_ptr;
310 shared_ptr<BinNormalisation> normalisation_ptr;
312 shared_ptr<BinNormalisation> post_normalisation_ptr;
314 shared_ptr<ProjData> output_proj_data_sptr;
315
317
319 shared_ptr<ListModeData> lm_data_ptr;
320
323
327
328 unsigned int current_frame_num;
329
331
332 shared_ptr<const ProjDataInfo> proj_data_info_cyl_uncompressed_ptr;
333
340
343};
344
345END_NAMESPACE_STIR
346
347#endif
Declaration of class stir::BinNormalisation.
Declaration of class stir::ListModeData.
Abstract base class for listmode to projection data conversion.
Declaration of class stir::ParsingObject.
Declaration of class stir::ProjDataInfo.
Declaration of class stir::TimeFrameDefinitions.
A class for storing coordinates and value of a single projection bin.
Definition Bin.h:49
Class for storing and using gamma events from a list mode file.
Definition ListEvent.h:46
The base class for reading list mode data.
Definition ListModeData.h:123
A class for storing and using a timing record from a listmode file.
Definition ListTime.h:47
This class is the abstract base class fir binning listmode data to projection data,...
Definition LmToProjDataAbstract.h:39
void initialise_keymap() override
Initialise all keywords.
Definition LmToProjData.cxx:288
int get_compression_count(const Bin &bin) const
A function that should return the number of uncompressed bins in the current bin.
Definition LmToProjData.cxx:597
void do_post_normalisation(Bin &bin) const
Computes a post-normalisation factor (if any) for this bin.
Definition LmToProjData.cxx:559
bool do_time_frame
variable that will be set according to if we are using time frames or num_events_to_store
Definition LmToProjData.h:337
shared_ptr< const ProjDataInfo > proj_data_info_cyl_uncompressed_ptr
Internal variable that will be used for pre-normalisation.
Definition LmToProjData.h:332
bool post_processing() override
This will be called at the end of the parsing.
Definition LmToProjData.cxx:316
int delayed_increment
A variable that will be set to 1,0 or -1, according to store_prompts and store_delayeds.
Definition LmToProjData.h:339
virtual void process_new_time_event(const ListTime &)
will be called after a new timing event is found in the file
Definition LmToProjData.cxx:611
double current_time
stores the time (in secs) recorded in the previous timing event
Definition LmToProjData.h:325
virtual void set_input_data(const shared_ptr< ExamData > &)
set input data
Definition LmToProjData.cxx:155
shared_ptr< BinNormalisation > normalisation_ptr
This will be used for pre-normalisation.
Definition LmToProjData.h:310
shared_ptr< const ProjDataInfo > get_template_proj_data_info_sptr() const
Get the current template.
Definition LmToProjData.cxx:149
virtual void get_bin_from_event(Bin &bin, const ListEvent &) const
will be called to get the bin for a coincidence event
Definition LmToProjData.cxx:503
void set_defaults() override
Set defaults before parsing.
Definition LmToProjData.cxx:272
shared_ptr< ProjData > output_proj_data_sptr
This will be used to return the output directly, if set.
Definition LmToProjData.h:314
shared_ptr< BinNormalisation > post_normalisation_ptr
This will be used for post-normalisation.
Definition LmToProjData.h:312
virtual Succeeded set_up() override
Perform various checks.
Definition LmToProjData.cxx:346
LmToProjData(const char *const par_filename)
Constructor taking a filename for a parameter file.
Definition LmToProjData.cxx:485
virtual void process_data() override
This function does the actual work.
Definition LmToProjData.cxx:625
std::string frame_definition_filename
frame definitions
Definition LmToProjData.h:294
bool interactive
Toggle readable output on stdout or actual projdata.
Definition LmToProjData.h:306
void set_output_projdata_sptr(shared_ptr< ProjData > &)
set projdata to be filled with output
Definition LmToProjData.cxx:202
void set_template_proj_data_info_sptr(shared_ptr< const ProjDataInfo >)
Optional proj data_info to use as "template".
Definition LmToProjData.cxx:139
TimeFrameDefinitions frame_defs
Time frames.
Definition LmToProjData.h:322
double get_last_processed_lm_rel_time() const
Returns the last processed timestamp in the listmode file.
Definition LmToProjData.cxx:196
bool _already_setup
an internal bool variable to check if the object has been set-up or not
Definition LmToProjData.h:342
virtual void start_new_time_frame(const unsigned int new_frame_num)
will be called when a new time frame starts
Definition LmToProjData.cxx:615
unsigned int current_frame_num
stores the current frame number
Definition LmToProjData.h:328
shared_ptr< ListModeData > lm_data_ptr
Pointer to the actual data.
Definition LmToProjData.h:319
a class containing an enumeration type that can be used by functions to signal successful operation o...
Definition Succeeded.h:44
Class used for storing time frame durations.
Definition TimeFrameDefinitions.h:39