Skip to content

Commit 3615758

Browse files
committed
new age
1 parent 7864a17 commit 3615758

File tree

4 files changed

+39
-313
lines changed

4 files changed

+39
-313
lines changed

pom.xml

Lines changed: 4 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -108,108 +108,12 @@
108108
</repository>
109109
</repositories>
110110
<dependencies>
111-
<dependency>
112-
<groupId>net.imagej</groupId>
113-
<artifactId>imagej</artifactId>
114-
</dependency>
115-
<dependency>
116-
<groupId>net.imagej</groupId>
117-
<artifactId>imagej-legacy</artifactId>
118-
</dependency>
119-
<dependency>
120-
<groupId>net.imglib2</groupId>
121-
<artifactId>imglib2</artifactId>
122-
</dependency>
123-
<dependency>
124-
<groupId>net.imagej</groupId>
125-
<artifactId>ij</artifactId>
126-
</dependency>
127-
<dependency>
128-
<groupId>net.imglib2</groupId>
129-
<artifactId>imglib2-ij</artifactId>
130-
</dependency>
131-
<!-- <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-ui</artifactId>
132-
</dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-realtransform</artifactId>
133-
</dependency> <dependency> <groupId>net.imglib2</groupId> <artifactId>imglib2-algorithm</artifactId>
134-
</dependency> -->
135-
<dependency>
136-
<groupId>sc.fiji</groupId>
137-
<artifactId>bigdataviewer-core</artifactId>
138-
</dependency>
139-
<dependency>
140-
<groupId>sc.fiji</groupId>
141-
<artifactId>Fiji_Plugins</artifactId>
142-
</dependency>
143-
<dependency>
144-
<groupId>io.scif</groupId>
145-
<artifactId>scifio</artifactId>
146-
</dependency>
147-
<dependency>
148-
<groupId>io.scif</groupId>
149-
<artifactId>scifio-bf-compat</artifactId>
150-
<scope>runtime</scope>
151-
</dependency>
152-
<!-- The formats-bsd component adds support for open formats. -->
153-
<dependency>
154-
<groupId>ome</groupId>
155-
<artifactId>formats-bsd</artifactId>
156-
<scope>runtime</scope>
157-
</dependency>
158-
<!-- The formats-gpl component adds support for proprietary formats. -->
159-
<dependency>
160-
<groupId>ome</groupId>
161-
<artifactId>formats-gpl</artifactId>
162-
<scope>runtime</scope>
163-
</dependency>
164-
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
165-
<dependency>
166-
<groupId>com.jcraft</groupId>
167-
<artifactId>jsch</artifactId>
168-
<version>0.1.54</version>
169-
</dependency>
170-
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
171-
<dependency>
172-
<groupId>com.google.guava</groupId>
173-
<artifactId>guava</artifactId>
174-
<version>r05</version>
175-
176-
</dependency>
177-
<!-- https://mvnrepository.com/artifact/org.apache.kafka/kafka -->
178-
179-
<dependency>
180-
<groupId>commons-io</groupId>
181-
<artifactId>commons-io</artifactId>
182-
<version>2.4</version>
183-
</dependency>
184-
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
185-
<dependency>
186-
<groupId>com.google.code.gson</groupId>
187-
<artifactId>gson</artifactId>
188-
<version>2.8.5</version>
189-
</dependency>
190-
191111
<dependency>
192112
<groupId>net.preibisch</groupId>
193-
<artifactId>multiview-reconstruction</artifactId>
194-
<version>0.5.0-SNAPSHOT</version>
195-
</dependency>
196-
<dependency>
197-
<groupId>org.janelia.saalfeldlab</groupId>
198-
<artifactId>n5-imglib2</artifactId>
199-
<version>3.4.0</version>
200-
</dependency>
201-
<dependency>
202-
<groupId>org.apache.kafka</groupId>
203-
<artifactId>kafka_2.12</artifactId>
204-
<version>1.1.0</version>
205-
</dependency>
206-
<!-- <dependency> <groupId>ome</groupId> <artifactId>bio-formats_plugins</artifactId>
207-
</dependency> -->
208-
<dependency>
209-
<groupId>info.picocli</groupId>
210-
<artifactId>picocli</artifactId>
211-
<version>3.9.2</version>
113+
<artifactId>distribution</artifactId>
114+
<version>0.2.2-SNAPSHOT</version>
212115
</dependency>
116+
213117
</dependencies>
214118

215119
<build>
@@ -252,7 +156,7 @@
252156
<!-- MainClass in mainfest make a executable jar -->
253157
<archive>
254158
<manifest>
255-
<mainClass>net.preibisch.fusiontask.task.FusionV2</mainClass>
159+
<mainClass>net.preibisch.fusiontask.task.Fusion</mainClass>
256160
</manifest>
257161
</archive>
258162

@@ -268,11 +172,6 @@
268172
</execution>
269173
</executions>
270174
</plugin>
271-
272175
</plugins>
273-
<!-- <plugins> <plugin> <artifactId>maven-assembly-plugin</artifactId>
274-
<configuration> <archive> <manifest> <mainClass>main.java.net.preibisch.fusiontask.task.MainJob</mainClass>
275-
</manifest> </archive> <descriptorRefs> <descriptorRef>jar-with-dependencies</descriptorRef>
276-
</descriptorRefs> </configuration> </plugin> </plugins> -->
277176
</build>
278177
</project>

src/net/preibisch/fusiontask/task/FusionV2.java renamed to src/net/preibisch/fusiontask/task/Fusion.java

Lines changed: 34 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import net.preibisch.distribution.algorithm.blockmanager.block.BasicBlockInfo;
2020
import net.preibisch.distribution.algorithm.clustering.kafka.KafkaManager;
2121
import net.preibisch.distribution.algorithm.clustering.kafka.KafkaProperties;
22-
import net.preibisch.distribution.algorithm.clustering.scripting.TaskType;
22+
import net.preibisch.distribution.algorithm.clustering.scripting.JobType;
2323
import net.preibisch.distribution.algorithm.controllers.items.BlocksMetaData;
2424
import net.preibisch.distribution.algorithm.task.FusionParams;
2525
import net.preibisch.distribution.io.img.XMLFile;
@@ -29,62 +29,60 @@
2929
import picocli.CommandLine;
3030
import picocli.CommandLine.Option;
3131

32-
public class FusionV2 implements Callable<Void> {
33-
@Option(names = { "-t", "--task" }, required = false, description = "The path of the Data")
32+
33+
public class Fusion implements Callable<Void> {
34+
@Option(names = { "-t", "--task" }, required = true, description = "The path of the Data")
3435
private String task;
3536

36-
@Option(names = { "-o", "--output" }, required = false, description = "The path of the Data")
37+
@Option(names = { "-o", "--output" }, required = true, description = "The path of the Data")
3738
private String output;
3839

39-
@Option(names = { "-i", "--input" }, required = false, description = "The path of the Data")
40+
@Option(names = { "-i", "--input" }, required = true, description = "The path of the Data")
4041
private String input;
4142

42-
@Option(names = { "-m", "--meta" }, required = false, description = "The path of the MetaData file")
43+
@Option(names = { "-m", "--meta" }, required = true, description = "The path of the MetaData file")
4344
private String metadataPath;
4445

45-
@Option(names = { "-p", "--param" }, required = false, description = "The path of the MetaData file")
46+
@Option(names = { "-p", "--param" }, required = true, description = "The path of the MetaData file")
4647
private String paramPath;
4748

4849
@Option(names = { "-v","-view" }, required = false, description = "The id of block")
4950
private int view;
5051
@Option(names = { "-id" }, required = false, description = "The id of block")
5152
private Integer id;
5253

53-
public FusionV2() {
54-
// TODO Auto-generated constructor stub
55-
}
56-
5754
@Override
5855
public Void call() throws Exception {
56+
5957
try {
60-
61-
try {
62-
id = id - 1;
63-
} catch (Exception e) {
64-
KafkaManager.error(-1, e.toString());
65-
System.out.println("Error id");
66-
throw new Exception("Specify id!");
67-
}
68-
TaskType type = TaskType.of(task);
58+
System.out.println("id: "+id);
59+
id = id - 1;
60+
} catch (Exception e) {
61+
KafkaManager.error(-1, e.toString());
62+
System.out.println("Error id");
63+
throw new Exception("Specify id!");
64+
}
65+
// try {
66+
System.out.println("task: "+task);
67+
JobType type = JobType.of(task);
68+
6969
switch (type) {
7070
case PREPARE:
71+
System.out.println(type.toString());
7172
generateN5(input, metadataPath,paramPath, output, id,view);
7273
return null;
7374
case PROCESS:
75+
System.out.println(type.toString());
7476
blockTask(input, metadataPath, paramPath, output, id,view);
7577
return null;
76-
77-
default:
78-
KafkaManager.error(id, "Specify task");
79-
System.out.println("Error");
80-
throw new Exception("Specify task!");
8178
}
82-
} catch (Exception e) {
83-
KafkaManager.error(id, e.toString());
84-
System.out.println("Error");
85-
throw new Exception("Specify task!");
86-
}
79+
// } catch (Exception e) {
80+
// KafkaManager.error(id, e.toString());
81+
// System.out.println("Error "+e);
82+
// throw new Exception("Specify task!");
83+
// }
8784
// MyLogger.log.info("Block " + id + " saved !");
85+
return null;
8886
}
8987

9088
public static void blockTask(String inputPath, String metadataPath, String paramPath, String outputPath, int id,int view) {
@@ -95,10 +93,7 @@ public static void blockTask(String inputPath, String metadataPath, String param
9593
FusionParams params = FusionParams.fromJson(paramPath);
9694
String jobId = md.getJobId();
9795
KafkaProperties.setJobId(jobId);
98-
KafkaManager.log(id, "Got metadata !");
9996
BasicBlockInfo binfo = md.getBlocksInfo().get(id);
100-
KafkaManager.log(id, "Got block info !");
101-
// BoundingBox bb = new BoundingBox(Util.long2int(binfo.getMin()), Util.long2int(binfo.getMax()));
10297
KafkaManager.log(id, "Bounding box created: " + params.getBb().toString());
10398
List<ViewId> viewIds = params.getViewIds().get(view);
10499
KafkaManager.log(id, "Got view ids ");
@@ -108,7 +103,6 @@ public static void blockTask(String inputPath, String metadataPath, String param
108103
KafkaManager.log(id, "Input loaded. ");
109104
// XMLFile inputFile = XMLFile.XMLFile(inputPath);
110105
RandomAccessibleInterval<FloatType> block = inputFile.fuse(params.getBb(),view);
111-
112106
KafkaManager.log(id, "Got block. ");
113107
N5File outputFile = N5File.open(outputPath);
114108
outputFile.saveBlock(block, binfo.getGridOffset());
@@ -126,7 +120,8 @@ public static void generateN5(String inputPath, String metadataPath,String param
126120
BlocksMetaData md = BlocksMetaData.fromJson(metadataPath);
127121
FusionParams params = FusionParams.fromJson(paramPath);
128122
BoundingBox bb = new BoundingBox(params.getBb());
129-
long[] dims = bb.getDimensions((int)params.getDownsampling());
123+
int down = ((int)params.getDownsampling()==0) ? 1 : (int) params.getDownsampling();
124+
long[] dims = bb.getDimensions(down);
130125
int blockUnit = md.getBlockUnit();
131126
N5File outputFile = new N5File(outputPath, dims, blockUnit);
132127
outputFile.create();
@@ -160,6 +155,9 @@ public static void generateN5fromXML(String inputPath, String metadataPath, Stri
160155
}
161156

162157
public static void main(String[] args) {
163-
CommandLine.call(new FusionV2(), args);
158+
// new ImageJ();
159+
// String str = "-t pre -i /Users/Marwan/Desktop/testtask/dataset.xml -o /Users/Marwan/Desktop/testtask/0_output.n5 -m /Users/Marwan/Desktop/testtask/0_metadata.json -p /Users/Marwan/Desktop/testtask/0_param.json -id 1";
160+
// System.out.println(String.join(" ", args));
161+
CommandLine.call(new Fusion(), args);
164162
}
165163
}

0 commit comments

Comments
 (0)