IMcImage2CreateRegionAccess2 Method |
![]() |
Namespace: MediaCy.IQL.Engine
Function CreateRegionAccess2 ( <OptionalAttribute> Type As Object, Optional Channel As Integer = -1, Optional Frame As Integer = -2, <OptionalAttribute> RegionRect As Object, <OptionalAttribute> SizeRatioXY As Object, <OutAttribute> Optional ByRef MemoryUsageLimitPcnt As Double = 0, Optional AccessModeFlags As mcRegionAccessMode = mcRegionAccessMode.mcramReadWrite ) As IMcRegionAccess2
Imports MediaCy.IQL.Operators Public Module McRegionAccess_Examples Public Sub McRegionAccessCopy() If ThisApplication.ActiveImage Is Nothing Then 'load demo image Dim imgDemo As McImage imgDemo = ThisApplication.Images.Open( ThisApplication.Path(mcPathType.mcptSampleImages) + "Count And Size\Spots.tif") imgDemo.Aoi.SetEllipse( -1, 120,120,100,80) 'set an Aoi End If 'Copy the pixels within the ActiveImage.Aoi to a new image, having 'the same size as the bounds as the ActiveImage.Aoi Dim srcImage As McImage = ThisApplication.ActiveImage 'get src McRegionAccess for bounds of Aoi Dim srcRA As McRegionAccess srcRA = srcImage.Aoi.AccessMaskedImageData 'create destination image of correct size Dim lW, lH As Integer lW = srcRA.Width lH = srcRA.Height Dim newImg As McImage newImg = ThisApplication.Images.Add("MyAoiCopy", lW, lH, 1, srcImage.Type, mcImageCreateFlags.mcicfNoInit) 'get destination McRegionAccess Dim destRA As McRegionAccess destRA = newImg.CreateRegionAccess 'use src Aoi as destination RegionMask destRA.RegionMask = srcImage.Aoi 'Adjust RegionMask registration offset Dim lLeft As Integer, lTop As Integer, lRight As Integer, lBottom As Integer srcImage.Aoi.GetBounds lLeft, lTop, lRight, lBottom destRA.SetRegionMaskOffset lLeft, lTop 'Above, RegionMaskOffset is set so that the Left,Top of the 'srcImage.Aoi maps onto 0,0 of the destination image 'In this example, src should use FastAccess if possible srcRA.FastAccess = True ' this will not interfere with the destRA.PutArea 'region masking, because the src image is different than the dest 'Copy block of pixels from src to dest Dim varArea As Object srcRA.GetArea varArea 'get block of src pixels destRA.PutArea varArea 'put the block, doing region masking End Sub 'McRegionAccessCopy ''example demonstrates using of McRegionAccess.GetArea/PutArea method ''on multi-frame images ''the main code is located in frmMosaic.frm ''the demo creates a mosaic image of a sequence and allows navigating through ''sequence by clicking on frame of interest 'Sub MosaicDemo() ' 'load demo image ' Images.Open (Path & "Images\Heart.seq") ' 'open Mosaic form as modeless dialog ' frmMosaic.Show False 'End Sub ' End Module 'McRegionAccess_Examples