Package: python-nifti Version: 0.20070425.1-1~etch.apsy0 Severity: normal
Hi Michael, while you are asleep here is a food for thought for the early morning... well -- subject describes it all. here is the code sample to give more information (read till the end since another issue there as well) import numpy, nifti z = numpy.zeros([3,4,5,6]) ni1 = nifti.NiftiImage(z) ni2 = nifti.NiftiImage(z) ni1.save('/tmp/1.nii.gz') hdr1 = ni1.header hdr2 = ni2.header for item in hdr1.keys(): if not hdr2.has_key(item): print "hdr2 has no " + key else: if `hdr1[item]` != `hdr2[item]`: print "Differ: ", item, hdr1[item], hdr2[item] ni2.updateHeader(hdr2) output of it is $> python showbug.py Differ: vox_offset 352.0 348.0 ** ERROR (nifti_set_filename): failed to set prefix for '' ** ERROR: nifti_convert_nhdr2nim: bad filename Traceback (most recent call last): File "showbug.py", line 58, in ? ni2.updateHeader(hdr2) File "/usr/lib/python2.4/site-packages/nifti/niftiimage.py", line 766, in updateHeader raise RuntimeError, \ RuntimeError: Could not recreate NIfTI image struct from updated header. so we have absent filename and also vox_offset differs in saved and not-saved versions. another issue I encountered is that other nifti files I saw they have 1 in higher dimensions (in dim I mean) and I believe dim[5]==1 has some meaning for something in nifti header format. I could not adjust it via modifying header's dim list -- after saving they all remained 0s. So I guess they simply better be set to 1 whenever we create niftiimage out of numpy array. cheers... sleep well... see you in few weeks ;-) -- System Information: Debian Release: 4.0 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.18-4-amd64 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Versions of packages python-nifti depends on: ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries ii libniftiio0 0.5-3~etch.apsy0 IO libraries for the NIfTI-1 data ii python 2.4.4-2 An interactive high-level object-o ii python-central 0.5.12 register and build utility for Pyt ii python-numpy [python-nu 1:1.0.1-1 Numerical Python adds a fast array ii python-numpy-ext 1:1.0.1-1 Numerical Python adds a fast array ii python-scipy 0.5.2-0.1 scientific tools for Python ii python2.4 2.4.4-3 An interactive high-level object-o python-nifti recommends no packages. -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]