Skip to content

Instantly share code, notes, and snippets.

View romainGuiet's full-sized avatar

romainGuiet

View GitHub Profile
@romainGuiet
romainGuiet / BIOPLib.ijm
Last active August 29, 2015 14:11
A library of macro functions usefull for ActionBars (created using the ActionBar plugin ). Made at EPFL, BIOP, Olivier Burri, Romain Guiet.
// BIOP Functions Library v1.0
/*
* Returns the name of the parameters window, as we cannot use global variables,
* we just define a function that can act as a global variable
*/
function getWinTitle() {
win_title= toolName();
// If something is already open, keep it as-is.
if(!isOpen(win_title)) {
@romainGuiet
romainGuiet / Temporal-Color_Code_BIOP.ijm
Created May 20, 2016 09:23
A lightly modified version of Fiji.app\plugins\Scripts\Image\Hyperstacks\Temporal-Color_Code.ijm so it stops before projection, so you keep a colored stack
/*
************* Temporal-Color Coder *******************************
Color code the temporal changes.
Kota Miura (miura@embl.de)
Centre for Molecular and Cellular Imaging, EMBL Heidelberg, Germany
If you publish a paper using this macro, please acknowledge.
@romainGuiet
romainGuiet / rotateLineAroundCenter.ijm
Created March 14, 2019 08:58
ImageJ macro language : Around a fixed point, get the x,y corrdinates of the points rotating around the center at a defined distance
/*
* Use of the custom function rotateLine(...)
* Around a fixed point, get the x,y corrdinates
* of the points rotating around the Center at a defined distance
*
*/
selectWindow("blobs.gif");
// Center Point coordinates
@romainGuiet
romainGuiet / multi_DoG.ijm
Created March 30, 2019 08:41
An ImageJ macro language script to perform multi_DoG
title = getTitle;
close("\\Others");
roiManager("Reset");
sigma1 = newArray(1,2,3,4,5,10);
for (i = 0 ; i < lengthOf(sigma1) ; i++) {
selectWindow(title);
run("Duplicate...", "title=gb1");
run("Gaussian Blur...", "sigma="+sigma1[i]);
@romainGuiet
romainGuiet / split_channels.ijm
Last active April 26, 2024 00:18
An imagej macro example to process a folder of images, split the channels and save them in an output directory
// ask user to select a folder
dir = getDirectory("Select A folder");
// get the list of files (& folders) in it
fileList = getFileList(dir);
// prepare a folder to output the images
output_dir = dir + File.separator + "output" + File.separator ;
File.makeDirectory(output_dir);
//activate batch mode
@romainGuiet
romainGuiet / make_ROIs_from_labels.ijm
Created July 3, 2019 09:23
an ImageJ macro to make ROIs from image with labels
roiManager("reset");
getStatistics(area, mean, min, max, std, histogram);
for (i = 1; i <= max; i++) {
setThreshold(i, i);
run("Create Selection");
Roi.setName(IJ.pad(i,6))
roiManager("Add");
}
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
@romainGuiet
romainGuiet / doFWHM.ijm
Created September 3, 2019 09:24
a script for ImageJ (in macro language) to measure Full Width at Half Maximum.
doAxialMeasure = true;
//get some informations about the image
image_Name = getTitle();
getDimensions(image_width, image_height, image_channels, image_slices, image_frames);
getVoxelSize(voxel_width, voxel_height, voxel_depth, voxel_unit);
doFWHM();
@romainGuiet
romainGuiet / QP_Thresholders.groovy
Created October 4, 2019 07:40
A groovy script to use automatic or fixed value threshold in QuPath, via ImageJ.
import qupath.lib.scripting.*
import qupath.lib.regions.*
import qupath.lib.objects.*
import qupath.lib.measurements.*
import qupath.lib.objects.hierarchy.PathObjectHierarchy
import qupath.lib.roi.*
import qupath.imagej.images.servers.*
import qupath.imagej.color.*
import qupath.imagej.gui.*
@romainGuiet
romainGuiet / unzip.py
Last active October 29, 2019 13:32
Export zip file content in current working directory
archive_name = "models.zip"
import os
import zipfile
# retrieve the pat of the current directory (bash command uses !...)
path=!pwd
path = path[0]
# create the archive path using path and archive_name