antsImageWrite: Image Write

Description Usage Arguments Value Author(s) See Also Examples

Description

Write an image object of S4 class antsImage to a file.

Usage

1
antsImageWrite(image, filename)

Arguments

image

Image object of S4 class antsImage to be written.

filename

Name of the file to write the image to.

Value

0 – Success
1 – Failure

Author(s)

Shrinidhi KL

See Also

antsImageRead

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
fn <- getANTsRData( "r16" )
fi <- antsImageRead( fn )
antsImageWrite( fi , tempfile( fileext = ".nii.gz" ) )
antsImageWrite( fi , tempfile( fileext = ".mha" ) )
antsImageWrite( fi , tempfile( fileext = ".nrrd" ) )
antsImageWrite( antsImageClone( fi, "unsigned int" ) ,
  tempfile( fileext = ".jpg" )  )
antsImageWrite( antsImageClone( fi, "float" ) ,
  tempfile( fileext = ".tif" )  )
antsImageWrite( fi, tempfile( fileext = ".mrc" )  )
antsImageWrite( fi, tempfile( fileext = ".hd5" )  )
components(fi) = 0L
antsImageWrite( fi, tempfile( fileext = ".nii.gz" )  )
components(fi) = -1L
testthat::expect_error(
antsImageWrite( fi, tempfile( fileext = ".nii.gz" )), "nvalid S4"
)  
testthat::expect_error(
antsImageWrite( "hey"), "not of class antsImage"
) 

muschellij2/atropos documentation built on May 4, 2019, 3:17 p.m.