knime-ip / knip

KNIME Image Processing Extension
https://www.knime.com/community/image-processing
50 stars 10 forks source link

Segment Cropper in Don't Save loop cannot get saved #430

Closed imagejan closed 7 years ago

imagejan commented 7 years ago

When using the Segment Cropper node inside a Don't Save Start/End loop, the workflow cannot be saved in an executed state. When you try to save the executed workflow, the following exceptions get thrown:

2016-12-15 13:47:35,878 : DEBUG : ModalContext : SaveWorkflowRunnable :  :  : Could not save workflow
java.lang.NullPointerException
    at java.io.FileInputStream.<init>(FileInputStream.java:130)
    at org.knime.core.data.container.Buffer.addToZipFile(Buffer.java:1806)
    at org.knime.core.data.container.ContainerTable.saveToFile(ContainerTable.java:193)
    at org.knime.core.node.BufferedDataTable.save(BufferedDataTable.java:486)
    at org.knime.core.node.FileNodePersistor.saveBufferedDataTable(FileNodePersistor.java:1465)
    at org.knime.core.node.FileNodePersistor.saveInternalHeldTables(FileNodePersistor.java:1313)
    at org.knime.core.node.FileNodePersistor.save(FileNodePersistor.java:1232)
    at org.knime.core.node.workflow.FileNativeNodeContainerPersistor.save(FileNativeNodeContainerPersistor.java:502)
    at org.knime.core.node.workflow.FileSingleNodeContainerPersistor.save(FileSingleNodeContainerPersistor.java:605)
    at org.knime.core.node.workflow.FileWorkflowPersistor.saveNodeContainer(FileWorkflowPersistor.java:2233)
    at org.knime.core.node.workflow.FileWorkflowPersistor.saveContent(FileWorkflowPersistor.java:2003)
    at org.knime.core.node.workflow.FileWorkflowPersistor.save(FileWorkflowPersistor.java:1919)
    at org.knime.core.node.workflow.WorkflowManager.save(WorkflowManager.java:8139)
    at org.knime.workbench.editor2.SaveWorkflowRunnable.run(SaveWorkflowRunnable.java:125)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

and

2016-12-15 13:47:35,890 : DEBUG : main : WorkflowEditor :  :  : Could not save workflow: Could not save workflow: null
java.lang.reflect.InvocationTargetException
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:420)
    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:500)
    at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:284)
    at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1204)
    at org.knime.workbench.editor2.WorkflowEditor.saveTo(WorkflowEditor.java:1534)
    at org.knime.workbench.editor2.WorkflowEditor.doSave(WorkflowEditor.java:1647)
    at org.eclipse.ui.internal.SaveableHelper$2.run(SaveableHelper.java:156)
    at org.eclipse.ui.internal.SaveableHelper$5.run(SaveableHelper.java:285)
    at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:463)
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:371)
    at org.eclipse.ui.internal.WorkbenchWindow$14.run(WorkbenchWindow.java:2156)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
    at org.eclipse.ui.internal.WorkbenchWindow.run(WorkbenchWindow.java:2152)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:293)
    at org.eclipse.ui.internal.SaveableHelper.runProgressMonitorOperation(SaveableHelper.java:271)
    at org.eclipse.ui.internal.SaveableHelper.savePart(SaveableHelper.java:161)
    at org.eclipse.ui.internal.WorkbenchPage.saveSaveable(WorkbenchPage.java:3874)
    at org.eclipse.ui.internal.WorkbenchPage.saveEditor(WorkbenchPage.java:3888)
    at org.eclipse.ui.internal.handlers.SaveHandler.execute(SaveHandler.java:54)
    at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:295)
    at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:90)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:56)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:252)
    at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:234)
    at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
    at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:152)
    at org.eclipse.core.commands.Command.executeWithChecks(Command.java:493)
    at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:486)
    at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:210)
    at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:343)
    at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:160)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:595)
    at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:511)
    at org.eclipse.jface.action.ActionContributionItem$6.handleEvent(ActionContributionItem.java:462)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4362)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1113)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4180)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3769)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
    at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:337)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
    at org.knime.product.rcp.KNIMEApplication.start(KNIMEApplication.java:137)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
Caused by: org.eclipse.swt.SWTException: Invalid thread access
    at org.eclipse.swt.SWT.error(SWT.java:4491)
    at org.eclipse.swt.SWT.error(SWT.java:4406)
    at org.eclipse.swt.SWT.error(SWT.java:4377)
    at org.eclipse.swt.widgets.Widget.error(Widget.java:482)
    at org.eclipse.swt.widgets.Widget.checkWidget(Widget.java:373)
    at org.eclipse.swt.widgets.ToolItem.setEnabled(ToolItem.java:630)
    at org.eclipse.jface.action.StatusLine.setCanceled(StatusLine.java:505)
    at org.eclipse.jface.action.StatusLineManager$1.setCanceled(StatusLineManager.java:177)
    at org.eclipse.core.runtime.ProgressMonitorWrapper.setCanceled(ProgressMonitorWrapper.java:139)
    at org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor.setCanceled(EventLoopProgressMonitor.java:152)
    at org.knime.workbench.editor2.SaveWorkflowRunnable.run(SaveWorkflowRunnable.java:174)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)

When trying to re-open the workflow, it is broken, i.e. the Segment Cropper is missing and the subsequent nodes are orphaned and therefore don't contain any data.

Here is an example workflow that reproduces the issue:

DontSave Bug SegmentCropper.zip

The result of re-saving the workflow in an executed state is this:

DontSave Bug SegmentCropper Executed.zip

imagejan commented 7 years ago

Is there anything more I should try to get at the cause of this issue? It is blocking one of our groups here at FMI who want to read and annotate large datasets (a few GB each single volume image) and keep only the processed regions, so we're using the Don't Save nodes to avoid saving the original image data with every saved version of the workflow. Unfortunately, this is incompatible with the use of the Segment Cropper.

gab1one commented 7 years ago

Hi @imagejan, I am looking at this bug today ~and hope I can fix it quickly.~ I fixed the bug sucessfully, the next nightly build should contain a fixed version of the Segment Cropper.