Skip to content

Commit c3db337

Browse files
calculate min/max foreground (#3826)
Signed-off-by: Yiheng Wang <[email protected]>
1 parent 384c718 commit c3db337

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

monai/data/dataset_summary.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ def calculate_statistics(self, foreground_threshold: int = 0):
140140
image, *_ = convert_data_type(data=image, output_type=torch.Tensor)
141141
label, *_ = convert_data_type(data=label, output_type=torch.Tensor)
142142

143-
voxel_max.append(image.max().item())
144-
voxel_min.append(image.min().item())
145-
146143
image_foreground = image[torch.where(label > foreground_threshold)]
144+
145+
voxel_max.append(image_foreground.max().item())
146+
voxel_min.append(image_foreground.min().item())
147147
voxel_ct += len(image_foreground)
148148
voxel_sum += image_foreground.sum()
149149
voxel_square_sum += torch.square(image_foreground).sum()

0 commit comments

Comments
 (0)