|
87 | 87 | # to remove external dependency.
|
88 | 88 | # ------------------------------------------------------------------------------
|
89 | 89 |
|
| 90 | + |
90 | 91 | def drop_empty_slice(slices, empty_threshold: float):
|
91 | 92 | """
|
92 | 93 | Decide which 2D slices to keep by checking if their maximum intensity
|
@@ -317,6 +318,7 @@ def get_features_2p5d(
|
317 | 318 |
|
318 | 319 | return feature_image_xy, feature_image_yz, feature_image_zx
|
319 | 320 |
|
| 321 | + |
320 | 322 | # ------------------------------------------------------------------------------
|
321 | 323 | # End inline fid_utils code
|
322 | 324 | # ------------------------------------------------------------------------------
|
@@ -490,17 +492,15 @@ def main(
|
490 | 492 | ]
|
491 | 493 |
|
492 | 494 | 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"])) |
496 | 496 | if enable_padding:
|
497 | 497 | 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 | + ) |
499 | 501 | )
|
500 | 502 | 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)) |
504 | 504 |
|
505 | 505 | # Intensity scaling to clamp between [-1000, 1000]
|
506 | 506 | transform_list.append(
|
@@ -604,8 +604,12 @@ def main(
|
604 | 604 | # All-reduce / gather features across ranks
|
605 | 605 | # -------------------------------------------------------------------------
|
606 | 606 | 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, |
609 | 613 | ]
|
610 | 614 |
|
611 | 615 | # 1) Gather local feature sizes across ranks
|
|
0 commit comments