1212from PIL import Image
1313
1414from t4_devkit .common .geometry import view_points
15- from t4_devkit .common .timestamp import sec2us , us2sec
15+ from t4_devkit .common .timestamp import microseconds2seconds , seconds2microseconds
1616from t4_devkit .dataclass import LidarPointCloud , RadarPointCloud
1717from t4_devkit .schema import SensorModality
1818from t4_devkit .viewer import (
@@ -126,7 +126,7 @@ def render_scene(
126126
127127 scene : Scene = self ._t4 .scene [0 ]
128128 first_sample : Sample = self ._t4 .get ("sample" , scene .first_sample_token )
129- max_timestamp_us = first_sample .timestamp + sec2us (max_time_seconds )
129+ max_timestamp_us = first_sample .timestamp + seconds2microseconds (max_time_seconds )
130130
131131 concurrent .futures .wait (
132132 self ._render_lidar_and_ego (
@@ -295,7 +295,9 @@ def render_pointcloud(
295295 raise ValueError ("There is no 3D pointcloud data." )
296296
297297 first_lidar_sample_data : Sample = self ._t4 .get ("sample_data" , first_lidar_token )
298- max_timestamp_us = first_lidar_sample_data .timestamp + sec2us (max_time_seconds )
298+ max_timestamp_us = first_lidar_sample_data .timestamp + seconds2microseconds (
299+ max_time_seconds
300+ )
299301
300302 concurrent .futures .wait (
301303 self ._render_lidar_and_ego (
@@ -354,7 +356,7 @@ def _render_single_lidar(first_lidar_token: str) -> None:
354356 osp .join (self ._t4 .data_root , sample_data .filename )
355357 )
356358 viewer .render_pointcloud (
357- seconds = us2sec (sample_data .timestamp ),
359+ seconds = microseconds2seconds (sample_data .timestamp ),
358360 channel = sample_data .channel ,
359361 pointcloud = pointcloud ,
360362 color_mode = color_mode ,
@@ -384,7 +386,7 @@ def _render_single_radar(first_radar_token: str) -> None:
384386 osp .join (self ._t4 .data_root , sample_data .filename )
385387 )
386388 viewer .render_pointcloud (
387- seconds = us2sec (sample_data .timestamp ),
389+ seconds = microseconds2seconds (sample_data .timestamp ),
388390 channel = sample_data .channel ,
389391 pointcloud = pointcloud ,
390392 )
@@ -410,7 +412,7 @@ def _render_single_camera(first_camera_token: str) -> None:
410412 break
411413
412414 viewer .render_image (
413- seconds = us2sec (sample_data .timestamp ),
415+ seconds = microseconds2seconds (sample_data .timestamp ),
414416 camera = sample_data .channel ,
415417 image = osp .join (self ._t4 .data_root , sample_data .filename ),
416418 )
@@ -455,7 +457,7 @@ def _render_points_on_single_camera(camera: str) -> None:
455457 color_mode = color_mode ,
456458 )
457459
458- rr .set_time_seconds (ViewerConfig .timeline , us2sec (sample .timestamp ))
460+ rr .set_time_seconds (ViewerConfig .timeline , microseconds2seconds (sample .timestamp ))
459461
460462 rr .log (format_entity (ViewerConfig .ego_entity , camera ), rr .Image (image ))
461463 rr .log (
@@ -582,7 +584,7 @@ def _render_annotation3ds(
582584 self ._t4 .get_box3d (token , future_seconds = future_seconds )
583585 for token in sample .ann_3ds
584586 ]
585- viewer .render_box3ds (us2sec (sample .timestamp ), boxes )
587+ viewer .render_box3ds (microseconds2seconds (sample .timestamp ), boxes )
586588
587589 current_sample_token = sample .next
588590
@@ -636,7 +638,7 @@ def _render_annotation2ds(
636638 )
637639
638640 # Render 2D box
639- viewer .render_box2ds (us2sec (sample .timestamp ), boxes )
641+ viewer .render_box2ds (microseconds2seconds (sample .timestamp ), boxes )
640642
641643 if instance_tokens is None :
642644 # Surface Annotation
@@ -655,7 +657,7 @@ def _render_annotation2ds(
655657 # Render 2D segmentation image
656658 for camera , data in camera_masks .items ():
657659 viewer .render_segmentation2d (
658- seconds = us2sec (sample .timestamp ), camera = camera , ** data
660+ seconds = microseconds2seconds (sample .timestamp ), camera = camera , ** data
659661 )
660662
661663 # TODO: add support of rendering keypoints
0 commit comments