Click or drag to resize

IMcImageCastingSourceRange Property

The source luminance range for pixel value casts during CreateRegionAccess

Namespace:  MediaCy.IQL.Engine
Assembly:  MediaCy.IQL.Engine (in MediaCy.IQL.Engine.dll) Version: 10.0.6912.0
Syntax
VB
Property CastingSourceRange As Object
	Get
	Set

Property Value

Type: Object
Remarks
By default the source luminance range for casting luminances during a CreateRegionAccess (or McFeatures.AccessMaskedImageData) call is RangeMin to RangeMax. However there are some circumstances where you would like to have a different source luminance range to map some luminance range of source pixels onto a larger or smaller range for further computation. CastingSourceRange is always reset to its default value (RangeMin to RangeMax) after any call to CreateRegionAccess or to McFeatures.AccessMaskedImageData. Note that many methods that operate on image data may indirectly call one of these methods, so you need to make an assignment to CastingSourceRange only just before calling CreateRegionAccess. You do not need to change CastingSourceRange just to convert the luminance range of one image AOI to another range in another image, because the ConvertEx method takes source and destination luminance range arguments that will do the job for you. However, if you need to do a more complex image copy that also involves an unusual luminance range cast, then setting the CastingSourceRange before calling CopyToNewImage might be necessary.
Examples
VB
'This example stretches the luminance of pixels under the AOI
'to the full scale RangeMin and RangeMax for the McImage.Type
ThisApplication.ActiveImage.CastingSourceRange = Empty 'reset to defaults
Debug.Print "Default CastingSourceRange is: " _
& GlobalTools.McToText(ActiveImage.CastingSourceRange).Value
'Get a copy of the McImage.Type with default Min/MaxCastingLuminance
Dim mcimagetypeDest As McImageType
Set mcimagetypeDest = ThisApplication.ActiveImage.Type 'Get a copy of the McImage.Type
'Find the absolute luminance range of any channel
Dim arrayFullRange As Variant
ThisApplication.ActiveImage.Histogram.Interpretation = mciAnyInterp
arrayFullRange = ThisApplication.ActiveImage.Histogram.AbsoluteRange
Debug.Print "Full source luminance range is: " & GlobalTools.McToText(arrayFullRange).Value
Dim rangeAnyChannel As DOUBLERANGE
rangeAnyChannel.Start = McMin(McObjectTemp(arrayFullRange).SelectedValues(Empty, 0))
rangeAnyChannel.end = McMax(McObjectTemp(arrayFullRange).SelectedValues(Empty, 1))
Debug.Print "Max source luminance range for any channel is: " _
& GlobalTools.McToText(rangeAnyChannel).Value
'Set the casting source range to the range of luminances in the image AOI
ThisApplication.ActiveImage.CastingSourceRange = rangeAnyChannel
Debug.Print "The CastingSourceRange is now: " & GlobalTools.McToText(ActiveImage.CastingSourceRange).Value
'Get a McRegionAccess of the AOI cast to RangeMin thru RangeMax
Dim regionaccessCast As McRegionAccess
Set regionaccessCast = ThisApplication.ActiveImage.Aoi.AccessMaskedImageData( _
mcimagetypeDest, mcwcAllChannels, McActiveFrame)
'The above will reset the CastingSourceRange to its default
Debug.Print "The CastingSourceRange has been reset to: " _
& GlobalTools.McToText(ActiveImage.CastingSourceRange).Value
'Check the Min and Max luminance values in the block
Dim varBlockOfPixels As Variant, lNinBlock As Long
lNinBlock = regionaccessCast.GetArea(varBlockOfPixels)
vMin = McMin(varBlockOfPixels)
vMax = McMax(varBlockOfPixels)
Debug.Print "Min, Max in the cast block = " & McSprintf("%d, %d", vMin, vMax)
'Mark the regionaccessCast as "dirty", so that a back-cast will be done
regionaccessCast.SignalImageChanged
'Now release the region access to force the back cast into the image.
'Since CastingSourceRange is now the default of RangeMin to RangeMax,
'the back-cast will stretch the luminances under the AOI to this range.
Set regionaccessCast = Nothing
See Also