Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;

/**
Expand Down Expand Up @@ -140,11 +141,15 @@ public void actionPerformed(ActionEvent ae) {
null, null, AccessManager.getSubjectKey());
try {
BufferedWriter writer = new BufferedWriter(new FileWriter(fileOutputLocation.getText()));
for(TmOperation log: logs) {
writer.write(log.getTimestamp().toString() + "," +
log.getWorkspaceId() + "," + log.getNeuronId() + "," +
log.getUser() + "," + log.getActivity() + "," +
log.getElapsedTime());
for (TmOperation log : logs) {
writer.write(
Objects.toString(log.getTimestamp(), "") + "," +
Objects.toString(log.getWorkspaceId(), "") + "," +
Objects.toString(log.getNeuronId(), "") + "," +
Objects.toString(log.getUser(), "") + "," +
Objects.toString(log.getActivity(), "") + "," +
Objects.toString(log.getElapsedTime(), "")
);
writer.newLine();
}
writer.close();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,7 @@
import org.janelia.jacsstorage.clients.api.http.ClientProxy;
import org.janelia.model.domain.DomainConstants;
import org.janelia.model.domain.enums.FileType;
import org.janelia.model.domain.tiledMicroscope.TmColorModel;
import org.janelia.model.domain.tiledMicroscope.TmGeoAnnotation;
import org.janelia.model.domain.tiledMicroscope.TmNeuronMetadata;
import org.janelia.model.domain.tiledMicroscope.TmObjectMesh;
import org.janelia.model.domain.tiledMicroscope.TmSample;
import org.janelia.model.domain.tiledMicroscope.TmWorkspace;
import org.janelia.model.domain.tiledMicroscope.*;
import org.janelia.rendering.RenderedVolumeLoader;
import org.janelia.rendering.RenderedVolumeLoaderImpl;
import org.janelia.scenewindow.OrbitPanZoomInteractor;
Expand All @@ -132,6 +127,7 @@
import org.janelia.scenewindow.fps.FrameTracker;
import org.janelia.workstation.common.actions.CopyToClipboardAction;
import org.janelia.workstation.controller.NeuronManager;
import org.janelia.workstation.controller.TmViewerManager;
import org.janelia.workstation.controller.ViewerEventBus;
import org.janelia.workstation.controller.access.ModelTranslation;
import org.janelia.workstation.controller.action.AddEditNoteAction;
Expand Down Expand Up @@ -1356,8 +1352,12 @@ public void actionPerformed(ActionEvent e) {
viewMenu.add(new AbstractAction("Recenter on This 3D Position [left-click]") {
@Override
public void actionPerformed(ActionEvent e) {
long startTime = System.currentTimeMillis();
PerspectiveCamera pCam = (PerspectiveCamera) sceneWindow.getCamera();
neuronTraceLoader.animateToFocusXyz(mouseStageLocation, pCam.getVantage(), 150);
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.RECENTER_3D_VIEW,
null, endTime-startTime);
}
});
}
Expand Down Expand Up @@ -1782,6 +1782,7 @@ public void actionPerformed(ActionEvent e) {
topMenu.add(new AbstractAction("Center on Current Anchor") {
@Override
public void actionPerformed(ActionEvent e) {
long startTime = System.currentTimeMillis();
PerspectiveCamera pCam = (PerspectiveCamera) sceneWindow.getCamera();
float[] vtxLocation = TmModelManager.getInstance().getLocationInMicrometers(vertex.getX(),
vertex.getY(), vertex.getZ());
Expand All @@ -1792,6 +1793,9 @@ public void actionPerformed(ActionEvent e) {
null,
false);
setSampleLocation(event);
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.CENTER_CURRENT_ANCHOR,
null, endTime-startTime);
}
});

Expand Down Expand Up @@ -1833,24 +1837,36 @@ public void actionPerformed(ActionEvent e) {
topMenu.add(new AbstractAction("Set Vertex as Neuron Root") {
@Override
public void actionPerformed(ActionEvent e) {
long startTime = System.currentTimeMillis();
RerootNeuronAction action = new RerootNeuronAction();
action.execute(vertex.getNeuronId(), vertex.getId());
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.SET_VERTEX_NEURON_ROOT,
null, endTime-startTime);
}
});

topMenu.add(new AbstractAction("Split Neuron Edge Between Vertices") {
@Override
public void actionPerformed(ActionEvent e) {
long startTime = System.currentTimeMillis();
SplitNeuronBetweenVerticesAction action = new SplitNeuronBetweenVerticesAction();
action.execute(vertex.getNeuronId(), vertex.getId());
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.SPLIT_NEURON_EDGE_VERTICES,
null, endTime-startTime);
}
});

topMenu.add(new AbstractAction("Split Neurite At Vertex") {
@Override
public void actionPerformed(ActionEvent e) {
long startTime = System.currentTimeMillis();
SplitNeuronAtVertexAction action = new SplitNeuronAtVertexAction();
action.execute(vertex.getNeuronId(), vertex.getId());
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.SPLIT_NEURITE_AT_VERTEX,
null, endTime-startTime);
}
});
}
Expand All @@ -1875,10 +1891,14 @@ public void actionPerformed(ActionEvent e) {
AbstractAction hideNeuronAction = new AbstractAction("Hide Neuron") {
@Override
public void actionPerformed(ActionEvent e) {
long startTime = System.currentTimeMillis();
TmModelManager.getInstance().getCurrentView().addAnnotationToHidden(indicatedNeuron.getId());
NeuronUpdateEvent updateEvent = new NeuronUpdateEvent(
this, Arrays.asList(new TmNeuronMetadata[]{indicatedNeuron}));
ViewerEventBus.postEvent(updateEvent);
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.HIDE_NEURON,
null, endTime-startTime);
}
};
topMenu.add(hideNeuronAction);
Expand Down Expand Up @@ -1949,6 +1969,7 @@ public void actionPerformed(ActionEvent e) {
topMenu.add(new AbstractAction("Merge neurites...") {
@Override
public void actionPerformed(ActionEvent e) {

interactorContext.mergeNeurites();
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import javax.swing.event.MouseInputListener;

import Jama.Matrix;
import org.janelia.model.domain.tiledMicroscope.*;
import org.janelia.workstation.controller.TmViewerManager;
import org.janelia.workstation.controller.action.AnnotationSetRadiusAction;
import org.janelia.workstation.controller.action.NeuronChooseColorAction;
import org.janelia.workstation.controller.model.DefaultNeuron;
Expand All @@ -45,8 +47,6 @@
import org.janelia.horta.actors.SpheresActor;
import org.janelia.horta.actors.VertexHighlightActor;
import org.janelia.horta.options.TileLoadingPanel;
import org.janelia.model.domain.tiledMicroscope.TmGeoAnnotation;
import org.janelia.model.domain.tiledMicroscope.TmWorkspace;
import org.janelia.workstation.controller.NeuronManager;
import org.janelia.workstation.controller.SpatialIndexManager;
import org.janelia.workstation.controller.ViewerEventBus;
Expand All @@ -58,8 +58,6 @@
import org.janelia.workstation.core.api.AccessManager;
import org.janelia.workstation.core.keybind.KeymapUtil;
import org.janelia.workstation.core.util.ConsoleProperties;
import org.janelia.model.domain.tiledMicroscope.TmNeuronMetadata;
import org.janelia.model.domain.tiledMicroscope.TmNeuronTagMap;
import org.janelia.workstation.core.workers.SimpleWorker;
import org.janelia.workstation.geom.Vec3;
import org.janelia.workstation.integration.util.FrameworkAccess;
Expand Down Expand Up @@ -323,8 +321,9 @@ public void mouseExited(MouseEvent event) {

public boolean selectParentVertex(TmGeoAnnotation vertex, TmNeuronMetadata neuron)
{
long startTime = System.currentTimeMillis();
if (vertex == null) return false;

if (cachedParentVertex == vertex)
return false;
cachedParentVertex = vertex;
Expand Down Expand Up @@ -378,6 +377,9 @@ public boolean selectParentVertex(TmGeoAnnotation vertex, TmNeuronMetadata neuro
updateActorListener.neuronVertexUpdated(new VertexWithNeuron(
vertex, neuron));
log.info("Horta parent vertex set");
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.SELECT_VERTEX,
null, endTime-startTime);

return true;
}
Expand Down Expand Up @@ -555,6 +557,7 @@ public void mouseDragged(MouseEvent event)
return;
}

long startTime = System.currentTimeMillis();
// log.info("Dragging a vertex");
// Update display (only) of dragged vertex
// Update location of hover vertex glyph
Expand Down Expand Up @@ -593,6 +596,10 @@ public void mouseDragged(MouseEvent event)

event.consume(); // Don't let OrbitPanZoomInteractor drag the world
// log.info("Consumed tracing drag event");

long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.MOVE_VERTEX,
null, endTime-startTime);
}

@Override
Expand Down Expand Up @@ -987,7 +994,7 @@ public boolean canCreateRootVertex() {
}

public boolean appendVertex() {
long beginAppendTime = System.nanoTime();
long startTime = System.currentTimeMillis();
if (! canAppendVertex())
return false;
if (!TmModelManager.checkOwnership(
Expand All @@ -1009,6 +1016,9 @@ public boolean appendVertex() {
FrameworkAccess.handleException(error);
return false;
}
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.APPEND_VERTEX,
null, endTime-startTime);
return true;
}

Expand Down Expand Up @@ -1041,9 +1051,14 @@ public boolean canClearParent() {
public void clearParent() {
if (! canClearParent())
return;

long startTime = System.currentTimeMillis();
clearParentVertex();
SelectionAnnotationEvent annEvent = new SelectionAnnotationEvent(this,
null, false, true);
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.CLEAR_PARENT_ANCHOR,
null, endTime-startTime);
ViewerEventBus.postEvent(annEvent);
}

Expand Down Expand Up @@ -1087,16 +1102,6 @@ public boolean canSplitNeurite() {
if (TmModelManager.getInstance().getCurrentView().isProjectReadOnly()) return false;
return true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It looks like you deleted a method splitNeurite() here. Is that intentional? I didn't see a usage in IntelliJ, but then again, I don't see a usage for canSplitNeurite() either, which you've kept.

public boolean splitNeurite() {
if (!canSplitNeurite())
return false;
if (!TmModelManager.checkOwnership(NeuronManager.getInstance().getNeuronFromNeuronID(hoveredVertex.getNeuronId()))) {
return false;
}

return true;
}

private List<Long> findAncestors(Long neuronId, TmGeoAnnotation vertex) {
List<Long> ancestors = new ArrayList<>();
Expand Down Expand Up @@ -1124,6 +1129,7 @@ public boolean canMergeNeurite() {
public boolean mergeNeurites() {
if (!canMergeNeurite())
return false;
long startTime = System.currentTimeMillis();
if (hoveredNeuron == parentNeuron) {
List<Long> targetAncestors = findAncestors(hoveredNeuron.getId(), hoveredVertex);
List<Long> sourceAncestors = findAncestors(hoveredNeuron.getId(), parentVertex);
Expand Down Expand Up @@ -1168,6 +1174,9 @@ public boolean mergeNeurites() {
FrameworkAccess.handleException(error);
return false;
}
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.MERGE_NEURITES,
null, endTime-startTime);
return true;
}

Expand Down Expand Up @@ -1205,6 +1214,7 @@ public void selectNeuron(TmNeuronMetadata neuron) {
}

public void selectParent() {
long startTime = System.currentTimeMillis();
TmModelManager.getInstance().getCurrentSelections().setCurrentNeuron(hoveredNeuron);
TmModelManager.getInstance().getCurrentSelections().setCurrentVertex(hoveredVertex);
SelectionAnnotationEvent event = new SelectionAnnotationEvent(this,
Expand All @@ -1214,6 +1224,10 @@ public void selectParent() {
selectParentVertex(hoveredVertex, hoveredNeuron);
NeuronManager.getInstance().updateFragsByAnnotation(hoveredNeuron.getId(), hoveredVertex.getId());

long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.SELECT_VERTEX,
null, endTime-startTime);

}

boolean canUpdateAnchorRadius() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;
import javax.swing.event.MouseInputListener;

import org.janelia.model.domain.tiledMicroscope.TmOperation;
import org.janelia.workstation.controller.TmViewerManager;
import org.openide.util.Exceptions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -167,10 +170,14 @@ public void mouseDragged(MouseEvent event) {
}
// Middle drag to rotate
else if (isRotateMode(event)) {
long startTime = System.currentTimeMillis();
if (camera.getVantage().isConstrainedToUpDirection())
bChanged = orbitPixels(dx, -dy, 6.0f);
else
bChanged = rotatePixels(dx, -dy, 6.0f);
long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.ROTATE_SCREEN,
null, endTime-startTime);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ public synchronized void changeNeuronOwner(List<TmNeuronMetadata> neuronList, Su
}

public synchronized void deleteNeuron(final TmNeuronMetadata deletedNeuron) {

long startTime = System.currentTimeMillis();
// Update the UI first
if (applyFilter) {
// if filter, add and remove fragments as necessary
Expand All @@ -517,6 +517,10 @@ public synchronized void deleteNeuron(final TmNeuronMetadata deletedNeuron) {
FrameworkAccess.handleException(e);
return null;
});

long endTime = System.currentTimeMillis();
TmViewerManager.getInstance().logOperation(TmOperation.Activity.DELETE_NEURON,
null, endTime-startTime);
}

/**
Expand Down Expand Up @@ -1256,7 +1260,6 @@ public synchronized void deleteSubTree(final TmGeoAnnotation rootAnnotation) thr
if (rootAnnotation == null) {
return;
}

final TmNeuronMetadata neuron = getNeuronFromNeuronID(rootAnnotation.getNeuronId());
TmModelManager.getInstance().getNeuronHistory().checkBackup(neuron);
if (neuron == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
import org.janelia.workstation.integration.util.FrameworkAccess;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;

public class TmViewerManager implements GlobalViewerController {
Expand Down Expand Up @@ -60,16 +63,19 @@ public void logOperation (TmOperation.Activity activity, Date timestamp, Long el
if (!ApplicationPanel.isOperationsLogged()) {
return;
}
String timestampDate = null;
if (timestamp!=null) {
timestampDate = timestamp.toString();
}
Long workspaceId = null, sampleId = null;
if (modelManager.getCurrentWorkspace()!=null)
workspaceId = modelManager.getCurrentWorkspace().getId();
tmDomainMgr.createOperationLog(modelManager.getCurrentSample().getId(),
workspaceId, null,
activity, timestampDate, elapsedTime, AccessManager.getSubjectKey());
TmOperation newOperationLog = new TmOperation();
newOperationLog.setActivity(activity);
newOperationLog.setTimestamp(timestamp);
newOperationLog.setElapsedTime(elapsedTime);
newOperationLog.setWorkspaceId(workspaceId);
if (modelManager.getCurrentSelections().getCurrentNeuron()!=null)
newOperationLog.setNeuronId(modelManager.getCurrentSelections().getCurrentNeuron().getId());
if (modelManager.getCurrentSelections().getCurrentVertex()!=null)
newOperationLog.setVertexId(modelManager.getCurrentSelections().getCurrentVertex().getId());
tmDomainMgr.createOperationLog(newOperationLog, AccessManager.getSubjectKey());
}

@Subscribe
Expand Down
Loading