Description Usage Arguments Details Value Examples
Read an image file and convert it into an array.
1 2 3 |
filename |
the file name of the image file (including the filename extension). character. REQUIRED. |
format |
the format of the image file. Can be |
na.value |
the value with which NA values are replaced. numeric or NA. |
what |
an object whose mode will give the mode of the vector to be read, or a character vector of length one describing the mode: one of "numeric", "double", "integer", "int", "logical", "complex", "character", "raw". Only active if |
size |
the number of bytes per element in the byte stream. integer. See the documentation of the |
dimensions |
the number of bytes per element in the byte stream. The default, NA_integer_, uses the natural size. Size changing is not supported for raw and complex vectors. Only active if |
SPM |
is a logical variable (default = FALSE) that forces the voxel data values to be rescaled using the funused1 ANALYZE header field. This is an undocumented convention of ANALYZE files processed using the Statistical Parametric Mapping (SPM) software. Only active if |
reorient |
is a logical variable (default = TRUE) that enforces Qform/Sform transformations. Only active if |
flipud |
is a logical variable for vertical flipping of the image (default is TRUE). Only active if |
recover.header |
for analyse files, if only one of the .hdr file and the .img file is compressed, should they be copied to a temporary directory, decompressed and loaded. logical. |
verbose |
should the execution of the function be traced ? logical. |
This function requires to have installed the oro.nifti package to work if argument format is set to "analyze"
or "nifti"
.
It requires to have installed the oro.dicom package to work if argument format is set to dicom.
ARGUMENTS :
filename
argument corresponds to:
the con
argument of the base::readBin
function.
the fname
argument of the oro.nifti::readANALYZE
function. It should be a pathname to .img or .hdr files without the suffix.
the fname
argument of the oro.nifti::readNIfTI
function.
the fname
argument of the oro.dicom::readDICOMFile
function. It should be the file name with suffix.
The what
and dimensions
correspond to the what
and size
argument of the base::readBin
function.
The SPM
corresponds to the SPM
argument of the oro.nifti::readANALYZE
function.
The reorient
corresponds to the reorient
argument of the oro.nifti::readNIfTI
function.
The flipud
corresponds to the flipud
argument of the oro.dicom::readDICOMFile
function.
FUNCTION :
This function is a copy of the readMRI
function of the mritc package. It calls
readANALYZE
of the oro.nifti package to read analyze files,
readNIfTI
of the oro.nifti package to read NIFTI files,
readDICOMFile
of the oro.dicom package to read dicom files
and readBin
of the base package to read rawb.gz.
A nifti
object if format="nifit"
, an anlz
object if format="analyse"
and else an array
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
## load a NIFTI file
path.Pat1 <- system.file(file.path("nifti"), package = "MRIaggr")
nifti.Pat1_TTP_t0 <- readMRI(file.path(path.Pat1, "TTP_t0.nii"))
dim(nifti.Pat1_TTP_t0)
## Not run:
## load an analyse file (example of oro.nifti::readANALYZE)
path.Pat2 <- system.file("anlz", package = "oro.nifti")
analyse.avg <- readMRI(file.path(path.Pat2, "avg152T1.img.gz"))
graphics::image(analyse.avg[,,45,1])
### load a NIFTI file (example of oro.nifti::readNIfTI)
path.Pat3 <- system.file("nifti", package = "oro.nifti")
nifti.ffd <- readMRI(file.path(path.Pat3, "filtered_func_data.nii.gz"))
graphics::image(nifti.ffd[,,10,32])
## load a dicom file (examples of oro.dicom::readDICOMFile)
path.Pat4 <- system.file("dcm", package = "oro.dicom")
dicom.Abdo <- readMRI(file.path(path.Pat4,"Abdo.dcm"))
graphics::image(dicom.Abdo[[2]], col = grey(0:64/64), axes = FALSE, xlab = "", ylab = "",
main = "Abdo.dcm")
## load a rawb.gz file
path.Pat4 <- system.file(file.path("extdata"), package = "mritc")
rawb.Pat4 <- readMRI(file.path(path.Pat4, "t1.rawb.gz"), dimensions = c(91,109,91))
dim(rawb.Pat4)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.