3 #ifndef __stir_IO_MultiParametricDiscretisedDensityInputFileFormat_h__ 4 #define __stir_IO_MultiParametricDiscretisedDensityInputFileFormat_h__ 32 #include <boost/format.hpp> 43 const std::string get_name()
const override {
return "Multi"; }
46 bool actual_can_read(
const FileSignature& signature, std::istream&)
const override 50 const char* pos_of_colon = strchr(signature.
get_signature(),
':');
51 if (pos_of_colon == NULL)
60 unique_ptr<data_type> ret;
63 error(
"failed to read a Multi image from stream");
67 unique_ptr<data_type>
read_from_file(
const std::string& filename)
const override 69 MultipleDataSetHeader header;
70 if (header.parse(filename.c_str()) ==
false)
71 error(
"MultiParametricDiscretisedDensity:::read_from_file: Error parsing \"" + filename +
'\"');
72 if (header.get_num_data_sets() != ParametricVoxelsOnCartesianGrid::get_num_params())
73 error(
"MultiParametricDiscretisedDensity:::read_from_file: " 74 "wrong number of images found in \"" 78 + std::to_string(ParametricVoxelsOnCartesianGrid::get_num_params()) +
")");
80 using SingleDiscretisedDensityType = ParametricVoxelsOnCartesianGrid::SingleDiscretisedDensityType;
81 auto t = stir::read_from_file<SingleDiscretisedDensityType>(header.get_filename(0));
83 par_disc_den_ptr->update_parametric_image(*t, 1);
84 for (std::size_t i = 2; i <= header.get_num_data_sets(); ++i)
86 t = stir::read_from_file<SingleDiscretisedDensityType>(header.get_filename(i - 1));
89 par_disc_den_ptr->update_parametric_image(*t, i);
92 return unique_ptr<data_type>(par_disc_den_ptr);
A class to read/store the file signature.
Definition: FileSignature.h:34
This file declares various utility functions.
Class to store parametric images.
Definition: ECAT7ParametricDensityOutputFileFormat.h:36
defines the stir::DiscretisedDensity class
Declaration of stir::error()
const char * get_signature() const
get access to the signature
Definition: FileSignature.h:52
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
Declaration of class stir::ParametricDiscretisedDensity.
void error(const char *const s,...)
Print error with format string a la printf and throw exception.
Definition: error.cxx:42
defines the stir::VoxelsOnCartesianGrid class
Declaration of stir::read_from_file functions (providing easy access to class stir::InputFileFormatRe...
ParametricDiscretisedDensity< ParametricVoxelsOnCartesianGridBaseType > ParametricVoxelsOnCartesianGrid
Convenience typedef for Cartesian Voxelised Parametric Images with just two parameters.
Definition: ParametricDiscretisedDensity.h:172