Developer documentation
Version 3.0.3-105-gd3941f44
series.h
Go to the documentation of this file.
1/* Copyright (c) 2008-2022 the MRtrix3 contributors.
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 *
7 * Covered Software is provided under this License on an "as is"
8 * basis, without warranty of any kind, either expressed, implied, or
9 * statutory, including, without limitation, warranties that the
10 * Covered Software is free of defects, merchantable, fit for a
11 * particular purpose or non-infringing.
12 * See the Mozilla Public License v. 2.0 for more details.
13 *
14 * For more details, see http://www.mrtrix.org/.
15 */
16
17#ifndef __file_dicom_series_h__
18#define __file_dicom_series_h__
19
20#include "memory.h"
21#include "progressbar.h"
22#include "file/dicom/image.h"
23
24namespace MR {
25 namespace File {
26 namespace Dicom {
27
28 class Study;
29 class Image;
30
31 class Series : public vector<std::shared_ptr<Image>> { NOMEMALIGN
32 public:
33 Series (Study* parent, const std::string& series_name, size_t series_number, const std::string& image_type,
34 const std::string& series_ref_UID, const std::string& series_modality,
35 const std::string& series_date, const std::string& series_time) :
36 study (parent), name (series_name), image_type (image_type), series_ref_UID (series_ref_UID),
37 number (series_number), modality (series_modality), date (series_date), time (series_time) { }
38
41 size_t number;
42 std::string modality;
43 std::string date;
44 std::string time;
45
46 void read () {
47 ProgressBar progress ("reading DICOM series \"" + name + "\"", size());
48 for (size_t i = 0; i < size(); i++) {
49 (*this)[i]->read();
50 ++progress;
51 }
52 }
53
55 bool operator< (const Series& s) const {
56 if (number != s.number)
57 return number < s.number;
58 if (date.size() && date != s.date)
59 return date < s.date;
60 if (time.size() && time != s.time)
61 return time < s.time;
62 return image_type < s.image_type;
63 }
64
65 friend std::ostream& operator<< (std::ostream& stream, const Series& item);
66 };
67
68
69 }
70 }
71}
72
73
74#endif
75
76
77
vector< int > count() const
friend std::ostream & operator<<(std::ostream &stream, const Series &item)
std::string name
Definition: series.h:40
bool operator<(const Series &s) const
Definition: series.h:55
std::string image_type
Definition: series.h:40
Series(Study *parent, const std::string &series_name, size_t series_number, const std::string &image_type, const std::string &series_ref_UID, const std::string &series_modality, const std::string &series_date, const std::string &series_time)
Definition: series.h:33
std::string modality
Definition: series.h:42
std::string date
Definition: series.h:43
std::string series_ref_UID
Definition: series.h:40
std::string time
Definition: series.h:44
implements a progress meter to provide feedback to the user
Definition: progressbar.h:58
#define NOMEMALIGN
Definition: memory.h:22
Definition: base.h:24
Item item