Skip to content

Commit 1284529

Browse files
committed
style(auto3dseg): format analyzer with black
Signed-off-by: Jun Hyeok Lee <bluehyena123@naver.com>
1 parent a975397 commit 1284529

1 file changed

Lines changed: 15 additions & 5 deletions

File tree

monai/auto3dseg/analyzer.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ def __call__(self, data):
283283
a * b for a, b in zip(report[ImageStatsKeys.SHAPE][0], report[ImageStatsKeys.SPACING])
284284
]
285285

286-
report[ImageStatsKeys.INTENSITY] = [self.ops[ImageStatsKeys.INTENSITY].evaluate(nda_c) for nda_c in nda_croppeds]
286+
report[ImageStatsKeys.INTENSITY] = [
287+
self.ops[ImageStatsKeys.INTENSITY].evaluate(nda_c) for nda_c in nda_croppeds
288+
]
287289

288290
if not verify_report_format(report, self.get_report_format()):
289291
raise RuntimeError(f"report generated by {self.__class__} differs from the report format.")
@@ -358,7 +360,9 @@ def __call__(self, data: Mapping) -> dict:
358360

359361
report = deepcopy(self.get_report_format())
360362

361-
report[ImageStatsKeys.INTENSITY] = [self.ops[ImageStatsKeys.INTENSITY].evaluate(nda_f) for nda_f in nda_foregrounds]
363+
report[ImageStatsKeys.INTENSITY] = [
364+
self.ops[ImageStatsKeys.INTENSITY].evaluate(nda_f) for nda_f in nda_foregrounds
365+
]
362366

363367
if not verify_report_format(report, self.get_report_format()):
364368
raise RuntimeError(f"report generated by {self.__class__} differs from the report format.")
@@ -474,7 +478,9 @@ def __call__(self, data: Mapping[Hashable, MetaTensor]) -> dict[Hashable, MetaTe
474478
isinstance(t, (torch.Tensor, MetaTensor)) and t.device.type == "cuda" for t in (image_tensor, label_tensor)
475479
)
476480

477-
if isinstance(image_tensor, (MetaTensor, torch.Tensor)) and isinstance(label_tensor, (MetaTensor, torch.Tensor)):
481+
if isinstance(image_tensor, (MetaTensor, torch.Tensor)) and isinstance(
482+
label_tensor, (MetaTensor, torch.Tensor)
483+
):
478484
if label_tensor.device != image_tensor.device:
479485
if using_cuda:
480486
cuda_device = image_tensor.device if image_tensor.device.type == "cuda" else label_tensor.device
@@ -507,7 +513,9 @@ def __call__(self, data: Mapping[Hashable, MetaTensor]) -> dict[Hashable, MetaTe
507513
mask_index = ndas_label == index
508514

509515
nda_masks = [nda[mask_index] for nda in ndas]
510-
label_dict[LabelStatsKeys.IMAGE_INTST] = [self.ops[LabelStatsKeys.IMAGE_INTST].evaluate(nda_m) for nda_m in nda_masks]
516+
label_dict[LabelStatsKeys.IMAGE_INTST] = [
517+
self.ops[LabelStatsKeys.IMAGE_INTST].evaluate(nda_m) for nda_m in nda_masks
518+
]
511519

512520
pixel_count = sum(mask_index)
513521
pixel_arr.append(pixel_count)
@@ -530,7 +538,9 @@ def __call__(self, data: Mapping[Hashable, MetaTensor]) -> dict[Hashable, MetaTe
530538

531539
report = deepcopy(self.get_report_format())
532540
report[LabelStatsKeys.LABEL_UID] = unique_label
533-
report[LabelStatsKeys.IMAGE_INTST] = [self.ops[LabelStatsKeys.IMAGE_INTST].evaluate(nda_f) for nda_f in nda_foregrounds]
541+
report[LabelStatsKeys.IMAGE_INTST] = [
542+
self.ops[LabelStatsKeys.IMAGE_INTST].evaluate(nda_f) for nda_f in nda_foregrounds
543+
]
534544
report[LabelStatsKeys.LABEL] = label_substats
535545

536546
if not verify_report_format(report, self.get_report_format()):

0 commit comments

Comments
 (0)