Skip to content

Commit

Permalink
fix: default downsampling policy
Browse files Browse the repository at this point in the history
  • Loading branch information
bogovicj committed Dec 13, 2024
1 parent 7e40520 commit b92fbf8
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -163,6 +162,8 @@ public static enum DOWNSAMPLE_METHOD {
Sample, Average
};

public static final DOWNSAMPLE_POLICY DEFAULT_POLICY = DOWNSAMPLE_POLICY.Aggressive;

public static final String DOWN_SAMPLE = "Sample";
public static final String DOWN_AVERAGE = "Average";

Expand Down Expand Up @@ -791,18 +792,19 @@ protected <N extends SpatialMetadataGroup<?>> N finalizeMultiscaleMetadata(final
return multiscaleMetadata;
}

protected <M extends N5Metadata> boolean lastScale(final int[] chunkSize, final Interval imageDimensions, final M metadata) {
protected <M extends N5Metadata> boolean lastScale(final int[] chunkSize, final Interval imageDimensions,
final M metadata) {

// null check for tests
final String downsamplePolicy = prefs != null ?
prefs.get(getClass(), IJ_PROPERTY_DOWNSAMPLE_POLICY, DOWNSAMPLE_POLICY.Conservative.toString()) :
DOWNSAMPLE_POLICY.Aggressive.toString();

switch( DOWNSAMPLE_POLICY.valueOf(downsamplePolicy)) {
case Aggressive:
return lastScaleAggressive(chunkSize, imageDimensions, metadata);
default:
return lastScaleConservative(chunkSize, imageDimensions, metadata);
final String downsamplePolicy = prefs != null
? prefs.get(getClass(), IJ_PROPERTY_DOWNSAMPLE_POLICY, DEFAULT_POLICY.toString())
: DEFAULT_POLICY.toString();

switch (DOWNSAMPLE_POLICY.valueOf(downsamplePolicy)) {
case Aggressive:
return lastScaleAggressive(chunkSize, imageDimensions, metadata);
default:
return lastScaleConservative(chunkSize, imageDimensions, metadata);
}
}

Expand Down

0 comments on commit b92fbf8

Please sign in to comment.