Home Image-Pro Automation (Macros, Apps, Reports)
Options

Get Timepoints

Hello
I'm trying to extract the timepoint values for each frame of a .seq file. From what I can gather from the help files it should be possible using MediaCy.IQL.Sets which I've declared in the references and imports. However when I use the following command I get Object@Nothing

Dim imSet As McImageSet=ThisApplication.ActiveDocument.GetData(GetType(McImageSet),Nothing)

I substituted ActiveDocument for ActiveWindow or ActiveImage but that produces an error, how do extract the timepoint values from this type of file as it doesn't appear to belong to Sets. Any help/pointers appreciated.

Regards

David

Best Answer

  • Options
    edited September 2014 Answer ✓
    Apparently I was testing it in a newer version of Premier. I could reproduce your problem in 9.1.2. The problem is that it doesn't support multi-level object nesting in one line (it will be fixed in new version), so I've modified the macro to avoid that. Please use this one:

        Public Sub PrintFrameTime
            If ThisApplication.ActiveImage Is Nothing Then Exit Sub
            With ThisApplication.ActiveImage
                For i As Integer=0 To .FrameCount-1
                    Dim s As String
                    If TypeOf .Frame(i).Date Is System.DateTime Then
                        Dim d As System.DateTime=.Frame(i).Date
                        s=d.ToLocalTime.ToString("yyyy-MM-dd HH:mm:ss.fff")
                    Else
                        s="no time info"
                    End If
                    Debug.Print String.Format("Frame {0} - Date/Time {1}", i,s)
                Next
            End With
        End Sub
    

    Yuri

Answers

  • Options
    edited September 2014
    David,

    If ActiveDocument.GetData(GetType(McImageSet),Nothing) returns Nothing, then your active document is not an image set, but other type, could be just a sequence, which is McImage type. SEQ files without Z information are opened as McImage (with Z-information as McImageSet).

    You can get frame time using McFrame.Date property. Here is a sample macro (you can test it with CarCrash.seq):
        Public Sub PrintFrameTime
            If ThisApplication.ActiveImage Is Nothing Then Exit Sub
            With ThisApplication.ActiveImage
                For i As Integer=0 To .FrameCount-1
                    Dim d As System.DateTime=.Frame(i).Date.ToLocalTime
                    Debug.Print String.Format("Frame {0} - Date/Time {1}", i,d.ToString("yyyy-MM-dd HH:mm:ss.fff"))
                Next
            End With
        End Sub
    
    Regards,

    Yuri
  • Options
    Hello Yuri
    Tried it, and it throws the error Method 'System.Object.ToLocalTime' not found. I added System Object to the references and imported it but it still throws the error. It happens at the line Dim d

    David
  • Options
    edited September 2014
    It means that the frame doesn't have time. Try testing it with CarCrash.seq.
    Below is the macro that checks Date property for Nothing:
        Public Sub PrintFrameTime
            If ThisApplication.ActiveImage Is Nothing Then Exit Sub
            With ThisApplication.ActiveImage
                For i As Integer=0 To .FrameCount-1
                    Dim s As String
                    If TypeOf .Frame(i).Date Is System.DateTime Then
                        s=.Frame(i).Date.ToLocalTime.ToString("yyyy-MM-dd HH:mm:ss.fff")
                    Else
                        s="no time info"
                    End If
                    Debug.Print String.Format("Frame {0} - Date/Time {1}", i,s)
                Next
            End With
        End Sub
    
    Yuri
  • Options
    Hello Yuri
    I was trying it with CarCrash.seq and its the same error with both versions. The latest version throws the error at s=.Frame

    David
  • Options
    That works

    Thanks

    David
Sign In or Register to comment.