Skip to content

Instantly share code, notes, and snippets.

View romainGuiet's full-sized avatar

romainGuiet

View GitHub Profile
@romainGuiet
romainGuiet / postprocessing.txt
Created December 3, 2019 14:08
Postprocessing macro for DeepImageJ using StarDist model
name=getTitle();
run("Make Substack...", "channels=1");
rename("Predicted object probability");
proba_ID = getImageID();
run("Fire");
selectWindow(name);
run("Make Substack...", "channels=2-33");
@romainGuiet
romainGuiet / qps-export_annotations_as_ijROIs.groovy
Last active December 20, 2019 11:31
QuPath script (qps) to export the image annotations as a ROIset.zip in a '/ROI Sets' folder. The ROIset.zip saving/naming convention respect the ImageJ's BIOPLib.ijm (from PTBIOP update site).
// = CODE DESCRIPTION =
// Image annotations are saved as a ROIset.zip in a '/ROI Sets' folder, so they can be re-open in Image-j
// The ROIset.zip saving/naming convention respect the ImageJ's BIOPLib.ijm (from PTBIOP update site).
//
// == INPUTS ==
// A QuPath project, with annotations.
//
// == OUTPUTS ==
// The annotations are saved as a ROIset.zip in a '/ROI Sets' folder,
//
@romainGuiet
romainGuiet / LabelImageToRoiManager.groovy
Created January 14, 2020 10:09
Add ROIs to ImageJ roiManager from an image with labels.
// adapted from https://gist.github.com/NicoKiaru/ae00117cd6d33fea500d2867a5e669d9
//
// = CODE DESCRIPTION =
// Add ROIs to ImageJ roiManager from an image with labels.
//
// == INPUTS ==
// A label image, grey or RGB.
//
// == OUTPUTS ==
// Rois in ImageJ roiManager.
@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
@romainGuiet
romainGuiet / BIOP-DiAna.ijm
Last active March 18, 2022 08:08
An example ImageJ macro language script to run DiAna (images available here : https://drive.switch.ch/index.php/s/nfVRYJIic3lsfhm , supporting slides here : https://go.epfl.ch/2020-intro-diana ) #BIOP #Fiji #Coloc #DiAna
#@File(label= "Input composite multi channel image" ) image_path
#@int(label= "Channel A index") channelA
#@int(label= "Channel A threshold", value=5) thresholdA
#@int(label= "Channel B index") channelB
#@int(label= "Channel B threshold", value=30) thresholdB
// make sure everything is clean
@romainGuiet
romainGuiet / Find_FalsePositive_threshold.ijm
Last active May 28, 2024 10:13
An ImageJ macro to determine False Positive threshold on control images. #BIOP #FIJI #Macro #Coloc
#@File image_path
#@Integer(value=1) ch_idx
#@Boolean(value=true) closeImages
table_name = "FP_thresholds";
open(image_path );
img_name = getTitle();
print(img_name);
@romainGuiet
romainGuiet / Lazy_3DAnnotations.ijm
Last active October 29, 2020 10:31
ij macro prototype for lazy 3D annotations reyling on ROIs interpolation. #BIOP #FIJI #Annotations #Labels
// select an image with imcomplete labelling
// with first and last slice, plus some slices in the middle where you notice changes
#@File() image_path ;
// here we clear the environment
run("Close All");
print("\\Clear");
// Open image and get some infos about your file
open( image_path );
@romainGuiet
romainGuiet / qps-export_3D_labels.groovy
Last active June 11, 2020 09:41
a prototype groovy script to export 3D labels from QuPath annotation
/* QuPath-Script to export annotations to label tif images (e.g. to be used for stardist)
Use "Run for project" to export annotations for all images within a QuPath project
Afterwards both images and mask tiffs will be stored in the project subfolder
ground_truth
├── images
└── masks
@romainGuiet
romainGuiet / ijs-export_lif_zprojAvailable.groovy
Last active November 9, 2020 14:43
A groovy script usable in FIJI to export images of a lif file (should work with other bioformats supported format). User can specify the series to export using comma (1,2,3) or a range using dash (1-5) , or nothing to export all series #BIOP #FIJI #groovy #export #bioformats
#@ File image_path
#@ String seriesNbr
#@ String (choices={"max","avg","sum","none"}) zProj
import org.apache.commons.io.FilenameUtils
import ij.*
import ij.plugin.ZProjector
import ij.io.FileSaver
@romainGuiet
romainGuiet / closeOthers.groovy
Last active April 10, 2024 03:58
groovy command equivalent to 'close("\\others")' in macro language. #BIOP #Groovy #Macro
// https://forum.image.sc/t/macro-function-close-others-in-groovy/44630
// Using ID as proposed by @imagejan
import ij.WindowManager
#@ ImagePlus imp
WindowManager.getIDList()
.findAll{ it != imp.getID() }
.each{ WindowManager.getImage(it).close() }
null // suppress result processing by SciJava