ITK——Write a transform to file报错Could not create Transform IO object for writing file

博客主要讲述ITK出现‘there are no registration IO factories’异常的原因,即ITK无法识别要读写的文件格式。读取时内部读者无法接受文件、写入时文件名扩展名不被识别都会引发。还给出解决方法,如在CMake配置中启用IO模块,添加特定头文件和注册工厂等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

问题:exception message :there are no registration IO factories

 原因:

This exception is thrown when ITK does not recognize the fileformat that you are trying to read or write. When reading, ITK recognize file formats by asking a set of internal readers to attempt to read your file. If none of the registered readers accept your file, then the exception above is thrown. When writing, ITK uses the extension of the filename in order to chose the fileformat to be used. Make sure that you use one of the filename extensions recognized by ITK, and that the ImageIO class for that format has been registered.

Enable all the IO modules that you wish to support in your ITK CMake configuration.

链接:https://itk.org/Wiki/ITK/FAQ#NoFactoryException

解决方法:和读取image file类似的处理方法 

1、添加头文件:#include "itkTxtTransformIOFactory.h"

2、添加:itk::TxtTransformIOFactory::RegisterOneFactory();

注意:

保存transform的文件格式不同,添加的头文件不同:HDF5TransformIO, MatlabTransformIO 

参考链接:

https://itk.org/ITKExamples/src/IO/ImageBase/RegisterIOFactories/Documentation.html

https://simpleitk.readthedocs.io/en/master/Documentation/docs/source/IO.html

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值