file = system.file("extdata", "example.nii.gz", package = "RNifti")
img = RNifti::readNifti(file)
magic(img)
magic(img) = "ni1"
stopifnot(magic(img) == "ni1")
magic(img) = "n+1"
stopifnot(magic(img) == "n+1")
magic(img) = "r" # bad magic
stopifnot(magic(img) == "")
Run the code above in your browser using DataLab