[Nipy-devel] NIFTI1 & Re: AFNI code

Jonathan Taylor jonathan.taylor at stanford.edu
Sat Jul 1 02:47:27 CDT 2006


I add NIFTI-1 support this afternoon -- it's not perfect, of course.

I had some problems with byteswapped dtypes and writing to file -- the 
example I am using (from NIFTI-1's website) is non-native and when I 
call N.nan_to_num on it, it fails.

I tried adding some support for NIFTI-1 intent types, i.e. so the 
following works

---------------------------------


Python 2.4.3 (#2, Apr 27 2006, 14:43:58)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> from neuroimaging.image import Image, intent_types
 >>> from neuroimaging.image import Image
 >>>
 >>> image = 
Image('/home/jtaylo/code/nipy/lib/neuroimaging/tests/data/rho.img')
 >>> intent_types.Correl(image, df=20)
<neuroimaging.image.Image object at 0xb57939bc>
 >>> print image.df, image.intent_code
20.0 2
 >>>
 >>> image = 
Image('/home/jtaylo/code/nipy/lib/neuroimaging/tests/data/zstat1.nii')
 >>> intent_types.TTest(image, df=20)
<neuroimaging.image.Image object at 0xb5793e0c>
 >>> print image.df, image.image.intent_p1
20.0 20.0
 >>>
 >>> image.df = 30
 >>>
 >>> # uses trait delegation when image is NIFTI1
...
 >>> print image.df, image.image.intent_p1
30.0 30.0
 >>>
 >>>
 >>>
 >>> # attributes are changed when intent is changed
...
 >>> image = intent_types.FTest(image, df_denom=20, df_num=30)
 >>> print image.df_denom, image.df_num
20.0 30.0
 >>> print image.df
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'Image' object has no attribute 'df'
 >>>

---------------------------------------------------------
Jarrod Millman wrote:
> I am not sure if it will be of any help, but the imaging tools
> codebase has some code for supporting nifti1 as well:
> https://cirl.berkeley.edu/trac/browser/bic/trunk/imaging-tools/root/imaging/nifti.py 
>

-- 

------------------------------------------------------------------------
Jonathan Taylor                           Tel:   650.723.9230
Dept. of Statistics                       Fax:   650.725.8977
Sequoia Hall, 137                         www-stat.stanford.edu/~jtaylo
390 Serra Mall
Stanford, CA 94305



More information about the Nipy-devel mailing list