Skip to content

Commit 327a92f

Browse files
committed
update
Signed-off-by: dongyang0122 <[email protected]>
2 parents ed3d194 + bbae516 commit 327a92f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

generation/maisi/scripts/compute_fid2p5d_ct.py

+13-9
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
# to remove external dependency.
8888
# ------------------------------------------------------------------------------
8989

90+
9091
def drop_empty_slice(slices, empty_threshold: float):
9192
"""
9293
Decide which 2D slices to keep by checking if their maximum intensity
@@ -317,6 +318,7 @@ def get_features_2p5d(
317318

318319
return feature_image_xy, feature_image_yz, feature_image_zx
319320

321+
320322
# ------------------------------------------------------------------------------
321323
# End inline fid_utils code
322324
# ------------------------------------------------------------------------------
@@ -490,17 +492,15 @@ def main(
490492
]
491493

492494
if enable_resampling:
493-
transform_list.append(
494-
monai.transforms.Spacingd(keys=["image"], pixdim=rs_spacing_tuple, mode=["bilinear"])
495-
)
495+
transform_list.append(monai.transforms.Spacingd(keys=["image"], pixdim=rs_spacing_tuple, mode=["bilinear"]))
496496
if enable_padding:
497497
transform_list.append(
498-
monai.transforms.SpatialPadd(keys=["image"], spatial_size=target_shape_tuple, mode=["constant"], value=-1000)
498+
monai.transforms.SpatialPadd(
499+
keys=["image"], spatial_size=target_shape_tuple, mode=["constant"], value=-1000
500+
)
499501
)
500502
if enable_center_cropping:
501-
transform_list.append(
502-
monai.transforms.CenterSpatialCropd(keys=["image"], roi_size=target_shape_tuple)
503-
)
503+
transform_list.append(monai.transforms.CenterSpatialCropd(keys=["image"], roi_size=target_shape_tuple))
504504

505505
# Intensity scaling to clamp between [-1000, 1000]
506506
transform_list.append(
@@ -604,8 +604,12 @@ def main(
604604
# All-reduce / gather features across ranks
605605
# -------------------------------------------------------------------------
606606
features = [
607-
real_features_xy, real_features_yz, real_features_zx,
608-
synth_features_xy, synth_features_yz, synth_features_zx
607+
real_features_xy,
608+
real_features_yz,
609+
real_features_zx,
610+
synth_features_xy,
611+
synth_features_yz,
612+
synth_features_zx,
609613
]
610614

611615
# 1) Gather local feature sizes across ranks

0 commit comments

Comments
 (0)