[ITK] confused about itk io factory

谢玮宜 weiehome at sina.com
Tue Mar 22 04:14:41 EDT 2016


Dear ITK experts,

I recently have some problems with using ITK ImageIO factory functions. 
When I tried to use ObjectFactoryBase::CreateInstance(const char
*itkclassname) with itkclassname like itkPNGImageIO, it is not working. The
purpose is to create an image io instance by classname using RTTI. 
I did debug into the code and then I found itkclassname has to be
itkImageIOBase, then it will create always the first ImageIO instance in
override map. I got really confused what is the purpose of this API
"CreateInstance(classname)".

I also print out all registered ImageIO factories and I found gdcmImageIO is
in it. So what is the purpose that in example of dicom images reading and
write, everytime we have to manually call reader->setImageio(
gdcmIO::New())?
As I understood, if an imageIO is registered already, the reader will
automatically check when it is reading a file to see if the format is
supported by an underlying IO.

Please correct me. I think I somehow got seriously wrong with the underlying
concept of itk IO mechanism. 
Thank you all in advance!

BR,xie




More information about the Community mailing list