newMriImageFromFile(fileName, fileType = NULL, volumes = NULL, sparse = FALSE, mask = NULL)
newMriImageMetadataFromFile(fileName, fileType = NULL)
writeMriImageToFile(image, fileName = NULL, fileType = NA, datatype = NULL, overwrite = TRUE)identifyImageFileNames(fileName, fileType = NULL, errorIfMissing = TRUE)
imageFileExists(fileName, fileType = NULL)
removeImageFilesWithName(fileName)
copyImageFiles(from, to, overwrite = FALSE, deleteOriginals = FALSE)
symlinkImageFiles(from, to, overwrite = FALSE, relative = TRUE)
MriImage
object.tractorFileType
option. See Details.SparseArray
object?MriImage
object representing a mask, outside of which the image to be read should be considered to be zero. This can be used to save memory when only a small part of a large image is of interest. IgnoredgetDataTypeByNiftiCode
.writeMriImageToFile
, an error will be raised if there is an existing file and this is set to FALSE.TRUE
, copyImageFiles
performs a move rather than a copy.TRUE
, the path stored in the symlink will be relative (e.g. "../some_dir/some_image.nii"
) rather than absolute (e.g. "/path/to/some_dir/some_image.nii"
).newMriImageFromFile
and newMriImageMetadataFromFile
return the appropriate image or metadata object. imageFileExists
returns TRUE
if an existing file with the specified name exists (all file extensions are checked), and FALSE
otherwise. removeImageFilesWithName
returns the result of unlink
applied to all relevant files. writeMriImageToFile
and identifyImageFileNames
return a list with the following elements, describing the identified or written files:"Nifti"
, "Analyze"
or "Mgh"
). Not returned by writeMriImageToFile
.copyImageFiles
and symlinkImageFiles
are called for their side effects."foo.nii"
AND "foo.img"
), and these functions will produce an error if multiple compatible files exist. Suitable values for fileType
(and the tractorFileType
option, which is used as a default) are ANALYZE
, NIFTI
, NIFTI_PAIR
(the two-file NIfTI format), MGH
, ANALYZE_GZ
, NIFTI_GZ
, NIFTI_PAIR_GZ
and MGH_GZ
. The latter four are gzipped versions of the former four. NIFTI_GZ
is recommended unless there is a need for one of the others. This is the default value for the tractorFileType
option, but that can be changed using a call to options
, or by setting the TRACTOR_FILETYPE
environment variable before loading the tractor.base package.
Since multiple files may be involved, copying, moving or symlinking images is not trivial. copyImageFiles
and symlinkImageFiles
are wrappers around the standard functions file.copy
and file.symlink
which handle this complexity.
J.D. Clayden, S. Muñoz Maniega, A.J. Storkey, M.D. King, M.E. Bastin & C.A. Clark (2011). TractoR: Magnetic resonance imaging and tractography with R. Journal of Statistical Software 44(8):1-18.
MriImage
, MriImageMetadata
, getDataTypeByNiftiCode
and unlink
.