Last active
May 21, 2019 19:42
-
-
Save ctrueden/5143f1511cc21b8e8f64c1626e72962c to your computer and use it in GitHub Desktop.
Import a cropped region of a 2D image using SCIFIO
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
#@ DatasetIOService dio | |
#@ File imageFile | |
#@ long x | |
#@ long y | |
#@ long width | |
#@ long height | |
#@output Dataset dataset | |
from io.scif.config import SCIFIOConfig | |
from io.scif.img import ImageRegion, Range | |
from net.imagej.axis import Axes | |
config = SCIFIOConfig() | |
xRange = Range(x, x + width - 1) | |
yRange = Range(y, y + height - 1) | |
region = {Axes.X: xRange, Axes.Y: yRange} | |
config.imgOpenerSetRegion(ImageRegion(region)) | |
dataset = dio.open(imageFile.getAbsolutePath(), config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Originally posted to this Image.sc Forum thread.