Skip to content

Commit

Permalink
fix: respect all segment group
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjayankur31 committed May 18, 2023
1 parent 766d52d commit 5627e12
Showing 1 changed file with 52 additions and 51 deletions.
103 changes: 52 additions & 51 deletions src/main/java/org/neuroml/export/neuron/JSONCellSerializer.java
Expand Up @@ -300,72 +300,73 @@ else if(fract == 0 && segsPar.get(0) == parentId)
boolean foundAll = false;
for(SegmentGroup grp : morph.getSegmentGroup())
{
if(!grp.getId().equals("all")) // I'll calculate this here...
if(grp.getId().equals("all")) // I'll calculate this here...
{
if(!(foundNeuroLexFlags && CellUtils.isUnbranchedNonOverlapping(grp)))
{
g.writeStartObject();
g.writeStringField("name", grp.getId());
foundAll = true;
}
if(!(foundNeuroLexFlags && CellUtils.isUnbranchedNonOverlapping(grp)))
{
g.writeStartObject();
g.writeStringField("name", grp.getId());

if(!grp.getMember().isEmpty())
if(!grp.getMember().isEmpty())
{
g.writeArrayFieldStart("segments");
for(Member m : grp.getMember())
{
g.writeString(idsVsNames.get(m.getSegment()));
}
g.writeEndArray();
}
if(!grp.getInclude().isEmpty())
{
g.writeArrayFieldStart("groups");
for(org.neuroml.model.Include inc : grp.getInclude())
{
g.writeArrayFieldStart("segments");
for(Member m : grp.getMember())
boolean isSection = CellUtils.isUnbranchedNonOverlapping(namesVsSegmentGroups.get(inc.getSegmentGroup()));
if(!isSection)
{
g.writeString(idsVsNames.get(m.getSegment()));
g.writeString(inc.getSegmentGroup());
}
g.writeEndArray();
}
if(!grp.getInclude().isEmpty())
g.writeEndArray();
g.writeArrayFieldStart("sections");
for(org.neuroml.model.Include inc : grp.getInclude())
{
g.writeArrayFieldStart("groups");
for(org.neuroml.model.Include inc : grp.getInclude())
boolean isSection = CellUtils.isUnbranchedNonOverlapping(namesVsSegmentGroups.get(inc.getSegmentGroup()));
if(isSection)
{
boolean isSection = CellUtils.isUnbranchedNonOverlapping(namesVsSegmentGroups.get(inc.getSegmentGroup()));
if(!isSection)
{
g.writeString(inc.getSegmentGroup());
}
g.writeString(inc.getSegmentGroup());
}
g.writeEndArray();
g.writeArrayFieldStart("sections");
for(org.neuroml.model.Include inc : grp.getInclude())
{
boolean isSection = CellUtils.isUnbranchedNonOverlapping(namesVsSegmentGroups.get(inc.getSegmentGroup()));
if(isSection)
{
g.writeString(inc.getSegmentGroup());
}
}
g.writeEndArray();
}
// System.out.println("+++ " +grp.getInhomogeneousParameter());
// System.out.println("-- " +ChannelDensity.class.getSimpleName());
if(!grp.getInhomogeneousParameter().isEmpty())
g.writeEndArray();
}
// System.out.println("+++ " +grp.getInhomogeneousParameter());
// System.out.println("-- " +ChannelDensity.class.getSimpleName());
if(!grp.getInhomogeneousParameter().isEmpty())
{
g.writeArrayFieldStart("inhomogeneousParameters");
for(InhomogeneousParameter ih : grp.getInhomogeneousParameter())
{
g.writeArrayFieldStart("inhomogeneousParameters");
for(InhomogeneousParameter ih : grp.getInhomogeneousParameter())
g.writeStartObject();
g.writeStringField("id", ih.getId());
g.writeStringField("variable", ih.getVariable());
inhomogeneousParametersVsVariables.put(ih.getId(), ih.getVariable());
g.writeStringField("metric", ih.getMetric().value());
if(ih.getProximal() != null)
{
g.writeStartObject();
g.writeStringField("id", ih.getId());
g.writeStringField("variable", ih.getVariable());
inhomogeneousParametersVsVariables.put(ih.getId(), ih.getVariable());
g.writeStringField("metric", ih.getMetric().value());
if(ih.getProximal() != null)
{
g.writeStringField("proximalTranslationStart", ih.getProximal().getTranslationStart() + "");
}
if(ih.getDistal() != null)
{
g.writeStringField("distalNormalizationEnd", ih.getDistal().getNormalizationEnd() + "");
}
g.writeEndObject();
g.writeStringField("proximalTranslationStart", ih.getProximal().getTranslationStart() + "");
}
if(ih.getDistal() != null)
{
g.writeStringField("distalNormalizationEnd", ih.getDistal().getNormalizationEnd() + "");
}
g.writeEndArray();
g.writeEndObject();
}
g.writeEndArray();
}

g.writeEndObject();
}
g.writeEndObject();
}
}
if(!foundAll)
Expand Down

0 comments on commit 5627e12

Please sign in to comment.