Viewer#

Viewer GUI elements for the nerfstudio viewer

class nerfstudio.viewer.server.viewer_elements.ViewerButton(name: str, cb_hook: Callable[[ViewerButton], Any], disabled: bool = False)[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

install(viser_server: ViserServer) None[source]#

Installs the gui element into the given viser_server

class nerfstudio.viewer.server.viewer_elements.ViewerButtonGroup(name: str, default_value: ~nerfstudio.viewer.server.viewer_elements.TString, options: ~typing.List[~nerfstudio.viewer.server.viewer_elements.TString], cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • default_value – The default value of the button group

  • options – The options of the button group

  • cb_hook – Callback to call on update

class nerfstudio.viewer.server.viewer_elements.ViewerCheckbox(name: str, default_value: bool, disabled: bool = False, cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • cb_hook – Callback to call on update

  • hint – The hint text

class nerfstudio.viewer.server.viewer_elements.ViewerClick(origin: Tuple[float, float, float], direction: Tuple[float, 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)

class nerfstudio.viewer.server.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) 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

on_click(msg: ClickMessage)[source]#

Internal use only, register a click in the viewer which propagates to all self.click_cbs

register_click_cb(cb: Callable)[source]#

Add a callback which will be called when a click is detected in the viewer.

Parameters:

cb – The callback to call when a click is detected. The callback should take a ViewerClick object as an argument

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.server.viewer_elements.ViewerDropdown(name: str, default_value: ~nerfstudio.viewer.server.viewer_elements.TString, options: ~typing.List[~nerfstudio.viewer.server.viewer_elements.TString], disabled: bool = False, cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • cb_hook – Callback to call on update

  • hint – The hint text

set_options(new_options: List[TString]) None[source]#

Sets the options of the dropdown,

Parameters:

new_options – The new options. If the current option isn’t in the new options, the first option is selected.

class nerfstudio.viewer.server.viewer_elements.ViewerElement(name: str, disabled: bool = False, 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

abstract install(viser_server: ViserServer) None[source]#

Installs the gui element into the given viser_server

remove() None[source]#

Removes the gui element from the viewer

set_disabled(disabled: bool) None[source]#

Sets the disabled state of the gui element

set_hidden(hidden: bool) None[source]#

Sets the hidden state of the gui element

class nerfstudio.viewer.server.viewer_elements.ViewerNumber(name: str, default_value: ~nerfstudio.viewer.server.viewer_elements.IntOrFloat, disabled: bool = False, cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • cb_hook – Callback to call on update

  • hint – The hint text

class nerfstudio.viewer.server.viewer_elements.ViewerParameter(name: str, default_value: ~nerfstudio.viewer.server.viewer_elements.TValue, disabled: bool = False, 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

  • 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.server.viewer_elements.ViewerRGB(name, default_value: ~typing.Tuple[int, int, int], disabled=False, cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • cb_hook – Callback to call on update

  • hint – The hint text

class nerfstudio.viewer.server.viewer_elements.ViewerSlider(name: str, default_value: ~nerfstudio.viewer.server.viewer_elements.IntOrFloat, min_value: ~nerfstudio.viewer.server.viewer_elements.IntOrFloat, max_value: ~nerfstudio.viewer.server.viewer_elements.IntOrFloat, step: ~nerfstudio.viewer.server.viewer_elements.IntOrFloat = 0.1, disabled: bool = False, cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • cb_hook – Callback to call on update

  • hint – The hint text

class nerfstudio.viewer.server.viewer_elements.ViewerText(name: str, default_value: str, disabled: bool = False, cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • cb_hook – Callback to call on update

  • hint – The hint text

class nerfstudio.viewer.server.viewer_elements.ViewerVec3(name, default_value: ~typing.Tuple[float, float, float], step=0.1, disabled=False, cb_hook: ~typing.Callable[[~nerfstudio.viewer.server.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

  • cb_hook – Callback to call on update

  • hint – The hint text