Skip to content

Instantly share code, notes, and snippets.

View lacan's full-sized avatar
🤝

Olivier Burri lacan

🤝
View GitHub Profile
@lacan
lacan / Export Contiguous Fields.groovy
Last active February 15, 2023 06:20
[Operetta Export Contiguous Fields] Uses Flood filling on the fields to find which ones are direct neighbors and exports each as a separate ImagePlus. Example #Operetta #Fiji #Groovy #BIOP
// This script was created for Anna Hamacher, as per an internal discussion on the ImageSC forum
// that stemmed from https://forum.image.sc/t/viewing-slide-scans-from-operetta-perkin-elmer-cls-as-overview-montage-images/52942/13?u=oburri
// Code by Olivier Burri, EPFL - SV - PTECH - BIOP
// Edited by Anna Hamacher
// Last edition: July 2022
#@ File dir (label="Images Folder", style="directory")
#@Integer downsample (label="Downsample Factor", value=1)
#@String z_projection_method (label = "Projection Type", choices = {"No Projection", "Average Intensity", "Max Intensity", "Min Intensity", "Sum Slices", "Standard Deviation", "Median"} )
#@File outputDir (label="Output directory", style="directory")
@lacan
lacan / Demo_OMERO.ijm
Created May 26, 2021 12:27
[Demo for OMERO] This is a demo gist for OMERO #OMERO
print( "Your OMERO Server is Broken. Come back tomorrow" );
@lacan
lacan / Template matching using OpenCV.groovy
Created May 25, 2021 11:10
[Basic OpenCV Template Matching in QuPath] Testing OpenCV for Template Matching and NMS Suppression inside QuPath #qupath #opencv #imagesc
// Basic Template Matching using OpenCV with distance based NMS
// Author: Olivier Burri, EPFL - SV - PTECH - BIOP
// Inspiration:
// - https://docs.opencv.org/master/d4/dc6/tutorial_py_template_matching.html
// - https://towardsdatascience.com/non-maximum-suppression-nms-93ce178e177c
// Date: 2021-05-25
def downsample = 10
def templateClass = "Template"
def detectedClass = "Detected"
@lacan
lacan / useful_shortcuts.ijm
Last active April 28, 2021 07:57
[Useful Shortcuts ActionBar] An ActionBar that contains multiple shortcuts that are useful in Fiji #ImageJ #ActionBar #Fiji
// Action Bar description file :useful_shortcuts
// Provided by Olivier Burri for PCB-02
// Date: 20210420
// Copy this file (Do not rename it) to your Fiji installation under plugins/ActionBar
run("Action Bar","/plugins/ActionBar/useful_shortcuts.ijm");
exit();
<line>
<button> 1 line 1
label=Close All
@lacan
lacan / CombineNISPositionXMLs.groovy
Created April 6, 2021 07:58
[Combine XML Files from NIS Elements Positions] Combines multiple positions lists into a single one #Groovy #NISElements #Nikon #XML #Fiji
#@ File xmlFolder (label="Folder with XML Files to combine", style="directory")
// List all XML Files
def files = xmlFolder.list({d, f-> f ==~ /.*.xml/ } as FilenameFilter).collect{ new File( xmlFolder, it) }
// Make a result folder
resultfolder = new File( xmlFolder, "combined")
resultfolder.mkdirs()
// Get the reference from which we will append the others to
@lacan
lacan / concentric-circles.ijm
Last active March 24, 2021 17:42
[Concentric Circles Around Donut] Macro to create concentric circles based on relative distance to an outer edge for a "donut-like" shape #fiji #imagej #imagesc
/**
* Macro to create concentric circles and sectors based on relative distance to an outer edge for a "donut-like" shape
*
* Author: Olivier Burri, EPFL - SV - PTECH - BIOP
*
* For Kailie Batsche, from a request on the Image.sc forum:
* https://forum.image.sc/t/cross-sectional-analysis-cut-into-8-equal-sectors-with-three-concentric-rings/50302?u=oburri
*
* Provided under GPL3
* https://www.gnu.org/licenses/gpl-3.0.en.html
@lacan
lacan / MultiStackMontage All images.groovy
Last active January 21, 2021 13:04
[MultiStackMonage in a script] This script will use MultiStackMontage to create a montage for all open images in Fiji #Fiji #groovy #biop
// Makes a montage with the selected settings from all open images
// By Olivier Burri, EPFL - SV - BIOP
// For Matjaz Panjan, Jožef Stefan Institute
// This needs the StackMontage plugin, which is available from the PTBIOP update site
def nRows = 2
def nCols = 1
// SCRIPT START
@lacan
lacan / Parallel_HistrogramEqualize_All_Slices.groovy
Last active November 11, 2023 13:51
[Parallel Histrogram-Based Normalization] This performs Histogram Based Normalization on all slices of an open stack based on the selected reference slice #fiji #imageJ #histogram #BIOP
#@ ImagePlus image
#@ Integer ( label = "Channel to correct (in case of multichannel images)", value = 1 ) ch_correct
#@ Integer ( label = "Reference Slice", value = 1 ) ref_slice
#@ Boolean ( label = "Use Manual Normalization Parameters Below", value = false ) is_normalize
#@ Integer ( Label = "Minimum" ) the_min
#@ Integer ( Label = "Maximum" ) the_max
// This variable will help us at the end to add the normalized channel back
def all_images = []
@lacan
lacan / FWHM.ijm
Last active May 4, 2023 11:06
[1D Full Width At Half Maximum] This computes the Full Width at Half Maximum FWHM in an image for anz line profile drawn on the image and added to the ROI manager #fiji #imageJ #BIOP #FWHM
/**
* Calculate 1D Full Width at half Maximum of a single line or a series of lines added to the ROI Manager
* Created by Olivier Burri and Romain Guiet, BioImaging & Optics Platform (BIOP)
* Last Update: 2020.10.21
*
* Due to the simple nature of this code, no copyright applies
*
* Installation
* ------------
* From within Fiji Please use "Plugins > Macros > Install" and select this file
@lacan
lacan / FlatField_And_Stitch.groovy
Last active October 22, 2020 09:25
[Flatfield correction followed by stitching] Performs a flatfield correction and stitching from Raw LIF, CZI and LSM files using plugins in Fiji #Fiji #Stitching #Groovy #Flatfield #LIF #LSM #CZI #BIOP
/*
* Flatfield correction followed by stitching
*
* It is often the case that tiled microscopy images contain artifacts due to uneven illumination.
* This is due to the shape of the illumination, the quality of the optics and the size of the field of view, but
* losses of up to 50% can be seen between the periphery and the center of a field of view. This loss usually follows
* a parabolic function, but is not necessarily centered, causing artifacts when stitching tiled acquisitions
*
* While many methods exist to compensate for this, the simplest consists in acquiring a 'flat field' image by
* taking a homogeneous sample (Chroma slides or even better, dye solutions [https://www.ncbi.nlm.nih.gov/pubmed/18173639]) and acquiring it for each channel of the dataset