antspymm 1.5.7__py3-none-any.whl → 1.6.0__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/__init__.py +1 -3
- antspymm/mm.py +168 -144
- {antspymm-1.5.7.dist-info → antspymm-1.6.0.dist-info}/METADATA +3 -3
- antspymm-1.6.0.dist-info/RECORD +6 -0
- antspymm-1.5.7.dist-info/RECORD +0 -6
- {antspymm-1.5.7.dist-info → antspymm-1.6.0.dist-info}/WHEEL +0 -0
- {antspymm-1.5.7.dist-info → antspymm-1.6.0.dist-info}/top_level.txt +0 -0
antspymm/__init__.py
CHANGED
antspymm/mm.py
CHANGED
@@ -135,6 +135,10 @@ import tensorflow as tf
|
|
135
135
|
from multiprocessing import Pool
|
136
136
|
import glob as glob
|
137
137
|
|
138
|
+
antspyt1w.set_global_scientific_computing_random_seed(
|
139
|
+
antspyt1w.get_global_scientific_computing_random_seed( )
|
140
|
+
)
|
141
|
+
|
138
142
|
DATA_PATH = os.path.expanduser('~/.antspymm/')
|
139
143
|
|
140
144
|
def version( ):
|
@@ -280,6 +284,85 @@ def validate_nrg_file_format(path, separator):
|
|
280
284
|
# If all checks pass
|
281
285
|
return True, "The path conforms to the NRG format."
|
282
286
|
|
287
|
+
|
288
|
+
|
289
|
+
def apply_transforms_mixed_interpolation(
|
290
|
+
fixed,
|
291
|
+
moving,
|
292
|
+
transformlist,
|
293
|
+
interpolator="linear",
|
294
|
+
imagetype=0,
|
295
|
+
whichtoinvert=None,
|
296
|
+
mask=None,
|
297
|
+
**kwargs
|
298
|
+
):
|
299
|
+
"""
|
300
|
+
Apply ANTs transforms with mixed interpolation:
|
301
|
+
- Linear interpolation inside `mask`
|
302
|
+
- Nearest neighbor outside `mask`
|
303
|
+
|
304
|
+
Parameters
|
305
|
+
----------
|
306
|
+
fixed : ANTsImage
|
307
|
+
Fixed/reference image to define spatial domain.
|
308
|
+
|
309
|
+
moving : ANTsImage
|
310
|
+
Moving image to be transformed.
|
311
|
+
|
312
|
+
transformlist : list of str
|
313
|
+
List of filenames for transforms.
|
314
|
+
|
315
|
+
interpolator : str, optional
|
316
|
+
Interpolator used inside the mask. Default is "linear".
|
317
|
+
|
318
|
+
imagetype : int
|
319
|
+
Image type used by ANTs (0 = scalar, 1 = vector, etc.)
|
320
|
+
|
321
|
+
whichtoinvert : list of bool, optional
|
322
|
+
List of booleans indicating which transforms to invert.
|
323
|
+
|
324
|
+
mask : ANTsImage
|
325
|
+
Binary mask image indicating where to apply `interpolator` (e.g., "linear").
|
326
|
+
Outside the mask, nearest neighbor is used.
|
327
|
+
|
328
|
+
kwargs : dict
|
329
|
+
Additional arguments passed to `ants.apply_transforms`.
|
330
|
+
|
331
|
+
Returns
|
332
|
+
-------
|
333
|
+
ANTsImage
|
334
|
+
Interpolated image using mixed interpolation, added across masked regions.
|
335
|
+
"""
|
336
|
+
if mask is None:
|
337
|
+
raise ValueError("A binary `mask` image must be provided.")
|
338
|
+
|
339
|
+
# Apply linear interpolation inside the mask
|
340
|
+
interp_linear = ants.apply_transforms(
|
341
|
+
fixed=fixed,
|
342
|
+
moving=moving,
|
343
|
+
transformlist=transformlist,
|
344
|
+
interpolator=interpolator,
|
345
|
+
imagetype=imagetype,
|
346
|
+
whichtoinvert=whichtoinvert,
|
347
|
+
**kwargs
|
348
|
+
)
|
349
|
+
|
350
|
+
# Apply nearest-neighbor interpolation everywhere
|
351
|
+
interp_nn = ants.apply_transforms(
|
352
|
+
fixed=fixed,
|
353
|
+
moving=moving,
|
354
|
+
transformlist=transformlist,
|
355
|
+
interpolator="nearestNeighbor",
|
356
|
+
imagetype=imagetype,
|
357
|
+
whichtoinvert=whichtoinvert,
|
358
|
+
**kwargs
|
359
|
+
)
|
360
|
+
|
361
|
+
# Combine: linear * mask + nn * (1 - mask)
|
362
|
+
mixed_result = (interp_linear * mask) + (interp_nn * (1 - mask))
|
363
|
+
|
364
|
+
return mixed_result
|
365
|
+
|
283
366
|
def get_antsimage_keys(dictionary):
|
284
367
|
"""
|
285
368
|
Return the keys of the dictionary where the values are ANTsImages.
|
@@ -1881,7 +1964,7 @@ def timeseries_transform(transform, image, reference, interpolation='linear'):
|
|
1881
1964
|
def timeseries_reg(
|
1882
1965
|
image,
|
1883
1966
|
avg_b0,
|
1884
|
-
type_of_transform=
|
1967
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
1885
1968
|
total_sigma=1.0,
|
1886
1969
|
fdOffset=2.0,
|
1887
1970
|
trim = 0,
|
@@ -1993,7 +2076,7 @@ def timeseries_reg(
|
|
1993
2076
|
if temp.numpy().var() > 0:
|
1994
2077
|
myrig = ants.registration(
|
1995
2078
|
avg_b0, temp,
|
1996
|
-
type_of_transform='
|
2079
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
1997
2080
|
outprefix=txprefix
|
1998
2081
|
)
|
1999
2082
|
if type_of_transform == 'SyN':
|
@@ -2520,10 +2603,11 @@ def dti_reg(
|
|
2520
2603
|
bvals=None,
|
2521
2604
|
bvecs=None,
|
2522
2605
|
b0_idx=None,
|
2523
|
-
type_of_transform="
|
2606
|
+
type_of_transform="antsRegistrationSyNRepro[r]",
|
2524
2607
|
total_sigma=3.0,
|
2525
2608
|
fdOffset=2.0,
|
2526
2609
|
mask_csf=False,
|
2610
|
+
brain_mask_eroded=None,
|
2527
2611
|
output_directory=None,
|
2528
2612
|
verbose=False, **kwargs
|
2529
2613
|
):
|
@@ -2552,6 +2636,8 @@ def dti_reg(
|
|
2552
2636
|
|
2553
2637
|
mask_csf: boolean
|
2554
2638
|
|
2639
|
+
brain_mask_eroded: optional mask that will trigger mixed interpolation
|
2640
|
+
|
2555
2641
|
output_directory : string
|
2556
2642
|
output will be placed in this directory plus a numeric extension.
|
2557
2643
|
|
@@ -2575,6 +2661,7 @@ def dti_reg(
|
|
2575
2661
|
-------
|
2576
2662
|
>>> import ants
|
2577
2663
|
"""
|
2664
|
+
|
2578
2665
|
idim = image.dimension
|
2579
2666
|
ishape = image.shape
|
2580
2667
|
nTimePoints = ishape[idim - 1]
|
@@ -2620,6 +2707,8 @@ def dti_reg(
|
|
2620
2707
|
ab0, adw = get_average_dwi_b0( image )
|
2621
2708
|
# mask is used to roughly locate middle of brain
|
2622
2709
|
mask = ants.threshold_image( ants.iMath(adw,'Normalize'), 0.1, 1.0 )
|
2710
|
+
if brain_mask_eroded is None:
|
2711
|
+
brain_mask_eroded = mask * 0 + 1
|
2623
2712
|
motion_parameters = list()
|
2624
2713
|
motion_corrected = list()
|
2625
2714
|
centerOfMass = mask.get_center_of_mass()
|
@@ -2651,7 +2740,7 @@ def dti_reg(
|
|
2651
2740
|
else:
|
2652
2741
|
bcsf = ab0 * 0 + 1
|
2653
2742
|
|
2654
|
-
initrig = ants.registration( avg_b0, ab0,'
|
2743
|
+
initrig = ants.registration( avg_b0, ab0,'antsRegistrationSyNRepro[r]',outprefix=ofnG)
|
2655
2744
|
deftx = ants.registration( avg_dwi, adw, 'SyNOnly',
|
2656
2745
|
syn_metric='CC', syn_sampling=2,
|
2657
2746
|
reg_iterations=[50,50,20],
|
@@ -2680,7 +2769,7 @@ def dti_reg(
|
|
2680
2769
|
if temp.numpy().var() > 0:
|
2681
2770
|
myrig = ants.registration(
|
2682
2771
|
fixed, temp,
|
2683
|
-
type_of_transform='
|
2772
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
2684
2773
|
outprefix=txprefix,
|
2685
2774
|
**kwargs
|
2686
2775
|
)
|
@@ -2717,9 +2806,9 @@ def dti_reg(
|
|
2717
2806
|
fixed=ants.image_clone( adw )
|
2718
2807
|
if temp.numpy().var() > 0:
|
2719
2808
|
motion_parameters[k]=deftx+motion_parameters[k]
|
2720
|
-
img1w =
|
2809
|
+
img1w = apply_transforms_mixed_interpolation( avg_dwi,
|
2721
2810
|
ants.slice_image(image, axis=idim - 1, idx=k),
|
2722
|
-
motion_parameters[k] )
|
2811
|
+
motion_parameters[k], mask=brain_mask_eroded )
|
2723
2812
|
motion_corrected.append(img1w)
|
2724
2813
|
else:
|
2725
2814
|
motion_corrected.append(fixed)
|
@@ -2759,7 +2848,7 @@ def dti_reg(
|
|
2759
2848
|
def mc_reg(
|
2760
2849
|
image,
|
2761
2850
|
fixed=None,
|
2762
|
-
type_of_transform="
|
2851
|
+
type_of_transform="antsRegistrationSyNRepro[r]",
|
2763
2852
|
mask=None,
|
2764
2853
|
total_sigma=3.0,
|
2765
2854
|
fdOffset=2.0,
|
@@ -2862,7 +2951,7 @@ def mc_reg(
|
|
2862
2951
|
if temp.numpy().var() > 0:
|
2863
2952
|
myrig = ants.registration(
|
2864
2953
|
fixed, temp,
|
2865
|
-
type_of_transform='
|
2954
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
2866
2955
|
outprefix=ofnL+str(k).zfill(4)+"_",
|
2867
2956
|
**kwargs
|
2868
2957
|
)
|
@@ -3227,7 +3316,7 @@ def dewarp_imageset( image_list, initial_template=None,
|
|
3227
3316
|
initial_template=initial_template,
|
3228
3317
|
image_list=avglist,
|
3229
3318
|
gradient_step=0.5, blending_weight=0.8,
|
3230
|
-
iterations=iterations, **kwargs )
|
3319
|
+
iterations=iterations, verbose=False, **kwargs )
|
3231
3320
|
|
3232
3321
|
# last - warp all images to this frame
|
3233
3322
|
mocoplist = []
|
@@ -3235,7 +3324,7 @@ def dewarp_imageset( image_list, initial_template=None,
|
|
3235
3324
|
reglist = []
|
3236
3325
|
for k in range(len(image_list)):
|
3237
3326
|
if imagetype == 3:
|
3238
|
-
moco0 = ants.motion_correction( image=image_list[k], fixed=btp, type_of_transform='
|
3327
|
+
moco0 = ants.motion_correction( image=image_list[k], fixed=btp, type_of_transform='antsRegistrationSyNRepro[r]' )
|
3239
3328
|
mocoplist.append( moco0['motion_parameters'] )
|
3240
3329
|
mocofdlist.append( moco0['FD'] )
|
3241
3330
|
locavg = ants.slice_image( moco0['motion_corrected'], axis=3, idx=0 ) * 0.0
|
@@ -3452,13 +3541,13 @@ def get_average_rsf( x, min_t=10, max_t=35 ):
|
|
3452
3541
|
max_t=x.shape[3]
|
3453
3542
|
for myidx in range(min_t,max_t):
|
3454
3543
|
b0 = ants.slice_image( x, axis=3, idx=myidx)
|
3455
|
-
bavg = bavg + ants.registration(oavg,b0,'
|
3544
|
+
bavg = bavg + ants.registration(oavg,b0,'antsRegistrationSyNRepro[r]',outprefix=ofn)['warpedmovout']
|
3456
3545
|
bavg = ants.iMath( bavg, 'Normalize' )
|
3457
3546
|
oavg = ants.image_clone( bavg )
|
3458
3547
|
bavg = oavg * 0.0
|
3459
3548
|
for myidx in range(min_t,max_t):
|
3460
3549
|
b0 = ants.slice_image( x, axis=3, idx=myidx)
|
3461
|
-
bavg = bavg + ants.registration(oavg,b0,'
|
3550
|
+
bavg = bavg + ants.registration(oavg,b0,'antsRegistrationSyNRepro[r]',outprefix=ofn)['warpedmovout']
|
3462
3551
|
import shutil
|
3463
3552
|
shutil.rmtree(output_directory, ignore_errors=True )
|
3464
3553
|
bavg = ants.iMath( bavg, 'Normalize' )
|
@@ -3497,16 +3586,16 @@ def get_average_dwi_b0( x, fixed_b0=None, fixed_dwi=None, fast=False ):
|
|
3497
3586
|
temp_dwi = ants.slice_image( x, axis=3, idx=non_b0_idx[0] )
|
3498
3587
|
xavg = fixed_b0 * 0.0
|
3499
3588
|
bavg = fixed_b0 * 0.0
|
3500
|
-
tempreg = ants.registration( fixed_b0, temp_b0,'
|
3589
|
+
tempreg = ants.registration( fixed_b0, temp_b0,'antsRegistrationSyNRepro[r]')
|
3501
3590
|
fixed_b0_use = tempreg['warpedmovout']
|
3502
3591
|
fixed_dwi_use = ants.apply_transforms( fixed_b0, temp_dwi, tempreg['fwdtransforms'] )
|
3503
3592
|
for myidx in range(x.shape[3]):
|
3504
3593
|
b0 = ants.slice_image( x, axis=3, idx=myidx)
|
3505
3594
|
if not fast:
|
3506
3595
|
if not myidx in b0_idx:
|
3507
|
-
xavg = xavg + ants.registration(fixed_dwi_use,b0,'
|
3596
|
+
xavg = xavg + ants.registration(fixed_dwi_use,b0,'antsRegistrationSyNRepro[r]',outprefix=ofn)['warpedmovout']
|
3508
3597
|
else:
|
3509
|
-
bavg = bavg + ants.registration(fixed_b0_use,b0,'
|
3598
|
+
bavg = bavg + ants.registration(fixed_b0_use,b0,'antsRegistrationSyNRepro[r]',outprefix=ofn)['warpedmovout']
|
3510
3599
|
else:
|
3511
3600
|
if not myidx in b0_idx:
|
3512
3601
|
xavg = xavg + b0
|
@@ -3518,7 +3607,7 @@ def get_average_dwi_b0( x, fixed_b0=None, fixed_dwi=None, fast=False ):
|
|
3518
3607
|
shutil.rmtree(output_directory, ignore_errors=True )
|
3519
3608
|
avgb0=ants.n4_bias_field_correction(bavg)
|
3520
3609
|
avgdwi=ants.n4_bias_field_correction(xavg)
|
3521
|
-
avgdwi=ants.registration( avgb0, avgdwi, '
|
3610
|
+
avgdwi=ants.registration( avgb0, avgdwi, 'antsRegistrationSyNRepro[r]' )['warpedmovout']
|
3522
3611
|
return avgb0, avgdwi
|
3523
3612
|
|
3524
3613
|
def dti_template(
|
@@ -3564,8 +3653,8 @@ def dti_template(
|
|
3564
3653
|
fimg2=bavg
|
3565
3654
|
mimg2=b_image_list[k] * bcsf[k]
|
3566
3655
|
w1 = ants.registration(
|
3567
|
-
fimg, mimg, type_of_transform='
|
3568
|
-
multivariate_extras= [ [ "
|
3656
|
+
fimg, mimg, type_of_transform='antsRegistrationSyNQuickRepro[s]',
|
3657
|
+
multivariate_extras= [ [ "CC", fimg2, mimg2, 1, 2 ]],
|
3569
3658
|
outprefix=mydeftx,
|
3570
3659
|
verbose=0 )
|
3571
3660
|
txname = ants.apply_transforms(wavg, wavg,
|
@@ -3621,7 +3710,7 @@ def t1_based_dwi_brain_extraction(
|
|
3621
3710
|
t1w,
|
3622
3711
|
dwi,
|
3623
3712
|
b0_idx = None,
|
3624
|
-
transform='
|
3713
|
+
transform='antsRegistrationSyNRepro[r]',
|
3625
3714
|
deform=None,
|
3626
3715
|
verbose=False
|
3627
3716
|
):
|
@@ -3659,7 +3748,7 @@ def t1_based_dwi_brain_extraction(
|
|
3659
3748
|
b0_avg = ants.slice_image( dwi, axis=3, idx=b0_idx[0] ).iMath("Normalize")
|
3660
3749
|
for n in range(1,len(b0_idx)):
|
3661
3750
|
temp = ants.slice_image( dwi, axis=3, idx=b0_idx[n] )
|
3662
|
-
reg = ants.registration( b0_avg, temp, '
|
3751
|
+
reg = ants.registration( b0_avg, temp, 'antsRegistrationSyNRepro[r]' )
|
3663
3752
|
b0_avg = b0_avg + ants.iMath( reg['warpedmovout'], "Normalize")
|
3664
3753
|
else:
|
3665
3754
|
b0_avg = ants.slice_image( dwi, axis=3, idx=b0_idx[0] )
|
@@ -4463,10 +4552,12 @@ def joint_dti_recon(
|
|
4463
4552
|
if denoise :
|
4464
4553
|
img_RL = mc_denoise( img_RL )
|
4465
4554
|
|
4555
|
+
brainmaske = None
|
4466
4556
|
if brain_mask is not None:
|
4467
4557
|
maskInRightSpace = ants.image_physical_space_consistency( brain_mask, reference_B0 )
|
4468
4558
|
if not maskInRightSpace :
|
4469
4559
|
raise ValueError('not maskInRightSpace ... provided brain mask should be in reference_B0 space')
|
4560
|
+
brainmaske = ants.iMath( maskInRightSpace, "ME", 2 )
|
4470
4561
|
|
4471
4562
|
if img_RL is not None :
|
4472
4563
|
if verbose:
|
@@ -4478,6 +4569,7 @@ def joint_dti_recon(
|
|
4478
4569
|
bvals=bval_RL,
|
4479
4570
|
bvecs=bvec_RL,
|
4480
4571
|
type_of_transform=motion_correct,
|
4572
|
+
brain_mask_eroded=brainmaske,
|
4481
4573
|
verbose=True )
|
4482
4574
|
else:
|
4483
4575
|
reg_RL=None
|
@@ -4492,6 +4584,7 @@ def joint_dti_recon(
|
|
4492
4584
|
bvals=bval_LR,
|
4493
4585
|
bvecs=bvec_LR,
|
4494
4586
|
type_of_transform=motion_correct,
|
4587
|
+
brain_mask_eroded=brainmaske,
|
4495
4588
|
verbose=True )
|
4496
4589
|
|
4497
4590
|
ts_LR_avg = None
|
@@ -4563,7 +4656,7 @@ def joint_dti_recon(
|
|
4563
4656
|
print("JHU reg",flush=True)
|
4564
4657
|
|
4565
4658
|
OR_FA2JHUreg = ants.registration( reconFA, jhu_atlas,
|
4566
|
-
type_of_transform = '
|
4659
|
+
type_of_transform = 'antsRegistrationSyNQuickRepro[s]',
|
4567
4660
|
reg_iterations=reg_its, verbose=False )
|
4568
4661
|
OR_FA_jhulabels = ants.apply_transforms( reconFA, jhu_labels,
|
4569
4662
|
OR_FA2JHUreg['fwdtransforms'], interpolator='genericLabel')
|
@@ -5516,7 +5609,7 @@ def get_rsf_outputs( coords ):
|
|
5516
5609
|
return list( yeo['SystemName'].unique() )
|
5517
5610
|
|
5518
5611
|
def tra_initializer( fixed, moving, n_simulations=32, max_rotation=30,
|
5519
|
-
transform=['rigid'], compreg=None, verbose=False ):
|
5612
|
+
transform=['rigid'], compreg=None, random_seed=42, verbose=False ):
|
5520
5613
|
"""
|
5521
5614
|
multi-start multi-transform registration solution - based on ants.registration
|
5522
5615
|
|
@@ -5532,9 +5625,14 @@ def tra_initializer( fixed, moving, n_simulations=32, max_rotation=30,
|
|
5532
5625
|
|
5533
5626
|
compreg : registration results against which to compare
|
5534
5627
|
|
5628
|
+
random_seed : random seed for reproducibility
|
5629
|
+
|
5535
5630
|
verbose : boolean
|
5536
5631
|
|
5537
5632
|
"""
|
5633
|
+
import random
|
5634
|
+
if random_seed is not None:
|
5635
|
+
random.seed(random_seed)
|
5538
5636
|
if True:
|
5539
5637
|
output_directory = tempfile.mkdtemp()
|
5540
5638
|
output_directory_w = output_directory + "/tra_reg/"
|
@@ -5555,7 +5653,7 @@ def tra_initializer( fixed, moving, n_simulations=32, max_rotation=30,
|
|
5555
5653
|
bestreg=compreg
|
5556
5654
|
initx = ants.read_transform( bestreg['fwdtransforms'][0] )
|
5557
5655
|
for mytx in transform:
|
5558
|
-
regtx = '
|
5656
|
+
regtx = 'antsRegistrationSyNRepro[r]'
|
5559
5657
|
with tempfile.NamedTemporaryFile(suffix='.h5') as tp:
|
5560
5658
|
if mytx == 'translation':
|
5561
5659
|
regtx = 'Translation'
|
@@ -5660,7 +5758,7 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
|
|
5660
5758
|
templateNM = ants.iMath( mm_read( fntNM ), "Normalize" )
|
5661
5759
|
templatebstem = mm_read( fntbst ).threshold_image( 1, 1000 )
|
5662
5760
|
# reg = ants.registration( t1, template, 'antsRegistrationSyNQuickRepro[s]' )
|
5663
|
-
reg = ants.registration( t1, template, '
|
5761
|
+
reg = ants.registration( t1, template, 'antsRegistrationSyNQuickRepro[s]' )
|
5664
5762
|
# map NM avg to t1 for neuromelanin processing
|
5665
5763
|
nmavg2t1 = ants.apply_transforms( t1, templateNM,
|
5666
5764
|
reg['fwdtransforms'], interpolator='linear' )
|
@@ -5696,7 +5794,7 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
|
|
5696
5794
|
if verbose:
|
5697
5795
|
print(str(k) + " of " + str(len( list_nm_images ) ) )
|
5698
5796
|
current_image = ants.registration( list_nm_images[k], nm_avg,
|
5699
|
-
type_of_transform = '
|
5797
|
+
type_of_transform = 'antsRegistrationSyNRepro[r]' )
|
5700
5798
|
txlist.append( current_image['fwdtransforms'][0] )
|
5701
5799
|
current_image = current_image['warpedfixout']
|
5702
5800
|
nm_avg_new = nm_avg_new + current_image / len( list_nm_images )
|
@@ -5706,7 +5804,7 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
|
|
5706
5804
|
print("do slab registration to map anatomy to NM space")
|
5707
5805
|
t1c = ants.crop_image( t1_head, slab2t1 ).iMath("Normalize") # old way
|
5708
5806
|
nmavg2t1c = ants.crop_image( nmavg2t1, slab2t1 ).iMath("Normalize")
|
5709
|
-
# slabreg = ants.registration( nm_avg, nmavg2t1c, '
|
5807
|
+
# slabreg = ants.registration( nm_avg, nmavg2t1c, 'antsRegistrationSyNRepro[r]' )
|
5710
5808
|
slabreg = tra_initializer( nm_avg, t1c, verbose=verbose )
|
5711
5809
|
if False:
|
5712
5810
|
slabregT1 = tra_initializer( nm_avg, t1c, verbose=verbose )
|
@@ -5766,7 +5864,7 @@ def neuromelanin( list_nm_images, t1, t1_head, t1lab, brain_stem_dilation=8,
|
|
5766
5864
|
myreg = ants.registration(
|
5767
5865
|
ants.iMath(nm_avg_cropped,"Normalize"),
|
5768
5866
|
ants.iMath(crop_nm_list[k],"Normalize"),
|
5769
|
-
'
|
5867
|
+
'antsRegistrationSyNRepro[r]' )
|
5770
5868
|
warpednext = ants.apply_transforms(
|
5771
5869
|
nm_avg_cropped_new,
|
5772
5870
|
crop_nm_list[k],
|
@@ -6080,7 +6178,7 @@ def resting_state_fmri_networks( fmri, fmri_template, t1, t1segmentation,
|
|
6080
6178
|
else:
|
6081
6179
|
nc=float(nc)
|
6082
6180
|
|
6083
|
-
type_of_transform=
|
6181
|
+
type_of_transform="antsRegistrationSyNQuickRepro[r]" # , # should probably not change this
|
6084
6182
|
remove_it=True
|
6085
6183
|
output_directory = tempfile.mkdtemp()
|
6086
6184
|
output_directory_w = output_directory + "/ts_t1_reg/"
|
@@ -6189,13 +6287,14 @@ def resting_state_fmri_networks( fmri, fmri_template, t1, t1segmentation,
|
|
6189
6287
|
trim = 8,
|
6190
6288
|
output_directory=None,
|
6191
6289
|
verbose=verbose,
|
6192
|
-
syn_metric='
|
6290
|
+
syn_metric='CC',
|
6193
6291
|
syn_sampling=2,
|
6194
6292
|
reg_iterations=[40,20,5],
|
6195
6293
|
return_numpy_motion_parameters=True )
|
6196
6294
|
|
6197
6295
|
if verbose:
|
6198
6296
|
print("End rsfmri motion correction")
|
6297
|
+
print("--maximum motion : " + str(corrmo['FD'].max()) )
|
6199
6298
|
print("=== next anatomically based mapping ===")
|
6200
6299
|
|
6201
6300
|
despiking_count = np.zeros( corrmo['motion_corrected'].shape[3] )
|
@@ -6215,7 +6314,7 @@ def resting_state_fmri_networks( fmri, fmri_template, t1, t1segmentation,
|
|
6215
6314
|
# anatomical mapping
|
6216
6315
|
und = fmri_template * bmask
|
6217
6316
|
t1reg = ants.registration( und, t1,
|
6218
|
-
|
6317
|
+
"antsRegistrationSyNQuickRepro[s]", outprefix=ofnt1tx )
|
6219
6318
|
if verbose:
|
6220
6319
|
print("t1 2 bold done")
|
6221
6320
|
gmseg = ants.threshold_image( t1segmentation, 2, 2 )
|
@@ -6750,17 +6849,18 @@ def bold_perfusion_minimal(
|
|
6750
6849
|
perf_total_sigma = 1.5
|
6751
6850
|
corrmo = timeseries_reg(
|
6752
6851
|
fmri, fmri_template,
|
6753
|
-
type_of_transform='
|
6852
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
6754
6853
|
total_sigma=perf_total_sigma,
|
6755
6854
|
fdOffset=2.0,
|
6756
6855
|
trim = mytrim,
|
6757
6856
|
output_directory=None,
|
6758
6857
|
verbose=verbose,
|
6759
|
-
syn_metric='
|
6858
|
+
syn_metric='CC',
|
6760
6859
|
syn_sampling=2,
|
6761
6860
|
reg_iterations=[40,20,5] )
|
6762
6861
|
if verbose:
|
6763
6862
|
print("End rsfmri motion correction")
|
6863
|
+
print("--maximum motion : " + str(corrmo['FD'].max()) )
|
6764
6864
|
|
6765
6865
|
if m0_image is not None:
|
6766
6866
|
m0 = m0_image
|
@@ -6789,17 +6889,18 @@ def bold_perfusion_minimal(
|
|
6789
6889
|
fmri_template = ants.iMath( ants.get_average_of_timeseries( fmrimotcorr ), "Normalize" )
|
6790
6890
|
corrmo = timeseries_reg(
|
6791
6891
|
fmri, fmri_template,
|
6792
|
-
type_of_transform='
|
6892
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
6793
6893
|
total_sigma=perf_total_sigma,
|
6794
6894
|
fdOffset=2.0,
|
6795
6895
|
trim = mytrim,
|
6796
6896
|
output_directory=None,
|
6797
6897
|
verbose=verbose,
|
6798
|
-
syn_metric='
|
6898
|
+
syn_metric='CC',
|
6799
6899
|
syn_sampling=2,
|
6800
6900
|
reg_iterations=[40,20,5] )
|
6801
6901
|
if verbose:
|
6802
6902
|
print("End 2nd rsfmri motion correction")
|
6903
|
+
print("--maximum motion : " + str(corrmo['FD'].max()) )
|
6803
6904
|
|
6804
6905
|
if outlier_threshold < 1.0 and outlier_threshold > 0.0:
|
6805
6906
|
corrmo['motion_corrected'] = remove_volumes_from_timeseries( corrmo['motion_corrected'], hlinds )
|
@@ -6853,7 +6954,7 @@ def bold_perfusion_minimal(
|
|
6853
6954
|
m0 = ants.get_average_of_timeseries( fmrimotcorr )
|
6854
6955
|
else:
|
6855
6956
|
# register m0 to current template
|
6856
|
-
m0reg = ants.registration( fmri_template, m0, '
|
6957
|
+
m0reg = ants.registration( fmri_template, m0, 'antsRegistrationSyNRepro[r]', verbose=False )
|
6857
6958
|
m0 = m0reg['warpedmovout']
|
6858
6959
|
|
6859
6960
|
if ntp == 2 :
|
@@ -6934,7 +7035,7 @@ def bold_perfusion(
|
|
6934
7035
|
FD_threshold=0.5,
|
6935
7036
|
spa = (0., 0., 0., 0.),
|
6936
7037
|
nc = 3,
|
6937
|
-
type_of_transform='
|
7038
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
6938
7039
|
tc='alternating',
|
6939
7040
|
n_to_trim=0,
|
6940
7041
|
m0_image = None,
|
@@ -7069,7 +7170,7 @@ def bold_perfusion(
|
|
7069
7170
|
fmri_template, hlinds = loop_timeseries_censoring( fmri, 0.10 )
|
7070
7171
|
fmri_template = ants.get_average_of_timeseries( fmri_template )
|
7071
7172
|
del hlinds
|
7072
|
-
rig = ants.registration( fmri_template, t1head, '
|
7173
|
+
rig = ants.registration( fmri_template, t1head, 'antsRegistrationSyNRepro[r]' )
|
7073
7174
|
bmask = ants.apply_transforms( fmri_template, ants.threshold_image(t1segmentation,1,6), rig['fwdtransforms'][0], interpolator='genericLabel' )
|
7074
7175
|
if m0_indices is None:
|
7075
7176
|
if n_to_trim is None:
|
@@ -7086,7 +7187,7 @@ def bold_perfusion(
|
|
7086
7187
|
trim = mytrim,
|
7087
7188
|
output_directory=None,
|
7088
7189
|
verbose=verbose,
|
7089
|
-
syn_metric='
|
7190
|
+
syn_metric='CC',
|
7090
7191
|
syn_sampling=2,
|
7091
7192
|
reg_iterations=[40,20,5] )
|
7092
7193
|
if verbose:
|
@@ -7135,7 +7236,7 @@ def bold_perfusion(
|
|
7135
7236
|
print( 'fmri_template')
|
7136
7237
|
print( fmri_template )
|
7137
7238
|
|
7138
|
-
rig = ants.registration( fmri_template, t1head, '
|
7239
|
+
rig = ants.registration( fmri_template, t1head, 'antsRegistrationSyNRepro[r]' )
|
7139
7240
|
bmask = ants.apply_transforms( fmri_template,
|
7140
7241
|
ants.threshold_image(t1segmentation,1,6),
|
7141
7242
|
rig['fwdtransforms'][0],
|
@@ -7151,7 +7252,7 @@ def bold_perfusion(
|
|
7151
7252
|
trim = mytrim,
|
7152
7253
|
output_directory=None,
|
7153
7254
|
verbose=verbose,
|
7154
|
-
syn_metric='
|
7255
|
+
syn_metric='CC',
|
7155
7256
|
syn_sampling=2,
|
7156
7257
|
reg_iterations=[40,20,5] )
|
7157
7258
|
if verbose:
|
@@ -7169,7 +7270,7 @@ def bold_perfusion(
|
|
7169
7270
|
warn_if_small_mask( bmask, label='bold_perfusion:bmask*tsnrmask')
|
7170
7271
|
fmrimotcorr=corrmo['motion_corrected']
|
7171
7272
|
und = fmri_template * bmask
|
7172
|
-
t1reg = ants.registration( und, t1, "
|
7273
|
+
t1reg = ants.registration( und, t1, "antsRegistrationSyNRepro[s]" )
|
7173
7274
|
gmseg = ants.threshold_image( t1segmentation, 2, 2 )
|
7174
7275
|
gmseg = gmseg + ants.threshold_image( t1segmentation, 4, 4 )
|
7175
7276
|
gmseg = ants.threshold_image( gmseg, 1, 4 )
|
@@ -7264,7 +7365,7 @@ Where:
|
|
7264
7365
|
m0 = ants.get_average_of_timeseries( fmrimotcorr )
|
7265
7366
|
else:
|
7266
7367
|
# register m0 to current template
|
7267
|
-
m0reg = ants.registration( fmri_template, m0, '
|
7368
|
+
m0reg = ants.registration( fmri_template, m0, 'antsRegistrationSyNRepro[r]', verbose=False )
|
7268
7369
|
m0 = m0reg['warpedmovout']
|
7269
7370
|
|
7270
7371
|
if ntp == 2 :
|
@@ -7351,7 +7452,7 @@ Where:
|
|
7351
7452
|
|
7352
7453
|
def pet3d_summary( pet3d, t1head, t1, t1segmentation, t1dktcit,
|
7353
7454
|
spa = (0., 0., 0.),
|
7354
|
-
type_of_transform='
|
7455
|
+
type_of_transform='antsRegistrationSyNRepro[r]',
|
7355
7456
|
upsample=True,
|
7356
7457
|
verbose=False ):
|
7357
7458
|
"""
|
@@ -7401,7 +7502,7 @@ def pet3d_summary( pet3d, t1head, t1, t1segmentation, t1dktcit,
|
|
7401
7502
|
newspc = [minspc,minspc,minspc]
|
7402
7503
|
pet3dr = ants.resample_image( pet3d, newspc, interp_type=0 )
|
7403
7504
|
|
7404
|
-
rig = ants.registration( pet3dr, t1head, '
|
7505
|
+
rig = ants.registration( pet3dr, t1head, 'antsRegistrationSyNRepro[r]' )
|
7405
7506
|
bmask = ants.apply_transforms( pet3dr,
|
7406
7507
|
ants.threshold_image(t1segmentation,1,6),
|
7407
7508
|
rig['fwdtransforms'][0],
|
@@ -7536,7 +7637,7 @@ def mm(
|
|
7536
7637
|
group_template = None,
|
7537
7638
|
group_transform = None,
|
7538
7639
|
target_range = [0,1],
|
7539
|
-
dti_motion_correct = '
|
7640
|
+
dti_motion_correct = 'antsRegistrationSyNQuickRepro[r]',
|
7540
7641
|
dti_denoise = False,
|
7541
7642
|
perfusion_trim=10,
|
7542
7643
|
perfusion_m0_image=None,
|
@@ -7679,9 +7780,10 @@ def mm(
|
|
7679
7780
|
|
7680
7781
|
if do_kk:
|
7681
7782
|
if verbose:
|
7682
|
-
print('kk')
|
7683
|
-
output_dict['kk'] = antspyt1w.kelly_kapowski_thickness(
|
7783
|
+
print('kk in mm')
|
7784
|
+
output_dict['kk'] = antspyt1w.kelly_kapowski_thickness( t1_image,
|
7684
7785
|
labels=hier['dkt_parc']['dkt_cortex'], iterations=45 )
|
7786
|
+
|
7685
7787
|
if perfusion_image is not None:
|
7686
7788
|
if perfusion_image.shape[3] > 1: # FIXME - better heuristic?
|
7687
7789
|
output_dict['perf'] = bold_perfusion(
|
@@ -7706,7 +7808,7 @@ def mm(
|
|
7706
7808
|
verbose=verbose )
|
7707
7809
|
################################## do the rsf .....
|
7708
7810
|
if len(rsf_image) > 0:
|
7709
|
-
my_motion_tx = '
|
7811
|
+
my_motion_tx = 'antsRegistrationSyNRepro[r]'
|
7710
7812
|
rsf_image = [i for i in rsf_image if i is not None]
|
7711
7813
|
if verbose:
|
7712
7814
|
print('rsf length ' + str( len( rsf_image ) ) )
|
@@ -7728,6 +7830,7 @@ def mm(
|
|
7728
7830
|
boldTemplate = ants.build_template(
|
7729
7831
|
initial_template = init_temp,
|
7730
7832
|
image_list=[rsfavg1,rsfavg2],
|
7833
|
+
type_of_transform="antsRegistrationSyNQuickRepro[s]",
|
7731
7834
|
iterations=5, verbose=False )
|
7732
7835
|
if verbose:
|
7733
7836
|
print("join the 2 rsf")
|
@@ -7799,89 +7902,7 @@ def mm(
|
|
7799
7902
|
verbose=verbose ) # default
|
7800
7903
|
rsfprolist.append( rsf0 )
|
7801
7904
|
output_dict['rsf'] = rsfprolist
|
7802
|
-
|
7803
|
-
# Initialize the parameters DataFrame
|
7804
|
-
# first - no censoring - just explore compcor
|
7805
|
-
df = pd.DataFrame()
|
7806
|
-
cens=False
|
7807
|
-
HM=1.0 # best by PTBP
|
7808
|
-
hmsearch = [0.5, 1.0, 5.0 ]
|
7809
|
-
loopsearch = [ 0.25, 0.5, 0.75, 1.0 ]
|
7810
|
-
loop = 1.0
|
7811
|
-
CCsearch = [ 5, 0.80 ]
|
7812
|
-
defaultf = [ 0.008, 0.15 ]
|
7813
|
-
freqsearch = ['broad','mid','tight'] #
|
7814
|
-
# for debuggin
|
7815
|
-
# rsf_image = remove_volumes_from_timeseries( rsf_image, list(range(80,2000)))
|
7816
|
-
docens=True # explore censoring
|
7817
|
-
for ff in freqsearch:
|
7818
|
-
for CC in CCsearch:
|
7819
|
-
local_df = pd.DataFrame({"loop": [loop], "cens": [cens], "HM": [HM], "ff": [ff], "CC": [CC]})
|
7820
|
-
if verbose:
|
7821
|
-
print( local_df )
|
7822
|
-
if df.shape[0] == 0:
|
7823
|
-
df = local_df
|
7824
|
-
else:
|
7825
|
-
df = pd.concat([df, local_df], ignore_index=True)
|
7826
|
-
f = defaultf
|
7827
|
-
if ff == 'mid':
|
7828
|
-
f = [0.01,0.1]
|
7829
|
-
elif ff == 'tight':
|
7830
|
-
f = [0.03,0.08]
|
7831
|
-
rsf0 = resting_state_fmri_networks(
|
7832
|
-
rsf_image, boldTemplate, hier['brain_n4_dnz'], t1atropos,
|
7833
|
-
f=f,
|
7834
|
-
FD_threshold=HM,
|
7835
|
-
spa = None, spt = None,
|
7836
|
-
nc = CC,
|
7837
|
-
outlier_threshold=loop,
|
7838
|
-
ica_components = 0,
|
7839
|
-
impute = False,
|
7840
|
-
censor = cens,
|
7841
|
-
despike = 2.5,
|
7842
|
-
motion_as_nuisance = True,
|
7843
|
-
upsample=False,
|
7844
|
-
clean_tmp=0.66,
|
7845
|
-
verbose=verbose ) # default
|
7846
|
-
rsfprolist.append( rsf0 )
|
7847
|
-
|
7848
|
-
# test impact of censoring
|
7849
|
-
if docens:
|
7850
|
-
cens = True
|
7851
|
-
for loop in loopsearch:
|
7852
|
-
for HM in hmsearch:
|
7853
|
-
for ff in freqsearch:
|
7854
|
-
for CC in CCsearch:
|
7855
|
-
local_df = pd.DataFrame({"loop": [loop], "cens": [cens], "HM": [HM], "ff": [ff], "CC": [CC]})
|
7856
|
-
if verbose:
|
7857
|
-
print( local_df )
|
7858
|
-
df = pd.concat([df, local_df], ignore_index=True)
|
7859
|
-
f = defaultf
|
7860
|
-
if ff == 'mid':
|
7861
|
-
f = [0.01,0.1]
|
7862
|
-
elif ff == 'tight':
|
7863
|
-
f = [0.03,0.08]
|
7864
|
-
rsf0 = resting_state_fmri_networks(
|
7865
|
-
rsf_image,
|
7866
|
-
boldTemplate,
|
7867
|
-
hier['brain_n4_dnz'],
|
7868
|
-
t1atropos,
|
7869
|
-
f=f,
|
7870
|
-
FD_threshold=HM,
|
7871
|
-
spa = None,
|
7872
|
-
spt = None,
|
7873
|
-
nc = CC,
|
7874
|
-
outlier_threshold=loop,
|
7875
|
-
ica_components = 0,
|
7876
|
-
impute = False,
|
7877
|
-
censor = cens,
|
7878
|
-
despike = 2.5,
|
7879
|
-
motion_as_nuisance = True,
|
7880
|
-
upsample=False,
|
7881
|
-
clean_tmp=0.66,
|
7882
|
-
verbose=verbose ) # default
|
7883
|
-
rsfprolist.append( rsf0 )
|
7884
|
-
output_dict['rsf'] = rsfprolist
|
7905
|
+
|
7885
7906
|
if nm_image_list is not None:
|
7886
7907
|
if verbose:
|
7887
7908
|
print('nm')
|
@@ -7898,11 +7919,11 @@ def mm(
|
|
7898
7919
|
print("We have only one DTI: " + str(len(dw_image)))
|
7899
7920
|
dw_image = dw_image[0]
|
7900
7921
|
btpB0, btpDW = get_average_dwi_b0(dw_image)
|
7901
|
-
initrig = ants.registration( btpDW, hier['brain_n4_dnz'], '
|
7922
|
+
initrig = ants.registration( btpDW, hier['brain_n4_dnz'], 'antsRegistrationSyNRepro[r]' )['fwdtransforms'][0]
|
7902
7923
|
tempreg = ants.registration( btpDW, hier['brain_n4_dnz'], 'SyNOnly',
|
7903
|
-
syn_metric='
|
7924
|
+
syn_metric='CC', syn_sampling=2,
|
7904
7925
|
reg_iterations=[50,50,20],
|
7905
|
-
multivariate_extras=[ [ "
|
7926
|
+
multivariate_extras=[ [ "CC", btpB0, hier['brain_n4_dnz'], 1, 2 ]],
|
7906
7927
|
initial_transform=initrig
|
7907
7928
|
)
|
7908
7929
|
mybxt = ants.threshold_image( ants.iMath(hier['brain_n4_dnz'], "Normalize" ), 0.001, 1 )
|
@@ -7935,11 +7956,11 @@ def mm(
|
|
7935
7956
|
b_image_list=[a1b,a2b],
|
7936
7957
|
w_image_list=[a1w,a2w],
|
7937
7958
|
iterations=7, verbose=verbose )
|
7938
|
-
initrig = ants.registration( btpDW, hier['brain_n4_dnz'], '
|
7959
|
+
initrig = ants.registration( btpDW, hier['brain_n4_dnz'], 'antsRegistrationSyNRepro[r]' )['fwdtransforms'][0]
|
7939
7960
|
tempreg = ants.registration( btpDW, hier['brain_n4_dnz'], 'SyNOnly',
|
7940
|
-
syn_metric='
|
7961
|
+
syn_metric='CC', syn_sampling=2,
|
7941
7962
|
reg_iterations=[50,50,20],
|
7942
|
-
multivariate_extras=[ [ "
|
7963
|
+
multivariate_extras=[ [ "CC", btpB0, hier['brain_n4_dnz'], 1, 2 ]],
|
7943
7964
|
initial_transform=initrig
|
7944
7965
|
)
|
7945
7966
|
mybxt = ants.threshold_image( ants.iMath(hier['brain_n4_dnz'], "Normalize" ), 0.001, 1 )
|
@@ -7963,7 +7984,7 @@ def mm(
|
|
7963
7984
|
mydti = output_dict['DTI']
|
7964
7985
|
# summarize dwi with T1 outputs
|
7965
7986
|
# first - register ....
|
7966
|
-
reg = ants.registration( mydti['recon_fa'], hier['brain_n4_dnz'], '
|
7987
|
+
reg = ants.registration( mydti['recon_fa'], hier['brain_n4_dnz'], 'antsRegistrationSyNRepro[s]', total_sigma=1.0 )
|
7967
7988
|
##################################################
|
7968
7989
|
output_dict['FA_summ'] = hierarchical_modality_summary(
|
7969
7990
|
mydti['recon_fa'],
|
@@ -8026,7 +8047,7 @@ def mm(
|
|
8026
8047
|
normalization_dict['kk_norm'] = ants.apply_transforms( group_template, output_dict['kk']['thickness_image'], group_transform )
|
8027
8048
|
if output_dict['DTI'] is not None:
|
8028
8049
|
mydti = output_dict['DTI']
|
8029
|
-
dtirig = ants.registration( hier['brain_n4_dnz'], mydti['recon_fa'], '
|
8050
|
+
dtirig = ants.registration( hier['brain_n4_dnz'], mydti['recon_fa'], 'antsRegistrationSyNRepro[r]' )
|
8030
8051
|
normalization_dict['MD_norm'] = ants.apply_transforms( group_template, mydti['recon_md'],group_transform+dtirig['fwdtransforms'] )
|
8031
8052
|
normalization_dict['FA_norm'] = ants.apply_transforms( group_template, mydti['recon_fa'],group_transform+dtirig['fwdtransforms'] )
|
8032
8053
|
output_directory = tempfile.mkdtemp()
|
@@ -8043,7 +8064,7 @@ def mm(
|
|
8043
8064
|
if output_dict['rsf'] is not None:
|
8044
8065
|
if False:
|
8045
8066
|
rsfpro = output_dict['rsf'] # FIXME
|
8046
|
-
rsfrig = ants.registration( hier['brain_n4_dnz'], rsfpro['meanBold'], '
|
8067
|
+
rsfrig = ants.registration( hier['brain_n4_dnz'], rsfpro['meanBold'], 'antsRegistrationSyNRepro[r]' )
|
8047
8068
|
for netid in get_antsimage_keys( rsfpro ):
|
8048
8069
|
rsfkey = netid + "_norm"
|
8049
8070
|
normalization_dict[rsfkey] = ants.apply_transforms(
|
@@ -8797,7 +8818,7 @@ def mm_csv(
|
|
8797
8818
|
srmodel_T1 = False, # optional - will add a great deal of time
|
8798
8819
|
srmodel_NM = False, # optional - will add a great deal of time
|
8799
8820
|
srmodel_DTI = False, # optional - will add a great deal of time
|
8800
|
-
dti_motion_correct = '
|
8821
|
+
dti_motion_correct = 'antsRegistrationSyNQuickRepro[r]',
|
8801
8822
|
dti_denoise = True,
|
8802
8823
|
nrg_modality_list = None,
|
8803
8824
|
normalization_template = None,
|
@@ -10066,7 +10087,10 @@ def augment_image( x, max_rot=10, nzsd=1 ):
|
|
10066
10087
|
|
10067
10088
|
def boot_wmh( flair, t1, t1seg, mmfromconvexhull = 0.0, strict=True,
|
10068
10089
|
probability_mask=None, prior_probability=None, n_simulations=16,
|
10090
|
+
random_seed = 42,
|
10069
10091
|
verbose=False ) :
|
10092
|
+
import random
|
10093
|
+
random.seed( random_seed )
|
10070
10094
|
if verbose and prior_probability is None:
|
10071
10095
|
print("augmented flair")
|
10072
10096
|
if verbose and prior_probability is not None:
|
@@ -11005,7 +11029,7 @@ def wmh( flair, t1, t1seg,
|
|
11005
11029
|
"""
|
11006
11030
|
import numpy as np
|
11007
11031
|
import math
|
11008
|
-
t1_2_flair_reg = ants.registration(flair, t1, type_of_transform = '
|
11032
|
+
t1_2_flair_reg = ants.registration(flair, t1, type_of_transform = 'antsRegistrationSyNRepro[r]') # Register T1 to Flair
|
11009
11033
|
if probability_mask is None and model == 'sysu':
|
11010
11034
|
if verbose:
|
11011
11035
|
print('sysu')
|
@@ -12656,7 +12680,7 @@ def enantiomorphic_filling_without_mask( image, axis=0, intensity='low' ):
|
|
12656
12680
|
imagen = ants.iMath( imagen, "TruncateIntensity", 1e-6, 0.98 )
|
12657
12681
|
imagen = ants.iMath( imagen, 'Normalize' )
|
12658
12682
|
# Create a mirror image (flipping left and right)
|
12659
|
-
mirror_image = ants.reflect_image(imagen, axis=0, tx='
|
12683
|
+
mirror_image = ants.reflect_image(imagen, axis=0, tx='antsRegistrationSyNQuickRepro[s]' )['warpedmovout']
|
12660
12684
|
|
12661
12685
|
# Create a symmetric version of the image by averaging the original and the mirror image
|
12662
12686
|
symmetric_image = imagen * 0.5 + mirror_image * 0.5
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: antspymm
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.6.0
|
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
|
@@ -13,8 +13,8 @@ Requires-Dist: h5py>=2.10.0
|
|
13
13
|
Requires-Dist: numpy>=1.19.4
|
14
14
|
Requires-Dist: pandas>=1.0.1
|
15
15
|
Requires-Dist: antspyx>=0.4.2
|
16
|
-
Requires-Dist: antspynet>=0.
|
17
|
-
Requires-Dist: antspyt1w>=
|
16
|
+
Requires-Dist: antspynet>=0.3.0
|
17
|
+
Requires-Dist: antspyt1w>=1.1.0
|
18
18
|
Requires-Dist: pathlib
|
19
19
|
Requires-Dist: dipy
|
20
20
|
Requires-Dist: nibabel
|
@@ -0,0 +1,6 @@
|
|
1
|
+
antspymm/__init__.py,sha256=4_mZOfEtK-8BwT9qds8XMsr9r8ukVNUd00q6pngZHWQ,4950
|
2
|
+
antspymm/mm.py,sha256=2XzDbTWWcKIzJuYYPjEuwLmShsiMgrZoWzaBtljeKo8,544619
|
3
|
+
antspymm-1.6.0.dist-info/METADATA,sha256=yQ-GUGbKV4Ni1aZdVoCAKEUE6JXduzXZ-F5ya3QPHko,26007
|
4
|
+
antspymm-1.6.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
5
|
+
antspymm-1.6.0.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
|
6
|
+
antspymm-1.6.0.dist-info/RECORD,,
|
antspymm-1.5.7.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
antspymm/__init__.py,sha256=cTcqtGO0J5T2I0Chxe-Sy25QDlnHLDEQK8QEnJkkFRs,4900
|
2
|
-
antspymm/mm.py,sha256=eqMcRxQt03AbC3qRrubYBxGsbkKNfrS0dd9VgqXavCE,544991
|
3
|
-
antspymm-1.5.7.dist-info/METADATA,sha256=c-2SVYUIR2RGZ_XJXE8M1nxG94CpF9-fYBiRERaCHhQ,26007
|
4
|
-
antspymm-1.5.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
5
|
-
antspymm-1.5.7.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
|
6
|
-
antspymm-1.5.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|