-
Notifications
You must be signed in to change notification settings - Fork 47
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
Added the option to use metaballs for generating meshes for somas #116
Conversation
brayns/io/MorphologyLoader.cpp
Outdated
@@ -35,6 +36,8 @@ | |||
# include <brion/brion.h> | |||
#endif | |||
|
|||
//#define BRAYNS_USE_BRION //// TO REMOVE //// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
then remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:-)
@@ -230,7 +230,7 @@ class Scene | |||
// Model | |||
PrimitivesMap _primitives; | |||
TrianglesMeshMap _trianglesMeshes; | |||
Materials _materials; | |||
MaterialsMap _materials; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I may not have the big picture in mind, but given the fact the the materials are contiguous from 0 -> nbMaterials, the vector looked more appropriate than the map
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a mix between vectors and maps, but I decided to go for maps, mainly for access. I know that I will soon have to improve material management by being able to select then by name or ID. So maps are in the end more appropriate but I understand this is not clear in that code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
brayns/io/MorphologyLoader.cpp
Outdated
// Soma | ||
const brain::neuron::Soma& soma = morphology.getSoma(); | ||
const size_t material = | ||
_material( morphologyIndex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please rename _material() function so that it starts with an action verb: reading this I don't know what it is doing. Creating one? Getting an index..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed _material to _getMaterialFromSectionType
brayns/io/MorphologyLoader.cpp
Outdated
const auto material = | ||
_material( morphologyIndex, size_t( section.getType( ))); | ||
const auto& samples = section.getSamples(); | ||
if( samples.size() == 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
samples.empty()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
brayns/io/MorphologyLoader.cpp
Outdated
for( size_t i = 0; i < samplesToProcess; ++i ) | ||
{ | ||
const auto& sample = samples[i]; | ||
Vector3f position( sample.x(), sample.y(), sample.z()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
brayns/io/MorphologyLoader.cpp
Outdated
@@ -67,6 +188,7 @@ bool MorphologyLoader::_importMorphology( | |||
const size_t simulationOffset, | |||
float& maxDistanceToSoma) | |||
{ | |||
const bool useMetaballs = _geometryParameters.getMetaballsGridSize() != 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for readability: make this a bool _useMetaballs() const func. and use it everywhere instead of _geometryParameters.getMetaballsGridSize() != 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
brayns/io/MorphologyLoader.cpp
Outdated
if( morphologySectionTypes & MST_DENDRITE ) | ||
sectionTypes.push_back( brain::neuron::SectionType::dendrite ); | ||
if( morphologySectionTypes & MST_APICAL_DENDRITE ) | ||
sectionTypes.push_back( brain::neuron::SectionType::apicalDendrite ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a duplicate from around lines 224... try to split the code into more individual functions and reuse them whenever possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, but I had to make it a free function because the return type is from brion, and since Brion is am optional dependency, that would require an #ifdef in the header.
Retest this please |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good otherwise
brayns/common/engine/Engine.cpp
Outdated
_scene.reset(); | ||
_camera.reset(); | ||
_renderers.clear(); | ||
_frameBuffer.reset(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not look useful, smart_ptrs are guaranteed to do it by themselves..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Old man habits ;-) Removed
_normals.clear(); | ||
_colors.clear(); | ||
_indices.clear(); | ||
_textureCoordinates.clear(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here...?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dito
@@ -230,7 +230,7 @@ class Scene | |||
// Model | |||
PrimitivesMap _primitives; | |||
TrianglesMeshMap _trianglesMeshes; | |||
Materials _materials; | |||
MaterialsMap _materials; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK!
brayns/io/MorphologyLoader.cpp
Outdated
@@ -279,6 +400,17 @@ bool MorphologyLoader::importCircuit( | |||
{ | |||
const auto& uri = uris[i]; | |||
float maxDistanceToSoma = 0.f; | |||
|
|||
if( _geometryParameters.getMetaballsGridSize() != 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_geometryParameters.useMetaballs()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done
brayns/io/MorphologyLoader.cpp
Outdated
@@ -363,6 +495,16 @@ bool MorphologyLoader::importCircuit( | |||
&compartmentOffsets[i] | |||
}; | |||
|
|||
if( _geometryParameters.getMetaballsGridSize() != 0 ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_geometryParameters.useMetaballs()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
Oh, in case you maintain a changelog, there is no entry for this feature ;-) |
Oops, yes, the changelog... Doing it now! |
No description provided.