Need help or advice ? Come to the Icy club ! - Every other Thursday morning from 9h30 to 12h30 - Francois Jacob Building - Main hall - Pasteur

Invert ROI

by tprovoost / Thomas Provoost

Inversion of an ROI in python.

version 1 (last version):

download to use and modify in Icy. How do I use scripts ? A Problem ? ask the community.
Changelog for this version: initial version
# Inverse ROI: 
# 	replaces the current ROI by its inverse.
from icy.main import Icy
from icy.roi import ROI2DRectangle
from icy.roi import ROI2D
from icy.util import ShapeUtil
import sys

seq = Icy.getMainInterface().getFocusedSequence()
img = Icy.getMainInterface().getFocusedImage()

if seq == None:
	sys.exit("No sequence")

# Get current ROI
roi = seq.getSelectedROI2D()

if roi == None:
	sys.exit("No selected ROI")

# Create an ROI of the size of the image
roiImage = ROI2DRectangle(img.getBounds())

# Do the XOR operation
res = ROI2D.merge([roi, roiImage], ShapeUtil.ShapeOperation.XOR)

# Compute inverse by XOR operation

This script has no documentation. A Problem ? ask the community.

Icy script publication Id : W6U7F9