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 / bloscSearch.sh
Created November 11, 2021 16:04
check for blosc on macos 12
#!/bin/bash
isMac12 () {
hasSwVers=$(command -v sw_vers)
if [ ! -z $hasSwVers ]
then
ver=$(sw_vers | grep -Eo '[0-9]+\.[0-9]+\.[0-9]+')
if [[ $ver =~ ^12\..* ]]
then
@bogovicj
bogovicj / padCropToTarget.groovy
Last active August 19, 2021 23:12
Pads/crops the source image such that its field of view matches that target image.
#@ Dataset source
#@ Dataset target
/**
* Pads/crops the source image such that its field of view matches that target image,
* respecting the target image origin.
*
* Currently only supports pixel-length shifts, and ignores source origin.
*
* see:
@bogovicj
bogovicj / readIjLut.groovy
Created June 3, 2021 15:14
Read and print an imagej LUT
#@File lut
lut = ij.plugin.LutLoader.openLut( lut.getCanonicalPath() );
for( i in 0..<lut.getMapSize() )
{
println( [lut.getRed( i ), lut.getGreen(i), lut.getBlue(i)].join(" ") )
}
package org.janelia.saalfeldlab.n5.metadata;
import org.janelia.saalfeldlab.n5.DatasetAttributes;
import org.janelia.saalfeldlab.n5.N5Reader;
import org.janelia.saalfeldlab.n5.N5TreeNode;
import java.io.IOException;
import java.util.Map;
import java.util.Optional;
@bogovicj
bogovicj / ResaveCosemMultiscaleSubset.java
Created April 27, 2021 21:12
Resave a subset of a multiscale cosem dataset locally
package cosem;
import java.io.IOException;
import java.util.Arrays;
import org.janelia.saalfeldlab.n5.DatasetAttributes;
import org.janelia.saalfeldlab.n5.N5Reader;
import org.janelia.saalfeldlab.n5.N5Writer;
import org.janelia.saalfeldlab.n5.ij.N5Factory;
import org.janelia.saalfeldlab.n5.imglib2.N5Utils;
@bogovicj
bogovicj / voronoiFiji.groovy
Created April 8, 2021 22:52
Voronoi diagram / "Natural interpolation"with imglib2-KDTree
#@ Dataset img
/**
* Voronoi diagram / "Natural interpolation"with imglib2-KDTree
* see
* https://forum.image.sc/t/natural-neighbor-interpolation-in-3d/51243
*
* John Bogovic
*/
@bogovicj
bogovicj / zarrBdv.groovy
Created March 19, 2021 21:48
Read a zarr volume and display with bigdataviewer
import net.imglib2.*;
import bdv.util.*;
import org.janelia.saalfeldlab.n5.zarr.*;
import org.janelia.saalfeldlab.n5.imglib2.*;
/*
* A groovy script for Fiji that reads a zarr volume and displays it using BigDataViewer
*
* John Bogovic
*/
@bogovicj
bogovicj / RemoveAffineExample.java
Created November 24, 2020 15:22
example "removing" an affine from a Realtransform with n5-imglib2
package demos;
import java.io.IOException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.janelia.saalfeldlab.n5.GzipCompression;
import org.janelia.saalfeldlab.n5.N5FSReader;
import org.janelia.saalfeldlab.n5.N5FSWriter;
import org.janelia.saalfeldlab.n5.N5Reader;
@bogovicj
bogovicj / fijiUnicodeTest.groovy
Last active October 27, 2020 17:33
Testing how unicode is rendered in swing using fiji
import java.awt.Dimension;
import java.awt.Font;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
String arrow = "&#x2192; ";
String ts = "&#x2009;";
String times = "&#x2715;";
@bogovicj
bogovicj / fijiCauseAwsError.groovy
Last active September 23, 2020 21:25
a groovy script that reproduces some aws errors in sept 2020
import org.janelia.saalfeldlab.n5.N5Reader;
import org.janelia.saalfeldlab.n5.N5TreeNode;
import org.janelia.saalfeldlab.n5.imglib2.N5Utils;
import org.janelia.saalfeldlab.n5.metadata.*;
import org.janelia.saalfeldlab.n5.s3.N5AmazonS3Reader;
import net.imglib2.util.Intervals;
import com.amazonaws.services.s3.*;
import com.amazonaws.regions.Regions;
import com.amazonaws.auth.profile.ProfileCredentialsProvider;