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
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
0
Comments
-
Does the image/image set has spatial calibration?
If the image doesn't have calibration, calib is Nothing.
Yuri0 -
Hi Yuriyes 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.fsup0
-
Do you have Color Compite option on? When it's off, the active Image is exposed, not ImageSet.
Yuri
0 -
No the Color Composite is not activated.fsup0
-
You have to activate Color composite mode to make your macro work. (As you macro explicitly asks for Image set)
Yuri0 -
Hi YuriI get the same error when I activate the Color Composite mode.fsup0
-
Can you please post your image (if it's not too big), so we can check it?
Yuri
0 -
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
0 -
Thats it. Now it works great.
Thank you for supporting me.fsup0
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