Viewer#
Viewer GUI elements for the nerfstudio viewer
- class nerfstudio.viewer.viewer_elements.ViewerButton(name: str, cb_hook: Callable[[ViewerButton], Any], disabled: bool = False, visible: bool = True)[source]#
Bases:
ViewerElement
[bool
]A button in the viewer
- Parameters:
name – The name of the button
cb_hook – The function to call when the button is pressed
disabled – If the button is disabled
visible – If the button is visible
- class nerfstudio.viewer.viewer_elements.ViewerButtonGroup(name: str, default_value: ~nerfstudio.viewer.viewer_elements.TString, options: ~typing.List[~nerfstudio.viewer.viewer_elements.TString], visible: bool = True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerDropdown], ~typing.Any] = <function ViewerButtonGroup.<lambda>>)[source]#
Bases:
ViewerParameter
[TString
],Generic
[TString
]A button group in the viewer. Unlike other fields, cannot be disabled.
- Parameters:
name – The name of the button group
visible – If the button group is visible
options – The options of the button group
cb_hook – Callback to call on update
- class nerfstudio.viewer.viewer_elements.ViewerCheckbox(name: str, default_value: bool, disabled: bool = False, visible: bool = True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerCheckbox], ~typing.Any] = <function ViewerCheckbox.<lambda>>, hint: ~typing.Optional[str] = None)[source]#
Bases:
ViewerParameter
[bool
]A checkbox in the viewer
- Parameters:
name – The name of the checkbox
default_value – The default value of the checkbox
disabled – If the checkbox is disabled
visible – If the checkbox is visible
cb_hook – Callback to call on update
hint – The hint text
- class nerfstudio.viewer.viewer_elements.ViewerClick(origin: Tuple[float, float, float], direction: Tuple[float, float, float], screen_pos: Tuple[float, float])[source]#
Bases:
object
Class representing a click in the viewer as a ray.
- direction: Tuple[float, float, float]#
The direction of the click if projected from the camera through the clicked pixel, in world coordinates
- origin: Tuple[float, float, float]#
The origin of the click in world coordinates (center of camera)
- screen_pos: Tuple[float, float]#
The screen position of the click in OpenCV screen coordinates, normalized to [0, 1]
- class nerfstudio.viewer.viewer_elements.ViewerControl[source]#
Bases:
object
class for exposing non-gui controls of the viewer to the user
- get_camera(img_height: int, img_width: int, client_id: Optional[int] = None) Optional[Cameras] [source]#
Returns the Cameras object representing the current camera for the viewer, or None if the viewer is not connected yet
- Parameters:
img_height – The height of the image to get camera intrinsics for
img_width – The width of the image to get camera intrinsics for
- register_pointer_cb(event_type: Literal['click'], cb: Callable[[ViewerClick], None], removed_cb: Optional[Callable[[], None]] = None)[source]#
- register_pointer_cb(event_type: Literal['rect-select'], cb: Callable[[ViewerRectSelect], None], removed_cb: Optional[Callable[[], None]] = None)
Add a callback which will be called when a scene pointer event is detected in the viewer. Scene pointer events include: - “click”: A click event, which includes the origin and direction of the click - “rect-select”: A rectangle selection event, which includes the screen bounds of the box selection
The callback should take a ViewerClick object as an argument if the event type is “click”, and a ViewerRectSelect object as an argument if the event type is “rect-select”.
- Parameters:
cb – The callback to call when a click or a rect-select is detected.
removed_cb – The callback to run when the pointer event is removed.
- set_crop(min_point: Tuple[float, float, float], max_point: Tuple[float, float, float])[source]#
Set the scene crop box of the viewer to the specified min,max point
- Parameters:
min_point – The minimum point of the crop box
max_point – The maximum point of the crop box
- set_fov(fov)[source]#
Set the FOV of the viewer camera
- Parameters:
fov – The new FOV of the camera in degrees
- set_pose(position: Optional[Tuple[float, float, float]] = None, look_at: Optional[Tuple[float, float, float]] = None, instant: bool = False)[source]#
Set the camera position of the viewer camera.
- Parameters:
position – The new position of the camera in world coordinates
look_at – The new look_at point of the camera in world coordinates
instant – If the camera should move instantly or animate to the new position
- class nerfstudio.viewer.viewer_elements.ViewerDropdown(name: str, default_value: ~nerfstudio.viewer.viewer_elements.TString, options: ~typing.List[~nerfstudio.viewer.viewer_elements.TString], disabled: bool = False, visible: bool = True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerDropdown], ~typing.Any] = <function ViewerDropdown.<lambda>>, hint: ~typing.Optional[str] = None)[source]#
Bases:
ViewerParameter
[TString
],Generic
[TString
]A dropdown in the viewer
- Parameters:
name – The name of the dropdown
default_value – The default value of the dropdown
options – The options of the dropdown
disabled – If the dropdown is disabled
visible – If the dropdown is visible
cb_hook – Callback to call on update
hint – The hint text
- class nerfstudio.viewer.viewer_elements.ViewerElement(name: str, disabled: bool = False, visible: bool = True, cb_hook: ~typing.Callable = <function ViewerElement.<lambda>>)[source]#
Bases:
Generic
[TValue
]Base class for all viewer elements
- Parameters:
name – The name of the element
disabled – If the element is disabled
visible – If the element is visible
- abstract install(viser_server: ViserServer) None [source]#
Installs the gui element into the given viser_server
Sets the hidden state of the gui element
- class nerfstudio.viewer.viewer_elements.ViewerNumber(name: str, default_value: ~nerfstudio.viewer.viewer_elements.IntOrFloat, disabled: bool = False, visible: bool = True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerNumber], ~typing.Any] = <function ViewerNumber.<lambda>>, hint: ~typing.Optional[str] = None)[source]#
Bases:
ViewerParameter
[IntOrFloat
],Generic
[IntOrFloat
]A number field in the viewer
- Parameters:
name – The name of the number field
default_value – The default value of the number field
disabled – If the number field is disabled
visible – If the number field is visible
cb_hook – Callback to call on update
hint – The hint text
- class nerfstudio.viewer.viewer_elements.ViewerParameter(name: str, default_value: ~nerfstudio.viewer.viewer_elements.TValue, disabled: bool = False, visible: bool = True, cb_hook: ~typing.Callable = <function ViewerParameter.<lambda>>)[source]#
Bases:
ViewerElement
[TValue
],Generic
[TValue
]A viewer element with state
- Parameters:
name – The name of the element
default_value – The default value of the element
disabled – If the element is disabled
visible – If the element is visible
cb_hook – Callback to call on update
- install(viser_server: ViserServer) None [source]#
Based on the type provided by default_value, installs a gui element inside the given viser_server
- Parameters:
viser_server – The server to install the gui element into.
- property value: TValue#
Returns the current value of the viewer element
- class nerfstudio.viewer.viewer_elements.ViewerRGB(name, default_value: ~typing.Tuple[int, int, int], disabled=False, visible=True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerRGB], ~typing.Any] = <function ViewerRGB.<lambda>>, hint: ~typing.Optional[str] = None)[source]#
Bases:
ViewerParameter
[Tuple
[int
,int
,int
]]An RGB color picker for the viewer
- Parameters:
name – The name of the color picker
default_value – The default value of the color picker
disabled – If the color picker is disabled
visible – If the color picker is visible
cb_hook – Callback to call on update
hint – The hint text
- class nerfstudio.viewer.viewer_elements.ViewerRectSelect(min_bounds: Tuple[float, float], max_bounds: Tuple[float, float])[source]#
Bases:
object
Class representing a rectangle selection in the viewer (screen-space).
The screen coordinates follow OpenCV image coordinates, with the origin at the top-left corner, but the bounds are also normalized to [0, 1] in both dimensions.
- max_bounds: Tuple[float, float]#
The maximum bounds of the rectangle selection in screen coordinates.
- min_bounds: Tuple[float, float]#
The minimum bounds of the rectangle selection in screen coordinates.
- class nerfstudio.viewer.viewer_elements.ViewerSlider(name: str, default_value: ~nerfstudio.viewer.viewer_elements.IntOrFloat, min_value: ~nerfstudio.viewer.viewer_elements.IntOrFloat, max_value: ~nerfstudio.viewer.viewer_elements.IntOrFloat, step: ~nerfstudio.viewer.viewer_elements.IntOrFloat = 0.1, disabled: bool = False, visible: bool = True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerSlider], ~typing.Any] = <function ViewerSlider.<lambda>>, hint: ~typing.Optional[str] = None)[source]#
Bases:
ViewerParameter
[IntOrFloat
],Generic
[IntOrFloat
]A slider in the viewer
- Parameters:
name – The name of the slider
default_value – The default value of the slider
min_value – The minimum value of the slider
max_value – The maximum value of the slider
step – The step size of the slider
disabled – If the slider is disabled
visible – If the slider is visible
cb_hook – Callback to call on update
hint – The hint text
- class nerfstudio.viewer.viewer_elements.ViewerText(name: str, default_value: str, disabled: bool = False, visible: bool = True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerText], ~typing.Any] = <function ViewerText.<lambda>>, hint: ~typing.Optional[str] = None)[source]#
Bases:
ViewerParameter
[str
]A text field in the viewer
- Parameters:
name – The name of the text field
default_value – The default value of the text field
disabled – If the text field is disabled
visible – If the text field is visible
cb_hook – Callback to call on update
hint – The hint text
- class nerfstudio.viewer.viewer_elements.ViewerVec3(name, default_value: ~typing.Tuple[float, float, float], step=0.1, disabled=False, visible=True, cb_hook: ~typing.Callable[[~nerfstudio.viewer.viewer_elements.ViewerVec3], ~typing.Any] = <function ViewerVec3.<lambda>>, hint: ~typing.Optional[str] = None)[source]#
Bases:
ViewerParameter
[Tuple
[float
,float
,float
]]3 number boxes in a row to input a vector
- Parameters:
name – The name of the vector
default_value – The default value of the vector
step – The step of the vector
disabled – If the vector is disabled
visible – If the vector is visible
cb_hook – Callback to call on update
hint – The hint text