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