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

Tensor & depth image value ranges can now be configured, from UI & code #7549

Merged
merged 22 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
1dac136
add value/depth ranges to depth image and tensor
Wumpf Sep 27, 2024
a34a744
implement usage of value_display_range on tensor
Wumpf Sep 27, 2024
0e09854
depth images pass now custom configured colormap range through
Wumpf Sep 30, 2024
bd094e4
always use 0.0 as default for depth image range again, fix depth_clou…
Wumpf Sep 30, 2024
ffcb8f3
finite range is now always available
Wumpf Sep 30, 2024
fe4827c
rename depth_display_range -> depth_range, value_display_range -> val…
Wumpf Sep 30, 2024
0268144
update python tensor ctor
Wumpf Sep 30, 2024
cc33052
update/fix python depth_image ctor and fix field ordering
Wumpf Sep 30, 2024
9944bab
update signed distance field to use cyantoyellow colormap and a symme…
Wumpf Sep 30, 2024
debdae8
enhance python depth image test a bit
Wumpf Sep 30, 2024
cf352cf
Introduce new ValueRange component in favor of Range1D for tensor & d…
Wumpf Sep 30, 2024
dc0d542
fix python lints
Wumpf Sep 30, 2024
a783430
fix depth image test
Wumpf Sep 30, 2024
33b7fc3
fbs doc improvements
Wumpf Oct 1, 2024
fc58580
sorting
Wumpf Oct 1, 2024
76eb0db
ColormapWithMappingRange -> ColormapWithRange
Wumpf Oct 1, 2024
b3c6914
some simplifications on query
Wumpf Oct 1, 2024
5fc77e8
use min/max values on TensorDataType/ChannelDatatype instead of speci…
Wumpf Oct 1, 2024
65e27c2
python doc improvements
Wumpf Oct 1, 2024
32ce3b0
improve range determination in log_volumetric_sdf
Wumpf Oct 1, 2024
0d78459
cargo fmt
Wumpf Oct 1, 2024
90eb9fd
fix missing `ValueRangeBatch` entry on check_all_components_ui.py
Wumpf Oct 1, 2024
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
1 change: 1 addition & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5572,6 +5572,7 @@ dependencies = [
"re_chunk_store",
"re_data_ui",
"re_log_types",
"re_query",
"re_renderer",
"re_space_view",
"re_tracing",
Expand Down
19 changes: 16 additions & 3 deletions crates/store/re_types/definitions/rerun/archetypes/depth_image.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace rerun.archetypes;
///
/// Each pixel corresponds to a depth value in units specified by [components.DepthMeter].
///
/// \cpp Since the underlying `rerun::datatypes::TensorData` uses `rerun::Collection` internally,
/// \cpp Since the underlying `rerun::datatypes::ImageBuffer` uses `rerun::Collection` internally,
/// \cpp data can be passed in without a copy from raw pointers or by reference from `std::vector`/`std::array`/c-arrays.
/// \cpp If needed, this "borrow-behavior" can be extended by defining your own `rerun::CollectionAdapter`.
///
Expand Down Expand Up @@ -41,17 +41,30 @@ table DepthImage (
/// If not set, the depth image will be rendered using the Turbo colormap.
colormap: rerun.components.Colormap ("attr.rerun.component_optional", nullable, order: 3200);

/// The expected range of depth values.
///
/// This is typically the expected range of valid values.
/// Everything outside of the range is clamped to the range for the purpose of colormpaping.
/// Note that point clouds generated from this image will still display all points, regardless of this range.
///
/// If not specified, the range will be automatically estimated from the data.
/// Note that the Viewer may try to guess a wider range than the minimum/maximum of values
/// in the contents of the depth image.
/// E.g. if all values are positive, some bigger than 1.0 and all smaller than 255.0,
/// the Viewer will guess that the data likely came from an 8bit image, thus assuming a range of 0-255.
depth_range: rerun.components.ValueRange ("attr.rerun.component_optional", nullable, order: 3300);

/// Scale the radii of the points in the point cloud generated from this image.
///
/// A fill ratio of 1.0 (the default) means that each point is as big as to touch the center of its neighbor
/// if it is at the same depth, leaving no gaps.
/// A fill ratio of 0.5 means that each point touches the edge of its neighbor if it has the same depth.
///
/// TODO(#6744): This applies only to 3D views!
point_fill_ratio: rerun.components.FillRatio ("attr.rerun.component_optional", nullable, order: 3300);
point_fill_ratio: rerun.components.FillRatio ("attr.rerun.component_optional", nullable, order: 3400);
Wumpf marked this conversation as resolved.
Show resolved Hide resolved

/// An optional floating point value that specifies the 2D drawing order, used only if the depth image is shown as a 2D image.
///
/// Objects with higher values are drawn on top of those with lower values.
draw_order: rerun.components.DrawOrder ("attr.rerun.component_optional", nullable, order: 3400);
draw_order: rerun.components.DrawOrder ("attr.rerun.component_optional", nullable, order: 3500);
}
15 changes: 15 additions & 0 deletions crates/store/re_types/definitions/rerun/archetypes/tensor.fbs
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,19 @@ table Tensor (
) {
/// The tensor data
data: rerun.components.TensorData ("attr.rerun.component_required", order: 1000);

// --- Optional ---

/// The expected range of values.
///
/// This is typically the expected range of valid values.
/// Everything outside of the range is clamped to the range for the purpose of colormpaping.
/// Any colormap applied for display, will map this range.
///
/// If not specified, the range will be automatically estimated from the data.
/// Note that the Viewer may try to guess a wider range than the minimum/maximum of values
/// in the contents of the tensor.
/// E.g. if all values are positive, some bigger than 1.0 and all smaller than 255.0,
/// the Viewer will guess that the data likely came from an 8bit image, thus assuming a range of 0-255.
value_range: rerun.components.ValueRange ("attr.rerun.component_optional", nullable, order: 2000);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@ table TensorScalarMapping (
///
/// Raises the normalized values to the power of this value before mapping to color.
/// Acts like an inverse brightness. Defaults to 1.0.
///
/// The final value for display is set as:
/// `colormap( ((value - data_display_range.min) / (data_display_range.max - data_display_range.min)) ** gamma )`
gamma: rerun.components.GammaCorrection ("attr.rerun.component_optional", nullable, order: 1200);

// TODO(andreas): explicit scalar ranges should go in here as well!
// Overall we should communicate scalar mapping to work like this here
// https://matplotlib.org/stable/api/_as_gen/matplotlib.colors.PowerNorm.html#matplotlib.colors.PowerNorm
// (value - vmin) ** gamma / (vmax - vmin) ** gamma
}
1 change: 1 addition & 0 deletions crates/store/re_types/definitions/rerun/components.fbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions crates/store/re_types/definitions/rerun/components/value_range.fbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
namespace rerun.components;

// ---

/// Range of expected or valid values, specifying a lower and upper bound.
struct ValueRange (
"attr.rust.derive": "Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable",
"attr.rust.repr": "transparent"
) {
range: rerun.datatypes.Range1D (order: 100);
}
59 changes: 55 additions & 4 deletions crates/store/re_types/src/archetypes/depth_image.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/store/re_types/src/archetypes/depth_image_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ impl DepthImage {
meter: None,
colormap: None,
point_fill_ratio: None,
depth_range: None,
})
}
}
66 changes: 58 additions & 8 deletions crates/store/re_types/src/archetypes/tensor.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading