@@ -204,7 +204,7 @@ def _transformation_constructor(self):
204
204
return "" .join (retval )
205
205
206
206
def _regularization_constructor (self ):
207
- return "--regularization {}[{},{}]" .format (
207
+ return "--regularization {}[{},{}]" .format ( # noqa: UP032
208
208
self .inputs .regularization ,
209
209
self .inputs .regularization_gradient_field_sigma ,
210
210
self .inputs .regularization_deformation_field_sigma ,
@@ -1241,7 +1241,7 @@ def _format_winsorize_image_intensities(self):
1241
1241
)
1242
1242
)
1243
1243
self ._quantilesDone = True
1244
- return "--winsorize-image-intensities [ {}, {} ]" .format (
1244
+ return "--winsorize-image-intensities [ {}, {} ]" .format ( # noqa: UP032
1245
1245
self .inputs .winsorize_lower_quantile ,
1246
1246
self .inputs .winsorize_upper_quantile ,
1247
1247
)
@@ -1268,12 +1268,12 @@ def _get_initial_transform_filenames(self):
1268
1268
def _format_arg (self , opt , spec , val ):
1269
1269
if opt == "fixed_image_mask" :
1270
1270
if isdefined (self .inputs .moving_image_mask ):
1271
- return "--masks [ {}, {} ]" .format (
1271
+ return "--masks [ {}, {} ]" .format ( # noqa: UP032
1272
1272
self .inputs .fixed_image_mask ,
1273
1273
self .inputs .moving_image_mask ,
1274
1274
)
1275
1275
else :
1276
- return "--masks %s" % self .inputs .fixed_image_mask
1276
+ return "--masks {}" . format ( self .inputs .fixed_image_mask ) # noqa: UP032
1277
1277
elif opt == "transforms" :
1278
1278
return self ._format_registration ()
1279
1279
elif opt == "initial_moving_transform" :
@@ -1308,18 +1308,20 @@ def _format_arg(self, opt, spec, val):
1308
1308
out_filename = self ._get_outputfilenames (inverse = False )
1309
1309
inv_out_filename = self ._get_outputfilenames (inverse = True )
1310
1310
if out_filename and inv_out_filename :
1311
- return "--output [ {}, {}, {} ]" .format (
1311
+ return "--output [ {}, {}, {} ]" .format ( # noqa: UP032
1312
1312
self .inputs .output_transform_prefix ,
1313
1313
out_filename ,
1314
1314
inv_out_filename ,
1315
1315
)
1316
1316
elif out_filename :
1317
- return "--output [ {}, {} ]" .format (
1317
+ return "--output [ {}, {} ]" .format ( # noqa: UP032
1318
1318
self .inputs .output_transform_prefix ,
1319
1319
out_filename ,
1320
1320
)
1321
1321
else :
1322
- return "--output %s" % self .inputs .output_transform_prefix
1322
+ return "--output {}" .format ( # noqa: UP032
1323
+ self .inputs .output_transform_prefix ,
1324
+ )
1323
1325
elif opt == "winsorize_upper_quantile" or opt == "winsorize_lower_quantile" :
1324
1326
if not self ._quantilesDone :
1325
1327
return self ._format_winsorize_image_intensities ()
@@ -1590,7 +1592,7 @@ class MeasureImageSimilarity(ANTSCommand):
1590
1592
def _metric_constructor (self ):
1591
1593
retval = (
1592
1594
'--metric {metric}["{fixed_image}","{moving_image}",{metric_weight},'
1593
- "{radius_or_number_of_bins},{sampling_strategy},{sampling_percentage}]" .format (
1595
+ "{radius_or_number_of_bins},{sampling_strategy},{sampling_percentage}]" .format ( # noqa: UP032
1594
1596
metric = self .inputs .metric ,
1595
1597
fixed_image = self .inputs .fixed_image ,
1596
1598
moving_image = self .inputs .moving_image ,
@@ -1604,13 +1606,13 @@ def _metric_constructor(self):
1604
1606
1605
1607
def _mask_constructor (self ):
1606
1608
if self .inputs .moving_image_mask :
1607
- retval = '--masks ["{fixed_image_mask}","{moving_image_mask}"]' .format (
1609
+ retval = '--masks ["{fixed_image_mask}","{moving_image_mask}"]' .format ( # noqa: UP032
1608
1610
fixed_image_mask = self .inputs .fixed_image_mask ,
1609
1611
moving_image_mask = self .inputs .moving_image_mask ,
1610
1612
)
1611
1613
else :
1612
- retval = '--masks "{fixed_image_mask }"' .format (
1613
- fixed_image_mask = self .inputs .fixed_image_mask
1614
+ retval = '--masks "{}"' .format ( # noqa: UP032
1615
+ fixed_image_mask = self .inputs .fixed_image_mask ,
1614
1616
)
1615
1617
return retval
1616
1618
@@ -1870,9 +1872,7 @@ def _list_outputs(self):
1870
1872
f"00_{ self .inputs .output_prefix } _AffineTransform.mat"
1871
1873
)
1872
1874
outputs ["displacement_field" ] = os .path .abspath (
1873
- "01_{}_DisplacementFieldTransform.nii.gz" .format (
1874
- self .inputs .output_prefix
1875
- )
1875
+ f"01_{ self .inputs .output_prefix } _DisplacementFieldTransform.nii.gz"
1876
1876
)
1877
1877
if self .inputs .process == "assemble" :
1878
1878
outputs ["out_file" ] = os .path .abspath (self .inputs .out_file )
0 commit comments