Skip to content

Instantly share code, notes, and snippets.

View lacan's full-sized avatar
🤝

Olivier Burri lacan

🤝
View GitHub Profile
@lacan
lacan / Convert Images Using QuPath.groovy
Created September 6, 2022 07:56
[Convert Images to Pyramids using QuPath in Parallel] this is pretty fast and works for RGB images. To run in Fiji #fiji #qupath #ome-tiff
#@ File imagesDirectory (label="Directory with images", style="directory")
#@ String extension (label="Image extension", value="tif")
#@ String quPathExe (label="Path to QuPath Executable", value="C:/QuPath-0.3.2/QuPath-0.3.2 (console).exe")
import groovyx.gpars.GParsPool
def folder = imagesDirectory
def convertedFolder = new File( folder.getParent(), "converted")
convertedFolder.mkdirs()
@lacan
lacan / Data_To_Midi.groovy
Created August 24, 2022 09:23
[Data to MIDI sound] Use results from a Results table as notes to form a melody #midi #imagej
#@ File saveLocation (label="Location of MIDI save file")
/**
* Testing Spots to Sound using MIDI
* Each hit is given a unique note based on some metric and intensity is related to volume
*
* = AUTHOR INFORMATION =
* Code written by Olivier Burri, EPFL - SV - PTECH - BIOP
* for Samuel Vernon, McCabe Lab
* 2022.08.23
@lacan
lacan / Save objects as masks.groovy
Created April 1, 2022 13:40
[Save PathObjects instances as label masks] Saves the selected type of PathObject as a label image. Useful for training Deep Models where the ground truth is annotated in QuPath#QuPath
// Save the whole Image
def downsample = 4
// Save the whole Image
def request = RegionRequest.createInstance( getCurrentServer(), downsample )
def imageData = getCurrentImageData()
@lacan
lacan / Create IJ RoiSet ZIP From Cells.groovy
Created April 1, 2022 13:20
[Create ImageJ Rois from QuPath Cells] Generates a RoiSet.zip file for the current image for all cell objects #QuPath #ImageJ
// Create cytoplasm ROI before adding it to the Roi Manager?
def getcytoplasm = true
// START OF SCRIPT
// Use ImageJ's RoiManager
def rm = RoiManager.getInstance() == null ? new RoiManager() : RoiManager.getInstance()
rm,.reset()
@lacan
lacan / Export Rendered View.groovy
Created March 11, 2022 12:08
[Export Rendered View] Exports the WYSIWYG version of a certain region as a jpeg with a metadata field appended to the image name. Works with Run for Project #qupath
// Export Rendered view of S1HL as open in QuPath with metadata tag in file name
// Author: Olivier Burri
// originally for Julie Meystre, LNMC
// Date: 2022 03 11
// NOTE: Make sure that all settings are as you want them on a currently open image (Channels, hidden Pathclasses, Annotation names, ...) before you start, as your current display and layer settings will be applied to all image if you use "Run for Project"
def downsample = 5
def regionClass = "S1HL"
def metadataName = "Distance to midline"
@lacan
lacan / TrackMate-StarDist.groovy
Created March 9, 2022 15:23
[TrackMate with Custom StarDist Model] Run TrackMate from a script and save the results. #fiji #stardist #trackmate
/**
* Use StarDist in TrackMate from the latest version and export results
* Using a custom StarDist Model
* Author: Olivier Burri, EPFL SV PTECH BIOP
* Last Modification: March 2022
*
* Due to the simple nature of this code, no copyright is applicable
*
*/
@lacan
lacan / good_code.ijm
Last active November 2, 2021 14:18
[Nice try]
// You are a smart one
// But we did not share a solution to this code :)
// Here it is again just for you:
// You are a smart one
// But we did not share a solution to this code :)
// Here it is again just for you:
run("Set Measurements...", "area mean standard modal min limit display redirect=None decimal=3");
@lacan
lacan / bad_code.ijm
Last active November 2, 2021 14:18
[Bad code example] Example short code that does not have any comments or variables #fiji #macro #bestpractices
run("Set Measurements...", "area mean standard modal min limit display redirect=None decimal=3");
run("Split Channels");
selectWindow("C1-Edu+_RFP+_(2).tif")
run("Median...", "radius=5");
setAutoThreshold("Li dark");
run("Create Selection");
selectWindow("C2-Edu+_RFP+_(2).tif");
run("Restore Selection");
@lacan
lacan / Crop Dataset Around Nuclei.groovy
Created October 1, 2021 16:18
[Crop Dataset Around Nuclei] Crops an Imaris Dataset where nuclei were tracked by taking the centroid of each surface at each timepoint #groovy #imaris #cool
/**
* Split Imaris Tracked Nuclei into separate ims files
*
*
* Author: Olivier Burri EPFL SV PTECH BIOP
* for Noémie Chabot, Vastenhouw Lab
*
* Last update: 01-10-2021
*
* Dependencies: EasyXT https://github.com/BIOP
@lacan
lacan / 3D Shell Measurement.groovy
Created July 23, 2021 10:18
[3D Shell Intensities] Segments nucleus and creates concentric shells to measure the average intensity of a channel of interest #Fiji #ImageSC #Macro
// Make 3D Shell and measure intensity at given thicknesses
// By Olivier Burri, EPFL - SV - PTECH - BIOP
// As a response to an ImageSC forum post:
// https://forum.image.sc/t/help-with-shell-analysis-of-nuclei/54342
// Last update: 2021/07/23
raw = getTitle();
close("\\Others");