Skip to content

Instantly share code, notes, and snippets.

View NicoKiaru's full-sized avatar

Nicolas Chiaruttini NicoKiaru

View GitHub Profile
@NicoKiaru
NicoKiaru / GraphLifeTimeVSRepetitionRate.ijm
Created September 19, 2023 09:07
A small demo of the Pile-up effect in FLIM imaging #BIOP #FIJI #FLIM
/**
* A small theory about pile-up effect in FLIM - unfortunately I lost the way I made these equations
*
* (I think the documentation below is wrong: what is n ? what is alpha ? why are they not the same ?)
*
* Here, we model a poisson process for the number of photon emitted per excitation pulse. (parameter alpha)
* In other words: alpha is the parameter of the poisson distribution ( = average number of photons emitted after an excitation pulse)
*
* And each photon has a mono-exponential lifetime tau
*
@NicoKiaru
NicoKiaru / XmlCZI.java
Created May 8, 2023 21:17
A class that can be used to (partially) bind CZI file properties to Java objects
package loci.formats.in.libczi;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.ArrayList;
import loci.common.DataTools;
import ome.units.UNITS;
import ome.units.quantity.Length;
@NicoKiaru
NicoKiaru / ImagePlusToAtlas.groovy
Created February 27, 2023 11:40
How to use an Image from ImageJ and transform it into an Atlas in ABBA
#@ImagePlus structural_images
#@ImagePlus label_image
#@Double atlas_precision_mm
#@ObjectService os
@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
@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
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 / 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
@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 / 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 / FijiMultiSeriesExporter.groovy
Last active May 11, 2022 14:10
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
#@boolean(label="Show advanced opening parameters") advanced
#@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