Skip to content

Conversation

@eteq
Copy link
Member

@eteq eteq commented Jun 27, 2025

As diuscussed with @mwcraig out-of-band, we realized image_height and image_width shouldn't be attributes since it may be label dependent. This changes them to be method-accessible instead of attributes

@eteq eteq requested a review from mwcraig June 29, 2025 21:24
Copy link
Member

@mwcraig mwcraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one minor change and a longer, rambling question...

def test_width_height(self, data: np.ndarray):
self.image.load_image(NDData(data=data))
assert self.image.get_shape().width == 150
assert self.image.get_shape().height == 100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please also add a test that get_shape returns an ImageShape?

"ImageShape",
]

ImageShape = namedtuple("ImageShape", ["width", "height"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking out loud here...is there any way to avoid declaring ImageShape as something that needs to be imported by backends? For type hinting we could have get_shape(..) -> tuple[int, int] and then have get_shape return an ImgeShape that is defined inside of get_shape.

Or, I suppose, we could follow the Array API specification and just return a plain tuple...

Not against named tuples, but trying to think of ways to minimize the imports for backends.

@mwcraig
Copy link
Member

mwcraig commented Jul 8, 2025

Closing in favor of just getting the shape from the image since #71 added a way to get the image

@mwcraig mwcraig closed this Jul 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants