Skip to content

Commit d7159bc

Browse files
committed
CHG2/2: WriteFullImage switched from choices to boolean w.r.t. pyramids
1 parent 74d15ff commit d7159bc

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

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

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ public class WriteFullImage implements Command {
4545
persistKey="datasetreslevel")
4646
public String resolutionLevelsAsStr = "[1, 1, 1]";
4747

48-
@Parameter(label = "Write also lower resolutions:", required = false,
49-
choices = {"no","yes -> uploading segmentation", "yes -> uploading raw images"})
50-
public String uploadRegime = "No";
48+
@Parameter(label = "Write also lower resolutions:", required = false)
49+
public boolean uploadResPyramids = true;
5150

5251
@Parameter(label = "Selected version:",
5352
description = "provide number, or keyword: latest, new",
@@ -74,14 +73,10 @@ public class WriteFullImage implements Command {
7473
@Override
7574
public void run() {
7675
try {
77-
LocalWriter.Downscale ds = LocalWriter.Downscale.NONE;
78-
if (uploadRegime.contains("segment")) ds = LocalWriter.Downscale.NEARESTNEIGHBOR;
79-
else if (uploadRegime.contains("raw")) ds = LocalWriter.Downscale.SMOOTH;
80-
8176
new LocalWriter(log.getContext()).writeNow((Img)inDatasetImg.getImgPlus().getImg(),
8277
URL,datasetID,
8378
timepoint,channel,angle,
84-
resolutionLevelsAsStr,ds,versionAsStr,
79+
resolutionLevelsAsStr,uploadResPyramids,versionAsStr,
8580
timeout,verboseLog);
8681
} catch (IOException | IllegalArgumentException e) {
8782
log.error("Problem writing full image: "+e.getMessage());
@@ -133,26 +128,20 @@ static class LocalWriter extends ImagePlusTransferrer {
133128
this.setContext(useThisCtx);
134129
}
135130

136-
public enum Downscale {
137-
NONE,
138-
NEARESTNEIGHBOR,
139-
SMOOTH
140-
}
141-
142131
<T extends RealType<T>>
143132
void writeNow(final Img<T> img, final String url, final String datasetID,
144133
final int timepoint, final int channel, final int angle,
145134
final String resolutionLevelsAsStr, final String versionAsStr,
146135
final int serverTimeout, final boolean verboseLog)
147136
throws IOException,IllegalArgumentException {
148137
writeNow(img,url,datasetID,timepoint,channel,angle,
149-
resolutionLevelsAsStr,Downscale.NONE,versionAsStr,serverTimeout,verboseLog);
138+
resolutionLevelsAsStr,true,versionAsStr,serverTimeout,verboseLog);
150139
}
151140

152141
<TR extends RealType<TR>, TNR extends NativeType<TNR> & RealType<TNR>>
153142
void writeNow(final Img<TR> img, final String url, final String datasetID,
154143
final int timepoint, final int channel, final int angle,
155-
final String resolutionLevelsAsStr, final Downscale downRegime,
144+
final String resolutionLevelsAsStr, final boolean uploadResPyramids,
156145
final String versionAsStr,
157146
final int serverTimeout, final boolean verboseLog)
158147
throws IOException,IllegalArgumentException {
@@ -193,7 +182,7 @@ void writeNow(final Img<TR> img, final String url, final String datasetID,
193182

194183
this.writeWithAType(image);
195184

196-
if (downRegime != Downscale.NONE)
185+
if (uploadResPyramids)
197186
{
198187
//plan: find upper res levels, for each create downscaled image and upload it
199188
int resLevelIdx = 0;

0 commit comments

Comments
 (0)