3 #ifndef __stir_IO_MultiDynamicDiscretisedDensityInputFileFormat_h__ 4 #define __stir_IO_MultiDynamicDiscretisedDensityInputFileFormat_h__ 31 #include <boost/format.hpp> 42 const std::string get_name()
const override {
return "Multi"; }
45 bool actual_can_read(
const FileSignature& signature, std::istream&)
const override 49 const char* pos_of_colon = strchr(signature.
get_signature(),
':');
50 if (pos_of_colon == NULL)
59 unique_ptr<data_type> ret;
62 error(
"failed to read an Multi image from stream");
66 unique_ptr<data_type>
read_from_file(
const std::string& filename)
const override 68 MultipleDataSetHeader header;
69 if (header.parse(filename.c_str()) ==
false)
70 error(
"MultiDynamicDiscretisedDensity:::read_from_file: Error parsing %s", filename.c_str());
72 dyn_disc_den_ptr->set_num_densities(header.get_num_data_sets());
74 for (std::size_t i = 1U; i <= header.get_num_data_sets(); ++i)
79 if (t->get_exam_info().get_time_frame_definitions().get_num_frames() != 1)
80 error(str(boost::format(
81 "The individual components of a dynamic image should contain 1 time frame, but image %1% contains %2%.")
82 % i % t->get_exam_info().get_time_frame_definitions().get_num_frames()));
83 double start = t->get_exam_info().get_time_frame_definitions().get_start_time(1);
84 double end = t->get_exam_info().get_time_frame_definitions().get_end_time(1);
88 exam_info = t->get_exam_info();
90 shared_ptr<Scanner> scanner_sptr(Scanner::get_scanner_from_name(exam_info.originating_system));
91 dyn_disc_den_ptr->set_scanner(*scanner_sptr);
94 dyn_disc_den_ptr->set_exam_info(exam_info);
95 dyn_disc_den_ptr->set_density(*t, i);
98 dyn_disc_den_ptr->set_if_decay_corrected(1.);
100 return unique_ptr<data_type>(dyn_disc_den_ptr);
A class to read/store the file signature.
Definition: FileSignature.h:34
This file declares various utility functions.
Declarations of functions which read/write Interfile data.
void set_time_frame(const int frame_num, const double start, const double end)
Set time frame.
Definition: TimeFrameDefinitions.cxx:256
defines the stir::DiscretisedDensity class
Declaration of stir::error()
Declaration of class stir::DynamicDiscretisedDensity.
const char * get_signature() const
get access to the signature
Definition: FileSignature.h:52
Class of multiple image frames, one for each time frame Each time frame is a DiscretisedDensity<3,float>
Definition: DynamicDiscretisedDensity.h:45
Definition of stir::is_null_ptr functions.
string standardise_interfile_keyword(const string &keyword)
Put a (Interfile) keyword into a standard form.
Definition: interfile_keyword_functions.cxx:28
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition: error.cxx:42
a class for storing information about 1 exam (or scan)
Definition: ExamInfo.h:41
void set_num_time_frames(int num_time_frames)
Set number of time frames.
Definition: TimeFrameDefinitions.h:98
This abstract class is the basis for all image representations.
Definition: FBP2DReconstruction.h:35