这个例子应该可以帮助你:
// ROIs are objects of the image display, so get that one first
Image input := GetFrontImage()
ImageDisplay disp = input.ImageGetImageDisplay(0)
// Iterate over all ROIs found on the display
number nRoi = disp.ImageDisplayCountROIs()
for (number i=0; i<nRoi; i++ )
{
ROI myRoi = disp.ImageDisplayGetROI( i )
// Test if the ROI has the properties you want
if ( !myROI.ROIIsRectangle() ) continue
if ( !myROI.ROIGetVolatile() ) continue
// Read the ROI region and use that to copy the data
number t, l, b, r
myROI.ROIGetRectangle( t, l, b, r )
// Use slice2 to address the area and ImageClone to get a clone
// inclusing tags, calibration etc.
image cut := input.Slice2(t,l,0, 0,(r-l),1, 1,(b-t),1 ).ImageClone()
cut.ShowImage()
// Optionally set some names
cut.SetName( input.GetName()+" #"+(i+1) )
// Optionally modify the roi
myRoi.ROISetVolatile( 0 )
myRoi.ROISetMoveable( 0 )
myRoi.ROISetLabel( "cut #"+(i+1) )
}