@@ -8825,6 +8825,7 @@ def mm_csv(
8825
8825
perfusion_m0 = None,
8826
8826
rsf_upsampling = 3.0,
8827
8827
pet3d = None,
8828
+ min_t1_spacing_for_sr = 0.8,
8828
8829
):
8829
8830
"""
8830
8831
too dangerous to document ... use with care.
@@ -8909,6 +8910,10 @@ def mm_csv(
8909
8910
8910
8911
pet3d : optional antsImage for PET (or other 3d scalar) data which we want to summarize
8911
8912
8913
+ min_t1_spacing_for_sr : float
8914
+ if the minimum input image spacing is less than this value,
8915
+ the function will return the original image. Default 0.8.
8916
+
8912
8917
Returns
8913
8918
---------
8914
8919
@@ -9010,7 +9015,8 @@ def makewideout( x, separator = mysep ):
9010
9015
srmodel_T1_mdl = tf.keras.models.load_model( srmodel_T1, compile=False )
9011
9016
if verbose:
9012
9017
print("Convert T1w to SR via model ", srmodel_T1 )
9013
- t1 = t1w_super_resolution_with_hemispheres( t1, srmodel_T1_mdl )
9018
+ t1 = t1w_super_resolution_with_hemispheres( t1, srmodel_T1_mdl,
9019
+ min_spacing=min_t1_spacing_for_sr )
9014
9020
if not hierexists and not testloop:
9015
9021
subjectpropath = os.path.dirname( hierfn )
9016
9022
if verbose:
@@ -13053,6 +13059,7 @@ def t1w_super_resolution_with_hemispheres(
13053
13059
truncation=[0.001, 0.999],
13054
13060
target_range=[0, 1],
13055
13061
poly_order="hist",
13062
+ min_spacing=0.8,
13056
13063
verbose=True
13057
13064
):
13058
13065
"""
@@ -13082,6 +13089,10 @@ def t1w_super_resolution_with_hemispheres(
13082
13089
poly_order : str or int
13083
13090
Polynomial order or "hist" for histogram matching after SR.
13084
13091
13092
+ min_spacing : float
13093
+ if the minimum input image spacing is less than this value,
13094
+ the function will return the original image. Default 0.8.
13095
+
13085
13096
verbose : bool
13086
13097
If True, print progress updates.
13087
13098
@@ -13090,7 +13101,7 @@ def t1w_super_resolution_with_hemispheres(
13090
13101
ANTsImage
13091
13102
Super-resolved T1-weighted image.
13092
13103
"""
13093
- if np.min(ants.get_spacing(t1img)) < 0.8 :
13104
+ if np.min(ants.get_spacing(t1img)) < min_spacing :
13094
13105
if verbose:
13095
13106
print("Image resolution too high — skipping SR.")
13096
13107
return t1img
0 commit comments