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
-
Matt,
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,
Yuri0 -
2021-03-26-142144Yuri --Thank you for looking into this.I don't think your macro is testing the issue that I am seeing.If you make your macro create the ROI on the left side of an image with a GRAY WEDGE from LEFT to RIGHT and then you have your macro slide the ROI across the image, I think you will find that the HISTOGRAM does not update until the macro completes and focus within IMAGE-PRO is returned to the PRIMARY IMAGE-PRO INTERFACE.Thanks-- Matt
0 -
Hi Matt,
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:Public Sub RollingROI Dim sz As Integer=100 Dim im As McImage=ThisApplication.ActiveImage If im Is Nothing Then Exit Sub im.Aoi.Reset For y As Single=0 To im.Height Step sz For x As Single=0 To im.Width Step sz im.Aoi.SetBox(0,x,y,x+sz,y+sz) Wait(0.5) Next Next End Sub
Yuri0 -
2021-03-29-111725Yuri --Thank you for your CODE and your suggestion.There are WAIT commands within the ROUTINE A CODE (that moves the ROI) which is called by ROUTINE B (that does A and other things). If the WAIT is within ROUTINE A but ROUTINE B is still active perhaps IP10 is not updating the HISTOGRAM with the new ROI. I will try to put a short WAIT into ROUTINE B after the call to ROUTINE A to try to give IP10 the chance to catch up.This is an appearance issue only and is not generating a functionality problem so resolving it is polish oriented not performance oriented.Thanks again.-- Matt
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