CODE to force an update of the IMAGE HISTOGRAM . . .
2021-03-25-183933
All --
I am using the CODE below to display the IMAGE HISTOGRAM for an IMAGE / ROI.
With Application.Gadgets.ImageHistogram(Nothing) .CheckState = MediaCy.IQL.Application.McCommand.mcCheckState.Checked .Run() End With
The CODE for the APP changes the ROI but the IMAGE HISTOGRAM does not update after the ROI is created by the CODE.
I have used CODE shown below after the ROI is created by the APP to update the IMAGE HISTOGRAM but it does not seem to work while the APP is actively doing something.
'REFRESH THE UI MyControl.Refresh DoEvents 'REFRESH THE IMAGE WINDOW ThisApplication.ActiveWindowEx.Refresh 'REFRESH THE MEASUREMENT DATA ThisApplication.ActiveImage.MeasurementsData.Refresh
Is there CODE that will force the IMAGE HISTOGRAM to update while the APP is executing routines?
Thanks.
-- Matt
0
Answers
In my tests with the macro below, the histogram is updated automatically when ROI is added (histogram window is already opened):
Public Function AddROI() As SimpleScript AddROI = New SimpleScript Dim image1 With Application.RibbonCommands.SelectRibbonTab(AddROI) .TabName = "Select" .Run() End With With Application.DocumentCommands.ActiveImage(AddROI) .Run(image1) End With With [Select].RoiCommands.Add(AddROI) .ROIType = Features.ROI.ROITypes.Rectangle .Points = New System.Collections.Generic.List(Of System.Drawing.PointF) .Points.Add(New System.Drawing.PointF(428F,575F)) .Points.Add(New System.Drawing.PointF(592F,658F)) .Angle = 0R .Run(image1) End With End Function
Please check if that macro will work for you.Regards,
Yuri
Maybe you macro is running fast and the system is too busy for the UI updates.
You can add Wait function to the loop. The following example updates the histogram after every ROI move:
Yuri