How do I get a list of the available SPATIAL CALIBRATIONS?
All --
I would like to create a DROP DOWN MENU within a PREMIER APPLICATION so the user can select the SPATIAL CALIBRATION that will be applied to each image as it is analyzed.
I have the following code which applies a SPATIAL CALIBRATION based on its name.
-------------------------------------------
-------------------------------------------
I do not see a way to get a list of the SPATIAL CALIBRATIONS though.
I do see
Image-Pro Premier Automation Help
GetFilteredList Method (IncludeFlags, ExcludeFlags)
Can a PREMIER GURU please provide a mechanism to get a list of the available SPATIAL CALIBRATIONS appropriate for this challenge?
Thanks.
-- Matt
I would like to create a DROP DOWN MENU within a PREMIER APPLICATION so the user can select the SPATIAL CALIBRATION that will be applied to each image as it is analyzed.
I have the following code which applies a SPATIAL CALIBRATION based on its name.
-------------------------------------------
Public Sub ApplySelectedCalibration Dim var1 = "10x/0.30 DRY + 1.0 X", spcal1 With Measure.Calibration.SpatialCommands.Define(Nothing) .Run(var1, spcal1) End With With Measure.Calibration.SpatialCommands.SetActive(Nothing) .FilterInput = True .Run(spcal1) End With End Sub
-------------------------------------------
I do not see a way to get a list of the SPATIAL CALIBRATIONS though.
I do see
Image-Pro Premier Automation Help
GetFilteredList Method (IncludeFlags, ExcludeFlags)
Automation
Reference ► MediaCy.IQL.Calibrations ► IMcSpatialCalibs ►
GetFilteredList(mccfCalibFlags, mccfCalibFlags)
which contains the example code
but I cannot resolve the syntax errors that appear when I paste this into a PREMIER MODULE.which contains the example code
' Get a collection of all reference calibrations Set newList = SpatialCalibs.GetFilteredList(mccfIsReference, 0) ' Get a collection of all calibrations that are NOT derived calibrations Set newList = SpatialCalibs.GetFilteredList(0, mccfWasDerived)
Can a PREMIER GURU please provide a mechanism to get a list of the available SPATIAL CALIBRATIONS appropriate for this challenge?
Thanks.
-- Matt
0
Best Answer
-
Hi Matt,Some code in the examples is old designed for VB6 and IQBase. We are working on converting them to new syntax, but you can also convert them manually using some simple rules: if you see "Set" in the examples, then you just should remove it. If some object variables are not defined, add ThisApplication in front of it. The new syntax is more strict, so all variables must be defined and full enum syntax is used. The code should look like:
' Get a collection of all reference calibrations Dim newList newList = ThisApplication.SpatialCalibs.GetFilteredList(MediaCy.IQL.Calibrations.mccfCalibFlags.mccfIsReference, 0)
Here is the macro that will print all spatial calibrations:Public Sub PrintAllSpatialCalibrations Dim calibs As MediaCy.IQL.Calibrations.McSpatialCalibs=ThisApplication.Engine.SpatialCalibs For Each cal As MediaCy.IQL.Calibrations.McSpatialCalib In calibs Debug.Print cal.Name & " PixelSize = " & cal.PixelSizeX.ToString Next End Sub
Regards,Yuri0
Answers
-
Yuri --
Thank you for your prompt response.
The information about the HELP FILE EXAMPLE CODE is helpful and the example macro you provided shows the technology perfectly.
I've integrated your code into my code and produced the following two macros.
The first macro is a modification of the LOAD routine within a PREMIER APP. Your code has been integrated in to populate the COMBOBOX1 control
The second macro is a routine that will be called when it is appropriate to calibrate the active image according to the user's setting of the COMBOBOX1 control.
Thanks again.
-- Matt
--------------------------------Private Sub MyControl_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyControl.Load ' Initialization code goes here 'Clear the combobox comboBox1.Items.Clear 'Connect with the spatial calibrations Dim calibs As MediaCy.IQL.Calibrations.McSpatialCalibs=ThisApplication.Engine.SpatialCalibs 'Loop through all the available spatial calibrations For Each cal As MediaCy.IQL.Calibrations.McSpatialCalib In calibs 'Add the current spatial spatial calibration to the combobox comboBox1.Items.Add(cal.Name) Next 'Select the first spatial calibration comboBox1.SelectedIndex = 0 End Sub
--------------------------------Public Sub ApplyCalibrationFromCombobox 'Declare local variables Dim var1, spcal1 'Set var1 according to combobox1 var1 = combobox1.SelectedItem.ToString 'Select, activate, and apply the appropriate calibration based upon its name from combobox1 With Measure.Calibration.SpatialCommands.Define(Nothing) .Run(var1, spcal1) End With With Measure.Calibration.SpatialCommands.SetActive(Nothing) .FilterInput = True .Run(spcal1) End With With Measure.Calibration.SpatialCommands.Apply(Nothing) .Run(ThisApplication.ActiveImage, spcal1) End With End Sub
--------------------------------
0
Categories
- All Categories
- 961 Image-Pro v9 and higher
- 9 Image-Pro FAQs
- 18 Image-Pro Download & Install
- 448 Image-Pro General Discussions
- 486 Image-Pro Automation (Macros, Apps, Reports)
- 20 AutoQuant Deconvolution
- 2 AutoQuant Download & Install
- 18 AutoQuant General Discussions
- 195 Image-Pro Plus v7 and lower
- 3 Image-Pro Plus Download & Install
- 106 Image-Pro Plus General Discussions
- 86 Image-Pro Plus Automation with Macros
- 19 Legacy Products
- 16 Image-Pro Premier 3D General Discussions
- 26 Image-Pro Insight General Discussions