Skip to content

Commit

Permalink
added neuronedge to handle horta neuronmodel
Browse files Browse the repository at this point in the history
  • Loading branch information
porterbot committed Jul 7, 2020
1 parent a66741c commit bad4dcc
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ allprojects {
apply plugin: 'maven-publish'
apply plugin: 'idea'
group = 'org.janelia.jacs-model'
version = '2.28'
version = '2.29.refactor'
}

subprojects {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonIgnore;

Expand Down Expand Up @@ -40,6 +41,9 @@ public class TmGeoAnnotation {
@JsonIgnore
transient private Long neuronId = null;

@JsonIgnore
transient private List<TmNeuronEdge> neuronEdges;

// implementation note: at one point we stored the parent and child objects,
// but serializing them for calling remote server routines caused the
// whole tree to get walked recursively, overflowing the stack; so
Expand All @@ -58,8 +62,10 @@ public TmGeoAnnotation(Long id, Long parentId, Long neuronId, Double x, Double y
this.radius = radius;
this.creationDate = creationDate;
this.modificationDate = modificationDate;
this.neuronEdges = new ArrayList<>();
}


@Override
public String toString() {
//return String.format("ann id %d", id);
Expand Down Expand Up @@ -102,6 +108,10 @@ public void setZ(Double z) {
updateModificationDate();
}

public List<TmNeuronEdge> getNeuronEdges() {
return neuronEdges;
}

public void addChild(TmGeoAnnotation child) {
childIds.add(child.getId());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ public class TmNeuronData implements Serializable {
@JsonIgnore
transient private Map<Long, TmStructuredTextAnnotation> textAnnotationMap;


public TmNeuronData() {
}

public List<Long> getRootAnnotationIds() {
return rootAnnotationIds;
}


@JsonIgnore
public Collection<TmNeuronEdge> getEdges() {
List<TmNeuronEdge> totalEdges = new ArrayList<>();
for (TmGeoAnnotation annotation : geoAnnotations) {
totalEdges.addAll(annotation.getNeuronEdges());
}
return totalEdges;
}

// maps geo ann ID to geo ann object
@JsonIgnore
public Map<Long, TmGeoAnnotation> getGeoAnnotationMap() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package org.janelia.model.domain.tiledMicroscope;

public class TmNeuronEdge {
private final TmGeoAnnotation child;
private final TmGeoAnnotation parent;

TmNeuronEdge(TmGeoAnnotation parent, TmGeoAnnotation child)
{
this.parent = parent;
this.child = child;
}

public TmGeoAnnotation getParentVertex() {
return parent;
}

public TmGeoAnnotation getChildVertex() {
return child;
}

@Override
public boolean equals(Object obj)
{
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
final TmNeuronEdge other = (TmNeuronEdge) obj;
if (parent!=other.parent && child!=other.child) {
return false;
}
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ public static TmNeuronMetadata copy(TmNeuronMetadata neuron) {
return copy;
}

public void updateEdges() {

}

public void merge(TmNeuronMetadata neuron) {
this.setName(neuron.getName());
this.setWorkspaceRef(neuron.getWorkspaceRef());
Expand Down Expand Up @@ -197,6 +201,14 @@ public void addGeometricAnnotation(TmGeoAnnotation tmGeoAnnotation) {
}


/**
* Pass-through method to TmNeuronData
*/
@JsonIgnore
public Collection<TmNeuronEdge> getEdges() {
return neuronData.getEdges();
}

/**
* Pass-through method to TmNeuronData
*/
Expand Down

0 comments on commit bad4dcc

Please sign in to comment.