Skip to content

Instantly share code, notes, and snippets.

View imagejan's full-sized avatar

Jan Eglinger imagejan

  • Friedrich Miescher Institute for Biomedical Research (FMI)
  • Basel, Switzerland
  • X @jan_eglinger
View GitHub Profile
@bobpeers
bobpeers / prefect.py
Last active May 15, 2023 23:41
Template to schedule KNIME workflows using Prefect
#prefect imports
import prefect
from prefect import task, Flow
from prefect.schedules import Schedule
from prefect.schedules.clocks import CronClock
from prefect.storage import Local
import pendulum
import knime
import os
@ctrueden
ctrueden / scifio.py
Last active March 1, 2022 20:34
Open images as numpy arrays using SCIFIO and Bio-Formats
#!/usr/bin/env python
#
# scifio.py - Open images as numpy arrays using SCIFIO and Bio-Formats.
#
# -- Settings --
max_mem_mb = '6144'
scifio_lifesci = False
@ctrueden
ctrueden / boofcv-seeded-watershed.groovy
Last active March 25, 2019 21:21
Seeded watershed in ImageJ using BoofCV
#@dependency(group="org.boofcv", module="boofcv-core", version="0.33")
#@dependency(group="org.boofcv", module="boofcv-swing", version="0.32")
#@both ImagePlus imp
#@output ImagePlus (label="Watersheds") watersheds
#@output ImagePlus (label="Regions") regions
#@output ImagePlus (label="Seeds") seeds
import boofcv.alg.filter.binary.BinaryImageOps
import boofcv.alg.filter.binary.ThresholdImageOps
#@Dataset(label="Image to transform") img
#@Double(label="scale") scaling_factor
#@UIService ui
import net.imglib2.*;
import net.imglib2.realtransform.*;
import net.imglib2.view.*;
import net.imglib2.interpolation.*;
import net.imglib2.interpolation.randomaccess.*;
@ctrueden
ctrueden / mix-ij2-and-ij2-rois.groovy
Created June 3, 2018 18:54
Create some ImgLib2 ROIs and attach them to an IJ1 ImagePlus
#@ ConvertService convert
#@ ImagePlus imp
import bdv.util.BdvFunctions
import bdv.util.BdvOptions
import ij.gui.Overlay
import ij.gui.Roi
import net.imglib2.roi.Masks
# function to do a dodged half-boxplot and jittered points next to each other
#
# data_in should be a data frame
# factor_col should be a bare column name (not a string)
# although it will work if that column is factor or a character type
# numeric_col is the y axis continuous variable
# offset is the width of the boxplots and jittered point cloud
#
# the basic approach is to draw a boxplot without the tails
# (e.g. only the interquartile range) and then use segments to add the
@lacan
lacan / curvature_radius.bsh
Last active October 13, 2022 15:18
Curvature radius simple calculation for ImageJ/fiji #Fiji #Beanshell #Curvature #ImageJ
/*
* Simple script that takes a selection and computes the curvature radius for the whole perimeter of the shape.
*
* By Olivier Burri,
* BioImaging and Optics Platform, BIOP
* Ecole Polytechnique Fédérale de Lausanne (EPFL)
* Last update: May 2017
*
*
*/
@ctrueden
ctrueden / ParseMetadata.java
Last active June 29, 2018 10:51
Simple SCIFIO example which parses metadata and prints it
package net.restlesscoder.sandbox.imagej;
import io.scif.FieldPrinter;
import io.scif.Format;
import io.scif.Metadata;
import net.imagej.ImageJ;
public class ParseMetadata {
@lacan
lacan / bissect.ijm
Last active April 16, 2021 18:50
Generates a curve that bissects a previously drawn segment #ImageJ #Macro
/*
* Simple bissection tool. By Olivier Burri at the BioImaging and Optics Platform
* Provided as-is based on a request of the ImageJ Forum: http://forum.imagej.net/t/how-do-you-measure-the-angle-of-curvature-of-a-claw
*
* Mouse listening code based on imageJ example
* https://imagej.nih.gov/ij/macros//GetCursorLocDemo.txt
*
* To install, use 'Plugins > Macros > Install...' and select this file
*
* To run, create a line selection and press F2.