morphonets / SNT

The ImageJ framework for quantification of neuronal anatomy
https://imagej.net/plugins/snt
GNU General Public License v3.0
42 stars 18 forks source link

Feat: CTRL+S to save .traces #159

Closed carshadi closed 1 year ago

carshadi commented 1 year ago

Closes #158

tferr commented 1 year ago

@carshadi, thinking a bit more about this: what would be really beneficial is a mechanism to quickly save/restore tracings from disk. I was not able to implement a full auto-save system, but added a couple of things to this PR that should streamline workflows:

tferr commented 1 year ago

@carshadi , it seems I have to release a new SNT version soon. Do you have time to look at this soonish? If so, this could be included.

carshadi commented 1 year ago

@tferr I tried the Ctrl+S and it works, but the CTRL+SHIFT+S gives an error.

java.io.FileNotFoundException: C:\Users\cameron.arshadi\Desktop\OP_1_2023-04-13_12:22:24.traces (The filename, directory name, or volume label syntax is incorrect)
    at java.io.FileOutputStream.open0(Native Method)
    at java.io.FileOutputStream.open(FileOutputStream.java:270)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:213)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:101)
    at sc.fiji.snt.PathAndFillManager.writeXML(PathAndFillManager.java:1363)
    at sc.fiji.snt.SNTUI.saveToXML(SNTUI.java:4295)
    at sc.fiji.snt.SNTUI.saveToXML(SNTUI.java:4274)
    at sc.fiji.snt.QueueJumpingKeyListener.keyPressed(QueueJumpingKeyListener.java:137)
    at java.awt.Component.processKeyEvent(Component.java:6497)
    at java.awt.Component.processEvent(Component.java:6316)
    at java.awt.Container.processEvent(Container.java:2239)
    at java.awt.Window.processEvent(Window.java:2025)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1954)
    at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:834)
    at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1102)
    at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:973)
    at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:799)
    at java.awt.Component.dispatchEventImpl(Component.java:4760)
    at java.awt.Container.dispatchEventImpl(Container.java:2297)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:760)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:84)
    at java.awt.EventQueue$4.run(EventQueue.java:733)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:730)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

To reproduce: 1) Load OP_1 2) delete all paths 3) trace a path 4) press CTRL+S - works 5) extend path 6) press CTRL+SHIFT+S - error

image

tferr commented 1 year ago

Oh, it is the colons in the time stamp. Windows does not seem to support it in filenames!?

tferr commented 1 year ago

@carshadi, please try now. Timestamp files now have only underscores in the filename. I also added a convenience menu to open relevant folders in the System File Explorer

carshadi commented 1 year ago

@tferr that fixed it. I tested it for a while and think this is good to merge!