mito_section.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 <cstdint> // uint32_t
8 #include <memory> // std::shared_ptr
9 #include <vector> // std::vector
10 
11 #include <morphio/properties.h> // Property
12 
13 namespace morphio {
14 namespace mut {
15 
18 {
19  public:
20  MitoSection(Mitochondria* mitochondria,
21  unsigned int id,
22  const Property::MitochondriaPointLevel& pointProperties);
23  MitoSection(Mitochondria* mitochondria, unsigned int id, const morphio::MitoSection& section);
24  MitoSection(Mitochondria* mitochondria, unsigned int id, const MitoSection& section);
25 
27  std::shared_ptr<MitoSection> appendSection(const Property::MitochondriaPointLevel& points);
28 
34  std::shared_ptr<MitoSection> appendSection(const std::shared_ptr<MitoSection>& original_section,
35  bool recursive);
36 
42  std::shared_ptr<MitoSection> appendSection(const morphio::MitoSection& section, bool recursive);
43 
45  std::shared_ptr<MitoSection> parent() const;
46 
48  bool isRoot() const;
49 
51  const std::vector<std::shared_ptr<MitoSection>>& children() const;
52 
54  bool hasSameShape(const MitoSection& other) const noexcept;
55 
57  inline uint32_t id() const noexcept;
58 
62  inline const std::vector<morphio::floatType>& diameters() const noexcept;
63  inline std::vector<morphio::floatType>& diameters() noexcept;
69  inline const std::vector<uint32_t>& neuriteSectionIds() const noexcept;
70  inline std::vector<uint32_t>& neuriteSectionIds() noexcept;
78  inline const std::vector<morphio::floatType>& pathLengths() const noexcept;
79  inline std::vector<morphio::floatType>& pathLengths() noexcept;
82  private:
83  uint32_t id_;
84 
85  Mitochondria* mitochondria_;
86 
87  public:
88  // TODO: make private
90 };
91 
92 inline uint32_t MitoSection::id() const noexcept {
93  return id_;
94 }
95 
96 inline const std::vector<morphio::floatType>& MitoSection::diameters() const noexcept {
97  return _mitoPoints._diameters;
98 }
99 
100 inline const std::vector<uint32_t>& MitoSection::neuriteSectionIds() const noexcept {
101  return _mitoPoints._sectionIds;
102 }
103 
104 inline const std::vector<morphio::floatType>& MitoSection::pathLengths() const noexcept {
105  return _mitoPoints._relativePathLengths;
106 }
107 
108 inline std::vector<morphio::floatType>& MitoSection::diameters() noexcept {
109  return _mitoPoints._diameters;
110 }
111 
112 inline std::vector<uint32_t>& MitoSection::neuriteSectionIds() noexcept {
113  return _mitoPoints._sectionIds;
114 }
115 
116 inline std::vector<morphio::floatType>& MitoSection::pathLengths() noexcept {
117  return _mitoPoints._relativePathLengths;
118 }
119 
120 void friendDtorForSharedPtrMito(MitoSection* section);
121 
122 } // namespace mut
123 } // namespace morphio
morphio::mut::MitoSection::hasSameShape
bool hasSameShape(const MitoSection &other) const noexcept
Return true if the both sections have the same neuriteSectionIds, diameters and pathLengths.
morphio::MitoSection
Definition: mito_section.h:21
morphio::Property::MitochondriaPointLevel
Definition: properties.h:92
morphio::mut::MitoSection::neuriteSectionIds
const std::vector< uint32_t > & neuriteSectionIds() const noexcept
Definition: mito_section.h:100
morphio::mut::MitoSection::children
const std::vector< std::shared_ptr< MitoSection > > & children() const
Get the Section children.
morphio::mut::MitoSection::parent
std::shared_ptr< MitoSection > parent() const
Get the Section parent.
morphio::mut::MitoSection::diameters
const std::vector< morphio::floatType > & diameters() const noexcept
Definition: mito_section.h:96
morphio::mut::MitoSection::id
uint32_t id() const noexcept
Return the section id.
Definition: mito_section.h:92
morphio::mut::MitoSection::appendSection
std::shared_ptr< MitoSection > appendSection(const Property::MitochondriaPointLevel &points)
Append a MitoSection.
morphio::mut::MitoSection::isRoot
bool isRoot() const
Return true if section is a root section.
morphio::mut::Mitochondria
Definition: mitochondria.h:25
morphio::mut::MitoSection
Definition: mito_section.h:17
morphio::mut::MitoSection::pathLengths
const std::vector< morphio::floatType > & pathLengths() const noexcept
Definition: mito_section.h:104