Skip to content

Commit

Permalink
BRAYNS-643 Fix mesh loader. (#1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien4193 authored Jun 12, 2024
1 parent 7cf4165 commit c0dd7b9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 18 deletions.
6 changes: 6 additions & 0 deletions brayns/io/loaders/mesh/MeshLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <filesystem>
#include <fstream>
#include <sstream>
#include "MeshLoader.h"

namespace
{
Expand Down Expand Up @@ -191,6 +192,11 @@ std::vector<std::string> MeshLoader::getExtensions() const
return _parsers.getAllSupportedExtensions();
}

bool MeshLoader::canLoadBinary() const
{
return true;
}

std::vector<std::shared_ptr<Model>> MeshLoader::loadBinary(const BinaryRequest &request)
{
auto format = std::string(request.format);
Expand Down
7 changes: 7 additions & 0 deletions brayns/io/loaders/mesh/MeshLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,13 @@ class MeshLoader : public Loader<EmptyLoaderParams>
*/
std::vector<std::string> getExtensions() const override;

/**
* @brief Supports binary
*
* @return true
*/
bool canLoadBinary() const override;

/**
* @brief Import the mesh in the given scene from the given binary data.
*
Expand Down
2 changes: 1 addition & 1 deletion plugins/CircuitExplorer/io/bbploader/CellLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ std::vector<CellCompartments> CellLoader::load(

auto colorData = ColorDataFactory::create(context);

if (loadSoma && !loadAxon && !loadDend)
if (!loadSoma && !loadAxon && !loadDend)
{
return SomaImporter::import(context, model, std::move(colorData));
}
Expand Down
17 changes: 0 additions & 17 deletions plugins/CircuitExplorer/io/bbploader/ParameterCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -114,29 +114,12 @@ class ReportChecker
}
}
};

class NeuronSectionsChecker
{
public:
static void check(const BBPLoaderParameters &input)
{
const auto &morphSettings = input.neuron_morphology_parameters;
const auto loadSoma = morphSettings.load_soma;
const auto loadAxon = morphSettings.load_axon;
const auto loadDend = morphSettings.load_dendrites;
if (!loadSoma && !loadAxon && !loadDend)
{
throw std::invalid_argument("All neuron sections cannot be disabled");
}
}
};
} // namespace

void ParameterCheck::checkInput(const brion::BlueConfig &config, const BBPLoaderParameters &input)
{
InputGidSettingsChecker::check(input);
TargetChecker::check(config, input);
ReportChecker::check(config, input);
NeuronSectionsChecker::check(input);
}
} // namespace bbploader

0 comments on commit c0dd7b9

Please sign in to comment.