LoadingProcedures { public static String addSynapseToRoiInfoWithHP(String roiInfoString, String roi, String synapseType, Double synapseConfidence, Double preHPThreshold, Double postHPThreshold) { RoiInfoWithHighPrecisionCounts roiInfo = getRoiInfoHPFromString(roiInfoString); if (synapseType.equals(PRE) && synapseConfidence != null && synapseConfidence > preHPThreshold) { roiInfo.incrementPreForRoi(roi); roiInfo.incrementPreHPForRoi(roi); } else if (synapseType.equals(PRE)) { roiInfo.incrementPreForRoi(roi); } else if (synapseType.equals(POST) && synapseConfidence != null && synapseConfidence > postHPThreshold) { roiInfo.incrementPostForRoi(roi); roiInfo.incrementPostHPForRoi(roi); } else if (synapseType.equals(POST)) { roiInfo.incrementPostForRoi(roi); } return roiInfo.getAsJsonString(); }  @Procedure(value = "loader.setConnectionSetRoiInfoAndWeightHP", mode = Mode.WRITE) @Description("loader.setConnectionSetRoiInfoAndWeightHP : Add roiInfo property to ConnectionSet node.") void setConnectionSetRoiInfoAndWeightHP(@Name("preBodyId") final Long preBodyId,
                                                   @Name("postBodyId") final Long postBodyId,
                                                   @Name("datasetLabel") final String datasetLabel,
                                                   @Name("preHPThreshold") final Double preHPThreshold,
                                                   @Name("postHPThreshold") final Double postHPThreshold); @Procedure(value = "loader.addPropsAndConnectionInfoToSegment", mode = Mode.WRITE) @Description("loader.addPropsAndConnectionInfoToSegment(segmentNode, synapseSetNode, dataset, preHPThreshold, postHPThreshold, neuronThreshold, addCSRoiInfoAndWeightHP)") void addPropsAndConnectionInfoToSegment(@Name("segment") final Node segment,
                                                   @Name("synapseSet") final Node synapseSet,
                                                   @Name("dataset") final String dataset,
                                                   @Name("preHPThreshold") final Double preHPThreshold,
                                                   @Name("postHPThreshold") final Double postHPThreshold,
                                                   @Name("neuronThreshold") final Long neuronThreshold,
                                                   @Name("addCSRoiInfoAndWeightHP") final boolean addCSRoiInfoAndWeightHP); static Set<String> getMetaNodeRoiSet(final Node metaNode); static void incrementSegmentPreCount(Node segment); static void incrementSegmentPostCount(Node segment); static String addSynapseToRoiInfo(String roiInfoString, String roiName, String synapseType); static Map<String, SynapseCounter> getRoiInfoAsMap(String roiInfoString); static void convertSegmentToNeuron(final Node segment, final String datasetLabel, final Node metaNode); static String generateClusterName(RoiInfo roiInfo, long totalPre, long totalPost, double threshold, Set<String> includedRois); static void addWeightAndWeightHPToConnectsTo(Node connectionSet, int weight, int weightHP); static void addWeightToConnectsTo(Set<Node> synapsesForConnectionSet, Node connectionSet, Set<String> metaNodeRoiSet); static int[] setConnectionSetRoiInfoAndGetWeightAndWeightHP(Set<Node> synapsesForConnectionSet, Node connectionSet, Double preHPThreshold, Double postHPThreshold, Set<String> metaNodeRoiSet); static int[] setConnectionSetRoiInfoWeightAndWeightHP(Set<Node> synapsesForConnectionSet, Node connectionSetNode, double preHPThreshold, double postHPThreshold, Set<String> metaNodeRoiSet); static String addSynapseToRoiInfoWithHP(String roiInfoString, String roi, String synapseType, Double synapseConfidence, Double preHPThreshold, Double postHPThreshold); static String removeSynapseFromRoiInfoWithHP(String roiInfoString, String roi, String synapseType, Double synapseConfidence, Double preHPThreshold, Double postHPThreshold); static Relationship addConnectsToRelationship(Node startNode, Node endNode, long weight); static void addSynapseToSynapseSet(final Node synapseSet, final Node synapse); static Map<String, Double> getPreAndPostHPThresholdFromMetaNode(Node metaNode); @Context
    public GraphDatabaseService dbService; @Context
    public Log log; }
@Test public void shouldAddSynapseToRoiInfoWithHP() { RoiInfoWithHighPrecisionCounts roiInfo = new RoiInfoWithHighPrecisionCounts(); roiInfo.incrementPreForRoi("roiA"); roiInfo.incrementPreHPForRoi("roiA"); roiInfo.incrementPostForRoi("roiA"); String initialRoiInfoString = roiInfo.getAsJsonString(); String newRoiInfoString = addSynapseToRoiInfoWithHP(initialRoiInfoString, "roiB", "post", 0.5, .9, .4); Assert.assertEquals("{\"roiA\":{\"preHP\":1,\"postHP\":0,\"pre\":1,\"post\":1},\"roiB\":{\"preHP\":0,\"postHP\":1,\"pre\":0,\"post\":1}}",newRoiInfoString); String newRoiInfoString2 = addSynapseToRoiInfoWithHP(newRoiInfoString, "roiB", "pre", 0.98, .9, .4); Assert.assertEquals("{\"roiA\":{\"preHP\":1,\"postHP\":0,\"pre\":1,\"post\":1},\"roiB\":{\"preHP\":1,\"postHP\":1,\"pre\":1,\"post\":1}}",newRoiInfoString2); }