|
31 | 31 | import org.scijava.Context; |
32 | 32 | import org.scijava.app.StatusService; |
33 | 33 | import org.scijava.batch.BatchService; |
| 34 | +import org.scijava.command.CommandModule; |
34 | 35 | import org.scijava.command.CommandService; |
35 | 36 | import org.scijava.convert.ConvertService; |
36 | 37 | import org.scijava.display.DisplayService; |
|
52 | 53 | import org.scijava.util.VersionUtils; |
53 | 54 | import sc.fiji.snt.analysis.sholl.ShollUtils; |
54 | 55 | import sc.fiji.snt.gui.GuiUtils; |
| 56 | +import sc.fiji.snt.gui.cmds.BigDataLoaderCmd; |
55 | 57 | import sc.fiji.snt.util.BoundingBox; |
56 | 58 | import sc.fiji.snt.viewer.Viewer3D; |
57 | 59 |
|
|
68 | 70 | import java.text.SimpleDateFormat; |
69 | 71 | import java.util.List; |
70 | 72 | import java.util.*; |
| 73 | +import java.util.concurrent.ExecutionException; |
| 74 | +import java.util.concurrent.Future; |
71 | 75 | import java.util.concurrent.TimeUnit; |
| 76 | +import java.util.concurrent.TimeoutException; |
72 | 77 | import java.util.jar.Attributes; |
73 | 78 | import java.util.jar.Manifest; |
74 | 79 | import java.util.regex.Matcher; |
@@ -715,25 +720,47 @@ private static List<Class<? extends Service>> requiredServices() { |
715 | 720 | } |
716 | 721 |
|
717 | 722 | /** |
718 | | - * Convenience method to start up SNT's GUI. |
719 | | - * |
| 723 | + * Convenience method to start up SNT's GUI in 'standard' mode. |
| 724 | + * |
720 | 725 | * @return a reference to the {@link SNT} instance just started.s |
721 | 726 | */ |
722 | 727 | public static SNT startApp() { |
| 728 | + return startApp(false); |
| 729 | + } |
| 730 | + |
| 731 | + /** |
| 732 | + * Convenience method to start up SNT's GUI. |
| 733 | + * @param streamMode If {@code true} SNT is initialized in stream (big data) mode, otherwise in 'standard' mode. |
| 734 | + * @return a reference to the {@link SNT} instance just started.s |
| 735 | + */ |
| 736 | + public static SNT startApp(final boolean streamMode) { |
723 | 737 | GuiUtils.setLookAndFeel(); // needs to be called here to set L&F of image's contextual menu!? |
724 | 738 | if (context == null && ij.IJ.getInstance() == null) { |
725 | | - new ImageJ().ui().showUI(); |
| 739 | + new ImageJ().ui().showUI(); // ImageJ ui needs to be displayed for proper display of scijava prompts |
726 | 740 | } |
727 | | - setIsLoading(true); |
728 | | - final PathAndFillManager pathAndFillManager = new PathAndFillManager(); |
729 | | - final SNT snt = new SNT(getContext(), pathAndFillManager); |
730 | | - snt.initialize(null); |
731 | | - try { |
732 | | - javax.swing.SwingUtilities.invokeAndWait(snt::startUI); |
733 | | - } catch (final InvocationTargetException | InterruptedException e) { |
734 | | - e.printStackTrace(); |
| 741 | + |
| 742 | + if (streamMode) { |
| 743 | + final Future<CommandModule> future = getContext().getService(CommandService.class).run(BigDataLoaderCmd.class, |
| 744 | + true, (Map<String, Object>) null); |
| 745 | + try { |
| 746 | + future.get(30, TimeUnit.SECONDS); |
| 747 | + } catch (final InterruptedException | ExecutionException | TimeoutException e) { |
| 748 | + error("SNTUTils.startApp(true) failed", e); |
| 749 | + } |
| 750 | + return getInstance(); |
| 751 | + |
| 752 | + } else { |
| 753 | + setIsLoading(true); |
| 754 | + final PathAndFillManager pathAndFillManager = new PathAndFillManager(); |
| 755 | + final SNT snt = new SNT(getContext(), pathAndFillManager); |
| 756 | + snt.initialize(null); |
| 757 | + try { |
| 758 | + javax.swing.SwingUtilities.invokeAndWait(snt::startUI); |
| 759 | + } catch (final InvocationTargetException | InterruptedException e) { |
| 760 | + e.printStackTrace(); |
| 761 | + } |
| 762 | + return snt; |
735 | 763 | } |
736 | | - return snt; |
737 | 764 | } |
738 | 765 | } |
739 | 766 |
|
0 commit comments