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
@bogovicj
bogovicj / devclaude
Created March 3, 2026 18:42
Runs the 'claude-dev' docker image for claude, mounting a set of volumes into the container. Folders are mounted into the /workspace folder.
#!/bin/bash
#
# Runs the 'claude-dev' docker image for claude, mounting a set of volumes
# into the container. Folders are mounted into the /workspace folder.
#
# All arguments are mounted. If no arguments are provided, the current working directory is mounted.
args=""
if [ $# -eq 0 ]
then
@bogovicj
bogovicj / n5-benchmarks
Last active February 25, 2026 19:34
Run n5 block read benchmarks for a set of commits
#!/usr/bin/env bash
## Which benchmark to run
## BlockReadWriteBenchmarks : benchmarks file reading and decoding
## BlockCodecBenchmarks" : benchmarks decoding only
benchmark="BlockCodecBenchmarks"
## Benchmark parameters
dataTypes="int32"
fillType="random"
@bogovicj
bogovicj / openWithIOService.groovy
Created December 8, 2025 20:26
An ImageJ2 script that opens some File with the IOService.
#@ File f
#@ UIService ui
#@ IOService io
/**
* Explicitly use the ImageJ2 IOService to open some file.
*/
ui.show(io.open(f.getAbsolutePath()));
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);
}