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
/**
* 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
@bogovicj
bogovicj / shapeDemo.groovy
Created April 2, 2024 14:12
ImageJ2 script that displays a Diamond or Hypersphere neighborhood for a given radius
#@ DatasetService ds
#@ UIService ui
#@ Long radius = 13
#@ String (choices={"Diamond", "Hypersphere"}, style="listBox") shapeType
/*
* Displays a Diamond or Hypersphere neighborhood for a given radius
*/
if( shapeType.equals("Diamond"))
shp = new DiamondShape(radius);
@bogovicj
bogovicj / skimage_affine.ipynb
Created March 20, 2024 14:06
Apply an affine or scaling transform with scikit-image
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bogovicj
bogovicj / CompressionExamples.java
Created December 8, 2023 18:16
Create example n5 array datasets for a variety of compression methods.
package org.janelia.saalfeldlab.n5.generateExamples;
import org.janelia.saalfeldlab.n5.Bzip2Compression;
import org.janelia.saalfeldlab.n5.Compression;
import org.janelia.saalfeldlab.n5.GzipCompression;
import org.janelia.saalfeldlab.n5.Lz4Compression;
import org.janelia.saalfeldlab.n5.N5Writer;
import org.janelia.saalfeldlab.n5.RawCompression;
import org.janelia.saalfeldlab.n5.XzCompression;
import org.janelia.saalfeldlab.n5.blosc.BloscCompression;
@bogovicj
bogovicj / image_geometry.ipynb
Last active July 18, 2024 01:12
Image geometry and indexing in python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.