Description Usage Arguments Value Author(s) Examples
Read numpy array to antsImage. This inverts writeANTsImageToNumpy.
1 | readNumpyToANTsImage(fn, img)
|
fn |
input filename (probably a .npy extension) |
img |
reference antsImage in which to put numpy data |
antsImage is output
Avants BB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | img = ANTsR::antsImageRead( ANTsR::getANTsRData( "r16" ) )
ofn = tempfile( fileext=".npy" )
writeANTsImageToNumpy( img, ofn )
img2 = readNumpyToANTsImage( ofn, img )
img = ANTsR::makeImage( c( 5, 6, 7 ) )
writeANTsImageToNumpy( img, ofn )
img3 = readNumpyToANTsImage( ofn, img )
img = antsImageRead( getANTsRData( "mni" ) )
writeANTsImageToNumpy( img, ofn )
img3 = readNumpyToANTsImage( ofn, img )
# # in python
# from PIL import Image
# import numpy as np
# from scipy.misc import toimage
# data = np.load( ofn )
# array = np.reshape( data, [ 182, 218, 182 ] )
# toimage(array[:,111,:]).show()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.