VB said:
With myTempImage
.Aoi.SetBox(-1, 50, 50, 150, 150)
Dim mcregionsT As New McRegions
mcregionsT = IQL.McApplication.CreateOperator("McRegions",
myTempImage)
mcregionsT.Threshold.Execute()
mcregionsT.CleanUpBordersAndNoise(.Aoi,
mcRegionBorders.mcrbAllBorders, 25)
.PointFeatures.CopyFrom(mcregionsT.mpRgnCentroidAsPoint.value)
mcregionsT = Nothing
.SaveAs("C:/temp/CentroidSoy.tif")
End With
I get the error at the line: IQL.McApplication.CreateOperator
VBUser
:
mcregionsT = IQL.McApplication.CreateOperator("McRegions", myTempImage)
Where do you define an instance of IQL? Since you are trying to do an
operation against a member of IQL (McApplication in this case) somewhere
you have to create an instance of IQL (most likely using new statement)
What you have would be fine if CreateOperator was marked as "shared"
which is is not, hence the error message.
Dim mcregionsT As New McRegions
This is an error. What you are doing is creating a new instance of
McRegions. Then the very next statement you lose that instance and
point to another new instance that is returned by IQL.McAppliction.....
Instead do:
Dim mcregionsT as McRegions
This makes a pointer that will point to an McRegions object but doesn't
just yet. Your next line then have mcregionsT point to the object.
Chris