Developer documentation
Version 3.0.3-105-gd3941f44
tree.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_tree_h__
18#define __file_dicom_tree_h__
19
20#include "memory.h"
21#include "file/dicom/patient.h"
22
23namespace MR {
24 namespace File {
25 namespace Dicom {
26
27 class Series;
28 class Patient;
29
30 class Tree : public vector<std::shared_ptr<Patient>> { NOMEMALIGN
31 public:
32 std::string description;
33 void read (const std::string& filename);
34 std::shared_ptr<Patient> find (const std::string& patient_name, const std::string& patient_ID,
35 const std::string& patient_DOB);
36
37 void sort() {
38 std::sort (begin(), end(), compare_ptr_contents());
39 for (auto patient : *this) {
40 std::sort (patient->begin(), patient->end(), compare_ptr_contents());
41 for (auto study : *patient)
42 std::sort (study->begin(), study->end(), compare_ptr_contents());
43 }
44 }
45
46 protected:
47 void read_dir (const std::string& filename, ProgressBar& progress);
48 void read_file (const std::string& filename);
49 };
50
51 std::ostream& operator<< (std::ostream& stream, const Tree& item);
52
53 extern vector<std::shared_ptr<Series>> (*select_func) (const Tree& tree);
54
55 }
56 }
57}
58
59#endif
60
61
62
void read_file(const std::string &filename)
std::string description
Definition: tree.h:32
void read_dir(const std::string &filename, ProgressBar &progress)
std::shared_ptr< Patient > find(const std::string &patient_name, const std::string &patient_ID, const std::string &patient_DOB)
void read(const std::string &filename)
implements a progress meter to provide feedback to the user
Definition: progressbar.h:58
#define NOMEMALIGN
Definition: memory.h:22
std::ostream & operator<<(std::ostream &stream, const Patient &item)
Definition: base.h:24
Item item