antspymm 1.5.2__py3-none-any.whl → 1.5.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
antspymm/mm.py CHANGED
@@ -2198,9 +2198,10 @@ def dti_numpy_to_image( reference_image, tensorarray, upper_triangular=True):
2198
2198
  def transform_and_reorient_dti( fixed, moving_dti, composite_transform, py_based=True, verbose=False, **kwargs):
2199
2199
  """
2200
2200
  apply a transform to DTI in the style of ants.apply_transforms. this function
2201
- expects a pre-computed composite transform which it will use to reorient
2202
- the DTI using preservation of principle directions.
2203
-
2201
+ expects a pre-computed composite transform which it will use to reorient
2202
+ the DTI using preservation of principle directions. BUG fix by cookpa 2025
2203
+ 06 18.
2204
+
2204
2205
  fixed : antsImage reference space
2205
2206
 
2206
2207
  moving_dti : antsImage DTI in upper triangular format
@@ -2224,34 +2225,36 @@ def transform_and_reorient_dti( fixed, moving_dti, composite_transform, py_based
2224
2225
  dtiw = []
2225
2226
  for k in range(len(dtsplit)):
2226
2227
  dtiw.append( ants.apply_transforms( fixed, dtsplit[k], composite_transform ) )
2227
- dtiw=ants.merge_channels(dtiw)
2228
+ dtiw=ants.merge_channels(dtiw) # resampled into fixed space but still based in moving index space
2228
2229
  if verbose:
2229
2230
  print("reorient tensors locally: compose and get reo image")
2230
- locrot = ants.deformation_gradient( ants.image_read(composite_transform),
2231
+ locrot = ants.deformation_gradient( ants.image_read(composite_transform),
2231
2232
  to_rotation = True, py_based=py_based ).numpy()
2232
- rebaser = np.dot( np.transpose( fixed.direction ), moving_dti.direction )
2233
+ # rebases from moving index to fixed index space. Not quite what we need here
2234
+ # rebaser = np.dot( np.transpose( fixed.direction ), moving_dti.direction )
2233
2235
  if verbose:
2234
2236
  print("convert UT to full tensor")
2235
2237
  dtiw2tensor = triangular_to_tensor( dtiw )
2236
2238
  if verbose:
2237
- print("rebase tensors to new space via iterator")
2239
+ print("rebase tensors to new space and apply reorientation via iterator")
2238
2240
  it = np.ndindex( fixed.shape )
2239
2241
  for i in it:
2240
- # direction * dt * direction.transpose();
2241
2242
  mmm = dtiw2tensor[i]
2242
- # transform rebase
2243
+ # Rebase mmm to physical space
2244
+ mmm = np.dot( mmm, np.transpose( moving_dti.direction ) )
2245
+ mmm = np.dot( moving_dti.direction, mmm )
2246
+ # Now apply local rotation
2243
2247
  locrotx = np.reshape( locrot[i], [3,3] )
2244
2248
  mmm = np.dot( mmm, np.transpose( locrotx ) )
2245
2249
  mmm = np.dot( locrotx, mmm )
2246
- # physical space rebase
2247
- mmm = np.dot( mmm, np.transpose( rebaser ) )
2248
- mmm = np.dot( rebaser, mmm )
2250
+ # Now rebase to fixed index space
2251
+ mmm = np.dot( mmm, np.transpose( fixed.direction ) )
2252
+ mmm = np.dot( fixed.direction, mmm )
2249
2253
  dtiw2tensor[i] = mmm
2250
2254
  if verbose:
2251
2255
  print("done with rebasing")
2252
2256
  return dti_numpy_to_image( fixed, dtiw2tensor )
2253
2257
 
2254
-
2255
2258
  def dti_reg(
2256
2259
  image,
2257
2260
  avg_b0,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: antspymm
3
- Version: 1.5.2
3
+ Version: 1.5.3
4
4
  Summary: multi-channel/time-series medical image processing with antspyx
5
5
  Author-email: "Avants, Gosselin, Tustison, Reardon" <stnava@gmail.com>
6
6
  License: Apache-2.0
@@ -0,0 +1,7 @@
1
+ antspymm/__init__.py,sha256=DnkidUfEu3Dl0tuWNTA-9VOUkBtH_cROKiPGNNXNagU,4637
2
+ antspymm/mm.py,sha256=8iZxrWenPeLhwc1dxDgvAhgNGZHOahTi1LegOhmHkL8,527319
3
+ antspymm-1.5.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
+ antspymm-1.5.3.dist-info/METADATA,sha256=pfNoP9vDefzKmOfRYk5z68qAJXXSmY2ELLLaRioiSHs,25939
5
+ antspymm-1.5.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
+ antspymm-1.5.3.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
7
+ antspymm-1.5.3.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- antspymm/__init__.py,sha256=DnkidUfEu3Dl0tuWNTA-9VOUkBtH_cROKiPGNNXNagU,4637
2
- antspymm/mm.py,sha256=NbT1IBiuEMtMoanr_8yO3kLNpSSfV0j1_155gykGOM0,526972
3
- antspymm-1.5.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
- antspymm-1.5.2.dist-info/METADATA,sha256=3Ttc-cPytZsiNct2MRz4PZwe5JmdZzaEsEgu7hxKxvA,25939
5
- antspymm-1.5.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
6
- antspymm-1.5.2.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
7
- antspymm-1.5.2.dist-info/RECORD,,