[med-svn] [Git][med-team/nipy][master] 2 commits: initialize changelog.

Étienne Mollier (@emollier) gitlab at salsa.debian.org
Sat Feb 4 14:09:59 GMT 2023



Étienne Mollier pushed to branch master at Debian Med / nipy


Commits:
01de33f4 by Étienne Mollier at 2023-02-04T15:07:28+01:00
initialize changelog.

- - - - -
12a4fbea by Étienne Mollier at 2023-02-04T15:07:44+01:00
nibabel5.0.0.patch: update following review upstream

Thanks: Chris Markiewicz and Yaroslav Halchenko

- - - - -


2 changed files:

- debian/changelog
- debian/patches/nibabel5.0.0.patch


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,11 @@
+nipy (0.5.0-8) UNRELEASED; urgency=medium
+
+  [ Yaroslav Halchenko ]
+  * removed myself and Michael since we have not attended to this package for
+    awhile
+
+ -- Étienne Mollier <emollier at debian.org>  Sat, 04 Feb 2023 15:07:02 +0100
+
 nipy (0.5.0-7) unstable; urgency=medium
 
   * Team upload.


=====================================
debian/patches/nibabel5.0.0.patch
=====================================
@@ -1,9 +1,11 @@
 Description: port py3k calls to nibabel 5.0.0
  The nibabel.py3k module doesn't exist anymore.  numpy.compat.py3k is fetched
- directly instead.
+ directly instead.  A number of Nifti1Image class instantiations also need
+ adjustment, since masks of int64 or uint64 are not tolerated implicitly
+ anymore.
 Author: Étienne Mollier <emollier at debian.org>
 Bug-Debian: https://bugs.debian.org/1030138
-Forwarded: no
+Forwarded: https://github.com/nipy/nipy/pull/498
 Last-Update: 2023-01-31
 ---
 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
@@ -68,7 +70,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
      assert_false(is_xyz_affable(img4_r))
      assert_raises(AxesError, xyz_affine, img4_r)
 -    nimg = nib.Nifti1Image(arr, aff)
-+    nimg = nib.Nifti1Image(arr, aff, dtype=arr.dtype)
++    nimg = nib.Nifti1Image(arr.astype('float'), aff)
      assert_true(is_xyz_affable(nimg))
      assert_array_equal(xyz_affine(nimg), aff)
      # Any dimensions not spatial, AxesError
@@ -77,109 +79,80 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
      assert_equal(img.coordmap, img_t0_r.coordmap)
      # Test against nibabel image
 -    nimg = nib.Nifti1Image(arr, np.diag([2,3,4,1]))
-+    nimg = nib.Nifti1Image(arr, np.diag([2,3,4,1]), dtype=arr.dtype)
++    nimg = nib.Nifti1Image(arr.astype('float'), np.diag([2,3,4,1]))
      nimg_r = as_xyz_image(nimg)
      assert_true(nimg is nimg_r)
      # It's sometimes impossible to make an xyz affable image
 --- nipy.orig/nipy/labs/spatial_models/tests/test_discrete_domain.py
 +++ nipy/nipy/labs/spatial_models/tests/test_discrete_domain.py
-@@ -130,7 +130,7 @@
-     toto = np.ones(shape[:3])
-     affine = np.random.randn(4, 4)
-     affine[3:, 0:3] = 0
--    nim = Nifti1Image(toto, affine)
-+    nim = Nifti1Image(toto, affine, dtype=toto.dtype)
-     ddom = domain_from_image(nim)
-     ref = np.sum(toto) * np.absolute(np.linalg.det(affine))
-     assert_almost_equal(np.sum(ddom.local_volume), ref)
-@@ -142,8 +142,8 @@
+@@ -142,7 +142,7 @@
      mask = np.random.randn(*shape[:3]) > .5
      noise = np.random.randn(*shape[:3])
      affine = np.eye(4)
 -    mim = Nifti1Image(mask.astype('u8'), affine)
--    nim = Nifti1Image(noise, affine)
-+    mim = Nifti1Image(mask.astype('u8'), affine, dtype=mask.astype('u8').dtype)
-+    nim = Nifti1Image(noise, affine, dtype=noise.dtype)
++    mim = Nifti1Image(mask.astype('u1'), affine)
+     nim = Nifti1Image(noise, affine)
      ddom = grid_domain_from_image(mim)
      ddom.make_feature_from_image(nim, 'noise')
-     assert_almost_equal(ddom.features['noise'], noise[mask])
-@@ -163,7 +163,7 @@
-     toto = np.ones(shape[:3])
-     affine = np.random.randn(4, 4)
-     affine[3:, 0:3] = 0
--    nim = Nifti1Image(toto, affine)
-+    nim = Nifti1Image(toto, affine, dtype=toto.dtype)
-     ddom = grid_domain_from_image(nim)
-     ref = np.sum(toto) * np.absolute(np.linalg.det(affine[:3, 0:3]))
-     assert_almost_equal(np.sum(ddom.local_volume), ref)
 --- nipy.orig/nipy/labs/spatial_models/tests/test_mroi.py
 +++ nipy/nipy/labs/spatial_models/tests/test_mroi.py
-@@ -205,8 +205,10 @@
+@@ -205,8 +205,8 @@
      # Test example runs correctly
      eg_img = pjoin(dirname(__file__), 'some_blobs.nii')
      nim = load(eg_img)
 -    mask_image = Nifti1Image((nim.get_data() ** 2 > 0).astype('u8'),
 -                             get_affine(nim))
 +    arr = nim.get_data() ** 2 > 0
-+    mask_image = Nifti1Image(arr.astype('u8'),
-+                             get_affine(nim),
-+                             dtype=arr.astype('u8').dtype)
++    mask_image = Nifti1Image(arr.astype('u1'), get_affine(nim))
      domain = grid_domain_from_image(mask_image)
      data = nim.get_data()
      values = data[data != 0]
 --- nipy.orig/nipy/labs/spatial_models/tests/test_parcel_io.py
 +++ nipy/nipy/labs/spatial_models/tests/test_parcel_io.py
-@@ -17,7 +17,9 @@
+@@ -17,7 +17,7 @@
      """
      n_parcels = 20
      shape = (10, 10, 10)
 -    mask_image = Nifti1Image(np.ones(shape), np.eye(4))
-+    mask_image = Nifti1Image(np.ones(shape),
-+                             np.eye(4),
-+                             dtype=np.ones(shape).dtype)
++    mask_image = Nifti1Image(np.ones(shape).astype('u1'), np.eye(4))
      wim = mask_parcellation(mask_image, n_parcels)
      assert_equal(np.unique(wim.get_data()), np.arange(n_parcels))
  
-@@ -33,8 +35,10 @@
+@@ -33,8 +33,8 @@
      with InTemporaryDirectory():
          for subject in range(n_subjects):
              path = 'mask%s.nii' % subject
 -            save(Nifti1Image((rng.rand(*shape) > .1).astype('u8'),
 -                             np.eye(4)), path)
 +            arr = rng.rand(*shape) > .1
-+            save(Nifti1Image(arr.astype('u8'), np.eye(4),
-+                             dtype=arr.astype('u8').dtype),
-+                 path)
++            save(Nifti1Image(arr.astype('u1'), np.eye(4)), path)
              mask_images.append(path)
  
          wim = mask_parcellation(mask_images, n_parcels)
-@@ -47,7 +51,8 @@
+@@ -47,7 +47,7 @@
      # Generate an image
      shape = (10, 10, 10)
      n_parcel, nn, mu = 10, 6, 1.
 -    mask_image = Nifti1Image(np.ones(shape), np.eye(4))
-+    mask_image = Nifti1Image(np.ones(shape), np.eye(4),
-+                             dtype=np.ones(shape).dtype)
++    mask_image = Nifti1Image(np.ones(shape).astype('u1'), np.eye(4))
      with InTemporaryDirectory() as dir_context:
          surrogate_3d_dataset(mask=mask_image, out_image_file='image.nii')
  
-@@ -67,7 +72,8 @@
+@@ -67,7 +67,7 @@
      shape = (10, 10, 10)
      n_parcel, nn, mu = 10, 6, 1.
      method = 'ward'
 -    mask_image = Nifti1Image(np.ones(shape), np.eye(4))
-+    mask_image = Nifti1Image(np.ones(shape), np.eye(4),
-+                             dtype=np.ones(shape).dtype)
++    mask_image = Nifti1Image(np.ones(shape).astype('u1'), np.eye(4))
  
      with InTemporaryDirectory() as dir_context:
          data_image = ['image_%d.nii' % i for i in range(5)]
-@@ -88,7 +94,8 @@
+@@ -88,7 +88,7 @@
      shape = (10, 10, 10)
      n_parcel, nn, mu = 10, 6, 1.
      method = 'ward'
 -    mask_image = Nifti1Image(np.ones(shape), np.eye(4))
-+    mask_image = Nifti1Image(np.ones(shape), np.eye(4),
-+                             dtype=np.ones(shape).dtype)
++    mask_image = Nifti1Image(np.ones(shape).astype('u1'), np.eye(4))
      with InTemporaryDirectory() as dir_context:
          surrogate_3d_dataset(n_subj=10, mask=mask_image, 
                               out_image_file='image.nii')    
@@ -190,47 +163,36 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
  
  >>> import nibabel as nib
 ->>> nimg = nib.Nifti1Image(data, affine)
-+>>> nimg = nib.Nifti1Image(data, affine, dtype=data.dtype)
++>>> nimg = nib.Nifti1Image(data.astype('float'), affine)
  >>> xyz_affine(nimg)
  array([[ 2.,  0.,  0.,  0.],
         [ 0.,  3.,  0.,  0.],
-@@ -132,7 +132,7 @@
-     Nibabel images always have xyz affines
- 
-     >>> import nibabel as nib
--    >>> nimg = nib.Nifti1Image(arr, np.diag([2,3,4,1]))
-+    >>> nimg = nib.Nifti1Image(arr, np.diag([2,3,4,1]), dtype=arr.dtype)
-     >>> xyz_affine(nimg)
-     array([[ 2.,  0.,  0.,  0.],
-            [ 0.,  3.,  0.,  0.],
 @@ -195,7 +195,7 @@
      Nibabel images always have xyz affines
  
      >>> import nibabel as nib
 -    >>> nimg = nib.Nifti1Image(arr, np.diag([2,3,4,1]))
-+    >>> nimg = nib.Nifti1Image(arr, np.diag([2,3,4,1]), dtype=arr.dtype)
++    >>> nimg = nib.Nifti1Image(arr.astype('float'), np.diag([2,3,4,1]))
      >>> is_xyz_affable(nimg)
      True
      """
 --- nipy.orig/nipy/labs/spatial_models/parcel_io.py
 +++ nipy/nipy/labs/spatial_models/parcel_io.py
-@@ -54,7 +54,8 @@
+@@ -53,7 +53,7 @@
+     else:
          # mask_images should be a list
          mask_data = intersect_masks(mask_images, threshold=0) > 0
-         mask = Nifti1Image(mask_data.astype('u8'),
--                           get_affine(load(mask_images[0])))
-+                           get_affine(load(mask_images[0])),
-+                           dtype=mask_data.astype('u8').dtype)
+-        mask = Nifti1Image(mask_data.astype('u8'),
++        mask = Nifti1Image(mask_data.astype('u1'),
+                            get_affine(load(mask_images[0])))
  
      domain = grid_domain_from_image(mask)
-     cent, labels, J = kmeans(domain.coord, nb_parcel)
-@@ -100,7 +101,8 @@
+@@ -99,7 +99,7 @@
+     else:
          # mask_images should be a list
          grp_mask = intersect_masks(mask_images, threshold=ths) > 0
-         mask = Nifti1Image(grp_mask.astype('u8'),
--                           get_affine(load(mask_images[0])))
-+                           get_affine(load(mask_images[0])),
-+                           dtype=grp_mask.astype('u8').dtype)
+-        mask = Nifti1Image(grp_mask.astype('u8'),
++        mask = Nifti1Image(grp_mask.astype('u1'),
+                            get_affine(load(mask_images[0])))
  
      # build the domain
-     domain = grid_domain_from_image(mask, nn=6)



View it on GitLab: https://salsa.debian.org/med-team/nipy/-/compare/8c92980857f25358762e57ccee200453ffaa85d6...12a4fbea8c99c1e5dc07ee81bc3da1a450617050

-- 
View it on GitLab: https://salsa.debian.org/med-team/nipy/-/compare/8c92980857f25358762e57ccee200453ffaa85d6...12a4fbea8c99c1e5dc07ee81bc3da1a450617050
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20230204/29597d04/attachment-0001.htm>


More information about the debian-med-commit mailing list