--- pynifti-0.20100607.1.orig/TODO
+++ pynifti-0.20100607.1/TODO
@@ -1,3 +1,5 @@
+* Enhance pynifti_pst to do percent signalchange relative to a given volume.
+
 * Implement support for slice timing related NIfTI information.
 
 * Implement support for intent codes.
--- pynifti-0.20100607.1.orig/Makefile
+++ pynifti-0.20100607.1/Makefile
@@ -30,7 +30,8 @@
 
 
 build: build-stamp
-build-stamp: 3rd
+# no 3rd building in Debian
+build-stamp:
 	python setup.py config --noisy
 	python setup.py build_ext
 	python setup.py build_py
--- pynifti-0.20100607.1.orig/setup.py
+++ pynifti-0.20100607.1/setup.py
@@ -21,7 +21,7 @@
 # Common configuration #
 ########################
 
-extra_link_args = ['--Wl,--no-undefined']
+extra_link_args = []
 include_dirs = []
 library_dirs = []
 defines = []
--- pynifti-0.20100607.1.orig/debian/watch
+++ pynifti-0.20100607.1/debian/watch
@@ -0,0 +1,8 @@
+# Compulsory line, this is a version 3 file
+version=3
+
+#http://apsy.gse.uni-magdeburg.de/~hanke/software/pynifti/pynifti_(.*)\.orig\.tar\.gz
+http://sf.net/niftilib pynifti_([\d\.]*)\.tar\.gz
+
+
+
--- pynifti-0.20100607.1.orig/debian/compat
+++ pynifti-0.20100607.1/debian/compat
@@ -0,0 +1 @@
+5
--- pynifti-0.20100607.1.orig/debian/copyright
+++ pynifti-0.20100607.1/debian/copyright
@@ -0,0 +1,55 @@
+Format-Specification: http://wiki.debian.org/Proposals/CopyrightFormat
+Upstream-Name: PyNIfTI
+Upstream-Source: http://niftilib.sourceforge.net
+
+
+Files: *
+Copyright: Copyright 2006-2010, Michael Hanke <michael.hanke@gmail.com>
+License: Expat
+  Permission is hereby granted, free of charge, to any person obtaining a copy
+  of this software and associated documentation files (the "Software"), to deal
+  in the Software without restriction, including without limitation the rights
+  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+  copies of the Software, and to permit persons to whom the Software is
+  furnished to do so, subject to the following conditions:
+
+  The above copyright notice and this permission notice shall be included in
+  all copies or substantial portions of the Software.
+
+  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+  THE SOFTWARE.
+
+
+Files: 3rd/nifticlibs/*
+Copyright: None, the code is placed into the public domain
+License: Other
+  The source tarball contains a partial copy of the NIfTI C libraries. This
+  code is placed into the public domain. Quote from LICENSE file:
+
+  Niftilib has been developed by members of the NIFTI DFWG and volunteers in
+  the neuroimaging community and serves as a reference implementation of the
+  nifti-1 file format.
+
+  http://nifti.nimh.nih.gov/
+
+  Nifticlib code is released into the public domain, developers are encouraged
+  to incorporate niftilib code into their applications, and, to contribute
+  changes and enhancements to niftilib.
+
+  However, the corresponding libraries are available from the nifticlib source
+  package (or rather the binary packages it builds). Therefore this code is
+  not used and the respective packages are used as dependencies. This copy of
+  the nifticlibs code is, however, left in place, as it does not hurt and does
+  not justify repackaging of the upstream sources.
+
+
+Files: debian/*
+Copyright: Copyright 2006-2010, Michael Hanke <michael.hanke@gmail.com>
+License: Expat
+
+
--- pynifti-0.20100607.1.orig/debian/changelog
+++ pynifti-0.20100607.1/debian/changelog
@@ -0,0 +1,251 @@
+pynifti (0.20100607.1-4.4.201403120624) ucs4-0-0-0; urgency=low
+
+  * UCS auto build. No patches were applied to the original source package
+
+ -- Univention builddaemon <buildd@univention.de>  Wed, 12 Mar 2014 06:24:33 +0100
+
+pynifti (0.20100607.1-4) unstable; urgency=low
+
+  * Add upstream bugfix for missing complex64 datatype support (Closes:
+    #629591).
+  * Do not compress objects.inv in Sphinx docs (Closes: #608750).
+
+ -- Michael Hanke <mih@debian.org>  Fri, 09 Sep 2011 13:47:16 +0200
+
+pynifti (0.20100607.1-3) unstable; urgency=low
+
+  * Remove broken --no-undefined linker option for the nifticlib Python
+    extension (Closes: #625049).
+  * Updated uploader email address.
+
+ -- Michael Hanke <mih@debian.org>  Wed, 04 May 2011 12:43:25 -0400
+
+pynifti (0.20100607.1-2) unstable; urgency=low
+
+  * Adjust libnifti-dev build-dependency -- no versioned -dev package
+    available anymore.
+  * Bumped Debian Standards-version to 3.9.0, no changes necessary.
+  * Adjust dependencies from python-numpy-ext to python-numpy
+    (Closes: #589589).
+  * Add patch to prevent type issue with swig-container and lastest NumPy.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Sun, 25 Jul 2010 08:36:23 -0400
+
+pynifti (0.20100607.1-1) unstable; urgency=low
+
+  * New upstream bugfix release.
+  * Switch maintainer to the NeuroDebian team, keep previous uploaders.
+  * Update dates in debian/copyright.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Tue, 06 Jul 2010 12:03:57 -0400
+
+pynifti (0.20100412.1-1) unstable; urgency=low
+
+  * New upstream bugfix release.
+  * Bump Standards-version to 3.8.4.0 -- no changes necessary.
+  * No longer build PDF version of the manual and removing texlive
+    as build-dependency.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Mon, 12 Apr 2010 20:38:25 -0400
+
+pynifti (0.20090303.1-1) unstable; urgency=low
+
+  * New upstream bugfix release (Closes: #517920).
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Tue, 03 Mar 2009 18:35:05 +0100
+
+pynifti (0.20090205.1-1) unstable; urgency=low
+
+  * New upstream version.
+  * Build-depend on swig (>= 1.3.29) for the '-O' switch.
+  * Added 'XS-DM-Upload-Allowed: yes' in debian/control.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Sun, 08 Feb 2009 10:05:19 +0100
+
+pynifti (0.20081017.1-1) unstable; urgency=low
+
+  * New upstream version.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Fri, 17 Oct 2008 14:20:58 +0200
+
+pynifti (0.20080710.1-1) unstable; urgency=low
+
+  * New upstream release (Closes: #490141).
+  * Change email address of Yaroslav Halchenko in uploaders field to
+    'yoh@debian.org'.
+  * Bumped Debian Standards-version to 3.8.0, no changes necessary.
+  * Converted debian/copyright into a machine readable format. 
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Thu, 10 Jul 2008 17:30:22 +0200
+
+pynifti (0.20080630.1-1) unstable; urgency=low
+
+  * New upstream release. Fixed memory leak.
+  * Merged bashism-removal patch with upstream.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Mon, 30 Jun 2008 10:08:58 +0200
+
+pynifti (0.20080624.1-2) unstable; urgency=low
+
+  * Fixed bashism in Makefile.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Wed, 25 Jun 2008 10:22:57 +0200
+
+pynifti (0.20080624.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * Rewrote debian/rules using CDBS (with python-support) and adjusted
+    build-dependencies accordingly..
+  * Build and install documentation in HTML format.
+  * Mention nifticlibs code copy in debian/copyright.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Tue, 24 Jun 2008 21:23:21 +0200
+
+pynifti (0.20070930.1-2) unstable; urgency=low
+
+  * Bumped Debian Standards-version to 3.7.3, no changes necessary.
+  * Modified build-deps for libnifti transition.
+  * Moved package to section 'python'.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Thu, 03 Jan 2008 12:22:14 +0100
+
+pynifti (0.20070930.1-1) unstable; urgency=low
+
+  * New upstream release. Relicense under the MIT license, to be compatible
+    with SciPy license. http://www.opensource.org/licenses/mit-license.php
+  * Updated documentation.
+  * Updated VCS information in debian/control.
+  * Added new-style Homepage field in debian/control.
+  * Updated debian/watch. 
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Wed, 28 Nov 2007 20:46:12 +0100
+
+pynifti (0.20070917.1-1) unstable; urgency=low
+
+  [ Michael Hanke ]
+  * Bugfix: Can now update NIfTI header data when no filename is set
+    (Closes: #442175).
+  * Unloading of image data without a filename set is no checked and prevented
+    as it would damage data integrity and the image data could not be
+    recovered.
+
+  [ Yaroslav Halchenko ]
+  * Added 'pixdim' property.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Mon, 17 Sep 2007 08:32:59 +0200
+
+pynifti (0.20070905.1-1) unstable; urgency=low
+
+  [ Yaroslav Halchenko ]
+  * Fixed a bug in the qform/quaternion handling that caused changes to the
+    qform to vanish when saving to file.
+
+  [ Michael Hanke ]
+  * Added more unit tests.
+  * 'dim' vector in the NIfTI header is now guaranteed to only contain
+    non-zero elements. This caused problems with some applications.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Wed,  5 Sep 2007 20:54:18 +0200
+
+pynifti (0.20070803.1-1) unstable; urgency=low
+
+  * Does not depend on SciPy anymore.
+  * Initial steps towards a unittest suite.
+  * pynifti_pst can now print the peristimulus signal matrix for a single
+    voxel (onsets x time) for easier processing of this information in
+    external applications.
+  * utils.getPeristimulusTimeseries() can now be used to compute mean and
+    variance of the signal (among others).
+  * debian/{copyright|watch} now point to the new home of pynifti in the
+    niftilib project on SourceForge.
+  * pynifti_pst is able to compute more than just the mean peristimulus
+    timeseries (e.g. variance and standard deviation).
+  * Relaxed build-dependency on libniftiio to any SO-version of the library.
+  * Set default image description when saving a file if none is present.
+  * Improved documentation.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Fri,  3 Aug 2007 15:47:26 +0200
+
+pynifti (0.20070425.1-1) unstable; urgency=low
+
+  * Improved documentation. Added note about the special usage of the header
+    property. Also added notes about the relevant properties in the docstring
+    of the corresponding accessor methods.
+  * Added property and accessor methods to access/modify the repetition time
+    of timeseries (dt).
+  * Added functions to manipulate the pixdim values.
+  * Added utils.py with some utility functions.
+  * Added functions/property to determine the bounding box of an image.
+  * Fixed a bug that caused a corrupted sform matrix when converting a NumPy
+    array and a header dictionary into a NIfTI image.
+  * Added script to compute peristimulus timeseries (pynifti_pst).
+  * Package now depends on python-scipy.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Wed, 25 Apr 2007 23:12:22 +0200
+
+pynifti (0.20070315.1-1) unstable; urgency=low
+
+  [ Yaroslav Halchenko ]
+  * Removed functionality for "NiftiImage.save() raises an IOError
+    exception when writing the image file fails."
+
+  [ Michael Hanke ]
+  * Added ability to force a filetype when setting the filename or saving 
+    a file.
+  * Reverse the order of the 'header' and 'load' argument in the NiftiImage
+    constructor. 'header' is now first as it seems to be used more often.
+  * Improved the source code documentation.
+  * Added getScaledData() method to NiftiImage that returns a copy of the data
+    array that is scaled with the slope and intercept stored in the NIfTI
+    header.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Thu, 15 Mar 2007 18:25:52 +0100
+
+pynifti (0.20070301.2-1) unstable; urgency=low
+
+  * Fixed wrong link to the source tarball in README.html. 
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Thu,  1 Mar 2007 22:27:26 +0100
+
+pynifti (0.20070301.1-1) unstable; urgency=low
+
+  [ Michael Hanke ]
+  * Updated build-depends to comply to the latest Python policy.
+  * Initial upload to the Debian archive. (Closes: #413049)
+  * NiftiImage.save() raises an IOError exception when writing the image file
+    fails.
+
+  [ Yaroslav Halchenko ]
+  * Added extent, volextent, and timepoints properties to NiftiImage
+    class.
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Thu,  1 Mar 2007 22:08:15 +0100
+
+pynifti (0.20070220.1-1) unstable; urgency=low
+
+  * NiftiFile class is renamed to NiftiImage.
+  * SWIG-wrapped libniftiio functions are no available in the nifticlib
+    module.
+  * Fixed broken NiftiImage from Numpy array constructor.
+  * Added initial documentation in README.html.
+  * Fulfilled a number of Yarik's wishes ;)
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Tue, 20 Feb 2007 17:36:08 +0100
+
+pynifti (0.20070214.1-1) unstable; urgency=low
+
+  * Does not depend on libfslio anymore.
+  * Up to seven-dimensional dataset are supported (as much as NIfTI can do).
+  * The complete NIfTI header dataset is modifiable.
+  * Most image properties are accessable via class attributes and accessor
+    methods.
+  * Improved documentation (but still a long way to go).
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Wed, 14 Feb 2007 10:11:55 +0100
+
+pynifti (0.20061114-1) unstable; urgency=low
+
+  * Initial release. 
+
+ -- Michael Hanke <michael.hanke@gmail.com>  Tue, 14 Nov 2006 19:36:51 +0100
+
--- pynifti-0.20100607.1.orig/debian/python-nifti.links
+++ pynifti-0.20100607.1/debian/python-nifti.links
@@ -0,0 +1 @@
+usr/share/javascript/jquery/jquery.js usr/share/doc/python-nifti/html/_static/jquery.js
--- pynifti-0.20100607.1.orig/debian/pycompat
+++ pynifti-0.20100607.1/debian/pycompat
@@ -0,0 +1 @@
+2
--- pynifti-0.20100607.1.orig/debian/control
+++ pynifti-0.20100607.1/debian/control
@@ -0,0 +1,21 @@
+Source: pynifti
+Section: python
+Priority: optional
+Maintainer: NeuroDebian Team <team@neuro.debian.net>
+Uploaders: Michael Hanke <mih@debian.org>, Yaroslav Halchenko <debian@onerussian.com>
+Build-Depends: cdbs, debhelper (>= 5.0.38), swig (>= 1.3.29), python-all-dev (>= 2.4), python-support (>= 0.6), python-numpy, libnifti-dev (>> 1.1.0-2), python-sphinx
+Standards-Version: 3.9.2
+Homepage: http://niftilib.sourceforge.net/pynifti/
+Vcs-Browser: http://git.debian.org/?p=pkg-exppsy/pynifti.git
+Vcs-Git: git://git.debian.org/git/pkg-exppsy/pynifti.git
+DM-Upload-Allowed: yes
+
+Package: python-nifti
+Architecture: any
+Depends: ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}, python-numpy, libjs-jquery
+Provides: ${python:Provides}
+XB-Python-Version: ${python:Versions}
+Description: Python interface to the NIfTI I/O libraries
+ Using PyNIfTI one can easily read and write NIfTI and ANALYZE images from
+ within Python. The NiftiImage class provides Python-style access to the full
+ header information. Image data is made available via NumPy arrays.
--- pynifti-0.20100607.1.orig/debian/rules
+++ pynifti-0.20100607.1/debian/rules
@@ -0,0 +1,30 @@
+#!/usr/bin/make -f
+# -*- mode: makefile; coding: utf-8 -*-
+
+include /usr/share/cdbs/1/rules/debhelper.mk
+DEB_PYTHON_SYSTEM = pysupport
+DEB_PYTHON_MODULE_PACKAGE = python-nifti
+include /usr/share/cdbs/1/class/python-distutils.mk
+
+clean::
+	$(MAKE) distclean
+
+build/python-nifti::
+	$(MAKE) unittest
+	$(MAKE) htmldoc
+
+
+# use jquery from Debian package
+# symlinked by debhelper
+install/python-mvpa-doc::
+	-rm build/html/_static/jquery.js
+
+
+# install directly into package directory
+DEB_DESTDIR = $(CURDIR)/debian/python-nifti
+# immediately useable documentation
+# and exemplar data (they are small excerpts anyways)
+DEB_COMPRESS_EXCLUDE := .py .html .css .jpg .txt .js .json .rtc .par .bin objects.inv
+# doc contents
+DEB_INSTALL_DOCS_python-nifti := build/html
+
--- pynifti-0.20100607.1.orig/debian/python-nifti.manpages
+++ pynifti-0.20100607.1/debian/python-nifti.manpages
@@ -0,0 +1 @@
+man/pynifti_pst.1
--- pynifti-0.20100607.1.orig/nifti/clib.i
+++ pynifti-0.20100607.1/nifti/clib.i
@@ -115,38 +115,40 @@
     switch(_img->datatype)
     {
       case NIFTI_TYPE_UINT8:
-          array_type = NPY_UBYTE;
+          array_type = NPY_UINT8;
           break;
       case NIFTI_TYPE_INT8:
-          array_type = NPY_BYTE;
+          array_type = NPY_INT8;
           break;
       case NIFTI_TYPE_UINT16:
-          array_type = NPY_USHORT;
+          array_type = NPY_UINT16;
           break;
       case NIFTI_TYPE_INT16:
-          array_type = NPY_SHORT;
+          array_type = NPY_INT16;
           break;
       case NIFTI_TYPE_UINT32:
-          array_type = NPY_UINT;
+          array_type = NPY_UINT32;
           break;
       case NIFTI_TYPE_INT32:
-          array_type = NPY_INT;
+          array_type = NPY_INT32;
           break;
       case NIFTI_TYPE_UINT64:
+          array_type = NPY_UINT64;
+          break;
       case NIFTI_TYPE_INT64:
-          array_type = NPY_LONG;
+          array_type = NPY_INT64;
           break;
       case NIFTI_TYPE_FLOAT32:
-          array_type = NPY_FLOAT;
+          array_type = NPY_FLOAT32;
           break;
       case NIFTI_TYPE_FLOAT64:
-          array_type = NPY_DOUBLE;
+          array_type = NPY_FLOAT64;
           break;
-      case NIFTI_TYPE_COMPLEX128:
-          array_type = NPY_CFLOAT;
+      case NIFTI_TYPE_COMPLEX64:
+          array_type = NPY_COMPLEX64;
           break;
-      case NIFTI_TYPE_COMPLEX256:
-          array_type = NPY_CDOUBLE;
+      case NIFTI_TYPE_COMPLEX128:
+          array_type = NPY_COMPLEX128;
           break;
       default:
           PyErr_SetString(PyExc_RuntimeError, "Unsupported datatype");
--- pynifti-0.20100607.1.orig/nifti/format.py
+++ pynifti-0.20100607.1/nifti/format.py
@@ -399,7 +399,8 @@
 
         # assign remaining dim vector
         for i in range(7):
-            dim[i+1] = target_dim[i]
+            # cast to prevent type issues with the IntArray swig container
+            dim[i+1] = int(target_dim[i])
 
         # expand dim vector
         self.raw_nimg.ndim = dim[0]
--- pynifti-0.20100607.1.orig/nifti/utils.py
+++ pynifti-0.20100607.1/nifti/utils.py
@@ -31,6 +31,7 @@
                       N.int64 : ncl.NIFTI_TYPE_INT64,
                       N.float32: ncl.NIFTI_TYPE_FLOAT32,
                       N.float64: ncl.NIFTI_TYPE_FLOAT64,
+                      N.complex64: ncl.NIFTI_TYPE_COMPLEX64,
                       N.complex128: ncl.NIFTI_TYPE_COMPLEX128
                     }
 """Mapping of NumPy datatypes to NIfTI datatypes."""
@@ -47,6 +48,7 @@
       ncl.NIFTI_TYPE_INT64: 'i8',
       ncl.NIFTI_TYPE_FLOAT32: 'f4',
       ncl.NIFTI_TYPE_FLOAT64: 'f8',
+      ncl.NIFTI_TYPE_COMPLEX64: 'c8',
       ncl.NIFTI_TYPE_COMPLEX128: 'c16'
     }
 """Mapping of NIfTI to NumPy datatypes (necessary for handling memory
--- pynifti-0.20100607.1.orig/tests/test_fileio.py
+++ pynifti-0.20100607.1/tests/test_fileio.py
@@ -13,6 +13,7 @@
 
 from nifti.image import NiftiImage, MemMappedNiftiImage
 from nifti.format import NiftiFormat
+import nifti.utils
 import nifti.clib as ncl
 import unittest
 import md5
@@ -40,21 +41,23 @@
         self.workdir = tempfile.mkdtemp('pynifti_test')
         self.nimg = NiftiImage(os.path.join('data', 'example4d.nii.gz'))
         self.fp = tempfile.NamedTemporaryFile(suffix='.nii.gz')
+        self.fp_plain = tempfile.NamedTemporaryFile(suffix='.nii')
 
 
     def tearDown(self):
         shutil.rmtree(self.workdir)
         del self.nimg
         self.fp.close()
+        self.fp_plain.close()
 
 
     def testIdempotentLoadSaveCycle(self):
         """ check if file is unchanged by load/save cycle.
         """
         md5_orig = md5sum(os.path.join('data', 'example4d.nii.gz'))
-        self.nimg.save( os.path.join( self.workdir, 'iotest.nii.gz') )
-        nimg2 = NiftiImage( os.path.join( self.workdir, 'iotest.nii.gz'))
-        md5_io =  md5sum( os.path.join( self.workdir, 'iotest.nii.gz') )
+        self.nimg.save(self.fp.name)
+        nimg2 = NiftiImage(self.fp.name)
+        md5_io =  md5sum(self.fp.name)
 
         self.failUnlessEqual(md5_orig, md5_io)
 
@@ -104,19 +107,19 @@
         data = N.arange(24).reshape(2,3,4)
         n = NiftiImage(data)
 
-        n.save(os.path.join(self.workdir, 'scratch.nii'))
+        n.save(self.fp.name)
 
-        n2 = NiftiImage(os.path.join(self.workdir, 'scratch.nii'))
+        n2 = NiftiImage(self.fp.name)
 
         self.failUnless((n2.data == data).all())
 
         # now modify data and store again
         n2.data[:] = n2.data * 2
 
-        n2.save(os.path.join(self.workdir, 'scratch.nii'))
+        n2.save(self.fp.name)
 
         # reopen and check data
-        n3 = NiftiImage(os.path.join(self.workdir, 'scratch.nii'))
+        n3 = NiftiImage(self.fp.name)
 
         self.failUnless((n3.data == data * 2).all())
 
@@ -128,9 +131,9 @@
 
     def testMemoryMapping(self):
         # save as uncompressed file
-        self.nimg.save(os.path.join(self.workdir, 'mmap.nii'))
+        self.nimg.save(self.fp_plain.name)
 
-        nimg_mm = MemMappedNiftiImage(os.path.join(self.workdir, 'mmap.nii'))
+        nimg_mm = MemMappedNiftiImage(self.fp_plain.name)
 
         # make sure we have the same
         self.failUnlessEqual(self.nimg.data[1,12,39,46],
@@ -145,7 +148,7 @@
         self.failUnlessEqual(nimg_mm.data[0,12,30,23], 999)
 
         # now reopen non-mapped and confirm operation
-        nimg_mod = NiftiImage(os.path.join(self.workdir, 'mmap.nii'))
+        nimg_mod = NiftiImage(self.fp_plain.name)
         self.failUnlessEqual(nimg_mod.data[0,12,30,23], 999)
 
         self.failUnlessRaises(RuntimeError, nimg_mm.setFilename, 'someother')
@@ -161,9 +164,8 @@
         self.failUnless( (self.nimg.qform == ident).all() )
 
         # test save/load cycle
-        self.nimg.save( os.path.join( self.workdir, 'qformtest.nii.gz') )
-        nimg2 = NiftiImage( os.path.join( self.workdir,
-                                               'qformtest.nii.gz') )
+        self.nimg.save(self.fp.name)
+        nimg2 = NiftiImage(self.fp.name)
 
         self.failUnless( (self.nimg.qform == nimg2.qform).all() )
 
@@ -173,9 +175,8 @@
         new_qoffset = (10.0, 20.0, 30.0)
         self.nimg.qoffset = new_qoffset
 
-        fname = os.path.join(self.workdir, 'test-qoffset-file.nii.gz')
-        self.nimg.save(fname)
-        nimg2 = NiftiImage(fname)
+        self.nimg.save(self.fp.name)
+        nimg2 = NiftiImage(self.fp.name)
 
         self.failUnless((self.nimg.qform == nimg2.qform).all())
 
@@ -193,9 +194,8 @@
         self.failUnless( (nimg3.qform == qform).all() )
 
         # see whether it survives save/load cycle
-        fname = os.path.join(self.workdir, 'qform_fromfile_test.nii.gz')
-        nimg3.save(fname)
-        nimg4 = NiftiImage(fname)
+        nimg3.save(self.fp.name)
+        nimg4 = NiftiImage(self.fp.name)
 
         # test rotation portion of qform, pixdims appear to be ok
         self.failUnless( (nimg4.qform[:3, :3] == qform[:3, :3]).all() )
@@ -214,9 +214,8 @@
         nimg.qform = ident
         self.failUnless( (nimg.qform == ident).all() )
 
-        fname = os.path.join(self.workdir, 'qform_fromarray_test.nii.gz')
-        nimg.save(fname)
-        nimg2 = NiftiImage(fname)
+        nimg.save(self.fp.name)
+        nimg2 = NiftiImage(self.fp.name)
         # test rotation portion of qform, pixdims appear to be ok
         self.failUnless( (nimg.qform[:3, :3] == nimg2.qform[:3, :3]).all() )
         # test full qform
@@ -269,9 +268,9 @@
         """ check if extensions actually get safed to the file.
         """
         self.nimg.extensions += ('comment', 'fileio')
-        self.nimg.save(os.path.join( self.workdir, 'extensions.nii.gz'))
+        self.nimg.save(self.fp.name)
 
-        nimg2 = NiftiImage(os.path.join(self.workdir, 'extensions.nii.gz'))
+        nimg2 = NiftiImage(self.fp.name)
 
         # should be the last one added
         self.failUnless(nimg2.extensions[-1] == 'fileio')
@@ -297,8 +296,8 @@
             self.failUnless(ext[el] == teststr[:el])
 
         # save/load cycle
-        self.nimg.save(os.path.join( self.workdir, 'ext2.nii.gz'))
-        nimg2 = NiftiImage(os.path.join(self.workdir, 'ext2.nii.gz'))
+        self.nimg.save(self.fp.name)
+        nimg2 = NiftiImage(self.fp.name)
 
         # see what came out of it
         ext2 = nimg2.extensions
@@ -314,21 +313,20 @@
         save/load cycle.
         """
         self.nimg.meta['something'] = 'Gmork'
-        self.nimg.save(os.path.join( self.workdir, 'meta.nii.gz'))
-        nimg2 = NiftiImage(os.path.join(self.workdir, 'meta.nii.gz'),
-                           loadmeta=True)
+        self.nimg.save(self.fp.name)
+        nimg2 = NiftiImage(self.fp.name, loadmeta=True)
 
         self.failUnless(nimg2.meta['something'] == 'Gmork')
 
         # test whether the meta extensions is preserved during a load/safe cycle
         # even when it is not unpickled intermediately
         # by default nothing is unpickled
-        nimg_packed = NiftiImage(os.path.join(self.workdir, 'meta.nii.gz'))
+        nimg_packed = NiftiImage(self.fp.name)
         self.failUnless(len(nimg_packed.meta) == 0)
 
-        nimg_packed.save(os.path.join( self.workdir, 'packed.nii.gz'))
+        nimg_packed.save(self.fp.name)
 
-        nimg_unpacked = NiftiImage(os.path.join(self.workdir, 'packed.nii.gz'))
+        nimg_unpacked = NiftiImage(self.fp.name)
         self.failUnless(nimg2.meta['something'] == 'Gmork')
 
 
@@ -336,8 +334,8 @@
         alt_array = N.zeros((3,4,5,6,7), dtype='int32')
         self.nimg.data = alt_array
 
-        self.nimg.save(os.path.join( self.workdir, 'assign.nii'))
-        nimg2 = NiftiImage(os.path.join(self.workdir, 'assign.nii'))
+        self.nimg.save(self.fp.name)
+        nimg2 = NiftiImage(self.fp.name)
 
 
         self.failUnless(nimg2.header['dim'] == [5, 7, 6, 5, 4, 3, 1, 1])
@@ -369,6 +367,20 @@
         self.failUnlessRaises(UnicodeError, nim.save, fn_pureuni)
 
 
+    def testDTypesSupport(self):
+        """Check load/cycles with all supported dtypes"""
+        for dt in nifti.utils.N2nifti_dtype_map.keys():
+            data = N.ones(65536, dt).reshape(256,256)
+            nim = NiftiImage(data)
+            nim.save(self.fp.name)
+            nim2 = NiftiImage(self.fp.name)
+            self.failUnlessEqual(nim2.data.dtype, dt)
+            self.failUnlessEqual(nim2.header['datatype'],
+                                 nifti.utils.N2nifti_dtype_map[dt])
+            self.failUnless((nim2.data == 1).all())
+
+
+
 def suite():
     return unittest.makeSuite(FileIOTests)
 
--- pynifti-0.20100607.1.orig/man/pynifti_pst.1
+++ pynifti-0.20100607.1/man/pynifti_pst.1
@@ -1,5 +1,5 @@
-.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.38.2.
-.TH PYNIFTI_PST "1" "July 2010" "pynifti_pst 0.20100607.1" "User Commands"
+.\" DO NOT MODIFY THIS FILE!  It was generated by help2man 1.37.1.
+.TH PYNIFTI_PST "1" "April 2010" "pynifti_pst 0.20100412.1" "User Commands"
 .SH NAME
 pynifti_pst \- compute peristimulus timeseries of fMRI data
 .SH SYNOPSIS
