Nifti read failed?

Hello, every one~
I have a question.

std::string str=“D:\Test2.nii”;
itk::ImageIOBase::Pointer imageIO =
tk::ImageIOFactory::CreateImageIO(str.c_str(), itk::CommonEnums::IOFileMode::ReadMode);

I use ITK 5.1 to read nii file like above code.
But there is an error ==> " imageIO.m_Pointer is nullptr "
How can I do~~~? OTL


Perhaps take a look at RegisterIOFactories example, and register NiftiIO in your code?

I can read the *.nii file !

1 Like