Skip to content

Width and height swapped when creating test image in data/synthetic/create_test_image_2d #5373

@Warvito

Description

@Warvito

Describe the bug
When creating a test image with data/synthetic/create_test_image_2d, it looks like the dimensions of the image are defined like (width, height) instead (height, width).

image = np.zeros((width, height))

This way, it can be a little confusing when creating test images. For example, in NumpyImageTestCase2D, we pass the dimensions as create_test_image_2d(self.im_shape[0], self.im_shape[1]... in

self.im_shape[0], self.im_shape[1], num_objs=4, rad_max=20, noise_max=0.0, num_seg_classes=self.num_classes

and inside create_test_image_2d, self.im_shape[0] is assign as width and self.im_shape[1] as height, because of the ordering that the args are defined in

width: int,

But when we create a test image using NumpyImageTestCase3D, we still pass the dimensions as create_test_image_3d(self.im_shape[0], self.im_shape[1], self.im_shape[2], ... in

self.im_shape[0],

but this time, self.im_shape[0] is assign as height and self.im_shape[1] as width because of the Args ordering in

height: int,

Additional context
It can make a little confusing to interpret tests like these:

expected_shape = (1, self.input_channels, self.im_shape[0], self.im_shape[1])

expected_shape = (1, self.input_channels, self.im_shape[1], self.im_shape[0], self.im_shape[2])

or when creating tests to check the shape of the output of the networks.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions