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

Added the option to use metaballs for generating meshes for somas #116

Merged
merged 5 commits into from
Feb 9, 2017

Conversation

favreau
Copy link
Member

@favreau favreau commented Feb 7, 2017

No description provided.

@@ -35,6 +36,8 @@
# include <brion/brion.h>
#endif

//#define BRAYNS_USE_BRION //// TO REMOVE ////
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then remove?

Copy link
Member Author

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;
Copy link

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

Copy link
Member Author

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.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK!

// Soma
const brain::neuron::Soma& soma = morphology.getSoma();
const size_t material =
_material( morphologyIndex,
Copy link

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..?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed _material to _getMaterialFromSectionType

const auto material =
_material( morphologyIndex, size_t( section.getType( )));
const auto& samples = section.getSamples();
if( samples.size() == 0 )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

samples.empty()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

for( size_t i = 0; i < samplesToProcess; ++i )
{
const auto& sample = samples[i];
Vector3f position( sample.x(), sample.y(), sample.z());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -67,6 +188,7 @@ bool MorphologyLoader::_importMorphology(
const size_t simulationOffset,
float& maxDistanceToSoma)
{
const bool useMetaballs = _geometryParameters.getMetaballsGridSize() != 0;
Copy link

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

if( morphologySectionTypes & MST_DENDRITE )
sectionTypes.push_back( brain::neuron::SectionType::dendrite );
if( morphologySectionTypes & MST_APICAL_DENDRITE )
sectionTypes.push_back( brain::neuron::SectionType::apicalDendrite );
Copy link

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.

Copy link
Member Author

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.

@favreau
Copy link
Member Author

favreau commented Feb 8, 2017

Retest this please

Copy link

@rdumusc rdumusc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good otherwise

_scene.reset();
_camera.reset();
_renderers.clear();
_frameBuffer.reset();
Copy link

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..?

Copy link
Member Author

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();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here...?

Copy link
Member Author

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;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK!

@@ -279,6 +400,17 @@ bool MorphologyLoader::importCircuit(
{
const auto& uri = uris[i];
float maxDistanceToSoma = 0.f;

if( _geometryParameters.getMetaballsGridSize() != 0 )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_geometryParameters.useMetaballs()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Done

@@ -363,6 +495,16 @@ bool MorphologyLoader::importCircuit(
&compartmentOffsets[i]
};

if( _geometryParameters.getMetaballsGridSize() != 0 )
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_geometryParameters.useMetaballs()

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@rdumusc
Copy link

rdumusc commented Feb 9, 2017

Oh, in case you maintain a changelog, there is no entry for this feature ;-)

@favreau
Copy link
Member Author

favreau commented Feb 9, 2017

Oops, yes, the changelog... Doing it now!

@favreau favreau merged commit 56eba5a into BlueBrain:master Feb 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants