|
4 | 4 | import java.util.ArrayList;
|
5 | 5 | import java.util.Arrays;
|
6 | 6 | import java.util.HashMap;
|
| 7 | +import java.util.List; |
7 | 8 |
|
| 9 | +import ij.ImageJ; |
8 | 10 | import mpicbg.spim.data.SpimDataException;
|
| 11 | +import mpicbg.spim.data.generic.sequence.BasicViewDescription; |
9 | 12 | import mpicbg.spim.data.sequence.ViewId;
|
10 |
| -import net.imglib2.multithreading.SimpleMultiThreading; |
11 | 13 | import net.imglib2.util.Pair;
|
12 | 14 | import net.preibisch.bigstitcher.spark.abstractcmdline.AbstractBasic;
|
13 | 15 | import net.preibisch.bigstitcher.spark.util.Import;
|
14 | 16 | import net.preibisch.legacy.io.IOFunctions;
|
15 | 17 | import net.preibisch.mvrecon.fiji.plugin.Split_Views;
|
16 | 18 | import net.preibisch.mvrecon.fiji.spimdata.SpimData2;
|
17 | 19 | import net.preibisch.mvrecon.fiji.spimdata.XmlIoSpimData2;
|
| 20 | +import net.preibisch.mvrecon.fiji.spimdata.explorer.SelectedViewDescriptionListener; |
18 | 21 | import net.preibisch.mvrecon.process.splitting.SplittingTools;
|
19 | 22 | import net.preibisch.stitcher.gui.StitchingExplorer;
|
20 | 23 | import picocli.CommandLine;
|
@@ -70,7 +73,8 @@ public class SplitDatasets extends AbstractBasic
|
70 | 73 | @Override
|
71 | 74 | public Void call() throws Exception
|
72 | 75 | {
|
73 |
| - this.dataGlobal = this.loadSpimData2(); |
| 76 | + // if we want to display the result, we need to set the fetcher threads to anything but 0 |
| 77 | + this.dataGlobal = displayResult ? this.loadSpimData2( Runtime.getRuntime().availableProcessors() ) : this.loadSpimData2(); |
74 | 78 |
|
75 | 79 | if ( dataGlobal == null )
|
76 | 80 | throw new IllegalArgumentException( "Couldn't load SpimData XML project." );
|
@@ -119,11 +123,39 @@ public Void call() throws Exception
|
119 | 123 |
|
120 | 124 | if ( displayResult )
|
121 | 125 | {
|
| 126 | + new ImageJ(); |
| 127 | + |
122 | 128 | final StitchingExplorer< SpimData2 > explorer = new StitchingExplorer< >( newData, xmlOutURI, new XmlIoSpimData2() );
|
123 | 129 | explorer.getFrame().toFront();
|
124 | 130 |
|
125 |
| - // TODO: check when it is quit |
126 |
| - SimpleMultiThreading.threadHaltUnClean(); |
| 131 | + explorer.addListener( new SelectedViewDescriptionListener<SpimData2>() { |
| 132 | + |
| 133 | + @Override |
| 134 | + public void updateContent(SpimData2 data) {} |
| 135 | + |
| 136 | + @Override |
| 137 | + public void selectedViewDescriptions(List<List<BasicViewDescription<?>>> viewDescriptions) {} |
| 138 | + |
| 139 | + @Override |
| 140 | + public void save() {} |
| 141 | + |
| 142 | + @Override |
| 143 | + public void quit() |
| 144 | + { |
| 145 | + System.out.println( "quitting GUI."); |
| 146 | + System.exit( 0 ); |
| 147 | + } |
| 148 | + }); |
| 149 | + |
| 150 | + // program will be quit by the listener above |
| 151 | + try |
| 152 | + { |
| 153 | + Thread.sleep( Long.MAX_VALUE ); |
| 154 | + } |
| 155 | + catch ( final InterruptedException e ) |
| 156 | + { |
| 157 | + System.err.println( "MultiThreading.threadWait(): Thread woken up: " + e ); |
| 158 | + } |
127 | 159 | }
|
128 | 160 | else if ( !dryRun )
|
129 | 161 | {
|
|
0 commit comments