IMcRegionAccessSetRegionMaskOffset Method
|
|
Sets the current RegionMask offset values
Namespace:
MediaCy.IQL.Engine
Assembly:
MediaCy.IQL.Engine (in MediaCy.IQL.Engine.dll) Version: 10.0.6912.0
SyntaxSub SetRegionMaskOffset (
lOffsetX As Integer,
lOffsetY As Integer
)
Parameters
- lOffsetX
- Type: SystemInt32
long : The new X offset value. - lOffsetY
- Type: SystemInt32
long : The new Y offset value.
RemarksThe RegionMask Offset is the positive X,Y offset from the origin of the
coordinates in the RegionMask property from this IMcRegionAccess.Image origin.
It will almost always be zero for both X and Y for a RegionMask property that is
assigned from an McRegions instance with the same parent image as the image
backing this IMcRegionAccess.
The masked region of this image is computed by subtracting the RegionMask Offset
from the coordinates gotten from the RegionMask.
Note |
---|
The RegionMaskOffset is always set to zero when any assignment is made
to the RegionMask property, so if must call SetRegionMaskOffset after assigning
your RegionMask property. |
Examples
Sub CopyAoiPixelsToCenterOfNewImage()
ThisApplication.Images.Open( ThisApplication.Path(mcPathType.mcptSampleImages) + "Count And Size\NUCSTAIN.TIF")
ThisApplication.ActiveImage.Aoi.SetEllipse(-1,200,200,160,110,55)
Dim srcImage As MediaCy.IQL.Engine.McImage = ThisApplication.ActiveImage
Dim srcRA As MediaCy.IQL.Engine.McRegionAccess = srcImage.Aoi.AccessMaskedImageData
Dim lW, lH, lAoiW, lAoiH As Integer
lAoiW = srcRA.Width
lAoiH = srcRA.Height
lW = lAoiW * 2
lH = lAoiH * 2
Dim newImg As MediaCy.IQL.Engine.McImage
newImg = ThisApplication.Images.Add("MyAoiCopy", lW, lH, 1, srcImage.Type)
Dim lLeft, lTop, lRight, lBottom As Integer
srcImage.Aoi.GetBounds lLeft, lTop, lRight, lBottom
Dim lDstLeft As Integer = (lW - lAoiW) / 2
Dim lDstTop As Integer = (lH - lAoiH) / 2
Dim lDstRight As Integer = lDstLeft + lAoiW -1
Dim lDstBottom As Integer = lDstTop + lAoiH -1
Dim destRA As MediaCy.IQL.Engine.McRegionAccess = newImg.CreateRegionAccess(newImg.Type,-1,0,lDstLeft,lDstTop,lDstRight,lDstBottom)
destRA.RegionMask = srcImage.Aoi
Dim lAoiOffsetLeft As Integer = lLeft - lDstLeft
Dim lAoiOffsetTop As Integer = lTop - lDstTop
destRA.SetRegionMaskOffset lAoiOffsetLeft, lAoiOffsetTop
srcRA.FastAccess = True
Dim objArea As Object
srcRA.GetArea objArea
destRA.PutArea objArea
MsgBox("Pixels from under the ROI in the source image are shown centered in the new image. OK closes both images.",,"CopyAoiPixelsToCenterOfNewImage")
srcImage.Close
newImg.Modified = False
newImg.Close
End Sub
See Also