Skip to content

Commit 0779455

Browse files
committed
DOC: minimum spacing for SR on T1
1 parent 208e1a6 commit 0779455

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

antspymm/mm.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8825,6 +8825,7 @@ def mm_csv(
88258825
perfusion_m0 = None,
88268826
rsf_upsampling = 3.0,
88278827
pet3d = None,
8828+
min_t1_spacing_for_sr = 0.8,
88288829
):
88298830
"""
88308831
too dangerous to document ... use with care.
@@ -8909,6 +8910,10 @@ def mm_csv(
89098910

89108911
pet3d : optional antsImage for PET (or other 3d scalar) data which we want to summarize
89118912

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+
89128917
Returns
89138918
---------
89148919

@@ -9010,7 +9015,8 @@ def makewideout( x, separator = mysep ):
90109015
srmodel_T1_mdl = tf.keras.models.load_model( srmodel_T1, compile=False )
90119016
if verbose:
90129017
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 )
90149020
if not hierexists and not testloop:
90159021
subjectpropath = os.path.dirname( hierfn )
90169022
if verbose:
@@ -13053,6 +13059,7 @@ def t1w_super_resolution_with_hemispheres(
1305313059
truncation=[0.001, 0.999],
1305413060
target_range=[0, 1],
1305513061
poly_order="hist",
13062+
min_spacing=0.8,
1305613063
verbose=True
1305713064
):
1305813065
"""
@@ -13082,6 +13089,10 @@ def t1w_super_resolution_with_hemispheres(
1308213089
poly_order : str or int
1308313090
Polynomial order or "hist" for histogram matching after SR.
1308413091

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+
1308513096
verbose : bool
1308613097
If True, print progress updates.
1308713098

@@ -13090,7 +13101,7 @@ def t1w_super_resolution_with_hemispheres(
1309013101
ANTsImage
1309113102
Super-resolved T1-weighted image.
1309213103
"""
13093-
if np.min(ants.get_spacing(t1img)) < 0.8:
13104+
if np.min(ants.get_spacing(t1img)) < min_spacing:
1309413105
if verbose:
1309513106
print("Image resolution too high — skipping SR.")
1309613107
return t1img

0 commit comments

Comments
 (0)