Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix: show labels on segmentation images with trivial dimensions #4368

Merged
merged 1 commit into from
Nov 29, 2023
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
3 changes: 2 additions & 1 deletion crates/re_data_ui/src/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,8 @@ fn tensor_pixel_value_ui(
ui.label(format!("{x}, {y}"));
ui.end_row();

if tensor.num_dim() == 2 {
// Check for annotations on any single-channel image
if let Some([_, _, 1]) = tensor.image_height_width_channels() {
if let Some(raw_value) = tensor.get(&[y, x]) {
if let (TensorDataMeaning::ClassId, Some(u16_val)) =
(meaning, raw_value.try_as_u16())
Expand Down
4 changes: 2 additions & 2 deletions crates/re_types/src/datatypes/tensor_data_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ impl TensorData {
2 => Some([shape_short[0].size, shape_short[1].size, 1]),
3 => {
let channels = shape_short[2].size;
if matches!(channels, 3 | 4) {
// rgb, rgba
if matches!(channels, 1 | 3 | 4) {
// mono, rgb, rgba
Some([shape_short[0].size, shape_short[1].size, channels])
} else {
None
Expand Down
Loading