morphology.h
1 /* Copyright (c) 2013-2023, EPFL/Blue Brain Project
2  *
3  * SPDX-License-Identifier: Apache-2.0
4  */
5 #pragma once
6 
7 #include <highfive/H5Group.hpp>
8 
9 #include <morphio/properties.h>
10 #include <morphio/section_iterators.hpp>
11 #include <morphio/types.h>
12 #include <morphio/warning_handling.h> // WarningHandler
13 
14 namespace morphio {
15 
17 using breadth_iterator = breadth_iterator_t<Section, Morphology>;
19 using depth_iterator = depth_iterator_t<Section, Morphology>;
20 
27 {
28  public:
29  virtual ~Morphology() = default;
30 
31  Morphology(const Morphology&) noexcept = default;
32  Morphology& operator=(const Morphology&) noexcept = default;
33  Morphology(Morphology&&) noexcept = default;
34  Morphology& operator=(Morphology&&) noexcept = default;
35 
47  explicit Morphology(const std::string& path,
48  unsigned int options = NO_MODIFIER,
49  std::shared_ptr<WarningHandler> = nullptr);
50 
51 
53  explicit Morphology(const HighFive::Group& group,
54  unsigned int options = NO_MODIFIER,
55  std::shared_ptr<WarningHandler> = nullptr);
56 
58  explicit Morphology(const mut::Morphology&);
59 
61  explicit Morphology(const std::string& contents,
62  const std::string& extension,
63  unsigned int options = NO_MODIFIER,
64  std::shared_ptr<WarningHandler> = nullptr);
65 
67  Soma soma() const;
68 
70  Mitochondria mitochondria() const;
71 
74 
76  const std::vector<Property::Annotation>& annotations() const;
77 
79  const std::vector<Property::Marker>& markers() const;
80 
85  std::vector<Section> rootSections() const;
86 
92  std::vector<Section> sections() const;
93 
99  Section section(uint32_t id) const;
100 
105  const Points& points() const noexcept;
106 
117  std::vector<uint32_t> sectionOffsets() const;
118 
123  const std::vector<morphio::floatType>& diameters() const;
124 
126  const std::vector<morphio::floatType>& perimeters() const;
127 
129  const std::vector<SectionType>& sectionTypes() const;
130 
136  const std::map<int, std::vector<unsigned int>>& connectivity() const;
137 
143  depth_iterator depth_begin() const;
145  depth_iterator depth_end() const;
146 
156 
158  const SomaType& somaType() const;
159 
161  const CellFamily& cellFamily() const;
162 
164  const MorphologyVersion& version() const;
165 
166  protected:
167  friend class mut::Morphology;
168  Morphology(const Property::Properties& properties, unsigned int options);
169 
170  std::shared_ptr<Property::Properties> properties_;
171 
172  template <typename Property>
173  const std::vector<typename Property::Type>& get() const;
174 };
175 } // namespace morphio
morphio::Property::Properties
Definition: properties.h:209
morphio::enums::SomaType
SomaType
Definition: enums.h:59
morphio::Morphology::cellFamily
const CellFamily & cellFamily() const
morphio::depth_iterator_t
Definition: section_iterators.hpp:82
morphio::Section
Definition: section.h:36
morphio::Morphology::sectionOffsets
std::vector< uint32_t > sectionOffsets() const
morphio::enums::NO_MODIFIER
@ NO_MODIFIER
Read morphology as is without any modification.
Definition: enums.h:18
morphio::Morphology::points
const Points & points() const noexcept
morphio::Morphology::breadth_begin
breadth_iterator breadth_begin() const
morphio::Morphology::soma
Soma soma() const
morphio::Morphology::markers
const std::vector< Property::Marker > & markers() const
morphio::Morphology::diameters
const std::vector< morphio::floatType > & diameters() const
morphio::Morphology
Definition: morphology.h:26
morphio::Morphology::depth_end
depth_iterator depth_end() const
morphio::Morphology::connectivity
const std::map< int, std::vector< unsigned int > > & connectivity() const
morphio::Morphology::perimeters
const std::vector< morphio::floatType > & perimeters() const
morphio::Morphology::depth_begin
depth_iterator depth_begin() const
morphio::Morphology::version
const MorphologyVersion & version() const
morphio::Morphology::mitochondria
Mitochondria mitochondria() const
morphio::Morphology::sections
std::vector< Section > sections() const
morphio::Morphology::somaType
const SomaType & somaType() const
morphio::enums::CellFamily
CellFamily
Definition: enums.h:52
morphio::Morphology::rootSections
std::vector< Section > rootSections() const
morphio::Morphology::sectionTypes
const std::vector< SectionType > & sectionTypes() const
morphio::Morphology::annotations
const std::vector< Property::Annotation > & annotations() const
morphio::Mitochondria
Definition: mitochondria.h:22
morphio::breadth_iterator_t
Definition: section_iterators.hpp:53
morphio::Soma
Definition: soma.h:28
morphio::mut::Morphology
Definition: morphology.h:32
morphio::EndoplasmicReticulum
Definition: endoplasmic_reticulum.h:22
morphio::Morphology::endoplasmicReticulum
EndoplasmicReticulum endoplasmicReticulum() const
morphio::Morphology::breadth_end
breadth_iterator breadth_end() const
morphio::Morphology::section
Section section(uint32_t id) const