Skip to content

Commit

Permalink
BRAYNS-591 Fix default morphology settings. (#1213)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien4193 authored Nov 7, 2023
1 parent 9204d4a commit 3c828ef
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 11 deletions.
14 changes: 14 additions & 0 deletions brayns/json/JsonType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,20 @@ const JsonObject &JsonExtractor::extractObject(const JsonValue &json)
return *json.extract<JsonObject::Ptr>();
}

JsonValue JsonFactory::array()
{
auto json = JsonValue();
emplaceArray(json);
return json;
}

JsonValue JsonFactory::object()
{
auto json = JsonValue();
emplaceObject(json);
return json;
}

JsonArray &JsonFactory::emplaceArray(JsonValue &json)
{
auto array = Poco::makeShared<JsonArray>();
Expand Down
2 changes: 2 additions & 0 deletions brayns/json/JsonType.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ class JsonExtractor
class JsonFactory
{
public:
static JsonValue array();
static JsonValue object();
static JsonArray &emplaceArray(JsonValue &json);
static JsonObject &emplaceObject(JsonValue &json);
};
Expand Down
5 changes: 0 additions & 5 deletions plugins/CircuitExplorer/api/neuron/NeuronMorphologyReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ NeuronMorphology NeuronMorphologyReader::read(const std::string &path, bool soma
throw std::invalid_argument("Nothing requested to be loaded");
}

if (!axon && !dendrites)
{
throw std::runtime_error("Soma-only NeuronMorphologies not allowed");
}

auto morph = MorphIOReader::read(path);

auto sections = NeuriteReader::read(morph, axon, dendrites);
Expand Down
2 changes: 1 addition & 1 deletion plugins/CircuitExplorer/io/BBPLoaderParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ struct JsonAdapter<BBPLoaderParameters> : ObjectAdapter<BBPLoaderParameters>
[](auto &object) -> auto & { return object.neuron_morphology_parameters; },
[](auto &object, auto value) { object.neuron_morphology_parameters = std::move(value); })
.description("Settings to configure neuron morphology loading")
.required(false);
.defaultValue(brayns::JsonFactory::object());
builder
.getset(
"load_afferent_synapses",
Expand Down
2 changes: 1 addition & 1 deletion plugins/CircuitExplorer/io/CellPlacementLoaderParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ struct JsonAdapter<CellPlacementLoaderParameters> : ObjectAdapter<CellPlacementL
[](auto &object) -> auto & { return object.morphology_parameters; },
[](auto &object, auto value) { object.morphology_parameters = std::move(value); })
.description("Settings for morphology geometry loading")
.required(false);
.defaultValue(brayns::JsonFactory::object());
return builder.build();
}
};
Expand Down
2 changes: 1 addition & 1 deletion plugins/CircuitExplorer/io/SonataLoaderParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ struct JsonAdapter<SonataNodePopulationParameters> : ObjectAdapter<SonataNodePop
[](auto &object) -> auto & { return object.neuron_morphology_parameters; },
[](auto &object, auto value) { object.neuron_morphology_parameters = std::move(value); })
.description("Settings for morphology geometry loading (ignored for vasculature populations)")
.required(false);
.defaultValue(brayns::JsonFactory::object());
builder
.getset(
"vasculature_geometry_parameters",
Expand Down
4 changes: 1 addition & 3 deletions python/brayns/plugins/cell_placement.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ class CellPlacementLoader(Loader):
density: float = 1.0
extension: str | None = None
ids: list[int] | None = None
morphology: Morphology = field(
default_factory=lambda: Morphology(load_dendrites=True)
)
morphology: Morphology = field(default_factory=Morphology)

@classmethod
@property
Expand Down

0 comments on commit 3c828ef

Please sign in to comment.