STIR  6.2.0
ECAT8_32bitListmodeInputFileFormat.h
Go to the documentation of this file.
1 #ifndef __stir_IO_ECAT8_32bitListmodeInputFileFormat_h__
2 #define __stir_IO_ECAT8_32bitListmodeInputFileFormat_h__
3 /*
4  Copyright (C) 2013 University College London
5  This file is part of STIR.
6 
7  SPDX-License-Identifier: Apache-2.0
8 
9  See STIR/LICENSE.txt for details
10 */
20 #include "stir/IO/interfile.h"
22 //#include "stir/listmode/CListRecordECAT8_32bit.h"
23 
24 #include "stir/utilities.h"
25 #include "stir/error.h"
26 #include <string>
27 
28 START_NAMESPACE_STIR
29 namespace ecat
30 {
31 
33 
37 {
38 public:
39  const std::string get_name() const override { return "ECAT8_32bit"; }
40 
41 protected:
42  bool actual_can_read(const FileSignature& signature, std::istream& input) const override
43  {
44  if (!is_interfile_signature(signature.get_signature()))
45  return false;
46  else
47  {
48  const std::string signature_as_string(signature.get_signature(), signature.size());
49  return signature_as_string.find("PETLINK") != std::string::npos;
50  }
51  }
52 
53 public:
54  unique_ptr<data_type> read_from_file(std::istream& input) const override
55  {
56  error("read_from_file for ECAT8_32bit listmode data with istream not implemented %s:%s. Sorry", __FILE__, __LINE__);
57  return unique_ptr<data_type>();
58  }
59  unique_ptr<data_type> read_from_file(const std::string& filename) const override
60  {
61  return unique_ptr<data_type>(new CListModeDataECAT8_32bit(filename));
62  }
63 };
64 
65 } // namespace ecat
66 END_NAMESPACE_STIR
67 
68 #endif
bool is_interfile_signature(const char *const signature)
Checks if the signature corresponds to the start of an interfile header.
Definition: interfile.cxx:75
A class to read/store the file signature.
Definition: FileSignature.h:34
unique_ptr< data_type > read_from_file(std::istream &input) const override
read data from a stream
Definition: ECAT8_32bitListmodeInputFileFormat.h:54
This file declares various utility functions.
Declaration of class stir::InputFileFormat.
Declarations of functions which read/write Interfile data.
Declaration of stir::error()
const char * get_signature() const
get access to the signature
Definition: FileSignature.h:52
unique_ptr< data_type > read_from_file(const std::string &filename) const override
read data from a filename
Definition: ECAT8_32bitListmodeInputFileFormat.h:59
Base-class for file-formats for reading.
Definition: InputFileFormat.h:39
A class that reads the listmode data for Siemens scanners.
Definition: CListModeDataECAT8_32bit.h:42
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition: error.cxx:42
std::size_t size() const
return size of valid signature read from the file
Definition: FileSignature.h:55
Class for being able to read list mode data from the ECAT 8_32bit scanner via the listmode-data regis...
Definition: ECAT8_32bitListmodeInputFileFormat.h:36
Declaration of class stir::ecat::CListModeDataECAT8_32bit.