nifti2_data_format > creating nifti1 images with library v2?
Showing 1-3 of 3 posts
Display:
Results per page:
Mar 2, 2021  02:03 PM | Alle Meije Wink
creating nifti1 images with library v2?
I am using the latest version of the nifti library in my program and when I save images to (nifti-2) files, neither fsl nor mricron (on a Ubuntu Focal system) accept them. The program can read nifti-2 images that it has just saved (putting the bar low), but it would be nice to have an external reference!

Are there any open-source image viewers that already support nifti-2? Or, failing that, is it possible to create nifti-1 images with the nifti-2 library? The only routine that seems available for creating a new nifti image seems to be nifti_simple_init_nim(), which only makes nifti-2.

Many thanks!
Mar 2, 2021  05:03 PM | Jon Clayden - University College London
RE: creating nifti1 images with library v2?
I don't know the details of FSL or mricron's NIfTI-2 support, but it is possible that the issue is with the NIfTI-2 library itself. I ran into problems (link) with producing valid NIfTI-2 files with the library last year, and although that is patched on GitHub I don't think it has propagated to a generally released version yet. If you can, it might be worth dropping in the latest library from GitHub to see if that helps.

Regarding your other question, it is possible to create NIfTI-1 images with the NIfTI-2 library, by setting the nifti_type field to NIFTI_FTYPE_NIFTI1_1 (or NIFTI_FTYPE_NIFTI1_2) before calling nifti_image_write().

I hope that's helpful!
Mar 4, 2021  11:03 PM | Richard Reynolds
RE: creating nifti1 images with library v2?
Hello,

AFNI can handle NIFTI-2 files, though not for every datum (e.g. no 64-bit floats).  And the nifti_tool program (from AFNI or from the NIFTI library) can be used to verify them, too.

If you would like, post the output of:
nifti_tool -disp_hdr -infile MY_NIFTI2.nii

for your image (assuming MY_NIFTI2.nii here)?

- rick