Skip to content

Commit c387179

Browse files
committed
create Zarr Dataset
1 parent 1dab42c commit c387179

File tree

4 files changed

+38
-3
lines changed

4 files changed

+38
-3
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,8 @@ cookies.txt
4545

4646
# Vim #
4747
.*.sw*
48+
at3_1m4_01.tif
49+
at3_1m4_02.tif
50+
at3_1m4_03.tif
51+
at3_1m4_05.tif
52+
at3_1m4_06.tif

src/main/java/cz/it4i/fiji/legacy/CreateNewDataset.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import cz.it4i.fiji.rest.util.DatasetInfo;
2828

2929
@Plugin(type = Command.class, headless = true, menuPath = "Plugins>HPC DataStore>Create>Create new dataset")
30-
public class CreateNewDataset implements Command {
30+
public abstract class CreateNewDataset implements Command {
3131
@Parameter(label = "URL of a DatasetsRegisterService:", persistKey = "datasetserverurl")
3232
public String url = "someHostname:9080";
3333

@@ -97,6 +97,11 @@ public class CreateNewDataset implements Command {
9797
@Parameter(type = ItemIO.OUTPUT, label="Label of the created dataset:")
9898
public String newDatasetLabel;
9999

100+
protected String getDatasetType()
101+
{
102+
return "N5";
103+
}
104+
100105
@Override
101106
public void run() {
102107
//logging facility
@@ -162,7 +167,7 @@ public void run() {
162167
myLogger.info("CREATED JSON:\n"+json);
163168

164169
final Future<CommandModule> subcall = cs.run(CreateNewDatasetFromJSON.class, true,
165-
"url",url, "json",json, "showRunCmd",showRunCmd);
170+
"url",url, "json",json, "showRunCmd",showRunCmd,"datasetType",getDatasetType());
166171
newDatasetUUID = (String)subcall.get().getOutput("newDatasetUUID");
167172
newDatasetLabel = di.getLabel();
168173
} catch (ExecutionException e) {
@@ -173,4 +178,6 @@ public void run() {
173178
myLogger.error("Error converting dataset description into JSON:"+e.getMessage());
174179
}
175180
}
181+
182+
176183
}

src/main/java/cz/it4i/fiji/legacy/CreateNewDatasetFromJSON.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,21 @@ public class CreateNewDatasetFromJSON implements Command {
3737
public String newDatasetUUID;
3838
@Parameter(type = ItemIO.OUTPUT, label="Label of the created dataset:")
3939
public String newDatasetLabel;
40+
@Parameter
41+
public String datasetType;
4042

4143
@Override
4244
public void run() {
4345
//logging facility
4446
myLogger = mainLogger.subLogger("HPC CreateDataset", LogLevel.INFO);
4547

4648
try {
47-
final HttpURLConnection connection = (HttpURLConnection)new URL("http://"+this.url+"/datasets").openConnection();
49+
String add="/datasets";
50+
if(datasetType.equals("Zarr"))
51+
{
52+
add+="zarr";
53+
}
54+
final HttpURLConnection connection = (HttpURLConnection)new URL("http://"+this.url+add).openConnection();
4855
connection.setRequestMethod("POST");
4956
connection.setRequestProperty("Content-Type","application/json");
5057
connection.setDoOutput(true);
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package cz.it4i.fiji.legacy;
2+
3+
import org.scijava.command.Command;
4+
import org.scijava.plugin.Plugin;
5+
6+
//TODO add more components
7+
@Plugin(type = Command.class, headless = true, menuPath = "Plugins>HPC DataStore>Create ZARR>Create new dataset")
8+
public class CreateNewDatasetZarr extends CreateNewDataset {
9+
10+
@Override
11+
protected String getDatasetType()
12+
{
13+
return "Zarr";
14+
}
15+
16+
}

0 commit comments

Comments
 (0)