Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion monai/networks/blocks/feature_pyramid_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,6 @@ def forward(self, x: Dict[str, Tensor]) -> Dict[str, Tensor]:
results, names = self.extra_blocks(results, x_values, names)

# make it back an OrderedDict
out = OrderedDict([(k, v) for k, v in zip(names, results)])
out = OrderedDict(list(zip(names, results)))

return out
12 changes: 6 additions & 6 deletions monai/networks/blocks/fft_utils_t.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ def ifftn_centered_t(ksp: Tensor, spatial_dims: int, is_complex: bool = True) ->
output2 = ifftn_centered(ksp, spatial_dims=2, is_complex=True)
"""
# define spatial dims to perform ifftshift, fftshift, and ifft
shift = [i for i in range(-spatial_dims, 0)] # noqa: C416
shift = list(range(-spatial_dims, 0)) # noqa: C416
if is_complex:
if ksp.shape[-1] != 2:
raise ValueError(f"ksp.shape[-1] is not 2 ({ksp.shape[-1]}).")
shift = [i for i in range(-spatial_dims - 1, -1)] # noqa: C416
dims = [i for i in range(-spatial_dims, 0)] # noqa: C416
shift = list(range(-spatial_dims - 1, -1)) # noqa: C416
dims = list(range(-spatial_dims, 0)) # noqa: C416

x = ifftshift(ksp, shift)

Expand Down Expand Up @@ -187,12 +187,12 @@ def fftn_centered_t(im: Tensor, spatial_dims: int, is_complex: bool = True) -> T
output2 = fftn_centered(im, spatial_dims=2, is_complex=True)
"""
# define spatial dims to perform ifftshift, fftshift, and fft
shift = [i for i in range(-spatial_dims, 0)] # noqa: C416
shift = list(range(-spatial_dims, 0)) # noqa: C416
if is_complex:
if im.shape[-1] != 2:
raise ValueError(f"img.shape[-1] is not 2 ({im.shape[-1]}).")
shift = [i for i in range(-spatial_dims - 1, -1)] # noqa: C416
dims = [i for i in range(-spatial_dims, 0)] # noqa: C416
shift = list(range(-spatial_dims - 1, -1)) # noqa: C416
dims = list(range(-spatial_dims, 0)) # noqa: C416

x = ifftshift(im, shift)

Expand Down
2 changes: 1 addition & 1 deletion monai/transforms/utility/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def __call__(
output = []
results = [self.splitter(d[key]) for key in all_keys]
for row in zip(*results):
new_dict = {k: v for k, v in zip(all_keys, row)}
new_dict = dict(zip(all_keys, row))
# fill in the extra keys with unmodified data
for k in set(d.keys()).difference(set(all_keys)):
new_dict[k] = deepcopy(d[k])
Expand Down
2 changes: 1 addition & 1 deletion tests/test_k_space_spike_noised.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_data(im_shape, im_type):
create_test_image = create_test_image_2d if len(im_shape) == 2 else create_test_image_3d
ims = create_test_image(*im_shape, rad_max=20, noise_max=0.0, num_seg_classes=5)
ims = [im_type(im[None]) for im in ims]
return {k: v for k, v in zip(KEYS, ims)}
return dict(zip(KEYS, ims))

@parameterized.expand(TESTS)
def test_same_result(self, im_shape, im_type):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_rand_k_space_spike_noised.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def get_data(im_shape, im_type):
create_test_image = create_test_image_2d if len(im_shape) == 2 else create_test_image_3d
ims = create_test_image(*im_shape, rad_max=20, noise_max=0.0, num_seg_classes=5)
ims = [im_type(im[None]) for im in ims]
return {k: v for k, v in zip(KEYS, ims)}
return dict(zip(KEYS, ims))

@parameterized.expand(TESTS)
def test_same_result(self, im_shape, im_type):
Expand Down