powered by
Creates a .img/.hdr pair of files or a .nii file from a given array
f.write.nifti(mat,file,size,L,nii,path.out=NULL)
Nothing is returned
An array
The name of the file to be written, without .img or .hdr suffix
Specify the format of the .img file. Either "float" (for 4 byte floats) or "int" (2 byte integers) or "char" (1 byte integers).
if NULL, the list is created by the function, else it should be provided. This list contains the header part of a NIFTI image.
should we write only one .nii file or a .hdr/.img pair of files
The path where to write the file (mandatory argument, even if the default value is NULL for backward compatibility)
f.write.array.to.img.8bit, f.write.array.to.img.2bytes, f.write.array.to.img.float f.write.nii.array.to.img.8bit, f.write.nii.array.to.img.2bytes, f.write.nii.array.to.img.float
f.write.array.to.img.8bit
f.write.array.to.img.2bytes
f.write.array.to.img.float
f.write.nii.array.to.img.8bit
f.write.nii.array.to.img.2bytes
f.write.nii.array.to.img.float
a<-array(rnorm(20*30*40*3),dim=c(20,30,40,3)) file<-"temp" tmpdir <- tempdir() f.write.nifti(a,file,size="float",nii=TRUE, path.out = tmpdir) unlink(tmpdir) # tidy up
Run the code above in your browser using DataLab