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

Show spatial calibration not working after update to version 10.0.1

After updating Image-Pro from version 10.0 to 10.0.1 a procedure does not work anymore. I use this sub to get the applied spatial calibration from a very large image set (Zeiss czi). A czi image is opened and a calibration is set automatically. If I call this sub an error appears "ActiveX Automation: Object var is 'Nothing'". But imset.Name is working well.

    Public Sub ShowSpatialCalibration()
        MsgBox ThisApplication.ActiveDocument.DisplayName 'working

        Dim imset As McImageSet = ThisApplication.ActiveDocument.Data
        Dim calib As MediaCy.IQL.Calibrations.McSpatialCalib
        calib = imset.SpatialCalibration

        MsgBox imset.Name 'working
        MsgBox calib.Name 'not working anymore
    End Sub

How can I fix this?

Thanks in advance
fsup

Comments

  • Options
    Does the image/image set has spatial calibration?
    If the image doesn't have calibration, calib is Nothing.

    Yuri
  • Options
    Hi Yuri

    yes the image set has a spatial calibration. The same code fragment worked well in version 10.0.0 and also in Image Pro Premier 9.3.


    fsup
  • Options
    Do you have Color Compite option on? When it's off, the active Image is exposed, not ImageSet.

    Yuri

  • Options
    No the Color Composite is not activated.

    fsup
  • Options
    You have to activate Color composite mode to make your macro work. (As you macro explicitly asks for Image set)

    Yuri
  • Options
    Hi Yuri

    I get the same error when I activate the Color Composite mode.

    fsup
  • Options
    Can you please post your image (if it's not too big), so we can check it?

    Yuri

  • Options
    We can reproduce your problem and have identified the cause.  The bug will be fixed in the next patch.  As a workaround, please access the McImageSet.XPhysicalExtent property before accessing the McImageSet.SpatialCalibration property as shown in the revised macro below:

       Public Sub ShowSpatialCalibration()
            Dim imset As McImageSet = ThisApplication.ActiveDocument.Data
            If imset Is Nothing Then Exit Sub
            MsgBox( "Image Set Name: " + imset.Name)
            Dim dX As Double = imset.XPhysicalExtent '<<<< Add this line
            Dim calib As MediaCy.IQL.Calibrations.McSpatialCalib
            calib = imset.SpatialCalibration
            If  calib Is Nothing Then
                MsgBox("Calib is Nothing.")
                Exit Sub
            Else
                MsgBox( "Calibration Name: " + calib.Name)
            End If
        End Sub 'ShowSpatialCalibration


  • Options
    Thats it. Now it works great.
    Thank you for supporting me.

    fsup
Sign In or Register to comment.