Skip to content

Instantly share code, notes, and snippets.

View romainGuiet's full-sized avatar

romainGuiet

View GitHub Profile
@romainGuiet
romainGuiet / make_cells_from_cytos_and_nuclei.groovy
Created October 7, 2024 09:16
A QuPath script to make cell objects from lists of cytos and nuclei
cytos = getDetectionObjects().findAll{it.getPathClass() == getPathClass('cells')}
nuclei = getDetectionObjects().findAll{it.getPathClass() == getPathClass('nuclei')}
print cytos
print nuclei
// Combine cytos and nuclei detections to create cell objects
def cells = cytos.collect{ cyto ->
cell_nucs = nuclei.findAll{ nuc -> cyto.getROI().contains( nuc.getROI().getCentroidX() , nuc.getROI().getCentroidY() )}
if ( !cell_nucs.isEmpty() ) {
#@ ImagePlus imp
#@ Double tolerance
nT = imp.getNFrames()
imp.getStack().
means_vals = (1..nT).collect{
imp.setT(it)
return imp.getStatistics().mean
}
@romainGuiet
romainGuiet / Seurat.groovy
Last active July 5, 2023 09:15
make detection of a define size
/* = CODE DESCRIPTION =
* This QuPath script fills thae image Annotations objects with circular detections objects of a user defined diameter.
* In combination with "Measure > Show measurements maps" it can be helpfull to quickly create meaningful heatmaps.
*
* == INPUTS ==
* Annotation(s) and RegionOfInterest diamater (in microns)
*
* == OUTPUTS ==
* circular detections objects of a user defined diameter
*
@romainGuiet
romainGuiet / RUN_mulitpleParam_Cellpose.groovy
Created March 16, 2022 13:48
A groovy script to batch test param for cellpose
#@File file_path
IJ.run("Close All", "");
// the folder containing the lif
dir = file_path.getParent()
// a subfolder to save images
output_dir = new File( dir ,"outputRom1PC")
output_dir.mkdir()
@romainGuiet
romainGuiet / make_3D_labels.groovy
Created October 27, 2021 13:53
Convert a Labels image to Measurements image (requires morpholibJ)
#@ImagePlus imp // imp should be a 3D label image
#@String stat_name // morpholibJ output table after Analyze Regions 3D
// using morpholibJ , update site : IJPB-plugins
IJ.run("Analyze Regions 3D", "voxel_count volume surface_area mean_breadth sphericity euler_number bounding_box centroid equivalent_ellipsoid ellipsoid_elongations max._inscribed surface_area_method=[Crofton (13 dirs.)] euler_connectivity=6");
// Duplicate the imp and make it 32-bit
imp_label = imp.duplicate();
IJ.run(imp_label, "32-bit", "");
run("Close All");
roiManager("reset");
// ring thickness
step = 10 ;
// prepare a test image
setForegroundColor(255, 255, 255);
setBackgroundColor(0, 0, 0);
newImage("Shape", "8-bit black", 512, 512, 1);
makePolygon(258,122,171,192,115,272,167,430,232,350,229,302,289,338,324,300,329,236,411,160);
@romainGuiet
romainGuiet / fake_StarDist3D.groovy
Created February 5, 2021 12:22
a fake StarDist3D combining StarDist2D+TrackMate+LaRoME
#@File image_path
#@RoiManager rm
#@ CommandService command
#@ Double (label="Nuclei Proba. Threshold", value=0.5) threshold_proba_nuc
#@ Double (label="Nuclei min. intensity (A.U.)", value=10) minInt_nuc
#@Integer (label="Max Frame Gap") frameGap
#@Double (label="Linking Max Distance") linkDistance
#@Integer (label="Gap Closing Max Distance") gapClosingDistance
// authors : olvier.burri & romain.guiet (at) epfl.ch
@romainGuiet
romainGuiet / test_optionDisableSmoothing.ijm
Created January 15, 2021 07:47
For the review of the article (https://f1000research.com/articles/9-1380). A macro to test the option "disable smoothing" of the plugin "Process>Subtract Background..."
run("Close All");
run("Blobs (25K)");
img1 = getImageID();
run("Invert LUT");
run("32-bit");
rename("On_disableSmoothing");
run("Duplicate...", "title=Off_disableSmoothing");
img2 = getImageID();
@romainGuiet
romainGuiet / ijs-EasyXT-Filter_detectedSpots.groovy
Last active December 18, 2020 06:28
An example script to show how to filter spots after the detection. #Fiji #EasyXT-Fiji #Imaris #BIOP
name_spots = "pinkySpots";
name_filtered_spots = name_spots+"-filtered";
rt = new ResultsTable()
rt.reset()
// Here teh script expect to find the demo.ims file in the folder Fiji>Plugins>BIOP
def plugins_dir = IJ.getDirectory("plugins")
def biop_dir = new File(plugins_dir , "BIOP")
ims_name = "HeLa_H2B-mcherry_Tubline-EGFP_mitochondria-MitoTracker_reduced.ims"
@romainGuiet
romainGuiet / image_fig.ijm
Last active December 7, 2020 06:42
A imagej macro to create the image from Figure 3, https://f1000research.com/articles/9-1380/v1
oneOval = 1 ;
//size_Array = newArray(1,5,10,20,50,100);
size_Array = newArray(7,9,11,15,20,25,50);
int_Array = newArray(5,10,20,50,100,150,250);
Array.getStatistics(size_Array, size_Array_min, size_Array_max, size_Array_mean, size_Array_stdDev);
//print(size_Array_max);