Skip to content

Instantly share code, notes, and snippets.

View volker-baecker's full-sized avatar

Volker volker-baecker

View GitHub Profile
@volker-baecker
volker-baecker / exercises.ipynb
Last active July 12, 2021 16:29
Exercises.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@volker-baecker
volker-baecker / run_separate_nuclei.sh
Last active November 21, 2017 13:44
Wrapper script to run the separate_nuclei.ijm macro headless.
# Run the macro in fiji headlessly using Xvfb
# to avoid errors due to gui dependencies.
export DISPLAY=:1
Xvfb $DISPLAY -auth /dev/null &
(
# the ’(’ starts a new sub shell. In this sub shell we start the worker processes:
java -Xmx6000m -cp jars/ij-1.51l-SNAPSHOT.jar ij.ImageJ -headless --console \
-macro separate_nuclei.ijm \
"input=$1, output=$2, scale_factor=$3"
wait # waits until all ’program’ processes are finished
@volker-baecker
volker-baecker / separate_nuclei.ijm
Last active November 17, 2017 16:27
Use image scaling and binary watershed to separate the nuclei in the image and create an indexed mask.
/**
* Separate Nuclei
*
* Use image scaling and binary watershed to separate the nuclei in the image
*
* written 2013 by Volker Baecker (INSERM) at Montpellier RIO Imaging (www.mri.cnrs.fr)
*
* This has been created from
* http://dev.mri.cnrs.fr/projects/imagej-macros/wiki/Separate_Nuclei_Tool
*
/*
* Play pong on the FIJI example images.
*
*/
var _WIDTH = 800;
var _HEIGHT = 600;
var _X_PADDLE = 50;
var _Y_PADDLE = _HEIGHT / 2;
var _WIDTH_PADDLE = 10;
@volker-baecker
volker-baecker / add_ijsegmentclusterednuclei.py
Created April 28, 2017 10:35
add the IJSegmentClusteredNuclei command to cytomine
import cytomine
import sys
#Connect to cytomine, edit connection values
cytomine_host="my-host" # Cytomine core URL
cytomine_public_key="my-public-key" # Your public key
cytomine_private_key="my-private-key" # Your private key
id_project=my-project-id
@volker-baecker
volker-baecker / IJSegmentNuclei.py
Last active January 28, 2018 12:07
wrapper script to run the IJSegmentNuclei workflow from cytomine
import sys
import os
from cytomine import Cytomine
from cytomine.models import *
from subprocess import call
from skimage import io
import numpy as np
from sldc import locator
from sldc.locator import affine_transform
from shapely.ops import cascaded_union
@volker-baecker
volker-baecker / run-segment-clustered-nuclei.sh
Last active April 25, 2017 13:22
run the IJSegmentClusteredNuclei.ijm macro in xvfb
# Run the metrics-macro in ImageJ headlessly using Xvfb to avoid errors due to ImageJ1 gui dependencies.
export DISPLAY=:1
Xvfb $DISPLAY -auth /dev/null &
(
# the '(' starts a new sub shell. In this sub shell we start the worker processes:
java -Xmx6000m -cp jars/ij-1.51l-SNAPSHOT.jar ij.ImageJ -headless --console -macro IJSegmentClusteredNuclei.ijm "input=$1, output=$2, radius=$3, threshold=$4"
wait # waits until all 'program' processes are finished
# this wait sees only the 'program' processes, not the Xvfb process
@volker-baecker
volker-baecker / IJSegmentClusteredNuclei.ijm
Last active April 28, 2017 10:20
Segment clustered nuclei with FIJI
// Author: Sébastien Tosi (IRB Barcelona)
// modified by Volker Bäcker to make it run
// in batch mode, reading parameters from the command line
//
// The macro will segment nuclei and separate clustered nuclei
// using a binary watershed. As a result an index-mask image is
// written for each input image.
// Use FIJI to run the macro with a command similar to
// java -Xmx6000m -cp jars/ij.jar ij.ImageJ -headless --console -macro IJSegmentClusteredNuclei.ijm "input=/media/baecker/donnees/mri/projects/2017/liege/in, output=/media/baecker/donnees/mri/projects/2017/liege/out, radius=5, threshold=-0.5"
@volker-baecker
volker-baecker / WG5-TG3_batch_extract_middle_slices.ijm
Last active September 27, 2017 08:44
A simple macro to extract the middle slices of a number of input stacks.
// For all images in a folder, extract the middle slice and save it into a
// subfolder.
//
// Written 2017 by Volker Baecker, Montpellier Ressources Imagerie
var _FILE_EXTENSION = ".tif";
setBatchMode(true);
dir = getDirectory("Select the input folder!");
# Run the metrics-macro in ImageJ headlessly using Xvfb to avoid errors due to ImageJ1 gui dependencies.
export DISPLAY=:1
Xvfb $DISPLAY -auth /dev/null &
(
# the '(' starts a new sub shell. In this sub shell we start the worker processes:
java -Xmx6000m -cp jars/ij-1.51h.jar ij.ImageJ -headless --console -macro metrics.ijm "plugin=$1, dir=$2, table=/fiji/data/in/Results.xls"
wait # waits until all 'program' processes are finished
# this wait sees only the 'program' processes, not the Xvfb process