Skip to content

Instantly share code, notes, and snippets.

View lacan's full-sized avatar
🤝

Olivier Burri lacan

🤝
View GitHub Profile
@lacan
lacan / lutToIntensity.ijm
Last active July 24, 2019 01:12
Reconvert color coded image to intensity based on color scale. #ImageJ #Fiji #Macro
/*
* Reconvert color LUT to intensity
* Olivier BURRI
* BioImaging and Optics Platform BIOP, EPFL
* In reply to an ImageJ Forum Post http://forum.imagej.net/t/split-colored-height-map-of-moon-in-greyscale-images/
* Provided As-Is
*/
// Before running this macro, make sure that you have an image called LUT with the color scalebar separately
@lacan
lacan / Export_Images_Folder.ijm
Last active February 24, 2024 12:27
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 //////////////////////
////////////////////////////////////////////////////////////
@lacan
lacan / curvature_radius.bsh
Last active October 13, 2022 15:18
Curvature radius simple calculation for ImageJ/fiji #Fiji #Beanshell #Curvature #ImageJ
/*
* Simple script that takes a selection and computes the curvature radius for the whole perimeter of the shape.
*
* By Olivier Burri,
* BioImaging and Optics Platform, BIOP
* Ecole Polytechnique Fédérale de Lausanne (EPFL)
* Last update: May 2017
*
*
*/
@lacan
lacan / Prune_Skeleton_Ends.bsh
Last active October 22, 2020 09:30
[Prune Skeleton Ends] Script to prune skeletons endpoints whose branches are shorter than the specified distance #Beanshell #ImageJ #Fiji #Skeleton #BIOP
// @ImagePlus(label="Skeleton image", description="Binary image skeletonized with Skeletonize3D") image
// @double(label="Length threshold", description="Minimum branch length to keep") threshold
// @OUTPUT ImagePlus prunedImage
import sc.fiji.analyzeSkeleton.AnalyzeSkeleton_;
import sc.fiji.analyzeSkeleton.Edge;
import sc.fiji.analyzeSkeleton.Point;
import ij.IJ;
// analyze skeleton
@lacan
lacan / Stitch_Correction.bsh
Last active November 30, 2018 11:45
[Stitching with Flatfield Correction] Takes a folder as input and processed all multiseries files there using a provided flatfield file #Beanshell #Stitching #Fiji #ImageJ
//@File(label="Multiposition Files Directory",style="directory") image_directory
//@String(value="Select a file for flat field correction or write none", visibility="MESSAGE") textFF
//@File(label="Flatfield Correction File", value="none") ff_file
//@int(label="Downsample Factor", style = "slider", min = "1", max = "16", stepSize = "1") downsample
//@Boolean(label="Compute Overlap") is_compute
//@String(label="Macro Mode",choices={"Fuse and display","Write to disk"}) output_type
//@LogService log
import ij.IJ;
import loci.formats.ImageReader;
@lacan
lacan / Normalize_Line_Straighten.ijm
Last active October 22, 2020 10:07
[Nomalize Line Profile] Normalizes line profiles by making use of the Straighten command followed by scaling #Macro #ImageJ #Fiji #BIOP
/*
* Normalizes line profiles by making use of the Straighten command followed by scaling
* By Olivier Burri, BioImaging And Optics Platform
* In Response to http://forum.imagej.net/t/average-pixels-with-line-tool/6408?u=oburri
*
* OUTPUT is the values of the line profile as a results table
* Column name is the image name.
* the number of rows corresponds to the normalization length normLength
*/
@lacan
lacan / get_Distances.ijm
Created August 10, 2017 11:10
[Compute Distance Based on Edges] Determine Length of a rather homogeneous structure using Find Edges on graylevel image #Macro #ImageJ #Fiji
/*
* Determine Length of a rather homogeneous structure using Find Edges on graylevel image
*
* using an iterative approach to end up having exactly two peaks on the
* maximum finder.
*
* By Olivier Burri
* BioImaging And Optics Platform.
*
* In response to http://forum.imagej.net/t/how-calculate-the-pixels-distance/6478?u=oburri
@lacan
lacan / Rescale_Images_Parallel.groovy
Last active October 22, 2020 10:14
[Rescale images in XYZ Parallel] Resamples images in parallel #Fiji #ImageJ #Bioformats #Groovy
//@File (label="Series File") image_file
//@Integer(label="XY Resampling") xy_resampling
//@Integer (label="Z Step") z_step
import loci.plugins.util.BFVirtualStack
import loci.formats.ChannelSeparator
import ij.ImagePlus
import ij.IJ
import groovyx.gpars.GParsExecutorsPool
@lacan
lacan / Histogram_Matching_Parallel.groovy
Last active October 22, 2020 10:14
[Parallel Histogram Matching for Stacks] #Groovy #Fiji #ImageJ
//@File (label="Directory with file(s)", style="directory" ) theDir
//@Integer (Label="Channel To Correct") ch_correct
//@Boolean (label="Use Normalization Parameters Below") is_normalize
//@Integer (Label="Minimum") the_min
//@Integer (Label="Maximum") the_max
/**
* Image stack equalizer for image folder
*
* The purpose of this script is to use the histogram of the first slice of the first image
@lacan
lacan / find_delaunay_neighbors_distance_demo.ijm
Last active December 8, 2018 10:00
[Neighbors from Delaunay] Find Average Neighbor Distance From Delaunay Triangulation Demo #ImageJ #Fiji #Macro
/**
* Demo of using Delaunay triangulation to find average inter-neighbor distances
* In reply to ImageJ forum post:
* http://forum.imagej.net/t/measuring-distance-to-neigbours/10712
*
* Olivier Burri, EPFL BIOP (BioImaging And Optics Platform)
* May 1st 2018
*
* Provided as-is under Creative Commons Attribution 4.0 International License
* https://creativecommons.org/licenses/by/4.0/