Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/org/janelia/saalfeldlab/hotknife/tools/ResaveMultiSemHeightField.java
  • Loading branch information
trautmane committed May 7, 2024
2 parents 7f749be + b8cc8c3 commit a0308de
Showing 1 changed file with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import net.imglib2.view.Views;
import org.janelia.saalfeldlab.hotknife.util.Util;
import org.janelia.saalfeldlab.n5.DatasetAttributes;
import org.janelia.saalfeldlab.n5.GzipCompression;
import org.janelia.saalfeldlab.n5.N5FSReader;
import org.janelia.saalfeldlab.n5.N5FSWriter;
import org.janelia.saalfeldlab.n5.N5Reader;
Expand Down Expand Up @@ -61,6 +62,9 @@ public class ResaveMultiSemHeightField implements Callable<Void>{
@Option(names = {"-g", "--fieldGroupOut"}, required = true, description = "N5 group to save, overrides if the same as input, e.g. /surface/s1")
private String fieldGroupOut = null;

@Option(names = {"-s", "--scale"}, required = true, split=",", description = "downsampling factors, e.g. 6,6,1")
private int[] downsamplingFactors = null;

private static final double SIGMA = 2.0;

public static void main(final String... args) throws IOException, InterruptedException, ExecutionException {
Expand Down Expand Up @@ -112,10 +116,27 @@ public final Void call() throws IOException, InterruptedException, ExecutionExce
System.out.println("SMOOTHING heightfield");
Gauss3.gauss(SIGMA, Views.extendBorder(heightField), heightField);

System.out.println("SAVING height field " + n5OutputPath + minHeightFieldOut);
final ExecutorService exec = Executors.newFixedThreadPool(4);

System.out.println("SAVING height field " + n5OutputPath + maxHeightFieldOut);
final double avg = sourceN5.getAttribute(maxHeightField, "avg", double.class);
attributes = sourceN5.getDatasetAttributes(maxHeightField);
N5Utils.save(heightField, targetN5, maxHeightFieldOut, attributes.getBlockSize(), attributes.getCompression());

//N5Utils.save(heightField, targetN5, maxHeightFieldOut, attributes.getBlockSize(), attributes.getCompression(), exec);

N5Utils
.save(
heightField,
targetN5,
maxHeightFieldOut,
new int[]{1024, 1024},
new GzipCompression(),
exec);

targetN5.setAttribute(maxHeightFieldOut, "avg", avg);
targetN5.setAttribute(maxHeightFieldOut, "downsamplingFactors", downsamplingFactors);

exec.shutdown();
service.shutdown();
sourceN5.close();
return null;
Expand Down

0 comments on commit a0308de

Please sign in to comment.