This file contains hidden or 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
| /* | |
| Purpose: | |
| This QuPath script exports annotations to a CSV file in a format compatible with Polyscope. | |
| The output file must be copied into the following directory in Polyscope: | |
| `..//polyscope/polyzoomer/PathXXXX_XXX/page/imagename/_imagename/annotations.txt` | |
| Works with any version of QuPath—until further notice (or disaster). | |
| Author: Caner Ercan | |
| Date: 28.02.2025 |
This file contains hidden or 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
| base_path = "B:/data/BE/cell_detect/acformer/" | |
| collected_data = NULL | |
| for (dataset in c("NU_dataset_rois","MDA1_dataset_rois","MDA2_dataset_rois")){ | |
| txt_path = paste(base_path,dataset ,"img_list.txt",sep="/") | |
| print(txt_path) | |
| txt_table = read.table(txt_path) |
This file contains hidden or 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
| def classes2delete = ["tissue_box", "tissue"] | |
| classes2delete.each { delclass -> | |
| print delclass | |
| toRemove = getAnnotationObjects().findAll { | |
| it.getPathClass()==getPathClass(delclass) | |
| removeObject(it, true) | |
| } | |
This file contains hidden or 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
| resolveHierarchy() | |
| def server = getCurrentServer() | |
| tsv_folder = buildFilePath(PROJECT_BASE_DIR, "tsv") | |
| def checkDir = new File(tsv_folder) | |
| if(!checkDir.exists()) { | |
| checkDir.mkdir() | |
| } | |
| csv_folder = buildFilePath(PROJECT_BASE_DIR, "corrected_point") | |
| checkDir = new File(csv_folder) |
This file contains hidden or 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
| #!/bin/bash | |
| # Define the base directory | |
| BASE_DIR="/Users/cercan/Desktop/BE/NU_wholeDataset_qupath/data" # Change this to your target directory | |
| OUTPUT_CSV="/Users/cercan/Desktop/BE/NU_wholeDataset_qupath/annotationData.csv" | |
| # Write the header to the CSV file | |
| echo "Name,Unclassified,Biopsy,Flow" > "$OUTPUT_CSV" | |
| # Find all subdirectories and process the JSON files |
This file contains hidden or 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
| import org.apache.commons.io.FilenameUtils | |
| def name = FilenameUtils.getBaseName(getProjectEntry().getImageName()) | |
| def server = getCurrentServer() | |
| selectObjectsByClassification("flow") | |
| anns =[] | |
| def anns = getSelectedObjects() | |
| i=0 | |
| for (ann in anns) { | |
| def roi = ann.getROI() |
This file contains hidden or 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
| //0.2.0 version of https://forum.image.sc/t/assign-point-objects-to-different-rois-by-overlap/26905/2?u=research_associate | |
| // Convert points into detections, resolve the heirarchy so they are now child objects of any annotations. | |
| import qupath.lib.roi.EllipseROI; | |
| import qupath.lib.objects.PathDetectionObject | |
| points = getAnnotationObjects().findAll{it.getROI().isPoint() } | |
| print points[0].getROI() | |
| describe(points[0].getROI()) |
This file contains hidden or 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
| //don't forget to change the stardist model location | |
| // this script will detect the cells and calculate shape, intensity features | |
| // iff you have a cell classifier model you can add it too at line 53 | |
| // the output measurements will be in a folder named 'cellMeasurements' in the project directory | |
| //caner 15.02.23 | |
| import qupath.ext.stardist.StarDist2D | |
| import qupath.lib.images.servers.* | |
| // Specify the model directory (you will need to change this!) |
This file contains hidden or 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
| //* | |
| //Caner Ercan | |
| //[email protected] | |
| //First Dialog Asks for the folder which contains all the images | |
| //Second dialog asks for time zero image | |
| //It generates a file in the same folder named as Results.csv | |
| *// | |
| setBatchMode(true); | |
| input = getDirectory("Choose Image Directory"); |
This file contains hidden or 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
| /** | |
| From https://forum.image.sc/t/qupath-multiple-image-alignment-and-object-transfer/35521/2 | |
| 0.2.0m9 | |
| If you have annotations within annotations, you may get duplicates. Ask on the forum or change the def pathObjects line. | |
| To use, have all objects desired in one image, and alignment files in the Affine folder within your project folder. | |
| If you have not saved those, this script will not work. | |
| It will use ALL of the affine transforms in that folder to transform the objects in the current image to the destination images | |
| that are named after the affine files. |
NewerOlder