STIR  6.2.0
stir_ecat6.h
Go to the documentation of this file.
1 //
2 //
14 /*
15  Copyright (C) 2000 PARAPET partners
16  Copyright (C) 2000- 2011, Hammersmith Imanet Ltd
17  This file is part of STIR.
18 
19  SPDX-License-Identifier: Apache-2.0 AND License-ref-PARAPET-license
20 
21  See STIR/LICENSE.txt for details
22 */
23 
24 #ifndef __stir_IO_stir_ecat6_H__
25 #define __stir_IO_stir_ecat6_H__
26 
28 #include "stir/IO/ecat6_types.h"
29 #include <string>
30 #include <stdio.h>
31 #include "stir/shared_ptr.h"
32 
33 START_NAMESPACE_STIR
34 
35 class Succeeded;
36 class NumericType;
37 class ByteOrder;
38 class Scanner;
39 class ExamInfo;
40 template <int num_dimensions, typename elemT>
41 class DiscretisedDensity;
42 template <typename elemT>
43 class VoxelsOnCartesianGrid;
44 template <typename elemT>
45 class Sinogram;
46 class ProjData;
47 class ProjDataInfo;
48 
49 START_NAMESPACE_ECAT
50 START_NAMESPACE_ECAT6
51 
64 bool is_ECAT6_file(const std::string& filename);
69 bool is_ECAT6_image_file(const std::string& filename);
75 bool is_ECAT6_emission_file(const std::string& filename);
81 bool is_ECAT6_attenuation_file(const std::string& filename);
82 
83 /*
84  \brief Convert image data
85  \ingroup ECAT
86  \param cti_fptr a FILE pointer to the ECAT6 file.
87  \param mhead the ECAT6 main header. Note that this parameter will be used
88  to get system and size info, not the main header in the file.
89 */
90 VoxelsOnCartesianGrid<float>* ECAT6_to_VoxelsOnCartesianGrid(const int frame_num,
91  const int gate_num,
92  const int data_num,
93  const int bed_num,
94  FILE* cti_fptr,
95  const ECAT6_Main_header& mhead);
96 /*
97  \brief Convert sinogram data
98  \ingroup ECAT
99  \param max_ring_diff if less than 0, the maximum is used (i.e. num_rings-1)
100  \param arccorrected tells the function if the data is (assumed to be) arc-corrected. Note
101  that the ECAT6 file format does not have any flag to indicate this.
102  \param output_file_name filename for output. A .s extension will be added (for the
103  binary file) if no extension is present.
104  \param cti_fptr a FILE pointer to the ECAT6 file.
105  \param mhead the ECAT6 main header. Note that this parameter will be used
106  to get system and size info, not the main header in the file.
107  \warning multiplies the data with the loss_correction_factor in the subheader.
108 */
109 void ECAT6_to_PDFS(const int frame_num,
110  const int gate_num,
111  const int data_num,
112  const int bed_num,
113  int max_ring_diff,
114  bool arccorrected,
115  const std::string& output_file_name,
116  FILE* cti_fptr,
117  const ECAT6_Main_header& mhead);
118 
120 
123 Scanner* find_scanner_from_ECAT6_Main_header(const ECAT6_Main_header& mhead);
124 
126 
127 Succeeded DiscretisedDensity_to_ECAT6(DiscretisedDensity<3, float> const& density,
128  std::string const& cti_name,
129  std::string const& orig_name,
130  const Scanner& scanner,
131  const int frame_num = 1,
132  const int gate_num = 1,
133  const int data_num = 0,
134  const int bed_num = 0);
135 
137 
142 Succeeded DiscretisedDensity_to_ECAT6(FILE* fptr,
143  DiscretisedDensity<3, float> const& density,
144  const ECAT6_Main_header& mhead,
145  const int frame_num = 1,
146  const int gate_num = 1,
147  const int data_num = 0,
148  const int bed_num = 0);
149 
151 
157 Succeeded ProjData_to_ECAT6(ProjData const& proj_data,
158  std::string const& cti_name,
159  std::string const& orig_name,
160  const int frame_num = 1,
161  const int gate_num = 1,
162  const int data_num = 0,
163  const int bed_num = 0,
164  const bool write_2D_sinograms = false);
165 
167 
175 Succeeded ProjData_to_ECAT6(FILE* fptr,
176  ProjData const& proj_data,
177  const ECAT6_Main_header& mhead,
178  const int frame_num = 1,
179  const int gate_num = 1,
180  const int data_num = 0,
181  const int bed_num = 0,
182  const bool write_2D_sinograms = false);
183 
185 
188 void make_ECAT6_Main_header(ECAT6_Main_header&, const Scanner&, const std::string& orig_name, ExamInfo const& exam_info);
189 
191 
194 void make_ECAT6_Main_header(ECAT6_Main_header& mhead,
195  Scanner const& scanner,
196  const std::string& orig_name,
197  DiscretisedDensity<3, float> const& density);
198 
200 
204 void make_ECAT6_Main_header(ECAT6_Main_header& mhead, const std::string& orig_name, ProjDataInfo const& proj_data_info);
205 END_NAMESPACE_ECAT
206 END_NAMESPACE_ECAT6
207 END_NAMESPACE_STIR
208 #endif
Succeeded DiscretisedDensity_to_ECAT6(FILE *fptr, DiscretisedDensity< 3, float > const &density, const ECAT6_Main_header &mhead, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0)
Write an (extra) image to an existing ECAT6 file.
Definition: stir_ecat6.cxx:614
Import of std::shared_ptr, std::dynamic_pointer_cast and std::static_pointer_cast (or corresponding b...
ECAT 6 CTI matrix parameters.
Scanner * find_scanner_from_ECAT6_Main_header(const ECAT6_Main_header &mhead)
determine scanner type from the ECAT6_Main_header
Definition: stir_ecat6.cxx:161
bool is_ECAT6_image_file(const std::string &filename)
checks if the file is in ECAT6 format and if the file contains images
Definition: stir_ecat6.cxx:140
bool is_ECAT6_file(const std::string &filename)
checks if the file is in ECAT6 formatAs ECAT6 doesn&#39;t have a &#39;magic number&#39; this check is somewhat he...
Definition: stir_ecat6.cxx:133
Succeeded ProjData_to_ECAT6(FILE *fptr, ProjData const &proj_data, const ECAT6_Main_header &mhead, const int frame_num=1, const int gate_num=1, const int data_num=0, const int bed_num=0, const bool write_2D_sinograms=false)
Write an (extra) set of sinograms to an existing ECAT6 file.
Definition: stir_ecat6.cxx:792
bool is_ECAT6_emission_file(const std::string &filename)
checks if the file is in ECAT6 format and if the file contains emission sinograms (or blank/transmisi...
Definition: stir_ecat6.cxx:147
bool is_ECAT6_attenuation_file(const std::string &filename)
checks if the file is in ECAT6 format and if the file contains attenuation correction factors ...
Definition: stir_ecat6.cxx:154
void make_ECAT6_Main_header(ECAT6_Main_header &mhead, const std::string &orig_name, ProjDataInfo const &proj_data_info)
Fill in most of the main header given an orig_name and a proj_data_info.
Definition: stir_ecat6.cxx:216
Declaration of routines which convert ECAT things into our building blocks and vice versa...