Skip to content

Instantly share code, notes, and snippets.

View NicoKiaru's full-sized avatar

Nicolas Chiaruttini NicoKiaru

View GitHub Profile
@NicoKiaru
NicoKiaru / DetectCellsABBA.groovy
Last active January 11, 2024 13:37
Performs cell detection in QuPath from an ABBA registered project with imported regions #BIOP #ABBA #QuPath
/**
* ABBA Script : performs a cell detection on the root node annotation
* imported from ABBA and restores the child objects after the detection has been performed
* To use and modify like you need / want
* You need to have imported the regions before running this script. See https://gist.github.com/NicoKiaru/723d8e628a3bb03902bb3f0f2f0fa466 for instance
* See https://biop.github.io/ijp-imagetoatlas/
* Author: Olivier Burri, Nicolas Chiaruttini, BIOP, EPFL
* Date: 2022-01-26
*/
@NicoKiaru
NicoKiaru / ExportCellDataABBA.groovy
Last active February 8, 2022 11:43
Export Cell Data from an ABBA registered project #BIOP #ABBA #QuPath
// To execute before:
// 0 - https://gist.github.com/NicoKiaru/723d8e628a3bb03902bb3f0f2f0fa466
// 1 - https://gist.github.com/NicoKiaru/f45f56e3ff2d1fb708821c110fbdee62
// save annotations
File directory = new File(buildFilePath(PROJECT_BASE_DIR,'export'));
directory.mkdirs();
def imageData = getCurrentImageData();
imageName = ServerTools.getDisplayableImageName(imageData.getServer())
@NicoKiaru
NicoKiaru / RemoveABBARegions.groovy
Created February 10, 2022 09:39
Re-import ABBA regions then filter out regions based on name #BIOP #ABBA #QuPath
// Modify the sequence of functions according to your need:
// - reImportAbbaRegions()
// - clearAllExcept(['Left: TH', 'Left: MB'])
// - clearRight()
// - clearLeft()
//
reImportAbbaRegions() // Erase and re import regions
@NicoKiaru
NicoKiaru / FijiMultiSeriesExporter.groovy
Last active November 4, 2024 15:29
Takes a bioformats compatible file and batch exports individual series, optionally Z Projected and rescaled #BIOP #Fiji #BigDataViewer
// You need to activate https://biop.epfl.ch/Fiji-Bdv-Playground/ for this script to function
// It takes a file and batch exports individual series, optionally Z Projected and rescaled
// Deals pretty correctly with Big dataset + saves multiresolution OME-TIFFs file, keeping the positional metadata
// Nicolas Chiaruttini, BIOP, EPFL, 2022
#@File(label="Dataset") image_file
#@String(label="Give a name to your dataset") dataset_name
#@String( label = "Select a subset of channels (0 based, comma separated). Leave blank for all", value="") range_channels
#@String( label = "Selected slices (0 based, comma separated). Leave blank for all", required = false ) range_slices
#@String( label = "Selected frames (0 based, comma separated). Leave blank for all", required = false ) range_frames
@NicoKiaru
NicoKiaru / SanitizeOperetta32bitsTiffs.groovy
Created March 29, 2022 12:01
Removes all 32 bits file from an Operetta dataset - crops values above 65535 #BIOP #Fiji #Operetta
#@File(label = "Select the 'Images' folder of your Operetta dataset", style = "directory") folder
#@TaskService taskService
def task = taskService.createTask("Operetta Sanitizer ")
try {
task.setStatusMessage("Listing files...")
task.setProgressMaximum(0)
def fileList = folder.list() as List
@NicoKiaru
NicoKiaru / CheckJarsAndUpdateSites.groovy
Last active March 31, 2022 10:32
Script checking the update sites and some repository #BIOP #Fiji
/**
* Simple script demoing how to check if an update site is enabled
* and how to list all enabled update sites
*
* @author Nicolas Chiaruttini
* BIOP, EPFL, 2022
**/
#@UpdateService updateService
@NicoKiaru
NicoKiaru / CarToPolDemo.groovy
Created April 11, 2022 07:40
Demoing cartesian to polar and polar to cartesian transform with imglib2
// See https://forum.image.sc/t/reconstructing-tomographic-light-sheet-data-2d-slice-into-cylindrical-3d-volume
// Bigdataviewer-playground update site need to be activated
#@ConvertService cs
#@ImagePlus(required=false) image
#@int numberOfAngles
#@BdvHandle(required=false) bdvPolar
#@BdvHandle(required=false) bdvCar
#@ColorRGB color
#@SourceAndConverterBdvDisplayService bdvDisplay
package ch.epfl.biop.test;
/**
* Simple tests of potential arithmetic simplification that I think
* a JIT compiler should be able to do:
* - Multiplications by ones
* - Additions with zeros...
*
* My wish is that special cases matrices computations could be auto-simplified.
* (a translation matrix is only 3 additions in 3D)
@NicoKiaru
NicoKiaru / LogFijiConfig.groovy
Created December 2, 2022 07:09
Logs all Fiji update sites activated and other information (OS, ij version)
/**
* Simple script demoing how to check if an update site is enabled
* and how to list all enabled update sites
*
* @author Nicolas Chiaruttini
* BIOP, EPFL, 2022
**/
#@UpdateService updateService
@NicoKiaru
NicoKiaru / CreateLargeImageAndSaveItAsTiff.groovy
Last active January 20, 2023 17:06
A Fiji script that can generate a procedural big image (>4GPix) and resaves it as a multi resolution OME TIFF image #BIOP #Fiji
/**
* Makes a big 2d procedural plane and saves it as a multiresolution ome.tiff image
*
* Tested on a 128 000 x 128 000 images with 8000 objects (11G pix), 10 resolutions levels, downscale 2 ~ 30 minutes to generate
*
* PTBIOP update site needed
* @author Nicolas Chiaruttini, 2023
*/
#@Integer nPixelsX