Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.10.0 #26

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 3rd-party/arbor
Submodule arbor updated 679 files
2 changes: 1 addition & 1 deletion 3rd-party/fmt
Submodule fmt updated 199 files
2 changes: 1 addition & 1 deletion 3rd-party/glbinding
Submodule glbinding updated 54 files
+4 −1 .gitignore
+15 −10 AUTHORS
+1 −1 CMakeLists.txt
+1 −1 LICENSE
+9 −8 README.md
+17 −6 cmake/CompileOptions.cmake
+1 −1 data/cubescape-gles/cubescape.frag
+1 −3 data/cubescape-gles/cubescape.geom
+1 −1 data/cubescape-gles/cubescape.vert
+2 −1 deploy/ubuntu-ppa/debian/control
+2 −2 deploy/ubuntu-ppa/debian/copyright
+1 −0 source/examples/CMakeLists.txt
+1 −1 source/examples/cubescape-gles/CMakeLists.txt
+161 −0 source/examples/cubescape-wgl/CMakeLists.txt
+265 −0 source/examples/cubescape-wgl/CubeScape.cpp
+47 −0 source/examples/cubescape-wgl/CubeScape.h
+59 −0 source/examples/cubescape-wgl/RawFile.cpp
+32 −0 source/examples/cubescape-wgl/RawFile.h
+273 −0 source/examples/cubescape-wgl/glutils.cpp
+50 −0 source/examples/cubescape-wgl/glutils.h
+131 −0 source/examples/cubescape-wgl/main.cpp
+1 −1 source/glbinding-aux/include/glbinding-aux/logging.h
+10 −10 source/glbinding-aux/source/Meta_BitfieldsByString.cpp
+1 −0 source/glbinding-aux/source/Meta_ExtensionsByString.cpp
+1 −0 source/glbinding-aux/source/Meta_StringsByBitfield.cpp
+1 −0 source/glbinding-aux/source/Meta_StringsByExtension.cpp
+1 −1 source/glbinding-aux/source/glrevision.h
+3 −2 source/glbinding-aux/source/logging.cpp
+11 −11 source/glbinding/include/glbinding/Binding.h
+28 −27 source/glbinding/include/glbinding/gl/bitfield.h
+3,113 −3,203 source/glbinding/include/glbinding/gl/enum.h
+1 −0 source/glbinding/include/glbinding/gl/extension.h
+10 −10 source/glbinding/include/glbinding/gl/functions.h
+50 −50 source/glbinding/include/glbinding/gl/types.h
+1 −1 source/glbinding/include/glbinding/glbinding.h
+6 −3 source/glbinding/source/Binding.cpp
+3 −3 source/glbinding/source/Binding_objects_a.cpp
+4 −4 source/glbinding/source/Binding_objects_c.cpp
+2 −2 source/glbinding/source/Binding_objects_g.cpp
+1 −1 source/glbinding/source/Binding_objects_h.cpp
+3 −3 source/glbinding/source/gl/functions_a.cpp
+4 −4 source/glbinding/source/gl/functions_c.cpp
+2 −2 source/glbinding/source/gl/functions_g.cpp
+1 −1 source/glbinding/source/gl/functions_h.cpp
+4 −0 source/tools/CMakeLists.txt
+1 −1 source/tools/glcontexts/CMakeLists.txt
+2 −0 source/tools/glcontexts/main.cpp
+134 −0 source/tools/glescontexts/CMakeLists.txt
+125 −0 source/tools/glescontexts/main.cpp
+1 −1 source/tools/glfunctions/CMakeLists.txt
+1 −1 source/tools/glinfo/CMakeLists.txt
+1 −1 source/tools/glisdeprecated/CMakeLists.txt
+1 −1 source/tools/glmeta/CMakeLists.txt
+1 −1 source/tools/glqueries/CMakeLists.txt
2 changes: 1 addition & 1 deletion 3rd-party/glfw
Submodule glfw updated 164 files
2 changes: 1 addition & 1 deletion 3rd-party/icons
Submodule icons updated 79 files
+414 −146 GenerateIconFontCppHeaders.py
+590 −0 IconsCodicons.cs
+588 −0 IconsCodicons.go
+584 −0 IconsCodicons.h
+584 −0 IconsCodicons.py
+582 −0 IconsCodicons.rs
+9 −4 IconsFontAwesome4.cs
+692 −0 IconsFontAwesome4.go
+6 −3 IconsFontAwesome4.h
+688 −0 IconsFontAwesome4.py
+686 −0 IconsFontAwesome4.rs
+10 −5 IconsFontAwesome5.cs
+1,020 −0 IconsFontAwesome5.go
+6 −3 IconsFontAwesome5.h
+1,016 −0 IconsFontAwesome5.py
+1,014 −0 IconsFontAwesome5.rs
+9 −4 IconsFontAwesome5Brands.cs
+474 −0 IconsFontAwesome5Brands.go
+6 −3 IconsFontAwesome5Brands.h
+470 −0 IconsFontAwesome5Brands.py
+468 −0 IconsFontAwesome5Brands.rs
+11 −6 IconsFontAwesome5Pro.cs
+1,872 −0 IconsFontAwesome5Pro.go
+6 −3 IconsFontAwesome5Pro.h
+1,868 −0 IconsFontAwesome5Pro.py
+1,866 −0 IconsFontAwesome5Pro.rs
+9 −5 IconsFontAwesome5ProBrands.cs
+474 −0 IconsFontAwesome5ProBrands.go
+6 −4 IconsFontAwesome5ProBrands.h
+470 −0 IconsFontAwesome5ProBrands.py
+468 −0 IconsFontAwesome5ProBrands.rs
+27 −15 IconsFontAwesome6.cs
+1,410 −0 IconsFontAwesome6.go
+23 −13 IconsFontAwesome6.h
+1,406 −0 IconsFontAwesome6.py
+1,404 −0 IconsFontAwesome6.rs
+61 −28 IconsFontAwesome6Brands.cs
+507 −0 IconsFontAwesome6Brands.go
+58 −27 IconsFontAwesome6Brands.h
+503 −0 IconsFontAwesome6Brands.py
+501 −0 IconsFontAwesome6Brands.rs
+9 −4 IconsFontaudio.cs
+172 −0 IconsFontaudio.go
+6 −3 IconsFontaudio.h
+168 −0 IconsFontaudio.py
+166 −0 IconsFontaudio.rs
+9 −4 IconsForkAwesome.cs
+828 −0 IconsForkAwesome.go
+6 −3 IconsForkAwesome.h
+824 −0 IconsForkAwesome.py
+822 −0 IconsForkAwesome.rs
+9 −4 IconsKenney.cs
+245 −0 IconsKenney.go
+6 −3 IconsKenney.h
+241 −0 IconsKenney.py
+239 −0 IconsKenney.rs
+1,487 −0 IconsLucide.cs
+1,485 −0 IconsLucide.go
+1,481 −0 IconsLucide.h
+1,481 −0 IconsLucide.py
+1,479 −0 IconsLucide.rs
+27 −6 IconsMaterialDesign.cs
+2,251 −0 IconsMaterialDesign.go
+23 −4 IconsMaterialDesign.h
+2,247 −0 IconsMaterialDesign.py
+2,245 −0 IconsMaterialDesign.rs
+7,467 −0 IconsMaterialDesignIcons.cs
+7,465 −0 IconsMaterialDesignIcons.go
+7,461 −0 IconsMaterialDesignIcons.h
+7,461 −0 IconsMaterialDesignIcons.py
+7,459 −0 IconsMaterialDesignIcons.rs
+3,649 −0 IconsMaterialSymbols.cs
+3,647 −0 IconsMaterialSymbols.go
+3,643 −0 IconsMaterialSymbols.h
+3,643 −0 IconsMaterialSymbols.py
+3,641 −0 IconsMaterialSymbols.rs
+77 −27 README.md
+17 −0 font.go
+3 −0 go.mod
2 changes: 1 addition & 1 deletion 3rd-party/imgui
Submodule imgui updated 184 files
2 changes: 1 addition & 1 deletion 3rd-party/implot
2 changes: 1 addition & 1 deletion 3rd-party/json
Submodule json updated 366 files
2 changes: 1 addition & 1 deletion 3rd-party/spdlog
Submodule spdlog updated 164 files
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ cmake_minimum_required(VERSION 3.19)
find_package(Git)

project(the-arbor-gui
VERSION 0.8.1
VERSION 0.10.1
LANGUAGES C CXX)

set(EXPORT_COMPILE_COMMANDS ON)

set(CMAKE_CXX_STANDARD 20)
include(GNUInstallDirs)

Expand Down Expand Up @@ -141,6 +143,7 @@ target_include_directories(imgui PRIVATE 3rd-party/imgui)
target_include_directories(imgui PUBLIC 3rd-party/implot)
target_include_directories(imgui PUBLIC 3rd-party/ImGuizmo/)
target_link_libraries(imgui PRIVATE glfw)
target_compile_definitions(arbor-gui-deps INTERFACE SPDLOG_FMT_EXTERNAL)

# Get commit hashes from git and inject into config
execute_process(COMMAND ${GIT_EXECUTABLE} -C ${PROJECT_SOURCE_DIR} describe --always --dirty --abbrev=0
Expand Down
121 changes: 61 additions & 60 deletions src/gui_state.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "gui_state.hpp"

#include <cmath>
#include <regex>
#include <string>

#include <glm/gtc/matrix_transform.hpp>
Expand All @@ -24,6 +23,7 @@
#include <arbor/simulation.hpp>
#include <arbor/context.hpp>
#include <arbor/load_balance.hpp>
#include <arbor/units.hpp>

#include "gui.hpp"
#include "utils.hpp"
Expand All @@ -37,6 +37,7 @@ extern float delta_zoom;
extern glm::vec2 mouse;

using namespace std::literals;
namespace U = arb::units;

namespace {
inline void gui_read_morphology(gui_state& state, bool& open);
Expand Down Expand Up @@ -390,8 +391,8 @@ namespace {
state.renderer.render(vs, {mouse.x - win_pos.x, size.y + win_pos.y - mouse.y});
ImGui::Image(reinterpret_cast<ImTextureID>(state.renderer.cell.tex), size, ImVec2(0, 1), ImVec2(1, 0));
if (ImGui::IsItemHovered()) {
auto shft = ImGui::IsKeyDown(GLFW_KEY_LEFT_SHIFT) || ImGui::IsKeyDown(GLFW_KEY_RIGHT_SHIFT);
auto ctrl = ImGui::IsKeyDown(GLFW_KEY_LEFT_CONTROL) || ImGui::IsKeyDown(GLFW_KEY_RIGHT_CONTROL);
auto shft = ImGui::IsKeyDown(ImGuiKey_LeftShift) || ImGui::IsKeyDown(ImGuiKey_RightShift);
auto ctrl = ImGui::IsKeyDown(ImGuiKey_LeftCtrl) || ImGui::IsKeyDown(ImGuiKey_RightCtrl);
if (shft || ctrl) {
auto what = shft ? ImGuizmo::ROTATE : ImGuizmo::TRANSLATE;
glm::vec3 shift = {vs.offset.x/vs.size.x, vs.offset.y/vs.size.y, 0.0f};
Expand Down Expand Up @@ -736,8 +737,11 @@ namespace {
}
}
}
std::sort(state_vars.begin(), state_vars.end());
std::unique(state_vars.begin(), state_vars.end());
{
std::sort(state_vars.begin(), state_vars.end());
auto last = std::unique(state_vars.begin(), state_vars.end());
state_vars.erase(last, state_vars.end());
}

for (const auto& locset: state.locsets) {
with_id id{locset};
Expand Down Expand Up @@ -850,20 +854,22 @@ namespace {
i_clamp.frequency = item.frequency;
i_clamp.phase = item.phase;
std::sort(item.envelope.begin(), item.envelope.end());
for (const auto& [t, i]: item.envelope) i_clamp.envelope.emplace_back(arb::i_clamp::envelope_point{t, i});
for (const auto& [t, i]: item.envelope) {
i_clamp.envelope.emplace_back(arb::i_clamp::envelope_point{t * U::ms , i * U::nA });
}
decor.place(locset, i_clamp, item.tag);
}
for (const auto child: state.detectors.get_children(id)) {
auto item = state.detectors[child];
decor.place(locset, arb::threshold_detector{item.threshold}, item.tag);
decor.place(locset, arb::threshold_detector{item.threshold * U::mV}, item.tag);
}
}

auto param = state.parameter_defaults;
if (param.RL) decor.set_default(arb::axial_resistivity{param.RL.value()});
if (param.Cm) decor.set_default(arb::membrane_capacitance{param.Cm.value()});
if (param.TK) decor.set_default(arb::temperature_K{param.TK.value()});
if (param.Vm) decor.set_default(arb::init_membrane_potential{param.Vm.value()});
if (param.RL) decor.set_default(arb::axial_resistivity{param.RL.value() * U::Ohm * U::cm});
if (param.Cm) decor.set_default(arb::membrane_capacitance{param.Cm.value() * U::F / U::m2});
if (param.TK) decor.set_default(arb::temperature{param.TK.value() * U::Kelvin });
if (param.Vm) decor.set_default(arb::init_membrane_potential{param.Vm.value() * U::mV});

for (const auto& ion: state.ions) {
const auto& data = state.ion_defaults[ion];
Expand All @@ -876,31 +882,31 @@ namespace {

if (state.presets.ion_data.contains(name)) {
auto p = state.presets.ion_data.at(name);
decor.set_default(arb::init_int_concentration{name, data.Xi.value_or(p.init_int_concentration.value())});
decor.set_default(arb::init_ext_concentration{name, data.Xo.value_or(p.init_ext_concentration.value())});
decor.set_default(arb::init_reversal_potential{name, data.Er.value_or(p.init_reversal_potential.value())});
decor.set_default(arb::init_int_concentration{name, data.Xi.value_or(p.init_int_concentration.value()) * U::mM});
decor.set_default(arb::init_ext_concentration{name, data.Xo.value_or(p.init_ext_concentration.value()) * U::mM});
decor.set_default(arb::init_reversal_potential{name, data.Er.value_or(p.init_reversal_potential.value())* U::mV});
} else {
decor.set_default(arb::init_int_concentration{name, data.Xi.value()});
decor.set_default(arb::init_ext_concentration{name, data.Xo.value()});
decor.set_default(arb::init_reversal_potential{name, data.Er.value()});
decor.set_default(arb::init_int_concentration{name, data.Xi.value() * U::mM});
decor.set_default(arb::init_ext_concentration{name, data.Xo.value() * U::mM});
decor.set_default(arb::init_reversal_potential{name, data.Er.value() * U::mV});
}
}

for (const auto& id: state.regions) {
auto rg = state.region_defs[id];
if (!rg.data) continue;
auto param = state.parameter_defs[id];
if (param.RL) decor.paint(rg.data.value(), arb::axial_resistivity{param.RL.value()});
if (param.Cm) decor.paint(rg.data.value(), arb::membrane_capacitance{param.Cm.value()});
if (param.TK) decor.paint(rg.data.value(), arb::temperature_K{param.TK.value()});
if (param.Vm) decor.paint(rg.data.value(), arb::init_membrane_potential{param.Vm.value()});
if (param.RL) decor.paint(rg.data.value(), arb::axial_resistivity{param.RL.value() * U::Ohm * U::cm});
if (param.Cm) decor.paint(rg.data.value(), arb::membrane_capacitance{param.Cm.value() * U::F / U::m2});
if (param.TK) decor.paint(rg.data.value(), arb::temperature{param.TK.value() * U::Kelvin});
if (param.Vm) decor.paint(rg.data.value(), arb::init_membrane_potential{param.Vm.value() * U::mV});

for (const auto& ion: state.ions) {
const auto& data = state.ion_par_defs[{id, ion}];
const auto& name = state.ion_defs[ion].name;
if (data.Xi) decor.paint(rg.data.value(), arb::init_int_concentration{name, data.Xi.value()});
if (data.Xo) decor.paint(rg.data.value(), arb::init_ext_concentration{name, data.Xo.value()});
if (data.Er) decor.paint(rg.data.value(), arb::init_reversal_potential{name, data.Er.value()});
if (data.Xi) decor.paint(rg.data.value(), arb::init_int_concentration{name, data.Xi.value() * U::mM});
if (data.Xo) decor.paint(rg.data.value(), arb::init_ext_concentration{name, data.Xo.value() * U::mM});
if (data.Er) decor.paint(rg.data.value(), arb::init_reversal_potential{name, data.Er.value() * U::mV});
}

for (const auto child: state.mechanisms.get_children(id)) {
Expand Down Expand Up @@ -938,7 +944,7 @@ namespace {
if (ImGui::BeginChild("TracePlot", {-180.0f, 0.0f})) {
if (to_plot) {
auto probe = to_plot.value();
auto trace = state.sim.traces.at(probe);
auto trace = state.sim.traces.at(probe.value);
const auto& [lo, hi] = std::accumulate(trace.values.begin(),
trace.values.end(),
std::make_pair(std::numeric_limits<float>::max(), std::numeric_limits<float>::min()),
Expand Down Expand Up @@ -1012,9 +1018,9 @@ void gui_state::deserialize(const std::filesystem::path& fn) {
struct ls_visitor {
gui_state* state;
id_type locset;
std::string tag;
arb::hash_type tag;

ls_visitor(gui_state* s, const arb::locset& l, const std::string& t): state{s}, tag{t} {
ls_visitor(gui_state* s, const arb::locset& l, const arb::hash_type& t): state{s}, tag{t} {
auto ls = to_string(l);
auto res = std::find_if(state->locsets.begin(), state->locsets.end(),
[&](const auto& id) {
Expand Down Expand Up @@ -1082,7 +1088,7 @@ void gui_state::deserialize(const std::filesystem::path& fn) {

void operator()(const arb::init_membrane_potential& t) { state->parameter_defs[region].Vm = t.value; }
void operator()(const arb::axial_resistivity& t) { state->parameter_defs[region].RL = t.value; }
void operator()(const arb::temperature_K& t) { state->parameter_defs[region].TK = t.value; }
void operator()(const arb::temperature& t) { state->parameter_defs[region].TK = t.value; }
void operator()(const arb::membrane_capacitance& t) { state->parameter_defs[region].Cm = t.value; }
void operator()(const arb::init_int_concentration& t) {
auto ion = std::find_if(state->ions.begin(), state->ions.end(),
Expand Down Expand Up @@ -1117,20 +1123,7 @@ void gui_state::deserialize(const std::filesystem::path& fn) {
}
}
void operator()(const arb::density& d) { make_density(d); }
};

struct df_visitor {
gui_state* state;
void operator()(const arb::init_membrane_potential& t) { log_error("Cannot handle this"); }
void operator()(const arb::axial_resistivity& t) { log_error("Cannot handle this"); }
void operator()(const arb::temperature_K& t) { log_error("Cannot handle this"); }
void operator()(const arb::membrane_capacitance& t) { log_error("Cannot handle this"); }
void operator()(const arb::init_int_concentration& t) { log_error("Cannot handle this"); }
void operator()(const arb::init_ext_concentration& t) { log_error("Cannot handle this"); }
void operator()(const arb::init_reversal_potential& t) { log_error("Cannot handle this"); }
void operator()(const arb::ion_reversal_potential_method& t) { log_error("Cannot handle this"); }
void operator()(const arb::ion_diffusivity& t) { log_error("Cannot handle this"); }
void operator()(const arb::cv_policy& t) { log_error("Cannot handle this"); }
void operator()(const arb::voltage_process& d) { log_error("Cannot handle this"); }
};

struct acc_visitor {
Expand Down Expand Up @@ -1437,15 +1430,15 @@ void gui_state::run_simulation() {
auto p = presets.ion_data.at(name);
prop.add_ion(name,
data.charge,
def.Xi.value_or(p.init_int_concentration.value()),
def.Xo.value_or(p.init_ext_concentration.value()),
def.Er.value_or(p.init_reversal_potential.value()));
def.Xi.value_or(p.init_int_concentration.value()) * U::mM,
def.Xo.value_or(p.init_ext_concentration.value()) * U::mM,
def.Er.value_or(p.init_reversal_potential.value())* U::mV);
} else {
prop.add_ion(name,
data.charge,
def.Xi.value(),
def.Xo.value(),
def.Er.value());
def.Xi.value() * U::mM,
def.Xo.value() * U::mM,
def.Er.value() * U::mV);
}
}
auto rec = make_recipe(prop, cell);
Expand All @@ -1455,34 +1448,42 @@ void gui_state::run_simulation() {
const auto& where = locset_defs[ls];
if (!where.data) continue;
auto loc = where.data.value();
// TODO this is quite crude...
auto tag = std::to_string(pb.value);
if (data.kind == "Voltage") {
rec.probes.emplace_back(arb::cable_probe_membrane_voltage{loc}, pb.value);
rec.probes.emplace_back(arb::cable_probe_membrane_voltage{loc}, tag);
} else if (data.kind == "Axial Current") {
rec.probes.emplace_back(arb::cable_probe_axial_current{loc}, pb.value);
rec.probes.emplace_back(arb::cable_probe_axial_current{loc}, tag);
} else if (data.kind == "Membrane Current") {
rec.probes.emplace_back(arb::cable_probe_total_ion_current_density{loc}, pb.value);
rec.probes.emplace_back(arb::cable_probe_total_ion_current_density{loc}, tag);
}
// TODO Finish
}
}
// Make simulation
auto sm = arb::simulation(rec);
auto sm = arb::simulation(rec);
sim.traces.clear();
sim.tag_to_id.clear();
sm.add_sampler(arb::all_probes,
arb::regular_schedule(this->sim.dt),
[&](arb::probe_metadata pm, std::size_t n, const arb::sample_record* samples) {
auto loc = arb::util::any_cast<const arb::mlocation*>(pm.meta);
trace t{(size_t)pm.tag, pm.index, loc->pos, loc->branch, {}, {}};
arb::regular_schedule(this->sim.dt * U::ms),
[&](const arb::probe_metadata pm, std::size_t n, const arb::sample_record* samples) {
auto loc = arb::util::any_cast<const arb::mlocation*>(pm.meta);
auto tag = pm.id.tag;
if (sim.tag_to_id.count(tag) == 0) {
id_type id = {sim.traces.size()};
sim.tag_to_id[tag] = id;
sim.traces.emplace_back(tag, id, pm.index, loc->pos, loc->branch);
}
auto id = sim.tag_to_id[tag];
auto& t = sim.traces.at(id.value);
for (std::size_t i = 0; i<n; ++i) {
const double* value = arb::util::any_cast<const double*>(samples[i].data);
t.times.push_back(samples[i].time);
t.values.push_back(*value);
}
sim.traces[t.id] = t;
},
arb::sampling_policy::exact);
});
try {
sm.run(sim.until, sim.dt);
sm.run(sim.until * U::ms, sim.dt * U::ms);
} catch (...) {
ImGui::OpenPopup("Error");
}
Expand Down
26 changes: 20 additions & 6 deletions src/loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace io {

loaded_morphology load_swc(const std::filesystem::path &fn,
std::function<arb::morphology(const std::vector<arborio::swc_record> &)> swc_to_morph) {

return { swc_to_morph(arborio::parse_swc(slurp(fn)).records()),
{{"soma", "(tag 1)"},
{"axon", "(tag 2)"},
Expand All @@ -22,8 +23,21 @@ loaded_morphology load_swc(const std::filesystem::path &fn,
{}};
}

loaded_morphology load_neuron_swc(const std::filesystem::path &fn) { return load_swc(fn, arborio::load_swc_neuron); }
loaded_morphology load_arbor_swc(const std::filesystem::path &fn) { return load_swc(fn, arborio::load_swc_arbor); }
loaded_morphology load_neuron_swc(const std::filesystem::path &fn) {
auto loaded = arborio::load_swc_neuron(fn);
loaded_morphology res{.morph=loaded.morphology};
for (const auto& [k, v]: loaded.labels.regions()) res.regions.emplace_back(k, to_string(v));
for (const auto& [k, v]: loaded.labels.locsets()) res.locsets.emplace_back(k, to_string(v));
return res;
}

loaded_morphology load_arbor_swc(const std::filesystem::path &fn) {
auto loaded = arborio::load_swc_arbor(fn);
loaded_morphology res{.morph=loaded.morphology};
for (const auto& [k, v]: loaded.labels.regions()) res.regions.emplace_back(k, to_string(v));
for (const auto& [k, v]: loaded.labels.locsets()) res.locsets.emplace_back(k, to_string(v));
return res;
}

loaded_morphology load_neuroml_morph(const std::filesystem::path &fn) {
arborio::neuroml nml(slurp(fn));
Expand All @@ -33,8 +47,8 @@ loaded_morphology load_neuroml_morph(const std::filesystem::path &fn) {
if (!morph_data) log_error("Invalid morphology id {} in NML file.");
auto morph = morph_data.value();
loaded_morphology result{.morph=morph.morphology};
for (const auto& [k, v]: morph.groups.regions()) result.regions.emplace_back(k, to_string(v));
for (const auto& [k, v]: morph.groups.locsets()) result.locsets.emplace_back(k, to_string(v));
for (const auto& [k, v]: morph.labels.regions()) result.regions.emplace_back(k, to_string(v));
for (const auto& [k, v]: morph.labels.locsets()) result.locsets.emplace_back(k, to_string(v));
return result;
}

Expand All @@ -46,8 +60,8 @@ loaded_morphology load_neuroml_cell(const std::filesystem::path &fn) {
if (!morph_data) log_error("Invalid cell id {} in NML file.");
auto morph = morph_data.value();
loaded_morphology result{.morph=morph.morphology};
for (const auto& [k, v]: morph.groups.regions()) result.regions.emplace_back(k, to_string(v));
for (const auto& [k, v]: morph.groups.locsets()) result.locsets.emplace_back(k, to_string(v));
for (const auto& [k, v]: morph.labels.regions()) result.regions.emplace_back(k, to_string(v));
for (const auto& [k, v]: morph.labels.locsets()) result.locsets.emplace_back(k, to_string(v));
return result;
}

Expand Down
1 change: 0 additions & 1 deletion src/loader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <vector>
#include <string>
#include <tuple>
#include <filesystem>

#include <arbor/morph/morphology.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/recipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct recipe: arb::recipe {
std::any get_global_properties(arb::cell_kind) const override { return properties; }
};


inline
recipe make_recipe(const arb::cable_cell_global_properties& properties,
const arb::cable_cell& cell) {
recipe result;
Expand Down
Loading
Loading