how can a rect list be constructed using Premiere?
'I am trying to formulate an array of rectangles to use as ROI's later in another process. I am unable to find the rect variable type in premiere. what do I have to do? -thanks.
Public Sub Get_Rects()
Dim i,j As Integer
Dim rows As Integer = 11
Dim columns As Integer = 14
Dim wellwidth As Double = 218
Dim wellheight As Double = 222
Dim wellStartX As Double = 23
Dim wellStartY As Double = 286
Dim L, R, T, B As Double
'Dim myRect as rect
'Dim WellRect(154) As Rect
'Dim WellRect(154) As McRegions?
Dim counter As Integer = 0
For i = 0 To rows-1
L = wellStartX + (i*wellwidth)
R = L + wellwidth
'myrect.left = L
'myrect.right = R
For j = 0 To columns-1
T = wellStartY + (j*wellheight)
B = T + wellheight
'myrect.top = T
'myrect.bottom = B
'WellRect(counter)=myRect
'WellRect(counter) = ?
Next j
Next i
End Sub
0
Best Answer
-
Hi thans,
First function returns list of ROIs, the second draws ROIs on the active image:Public Function Get_Well_ROIs As System.Collections.Generic.List(Of System.Drawing.RectangleF) Dim ROIs As New System.Collections.Generic.List(Of System.Drawing.RectangleF) Dim i,j As Integer Dim rows As Integer = 11 Dim columns As Integer = 14 Dim wellwidth As Double = 218 Dim wellheight As Double = 222 Dim wellStartX As Double = 23 Dim wellStartY As Double = 286 Dim l, R, T, B As Double For i = 0 To rows-1 l = wellStartX + (i*wellwidth) R = l + wellwidth For j = 0 To columns-1 T = wellStartY + (j*wellheight) B = T + wellheight ROIs.Add(System.Drawing.RectangleF.FromLTRB(l,T,R,B)) Next j Next i Return ROIs End Function Public Function Well_ROIs() As SimpleScript Well_ROIs = New SimpleScript Dim doc1 With Application.DocumentCommands.Active(Well_ROIs) .Run(doc1) End With With [Select].RoiCommands.DeleteAll(Well_ROIs) .Run(doc1) End With With Automate.ScriptingCommands.CodeCommand(Well_ROIs) If .Run() Then ' User Code Here Dim ROIs As System.Collections.Generic.List(Of System.Drawing.RectangleF) Dim R As System.Drawing.RectangleF ROIs = Get_Well_ROIs For Each R In ROIs With [Select].RoiCommands.Add(Well_ROIs) .Points = New System.Collections.Generic.List(Of System.Drawing.PointF) .Points.Add(New System.Drawing.PointF(R.Left,R.Top)) .Points.Add(New System.Drawing.PointF(R.Right,R.Bottom)) .Angle = 0R .ROIType = Features.ROI.ROITypes.Rectangle .Run(doc1) End With Next End If End With End Function Thanks, Nikita.
0
Answers
-
Hi thans,
I've modified your macro for Premier:Public Function Well_ROIs() As SimpleScript Well_ROIs = New SimpleScript Dim doc1 With Application.DocumentCommands.Active(Well_ROIs) .Run(doc1) End With With [Select].RoiCommands.DeleteAll(Well_ROIs) .Run(doc1) End With With Automate.ScriptingCommands.CodeCommand(Well_ROIs) If .Run() Then ' User Code Here Dim i,j As Integer Dim rows As Integer = 11 Dim columns As Integer = 14 Dim wellwidth As Double = 218 Dim wellheight As Double = 222 Dim wellStartX As Double = 23 Dim wellStartY As Double = 286 Dim L, R, T, B As Double Dim counter As Integer = 0 For i = 0 To rows-1 L = wellStartX + (i*wellwidth) R = L + wellwidth For j = 0 To columns-1 T = wellStartY + (j*wellheight) B = T + wellheight With [Select].RoiCommands.Add(Well_ROIs) .Points = New System.Collections.Generic.List(Of System.Drawing.PointF) .Points.Add(New System.Drawing.PointF(L,T)) .Points.Add(New System.Drawing.PointF(R,B)) .Angle = 0R .ROIType = Features.ROI.ROITypes.Rectangle .Run(doc1) End With Next j Next i End If End With End Function Thanks, Nikita.
0 -
What would the code need to be for "manual" scripting. I'm having a difficult time with the simple script style.0
-
Also, how does the simple script return to me an array of rectangles? it looks like it will make the rectangle as I need it, but how do I get the array filled and returned out of this function to consume in another subroutine?
0 -
If you're using ROIs or even measurements in a multitude of images, you can use the Features Manager to store features (Measurements, ROIs, Line Profiles, etc), and you can even use it to convert from one feature type to another. It is macro recordable so it can make it simpler to handle and the features list can even be loaded from or saved to a file for use over multiple sessions.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