# Nifti read failed?

**URL:** https://discourse.itk.org/t/nifti-read-failed/3735
**Category:** Beginner Questions
**Tags:** dicom, itk-releases, simpleitk
**Created:** [December 29, 2020, 1:42am UTC](https://discourse.itk.org/t/nifti-read-failed/3735 "2020-12-29T01:42:21Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![jeffppp](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@jeffppp](https://discourse.itk.org/u/jeffppp)
#### Post date: [December 29, 2020, 1:42am UTC](https://discourse.itk.org/t/nifti-read-failed/3735/1 "2020-12-29T01:42:21Z")

</div>

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

Thanks

---

<div class="post-metadata">

### Author: ![dzenanz](https://discourse.itk.org/user_avatar/discourse.itk.org/dzenanz/32/1093_2.png) [@dzenanz](https://discourse.itk.org/u/dzenanz)
#### Post date: [December 29, 2020, 1:55pm UTC](https://discourse.itk.org/t/nifti-read-failed/3735/2 "2020-12-29T13:55:36Z")

</div>

Perhaps take a look at [RegisterIOFactories example](https://itk.org/ITKExamples/src/IO/ImageBase/RegisterIOFactories/Documentation.html), and register NiftiIO in your code?

---

<div class="post-metadata">

### Author: ![jeffppp](https://discourse.itk.org/letter_avatar_proxy/v4/letter/j/ecccb3/32.png) [@jeffppp](https://discourse.itk.org/u/jeffppp)
#### Post date: [December 30, 2020, 3:36am UTC](https://discourse.itk.org/t/nifti-read-failed/3735/3 "2020-12-30T03:36:45Z")

</div>

Thanks.  
I can read the \*.nii file !
