Skip to content

Instantly share code, notes, and snippets.

View NicoKiaru's full-sized avatar

Nicolas Chiaruttini NicoKiaru

View GitHub Profile
@ato
ato / TempoDirectory.java
Created October 1, 2013 05:55
TempDirectory java temporary directory delete on exit
import java.io.IOException;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
class TempDirectory {
final Path path;
@lacan
lacan / Export_Images_Folder.ijm
Last active May 15, 2024 10:05
Extract multi-series file and resave as TIFF stacks or slices #Fiji #ImageJ #Macro #BIOP
/*
* Complex Format EXPORT MACRO
* By Olivier Burri @ EPFL - SV - PTECH - BIOP
* Given a folder, extracts all series inside all multi-file files with given extension in new folders
* Last edit: 13.02.2017
*/
////////////////////// SET PARAMETERS //////////////////////
////////////////////////////////////////////////////////////
@GenevieveBuckley
GenevieveBuckley / convert_ImagePlus_to_ImgPlus.py
Created January 9, 2018 04:52
ImageJ API scripting in Jython - how to convert to and from ImgPlus and ImagePlus. http://javadoc.scijava.org
"""Converting from ImagePlus to ImgPlus.
When an ImagePlus is made available by ImageJ 1.x,
you can pass it to ImgLib2 as an Img via ImageJFunctions.wrap(imp)
http://javadoc.scijava.org/ImgLib2/net/imglib2/img/display/imagej/ImageJFunctions.html
"""
from ij import IJ
from net.imglib2.img import ImagePlusAdapter
image = IJ.openImage() # opens a file picker, or you can add the filename string as an argument.
output = ImagePlusAdapter.wrapImgPlus(image) #
import ij.*
import ij.plugin.Duplicator
import ij.io.FileSaver
/**
*
* Here is a groovy script which:
* - Gets information about the current ImagePlus File (via imp.getOriginalFileInfo()),
* - Retrieves its directory
* - Creates an output subfolder
@mutterer
mutterer / readCziEvents_.ijm
Last active May 9, 2023 20:22
An ImageJ macro to read 'timestamps' and 'events' from CZI files. Request from Julien Cau and Emmanuel Perisse.
// ImageJ macro to read 'timestamps' and 'events' from CZI files.
path = File.openDialog("Select CZI File");
s = File.openAsRawString(path, File.length(path));
o = indexOf(s,"CZTIMS");
o=o+0xcc;
n = parseInt(read32bAt(o));
timestamps = newArray(n);
@romainGuiet
romainGuiet / BIOP-userProject.ijm
Last active June 16, 2021 14:26
A ImageJ macro to create a standardized "User Project" folder. #BIOP #FIJI #Macro #UserProject
#@File(label="Please select an UserName-Lab", style="directory") selected_dir
#@String() projectName
/*
* Macro to create a folder accordingly to BIOP template.
*
*
*
* git need to be installed
@lacan
lacan / Export Annotations For Stardist.groovy
Last active July 30, 2023 14:32
[QuPath Script To Export Annotations For Stardist] this script will take rectangular annotations in QuPath and export them and their containing objects as images and masks for deep neural netowrk training #qupath #stardist #BIOP
/*
// ABOUT
Exports Annotations for StarDist (Or other Deep Learning frameworks)
// INPUTS
You need rectangular annotations that have classes "Training" and "Validation"
After you have placed these annotations, lock them and start drawing the objects inside
// OUTPUTS
----------
@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 / 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")
#@ UIService ui
#@ DatasetService ds
/*
* Happy Pi Day 2022
*
* This visualizes the bifurcation diagram for the "standard circle map"
* https://en.wikipedia.org/wiki/Arnold_tongue#Standard_circle_map
*
* (and its parameters are expressed in terms of pi)