STIR 6.4.0
MultipleDataSetHeader.inl
Go to the documentation of this file.
1/*
2 Copyright (C) 2018, 2020, University College London
3 This file is part of STIR.
4
5 SPDX-License-Identifier: Apache-2.0
6
7 See STIR/LICENSE.txt for details
8*/
9
17
18#include <fstream>
19#include "stir/error.h"
20
21START_NAMESPACE_STIR
22
23template <class VectorOfStringsT>
24void
25MultipleDataSetHeader::write_header(const std::string& filename, const VectorOfStringsT& individual_filenames)
26{
27 std::ofstream multi_file(filename.c_str());
28 if (!multi_file.is_open())
29 error("MultiDynamicDiscretisedDensity error: Failed to write \"" + filename + "\".\n");
30
31 multi_file << "Multi :=\n";
32 multi_file << "\ttotal number of data sets := " << individual_filenames.size() << "\n";
33 int i = 1;
34 for (auto&& individual_filename : individual_filenames)
35 {
36 multi_file << "\tdata set[" << i << "] := " << individual_filename << "\n";
37 ++i;
38 }
39 multi_file << "end :=\n";
40 multi_file.close();
41}
42
43END_NAMESPACE_STIR
Declaration of stir::error()