-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
scripts to export annotations as rois and create masks from them
- Loading branch information
1 parent
5d14e41
commit 0dbc8a3
Showing
3 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
*.class | ||
# User-specific stuff | ||
**/.idea/** | ||
|
18 changes: 18 additions & 0 deletions
18
volker/toolsets/tree_ring_segmentation/groovy/export_rois.groovy
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import ij.plugin.frame.RoiManager | ||
|
||
|
||
def imageData = getCurrentImageData() | ||
def name = GeneralTools.getNameWithoutExtension(imageData.getServer().getMetadata().getName()) | ||
def path = buildFilePath(PROJECT_BASE_DIR, name + ".zip") | ||
|
||
def annotations = getAnnotationObjects() | ||
def roiMan = new RoiManager(false) | ||
double x = 0 | ||
double y = 0 | ||
double downsample = 1 // Increase if you want to export to work at a lower resolution | ||
annotations.each { | ||
def roi = IJTools.convertToIJRoi(it.getROI(), x, y, downsample) | ||
roiMan.addRoi(roi) | ||
} | ||
roiMan.runCommand("Save", path) | ||
roiMan.runCommand("Reset") |
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