This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// A label image with ROIs in the ROI Manager should be opened before running this macro | |
// It will remove all the boundary ROIs in the ROI Manager | |
// Author: Ved Sharma, The Rockefeller University (October 20, 2022) | |
imgWidth = getWidth(); // in pixels | |
imgHeight = getHeight(); // in pixels | |
setForegroundColor(0, 0, 0); // setting foreground color for filling black to removed ROIs | |
count=0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create ROIs from a label image, such as the one generated from Cellpose | |
// Works for 8 and 16 bit label images. | |
// Open the label image and run this macro. It will generate the ROIs and add them to the ROI Manager. | |
// Author: Ved Sharma, The Rockefeller University, October 21, 2022 | |
if(bitDepth() != 8) | |
if(bitDepth() != 16) | |
exit("Image bit depth = "+bitDepth()+".\n \nThis macro works with only 8 and 16 bit label images!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Scripts mostly taken from Pete, and also from the forums. For easy access and reference. | |
TOC | |
Remove detections outside annotations.groovy - Removes detections without a parent object. | |
Removing measurements by Weka file.groovy - Uses the results of Weka classification analysis of your training set | |
to select the "best" measurements plus any specific ones you want to keep. Then it removes the rest. Use this to clean up | |
large amounts measurements like LBP, Haralick, Smoothed etc. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove detections that have ROIs that touch the border of any annotation ROI in QuPath v0.2. | |
* | |
* Note that there are some non-obvious subtleties involved depending upon how ROIs are accessed - | |
* see the 'useHierarchyRule' option for more info. | |
* | |
* Written for https://forum.image.sc/t/remove-detected-objects-touching-annotations-border/49053 | |
* | |
* @author Pete Bankhead | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ImageJ/Fiji macro to count no. of shapes in an image (Cirlces, Squares and Triangles) | |
// Macro written in response to the question on image.sc forum: | |
// https://forum.image.sc/t/can-i-count-different-shape-with-the-imagej/53497 | |
// | |
// Version 2: added the interpolate ROI to smoothen the ROI boundary | |
// Author: Ved P Sharma (June 10, 2021) | |
run("Select None"); | |
roiManager("reset"); | |
run("Invert"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ImageJ/Fiji macro to label slices in a stack with values read from a text file | |
// Author: Ved P Sharma (June 2, 2021) | |
str = File.openAsString(""); | |
labels=split(str,"\n") | |
n = labels.length; | |
for(i=0; i<n; i++) { | |
label = labels[i]; | |
sliceNumber=toString(i+1)+"-"+toString(i+1); | |
run("Label...", "format=Text starting=0 interval=1 x=5 y=20 font=18 text=&label range=&sliceNumber"); |