我正在使用 simpleITK (python) 执行图像配准 ImageRegistrationMethod.Execute()
。目的是收集图像注册过程的一些统计信息(例如找出何时成功和何时失败),因此我ImageRegistrationMethod
用不同的初始转换初始化实例,包括不会导致注册成功的那些。在执行时,simpleITK 有时会抛出异常,这很好,因为我可以捕捉到它。但有时我会在 stderr 中收到这样的警告
WARNING: In /mnt/emptyplaceholder/projects/elastix/build/ITK-prefix/include/ITK-4.12/itkObjectToObjectMetric.hxx, line 529
Self (0x3a0af70): No valid points were found during metric evaluation. For image metrics, verify that the images overlap appropriately. For instance, you can align the image centers by translation. For point-set metrics, verify that the fixed points, once transformed into the virtual domain space, actually lie within the virtual domain.
或这个
WARNING: In /mnt/emptyplaceholder/projects/elastix/build/ITK-prefix/include/ITK-4.12/itkCorrelationImageToImageMetricv4HelperThreader.hxx, line 85
CorrelationImageToImageMetricv4HelperThreader (0x3a01370): collected only zero points
但注册继续进行。
问题是当注册完全顺利时,我如何区分(从 python)实例与带有警告的这种情况。一个简单而愚蠢的选择是监控标准错误,但也许有一些 ITK 功能来报告这些事件?