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 #include <morphio/properties.h>
9 #include <morphio/section_iterators.hpp>
10 #include <morphio/types.h>
11 
12 namespace morphio {
13 
15 using breadth_iterator = breadth_iterator_t<Section, Morphology>;
17 using depth_iterator = depth_iterator_t<Section, Morphology>;
18 
25 {
26  public:
27  virtual ~Morphology() = default;
28 
29  Morphology(const Morphology&) noexcept = default;
30  Morphology& operator=(const Morphology&) noexcept = default;
31  Morphology(Morphology&&) noexcept = default;
32  Morphology& operator=(Morphology&&) noexcept = default;
33 
45  explicit Morphology(const std::string& path, unsigned int options = NO_MODIFIER);
46 
48  explicit Morphology(const HighFive::Group& group, unsigned int options = NO_MODIFIER);
49 
51  explicit Morphology(const mut::Morphology&);
52 
54  explicit Morphology(const std::string& contents,
55  const std::string& extension,
56  unsigned int options = NO_MODIFIER);
57 
59  Soma soma() const;
60 
62  Mitochondria mitochondria() const;
63 
66 
68  const std::vector<Property::Annotation>& annotations() const;
69 
71  const std::vector<Property::Marker>& markers() const;
72 
77  std::vector<Section> rootSections() const;
78 
84  std::vector<Section> sections() const;
85 
91  Section section(uint32_t id) const;
92 
97  const Points& points() const noexcept;
98 
109  std::vector<uint32_t> sectionOffsets() const;
110 
115  const std::vector<morphio::floatType>& diameters() const;
116 
118  const std::vector<morphio::floatType>& perimeters() const;
119 
121  const std::vector<SectionType>& sectionTypes() const;
122 
128  const std::map<int, std::vector<unsigned int>>& connectivity() const;
129 
135  depth_iterator depth_begin() const;
137  depth_iterator depth_end() const;
138 
148 
150  const SomaType& somaType() const;
151 
153  const CellFamily& cellFamily() const;
154 
156  const MorphologyVersion& version() const;
157 
158  protected:
159  friend class mut::Morphology;
160  Morphology(const Property::Properties& properties, unsigned int options);
161 
162  std::shared_ptr<Property::Properties> properties_;
163 
164  template <typename Property>
165  const std::vector<typename Property::Type>& get() const;
166 };
167 } // namespace morphio
morphio::Property::Properties
Definition: properties.h:210
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:24
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:29
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