antspymm 1.3.4__py3-none-any.whl → 1.3.5__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 +37 -10
- {antspymm-1.3.4.dist-info → antspymm-1.3.5.dist-info}/METADATA +1 -1
- antspymm-1.3.5.dist-info/RECORD +7 -0
- antspymm-1.3.4.dist-info/RECORD +0 -7
- {antspymm-1.3.4.dist-info → antspymm-1.3.5.dist-info}/LICENSE +0 -0
- {antspymm-1.3.4.dist-info → antspymm-1.3.5.dist-info}/WHEEL +0 -0
- {antspymm-1.3.4.dist-info → antspymm-1.3.5.dist-info}/top_level.txt +0 -0
antspymm/mm.py
CHANGED
@@ -3451,6 +3451,9 @@ def dipy_dti_recon(
|
|
3451
3451
|
bvals = bvalsfn.copy()
|
3452
3452
|
bvecs = bvecsfn.copy()
|
3453
3453
|
|
3454
|
+
if bvals.max() < 1.0:
|
3455
|
+
raise ValueError("DTI recon error: maximum bvalues are too small.")
|
3456
|
+
|
3454
3457
|
b0_idx = segment_timeseries_by_bvalue( bvals )['highermeans']
|
3455
3458
|
|
3456
3459
|
b0 = ants.slice_image( image, axis=3, idx=b0_idx[0] )
|
@@ -7975,16 +7978,21 @@ def mm_csv(
|
|
7975
7978
|
hier['dataframes'], identifier=None )
|
7976
7979
|
t1wide.to_csv( hierfn + 'mmwide.csv' )
|
7977
7980
|
################# read the hierarchical data ###############################
|
7981
|
+
# over-write the rbp data with a consistent and recent approach ############
|
7982
|
+
myx = antspyt1w.inspect_raw_t1( t1, hierfn + 'rbp' , option='both' )
|
7983
|
+
del myx
|
7978
7984
|
hier = antspyt1w.read_hierarchical( hierfn )
|
7979
7985
|
if exists( hierfn + 'mmwide.csv' ) :
|
7980
7986
|
t1wide = pd.read_csv( hierfn + 'mmwide.csv' )
|
7981
7987
|
elif not testloop:
|
7982
7988
|
t1wide = antspyt1w.merge_hierarchical_csvs_to_wide_format(
|
7983
7989
|
hier['dataframes'], identifier=None )
|
7984
|
-
|
7985
|
-
|
7990
|
+
rgrade = str( t1wide['resnetGrade'].iloc[0] )
|
7991
|
+
if t1wide['resnetGrade'].iloc[0] < 0.20:
|
7986
7992
|
warnings.warn('T1w quality check indicates failure: ' + rgrade + " will not process." )
|
7987
7993
|
return
|
7994
|
+
else:
|
7995
|
+
print('T1w quality check indicates success: ' + rgrade + " will process." )
|
7988
7996
|
|
7989
7997
|
if srmodel_T1 is not False :
|
7990
7998
|
hierfntest = hierfnSR + 'mtl.csv'
|
@@ -9544,6 +9552,7 @@ def blind_image_assessment(
|
|
9544
9552
|
image_reference = ants.image_clone( image )
|
9545
9553
|
ntimepoints = 1
|
9546
9554
|
bvalueMax=None
|
9555
|
+
bvecnorm=None
|
9547
9556
|
if image_reference.dimension == 4:
|
9548
9557
|
ntimepoints = image_reference.shape[3]
|
9549
9558
|
if "DTI" in image_filename:
|
@@ -9556,6 +9565,8 @@ def blind_image_assessment(
|
|
9556
9565
|
if exists( bval_name ) and exists( bvec_name ):
|
9557
9566
|
bvals, bvecs = read_bvals_bvecs( bval_name , bvec_name )
|
9558
9567
|
bvalueMax = bvals.max()
|
9568
|
+
bvecnorm = np.linalg.norm(bvecs,axis=1).reshape( bvecs.shape[0],1 )
|
9569
|
+
bvecnorm = bvecnorm.max()
|
9559
9570
|
else:
|
9560
9571
|
image_b0 = ants.get_average_of_timeseries( image_reference ).iMath("Normalize")
|
9561
9572
|
else:
|
@@ -9721,11 +9732,11 @@ def blind_image_assessment(
|
|
9721
9732
|
noizlevel, snrref, cnrref, psnrref, ssimref, mymi, asym_err, myevr, msk_vol,
|
9722
9733
|
spc[0], spc[1], spc[2],org[0], org[1], org[2],
|
9723
9734
|
image.shape[0], image.shape[1], image.shape[2], ntimepoints,
|
9724
|
-
jjj, modality, mriseries, mrimfg, mrimodel, MagneticFieldStrength, mriSAR, PixelBandwidth, BandwidthPerPixelPhaseEncode, bvalueMax ]],
|
9735
|
+
jjj, modality, mriseries, mrimfg, mrimodel, MagneticFieldStrength, mriSAR, PixelBandwidth, BandwidthPerPixelPhaseEncode, bvalueMax, bvecnorm ]],
|
9725
9736
|
columns=[
|
9726
9737
|
'filename',
|
9727
9738
|
'dimensionality',
|
9728
|
-
'noise', 'snr', 'cnr', 'psnr', 'ssim', 'mi', 'reflection_err', 'EVR', 'msk_vol', 'spc0','spc1','spc2','org0','org1','org2','dimx','dimy','dimz','dimt','slice','modality', 'mriseries', 'mrimfg', 'mrimodel', 'mriMagneticFieldStrength', 'mriSAR', 'mriPixelBandwidth', 'mriPixelBandwidthPE', 'dti_bvalueMax' ])
|
9739
|
+
'noise', 'snr', 'cnr', 'psnr', 'ssim', 'mi', 'reflection_err', 'EVR', 'msk_vol', 'spc0','spc1','spc2','org0','org1','org2','dimx','dimy','dimz','dimt','slice','modality', 'mriseries', 'mrimfg', 'mrimodel', 'mriMagneticFieldStrength', 'mriSAR', 'mriPixelBandwidth', 'mriPixelBandwidthPE', 'dti_bvalueMax', 'dti_bvecnorm' ])
|
9729
9740
|
outdf = pd.concat( [outdf, df ], axis=0, ignore_index=False )
|
9730
9741
|
if verbose:
|
9731
9742
|
print( outdf )
|
@@ -10893,6 +10904,7 @@ def aggregate_antspymm_results_sdf(
|
|
10893
10904
|
splitsep='-',
|
10894
10905
|
idsep='-',
|
10895
10906
|
wild_card_modality_id=False,
|
10907
|
+
second_split=False,
|
10896
10908
|
verbose=False ):
|
10897
10909
|
"""
|
10898
10910
|
Aggregate ANTsPyMM results from the specified study data frame and store the aggregated results in a new data frame. This assumes data is organized on disk
|
@@ -10911,6 +10923,7 @@ def aggregate_antspymm_results_sdf(
|
|
10911
10923
|
- idsep (str): the separator used to partition subjectid date and imageid
|
10912
10924
|
for example, if idsep is - then we have subjectid-date-imageid
|
10913
10925
|
- wild_card_modality_id (bool): keep if False for safer execution
|
10926
|
+
- second_split (bool): this is a hack that will split the imageID by . and keep the first part of the split; may be needed when the input filenames contain .
|
10914
10927
|
- verbose : boolean
|
10915
10928
|
|
10916
10929
|
Note:
|
@@ -10992,12 +11005,24 @@ def aggregate_antspymm_results_sdf(
|
|
10992
11005
|
myproj = str(df[project_col].iloc[x])
|
10993
11006
|
mydate = str(df[date_col].iloc[x])
|
10994
11007
|
myid = str(df[image_col].iloc[x])
|
11008
|
+
if second_split:
|
11009
|
+
myid = myid.split(".")[0]
|
10995
11010
|
path_template = base_path + "/" + myproj + "/" + sid + "/" + mydate + '/' + hiervariable + '/' + str(myid) + "/"
|
10996
11011
|
hierfn = sorted(glob( path_template + "*" + hiervariable + "*wide.csv" ) )
|
11012
|
+
if len( hierfn ) == 0:
|
11013
|
+
print( hierfn )
|
11014
|
+
print( path_template )
|
11015
|
+
print( myproj )
|
11016
|
+
print( sid )
|
11017
|
+
print( mydate )
|
11018
|
+
print( myid )
|
10997
11019
|
if len( hierfn ) > 0:
|
10998
11020
|
keep[x]=True
|
10999
11021
|
|
11000
|
-
df=df[keep]
|
11022
|
+
# df=df[keep]
|
11023
|
+
if df.shape[0] == 0:
|
11024
|
+
warnings.warn("input data frame shape is filtered down to zero")
|
11025
|
+
return df
|
11001
11026
|
|
11002
11027
|
if not df.index.is_unique:
|
11003
11028
|
warnings.warn("data frame does not have unique indices. we therefore reset the index to allow the function to continue on." )
|
@@ -11030,7 +11055,8 @@ def aggregate_antspymm_results_sdf(
|
|
11030
11055
|
myproj = str(df[project_col].iloc[x])
|
11031
11056
|
mydate = str(df[date_col].iloc[x])
|
11032
11057
|
myid = str(df[image_col].iloc[x])
|
11033
|
-
|
11058
|
+
if second_split:
|
11059
|
+
myid = myid.split(".")[0]
|
11034
11060
|
if verbose:
|
11035
11061
|
print( myfn )
|
11036
11062
|
print( temp )
|
@@ -11090,7 +11116,6 @@ def aggregate_antspymm_results_sdf(
|
|
11090
11116
|
nlarge = len(t1wfn)
|
11091
11117
|
t1wfn = find_most_recent_file( t1wfn )
|
11092
11118
|
warnings.warn("there are " + str( nlarge ) + " number of wide fns with search path " + modsearch + " we take the most recent of these " + t1wfn[0] )
|
11093
|
-
# raise ValueError("there are " + str( len( t1wfn ) ) + " number of wide fns with search path " + modsearch )
|
11094
11119
|
if len( t1wfn ) == 1:
|
11095
11120
|
if verbose:
|
11096
11121
|
print(t1wfn)
|
@@ -11108,9 +11133,11 @@ def aggregate_antspymm_results_sdf(
|
|
11108
11133
|
hdf.index = subdf.index.copy()
|
11109
11134
|
subdf = pd.concat( [subdf,hdf], axis=1, ignore_index=False)
|
11110
11135
|
dfout = pd.concat( [dfout,subdf], axis=0, ignore_index=False )
|
11111
|
-
|
11112
|
-
dfout
|
11113
|
-
|
11136
|
+
|
11137
|
+
if dfout.shape[0] > 0:
|
11138
|
+
badnames = get_names_from_data_frame( ['Unnamed'], dfout )
|
11139
|
+
dfout=dfout.drop(badnames, axis=1)
|
11140
|
+
return dfout
|
11114
11141
|
|
11115
11142
|
def enantiomorphic_filling_without_mask( image, axis=0, intensity='low' ):
|
11116
11143
|
"""
|
@@ -0,0 +1,7 @@
|
|
1
|
+
antspymm/__init__.py,sha256=1fHqufHndrkJwz473av8qOf5-1xm5r-aKHuMAETGIiE,4462
|
2
|
+
antspymm/mm.py,sha256=7UVUV4vASSwsASTT2aObJX4dg7mU28K4H85106BTuXM,479710
|
3
|
+
antspymm-1.3.5.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
4
|
+
antspymm-1.3.5.dist-info/METADATA,sha256=sJaL9YV5hUbe04k_j8YG0DhiNyyJc9CMBo-AdWDH6-M,14590
|
5
|
+
antspymm-1.3.5.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
+
antspymm-1.3.5.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
|
7
|
+
antspymm-1.3.5.dist-info/RECORD,,
|
antspymm-1.3.4.dist-info/RECORD
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
antspymm/__init__.py,sha256=1fHqufHndrkJwz473av8qOf5-1xm5r-aKHuMAETGIiE,4462
|
2
|
-
antspymm/mm.py,sha256=FbboL-Mdg6KTzWvAm770qaKEMLB9wK_isrBmqVbqyQw,478666
|
3
|
-
antspymm-1.3.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
4
|
-
antspymm-1.3.4.dist-info/METADATA,sha256=EwUjVut7HWbQQlz-kUaf5qFrfYXXuPXPL5mmeiXdW3A,14590
|
5
|
-
antspymm-1.3.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
6
|
-
antspymm-1.3.4.dist-info/top_level.txt,sha256=iyD1sRhCKzfwKRJLq5ZUeV9xsv1cGQl8Ejp6QwXM1Zg,9
|
7
|
-
antspymm-1.3.4.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|