antspymm 1.3.7__py3-none-any.whl → 1.3.9__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
@@ -5017,8 +5017,6 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
5017
5017
  nmdf_wide = antspyt1w.merge_hierarchical_csvs_to_wide_format(
5018
5018
  {'NM' : nmdf},
5019
5019
  col_names = ['Mean'] )
5020
- if verbose:
5021
- print( "nm done" )
5022
5020
 
5023
5021
  rr_mask = ants.mask_image( labels2nm, labels2nm, [33,34] , binarize=True )
5024
5022
  sn_mask = ants.mask_image( labels2nm, labels2nm, [7,9,23,25] , binarize=True )
@@ -5028,7 +5026,8 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
5028
5026
  rravg = nm_avg_cropped[ rr_mask == 1].mean()
5029
5027
  snstd = nm_avg_cropped[ sn_mask == 1].std()
5030
5028
  rrstd = nm_avg_cropped[ rr_mask == 1].std()
5031
- snvol = np.prod( ants.get_spacing(sn_mask) ) * sn_mask.sum()
5029
+ vol_element = np.prod( ants.get_spacing(sn_mask) )
5030
+ snvol = vol_element * sn_mask.sum()
5032
5031
 
5033
5032
  # get the mean voxel position of the SN
5034
5033
  if snvol > 0:
@@ -5037,7 +5036,34 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
5037
5036
  else:
5038
5037
  sn_z = math.nan
5039
5038
 
5040
- nm_evr = antspyt1w.patch_eigenvalue_ratio( nm_avg, 512, [6,6,6], evdepth = 0.9, mask=cropper2nm )
5039
+ nm_evr = 0.0
5040
+ if cropper2nm.sum() > 0:
5041
+ nm_evr = antspyt1w.patch_eigenvalue_ratio( nm_avg, 512, [6,6,6],
5042
+ evdepth = 0.9, mask=cropper2nm )
5043
+
5044
+ simg = ants.smooth_image( nm_avg_cropped, np.min(ants.get_spacing(nm_avg_cropped)) )
5045
+ k = 2.0
5046
+ rrthresh = (rravg + k * rrstd)
5047
+ nmabovekthresh_mask = sn_mask * ants.threshold_image( simg, rrthresh, math.inf)
5048
+ snvolabovethresh = vol_element * nmabovekthresh_mask.sum()
5049
+ snintmeanabovethresh = float( ( simg * nmabovekthresh_mask ).mean() )
5050
+ snintsumabovethresh = float( ( simg * nmabovekthresh_mask ).sum() )
5051
+
5052
+ k = 3.0
5053
+ rrthresh = (rravg + k * rrstd)
5054
+ nmabovekthresh_mask3 = sn_mask * ants.threshold_image( simg, rrthresh, math.inf)
5055
+ snvolabovethresh3 = vol_element * nmabovekthresh_mask3.sum()
5056
+
5057
+ k = 4.0
5058
+ rrthresh = (rravg + k * rrstd)
5059
+ nmabovekthresh_mask4 = sn_mask * ants.threshold_image( simg, rrthresh, math.inf)
5060
+ snvolabovethresh4 = vol_element * nmabovekthresh_mask4.sum()
5061
+
5062
+ if verbose:
5063
+ print( "nm vol @2std above rrmean: " + str( snvolabovethresh ) )
5064
+ print( "nm intmean @2std above rrmean: " + str( snintmeanabovethresh ) )
5065
+ print( "nm intsum @2std above rrmean: " + str( snintsumabovethresh ) )
5066
+ print( "nm done" )
5041
5067
 
5042
5068
  return{
5043
5069
  'NM_avg' : nm_avg,
@@ -5053,6 +5079,11 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
5053
5079
  'NM_avg_substantianigra' : snavg,
5054
5080
  'NM_std_substantianigra' : snstd,
5055
5081
  'NM_volume_substantianigra' : snvol,
5082
+ 'NM_volume_substantianigra_2std' : snvolabovethresh,
5083
+ 'NM_intmean_substantianigra_2std' : snintmeanabovethresh,
5084
+ 'NM_intsum_substantianigra_2std' : snintsumabovethresh,
5085
+ 'NM_volume_substantianigra_3std' : snvolabovethresh3,
5086
+ 'NM_volume_substantianigra_4std' : snvolabovethresh4,
5056
5087
  'NM_avg_refregion' : rravg,
5057
5088
  'NM_std_refregion' : rrstd,
5058
5089
  'NM_min' : nm_avg_cropped.min(),
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: antspymm
3
- Version: 1.3.7
3
+ Version: 1.3.9
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=1fHqufHndrkJwz473av8qOf5-1xm5r-aKHuMAETGIiE,4462
2
+ antspymm/mm.py,sha256=m4l1VoltZnGqiKzLg1kOGRwx3INA87DkPZHJ4sU7cxE,481240
3
+ antspymm-1.3.9.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
+ antspymm-1.3.9.dist-info/METADATA,sha256=Ceg-uz1GUm1QPikt40iS9MkbF_7xJVgr4s-_1svpyr8,14866
5
+ antspymm-1.3.9.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
+ antspymm-1.3.9.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
7
+ antspymm-1.3.9.dist-info/RECORD,,
@@ -1,7 +0,0 @@
1
- antspymm/__init__.py,sha256=1fHqufHndrkJwz473av8qOf5-1xm5r-aKHuMAETGIiE,4462
2
- antspymm/mm.py,sha256=iQkwK-YcD6cYQhtIYKWhOW5vqVtGWBbzH6pfSqq_oN0,479836
3
- antspymm-1.3.7.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
4
- antspymm-1.3.7.dist-info/METADATA,sha256=SFxaPK9kMEgxJMx_CITvyWR3mWOzntIvKLHE1QKojRk,14866
5
- antspymm-1.3.7.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
6
- antspymm-1.3.7.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
7
- antspymm-1.3.7.dist-info/RECORD,,