Skip to content

Instantly share code, notes, and snippets.

View bogovicj's full-sized avatar

John Bogovic bogovicj

  • HHMI Janelia Research Campus
  • Washington DC metro area
View GitHub Profile
n5 = new N5Factory().openReader("/home/john/tmp/mitosis.zarr");
println(n5.getClass());
node = N5DatasetDiscoverer.discover(n5);
println(node.printRecursive());
println(node.getDescendant("s0").get().getMetadata().getClass());
import org.janelia.saalfeldlab.n5.N5Reader;
import org.janelia.saalfeldlab.n5.ij.N5Importer;
@bogovicj
bogovicj / n5ReaderAndDiscover.groovy
Created January 24, 2025 18:23
Create and n5 reader and parse some metadata
n5 = new N5Factory().openReader("/home/john/tmp/mitosis.zarr");
println(n5.getClass());
node = N5DatasetDiscoverer.discover(n5);
println(node.printRecursive());
println(node.getDescendant("s0").get().getMetadata().getClass());
import org.janelia.saalfeldlab.n5.N5Reader;
import org.janelia.saalfeldlab.n5.ij.N5Importer;
@bogovicj
bogovicj / aoc-2024-6a.sh
Last active December 16, 2024 22:38
Advent of code 2024 part 6a (in bash
#!/bin/bash
function initialize() {
# Make sure the guard is oriented to the right
#
# I happen to know that the guard is oriented up for my input
# So the commands below do a clock-wise rotation
# (this would be easy enough to generalize)
@bogovicj
bogovicj / BigWarpI2K2024.md
Last active October 23, 2024 15:12
BigWarp workshop at I2K 2024

Deformable 2D and 3D big data image registration and transformation with BigWarp

I2K 2024 From Images to Knowledge
Milan, Italy
Oct 24, 2024 9:45 AM

BigWarp is an intuitive tool for non-linear manual image registration that can scale to terabyte-sized image data. In this

/**
* Reads a {@link DataBlock} from an {@link InputStream}.
*
* @param in
* @param datasetAttributes
* @param gridPosition
* @return
* @throws IOException
*/
@SuppressWarnings("incomplete-switch")
@bogovicj
bogovicj / xarray_interpolation.ipynb
Created July 5, 2024 16:22
A demo of transforming an xarray DataArray using interp
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bogovicj
bogovicj / OptionalMapAbuse.java
Last active May 10, 2024 21:24
Use the map method to cause a side-effect if the optional is not-empty.
public T getValidateDefault(String parameter, Predicate<T> validator, T defaultValue) {
return getOptional(parameter).filter(validator)
.map(x -> {
allDefault = false;
return x;
}).orElse(defaultValue);
}
#@ File(styles="both") root
#@ String(value="/") datasetPath
/*
* If you used Fiji to export a multi-scale image with N5Viewer metadata using average downsampling
* between approximately March 13 and April 15 2024, the translation metadata may be incorrect.
*
* Running this script will correct the metadata.
*
* John Bogovic
#@ File(styles="both") root
#@ String(value="/") datasetPath
/*
* If you used Fiji to export a multi-scale an image with COSEM metadata using average downsampling
* between approximately March 13 and April 15 2024, the translation metadata may be incorrect.
*
* Running this script will correct the metadata.
*
* John Bogovic
#@ File(styles="both") root
#@ String(value="/") datasetPath
/*
* If you used Fiji to export a multi-scale OME-Zarr image using average downsampling
* between approximately March 13 and April 15 2024, the translation metadata may be incorrect.
*
* Running this script will correct the metadata.
*
* John Bogovic