Skip to content

Commit

Permalink
post-rebase cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Sep 6, 2023
1 parent cf8c513 commit 06f10da
Show file tree
Hide file tree
Showing 16 changed files with 12 additions and 43 deletions.
2 changes: 1 addition & 1 deletion crates/re_types/source_hash.txt

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

4 changes: 2 additions & 2 deletions crates/re_types/src/archetypes/image.rs

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

2 changes: 1 addition & 1 deletion docs/code-examples/annotation_context_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
# Log an annotation context to assign a label and color to each class
rr2.log("segmentation", rr2.AnnotationContext([(1, "red", (255, 0, 0)), (2, "green", (0, 255, 0))]))

rr.log_segmentation_image("segmentation/image", np.array(image), tensor_id=np.repeat(0, 16).astype(np.uint8))
rr.log_segmentation_image("segmentation/image", np.array(image))
2 changes: 0 additions & 2 deletions docs/code-examples/annotation_context_segmentation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use rerun::{
archetypes::AnnotationContext,
components::{Tensor, TensorDataMeaning},
datatypes::Color,
external::uuid,
RecordingStreamBuilder,
};

Expand All @@ -20,7 +19,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {

let mut image = Tensor::try_from(data.as_standard_layout().view())?;
image.meaning = TensorDataMeaning::ClassId;
image.tensor_id = uuid::Uuid::nil().into();

// create an annotation context to describe the classes
rec.log(
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/depth_image_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
)

# Log the tensor, assigning names to each dimension
rr.log_depth_image("world/camera/depth", image, tensor_id=np.repeat(0, 16).astype(np.uint8), meter=10000.0)
rr.log_depth_image("world/camera/depth", image, meter=10000.0)
2 changes: 0 additions & 2 deletions docs/code-examples/depth_image_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ use ndarray::{s, Array, ShapeBuilder};
use rerun::{
components::{Pinhole, Tensor, TensorDataMeaning},
datatypes::Mat3x3,
external::uuid,
RecordingStreamBuilder,
};

Expand All @@ -18,7 +17,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut tensor = Tensor::try_from(image.as_standard_layout().view())?;
tensor.meaning = TensorDataMeaning::Depth;
tensor.meter = Some(10000.);
tensor.tensor_id = uuid::Uuid::nil().into();

// If we log a pinhole camera model, the depth gets automatically back-projected to 3D
// TODO(#2816): Pinhole archetype
Expand Down
2 changes: 1 addition & 1 deletion docs/code-examples/depth_image_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
rr.init("rerun_example_depth_image", spawn=True)

# Log the tensor, assigning names to each dimension
rr.log_depth_image("depth", image, tensor_id=np.repeat(0, 16).astype(np.uint8), meter=10000.0)
rr.log_depth_image("depth", image, meter=10000.0)
2 changes: 0 additions & 2 deletions docs/code-examples/depth_image_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use ndarray::{s, Array, ShapeBuilder};
use rerun::{
components::{Tensor, TensorDataMeaning},
external::uuid,
RecordingStreamBuilder,
};

Expand All @@ -17,7 +16,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut tensor = Tensor::try_from(image.as_standard_layout().view())?;
tensor.meaning = TensorDataMeaning::Depth;
tensor.meter = Some(10000.);
tensor.tensor_id = uuid::Uuid::nil().into();

// TODO(#2792): Image archetype
rec.log_component_lists("depth", false, 1, [&tensor as _])?;
Expand Down
4 changes: 2 additions & 2 deletions docs/code-examples/image_simple.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Create and log an image
use ndarray::{s, Array, ShapeBuilder};
use rerun::{archetypes::Image, external::uuid, RecordingStreamBuilder};
use rerun::{archetypes::Image, RecordingStreamBuilder};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let (rec, storage) = RecordingStreamBuilder::new("rerun_example_image_simple").memory()?;
Expand All @@ -11,7 +11,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
image.slice_mut(s![50..150, 50..150, 0]).fill(0);
image.slice_mut(s![50..150, 50..150, 1]).fill(255);

rec.log("image", &Image::try_from(image)?.with_id(uuid::Uuid::nil()))?;
rec.log("image", &Image::try_from(image)?)?;

rerun::native_viewer::show(storage.take())?;
Ok(())
Expand Down
1 change: 0 additions & 1 deletion docs/code-examples/mesh_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,4 @@
[0, 255, 0],
[0, 0, 255],
],
mesh_id=np.repeat(0, 16).astype(np.uint8),
)
2 changes: 1 addition & 1 deletion docs/code-examples/segmentation_image_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
rr2.log("/", rr2.AnnotationContext([(1, "red", (255, 0, 0)), (2, "green", (0, 255, 0))]))

# TODO(#2792): SegmentationImage archetype
rr.log_segmentation_image("image", np.array(image), tensor_id=np.repeat(0, 16).astype(np.uint8))
rr.log_segmentation_image("image", np.array(image))
2 changes: 0 additions & 2 deletions docs/code-examples/segmentation_image_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use rerun::{
archetypes::AnnotationContext,
components::{Tensor, TensorDataMeaning},
datatypes::Color,
external::uuid,
RecordingStreamBuilder,
};

Expand All @@ -21,7 +20,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
// TODO(#2792): SegmentationImage archetype
let mut tensor = Tensor::try_from(image.as_standard_layout().view())?;
tensor.meaning = TensorDataMeaning::ClassId;
tensor.tensor_id = uuid::Uuid::nil().into();

// create an annotation context to describe the classes
let annotation = AnnotationContext::new([
Expand Down
11 changes: 0 additions & 11 deletions rerun_py/rerun_sdk/rerun/log/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ def log_depth_image(
*,
draw_order: float | None = None,
meter: float | None = None,
tensor_id: npt.NDArray[np.uint8] | None = None,
ext: dict[str, Any] | None = None,
timeless: bool = False,
recording: RecordingStream | None = None,
Expand Down Expand Up @@ -158,9 +157,6 @@ def log_depth_image(
How long is a meter in the given dtype?
For instance: with uint16, perhaps meter=1000 which would mean
you have millimeter precision and a range of up to ~65 meters (2^16 / 1000).
tensor_id:
A unique UUID for this tensor.
Leave empty to autogenerate a random one.
ext:
Optional dictionary of extension components. See [rerun.log_extension_components][]
timeless:
Expand Down Expand Up @@ -199,7 +195,6 @@ def log_depth_image(
image,
draw_order=draw_order,
meter=meter,
tensor_id=tensor_id,
ext=ext,
timeless=timeless,
meaning=bindings.TensorDataMeaning.Depth,
Expand All @@ -213,7 +208,6 @@ def log_segmentation_image(
image: npt.ArrayLike,
*,
draw_order: float | None = None,
tensor_id: npt.NDArray[np.uint8] | None = None,
ext: dict[str, Any] | None = None,
timeless: bool = False,
recording: RecordingStream | None = None,
Expand All @@ -240,9 +234,6 @@ def log_segmentation_image(
An optional floating point value that specifies the 2D drawing order.
Objects with higher values are drawn on top of those with lower values.
The default for images is -10.0.
tensor_id:
A unique UUID for this tensor.
Leave empty to autogenerate a random one.
ext:
Optional dictionary of extension components. See [rerun.log_extension_components][]
timeless:
Expand Down Expand Up @@ -272,7 +263,6 @@ def log_segmentation_image(
entity_path,
tensor=image,
draw_order=draw_order,
tensor_id=tensor_id,
ext=ext,
timeless=timeless,
recording=recording,
Expand All @@ -286,7 +276,6 @@ def log_segmentation_image(
tensor=image,
draw_order=draw_order,
meaning=bindings.TensorDataMeaning.ClassId,
tensor_id=tensor_id,
ext=ext,
timeless=timeless,
recording=recording,
Expand Down
7 changes: 0 additions & 7 deletions rerun_py/rerun_sdk/rerun/log/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def log_mesh(
normals: Any | None = None,
albedo_factor: Any | None = None,
vertex_colors: Colors | None = None,
mesh_id: npt.NDArray[np.uint8] | None = None,
timeless: bool = False,
recording: RecordingStream | None = None,
) -> None:
Expand Down Expand Up @@ -74,9 +73,6 @@ def log_mesh(
vertex_colors:
Optional array of RGB(A) vertex colors, in sRGB gamma space, either as 0-1 floats or 0-255 integers.
If specified, the alpha is considered separate (unmultiplied).
mesh_id:
A unique UUID for this mesh.
Leave empty to autogenerate a random one.
timeless:
If true, the mesh will be timeless (default: False)
recording:
Expand All @@ -97,8 +93,6 @@ def log_mesh(
albedo_factor = np.asarray(albedo_factor, dtype=np.float32).flatten()
if vertex_colors is not None:
vertex_colors = _normalize_colors(vertex_colors)
if mesh_id is not None:
mesh_id = np.asarray(mesh_id, dtype=np.uint8)

# Mesh arrow handling happens inside the python bridge
bindings.log_meshes(
Expand All @@ -108,7 +102,6 @@ def log_mesh(
index_buffers=[indices],
normal_buffers=[normals],
albedo_factors=[albedo_factor],
mesh_ids=[mesh_id],
timeless=timeless,
recording=recording,
)
Expand Down
3 changes: 1 addition & 2 deletions rerun_py/rerun_sdk/rerun/log/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ def _log_tensor(
names: Iterable[str | None] | None = None,
meter: float | None = None,
meaning: bindings.TensorDataMeaning = None,
tensor_id: npt.NDArray[np.uint8] | None = None,
ext: dict[str, Any] | None = None,
timeless: bool = False,
recording: RecordingStream | None = None,
Expand Down Expand Up @@ -140,7 +139,7 @@ def _log_tensor(
instanced: dict[str, Any] = {}
splats: dict[str, Any] = {}

instanced["rerun.tensor"] = TensorArray.from_numpy(tensor, names, meaning, meter, tensor_id=tensor_id)
instanced["rerun.tensor"] = TensorArray.from_numpy(tensor, names, meaning, meter)

if draw_order is not None:
instanced["rerun.draw_order"] = DrawOrderArray.splat(draw_order)
Expand Down
7 changes: 2 additions & 5 deletions rerun_py/src/python_bridge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,6 @@ fn log_meshes(
index_buffers: Vec<Option<numpy::PyReadonlyArray1<'_, u32>>>,
normal_buffers: Vec<Option<numpy::PyReadonlyArray1<'_, f32>>>,
albedo_factors: Vec<Option<numpy::PyReadonlyArray1<'_, f32>>>,
mesh_ids: Vec<Option<numpy::PyReadonlyArray1<'_, u8>>>,
timeless: bool,
recording: Option<&PyRecordingStream>,
) -> PyResult<()> {
Expand All @@ -824,25 +823,23 @@ fn log_meshes(
{
return Err(PyTypeError::new_err(format!(
"Top-level position/index/normal/albedo/id buffer arrays must be same the length, \
got positions={}, vertex_colors={}, indices={}, normals={}, albedo={}, mesh_id={} instead",
got positions={}, vertex_colors={}, indices={}, normals={}, albedo={} instead",
position_buffers.len(),
vertex_color_buffers.len(),
index_buffers.len(),
normal_buffers.len(),
albedo_factors.len(),
mesh_ids.len(),
)));
}

let mut meshes = Vec::with_capacity(position_buffers.len());

for (vertex_positions, vertex_colors, indices, normals, albedo_factor, mesh_id) in izip!(
for (vertex_positions, vertex_colors, indices, normals, albedo_factor) in izip!(
position_buffers,
vertex_color_buffers,
index_buffers,
normal_buffers,
albedo_factors,
mesh_ids,
) {
let albedo_factor =
if let Some(v) = albedo_factor.map(|albedo_factor| albedo_factor.as_array().to_vec()) {
Expand Down

0 comments on commit 06f10da

Please sign in to comment.