replaced writeFileNifti with niftiWrite